From: Cris Di Sclafani Date: Thu, 27 Aug 2020 13:39:19 +0000 (+0200) Subject: Built motion from commit (unavailable).|2.5.0 X-Git-Url: http://repos.xcallymotion.com/base//%22angular-material.themes.css/%22?a=commitdiff_plain;h=a3f0e0b687435b4bdcc7c9799fa02e23fe1c4a9a;p=motion2.git Built motion from commit (unavailable).|2.5.0 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index b55400f..152f1c6 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-27T12:35:16.867Z", "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:32:09.648Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 8c95a2b..d21120f 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-27T12:35:16.867Z", "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:32:09.648Z", "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 2775ca2..b53a77a 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 _0x3451=['motionbar[NULL,NULL,WinAppArguments]','TEXT','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'];(function(_0x562faf,_0x102bcc){var _0x22c1f6=function(_0x2cd3b8){while(--_0x2cd3b8){_0x562faf['push'](_0x562faf['shift']());}};_0x22c1f6(++_0x102bcc);}(_0x3451,0x112));var _0x1345=function(_0x417d76,_0x2812c5){_0x417d76=_0x417d76-0x0;var _0x422ff9=_0x3451[_0x417d76];return _0x422ff9;};'use strict';var Sequelize=require('sequelize');module[_0x1345('0x0')]={'name':{'type':Sequelize[_0x1345('0x1')],'get':function(_0x9eb166){return this[_0x1345('0x2')](_0x1345('0x3'));}},'action':{'type':Sequelize[_0x1345('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x1345('0x5'),_0x1345('0x6'),_0x1345('0x7'),_0x1345('0x8'),'urlForward',_0x1345('0x9'),_0x1345('0xa'),'script']],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x1345('0xb')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x1345('0xc')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x1345('0xd')},'data3':{'type':Sequelize[_0x1345('0x4')](0x1000),'comment':_0x1345('0xe')},'data4':{'type':Sequelize[_0x1345('0x4')](0x1000)},'data5':{'type':Sequelize[_0x1345('0x4')](0x1000)},'data6':{'type':Sequelize[_0x1345('0x4')]},'data7':{'type':Sequelize[_0x1345('0xf')]}}; \ No newline at end of file +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 diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 9ebd0f4..d932bc8 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 _0xc8ca=['offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','body','Action','find','params','catch','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json'];(function(_0x2d9a23,_0x481dc4){var _0x5198ee=function(_0x27d373){while(--_0x27d373){_0x2d9a23['push'](_0x2d9a23['shift']());}};_0x5198ee(++_0x481dc4);}(_0xc8ca,0x120));var _0xac8c=function(_0x7d286f,_0x1677de){_0x7d286f=_0x7d286f-0x0;var _0x3748cf=_0xc8ca[_0x7d286f];return _0x3748cf;};'use strict';var pdf=require(_0xac8c('0x0'));var emlformat=require(_0xac8c('0x1'));var rimraf=require(_0xac8c('0x2'));var zipdir=require(_0xac8c('0x3'));var jsonpatch=require(_0xac8c('0x4'));var rp=require(_0xac8c('0x5'));var moment=require(_0xac8c('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xac8c('0x7'));var util=require(_0xac8c('0x8'));var path=require(_0xac8c('0x9'));var sox=require('sox');var csv=require(_0xac8c('0xa'));var ejs=require(_0xac8c('0xb'));var fs=require('fs');var _=require(_0xac8c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xac8c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xac8c('0xa'));var querystring=require(_0xac8c('0xe'));var Papa=require(_0xac8c('0xf'));var Redis=require('ioredis');var authService=require(_0xac8c('0x10'));var qs=require(_0xac8c('0x11'));var as=require(_0xac8c('0x12'));var hardwareService=require(_0xac8c('0x13'));var logger=require(_0xac8c('0x14'))(_0xac8c('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xac8c('0x16'))['db'];function respondWithStatusCode(_0x4c2a03,_0x7efa66){_0x7efa66=_0x7efa66||0xcc;return function(_0x3fd715){if(_0x3fd715){return _0x4c2a03[_0xac8c('0x17')](_0x7efa66);}return _0x4c2a03[_0xac8c('0x18')](_0x7efa66)[_0xac8c('0x19')]();};}function respondWithResult(_0x55e4b9,_0x9fab10){_0x9fab10=_0x9fab10||0xc8;return function(_0x136f3e){if(_0x136f3e){return _0x55e4b9['status'](_0x9fab10)[_0xac8c('0x1a')](_0x136f3e);}};}function respondWithFilteredResult(_0x47c8ae,_0x32c9bb){return function(_0x3726b1){if(_0x3726b1){var _0x67b829=_0x3726b1['count'],_0x20384c=_0x32c9bb[_0xac8c('0x1b')],_0x3612c1=_0x32c9bb[_0xac8c('0x1b')]+_0x32c9bb[_0xac8c('0x1c')],_0x56ceae;if(_0x3612c1>=_0x67b829){_0x3612c1=_0x67b829;_0x56ceae=0xc8;}else{_0x56ceae=0xce;}_0x47c8ae[_0xac8c('0x18')](_0x56ceae);return _0x47c8ae[_0xac8c('0x1d')](_0xac8c('0x1e'),_0x20384c+'-'+_0x3612c1+'/'+_0x67b829)[_0xac8c('0x1a')](_0x3726b1);}return null;};}function patchUpdates(_0x27c2d2){return function(_0xab71a2){try{jsonpatch[_0xac8c('0x1f')](_0xab71a2,_0x27c2d2,!![]);}catch(_0x41a524){return BPromise[_0xac8c('0x20')](_0x41a524);}return _0xab71a2[_0xac8c('0x21')]();};}function saveUpdates(_0x488f7c,_0x11b343){return function(_0x121ab9){if(_0x121ab9){return _0x121ab9[_0xac8c('0x22')](_0x488f7c)[_0xac8c('0x23')](function(_0x78828){return _0x78828;});}return null;};}function removeEntity(_0x21e294,_0x2d4911){return function(_0x570425){if(_0x570425){return _0x570425['destroy']()['then'](function(){_0x21e294[_0xac8c('0x18')](0xcc)[_0xac8c('0x19')]();});}};}function handleEntityNotFound(_0x68d6ef,_0x3db608){return function(_0x41a93d){if(!_0x41a93d){_0x68d6ef[_0xac8c('0x17')](0x194);}return _0x41a93d;};}function handleError(_0x63aa43,_0x5edbd6){_0x5edbd6=_0x5edbd6||0x1f4;return function(_0x421517){logger[_0xac8c('0x24')](_0x421517[_0xac8c('0x25')]);if(_0x421517[_0xac8c('0x26')]){delete _0x421517['name'];}_0x63aa43[_0xac8c('0x18')](_0x5edbd6)['send'](_0x421517);};}exports[_0xac8c('0x22')]=function(_0x4c36e1,_0x3d702f){if(_0x4c36e1['body']['id']){delete _0x4c36e1[_0xac8c('0x27')]['id'];}return db[_0xac8c('0x28')][_0xac8c('0x29')]({'where':{'id':_0x4c36e1[_0xac8c('0x2a')]['id']}})[_0xac8c('0x23')](handleEntityNotFound(_0x3d702f,null))['then'](saveUpdates(_0x4c36e1[_0xac8c('0x27')],null))[_0xac8c('0x23')](respondWithResult(_0x3d702f,null))[_0xac8c('0x2b')](handleError(_0x3d702f,null));};exports[_0xac8c('0x2c')]=function(_0x410435,_0x1e5785){return db[_0xac8c('0x28')][_0xac8c('0x29')]({'where':{'id':_0x410435[_0xac8c('0x2a')]['id']}})[_0xac8c('0x23')](handleEntityNotFound(_0x1e5785,null))['then'](removeEntity(_0x1e5785,null))[_0xac8c('0x2b')](handleError(_0x1e5785,null));}; \ No newline at end of file +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 diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 603feb9..4195359 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 _0x7cb7=['./action.attributes','exports','define','Action','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x7cb7,0xa0));var _0x77cb=function(_0x392551,_0x3aaa6f){_0x392551=_0x392551-0x0;var _0x468413=_0x7cb7[_0x392551];return _0x468413;};'use strict';var _=require('lodash');var util=require(_0x77cb('0x0'));var logger=require(_0x77cb('0x1'))(_0x77cb('0x2'));var moment=require(_0x77cb('0x3'));var BPromise=require(_0x77cb('0x4'));var rp=require(_0x77cb('0x5'));var fs=require('fs');var path=require(_0x77cb('0x6'));var rimraf=require(_0x77cb('0x7'));var config=require(_0x77cb('0x8'));var attributes=require(_0x77cb('0x9'));module[_0x77cb('0xa')]=function(_0x5a4242,_0x54a133){return _0x5a4242[_0x77cb('0xb')](_0x77cb('0xc'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 52e15d4..2be670d 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x5bd044,_0xafd5fa){var _0x582fd7=function(_0x1accb9){while(--_0x1accb9){_0x5bd044['push'](_0x5bd044['shift']());}};_0x582fd7(++_0xafd5fa);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file +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 diff --git a/server/api/action/index.js b/server/api/action/index.js index 6202338..46c6db2 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 _0xab55=['put','/:id','isAuthenticated','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller'];(function(_0x35996c,_0x267ae9){var _0x2e9446=function(_0x4e4965){while(--_0x4e4965){_0x35996c['push'](_0x35996c['shift']());}};_0x2e9446(++_0x267ae9);}(_0xab55,0x1e6));var _0x5ab5=function(_0x1204a7,_0xf33c19){_0x1204a7=_0x1204a7-0x0;var _0xa5b1d8=_0xab55[_0x1204a7];return _0xa5b1d8;};'use strict';var multer=require(_0x5ab5('0x0'));var util=require(_0x5ab5('0x1'));var path=require(_0x5ab5('0x2'));var timeout=require(_0x5ab5('0x3'));var express=require(_0x5ab5('0x4'));var router=express['Router']();var auth=require(_0x5ab5('0x5'));var interaction=require(_0x5ab5('0x6'));var config=require(_0x5ab5('0x7'));var controller=require(_0x5ab5('0x8'));router[_0x5ab5('0x9')](_0x5ab5('0xa'),auth[_0x5ab5('0xb')](),controller[_0x5ab5('0xc')]);router[_0x5ab5('0xd')](_0x5ab5('0xa'),auth[_0x5ab5('0xb')](),controller[_0x5ab5('0xe')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 927f3b5..e0b92bc 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 _0xddd5=['sequelize','exports','STRING','TEXT'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0xddd5,0x144));var _0x5ddd=function(_0x36ab02,_0x3ea7f7){_0x36ab02=_0x36ab02-0x0;var _0x319df2=_0xddd5[_0x36ab02];return _0x319df2;};'use strict';var Sequelize=require(_0x5ddd('0x0'));module[_0x5ddd('0x1')]={'name':{'type':Sequelize[_0x5ddd('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5ddd('0x2')]},'parent':{'type':Sequelize[_0x5ddd('0x2')]},'table':{'type':Sequelize[_0x5ddd('0x2')]},'conditions':{'type':Sequelize[_0x5ddd('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +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 diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index f44d9d4..50f5b3a 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 _0x6a82=['groupBy','orderBy','DESC','field','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','table','foreignKey','conditions','clone','debug','toString','sequelize','QueryTypes','SELECT','join','cross_join','COUNT(DISTINCT\x20%s)','function','Limited\x20Query:','No\x20available\x20data','web','fullPath','randomstring','generate','output','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','select','countTable','COUNT(*)','run','runReport','COUNT(%s)','IS\x20EMPTY','Please\x20insert\x20at\x20least\x20one\x20field','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','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','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','include','findAll','catch','show','intersection','length','includeAll','find','create','user','role','Reports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','preview','left_join','right_join','SUM(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','from','MetricId','metric','replace','format'];(function(_0x4f9a38,_0x2db4c6){var _0x36fbc1=function(_0xd24217){while(--_0xd24217){_0x4f9a38['push'](_0x4f9a38['shift']());}};_0x36fbc1(++_0x2db4c6);}(_0x6a82,0xdd));var _0x26a8=function(_0x4b9ddd,_0x49f1e4){_0x4b9ddd=_0x4b9ddd-0x0;var _0x4dd1cc=_0x6a82[_0x4b9ddd];return _0x4dd1cc;};'use strict';var pdf=require(_0x26a8('0x0'));var emlformat=require(_0x26a8('0x1'));var rimraf=require(_0x26a8('0x2'));var zipdir=require(_0x26a8('0x3'));var jsonpatch=require(_0x26a8('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x26a8('0x5'));var Mustache=require(_0x26a8('0x6'));var util=require(_0x26a8('0x7'));var path=require(_0x26a8('0x8'));var sox=require(_0x26a8('0x9'));var csv=require(_0x26a8('0xa'));var ejs=require(_0x26a8('0xb'));var fs=require('fs');var _=require(_0x26a8('0xc'));var squel=require(_0x26a8('0xd'));var crypto=require(_0x26a8('0xe'));var jsforce=require(_0x26a8('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x26a8('0xa'));var querystring=require(_0x26a8('0x10'));var Papa=require(_0x26a8('0x11'));var Redis=require(_0x26a8('0x12'));var authService=require(_0x26a8('0x13'));var qs=require(_0x26a8('0x14'));var as=require(_0x26a8('0x15'));var hardwareService=require(_0x26a8('0x16'));var logger=require('../../config/logger')(_0x26a8('0x17'));var utils=require(_0x26a8('0x18'));var config=require(_0x26a8('0x19'));var db=require(_0x26a8('0x1a'))['db'];function respondWithStatusCode(_0x3f895e,_0x337b38){_0x337b38=_0x337b38||0xcc;return function(_0x4b97e8){if(_0x4b97e8){return _0x3f895e[_0x26a8('0x1b')](_0x337b38);}return _0x3f895e[_0x26a8('0x1c')](_0x337b38)['end']();};}function respondWithResult(_0x256e62,_0x91e89f){_0x91e89f=_0x91e89f||0xc8;return function(_0x1df14d){if(_0x1df14d){return _0x256e62['status'](_0x91e89f)['json'](_0x1df14d);}};}function respondWithFilteredResult(_0x1a4b47,_0xcc68b3){return function(_0x5e08b1){if(_0x5e08b1){var _0x1479b7=_0x5e08b1[_0x26a8('0x1d')],_0x2297e2=_0xcc68b3[_0x26a8('0x1e')],_0x708e88=_0xcc68b3[_0x26a8('0x1e')]+_0xcc68b3[_0x26a8('0x1f')],_0x4ffd60;if(_0x708e88>=_0x1479b7){_0x708e88=_0x1479b7;_0x4ffd60=0xc8;}else{_0x4ffd60=0xce;}_0x1a4b47[_0x26a8('0x1c')](_0x4ffd60);return _0x1a4b47[_0x26a8('0x20')](_0x26a8('0x21'),_0x2297e2+'-'+_0x708e88+'/'+_0x1479b7)['json'](_0x5e08b1);}return null;};}function patchUpdates(_0x213f5c){return function(_0x4df9ae){try{jsonpatch[_0x26a8('0x22')](_0x4df9ae,_0x213f5c,!![]);}catch(_0x499b86){return BPromise[_0x26a8('0x23')](_0x499b86);}return _0x4df9ae['save']();};}function saveUpdates(_0x374922,_0x4a8e08){return function(_0x49bf99){if(_0x49bf99){return _0x49bf99[_0x26a8('0x24')](_0x374922)[_0x26a8('0x25')](function(_0x56ed73){return _0x56ed73;});}return null;};}function removeEntity(_0x275d52,_0x139a07){return function(_0x37b68b){if(_0x37b68b){return _0x37b68b[_0x26a8('0x26')]()[_0x26a8('0x25')](function(){var _0x4c73b1=_0x37b68b['get']({'plain':!![]});var _0x38acbe='CustomReports';return db['UserProfileResource'][_0x26a8('0x26')]({'where':{'type':_0x38acbe,'resourceId':_0x4c73b1['id']}})['then'](function(){return _0x37b68b;});})['then'](function(){_0x275d52[_0x26a8('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x198be7,_0x5a2b4f){return function(_0x2bb21e){if(!_0x2bb21e){_0x198be7[_0x26a8('0x1b')](0x194);}return _0x2bb21e;};}function handleError(_0x4ec12c,_0x461c75){_0x461c75=_0x461c75||0x1f4;return function(_0x39b914){logger[_0x26a8('0x27')](_0x39b914[_0x26a8('0x28')]);if(_0x39b914[_0x26a8('0x29')]){delete _0x39b914[_0x26a8('0x29')];}_0x4ec12c['status'](_0x461c75)[_0x26a8('0x2a')](_0x39b914);};}exports[_0x26a8('0x2b')]=function(_0x23a65d,_0x2d9c6a){var _0x302c1b={},_0x4a2f58={},_0x2f01c7={'count':0x0,'rows':[]};var _0x393bf4=_[_0x26a8('0x2c')](db[_0x26a8('0x2d')][_0x26a8('0x2e')],function(_0x2699fe){return{'name':_0x2699fe[_0x26a8('0x2f')],'type':_0x2699fe[_0x26a8('0x30')][_0x26a8('0x31')]};});_0x4a2f58[_0x26a8('0x32')]=_[_0x26a8('0x2c')](_0x393bf4,_0x26a8('0x29'));_0x4a2f58[_0x26a8('0x33')]=_[_0x26a8('0x34')](_0x23a65d['query']);_0x4a2f58[_0x26a8('0x35')]=_['intersection'](_0x4a2f58[_0x26a8('0x32')],_0x4a2f58[_0x26a8('0x33')]);_0x302c1b['attributes']=_['intersection'](_0x4a2f58[_0x26a8('0x32')],qs[_0x26a8('0x36')](_0x23a65d[_0x26a8('0x33')][_0x26a8('0x36')]));_0x302c1b[_0x26a8('0x37')]=_0x302c1b['attributes']['length']?_0x302c1b['attributes']:_0x4a2f58[_0x26a8('0x32')];if(!_0x23a65d['query'][_0x26a8('0x38')](_0x26a8('0x39'))){_0x302c1b['limit']=qs['limit'](_0x23a65d['query'][_0x26a8('0x1f')]);_0x302c1b[_0x26a8('0x1e')]=qs[_0x26a8('0x1e')](_0x23a65d['query'][_0x26a8('0x1e')]);}_0x302c1b[_0x26a8('0x3a')]=qs[_0x26a8('0x3b')](_0x23a65d['query'][_0x26a8('0x3b')]);_0x302c1b['where']=qs[_0x26a8('0x35')](_['pick'](_0x23a65d[_0x26a8('0x33')],_0x4a2f58['filters']));if(_0x23a65d['query']['filter']){_0x302c1b[_0x26a8('0x3c')]=_[_0x26a8('0x3d')](_0x302c1b[_0x26a8('0x3c')],{'$or':_[_0x26a8('0x2c')](_0x393bf4,function(_0x56f9e5){if(_0x56f9e5['type']!==_0x26a8('0x3e')){var _0x1e1282={};_0x1e1282[_0x56f9e5[_0x26a8('0x29')]]={'$like':'%'+_0x23a65d[_0x26a8('0x33')]['filter']+'%'};return _0x1e1282;}})});}_0x302c1b=_['merge']({},_0x302c1b,_0x23a65d[_0x26a8('0x3f')]);var _0x45ae87={'where':_0x302c1b[_0x26a8('0x3c')]};return db[_0x26a8('0x2d')][_0x26a8('0x1d')](_0x45ae87)[_0x26a8('0x25')](function(_0x700a76){_0x2f01c7[_0x26a8('0x1d')]=_0x700a76;if(_0x23a65d[_0x26a8('0x33')]['includeAll']){_0x302c1b[_0x26a8('0x40')]=[{'all':!![]}];}return db[_0x26a8('0x2d')][_0x26a8('0x41')](_0x302c1b);})[_0x26a8('0x25')](function(_0x1fdaa9){_0x2f01c7['rows']=_0x1fdaa9;return _0x2f01c7;})[_0x26a8('0x25')](respondWithFilteredResult(_0x2d9c6a,_0x302c1b))[_0x26a8('0x42')](handleError(_0x2d9c6a,null));};exports[_0x26a8('0x43')]=function(_0x340537,_0x37d46f){var _0x37699c={'raw':![],'where':{'id':_0x340537['params']['id']}},_0x2bead9={};_0x2bead9[_0x26a8('0x32')]=_['keys'](db[_0x26a8('0x2d')][_0x26a8('0x2e')]);_0x2bead9[_0x26a8('0x33')]=_['keys'](_0x340537[_0x26a8('0x33')]);_0x2bead9[_0x26a8('0x35')]=_[_0x26a8('0x44')](_0x2bead9[_0x26a8('0x32')],_0x2bead9['query']);_0x37699c['attributes']=_[_0x26a8('0x44')](_0x2bead9[_0x26a8('0x32')],qs[_0x26a8('0x36')](_0x340537[_0x26a8('0x33')]['fields']));_0x37699c[_0x26a8('0x37')]=_0x37699c[_0x26a8('0x37')][_0x26a8('0x45')]?_0x37699c['attributes']:_0x2bead9['model'];if(_0x340537[_0x26a8('0x33')][_0x26a8('0x46')]){_0x37699c[_0x26a8('0x40')]=[{'all':!![]}];}_0x37699c=_[_0x26a8('0x3d')]({},_0x37699c,_0x340537[_0x26a8('0x3f')]);return db[_0x26a8('0x2d')][_0x26a8('0x47')](_0x37699c)['then'](handleEntityNotFound(_0x37d46f,null))['then'](respondWithResult(_0x37d46f,null))[_0x26a8('0x42')](handleError(_0x37d46f,null));};exports['create']=function(_0x2fca5a,_0x3c1552){return db['AnalyticCustomReport'][_0x26a8('0x48')](_0x2fca5a['body'],{})[_0x26a8('0x25')](function(_0x56f9fa){var _0x34faa2=_0x2fca5a[_0x26a8('0x49')]['get']({'plain':!![]});if(!_0x34faa2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x34faa2[_0x26a8('0x4a')]==='user'){var _0x1d275f=_0x56f9fa['get']({'plain':!![]});var _0x21f8f5=_0x26a8('0x4b');return db[_0x26a8('0x4c')]['find']({'where':{'name':_0x21f8f5,'userProfileId':_0x34faa2[_0x26a8('0x4d')]},'raw':!![]})[_0x26a8('0x25')](function(_0x11624e){if(_0x11624e&&_0x11624e[_0x26a8('0x4e')]===0x0){return db[_0x26a8('0x4f')]['create']({'name':_0x1d275f[_0x26a8('0x29')],'resourceId':_0x1d275f['id'],'type':'CustomReports','sectionId':_0x11624e['id']},{})[_0x26a8('0x25')](function(){return _0x56f9fa;});}else{return _0x56f9fa;}})[_0x26a8('0x42')](function(_0x115058){logger['error'](_0x26a8('0x50'),_0x115058);throw _0x115058;});}return _0x56f9fa;})[_0x26a8('0x25')](respondWithResult(_0x3c1552,0xc9))[_0x26a8('0x42')](handleError(_0x3c1552,null));};exports[_0x26a8('0x24')]=function(_0x23d7e7,_0x499a5e){if(_0x23d7e7[_0x26a8('0x51')]['id']){delete _0x23d7e7[_0x26a8('0x51')]['id'];}return db[_0x26a8('0x2d')]['find']({'where':{'id':_0x23d7e7[_0x26a8('0x52')]['id']}})['then'](handleEntityNotFound(_0x499a5e,null))['then'](saveUpdates(_0x23d7e7[_0x26a8('0x51')],null))[_0x26a8('0x25')](respondWithResult(_0x499a5e,null))[_0x26a8('0x42')](handleError(_0x499a5e,null));};exports['destroy']=function(_0x5ef7bf,_0x4c3b4a){return db[_0x26a8('0x2d')]['find']({'where':{'id':_0x5ef7bf[_0x26a8('0x52')]['id']}})[_0x26a8('0x25')](handleEntityNotFound(_0x4c3b4a,null))[_0x26a8('0x25')](removeEntity(_0x4c3b4a,null))[_0x26a8('0x42')](handleError(_0x4c3b4a,null));};exports[_0x26a8('0x53')]=function(_0x583bc,_0x308f1e){var _0x24bfe4=0xa;var _0x591bfb=['join',_0x26a8('0x54'),_0x26a8('0x55'),'cross_join'];var _0x2d30be={'SUM':_0x26a8('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x26a8('0x57'),'MIN':_0x26a8('0x58'),'AVG':_0x26a8('0x59'),'GROUP_CONCAT':_0x26a8('0x5a'),'GROUP_CONCAT ASC':_0x26a8('0x5b'),'GROUP_CONCAT DESC':_0x26a8('0x5c')};var _0x359c3f={'SEC_TO_TIME':_0x26a8('0x5d'),'DATE':_0x26a8('0x5e'),'HOUR':_0x26a8('0x5f'),'ROUND':_0x26a8('0x60'),'UNIX_TIMESTAMP':_0x26a8('0x61')};var _0x69e70=function(_0x2df4bf){return!_[_0x26a8('0x62')]([_0x26a8('0x63'),_0x26a8('0x64'),'IS\x20EMPTY',_0x26a8('0x65')],_0x2df4bf);};var _0x4b1f3f=function(_0x166f88){if(!_0x166f88||!_0x166f88[_0x26a8('0x66')]['length']){return'';}for(var _0x4bab07='(',_0x58179d=0x0;_0x58179d<_0x166f88[_0x26a8('0x66')]['length'];_0x58179d+=0x1){_0x58179d>0x0&&(_0x4bab07+='\x20'+_0x166f88[_0x26a8('0x67')]+'\x20');_0x4bab07+=_0x166f88[_0x26a8('0x66')][_0x58179d][_0x26a8('0x68')]?_0x4b1f3f(_0x166f88[_0x26a8('0x66')][_0x58179d][_0x26a8('0x68')]):_0x166f88['rules'][_0x58179d]['field']+'\x20'+_0x166f88[_0x26a8('0x66')][_0x58179d][_0x26a8('0x69')]+(_0x69e70(_0x166f88['rules'][_0x58179d][_0x26a8('0x69')])?'\x20'+_0x166f88[_0x26a8('0x66')][_0x58179d][_0x26a8('0x6a')]:'');}return _0x4bab07+')';};var _0x257892={'where':{'id':_0x583bc[_0x26a8('0x52')]['id']}},_0x52b205,_0x54487e,_0x5e7797,_0x2616ee,_0x22f4de;_0x257892=_[_0x26a8('0x3d')]({},_0x257892,_0x583bc[_0x26a8('0x3f')]);return db[_0x26a8('0x2d')][_0x26a8('0x47')](_0x257892)[_0x26a8('0x25')](function(_0x3340c2){if(_0x3340c2){_0x52b205=_0x3340c2;return _0x3340c2[_0x26a8('0x6b')]();}return null;})['then'](function(_0x3ef2c2){if(_0x3ef2c2){if(!_0x3ef2c2[_0x26a8('0x45')]){throw new db[(_0x26a8('0x6c'))][(_0x26a8('0x6d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x54487e=_0x3ef2c2;return db[_0x26a8('0x6e')][_0x26a8('0x41')]({'raw':!![]});}return null;})[_0x26a8('0x25')](function(_0x5aa3bc){if(_0x5aa3bc){_0x5e7797=_[_0x26a8('0x6f')](_0x5aa3bc,'id');var _0x13f2b6;var _0x5bb671=squel['select']();_0x5bb671[_0x26a8('0x70')](_0x52b205['table']);for(var _0xa9cae=0x0;_0xa9cae<_0x54487e[_0x26a8('0x45')];_0xa9cae+=0x1){_0x13f2b6=_0x54487e[_0xa9cae][_0x26a8('0x71')]?_0x5e7797[_0x54487e[_0xa9cae][_0x26a8('0x71')]][_0x26a8('0x72')]:_0x54487e[_0xa9cae]['field'];_0x13f2b6=_0x54487e[_0xa9cae]['function']?_[_0x26a8('0x73')](_0x2d30be[_0x54487e[_0xa9cae]['function']],'%s',_0x13f2b6):_0x13f2b6;_0x13f2b6=_0x54487e[_0xa9cae][_0x26a8('0x74')]?_[_0x26a8('0x73')](_0x359c3f[_0x54487e[_0xa9cae]['format']],'%s',_0x13f2b6):_0x13f2b6;if(_0x54487e[_0xa9cae][_0x26a8('0x75')]){_0x5bb671[_0x26a8('0x68')](_0x13f2b6);}_0x54487e[_0xa9cae]['orderBy']&&_0x5bb671['order'](_0x13f2b6,_0x54487e[_0xa9cae][_0x26a8('0x76')]===_0x26a8('0x77')?![]:!![]);_0x5bb671[_0x26a8('0x78')](_0x13f2b6,_0x54487e[_0xa9cae][_0x26a8('0x79')]||_0x13f2b6);}if(_0x52b205[_0x26a8('0x7a')]){_0x52b205['joins']=JSON[_0x26a8('0x7b')](_0x52b205[_0x26a8('0x7a')]);for(var _0x1c2d94=0x0;_0x1c2d94<_0x52b205['joins'][_0x26a8('0x45')];_0x1c2d94+=0x1){if(_0x52b205[_0x26a8('0x7a')][_0x1c2d94][_0x26a8('0x30')]&&_[_0x26a8('0x62')](_0x591bfb,_0x52b205['joins'][_0x1c2d94][_0x26a8('0x30')])&&_0x52b205[_0x26a8('0x7a')][_0x1c2d94][_0x26a8('0x7c')]&&_0x52b205[_0x26a8('0x7a')][_0x1c2d94][_0x26a8('0x7d')]&&_0x52b205[_0x26a8('0x7a')][_0x1c2d94]['foreignKey']){_0x5bb671[_0x52b205['joins'][_0x1c2d94][_0x26a8('0x30')]](_0x52b205[_0x26a8('0x7a')][_0x1c2d94][_0x26a8('0x7d')],null,util[_0x26a8('0x74')](_0x26a8('0x7e'),_0x52b205[_0x26a8('0x7f')],_0x52b205[_0x26a8('0x7a')][_0x1c2d94][_0x26a8('0x7c')],_0x52b205[_0x26a8('0x7a')][_0x1c2d94]['foreignTable'],_0x52b205['joins'][_0x1c2d94][_0x26a8('0x80')]));}}}if(_0x52b205[_0x26a8('0x81')]){_0x52b205[_0x26a8('0x81')]=JSON[_0x26a8('0x7b')](_0x52b205[_0x26a8('0x81')]);_0x5bb671[_0x26a8('0x3c')](_0x4b1f3f(_0x52b205['conditions'][_0x26a8('0x68')]));}_0x22f4de=_0x5bb671[_0x26a8('0x82')]();_0x5bb671[_0x26a8('0x1f')](_0x24bfe4);_0x5bb671['offset'](0x0);logger[_0x26a8('0x83')]('Limited\x20Query:',_0x5bb671[_0x26a8('0x84')]());return db[_0x26a8('0x85')][_0x26a8('0x33')](_0x5bb671['toString'](),{'type':db['sequelize'][_0x26a8('0x86')][_0x26a8('0x87')]});}})[_0x26a8('0x25')](respondWithResult(_0x308f1e,null))['catch'](handleError(_0x308f1e,null));};function runReport(_0x171f69,_0x25b328,_0x2e3696){var _0x2d47fe=_0x25b328[_0x26a8('0x29')];var _0x3b25d5=0xa;var _0x4d17c3=[_0x26a8('0x88'),'left_join',_0x26a8('0x55'),_0x26a8('0x89')];var _0x3f79a2={'SUM':_0x26a8('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x26a8('0x8a'),'MAX':_0x26a8('0x57'),'MIN':_0x26a8('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x26a8('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x187718={'SEC_TO_TIME':_0x26a8('0x5d'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x26a8('0x60'),'UNIX_TIMESTAMP':_0x26a8('0x61')};var _0x42ce3e=function(_0x2b9532){return!_[_0x26a8('0x62')](['IS\x20NULL',_0x26a8('0x64'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x2b9532);};var _0xc55bc8=function(_0x388bee){if(!_0x388bee||!_0x388bee['rules']['length']){return'';}for(var _0x32fe8b='(',_0x569c06=0x0;_0x569c06<_0x388bee[_0x26a8('0x66')]['length'];_0x569c06+=0x1){_0x569c06>0x0&&(_0x32fe8b+='\x20'+_0x388bee[_0x26a8('0x67')]+'\x20');_0x32fe8b+=_0x388bee['rules'][_0x569c06][_0x26a8('0x68')]?_0xc55bc8(_0x388bee[_0x26a8('0x66')][_0x569c06][_0x26a8('0x68')]):_0x388bee['rules'][_0x569c06][_0x26a8('0x78')]+'\x20'+_0x388bee[_0x26a8('0x66')][_0x569c06][_0x26a8('0x69')]+(_0x42ce3e(_0x388bee[_0x26a8('0x66')][_0x569c06][_0x26a8('0x69')])?'\x20'+_0x388bee[_0x26a8('0x66')][_0x569c06][_0x26a8('0x6a')]:'');}return _0x32fe8b+')';};var _0x359726={'where':{'id':_0x171f69['id']}},_0xd5e40f,_0x33c88f,_0x1bdd74,_0x3c591a,_0x48c5d8;_0x359726=_[_0x26a8('0x3d')]({},_0x359726,_0x2e3696);return db[_0x26a8('0x2d')][_0x26a8('0x47')](_0x359726)[_0x26a8('0x25')](function(_0x17cafa){if(_0x17cafa){_0xd5e40f=_0x17cafa;return _0x17cafa[_0x26a8('0x6b')]();}return null;})[_0x26a8('0x25')](function(_0x139f22){if(_0x139f22){if(!_0x139f22['length']){throw new db[(_0x26a8('0x6c'))][(_0x26a8('0x6d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x33c88f=_0x139f22;return db[_0x26a8('0x6e')][_0x26a8('0x41')]({'raw':!![]});}return null;})[_0x26a8('0x25')](function(_0x42c27c){if(_0x42c27c){_0x1bdd74=_[_0x26a8('0x6f')](_0x42c27c,'id');var _0x11d617;var _0x311e7a=squel['select']();_0x311e7a[_0x26a8('0x70')](_0xd5e40f[_0x26a8('0x7f')]);for(var _0x1b9bac=0x0;_0x1b9bac<_0x33c88f[_0x26a8('0x45')];_0x1b9bac+=0x1){_0x11d617=_0x33c88f[_0x1b9bac][_0x26a8('0x71')]?_0x1bdd74[_0x33c88f[_0x1b9bac][_0x26a8('0x71')]][_0x26a8('0x72')]:_0x33c88f[_0x1b9bac]['field'];_0x11d617=_0x33c88f[_0x1b9bac][_0x26a8('0x8b')]?_['replace'](_0x3f79a2[_0x33c88f[_0x1b9bac][_0x26a8('0x8b')]],'%s',_0x11d617):_0x11d617;_0x11d617=_0x33c88f[_0x1b9bac]['format']?_[_0x26a8('0x73')](_0x187718[_0x33c88f[_0x1b9bac][_0x26a8('0x74')]],'%s',_0x11d617):_0x11d617;if(_0x33c88f[_0x1b9bac]['groupBy']){_0x311e7a['group'](_0x11d617);}_0x33c88f[_0x1b9bac][_0x26a8('0x76')]&&_0x311e7a[_0x26a8('0x3a')](_0x11d617,_0x33c88f[_0x1b9bac][_0x26a8('0x76')]===_0x26a8('0x77')?![]:!![]);_0x311e7a[_0x26a8('0x78')](_0x11d617,_0x33c88f[_0x1b9bac][_0x26a8('0x79')]||_0x11d617);}if(_0xd5e40f['joins']){_0xd5e40f[_0x26a8('0x7a')]=JSON[_0x26a8('0x7b')](_0xd5e40f[_0x26a8('0x7a')]);for(var _0x53b1a8=0x0;_0x53b1a8<_0xd5e40f[_0x26a8('0x7a')]['length'];_0x53b1a8+=0x1){if(_0xd5e40f[_0x26a8('0x7a')][_0x53b1a8][_0x26a8('0x30')]&&_[_0x26a8('0x62')](_0x4d17c3,_0xd5e40f['joins'][_0x53b1a8][_0x26a8('0x30')])&&_0xd5e40f[_0x26a8('0x7a')][_0x53b1a8][_0x26a8('0x7c')]&&_0xd5e40f['joins'][_0x53b1a8]['foreignTable']&&_0xd5e40f[_0x26a8('0x7a')][_0x53b1a8]['foreignKey']){_0x311e7a[_0xd5e40f[_0x26a8('0x7a')][_0x53b1a8]['type']](_0xd5e40f[_0x26a8('0x7a')][_0x53b1a8][_0x26a8('0x7d')],null,util[_0x26a8('0x74')](_0x26a8('0x7e'),_0xd5e40f['table'],_0xd5e40f[_0x26a8('0x7a')][_0x53b1a8][_0x26a8('0x7c')],_0xd5e40f['joins'][_0x53b1a8][_0x26a8('0x7d')],_0xd5e40f[_0x26a8('0x7a')][_0x53b1a8][_0x26a8('0x80')]));}}}if(_0xd5e40f[_0x26a8('0x81')]){_0xd5e40f['conditions']=JSON[_0x26a8('0x7b')](_0xd5e40f['conditions']);_0x311e7a[_0x26a8('0x3c')](_0xc55bc8(_0xd5e40f[_0x26a8('0x81')][_0x26a8('0x68')]));}_0x48c5d8=_0x311e7a['clone']();_0x311e7a[_0x26a8('0x1f')](_0x3b25d5);_0x311e7a['offset'](0x0);logger[_0x26a8('0x83')](_0x26a8('0x8c'),_0x311e7a[_0x26a8('0x84')]());return db[_0x26a8('0x85')][_0x26a8('0x33')](_0x311e7a['toString'](),{'type':db[_0x26a8('0x85')]['QueryTypes'][_0x26a8('0x87')]});}})[_0x26a8('0x25')](function(_0x50eb67){if(!_0x50eb67[_0x26a8('0x45')]){throw new db['Sequelize'][(_0x26a8('0x6d'))](_0x26a8('0x8d'),0xcc);}if(_0x25b328['output']===_0x26a8('0x8e')){return null;}var _0x28d189=_[_0x26a8('0x3d')](_0x25b328,{'name':_0x25b328[_0x26a8('0x8f')]||_0x25b328[_0x26a8('0x29')]||_0xd5e40f['name'],'basename':_0x2d47fe,'savename':util[_0x26a8('0x74')]('%s-%s.%s',_0x25b328[_0x26a8('0x29')]||_0xd5e40f[_0x26a8('0x29')],require(_0x26a8('0x90'))[_0x26a8('0x91')](0x4),_0x25b328[_0x26a8('0x92')]||_0x26a8('0x93')),'reportId':_0xd5e40f['id'],'reportType':_0x26a8('0x94')});return db['AnalyticExtractedReport']['create'](_0x28d189,{'raw':!![]});})[_0x26a8('0x25')](function(_0x2e585f){if(_0xd5e40f[_0x26a8('0x7f')]===_0x26a8('0x95')){_0x48c5d8[_0x26a8('0x3c')](_0xd5e40f[_0x26a8('0x7f')]+_0x26a8('0x96'),_0x25b328[_0x26a8('0x97')],_0x25b328[_0x26a8('0x98')]);}else{_0x48c5d8[_0x26a8('0x3c')](_0xd5e40f[_0x26a8('0x7f')]+_0x26a8('0x99'),_0x25b328[_0x26a8('0x97')],_0x25b328[_0x26a8('0x98')]);}if(_0x2e585f){logger[_0x26a8('0x9a')](_0x26a8('0x9b'),_0x48c5d8['toString']());require(_0x26a8('0x9c'))[_0x26a8('0x9d')](path['join'](__dirname,_0x26a8('0x9e'),_0x2e585f[_0x26a8('0x92')]),[_0x2e585f['id'],_0x48c5d8[_0x26a8('0x84')](),path[_0x26a8('0x88')](__dirname,_0x26a8('0x9f'),_0x2e585f[_0x26a8('0xa0')]),_0x2d47fe]);return _0x2e585f;}else{var _0xea6373=squel[_0x26a8('0xa1')]();_0xea6373[_0x26a8('0x70')]('('+_0x48c5d8[_0x26a8('0x84')]()+')',_0x26a8('0xa2'));_0xea6373[_0x26a8('0x78')](_0x26a8('0xa3'),'count');_0x48c5d8[_0x26a8('0x1f')](_0x25b328['limit']||_0x3b25d5);_0x48c5d8[_0x26a8('0x1e')](_0x25b328[_0x26a8('0x1e')]||0x0);return db[_0x26a8('0x85')][_0x26a8('0x33')](_0xea6373['toString'](),{'type':db[_0x26a8('0x85')][_0x26a8('0x86')]['SELECT']})['then'](function(_0x2c0b5b){if(!_0x2c0b5b[_0x26a8('0x45')]){_0x3c591a=0x0;}else{_0x3c591a=_0x2c0b5b[0x0][_0x26a8('0x1d')]||0x0;}return db[_0x26a8('0x85')][_0x26a8('0x33')](_0x48c5d8[_0x26a8('0x84')](),{'type':db[_0x26a8('0x85')][_0x26a8('0x86')][_0x26a8('0x87')]});})[_0x26a8('0x25')](function(_0x547358){return{'rows':_0x547358||[],'count':_0x3c591a};});}});}exports[_0x26a8('0xa4')]=function(_0x2ff1e8,_0x42b659){return runReport(_0x2ff1e8[_0x26a8('0x52')],_0x2ff1e8[_0x26a8('0x33')],_0x2ff1e8[_0x26a8('0x3f')])[_0x26a8('0x25')](respondWithResult(_0x42b659,null))[_0x26a8('0x42')](handleError(_0x42b659,null));};exports[_0x26a8('0xa5')]=runReport;exports[_0x26a8('0x33')]=function(_0xac6084,_0x4cb413){var _0x8d94a=0xa;var _0x310191=[_0x26a8('0x88'),'left_join','right_join','cross_join'];var _0x36eb96={'SUM':_0x26a8('0x56'),'COUNT':_0x26a8('0xa6'),'COUNT DISTINCT':_0x26a8('0x8a'),'MAX':_0x26a8('0x57'),'MIN':'MIN(%s)','AVG':_0x26a8('0x59'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x26a8('0x5b'),'GROUP_CONCAT DESC':_0x26a8('0x5c')};var _0x1709fd={'SEC_TO_TIME':_0x26a8('0x5d'),'DATE':_0x26a8('0x5e'),'HOUR':_0x26a8('0x5f'),'ROUND':_0x26a8('0x60'),'UNIX_TIMESTAMP':_0x26a8('0x61')};var _0x25b3a6=function(_0x563822){return!_['includes']([_0x26a8('0x63'),'IS\x20NOT\x20NULL',_0x26a8('0xa7'),'IS\x20NOT\x20EMPTY'],_0x563822);};var _0xac572=function(_0x241b5a){if(!_0x241b5a||!_0x241b5a[_0x26a8('0x66')][_0x26a8('0x45')]){return'';}for(var _0x10f85c='(',_0x5b50e9=0x0;_0x5b50e9<_0x241b5a[_0x26a8('0x66')][_0x26a8('0x45')];_0x5b50e9+=0x1){_0x5b50e9>0x0&&(_0x10f85c+='\x20'+_0x241b5a[_0x26a8('0x67')]+'\x20');_0x10f85c+=_0x241b5a[_0x26a8('0x66')][_0x5b50e9][_0x26a8('0x68')]?_0xac572(_0x241b5a[_0x26a8('0x66')][_0x5b50e9][_0x26a8('0x68')]):_0x241b5a[_0x26a8('0x66')][_0x5b50e9]['field']+'\x20'+_0x241b5a[_0x26a8('0x66')][_0x5b50e9][_0x26a8('0x69')]+(_0x25b3a6(_0x241b5a[_0x26a8('0x66')][_0x5b50e9][_0x26a8('0x69')])?'\x20'+_0x241b5a[_0x26a8('0x66')][_0x5b50e9]['value']:'');}return _0x10f85c+')';};var _0x4a39f4={'where':{'id':_0xac6084[_0x26a8('0x52')]['id']}},_0x10e6bd,_0xe49fc3,_0x1ea8c3,_0x31f940,_0x37d3eb;_0x4a39f4=_['merge']({},_0x4a39f4,_0xac6084['options']);return db[_0x26a8('0x2d')][_0x26a8('0x47')](_0x4a39f4)['then'](function(_0x5bd87c){if(_0x5bd87c){_0x10e6bd=_0x5bd87c;return _0x5bd87c['getFields']();}return null;})[_0x26a8('0x25')](function(_0x43d3bf){if(_0x43d3bf){if(!_0x43d3bf[_0x26a8('0x45')]){throw new db[(_0x26a8('0x6c'))][(_0x26a8('0x6d'))](_0x26a8('0xa8'),0x193);}_0xe49fc3=_0x43d3bf;return db[_0x26a8('0x6e')][_0x26a8('0x41')]({'raw':!![]});}return null;})[_0x26a8('0x25')](function(_0x383910){if(_0x383910){_0x1ea8c3=_[_0x26a8('0x6f')](_0x383910,'id');var _0x1ccebc;var _0x376735=squel[_0x26a8('0xa1')]();_0x376735[_0x26a8('0x70')](_0x10e6bd[_0x26a8('0x7f')]);for(var _0x4157fe=0x0;_0x4157fe<_0xe49fc3[_0x26a8('0x45')];_0x4157fe+=0x1){_0x1ccebc=_0xe49fc3[_0x4157fe]['MetricId']?_0x1ea8c3[_0xe49fc3[_0x4157fe]['MetricId']][_0x26a8('0x72')]:_0xe49fc3[_0x4157fe][_0x26a8('0x78')];_0x1ccebc=_0xe49fc3[_0x4157fe][_0x26a8('0x8b')]?_[_0x26a8('0x73')](_0x36eb96[_0xe49fc3[_0x4157fe]['function']],'%s',_0x1ccebc):_0x1ccebc;_0x1ccebc=_0xe49fc3[_0x4157fe]['format']?_[_0x26a8('0x73')](_0x1709fd[_0xe49fc3[_0x4157fe][_0x26a8('0x74')]],'%s',_0x1ccebc):_0x1ccebc;if(_0xe49fc3[_0x4157fe][_0x26a8('0x75')]){_0x376735[_0x26a8('0x68')](_0x1ccebc);}_0xe49fc3[_0x4157fe][_0x26a8('0x76')]&&_0x376735['order'](_0x1ccebc,_0xe49fc3[_0x4157fe][_0x26a8('0x76')]==='DESC'?![]:!![]);_0x376735[_0x26a8('0x78')](_0x1ccebc,_0xe49fc3[_0x4157fe]['alias']||_0x1ccebc);}if(_0x10e6bd[_0x26a8('0x7a')]){_0x10e6bd[_0x26a8('0x7a')]=JSON[_0x26a8('0x7b')](_0x10e6bd[_0x26a8('0x7a')]);for(var _0x172cd9=0x0;_0x172cd9<_0x10e6bd[_0x26a8('0x7a')][_0x26a8('0x45')];_0x172cd9+=0x1){if(_0x10e6bd[_0x26a8('0x7a')][_0x172cd9]['type']&&_[_0x26a8('0x62')](_0x310191,_0x10e6bd['joins'][_0x172cd9][_0x26a8('0x30')])&&_0x10e6bd['joins'][_0x172cd9][_0x26a8('0x7c')]&&_0x10e6bd[_0x26a8('0x7a')][_0x172cd9][_0x26a8('0x7d')]&&_0x10e6bd[_0x26a8('0x7a')][_0x172cd9]['foreignKey']){_0x376735[_0x10e6bd[_0x26a8('0x7a')][_0x172cd9]['type']](_0x10e6bd[_0x26a8('0x7a')][_0x172cd9]['foreignTable'],null,util[_0x26a8('0x74')](_0x26a8('0x7e'),_0x10e6bd[_0x26a8('0x7f')],_0x10e6bd['joins'][_0x172cd9][_0x26a8('0x7c')],_0x10e6bd['joins'][_0x172cd9][_0x26a8('0x7d')],_0x10e6bd[_0x26a8('0x7a')][_0x172cd9][_0x26a8('0x80')]));}}}if(_0x10e6bd[_0x26a8('0x81')]){_0x10e6bd[_0x26a8('0x81')]=JSON[_0x26a8('0x7b')](_0x10e6bd[_0x26a8('0x81')]);_0x376735['where'](_0xac572(_0x10e6bd['conditions'][_0x26a8('0x68')]));}_0x37d3eb=_0x376735['clone']();_0x376735['limit'](_0x8d94a);_0x376735[_0x26a8('0x1e')](0x0);logger[_0x26a8('0x83')]('Limited\x20Query:',_0x376735['toString']());return db['sequelize'][_0x26a8('0x33')](_0x376735[_0x26a8('0x84')](),{'type':db['sequelize'][_0x26a8('0x86')][_0x26a8('0x87')]});}})['then'](function(){return{'sql':_0x37d3eb[_0x26a8('0x84')]()};})[_0x26a8('0x25')](respondWithResult(_0x4cb413,null))[_0x26a8('0x42')](handleError(_0x4cb413,null));}; \ No newline at end of file +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 diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 9c2483b..f02cd65 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 _0x9597=['util','../../config/logger','request-promise','path','./analyticCustomReport.attributes','define','lodash'];(function(_0x24b07f,_0x2c82e3){var _0x975161=function(_0xfc9999){while(--_0xfc9999){_0x24b07f['push'](_0x24b07f['shift']());}};_0x975161(++_0x2c82e3);}(_0x9597,0xed));var _0x7959=function(_0x3d5c54,_0x1ec906){_0x3d5c54=_0x3d5c54-0x0;var _0x22cea7=_0x9597[_0x3d5c54];return _0x22cea7;};'use strict';var _=require(_0x7959('0x0'));var util=require(_0x7959('0x1'));var logger=require(_0x7959('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7959('0x3'));var fs=require('fs');var path=require(_0x7959('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7959('0x5'));module['exports']=function(_0x2e76ea,_0x341ada){return _0x2e76ea[_0x7959('0x6')]('AnalyticCustomReport',attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 9dba02b..8cc061b 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 _0x59de=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util'];(function(_0x52cdb3,_0x247869){var _0x23671e=function(_0x197a6f){while(--_0x197a6f){_0x52cdb3['push'](_0x52cdb3['shift']());}};_0x23671e(++_0x247869);}(_0x59de,0xa6));var _0xe59d=function(_0x5cc8b9,_0x20e3c3){_0x5cc8b9=_0x5cc8b9-0x0;var _0x58892e=_0x59de[_0x5cc8b9];return _0x58892e;};'use strict';var _=require(_0xe59d('0x0'));var util=require(_0xe59d('0x1'));var moment=require(_0xe59d('0x2'));var BPromise=require(_0xe59d('0x3'));var rs=require(_0xe59d('0x4'));var fs=require('fs');var Redis=require(_0xe59d('0x5'));var db=require(_0xe59d('0x6'))['db'];var utils=require(_0xe59d('0x7'));var logger=require('../../config/logger')(_0xe59d('0x8'));var config=require('../../config/environment');var jayson=require(_0xe59d('0x9'));var client=jayson[_0xe59d('0xa')][_0xe59d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ecc40,_0x35e146,_0x12bfea){return new BPromise(function(_0x46f8f7,_0x4eb6a1){return client['request'](_0x2ecc40,_0x12bfea)['then'](function(_0x4c2dc3){logger[_0xe59d('0xc')](_0xe59d('0xd'),_0x35e146,_0xe59d('0xe'));logger[_0xe59d('0xf')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x35e146,'request\x20sent',JSON[_0xe59d('0x10')](_0x4c2dc3));if(_0x4c2dc3[_0xe59d('0x11')]){if(_0x4c2dc3[_0xe59d('0x11')][_0xe59d('0x12')]===0x1f4){logger[_0xe59d('0x11')](_0xe59d('0xd'),_0x35e146,_0x4c2dc3[_0xe59d('0x11')]['message']);return _0x4eb6a1(_0x4c2dc3['error'][_0xe59d('0x13')]);}logger[_0xe59d('0x11')](_0xe59d('0xd'),_0x35e146,_0x4c2dc3[_0xe59d('0x11')]['message']);return _0x46f8f7(_0x4c2dc3['error']['message']);}else{logger[_0xe59d('0xc')](_0xe59d('0xd'),_0x35e146,_0xe59d('0xe'));_0x46f8f7(_0x4c2dc3['result'][_0xe59d('0x13')]);}})[_0xe59d('0x14')](function(_0x2ae282){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x35e146,_0x2ae282);_0x4eb6a1(_0x2ae282);});});} \ No newline at end of file +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 diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 1958b99..3f1165a 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 _0x3d2d=['run','/:id/query','create','/:id','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/preview','preview','/:id/run'];(function(_0x7f1978,_0x4ef2ff){var _0x1bfb0a=function(_0x41134f){while(--_0x41134f){_0x7f1978['push'](_0x7f1978['shift']());}};_0x1bfb0a(++_0x4ef2ff);}(_0x3d2d,0x7f));var _0xd3d2=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x3d2d[_0x2b5eae];return _0x5f3ac9;};'use strict';var multer=require('multer');var util=require(_0xd3d2('0x0'));var path=require(_0xd3d2('0x1'));var timeout=require(_0xd3d2('0x2'));var express=require(_0xd3d2('0x3'));var router=express[_0xd3d2('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd3d2('0x5'));var config=require(_0xd3d2('0x6'));var controller=require('./analyticCustomReport.controller');router[_0xd3d2('0x7')]('/',auth[_0xd3d2('0x8')](),controller[_0xd3d2('0x9')]);router[_0xd3d2('0x7')]('/:id',auth[_0xd3d2('0x8')](),controller['show']);router[_0xd3d2('0x7')](_0xd3d2('0xa'),auth[_0xd3d2('0x8')](),controller[_0xd3d2('0xb')]);router[_0xd3d2('0x7')](_0xd3d2('0xc'),auth[_0xd3d2('0x8')](),controller[_0xd3d2('0xd')]);router[_0xd3d2('0x7')](_0xd3d2('0xe'),auth[_0xd3d2('0x8')](),controller['query']);router['post']('/',auth[_0xd3d2('0x8')](),controller[_0xd3d2('0xf')]);router['put'](_0xd3d2('0x10'),auth[_0xd3d2('0x8')](),controller[_0xd3d2('0x11')]);router['delete'](_0xd3d2('0x10'),auth[_0xd3d2('0x8')](),controller[_0xd3d2('0x12')]);module[_0xd3d2('0x13')]=router; \ No newline at end of file +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 diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 451fcae..4f78064 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 _0xc9cf=['exports','TEXT'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xc9cf,0x10e));var _0xfc9c=function(_0x2b0267,_0x59cab1){_0x2b0267=_0x2b0267-0x0;var _0x289a4a=_0xc9cf[_0x2b0267];return _0x289a4a;};'use strict';var Sequelize=require('sequelize');module[_0xfc9c('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xfc9c('0x1')]},'joins':{'type':Sequelize[_0xfc9c('0x1')]}}; \ No newline at end of file +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 diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index fa8f875..e19820e 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 _0x3784=['sequelize','toString','AVG(%s)','ROUND(%s)','IS\x20EMPTY','condition','value','Sequelize','groupBy','Limited\x20Query:','QueryTypes','SELECT','No\x20available\x20data','output','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','run','runReport','metric','DESC','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','destroy','DefaultReports','UserProfileResource','then','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','findAll','rows','catch','params','keys','include','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','update','body','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','replace','function','format','orderBy','alias','joins','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','parse','clone','debug'];(function(_0x2534ab,_0xa790c7){var _0x473888=function(_0x4cea07){while(--_0x4cea07){_0x2534ab['push'](_0x2534ab['shift']());}};_0x473888(++_0xa790c7);}(_0x3784,0x16f));var _0x4378=function(_0x1cc231,_0x46ecc2){_0x1cc231=_0x1cc231-0x0;var _0x452925=_0x3784[_0x1cc231];return _0x452925;};'use strict';var pdf=require(_0x4378('0x0'));var emlformat=require(_0x4378('0x1'));var rimraf=require(_0x4378('0x2'));var zipdir=require(_0x4378('0x3'));var jsonpatch=require(_0x4378('0x4'));var rp=require('request-promise');var moment=require(_0x4378('0x5'));var BPromise=require(_0x4378('0x6'));var Mustache=require(_0x4378('0x7'));var util=require(_0x4378('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4378('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4378('0xa'));var crypto=require(_0x4378('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4378('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4378('0xd'));var Papa=require(_0x4378('0xe'));var Redis=require('ioredis');var authService=require(_0x4378('0xf'));var qs=require(_0x4378('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4378('0x11'));var utils=require(_0x4378('0x12'));var config=require(_0x4378('0x13'));var db=require(_0x4378('0x14'))['db'];function respondWithStatusCode(_0x10707d,_0x18c767){_0x18c767=_0x18c767||0xcc;return function(_0x42f356){if(_0x42f356){return _0x10707d[_0x4378('0x15')](_0x18c767);}return _0x10707d[_0x4378('0x16')](_0x18c767)[_0x4378('0x17')]();};}function respondWithResult(_0x4af1c9,_0x2237b3){_0x2237b3=_0x2237b3||0xc8;return function(_0x2f0f86){if(_0x2f0f86){return _0x4af1c9[_0x4378('0x16')](_0x2237b3)[_0x4378('0x18')](_0x2f0f86);}};}function respondWithFilteredResult(_0x73cf03,_0x20881d){return function(_0x30f5cf){if(_0x30f5cf){var _0x5d162c=_0x30f5cf['count'],_0x51fefa=_0x20881d[_0x4378('0x19')],_0x53cf9c=_0x20881d[_0x4378('0x19')]+_0x20881d[_0x4378('0x1a')],_0xedcf8e;if(_0x53cf9c>=_0x5d162c){_0x53cf9c=_0x5d162c;_0xedcf8e=0xc8;}else{_0xedcf8e=0xce;}_0x73cf03['status'](_0xedcf8e);return _0x73cf03[_0x4378('0x1b')](_0x4378('0x1c'),_0x51fefa+'-'+_0x53cf9c+'/'+_0x5d162c)[_0x4378('0x18')](_0x30f5cf);}return null;};}function patchUpdates(_0x57c2fa){return function(_0x245aef){try{jsonpatch[_0x4378('0x1d')](_0x245aef,_0x57c2fa,!![]);}catch(_0x7917de){return BPromise[_0x4378('0x1e')](_0x7917de);}return _0x245aef['save']();};}function saveUpdates(_0x44d959,_0x8bcdbb){return function(_0x18189d){if(_0x18189d){return _0x18189d['update'](_0x44d959)['then'](function(_0x472f4c){return _0x472f4c;});}return null;};}function removeEntity(_0x2c53a6,_0x42805f){return function(_0x5d9f09){if(_0x5d9f09){return _0x5d9f09[_0x4378('0x1f')]()['then'](function(){var _0x156885=_0x5d9f09['get']({'plain':!![]});var _0x526a3a=_0x4378('0x20');return db[_0x4378('0x21')][_0x4378('0x1f')]({'where':{'type':_0x526a3a,'resourceId':_0x156885['id']}})[_0x4378('0x22')](function(){return _0x5d9f09;});})['then'](function(){_0x2c53a6['status'](0xcc)[_0x4378('0x17')]();});}};}function handleEntityNotFound(_0x2d2963,_0x8147ba){return function(_0x471792){if(!_0x471792){_0x2d2963['sendStatus'](0x194);}return _0x471792;};}function handleError(_0x5eaa9b,_0xe4a229){_0xe4a229=_0xe4a229||0x1f4;return function(_0x4175fb){logger[_0x4378('0x23')](_0x4175fb[_0x4378('0x24')]);if(_0x4175fb[_0x4378('0x25')]){delete _0x4175fb[_0x4378('0x25')];}_0x5eaa9b[_0x4378('0x16')](_0xe4a229)[_0x4378('0x26')](_0x4175fb);};}exports[_0x4378('0x27')]=function(_0x5a908a,_0x38220e){var _0x3e903d={},_0x3901d6={},_0x4adc04={'count':0x0,'rows':[]};var _0xd114ee=_[_0x4378('0x28')](db[_0x4378('0x29')][_0x4378('0x2a')],function(_0x16a183){return{'name':_0x16a183[_0x4378('0x2b')],'type':_0x16a183[_0x4378('0x2c')][_0x4378('0x2d')]};});_0x3901d6[_0x4378('0x2e')]=_[_0x4378('0x28')](_0xd114ee,_0x4378('0x25'));_0x3901d6[_0x4378('0x2f')]=_['keys'](_0x5a908a['query']);_0x3901d6['filters']=_[_0x4378('0x30')](_0x3901d6[_0x4378('0x2e')],_0x3901d6[_0x4378('0x2f')]);_0x3e903d[_0x4378('0x31')]=_[_0x4378('0x30')](_0x3901d6[_0x4378('0x2e')],qs[_0x4378('0x32')](_0x5a908a[_0x4378('0x2f')][_0x4378('0x32')]));_0x3e903d[_0x4378('0x31')]=_0x3e903d[_0x4378('0x31')][_0x4378('0x33')]?_0x3e903d[_0x4378('0x31')]:_0x3901d6[_0x4378('0x2e')];if(!_0x5a908a['query'][_0x4378('0x34')](_0x4378('0x35'))){_0x3e903d['limit']=qs['limit'](_0x5a908a['query'][_0x4378('0x1a')]);_0x3e903d[_0x4378('0x19')]=qs[_0x4378('0x19')](_0x5a908a[_0x4378('0x2f')][_0x4378('0x19')]);}_0x3e903d[_0x4378('0x36')]=qs[_0x4378('0x37')](_0x5a908a[_0x4378('0x2f')][_0x4378('0x37')]);_0x3e903d[_0x4378('0x38')]=qs[_0x4378('0x39')](_[_0x4378('0x3a')](_0x5a908a['query'],_0x3901d6['filters']));if(_0x5a908a[_0x4378('0x2f')][_0x4378('0x3b')]){_0x3e903d[_0x4378('0x38')]=_[_0x4378('0x3c')](_0x3e903d[_0x4378('0x38')],{'$or':_[_0x4378('0x28')](_0xd114ee,function(_0x58783e){if(_0x58783e[_0x4378('0x2c')]!==_0x4378('0x3d')){var _0x332449={};_0x332449[_0x58783e[_0x4378('0x25')]]={'$like':'%'+_0x5a908a[_0x4378('0x2f')]['filter']+'%'};return _0x332449;}})});}_0x3e903d=_['merge']({},_0x3e903d,_0x5a908a[_0x4378('0x3e')]);var _0x87ff6a={'where':_0x3e903d[_0x4378('0x38')]};return db['AnalyticDefaultReport']['count'](_0x87ff6a)['then'](function(_0x59a5f){_0x4adc04[_0x4378('0x3f')]=_0x59a5f;if(_0x5a908a[_0x4378('0x2f')]['includeAll']){_0x3e903d['include']=[{'all':!![]}];}return db[_0x4378('0x29')][_0x4378('0x40')](_0x3e903d);})[_0x4378('0x22')](function(_0x2e1934){_0x4adc04[_0x4378('0x41')]=_0x2e1934;return _0x4adc04;})['then'](respondWithFilteredResult(_0x38220e,_0x3e903d))[_0x4378('0x42')](handleError(_0x38220e,null));};exports['show']=function(_0x2f637,_0x243889){var _0x1c5ff7={'raw':!![],'where':{'id':_0x2f637[_0x4378('0x43')]['id']}},_0x336fb2={};_0x336fb2[_0x4378('0x2e')]=_[_0x4378('0x44')](db[_0x4378('0x29')][_0x4378('0x2a')]);_0x336fb2[_0x4378('0x2f')]=_[_0x4378('0x44')](_0x2f637[_0x4378('0x2f')]);_0x336fb2[_0x4378('0x39')]=_[_0x4378('0x30')](_0x336fb2[_0x4378('0x2e')],_0x336fb2[_0x4378('0x2f')]);_0x1c5ff7['attributes']=_['intersection'](_0x336fb2[_0x4378('0x2e')],qs[_0x4378('0x32')](_0x2f637[_0x4378('0x2f')]['fields']));_0x1c5ff7[_0x4378('0x31')]=_0x1c5ff7[_0x4378('0x31')][_0x4378('0x33')]?_0x1c5ff7[_0x4378('0x31')]:_0x336fb2[_0x4378('0x2e')];if(_0x2f637[_0x4378('0x2f')]['includeAll']){_0x1c5ff7[_0x4378('0x45')]=[{'all':!![]}];}_0x1c5ff7=_[_0x4378('0x3c')]({},_0x1c5ff7,_0x2f637[_0x4378('0x3e')]);return db[_0x4378('0x29')][_0x4378('0x46')](_0x1c5ff7)['then'](handleEntityNotFound(_0x243889,null))[_0x4378('0x22')](respondWithResult(_0x243889,null))[_0x4378('0x42')](handleError(_0x243889,null));};exports[_0x4378('0x47')]=function(_0x49e664,_0x412053){return db[_0x4378('0x29')]['create'](_0x49e664['body'],{})[_0x4378('0x22')](function(_0x23a285){var _0x2184db=_0x49e664['user'][_0x4378('0x48')]({'plain':!![]});if(!_0x2184db)throw new Error(_0x4378('0x49'));if(_0x2184db[_0x4378('0x4a')]==='user'){var _0x4bc017=_0x23a285[_0x4378('0x48')]({'plain':!![]});var _0x4672b9=_0x4378('0x4b');return db[_0x4378('0x4c')][_0x4378('0x46')]({'where':{'name':_0x4672b9,'userProfileId':_0x2184db[_0x4378('0x4d')]},'raw':!![]})['then'](function(_0x549c97){if(_0x549c97&&_0x549c97[_0x4378('0x4e')]===0x0){return db[_0x4378('0x21')][_0x4378('0x47')]({'name':_0x4bc017['name'],'resourceId':_0x4bc017['id'],'type':_0x4378('0x20'),'sectionId':_0x549c97['id']},{})[_0x4378('0x22')](function(){return _0x23a285;});}else{return _0x23a285;}})[_0x4378('0x42')](function(_0x180032){logger[_0x4378('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x180032);throw _0x180032;});}return _0x23a285;})[_0x4378('0x22')](respondWithResult(_0x412053,0xc9))[_0x4378('0x42')](handleError(_0x412053,null));};exports[_0x4378('0x4f')]=function(_0x3ba09d,_0x2a5e3c){if(_0x3ba09d[_0x4378('0x50')]['id']){delete _0x3ba09d[_0x4378('0x50')]['id'];}return db['AnalyticDefaultReport']['find']({'where':{'id':_0x3ba09d['params']['id']}})[_0x4378('0x22')](handleEntityNotFound(_0x2a5e3c,null))['then'](saveUpdates(_0x3ba09d[_0x4378('0x50')],null))[_0x4378('0x22')](respondWithResult(_0x2a5e3c,null))[_0x4378('0x42')](handleError(_0x2a5e3c,null));};exports[_0x4378('0x1f')]=function(_0x25960e,_0x3d8eff){return db[_0x4378('0x29')][_0x4378('0x46')]({'where':{'id':_0x25960e[_0x4378('0x43')]['id']}})[_0x4378('0x22')](handleEntityNotFound(_0x3d8eff,null))[_0x4378('0x22')](removeEntity(_0x3d8eff,null))[_0x4378('0x42')](handleError(_0x3d8eff,null));};exports[_0x4378('0x51')]=function(_0x599de8,_0x528655){var _0x423f0e=0xa;var _0x9d278c=[_0x4378('0x52'),_0x4378('0x53'),'right_join',_0x4378('0x54')];var _0x5c3356={'SUM':_0x4378('0x55'),'COUNT':_0x4378('0x56'),'COUNT DISTINCT':_0x4378('0x57'),'MAX':_0x4378('0x58'),'MIN':_0x4378('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4378('0x5a'),'GROUP_CONCAT ASC':_0x4378('0x5b'),'GROUP_CONCAT DESC':_0x4378('0x5c')};var _0x26c187={'SEC_TO_TIME':_0x4378('0x5d'),'DATE':_0x4378('0x5e'),'HOUR':_0x4378('0x5f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4378('0x60')};var _0x1ec5d1=function(_0x53e9e2){return!_[_0x4378('0x61')]([_0x4378('0x62'),_0x4378('0x63'),'IS\x20EMPTY',_0x4378('0x64')],_0x53e9e2);};var _0x10a733=function(_0x48d84d){if(!_0x48d84d||!_0x48d84d['rules']['length']){return'';}for(var _0x4cb9ab='(',_0x3193a7=0x0;_0x3193a7<_0x48d84d[_0x4378('0x65')][_0x4378('0x33')];_0x3193a7+=0x1){_0x3193a7>0x0&&(_0x4cb9ab+='\x20'+_0x48d84d[_0x4378('0x66')]+'\x20');_0x4cb9ab+=_0x48d84d['rules'][_0x3193a7][_0x4378('0x67')]?_0x10a733(_0x48d84d[_0x4378('0x65')][_0x3193a7][_0x4378('0x67')]):_0x48d84d[_0x4378('0x65')][_0x3193a7][_0x4378('0x68')]+'\x20'+_0x48d84d[_0x4378('0x65')][_0x3193a7]['condition']+(_0x1ec5d1(_0x48d84d[_0x4378('0x65')][_0x3193a7]['condition'])?'\x20'+_0x48d84d[_0x4378('0x65')][_0x3193a7]['value']:'');}return _0x4cb9ab+')';};var _0x1c4f1e={'where':{'id':_0x599de8[_0x4378('0x43')]['id']}},_0x1933e3,_0x174c1d,_0xf388da,_0x15383a,_0x660651;_0x1c4f1e=_['merge']({},_0x1c4f1e,_0x599de8[_0x4378('0x3e')]);return db[_0x4378('0x29')][_0x4378('0x46')](_0x1c4f1e)['then'](function(_0x4ff723){if(_0x4ff723){_0x1933e3=_0x4ff723;return _0x4ff723[_0x4378('0x69')]();}return null;})[_0x4378('0x22')](function(_0x2769fd){if(_0x2769fd){if(!_0x2769fd[_0x4378('0x33')]){throw new db['Sequelize'][(_0x4378('0x6a'))](_0x4378('0x6b'),0x193);}_0x174c1d=_0x2769fd;return db[_0x4378('0x6c')][_0x4378('0x40')]({'raw':!![]});}return null;})[_0x4378('0x22')](function(_0xdb75e6){if(_0xdb75e6){_0xf388da=_[_0x4378('0x6d')](_0xdb75e6,'id');var _0x1a5df6;var _0x3076e1=squel[_0x4378('0x6e')]();_0x3076e1[_0x4378('0x6f')](_0x1933e3[_0x4378('0x70')]);for(var _0x1b6c6e=0x0;_0x1b6c6e<_0x174c1d[_0x4378('0x33')];_0x1b6c6e+=0x1){_0x1a5df6=_0x174c1d[_0x1b6c6e][_0x4378('0x71')]?_0xf388da[_0x174c1d[_0x1b6c6e]['MetricId']]['metric']:_0x174c1d[_0x1b6c6e][_0x4378('0x68')];_0x1a5df6=_0x174c1d[_0x1b6c6e]['function']?_[_0x4378('0x72')](_0x5c3356[_0x174c1d[_0x1b6c6e][_0x4378('0x73')]],'%s',_0x1a5df6):_0x1a5df6;_0x1a5df6=_0x174c1d[_0x1b6c6e][_0x4378('0x74')]?_[_0x4378('0x72')](_0x26c187[_0x174c1d[_0x1b6c6e]['format']],'%s',_0x1a5df6):_0x1a5df6;if(_0x174c1d[_0x1b6c6e]['groupBy']){_0x3076e1['group'](_0x1a5df6);}_0x174c1d[_0x1b6c6e][_0x4378('0x75')]&&_0x3076e1[_0x4378('0x36')](_0x1a5df6,_0x174c1d[_0x1b6c6e][_0x4378('0x75')]==='DESC'?![]:!![]);_0x3076e1[_0x4378('0x68')](_0x1a5df6,_0x174c1d[_0x1b6c6e][_0x4378('0x76')]||_0x1a5df6);}if(_0x1933e3['joins']){_0x1933e3['joins']=JSON['parse'](_0x1933e3['joins']);for(var _0x4da0ca=0x0;_0x4da0ca<_0x1933e3[_0x4378('0x77')]['length'];_0x4da0ca+=0x1){if(_0x1933e3[_0x4378('0x77')][_0x4da0ca][_0x4378('0x2c')]&&_['includes'](_0x9d278c,_0x1933e3[_0x4378('0x77')][_0x4da0ca]['type'])&&_0x1933e3['joins'][_0x4da0ca]['parentKey']&&_0x1933e3['joins'][_0x4da0ca][_0x4378('0x78')]&&_0x1933e3['joins'][_0x4da0ca][_0x4378('0x79')]){_0x3076e1[_0x1933e3[_0x4378('0x77')][_0x4da0ca][_0x4378('0x2c')]](_0x1933e3[_0x4378('0x77')][_0x4da0ca][_0x4378('0x78')],null,util[_0x4378('0x74')](_0x4378('0x7a'),_0x1933e3['table'],_0x1933e3[_0x4378('0x77')][_0x4da0ca][_0x4378('0x7b')],_0x1933e3['joins'][_0x4da0ca][_0x4378('0x78')],_0x1933e3[_0x4378('0x77')][_0x4da0ca][_0x4378('0x79')]));}}}if(_0x1933e3[_0x4378('0x7c')]){_0x1933e3[_0x4378('0x7c')]=JSON[_0x4378('0x7d')](_0x1933e3[_0x4378('0x7c')]);_0x3076e1['where'](_0x10a733(_0x1933e3[_0x4378('0x7c')][_0x4378('0x67')]));}_0x660651=_0x3076e1[_0x4378('0x7e')]();_0x3076e1['limit'](_0x423f0e);_0x3076e1['offset'](0x0);logger[_0x4378('0x7f')]('Limited\x20Query:',_0x3076e1['toString']());return db[_0x4378('0x80')][_0x4378('0x2f')](_0x3076e1[_0x4378('0x81')](),{'type':db[_0x4378('0x80')]['QueryTypes']['SELECT']});}})[_0x4378('0x22')](respondWithResult(_0x528655,null))[_0x4378('0x42')](handleError(_0x528655,null));};function runReport(_0x55362a,_0x1e1477,_0x179e8b){var _0x1f542c=_0x1e1477['name'];var _0x406a84=0xa;var _0x2e112f=[_0x4378('0x52'),_0x4378('0x53'),'right_join',_0x4378('0x54')];var _0x53fa43={'SUM':_0x4378('0x55'),'COUNT':_0x4378('0x56'),'COUNT DISTINCT':_0x4378('0x57'),'MAX':'MAX(%s)','MIN':_0x4378('0x59'),'AVG':_0x4378('0x82'),'GROUP_CONCAT':_0x4378('0x5a'),'GROUP_CONCAT ASC':_0x4378('0x5b'),'GROUP_CONCAT DESC':_0x4378('0x5c')};var _0x50203c={'SEC_TO_TIME':_0x4378('0x5d'),'DATE':_0x4378('0x5e'),'HOUR':'HOUR(%s)','ROUND':_0x4378('0x83'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x40702b=function(_0x1f1ebc){return!_[_0x4378('0x61')]([_0x4378('0x62'),_0x4378('0x63'),_0x4378('0x84'),_0x4378('0x64')],_0x1f1ebc);};var _0x39c766=function(_0x236eae){if(!_0x236eae||!_0x236eae['rules']['length']){return'';}for(var _0x2b420e='(',_0x46b926=0x0;_0x46b926<_0x236eae[_0x4378('0x65')][_0x4378('0x33')];_0x46b926+=0x1){_0x46b926>0x0&&(_0x2b420e+='\x20'+_0x236eae[_0x4378('0x66')]+'\x20');_0x2b420e+=_0x236eae[_0x4378('0x65')][_0x46b926][_0x4378('0x67')]?_0x39c766(_0x236eae['rules'][_0x46b926][_0x4378('0x67')]):_0x236eae[_0x4378('0x65')][_0x46b926][_0x4378('0x68')]+'\x20'+_0x236eae[_0x4378('0x65')][_0x46b926][_0x4378('0x85')]+(_0x40702b(_0x236eae[_0x4378('0x65')][_0x46b926][_0x4378('0x85')])?'\x20'+_0x236eae[_0x4378('0x65')][_0x46b926][_0x4378('0x86')]:'');}return _0x2b420e+')';};var _0x46d643={'where':{'id':_0x55362a['id']}},_0x26c3c8,_0x1a2bbb,_0x52f4a1,_0x1e560a,_0x30b287;_0x46d643=_[_0x4378('0x3c')]({},_0x46d643,_0x179e8b);return db[_0x4378('0x29')]['find'](_0x46d643)[_0x4378('0x22')](function(_0x4fb414){if(_0x4fb414){_0x26c3c8=_0x4fb414;return _0x4fb414[_0x4378('0x69')]();}return null;})[_0x4378('0x22')](function(_0x298f1a){if(_0x298f1a){if(!_0x298f1a[_0x4378('0x33')]){throw new db[(_0x4378('0x87'))][(_0x4378('0x6a'))](_0x4378('0x6b'),0x193);}_0x1a2bbb=_0x298f1a;return db[_0x4378('0x6c')][_0x4378('0x40')]({'raw':!![]});}return null;})[_0x4378('0x22')](function(_0x1afc59){if(_0x1afc59){_0x52f4a1=_[_0x4378('0x6d')](_0x1afc59,'id');var _0x4f7658;var _0x38c7dd=squel[_0x4378('0x6e')]();_0x38c7dd[_0x4378('0x6f')](_0x26c3c8[_0x4378('0x70')]);for(var _0x2227b9=0x0;_0x2227b9<_0x1a2bbb[_0x4378('0x33')];_0x2227b9+=0x1){_0x4f7658=_0x1a2bbb[_0x2227b9][_0x4378('0x71')]?_0x52f4a1[_0x1a2bbb[_0x2227b9][_0x4378('0x71')]]['metric']:_0x1a2bbb[_0x2227b9][_0x4378('0x68')];_0x4f7658=_0x1a2bbb[_0x2227b9][_0x4378('0x73')]?_[_0x4378('0x72')](_0x53fa43[_0x1a2bbb[_0x2227b9][_0x4378('0x73')]],'%s',_0x4f7658):_0x4f7658;_0x4f7658=_0x1a2bbb[_0x2227b9][_0x4378('0x74')]?_[_0x4378('0x72')](_0x50203c[_0x1a2bbb[_0x2227b9][_0x4378('0x74')]],'%s',_0x4f7658):_0x4f7658;if(_0x1a2bbb[_0x2227b9][_0x4378('0x88')]){_0x38c7dd[_0x4378('0x67')](_0x4f7658);}_0x1a2bbb[_0x2227b9][_0x4378('0x75')]&&_0x38c7dd[_0x4378('0x36')](_0x4f7658,_0x1a2bbb[_0x2227b9]['orderBy']==='DESC'?![]:!![]);_0x38c7dd[_0x4378('0x68')](_0x4f7658,_0x1a2bbb[_0x2227b9]['alias']||_0x4f7658);}if(_0x26c3c8[_0x4378('0x77')]){_0x26c3c8[_0x4378('0x77')]=JSON['parse'](_0x26c3c8[_0x4378('0x77')]);for(var _0x4e0f39=0x0;_0x4e0f39<_0x26c3c8[_0x4378('0x77')]['length'];_0x4e0f39+=0x1){if(_0x26c3c8[_0x4378('0x77')][_0x4e0f39]['type']&&_['includes'](_0x2e112f,_0x26c3c8[_0x4378('0x77')][_0x4e0f39][_0x4378('0x2c')])&&_0x26c3c8[_0x4378('0x77')][_0x4e0f39]['parentKey']&&_0x26c3c8['joins'][_0x4e0f39]['foreignTable']&&_0x26c3c8[_0x4378('0x77')][_0x4e0f39][_0x4378('0x79')]){_0x38c7dd[_0x26c3c8[_0x4378('0x77')][_0x4e0f39]['type']](_0x26c3c8[_0x4378('0x77')][_0x4e0f39][_0x4378('0x78')],null,util[_0x4378('0x74')]('%s.%s\x20=\x20%s.%s',_0x26c3c8[_0x4378('0x70')],_0x26c3c8[_0x4378('0x77')][_0x4e0f39][_0x4378('0x7b')],_0x26c3c8[_0x4378('0x77')][_0x4e0f39][_0x4378('0x78')],_0x26c3c8[_0x4378('0x77')][_0x4e0f39][_0x4378('0x79')]));}}}if(_0x26c3c8[_0x4378('0x7c')]){_0x26c3c8[_0x4378('0x7c')]=JSON[_0x4378('0x7d')](_0x26c3c8['conditions']);_0x38c7dd[_0x4378('0x38')](_0x39c766(_0x26c3c8[_0x4378('0x7c')][_0x4378('0x67')]));}_0x30b287=_0x38c7dd[_0x4378('0x7e')]();_0x38c7dd['limit'](_0x406a84);_0x38c7dd[_0x4378('0x19')](0x0);logger[_0x4378('0x7f')](_0x4378('0x89'),_0x38c7dd[_0x4378('0x81')]());return db['sequelize']['query'](_0x38c7dd[_0x4378('0x81')](),{'type':db[_0x4378('0x80')][_0x4378('0x8a')][_0x4378('0x8b')]});}})[_0x4378('0x22')](function(_0x2e963a){if(!_0x2e963a[_0x4378('0x33')]){throw new db['Sequelize']['ValidationErrorItem'](_0x4378('0x8c'),0xcc);}if(_0x1e1477[_0x4378('0x8d')]==='web'){return null;}var _0x55f051=_[_0x4378('0x3c')](_0x1e1477,{'name':_0x1e1477['fullPath']||_0x1e1477[_0x4378('0x25')]||_0x26c3c8[_0x4378('0x25')],'basename':_0x1f542c,'savename':util[_0x4378('0x74')](_0x4378('0x8e'),_0x1e1477[_0x4378('0x25')]||_0x26c3c8['name'],require(_0x4378('0x8f'))[_0x4378('0x90')](0x4),_0x1e1477[_0x4378('0x8d')]||_0x4378('0x91')),'reportId':_0x26c3c8['id'],'reportType':_0x4378('0x92')});return db[_0x4378('0x93')][_0x4378('0x47')](_0x55f051,{'raw':!![]});})[_0x4378('0x22')](function(_0x3bd646){if(_0x26c3c8[_0x4378('0x70')]===_0x4378('0x94')){_0x30b287[_0x4378('0x38')](_0x26c3c8['table']+_0x4378('0x95'),_0x1e1477[_0x4378('0x96')],_0x1e1477[_0x4378('0x97')]);}else{_0x30b287[_0x4378('0x38')](_0x26c3c8[_0x4378('0x70')]+_0x4378('0x98'),_0x1e1477[_0x4378('0x96')],_0x1e1477[_0x4378('0x97')]);}if(_0x3bd646){logger[_0x4378('0x99')](_0x4378('0x9a'),_0x30b287['toString']());require(_0x4378('0x9b'))[_0x4378('0x9c')](path[_0x4378('0x52')](__dirname,_0x4378('0x9d'),_0x3bd646[_0x4378('0x8d')]),[_0x3bd646['id'],_0x30b287['toString'](),path[_0x4378('0x52')](__dirname,'../../files/reports',_0x3bd646[_0x4378('0x9e')]),_0x1f542c]);return _0x3bd646;}else{var _0x4fbae1=squel[_0x4378('0x6e')]();_0x4fbae1[_0x4378('0x6f')]('('+_0x30b287[_0x4378('0x81')]()+')',_0x4378('0x9f'));_0x4fbae1[_0x4378('0x68')](_0x4378('0xa0'),_0x4378('0x3f'));_0x30b287[_0x4378('0x1a')](_0x1e1477['limit']||_0x406a84);_0x30b287['offset'](_0x1e1477['offset']||0x0);return db[_0x4378('0x80')][_0x4378('0x2f')](_0x4fbae1[_0x4378('0x81')](),{'type':db[_0x4378('0x80')][_0x4378('0x8a')][_0x4378('0x8b')]})['then'](function(_0x3dc1bb){if(!_0x3dc1bb[_0x4378('0x33')]){_0x1e560a=0x0;}else{_0x1e560a=_0x3dc1bb[0x0]['count']||0x0;}return db['sequelize']['query'](_0x30b287[_0x4378('0x81')](),{'type':db[_0x4378('0x80')][_0x4378('0x8a')][_0x4378('0x8b')]});})['then'](function(_0x2069c6){return{'rows':_0x2069c6||[],'count':_0x1e560a};});}});}exports[_0x4378('0xa1')]=function(_0x3c2a0b,_0x5cd277){return runReport(_0x3c2a0b[_0x4378('0x43')],_0x3c2a0b[_0x4378('0x2f')],_0x3c2a0b[_0x4378('0x3e')])[_0x4378('0x22')](respondWithResult(_0x5cd277,null))['catch'](handleError(_0x5cd277,null));};exports[_0x4378('0xa2')]=runReport;exports[_0x4378('0x2f')]=function(_0x497d3e,_0x1866d6){var _0x7fcea5=0xa;var _0x38f15e=[_0x4378('0x52'),_0x4378('0x53'),'right_join',_0x4378('0x54')];var _0x2f75d5={'SUM':_0x4378('0x55'),'COUNT':_0x4378('0x56'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x4378('0x59'),'AVG':_0x4378('0x82'),'GROUP_CONCAT':_0x4378('0x5a'),'GROUP_CONCAT ASC':_0x4378('0x5b'),'GROUP_CONCAT DESC':_0x4378('0x5c')};var _0x462b8c={'SEC_TO_TIME':_0x4378('0x5d'),'DATE':_0x4378('0x5e'),'HOUR':'HOUR(%s)','ROUND':_0x4378('0x83'),'UNIX_TIMESTAMP':_0x4378('0x60')};var _0x45c950=function(_0x586fdf){return!_['includes'](['IS\x20NULL',_0x4378('0x63'),_0x4378('0x84'),_0x4378('0x64')],_0x586fdf);};var _0x4b0b3b=function(_0x241ac7){if(!_0x241ac7||!_0x241ac7[_0x4378('0x65')][_0x4378('0x33')]){return'';}for(var _0xb9dc60='(',_0x9f63bf=0x0;_0x9f63bf<_0x241ac7[_0x4378('0x65')][_0x4378('0x33')];_0x9f63bf+=0x1){_0x9f63bf>0x0&&(_0xb9dc60+='\x20'+_0x241ac7['operator']+'\x20');_0xb9dc60+=_0x241ac7['rules'][_0x9f63bf][_0x4378('0x67')]?_0x4b0b3b(_0x241ac7['rules'][_0x9f63bf][_0x4378('0x67')]):_0x241ac7[_0x4378('0x65')][_0x9f63bf][_0x4378('0x68')]+'\x20'+_0x241ac7[_0x4378('0x65')][_0x9f63bf][_0x4378('0x85')]+(_0x45c950(_0x241ac7['rules'][_0x9f63bf]['condition'])?'\x20'+_0x241ac7['rules'][_0x9f63bf]['value']:'');}return _0xb9dc60+')';};var _0x3a3684={'where':{'id':_0x497d3e[_0x4378('0x43')]['id']}},_0x318be0,_0x462690,_0x1e2137,_0x4c87c0,_0x406ba9;_0x3a3684=_[_0x4378('0x3c')]({},_0x3a3684,_0x497d3e['options']);return db['AnalyticDefaultReport'][_0x4378('0x46')](_0x3a3684)['then'](function(_0x51dc64){if(_0x51dc64){_0x318be0=_0x51dc64;return _0x51dc64[_0x4378('0x69')]();}return null;})[_0x4378('0x22')](function(_0x36f83f){if(_0x36f83f){if(!_0x36f83f[_0x4378('0x33')]){throw new db[(_0x4378('0x87'))]['ValidationErrorItem'](_0x4378('0x6b'),0x193);}_0x462690=_0x36f83f;return db[_0x4378('0x6c')]['findAll']({'raw':!![]});}return null;})[_0x4378('0x22')](function(_0x4a8a56){if(_0x4a8a56){_0x1e2137=_[_0x4378('0x6d')](_0x4a8a56,'id');var _0x4b9622;var _0x1457fc=squel['select']();_0x1457fc[_0x4378('0x6f')](_0x318be0[_0x4378('0x70')]);for(var _0x693d16=0x0;_0x693d16<_0x462690[_0x4378('0x33')];_0x693d16+=0x1){_0x4b9622=_0x462690[_0x693d16][_0x4378('0x71')]?_0x1e2137[_0x462690[_0x693d16][_0x4378('0x71')]][_0x4378('0xa3')]:_0x462690[_0x693d16]['field'];_0x4b9622=_0x462690[_0x693d16]['function']?_[_0x4378('0x72')](_0x2f75d5[_0x462690[_0x693d16]['function']],'%s',_0x4b9622):_0x4b9622;_0x4b9622=_0x462690[_0x693d16][_0x4378('0x74')]?_['replace'](_0x462b8c[_0x462690[_0x693d16][_0x4378('0x74')]],'%s',_0x4b9622):_0x4b9622;if(_0x462690[_0x693d16][_0x4378('0x88')]){_0x1457fc['group'](_0x4b9622);}_0x462690[_0x693d16][_0x4378('0x75')]&&_0x1457fc[_0x4378('0x36')](_0x4b9622,_0x462690[_0x693d16][_0x4378('0x75')]===_0x4378('0xa4')?![]:!![]);_0x1457fc['field'](_0x4b9622,_0x462690[_0x693d16][_0x4378('0x76')]||_0x4b9622);}if(_0x318be0[_0x4378('0x77')]){_0x318be0[_0x4378('0x77')]=JSON[_0x4378('0x7d')](_0x318be0[_0x4378('0x77')]);for(var _0x1dd887=0x0;_0x1dd887<_0x318be0[_0x4378('0x77')]['length'];_0x1dd887+=0x1){if(_0x318be0[_0x4378('0x77')][_0x1dd887][_0x4378('0x2c')]&&_[_0x4378('0x61')](_0x38f15e,_0x318be0[_0x4378('0x77')][_0x1dd887][_0x4378('0x2c')])&&_0x318be0[_0x4378('0x77')][_0x1dd887][_0x4378('0x7b')]&&_0x318be0['joins'][_0x1dd887][_0x4378('0x78')]&&_0x318be0[_0x4378('0x77')][_0x1dd887]['foreignKey']){_0x1457fc[_0x318be0[_0x4378('0x77')][_0x1dd887][_0x4378('0x2c')]](_0x318be0['joins'][_0x1dd887][_0x4378('0x78')],null,util[_0x4378('0x74')](_0x4378('0x7a'),_0x318be0['table'],_0x318be0[_0x4378('0x77')][_0x1dd887][_0x4378('0x7b')],_0x318be0['joins'][_0x1dd887][_0x4378('0x78')],_0x318be0[_0x4378('0x77')][_0x1dd887][_0x4378('0x79')]));}}}if(_0x318be0['conditions']){_0x318be0[_0x4378('0x7c')]=JSON['parse'](_0x318be0['conditions']);_0x1457fc[_0x4378('0x38')](_0x4b0b3b(_0x318be0[_0x4378('0x7c')][_0x4378('0x67')]));}_0x406ba9=_0x1457fc[_0x4378('0x7e')]();_0x1457fc[_0x4378('0x1a')](_0x7fcea5);_0x1457fc[_0x4378('0x19')](0x0);logger[_0x4378('0x7f')]('Limited\x20Query:',_0x1457fc[_0x4378('0x81')]());return db[_0x4378('0x80')]['query'](_0x1457fc[_0x4378('0x81')](),{'type':db[_0x4378('0x80')][_0x4378('0x8a')][_0x4378('0x8b')]});}})[_0x4378('0x22')](function(){return{'sql':_0x406ba9[_0x4378('0x81')]()};})[_0x4378('0x22')](respondWithResult(_0x1866d6,null))[_0x4378('0x42')](handleError(_0x1866d6,null));}; \ No newline at end of file +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 diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 1087e0c..4cdec4f 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 _0x3e1a=['../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','util','../../config/logger','moment','bluebird','rimraf'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x3e1a,0x187));var _0xa3e1=function(_0x38dc2e,_0x2cdaa5){_0x38dc2e=_0x38dc2e-0x0;var _0x27343b=_0x3e1a[_0x38dc2e];return _0x27343b;};'use strict';var _=require('lodash');var util=require(_0xa3e1('0x0'));var logger=require(_0xa3e1('0x1'))('api');var moment=require(_0xa3e1('0x2'));var BPromise=require(_0xa3e1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa3e1('0x4'));var config=require(_0xa3e1('0x5'));var attributes=require(_0xa3e1('0x6'));module['exports']=function(_0x1f35fc,_0x524bd5){return _0x1f35fc[_0xa3e1('0x7')](_0xa3e1('0x8'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index d78300a..b652598 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 _0x6822=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','AnalyticDefaultReport,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring'];(function(_0x54aea3,_0xae7d81){var _0x21ae46=function(_0xe16dbc){while(--_0xe16dbc){_0x54aea3['push'](_0x54aea3['shift']());}};_0x21ae46(++_0xae7d81);}(_0x6822,0x18c));var _0x2682=function(_0x320942,_0x2641c2){_0x320942=_0x320942-0x0;var _0x3ff787=_0x6822[_0x320942];return _0x3ff787;};'use strict';var _=require('lodash');var util=require(_0x2682('0x0'));var moment=require(_0x2682('0x1'));var BPromise=require(_0x2682('0x2'));var rs=require(_0x2682('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2682('0x4'))['db'];var utils=require(_0x2682('0x5'));var logger=require(_0x2682('0x6'))(_0x2682('0x7'));var config=require(_0x2682('0x8'));var jayson=require(_0x2682('0x9'));var client=jayson[_0x2682('0xa')][_0x2682('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35f55b,_0x3f706c,_0x4242c5){return new BPromise(function(_0x1a1307,_0x303fe4){return client[_0x2682('0xc')](_0x35f55b,_0x4242c5)['then'](function(_0x3e72bc){logger[_0x2682('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3f706c,'request\x20sent');logger['debug'](_0x2682('0xe'),_0x3f706c,_0x2682('0xf'),JSON['stringify'](_0x3e72bc));if(_0x3e72bc[_0x2682('0x10')]){if(_0x3e72bc[_0x2682('0x10')]['code']===0x1f4){logger[_0x2682('0x10')](_0x2682('0x11'),_0x3f706c,_0x3e72bc[_0x2682('0x10')][_0x2682('0x12')]);return _0x303fe4(_0x3e72bc[_0x2682('0x10')][_0x2682('0x12')]);}logger[_0x2682('0x10')](_0x2682('0x11'),_0x3f706c,_0x3e72bc[_0x2682('0x10')][_0x2682('0x12')]);return _0x1a1307(_0x3e72bc[_0x2682('0x10')][_0x2682('0x12')]);}else{logger[_0x2682('0xd')](_0x2682('0x11'),_0x3f706c,_0x2682('0xf'));_0x1a1307(_0x3e72bc['result']['message']);}})[_0x2682('0x13')](function(_0x2b1ed2){logger[_0x2682('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3f706c,_0x2b1ed2);_0x303fe4(_0x2b1ed2);});});} \ No newline at end of file +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 diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 078c7a1..81eac45 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 _0x8906=['express','Router','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','show','/:id/preview','preview','/:id/run','/:id/query','query','create','put','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x105702,_0x3d4a6c){var _0x10ff6b=function(_0x26ddf0){while(--_0x26ddf0){_0x105702['push'](_0x105702['shift']());}};_0x10ff6b(++_0x3d4a6c);}(_0x8906,0x1b6));var _0x6890=function(_0x451055,_0x3d3a2e){_0x451055=_0x451055-0x0;var _0x4c946a=_0x8906[_0x451055];return _0x4c946a;};'use strict';var multer=require(_0x6890('0x0'));var util=require(_0x6890('0x1'));var path=require('path');var timeout=require(_0x6890('0x2'));var express=require(_0x6890('0x3'));var router=express[_0x6890('0x4')]();var auth=require(_0x6890('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6890('0x6'));var controller=require('./analyticDefaultReport.controller');router[_0x6890('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6890('0x7')](_0x6890('0x8'),auth[_0x6890('0x9')](),controller[_0x6890('0xa')]);router[_0x6890('0x7')](_0x6890('0xb'),auth['isAuthenticated'](),controller[_0x6890('0xc')]);router[_0x6890('0x7')](_0x6890('0xd'),auth[_0x6890('0x9')](),controller['run']);router[_0x6890('0x7')](_0x6890('0xe'),auth['isAuthenticated'](),controller[_0x6890('0xf')]);router['post']('/',auth[_0x6890('0x9')](),controller[_0x6890('0x10')]);router[_0x6890('0x11')](_0x6890('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x6890('0x12')](_0x6890('0x8'),auth[_0x6890('0x9')](),controller[_0x6890('0x13')]);module[_0x6890('0x14')]=router; \ No newline at end of file +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 diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 2fee49a..786c78f 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 _0xefd2=['STRING','ENUM','pdf','xlsx','csv','DATE','Loading','scheduled','UNSIGNED','moment','exports'];(function(_0x10e983,_0x2f4eda){var _0x324138=function(_0x17a377){while(--_0x17a377){_0x10e983['push'](_0x10e983['shift']());}};_0x324138(++_0x2f4eda);}(_0xefd2,0x132));var _0x2efd=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xefd2[_0x29d915];return _0x160f86;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2efd('0x0'));module[_0x2efd('0x1')]={'name':{'type':Sequelize[_0x2efd('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x2efd('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x2efd('0x3')]('csv',_0x2efd('0x4'),_0x2efd('0x5')),'allowNull':![],'defaultValue':_0x2efd('0x6')},'savename':{'type':Sequelize[_0x2efd('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x2efd('0x7')]},'status':{'type':Sequelize[_0x2efd('0x2')],'defaultValue':_0x2efd('0x8')},'type':{'type':Sequelize[_0x2efd('0x3')]('manual',_0x2efd('0x9')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x2efd('0xa')]},'reportType':{'type':Sequelize[_0x2efd('0x2')]}}; \ No newline at end of file +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 diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 4ce566d..77957e1 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 _0xe3b0=['type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','filter','merge','count','includeAll','include','rows','catch','show','params','intersection','options','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','download','basename','savename','output','join','root','server/files/reports','Sequelize','ValidationError','exists','%s.%s','toLowerCase','html-pdf','rimraf','zip-dir','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','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','apply','save','update','then','destroy','ExtractedReports','UserProfileResource','error','stack','name','index','map','AnalyticExtractedReport','rawAttributes','fieldName'];(function(_0xe7e7c3,_0x2d9ea3){var _0x5887f7=function(_0x32cf9e){while(--_0x32cf9e){_0xe7e7c3['push'](_0xe7e7c3['shift']());}};_0x5887f7(++_0x2d9ea3);}(_0xe3b0,0x19f));var _0x0e3b=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0xe3b0[_0x1c8c28];return _0x1f59b4;};'use strict';var pdf=require(_0x0e3b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0e3b('0x1'));var zipdir=require(_0x0e3b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0e3b('0x3'));var BPromise=require(_0x0e3b('0x4'));var Mustache=require(_0x0e3b('0x5'));var util=require(_0x0e3b('0x6'));var path=require(_0x0e3b('0x7'));var sox=require(_0x0e3b('0x8'));var csv=require(_0x0e3b('0x9'));var ejs=require(_0x0e3b('0xa'));var fs=require('fs');var _=require(_0x0e3b('0xb'));var squel=require('squel');var crypto=require(_0x0e3b('0xc'));var jsforce=require(_0x0e3b('0xd'));var deskjs=require(_0x0e3b('0xe'));var toCsv=require(_0x0e3b('0x9'));var querystring=require(_0x0e3b('0xf'));var Papa=require(_0x0e3b('0x10'));var Redis=require(_0x0e3b('0x11'));var authService=require(_0x0e3b('0x12'));var qs=require(_0x0e3b('0x13'));var as=require(_0x0e3b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0e3b('0x15'))('api');var utils=require(_0x0e3b('0x16'));var config=require(_0x0e3b('0x17'));var db=require(_0x0e3b('0x18'))['db'];function respondWithStatusCode(_0x445c8c,_0x3fd43a){_0x3fd43a=_0x3fd43a||0xcc;return function(_0x2e2b42){if(_0x2e2b42){return _0x445c8c[_0x0e3b('0x19')](_0x3fd43a);}return _0x445c8c[_0x0e3b('0x1a')](_0x3fd43a)[_0x0e3b('0x1b')]();};}function respondWithResult(_0x35dafc,_0x5d6bac){_0x5d6bac=_0x5d6bac||0xc8;return function(_0x20fd65){if(_0x20fd65){return _0x35dafc[_0x0e3b('0x1a')](_0x5d6bac)[_0x0e3b('0x1c')](_0x20fd65);}};}function respondWithFilteredResult(_0x7af388,_0x1ef51b){return function(_0x155670){if(_0x155670){var _0x20dd16=_0x155670['count'],_0x3d4186=_0x1ef51b['offset'],_0xef4b8e=_0x1ef51b['offset']+_0x1ef51b[_0x0e3b('0x1d')],_0x114d29;if(_0xef4b8e>=_0x20dd16){_0xef4b8e=_0x20dd16;_0x114d29=0xc8;}else{_0x114d29=0xce;}_0x7af388[_0x0e3b('0x1a')](_0x114d29);return _0x7af388['set']('Content-Range',_0x3d4186+'-'+_0xef4b8e+'/'+_0x20dd16)['json'](_0x155670);}return null;};}function patchUpdates(_0x5dcecc){return function(_0x5b4707){try{jsonpatch[_0x0e3b('0x1e')](_0x5b4707,_0x5dcecc,!![]);}catch(_0xb21e68){return BPromise['reject'](_0xb21e68);}return _0x5b4707[_0x0e3b('0x1f')]();};}function saveUpdates(_0x27a188,_0x47fc4b){return function(_0x5e283b){if(_0x5e283b){return _0x5e283b[_0x0e3b('0x20')](_0x27a188)[_0x0e3b('0x21')](function(_0x3b5fb6){return _0x3b5fb6;});}return null;};}function removeEntity(_0x38ef46,_0x3079b4){return function(_0x56cf73){if(_0x56cf73){return _0x56cf73[_0x0e3b('0x22')]()[_0x0e3b('0x21')](function(){var _0xddb801=_0x56cf73['get']({'plain':!![]});var _0x178f9e=_0x0e3b('0x23');return db[_0x0e3b('0x24')][_0x0e3b('0x22')]({'where':{'type':_0x178f9e,'resourceId':_0xddb801['id']}})[_0x0e3b('0x21')](function(){return _0x56cf73;});})[_0x0e3b('0x21')](function(){_0x38ef46[_0x0e3b('0x1a')](0xcc)[_0x0e3b('0x1b')]();});}};}function handleEntityNotFound(_0x31d4ca,_0x290acb){return function(_0x58fb9b){if(!_0x58fb9b){_0x31d4ca['sendStatus'](0x194);}return _0x58fb9b;};}function handleError(_0x482a68,_0xf65916){_0xf65916=_0xf65916||0x1f4;return function(_0x4c3adf){logger[_0x0e3b('0x25')](_0x4c3adf[_0x0e3b('0x26')]);if(_0x4c3adf['name']){delete _0x4c3adf[_0x0e3b('0x27')];}_0x482a68[_0x0e3b('0x1a')](_0xf65916)['send'](_0x4c3adf);};}exports[_0x0e3b('0x28')]=function(_0x1a91b2,_0x14e908){var _0x3be03c={},_0x475ca1={},_0x565bba={'count':0x0,'rows':[]};var _0x958d73=_[_0x0e3b('0x29')](db[_0x0e3b('0x2a')][_0x0e3b('0x2b')],function(_0x46af4c){return{'name':_0x46af4c[_0x0e3b('0x2c')],'type':_0x46af4c[_0x0e3b('0x2d')]['key']};});_0x475ca1[_0x0e3b('0x2e')]=_[_0x0e3b('0x29')](_0x958d73,_0x0e3b('0x27'));_0x475ca1[_0x0e3b('0x2f')]=_[_0x0e3b('0x30')](_0x1a91b2[_0x0e3b('0x2f')]);_0x475ca1[_0x0e3b('0x31')]=_['intersection'](_0x475ca1['model'],_0x475ca1['query']);_0x3be03c[_0x0e3b('0x32')]=_['intersection'](_0x475ca1[_0x0e3b('0x2e')],qs['fields'](_0x1a91b2['query'][_0x0e3b('0x33')]));_0x3be03c[_0x0e3b('0x32')]=_0x3be03c[_0x0e3b('0x32')][_0x0e3b('0x34')]?_0x3be03c['attributes']:_0x475ca1[_0x0e3b('0x2e')];if(!_0x1a91b2[_0x0e3b('0x2f')][_0x0e3b('0x35')](_0x0e3b('0x36'))){_0x3be03c[_0x0e3b('0x1d')]=qs[_0x0e3b('0x1d')](_0x1a91b2['query'][_0x0e3b('0x1d')]);_0x3be03c['offset']=qs[_0x0e3b('0x37')](_0x1a91b2['query'][_0x0e3b('0x37')]);}_0x3be03c['order']=qs[_0x0e3b('0x38')](_0x1a91b2[_0x0e3b('0x2f')]['sort']);_0x3be03c[_0x0e3b('0x39')]=qs[_0x0e3b('0x31')](_['pick'](_0x1a91b2[_0x0e3b('0x2f')],_0x475ca1[_0x0e3b('0x31')]));if(_0x1a91b2[_0x0e3b('0x2f')][_0x0e3b('0x3a')]){_0x3be03c[_0x0e3b('0x39')]=_[_0x0e3b('0x3b')](_0x3be03c[_0x0e3b('0x39')],{'$or':_[_0x0e3b('0x29')](_0x958d73,function(_0x29456d){if(_0x29456d['type']!=='VIRTUAL'){var _0x230277={};_0x230277[_0x29456d[_0x0e3b('0x27')]]={'$like':'%'+_0x1a91b2[_0x0e3b('0x2f')][_0x0e3b('0x3a')]+'%'};return _0x230277;}})});}_0x3be03c=_[_0x0e3b('0x3b')]({},_0x3be03c,_0x1a91b2['options']);var _0x58f47c={'where':_0x3be03c[_0x0e3b('0x39')]};return db[_0x0e3b('0x2a')][_0x0e3b('0x3c')](_0x58f47c)[_0x0e3b('0x21')](function(_0x195986){_0x565bba[_0x0e3b('0x3c')]=_0x195986;if(_0x1a91b2[_0x0e3b('0x2f')][_0x0e3b('0x3d')]){_0x3be03c[_0x0e3b('0x3e')]=[{'all':!![]}];}return db[_0x0e3b('0x2a')]['findAll'](_0x3be03c);})[_0x0e3b('0x21')](function(_0x524e7a){_0x565bba[_0x0e3b('0x3f')]=_0x524e7a;return _0x565bba;})['then'](respondWithFilteredResult(_0x14e908,_0x3be03c))[_0x0e3b('0x40')](handleError(_0x14e908,null));};exports[_0x0e3b('0x41')]=function(_0x27da8d,_0xb7f055){var _0x23f86e={'raw':!![],'where':{'id':_0x27da8d[_0x0e3b('0x42')]['id']}},_0x2ffbfa={};_0x2ffbfa[_0x0e3b('0x2e')]=_[_0x0e3b('0x30')](db[_0x0e3b('0x2a')][_0x0e3b('0x2b')]);_0x2ffbfa[_0x0e3b('0x2f')]=_[_0x0e3b('0x30')](_0x27da8d[_0x0e3b('0x2f')]);_0x2ffbfa[_0x0e3b('0x31')]=_[_0x0e3b('0x43')](_0x2ffbfa[_0x0e3b('0x2e')],_0x2ffbfa[_0x0e3b('0x2f')]);_0x23f86e[_0x0e3b('0x32')]=_[_0x0e3b('0x43')](_0x2ffbfa[_0x0e3b('0x2e')],qs[_0x0e3b('0x33')](_0x27da8d['query'][_0x0e3b('0x33')]));_0x23f86e[_0x0e3b('0x32')]=_0x23f86e['attributes'][_0x0e3b('0x34')]?_0x23f86e['attributes']:_0x2ffbfa[_0x0e3b('0x2e')];if(_0x27da8d[_0x0e3b('0x2f')]['includeAll']){_0x23f86e[_0x0e3b('0x3e')]=[{'all':!![]}];}_0x23f86e=_[_0x0e3b('0x3b')]({},_0x23f86e,_0x27da8d[_0x0e3b('0x44')]);return db[_0x0e3b('0x2a')]['find'](_0x23f86e)[_0x0e3b('0x21')](handleEntityNotFound(_0xb7f055,null))['then'](respondWithResult(_0xb7f055,null))[_0x0e3b('0x40')](handleError(_0xb7f055,null));};exports[_0x0e3b('0x45')]=function(_0x466ddc,_0x335576){return db[_0x0e3b('0x2a')][_0x0e3b('0x45')](_0x466ddc[_0x0e3b('0x46')],{})['then'](function(_0x3e6eca){var _0x347e23=_0x466ddc['user'][_0x0e3b('0x47')]({'plain':!![]});if(!_0x347e23)throw new Error(_0x0e3b('0x48'));if(_0x347e23[_0x0e3b('0x49')]===_0x0e3b('0x4a')){var _0x529637=_0x3e6eca[_0x0e3b('0x47')]({'plain':!![]});var _0x259822=_0x0e3b('0x23');return db[_0x0e3b('0x4b')]['find']({'where':{'name':_0x259822,'userProfileId':_0x347e23[_0x0e3b('0x4c')]},'raw':!![]})['then'](function(_0x5194ef){if(_0x5194ef&&_0x5194ef[_0x0e3b('0x4d')]===0x0){return db[_0x0e3b('0x24')]['create']({'name':_0x529637[_0x0e3b('0x27')],'resourceId':_0x529637['id'],'type':_0x5194ef[_0x0e3b('0x27')],'sectionId':_0x5194ef['id']},{})[_0x0e3b('0x21')](function(){return _0x3e6eca;});}else{return _0x3e6eca;}})[_0x0e3b('0x40')](function(_0x26a45c){logger['error'](_0x0e3b('0x4e'),_0x26a45c);throw _0x26a45c;});}return _0x3e6eca;})[_0x0e3b('0x21')](respondWithResult(_0x335576,0xc9))[_0x0e3b('0x40')](handleError(_0x335576,null));};exports[_0x0e3b('0x20')]=function(_0x472ef8,_0x4aa47f){if(_0x472ef8[_0x0e3b('0x46')]['id']){delete _0x472ef8[_0x0e3b('0x46')]['id'];}return db[_0x0e3b('0x2a')][_0x0e3b('0x4f')]({'where':{'id':_0x472ef8['params']['id']}})['then'](handleEntityNotFound(_0x4aa47f,null))[_0x0e3b('0x21')](saveUpdates(_0x472ef8[_0x0e3b('0x46')],null))[_0x0e3b('0x21')](respondWithResult(_0x4aa47f,null))['catch'](handleError(_0x4aa47f,null));};exports[_0x0e3b('0x22')]=function(_0x5431ac,_0x4118c8){return db[_0x0e3b('0x2a')]['find']({'where':{'id':_0x5431ac['params']['id']}})['then'](handleEntityNotFound(_0x4118c8,null))[_0x0e3b('0x21')](removeEntity(_0x4118c8,null))[_0x0e3b('0x40')](handleError(_0x4118c8,null));};exports[_0x0e3b('0x50')]=function(_0x170b3d,_0x45c582,_0x4f8ed3){return db['AnalyticExtractedReport'][_0x0e3b('0x4f')]({'where':{'id':_0x170b3d['params']['id']},'attributes':[_0x0e3b('0x27'),_0x0e3b('0x51'),_0x0e3b('0x52'),_0x0e3b('0x53')],'raw':!![]})[_0x0e3b('0x21')](handleEntityNotFound(_0x45c582,null))[_0x0e3b('0x21')](function(_0x1d35b3){if(_0x1d35b3){if(!fs['existsSync'](path[_0x0e3b('0x54')](config[_0x0e3b('0x55')],_0x0e3b('0x56'),_0x1d35b3[_0x0e3b('0x52')]))){throw new db[(_0x0e3b('0x57'))][(_0x0e3b('0x58'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x170b3d[_0x0e3b('0x2f')][_0x0e3b('0x59')]){return _0x45c582[_0x0e3b('0x19')](0xc8);}return _0x45c582[_0x0e3b('0x50')](path[_0x0e3b('0x54')](config['root'],'server/files/reports',_0x1d35b3[_0x0e3b('0x52')]),util['format'](_0x0e3b('0x5a'),_0x1d35b3['basename']||_0x1d35b3['name'],_0x1d35b3['output'][_0x0e3b('0x5b')]()));}})['catch'](handleError(_0x45c582,null));}; \ No newline at end of file +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 diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 3dee13e..51b7b86 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 _0x5abd=['AnalyticExtractedReport','analytics_extracted_reports','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define'];(function(_0x22d4f0,_0x23edba){var _0x453942=function(_0x4d7a9b){while(--_0x4d7a9b){_0x22d4f0['push'](_0x22d4f0['shift']());}};_0x453942(++_0x23edba);}(_0x5abd,0x6a));var _0xd5ab=function(_0x47cc9a,_0x45415c){_0x47cc9a=_0x47cc9a-0x0;var _0x22bd37=_0x5abd[_0x47cc9a];return _0x22bd37;};'use strict';var _=require(_0xd5ab('0x0'));var util=require(_0xd5ab('0x1'));var logger=require('../../config/logger')(_0xd5ab('0x2'));var moment=require(_0xd5ab('0x3'));var BPromise=require(_0xd5ab('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd5ab('0x5'));var rimraf=require(_0xd5ab('0x6'));var config=require(_0xd5ab('0x7'));var attributes=require(_0xd5ab('0x8'));module[_0xd5ab('0x9')]=function(_0x186c57,_0x5d063a){return _0x186c57[_0xd5ab('0xa')](_0xd5ab('0xb'),attributes,{'tableName':_0xd5ab('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index c8d2ef8..b960088 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 _0x6113=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x292bf6,_0xe2de0a){var _0x278c57=function(_0xe19f89){while(--_0xe19f89){_0x292bf6['push'](_0x292bf6['shift']());}};_0x278c57(++_0xe2de0a);}(_0x6113,0xfb));var _0x3611=function(_0x12aaee,_0x5bf50c){_0x12aaee=_0x12aaee-0x0;var _0x37c350=_0x6113[_0x12aaee];return _0x37c350;};'use strict';var _=require(_0x3611('0x0'));var util=require(_0x3611('0x1'));var moment=require(_0x3611('0x2'));var BPromise=require('bluebird');var rs=require(_0x3611('0x3'));var fs=require('fs');var Redis=require(_0x3611('0x4'));var db=require(_0x3611('0x5'))['db'];var utils=require(_0x3611('0x6'));var logger=require('../../config/logger')(_0x3611('0x7'));var config=require('../../config/environment');var jayson=require(_0x3611('0x8'));var client=jayson[_0x3611('0x9')][_0x3611('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a5e3d,_0x2c1015,_0x1e9eba){return new BPromise(function(_0x3f0911,_0x19de89){return client[_0x3611('0xb')](_0x2a5e3d,_0x1e9eba)[_0x3611('0xc')](function(_0x5a48be){logger[_0x3611('0xd')](_0x3611('0xe'),_0x2c1015,_0x3611('0xf'));logger[_0x3611('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x2c1015,_0x3611('0xf'),JSON[_0x3611('0x11')](_0x5a48be));if(_0x5a48be[_0x3611('0x12')]){if(_0x5a48be['error'][_0x3611('0x13')]===0x1f4){logger[_0x3611('0x12')](_0x3611('0xe'),_0x2c1015,_0x5a48be[_0x3611('0x12')][_0x3611('0x14')]);return _0x19de89(_0x5a48be['error'][_0x3611('0x14')]);}logger[_0x3611('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2c1015,_0x5a48be['error'][_0x3611('0x14')]);return _0x3f0911(_0x5a48be[_0x3611('0x12')]['message']);}else{logger['info'](_0x3611('0xe'),_0x2c1015,_0x3611('0xf'));_0x3f0911(_0x5a48be[_0x3611('0x15')]['message']);}})[_0x3611('0x16')](function(_0x14e14f){logger[_0x3611('0x12')](_0x3611('0xe'),_0x2c1015,_0x14e14f);_0x19de89(_0x14e14f);});});} \ No newline at end of file +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 diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index da63042..e42d49f 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 _0xca8e=['show','download','post','put','/:id','destroy','exports','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','isAuthenticated','index'];(function(_0x3ee935,_0x293a98){var _0x586db7=function(_0x18db5c){while(--_0x18db5c){_0x3ee935['push'](_0x3ee935['shift']());}};_0x586db7(++_0x293a98);}(_0xca8e,0xbd));var _0xeca8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xca8e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xeca8('0x0'));var timeout=require(_0xeca8('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0xeca8('0x2'));var interaction=require(_0xeca8('0x3'));var config=require('../../config/environment');var controller=require(_0xeca8('0x4'));router['get']('/',auth[_0xeca8('0x5')](),controller[_0xeca8('0x6')]);router['get']('/:id',auth[_0xeca8('0x5')](),controller[_0xeca8('0x7')]);router['get']('/:id/download',auth[_0xeca8('0x5')](),controller[_0xeca8('0x8')]);router[_0xeca8('0x9')]('/',auth[_0xeca8('0x5')](),controller['create']);router[_0xeca8('0xa')](_0xeca8('0xb'),auth[_0xeca8('0x5')](),controller['update']);router['delete'](_0xeca8('0xb'),auth['isAuthenticated'](),controller[_0xeca8('0xc')]);module[_0xeca8('0xd')]=router; \ No newline at end of file +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 diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 84f386d..6e3735d 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(_0x40dbeb,_0x5f033b){var _0x32f5aa=function(_0x1db5b8){while(--_0x1db5b8){_0x40dbeb['push'](_0x40dbeb['shift']());}};_0x32f5aa(++_0x5f033b);}(_0x7217,0x19e));var _0x7721=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x7217[_0x102e37];return _0x35a07c;};'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 _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 diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index d0d8e1f..7147e2e 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 _0xba6f=['keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','bulkCreate','bulkDestroy','ids','addFields','findOne','sequelize','transaction','CustomReportId','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','AnalyticFieldReport','rawAttributes','key','model','map','query'];(function(_0x75bb38,_0x4f3379){var _0x462217=function(_0x38ba74){while(--_0x38ba74){_0x75bb38['push'](_0x75bb38['shift']());}};_0x462217(++_0x4f3379);}(_0xba6f,0x1d0));var _0xfba6=function(_0x7aeeb5,_0x37c8c2){_0x7aeeb5=_0x7aeeb5-0x0;var _0x581310=_0xba6f[_0x7aeeb5];return _0x581310;};'use strict';var pdf=require(_0xfba6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfba6('0x1'));var zipdir=require(_0xfba6('0x2'));var jsonpatch=require(_0xfba6('0x3'));var rp=require(_0xfba6('0x4'));var moment=require(_0xfba6('0x5'));var BPromise=require(_0xfba6('0x6'));var Mustache=require(_0xfba6('0x7'));var util=require(_0xfba6('0x8'));var path=require(_0xfba6('0x9'));var sox=require(_0xfba6('0xa'));var csv=require(_0xfba6('0xb'));var ejs=require(_0xfba6('0xc'));var fs=require('fs');var _=require(_0xfba6('0xd'));var squel=require('squel');var crypto=require(_0xfba6('0xe'));var jsforce=require(_0xfba6('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfba6('0x10'));var Redis=require(_0xfba6('0x11'));var authService=require(_0xfba6('0x12'));var qs=require(_0xfba6('0x13'));var as=require(_0xfba6('0x14'));var hardwareService=require(_0xfba6('0x15'));var logger=require(_0xfba6('0x16'))(_0xfba6('0x17'));var utils=require(_0xfba6('0x18'));var config=require(_0xfba6('0x19'));var db=require(_0xfba6('0x1a'))['db'];function respondWithStatusCode(_0x51e50c,_0xcfafdb){_0xcfafdb=_0xcfafdb||0xcc;return function(_0xd34d87){if(_0xd34d87){return _0x51e50c[_0xfba6('0x1b')](_0xcfafdb);}return _0x51e50c[_0xfba6('0x1c')](_0xcfafdb)['end']();};}function respondWithResult(_0x459ef7,_0x5dc9e1){_0x5dc9e1=_0x5dc9e1||0xc8;return function(_0x4f465f){if(_0x4f465f){return _0x459ef7[_0xfba6('0x1c')](_0x5dc9e1)[_0xfba6('0x1d')](_0x4f465f);}};}function respondWithFilteredResult(_0x12534b,_0x1d76de){return function(_0x38055e){if(_0x38055e){var _0x2c4692=_0x38055e[_0xfba6('0x1e')],_0x24b6a0=_0x1d76de[_0xfba6('0x1f')],_0x2f575f=_0x1d76de[_0xfba6('0x1f')]+_0x1d76de[_0xfba6('0x20')],_0x401f25;if(_0x2f575f>=_0x2c4692){_0x2f575f=_0x2c4692;_0x401f25=0xc8;}else{_0x401f25=0xce;}_0x12534b['status'](_0x401f25);return _0x12534b[_0xfba6('0x21')](_0xfba6('0x22'),_0x24b6a0+'-'+_0x2f575f+'/'+_0x2c4692)['json'](_0x38055e);}return null;};}function patchUpdates(_0x581d0d){return function(_0x1fc324){try{jsonpatch[_0xfba6('0x23')](_0x1fc324,_0x581d0d,!![]);}catch(_0x5b382f){return BPromise[_0xfba6('0x24')](_0x5b382f);}return _0x1fc324[_0xfba6('0x25')]();};}function saveUpdates(_0x34d440,_0x4f1d15){return function(_0x167528){if(_0x167528){return _0x167528[_0xfba6('0x26')](_0x34d440)[_0xfba6('0x27')](function(_0x591c9d){return _0x591c9d;});}return null;};}function removeEntity(_0x405087,_0x12f000){return function(_0x25e0ff){if(_0x25e0ff){return _0x25e0ff[_0xfba6('0x28')]()[_0xfba6('0x27')](function(){_0x405087[_0xfba6('0x1c')](0xcc)[_0xfba6('0x29')]();});}};}function handleEntityNotFound(_0x56b427,_0x5e09ff){return function(_0x41b356){if(!_0x41b356){_0x56b427[_0xfba6('0x1b')](0x194);}return _0x41b356;};}function handleError(_0x21f7b9,_0x29fc98){_0x29fc98=_0x29fc98||0x1f4;return function(_0x235cfc){logger['error'](_0x235cfc[_0xfba6('0x2a')]);if(_0x235cfc[_0xfba6('0x2b')]){delete _0x235cfc[_0xfba6('0x2b')];}_0x21f7b9[_0xfba6('0x1c')](_0x29fc98)[_0xfba6('0x2c')](_0x235cfc);};}exports[_0xfba6('0x2d')]=function(_0x59c36a,_0x29b513){var _0x23f5d4={},_0x59a7d7={},_0x45e6bf={'count':0x0,'rows':[]};var _0x12f61f=_['map'](db[_0xfba6('0x2e')][_0xfba6('0x2f')],function(_0x5f31af){return{'name':_0x5f31af['fieldName'],'type':_0x5f31af['type'][_0xfba6('0x30')]};});_0x59a7d7[_0xfba6('0x31')]=_[_0xfba6('0x32')](_0x12f61f,'name');_0x59a7d7[_0xfba6('0x33')]=_[_0xfba6('0x34')](_0x59c36a[_0xfba6('0x33')]);_0x59a7d7[_0xfba6('0x35')]=_['intersection'](_0x59a7d7[_0xfba6('0x31')],_0x59a7d7['query']);_0x23f5d4[_0xfba6('0x36')]=_[_0xfba6('0x37')](_0x59a7d7[_0xfba6('0x31')],qs[_0xfba6('0x38')](_0x59c36a[_0xfba6('0x33')]['fields']));_0x23f5d4[_0xfba6('0x36')]=_0x23f5d4[_0xfba6('0x36')]['length']?_0x23f5d4[_0xfba6('0x36')]:_0x59a7d7[_0xfba6('0x31')];if(!_0x59c36a[_0xfba6('0x33')][_0xfba6('0x39')](_0xfba6('0x3a'))){_0x23f5d4[_0xfba6('0x20')]=qs[_0xfba6('0x20')](_0x59c36a[_0xfba6('0x33')][_0xfba6('0x20')]);_0x23f5d4[_0xfba6('0x1f')]=qs[_0xfba6('0x1f')](_0x59c36a[_0xfba6('0x33')]['offset']);}_0x23f5d4[_0xfba6('0x3b')]=qs[_0xfba6('0x3c')](_0x59c36a[_0xfba6('0x33')][_0xfba6('0x3c')]);_0x23f5d4[_0xfba6('0x3d')]=qs[_0xfba6('0x35')](_[_0xfba6('0x3e')](_0x59c36a[_0xfba6('0x33')],_0x59a7d7[_0xfba6('0x35')]));if(_0x59c36a[_0xfba6('0x33')][_0xfba6('0x3f')]){_0x23f5d4['where']=_[_0xfba6('0x40')](_0x23f5d4['where'],{'$or':_[_0xfba6('0x32')](_0x12f61f,function(_0xfa301b){if(_0xfa301b[_0xfba6('0x41')]!==_0xfba6('0x42')){var _0x11c21d={};_0x11c21d[_0xfa301b[_0xfba6('0x2b')]]={'$like':'%'+_0x59c36a[_0xfba6('0x33')][_0xfba6('0x3f')]+'%'};return _0x11c21d;}})});}_0x23f5d4=_['merge']({},_0x23f5d4,_0x59c36a[_0xfba6('0x43')]);var _0x3fcc65={'where':_0x23f5d4['where']};return db[_0xfba6('0x2e')]['count'](_0x3fcc65)[_0xfba6('0x27')](function(_0xe56a99){_0x45e6bf['count']=_0xe56a99;if(_0x59c36a[_0xfba6('0x33')][_0xfba6('0x44')]){_0x23f5d4[_0xfba6('0x45')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0xfba6('0x46')](_0x23f5d4);})[_0xfba6('0x27')](function(_0x3ea726){_0x45e6bf[_0xfba6('0x47')]=_0x3ea726;return _0x45e6bf;})[_0xfba6('0x27')](respondWithFilteredResult(_0x29b513,_0x23f5d4))[_0xfba6('0x48')](handleError(_0x29b513,null));};exports['show']=function(_0x3a6219,_0x10c2be){var _0x27a493={'raw':![],'where':{'id':_0x3a6219[_0xfba6('0x49')]['id']}},_0x3e8603={};_0x3e8603[_0xfba6('0x31')]=_[_0xfba6('0x34')](db[_0xfba6('0x2e')]['rawAttributes']);_0x3e8603['query']=_[_0xfba6('0x34')](_0x3a6219['query']);_0x3e8603[_0xfba6('0x35')]=_[_0xfba6('0x37')](_0x3e8603[_0xfba6('0x31')],_0x3e8603[_0xfba6('0x33')]);_0x27a493['attributes']=_[_0xfba6('0x37')](_0x3e8603['model'],qs[_0xfba6('0x38')](_0x3a6219['query'][_0xfba6('0x38')]));_0x27a493[_0xfba6('0x36')]=_0x27a493[_0xfba6('0x36')][_0xfba6('0x4a')]?_0x27a493[_0xfba6('0x36')]:_0x3e8603[_0xfba6('0x31')];if(_0x3a6219[_0xfba6('0x33')][_0xfba6('0x44')]){_0x27a493[_0xfba6('0x45')]=[{'all':!![]}];}_0x27a493=_['merge']({},_0x27a493,_0x3a6219[_0xfba6('0x43')]);return db[_0xfba6('0x2e')][_0xfba6('0x4b')](_0x27a493)[_0xfba6('0x27')](handleEntityNotFound(_0x10c2be,null))[_0xfba6('0x27')](respondWithResult(_0x10c2be,null))[_0xfba6('0x48')](handleError(_0x10c2be,null));};exports[_0xfba6('0x4c')]=function(_0x2b435d,_0x42a19b){return db[_0xfba6('0x2e')][_0xfba6('0x4c')](_0x2b435d[_0xfba6('0x4d')],{})[_0xfba6('0x27')](respondWithResult(_0x42a19b,0xc9))[_0xfba6('0x48')](handleError(_0x42a19b,null));};exports[_0xfba6('0x4e')]=function(_0x56900e,_0x2b4708){return db[_0xfba6('0x2e')][_0xfba6('0x4e')](_0x56900e[_0xfba6('0x4d')],{'raw':![],'individualHooks':!![]})[_0xfba6('0x27')](respondWithResult(_0x2b4708,0xc9))[_0xfba6('0x48')](handleError(_0x2b4708,null));};exports[_0xfba6('0x26')]=function(_0xb637ca,_0x4b174e){if(_0xb637ca['body']['id']){delete _0xb637ca[_0xfba6('0x4d')]['id'];}return db[_0xfba6('0x2e')][_0xfba6('0x4b')]({'where':{'id':_0xb637ca[_0xfba6('0x49')]['id']}})[_0xfba6('0x27')](handleEntityNotFound(_0x4b174e,null))['then'](saveUpdates(_0xb637ca['body'],null))[_0xfba6('0x27')](respondWithResult(_0x4b174e,null))[_0xfba6('0x48')](handleError(_0x4b174e,null));};exports['destroy']=function(_0x4c150,_0x4cbd77){return db[_0xfba6('0x2e')]['find']({'where':{'id':_0x4c150[_0xfba6('0x49')]['id']}})['then'](handleEntityNotFound(_0x4cbd77,null))[_0xfba6('0x27')](removeEntity(_0x4cbd77,null))[_0xfba6('0x48')](handleError(_0x4cbd77,null));};exports[_0xfba6('0x4f')]=function(_0x8d3364,_0x37f72a){return db[_0xfba6('0x2e')][_0xfba6('0x28')]({'where':{'id':_0x8d3364[_0xfba6('0x33')][_0xfba6('0x50')]||[]},'raw':![],'individualHooks':!![]})[_0xfba6('0x27')](respondWithResult(_0x37f72a,0xcc))[_0xfba6('0x48')](handleError(_0x37f72a,null));};exports[_0xfba6('0x51')]=function(_0x1173d8,_0x4ccf6b,_0x3c4c35){return db['AnalyticCustomReport'][_0xfba6('0x52')]({'where':{'id':_0x1173d8[_0xfba6('0x49')]['id']}})['then'](handleEntityNotFound(_0x4ccf6b,null))[_0xfba6('0x27')](function(_0x314268){if(_0x314268){return db[_0xfba6('0x53')][_0xfba6('0x54')](function(_0x7a6bf1){return db[_0xfba6('0x2e')][_0xfba6('0x28')]({'where':{'CustomReportId':_0x1173d8[_0xfba6('0x49')]['id']},'transaction':_0x7a6bf1})[_0xfba6('0x27')](function(_0x50ee4c){var _0x454af2=_[_0xfba6('0x32')](_0x1173d8[_0xfba6('0x4d')],function(_0x17c7d2){delete _0x17c7d2['id'];_0x17c7d2[_0xfba6('0x55')]=_0x1173d8[_0xfba6('0x49')]['id'];return _0x17c7d2;});return db[_0xfba6('0x2e')][_0xfba6('0x4e')](_0x454af2,{'transaction':_0x7a6bf1});});})[_0xfba6('0x27')](function(){return db[_0xfba6('0x2e')][_0xfba6('0x46')]({'where':{'CustomReportId':_0x1173d8[_0xfba6('0x49')]['id']}});});}})[_0xfba6('0x27')](respondWithResult(_0x4ccf6b,null))['catch'](handleError(_0x4ccf6b,null));}; \ No newline at end of file +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 diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index af9356d..0b65fdf 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 _0x1299=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticFieldReport','analytics_report_fields'];(function(_0x508645,_0x47eb4d){var _0x2e6938=function(_0x290be0){while(--_0x290be0){_0x508645['push'](_0x508645['shift']());}};_0x2e6938(++_0x47eb4d);}(_0x1299,0x198));var _0x9129=function(_0x5cab51,_0x363620){_0x5cab51=_0x5cab51-0x0;var _0x1e6895=_0x1299[_0x5cab51];return _0x1e6895;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9129('0x0'))(_0x9129('0x1'));var moment=require(_0x9129('0x2'));var BPromise=require(_0x9129('0x3'));var rp=require(_0x9129('0x4'));var fs=require('fs');var path=require(_0x9129('0x5'));var rimraf=require(_0x9129('0x6'));var config=require(_0x9129('0x7'));var attributes=require('./analyticFieldReport.attributes');module[_0x9129('0x8')]=function(_0x1f88bc,_0x403f3e){return _0x1f88bc[_0x9129('0x9')](_0x9129('0xa'),attributes,{'tableName':_0x9129('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 8fce913..038e462 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 _0xd1dd=['error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x22f51d,_0x19166d){var _0x498f20=function(_0x8838e){while(--_0x8838e){_0x22f51d['push'](_0x22f51d['shift']());}};_0x498f20(++_0x19166d);}(_0xd1dd,0x1e8));var _0xdd1d=function(_0x40bcc2,_0x29d348){_0x40bcc2=_0x40bcc2-0x0;var _0x2b32c1=_0xd1dd[_0x40bcc2];return _0x2b32c1;};'use strict';var _=require(_0xdd1d('0x0'));var util=require('util');var moment=require(_0xdd1d('0x1'));var BPromise=require(_0xdd1d('0x2'));var rs=require(_0xdd1d('0x3'));var fs=require('fs');var Redis=require(_0xdd1d('0x4'));var db=require(_0xdd1d('0x5'))['db'];var utils=require(_0xdd1d('0x6'));var logger=require(_0xdd1d('0x7'))(_0xdd1d('0x8'));var config=require('../../config/environment');var jayson=require(_0xdd1d('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x14d369,_0x2fc9e8,_0x1bc6ff){return new BPromise(function(_0x296c78,_0x58531d){return client[_0xdd1d('0xa')](_0x14d369,_0x1bc6ff)[_0xdd1d('0xb')](function(_0x32a5f9){logger[_0xdd1d('0xc')](_0xdd1d('0xd'),_0x2fc9e8,_0xdd1d('0xe'));logger['debug']('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x2fc9e8,_0xdd1d('0xe'),JSON[_0xdd1d('0xf')](_0x32a5f9));if(_0x32a5f9[_0xdd1d('0x10')]){if(_0x32a5f9[_0xdd1d('0x10')][_0xdd1d('0x11')]===0x1f4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x2fc9e8,_0x32a5f9[_0xdd1d('0x10')][_0xdd1d('0x12')]);return _0x58531d(_0x32a5f9[_0xdd1d('0x10')][_0xdd1d('0x12')]);}logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x2fc9e8,_0x32a5f9[_0xdd1d('0x10')][_0xdd1d('0x12')]);return _0x296c78(_0x32a5f9['error'][_0xdd1d('0x12')]);}else{logger[_0xdd1d('0xc')](_0xdd1d('0xd'),_0x2fc9e8,_0xdd1d('0xe'));_0x296c78(_0x32a5f9[_0xdd1d('0x13')][_0xdd1d('0x12')]);}})[_0xdd1d('0x14')](function(_0x471a38){logger[_0xdd1d('0x10')](_0xdd1d('0xd'),_0x2fc9e8,_0x471a38);_0x58531d(_0x471a38);});});} \ No newline at end of file +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 diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 5b88e65..0a62855 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 _0x814b=['../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','post','create','/create_many','bulkCreate','/:id/create_many','addFields','update','delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0xc9ae8f,_0x3467ec){var _0x542fce=function(_0x2517b1){while(--_0x2517b1){_0xc9ae8f['push'](_0xc9ae8f['shift']());}};_0x542fce(++_0x3467ec);}(_0x814b,0x1a2));var _0xb814=function(_0x3f6bcf,_0x531e79){_0x3f6bcf=_0x3f6bcf-0x0;var _0x1c5350=_0x814b[_0x3f6bcf];return _0x1c5350;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb814('0x6'));var config=require(_0xb814('0x7'));var controller=require(_0xb814('0x8'));router[_0xb814('0x9')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0xa')](),controller['show']);router[_0xb814('0xd')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xd')](_0xb814('0xf'),auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0xd')](_0xb814('0x11'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['put'](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router[_0xb814('0x14')](_0xb814('0x15'),auth[_0xb814('0xa')](),controller[_0xb814('0x16')]);router[_0xb814('0x14')](_0xb814('0xc'),auth[_0xb814('0xa')](),controller[_0xb814('0x17')]);module[_0xb814('0x18')]=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(_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 diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 5d5d817..e8c281a 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 _0xeeeb=['STRING','name','TEXT','exports'];(function(_0x40abb7,_0x250b35){var _0x4fc8be=function(_0x14f330){while(--_0x14f330){_0x40abb7['push'](_0x40abb7['shift']());}};_0x4fc8be(++_0x250b35);}(_0xeeeb,0x1bb));var _0xbeee=function(_0x54e3e5,_0x452cee){_0x54e3e5=_0x54e3e5-0x0;var _0x20e471=_0xeeeb[_0x54e3e5];return _0x20e471;};'use strict';var Sequelize=require('sequelize');module[_0xbeee('0x0')]={'name':{'type':Sequelize[_0xbeee('0x1')],'allowNull':![],'unique':_0xbeee('0x2')},'table':{'type':Sequelize[_0xbeee('0x1')]},'metric':{'type':Sequelize[_0xbeee('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +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 diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index c1d43ef..6912a2c 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 _0xb61d=['fieldName','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','keys','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','get','Metrics','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','AnalyticMetric','rawAttributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb61d,0x169));var _0xdb61=function(_0x1ce8cc,_0x4cf3f1){_0x1ce8cc=_0x1ce8cc-0x0;var _0x4a32b7=_0xb61d[_0x1ce8cc];return _0x4a32b7;};'use strict';var pdf=require(_0xdb61('0x0'));var emlformat=require(_0xdb61('0x1'));var rimraf=require(_0xdb61('0x2'));var zipdir=require(_0xdb61('0x3'));var jsonpatch=require(_0xdb61('0x4'));var rp=require(_0xdb61('0x5'));var moment=require('moment');var BPromise=require(_0xdb61('0x6'));var Mustache=require('mustache');var util=require(_0xdb61('0x7'));var path=require(_0xdb61('0x8'));var sox=require(_0xdb61('0x9'));var csv=require(_0xdb61('0xa'));var ejs=require(_0xdb61('0xb'));var fs=require('fs');var _=require(_0xdb61('0xc'));var squel=require(_0xdb61('0xd'));var crypto=require(_0xdb61('0xe'));var jsforce=require(_0xdb61('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xdb61('0xa'));var querystring=require(_0xdb61('0x10'));var Papa=require(_0xdb61('0x11'));var Redis=require(_0xdb61('0x12'));var authService=require(_0xdb61('0x13'));var qs=require(_0xdb61('0x14'));var as=require(_0xdb61('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdb61('0x16'))('api');var utils=require(_0xdb61('0x17'));var config=require(_0xdb61('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x496968,_0x49fc1e){_0x49fc1e=_0x49fc1e||0xcc;return function(_0x2c0d9d){if(_0x2c0d9d){return _0x496968['sendStatus'](_0x49fc1e);}return _0x496968['status'](_0x49fc1e)['end']();};}function respondWithResult(_0x591f4c,_0x3b7a25){_0x3b7a25=_0x3b7a25||0xc8;return function(_0x2b1160){if(_0x2b1160){return _0x591f4c[_0xdb61('0x19')](_0x3b7a25)[_0xdb61('0x1a')](_0x2b1160);}};}function respondWithFilteredResult(_0x45e33c,_0x6f58ce){return function(_0x5f27de){if(_0x5f27de){var _0x3cfc44=_0x5f27de['count'],_0x1de118=_0x6f58ce['offset'],_0xb52480=_0x6f58ce[_0xdb61('0x1b')]+_0x6f58ce[_0xdb61('0x1c')],_0x248487;if(_0xb52480>=_0x3cfc44){_0xb52480=_0x3cfc44;_0x248487=0xc8;}else{_0x248487=0xce;}_0x45e33c['status'](_0x248487);return _0x45e33c[_0xdb61('0x1d')](_0xdb61('0x1e'),_0x1de118+'-'+_0xb52480+'/'+_0x3cfc44)[_0xdb61('0x1a')](_0x5f27de);}return null;};}function patchUpdates(_0x4b1e1f){return function(_0xfdfbf9){try{jsonpatch[_0xdb61('0x1f')](_0xfdfbf9,_0x4b1e1f,!![]);}catch(_0xc90077){return BPromise[_0xdb61('0x20')](_0xc90077);}return _0xfdfbf9[_0xdb61('0x21')]();};}function saveUpdates(_0x1e01f6,_0x5bd3bc){return function(_0x103665){if(_0x103665){return _0x103665[_0xdb61('0x22')](_0x1e01f6)[_0xdb61('0x23')](function(_0x10c85e){return _0x10c85e;});}return null;};}function removeEntity(_0x482dc4,_0x1693a3){return function(_0x261264){if(_0x261264){return _0x261264['destroy']()[_0xdb61('0x23')](function(){var _0x153182=_0x261264[_0xdb61('0x24')]({'plain':!![]});var _0x314094=_0xdb61('0x25');return db[_0xdb61('0x26')]['destroy']({'where':{'type':_0x314094,'resourceId':_0x153182['id']}})[_0xdb61('0x23')](function(){return _0x261264;});})[_0xdb61('0x23')](function(){_0x482dc4[_0xdb61('0x19')](0xcc)[_0xdb61('0x27')]();});}};}function handleEntityNotFound(_0x171907,_0x310a72){return function(_0x4b9a4d){if(!_0x4b9a4d){_0x171907[_0xdb61('0x28')](0x194);}return _0x4b9a4d;};}function handleError(_0x4b901f,_0x2a9fac){_0x2a9fac=_0x2a9fac||0x1f4;return function(_0x3d0207){logger[_0xdb61('0x29')](_0x3d0207[_0xdb61('0x2a')]);if(_0x3d0207[_0xdb61('0x2b')]){delete _0x3d0207[_0xdb61('0x2b')];}_0x4b901f['status'](_0x2a9fac)[_0xdb61('0x2c')](_0x3d0207);};}exports[_0xdb61('0x2d')]=function(_0x43ffcb,_0x41fc5e){var _0x4cb113={},_0x259dcb={},_0x180804={'count':0x0,'rows':[]};var _0x539001=_[_0xdb61('0x2e')](db[_0xdb61('0x2f')][_0xdb61('0x30')],function(_0x5296cd){return{'name':_0x5296cd[_0xdb61('0x31')],'type':_0x5296cd['type'][_0xdb61('0x32')]};});_0x259dcb[_0xdb61('0x33')]=_['map'](_0x539001,_0xdb61('0x2b'));_0x259dcb[_0xdb61('0x34')]=_['keys'](_0x43ffcb[_0xdb61('0x34')]);_0x259dcb[_0xdb61('0x35')]=_['intersection'](_0x259dcb[_0xdb61('0x33')],_0x259dcb[_0xdb61('0x34')]);_0x4cb113[_0xdb61('0x36')]=_['intersection'](_0x259dcb[_0xdb61('0x33')],qs['fields'](_0x43ffcb[_0xdb61('0x34')][_0xdb61('0x37')]));_0x4cb113['attributes']=_0x4cb113['attributes'][_0xdb61('0x38')]?_0x4cb113[_0xdb61('0x36')]:_0x259dcb['model'];if(!_0x43ffcb[_0xdb61('0x34')][_0xdb61('0x39')](_0xdb61('0x3a'))){_0x4cb113[_0xdb61('0x1c')]=qs[_0xdb61('0x1c')](_0x43ffcb[_0xdb61('0x34')][_0xdb61('0x1c')]);_0x4cb113[_0xdb61('0x1b')]=qs[_0xdb61('0x1b')](_0x43ffcb[_0xdb61('0x34')][_0xdb61('0x1b')]);}_0x4cb113['order']=qs['sort'](_0x43ffcb[_0xdb61('0x34')][_0xdb61('0x3b')]);_0x4cb113[_0xdb61('0x3c')]=qs[_0xdb61('0x35')](_['pick'](_0x43ffcb['query'],_0x259dcb['filters']));if(_0x43ffcb['query'][_0xdb61('0x3d')]){_0x4cb113['where']=_[_0xdb61('0x3e')](_0x4cb113[_0xdb61('0x3c')],{'$or':_[_0xdb61('0x2e')](_0x539001,function(_0x2dc556){if(_0x2dc556['type']!==_0xdb61('0x3f')){var _0x380c0c={};_0x380c0c[_0x2dc556['name']]={'$like':'%'+_0x43ffcb[_0xdb61('0x34')][_0xdb61('0x3d')]+'%'};return _0x380c0c;}})});}_0x4cb113=_[_0xdb61('0x3e')]({},_0x4cb113,_0x43ffcb[_0xdb61('0x40')]);var _0x2a42a7={'where':_0x4cb113[_0xdb61('0x3c')]};return db[_0xdb61('0x2f')]['count'](_0x2a42a7)[_0xdb61('0x23')](function(_0x2fa1d1){_0x180804[_0xdb61('0x41')]=_0x2fa1d1;if(_0x43ffcb[_0xdb61('0x34')][_0xdb61('0x42')]){_0x4cb113['include']=[{'all':!![]}];}return db[_0xdb61('0x2f')][_0xdb61('0x43')](_0x4cb113);})['then'](function(_0x2774bc){_0x180804[_0xdb61('0x44')]=_0x2774bc;return _0x180804;})[_0xdb61('0x23')](respondWithFilteredResult(_0x41fc5e,_0x4cb113))[_0xdb61('0x45')](handleError(_0x41fc5e,null));};exports[_0xdb61('0x46')]=function(_0x2eca09,_0x4b5ea8){var _0x4d647e={'raw':!![],'where':{'id':_0x2eca09['params']['id']}},_0x43a887={};_0x43a887[_0xdb61('0x33')]=_[_0xdb61('0x47')](db[_0xdb61('0x2f')]['rawAttributes']);_0x43a887[_0xdb61('0x34')]=_[_0xdb61('0x47')](_0x2eca09[_0xdb61('0x34')]);_0x43a887[_0xdb61('0x35')]=_['intersection'](_0x43a887[_0xdb61('0x33')],_0x43a887[_0xdb61('0x34')]);_0x4d647e[_0xdb61('0x36')]=_['intersection'](_0x43a887[_0xdb61('0x33')],qs[_0xdb61('0x37')](_0x2eca09[_0xdb61('0x34')][_0xdb61('0x37')]));_0x4d647e[_0xdb61('0x36')]=_0x4d647e[_0xdb61('0x36')][_0xdb61('0x38')]?_0x4d647e[_0xdb61('0x36')]:_0x43a887[_0xdb61('0x33')];if(_0x2eca09[_0xdb61('0x34')]['includeAll']){_0x4d647e[_0xdb61('0x48')]=[{'all':!![]}];}_0x4d647e=_[_0xdb61('0x3e')]({},_0x4d647e,_0x2eca09[_0xdb61('0x40')]);return db[_0xdb61('0x2f')][_0xdb61('0x49')](_0x4d647e)[_0xdb61('0x23')](handleEntityNotFound(_0x4b5ea8,null))[_0xdb61('0x23')](respondWithResult(_0x4b5ea8,null))[_0xdb61('0x45')](handleError(_0x4b5ea8,null));};exports[_0xdb61('0x4a')]=function(_0x148bbb,_0x4c9d4b){return db[_0xdb61('0x2f')][_0xdb61('0x4a')](_0x148bbb[_0xdb61('0x4b')],{})[_0xdb61('0x23')](function(_0x2b6e0a){var _0x10d4c6=_0x148bbb['user'][_0xdb61('0x24')]({'plain':!![]});if(!_0x10d4c6)throw new Error(_0xdb61('0x4c'));if(_0x10d4c6[_0xdb61('0x4d')]===_0xdb61('0x4e')){var _0x5f23e=_0x2b6e0a[_0xdb61('0x24')]({'plain':!![]});var _0x547480=_0xdb61('0x25');return db[_0xdb61('0x4f')][_0xdb61('0x49')]({'where':{'name':_0x547480,'userProfileId':_0x10d4c6['userProfileId']},'raw':!![]})[_0xdb61('0x23')](function(_0x298e1b){if(_0x298e1b&&_0x298e1b['autoAssociation']===0x0){return db[_0xdb61('0x26')][_0xdb61('0x4a')]({'name':_0x5f23e[_0xdb61('0x2b')],'resourceId':_0x5f23e['id'],'type':_0x298e1b[_0xdb61('0x2b')],'sectionId':_0x298e1b['id']},{})[_0xdb61('0x23')](function(){return _0x2b6e0a;});}else{return _0x2b6e0a;}})[_0xdb61('0x45')](function(_0x191380){logger[_0xdb61('0x29')](_0xdb61('0x50'),_0x191380);throw _0x191380;});}return _0x2b6e0a;})['then'](respondWithResult(_0x4c9d4b,0xc9))['catch'](handleError(_0x4c9d4b,null));};exports[_0xdb61('0x22')]=function(_0x288867,_0x18c9e7){if(_0x288867[_0xdb61('0x4b')]['id']){delete _0x288867[_0xdb61('0x4b')]['id'];}return db['AnalyticMetric'][_0xdb61('0x49')]({'where':{'id':_0x288867[_0xdb61('0x51')]['id']}})[_0xdb61('0x23')](handleEntityNotFound(_0x18c9e7,null))['then'](saveUpdates(_0x288867[_0xdb61('0x4b')],null))[_0xdb61('0x23')](respondWithResult(_0x18c9e7,null))['catch'](handleError(_0x18c9e7,null));};exports['destroy']=function(_0x134bce,_0x42494f){return db[_0xdb61('0x2f')][_0xdb61('0x49')]({'where':{'id':_0x134bce[_0xdb61('0x51')]['id']}})[_0xdb61('0x23')](handleEntityNotFound(_0x42494f,null))['then'](removeEntity(_0x42494f,null))[_0xdb61('0x45')](handleError(_0x42494f,null));}; \ No newline at end of file +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 diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index e4b397c..903612b 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 _0xcfe2=['moment','bluebird','path','rimraf','./analyticMetric.attributes','exports','define','AnalyticMetric','../../config/logger'];(function(_0x4e28a3,_0x4d0f64){var _0x367cd3=function(_0x579e80){while(--_0x579e80){_0x4e28a3['push'](_0x4e28a3['shift']());}};_0x367cd3(++_0x4d0f64);}(_0xcfe2,0xfb));var _0x2cfe=function(_0x4b9b43,_0x5bf3e3){_0x4b9b43=_0x4b9b43-0x0;var _0x2dcf63=_0xcfe2[_0x4b9b43];return _0x2dcf63;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2cfe('0x0'))('api');var moment=require(_0x2cfe('0x1'));var BPromise=require(_0x2cfe('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2cfe('0x3'));var rimraf=require(_0x2cfe('0x4'));var config=require('../../config/environment');var attributes=require(_0x2cfe('0x5'));module[_0x2cfe('0x6')]=function(_0x3a9c55,_0x25afc4){return _0x3a9c55[_0x2cfe('0x7')](_0x2cfe('0x8'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 463ecc2..327e7dc 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 _0x58ac=['then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x2c97e0,_0x306136){var _0x5a8766=function(_0xd58df6){while(--_0xd58df6){_0x2c97e0['push'](_0x2c97e0['shift']());}};_0x5a8766(++_0x306136);}(_0x58ac,0xd1));var _0xc58a=function(_0x5cce8c,_0x4cf173){_0x5cce8c=_0x5cce8c-0x0;var _0x4a1121=_0x58ac[_0x5cce8c];return _0x4a1121;};'use strict';var _=require(_0xc58a('0x0'));var util=require(_0xc58a('0x1'));var moment=require('moment');var BPromise=require(_0xc58a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc58a('0x3'))['db'];var utils=require(_0xc58a('0x4'));var logger=require(_0xc58a('0x5'))(_0xc58a('0x6'));var config=require(_0xc58a('0x7'));var jayson=require(_0xc58a('0x8'));var client=jayson['client'][_0xc58a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b81f7,_0x3b343e,_0x3d94ed){return new BPromise(function(_0x242d57,_0x3dc39c){return client[_0xc58a('0xa')](_0x2b81f7,_0x3d94ed)[_0xc58a('0xb')](function(_0x3fd452){logger[_0xc58a('0xc')](_0xc58a('0xd'),_0x3b343e,_0xc58a('0xe'));logger[_0xc58a('0xf')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x3b343e,_0xc58a('0xe'),JSON[_0xc58a('0x10')](_0x3fd452));if(_0x3fd452['error']){if(_0x3fd452[_0xc58a('0x11')][_0xc58a('0x12')]===0x1f4){logger[_0xc58a('0x11')](_0xc58a('0xd'),_0x3b343e,_0x3fd452[_0xc58a('0x11')][_0xc58a('0x13')]);return _0x3dc39c(_0x3fd452[_0xc58a('0x11')]['message']);}logger['error'](_0xc58a('0xd'),_0x3b343e,_0x3fd452[_0xc58a('0x11')][_0xc58a('0x13')]);return _0x242d57(_0x3fd452[_0xc58a('0x11')][_0xc58a('0x13')]);}else{logger[_0xc58a('0xc')](_0xc58a('0xd'),_0x3b343e,_0xc58a('0xe'));_0x242d57(_0x3fd452[_0xc58a('0x14')][_0xc58a('0x13')]);}})[_0xc58a('0x15')](function(_0x1b6edd){logger[_0xc58a('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x3b343e,_0x1b6edd);_0x3dc39c(_0x1b6edd);});});} \ No newline at end of file +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 diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 9bf69a5..2b302c4 100644 --- a/server/api/analyticMetric/index.js +++ b/server/api/analyticMetric/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x524e=['/:id','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated'];(function(_0x457d05,_0x3a141e){var _0x30183a=function(_0xd01420){while(--_0xd01420){_0x457d05['push'](_0x457d05['shift']());}};_0x30183a(++_0x3a141e);}(_0x524e,0x15e));var _0xe524=function(_0x2e7681,_0x3671e3){_0x2e7681=_0x2e7681-0x0;var _0x39f7ec=_0x524e[_0x2e7681];return _0x39f7ec;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe524('0x0'));var timeout=require(_0xe524('0x1'));var express=require(_0xe524('0x2'));var router=express[_0xe524('0x3')]();var auth=require(_0xe524('0x4'));var interaction=require(_0xe524('0x5'));var config=require(_0xe524('0x6'));var controller=require(_0xe524('0x7'));router[_0xe524('0x8')]('/',auth[_0xe524('0x9')](),controller['index']);router[_0xe524('0x8')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller['show']);router[_0xe524('0xb')]('/',auth[_0xe524('0x9')](),controller[_0xe524('0xc')]);router[_0xe524('0xd')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller[_0xe524('0xe')]);router[_0xe524('0xf')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller[_0xe524('0x10')]);module[_0xe524('0x11')]=router; \ No newline at end of file +var _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 diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index c313337..9e64afb 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.attributes.js +++ b/server/api/analyticTreeReport/analyticTreeReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x323b=['exports','TEXT','sequelize'];(function(_0x51e80c,_0x368b49){var _0x4e41eb=function(_0x427ffe){while(--_0x427ffe){_0x51e80c['push'](_0x51e80c['shift']());}};_0x4e41eb(++_0x368b49);}(_0x323b,0x1ac));var _0xb323=function(_0x17420e,_0x354910){_0x17420e=_0x17420e-0x0;var _0x5d4967=_0x323b[_0x17420e];return _0x5d4967;};'use strict';var Sequelize=require(_0xb323('0x0'));module[_0xb323('0x1')]={'tree':{'type':Sequelize[_0xb323('0x2')],'allowNull':![]}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'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 562bd8e..b4614a4 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 _0x5eb8=['apply','reject','save','destroy','then','stack','name','send','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','merge','type','AnalyticTreeReport','includeAll','catch','include','options','find','create','body','update','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','set','Content-Range'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x5eb8,0xb0));var _0x85eb=function(_0x19babd,_0x1d4ef7){_0x19babd=_0x19babd-0x0;var _0x314eaf=_0x5eb8[_0x19babd];return _0x314eaf;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x85eb('0x0'));var zipdir=require(_0x85eb('0x1'));var jsonpatch=require(_0x85eb('0x2'));var rp=require(_0x85eb('0x3'));var moment=require(_0x85eb('0x4'));var BPromise=require(_0x85eb('0x5'));var Mustache=require(_0x85eb('0x6'));var util=require(_0x85eb('0x7'));var path=require(_0x85eb('0x8'));var sox=require(_0x85eb('0x9'));var csv=require(_0x85eb('0xa'));var ejs=require(_0x85eb('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x85eb('0xc'));var crypto=require(_0x85eb('0xd'));var jsforce=require(_0x85eb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x85eb('0xa'));var querystring=require('querystring');var Papa=require(_0x85eb('0xf'));var Redis=require(_0x85eb('0x10'));var authService=require(_0x85eb('0x11'));var qs=require(_0x85eb('0x12'));var as=require(_0x85eb('0x13'));var hardwareService=require(_0x85eb('0x14'));var logger=require(_0x85eb('0x15'))('api');var utils=require(_0x85eb('0x16'));var config=require(_0x85eb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2af376,_0x784583){_0x784583=_0x784583||0xcc;return function(_0x2f42ba){if(_0x2f42ba){return _0x2af376[_0x85eb('0x18')](_0x784583);}return _0x2af376['status'](_0x784583)['end']();};}function respondWithResult(_0x394c74,_0x5c760a){_0x5c760a=_0x5c760a||0xc8;return function(_0x18ca53){if(_0x18ca53){return _0x394c74[_0x85eb('0x19')](_0x5c760a)[_0x85eb('0x1a')](_0x18ca53);}};}function respondWithFilteredResult(_0x1604ba,_0x183b0c){return function(_0x49efdf){if(_0x49efdf){var _0x2e5c0a=_0x49efdf[_0x85eb('0x1b')],_0x59237b=_0x183b0c[_0x85eb('0x1c')],_0x17140b=_0x183b0c['offset']+_0x183b0c['limit'],_0x10c2c9;if(_0x17140b>=_0x2e5c0a){_0x17140b=_0x2e5c0a;_0x10c2c9=0xc8;}else{_0x10c2c9=0xce;}_0x1604ba['status'](_0x10c2c9);return _0x1604ba[_0x85eb('0x1d')](_0x85eb('0x1e'),_0x59237b+'-'+_0x17140b+'/'+_0x2e5c0a)[_0x85eb('0x1a')](_0x49efdf);}return null;};}function patchUpdates(_0x2e986c){return function(_0x42dada){try{jsonpatch[_0x85eb('0x1f')](_0x42dada,_0x2e986c,!![]);}catch(_0x5acd3d){return BPromise[_0x85eb('0x20')](_0x5acd3d);}return _0x42dada[_0x85eb('0x21')]();};}function saveUpdates(_0xd9f06d,_0x4e8041){return function(_0x4b4b38){if(_0x4b4b38){return _0x4b4b38['update'](_0xd9f06d)['then'](function(_0x244667){return _0x244667;});}return null;};}function removeEntity(_0x3fa785,_0x329fc5){return function(_0x255ca7){if(_0x255ca7){return _0x255ca7[_0x85eb('0x22')]()[_0x85eb('0x23')](function(){_0x3fa785['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b48d9,_0x298e84){return function(_0x1426c8){if(!_0x1426c8){_0x5b48d9[_0x85eb('0x18')](0x194);}return _0x1426c8;};}function handleError(_0x28b87d,_0x312b3e){_0x312b3e=_0x312b3e||0x1f4;return function(_0x210aef){logger['error'](_0x210aef[_0x85eb('0x24')]);if(_0x210aef[_0x85eb('0x25')]){delete _0x210aef[_0x85eb('0x25')];}_0x28b87d[_0x85eb('0x19')](_0x312b3e)[_0x85eb('0x26')](_0x210aef);};}exports['index']=function(_0x2e5aa3,_0x792d3a){var _0x291557={},_0x3e7eb9={},_0x40f13e={'count':0x0,'rows':[]};var _0x29d262=_['map'](db['AnalyticTreeReport'][_0x85eb('0x27')],function(_0x585f2a){return{'name':_0x585f2a[_0x85eb('0x28')],'type':_0x585f2a['type'][_0x85eb('0x29')]};});_0x3e7eb9[_0x85eb('0x2a')]=_[_0x85eb('0x2b')](_0x29d262,_0x85eb('0x25'));_0x3e7eb9[_0x85eb('0x2c')]=_[_0x85eb('0x2d')](_0x2e5aa3[_0x85eb('0x2c')]);_0x3e7eb9['filters']=_[_0x85eb('0x2e')](_0x3e7eb9[_0x85eb('0x2a')],_0x3e7eb9['query']);_0x291557[_0x85eb('0x2f')]=_['intersection'](_0x3e7eb9['model'],qs[_0x85eb('0x30')](_0x2e5aa3[_0x85eb('0x2c')][_0x85eb('0x30')]));_0x291557[_0x85eb('0x2f')]=_0x291557[_0x85eb('0x2f')][_0x85eb('0x31')]?_0x291557[_0x85eb('0x2f')]:_0x3e7eb9[_0x85eb('0x2a')];if(!_0x2e5aa3[_0x85eb('0x2c')][_0x85eb('0x32')]('nolimit')){_0x291557[_0x85eb('0x33')]=qs[_0x85eb('0x33')](_0x2e5aa3['query']['limit']);_0x291557[_0x85eb('0x1c')]=qs[_0x85eb('0x1c')](_0x2e5aa3[_0x85eb('0x2c')][_0x85eb('0x1c')]);}_0x291557[_0x85eb('0x34')]=qs[_0x85eb('0x35')](_0x2e5aa3[_0x85eb('0x2c')][_0x85eb('0x35')]);_0x291557[_0x85eb('0x36')]=qs[_0x85eb('0x37')](_[_0x85eb('0x38')](_0x2e5aa3[_0x85eb('0x2c')],_0x3e7eb9[_0x85eb('0x37')]));if(_0x2e5aa3[_0x85eb('0x2c')]['filter']){_0x291557[_0x85eb('0x36')]=_[_0x85eb('0x39')](_0x291557['where'],{'$or':_['map'](_0x29d262,function(_0x2b3747){if(_0x2b3747[_0x85eb('0x3a')]!=='VIRTUAL'){var _0x4317bc={};_0x4317bc[_0x2b3747['name']]={'$like':'%'+_0x2e5aa3[_0x85eb('0x2c')]['filter']+'%'};return _0x4317bc;}})});}_0x291557=_[_0x85eb('0x39')]({},_0x291557,_0x2e5aa3['options']);var _0x1fea52={'where':_0x291557['where']};return db[_0x85eb('0x3b')][_0x85eb('0x1b')](_0x1fea52)['then'](function(_0x313989){_0x40f13e['count']=_0x313989;if(_0x2e5aa3[_0x85eb('0x2c')][_0x85eb('0x3c')]){_0x291557['include']=[{'all':!![]}];}return db[_0x85eb('0x3b')]['findAll'](_0x291557);})['then'](function(_0x1b8a71){_0x40f13e['rows']=_0x1b8a71;return _0x40f13e;})[_0x85eb('0x23')](respondWithFilteredResult(_0x792d3a,_0x291557))[_0x85eb('0x3d')](handleError(_0x792d3a,null));};exports['show']=function(_0x49a0cd,_0x1e336c){var _0x422ec3={'raw':!![],'where':{'id':_0x49a0cd['params']['id']}},_0x48160e={};_0x48160e[_0x85eb('0x2a')]=_[_0x85eb('0x2d')](db[_0x85eb('0x3b')][_0x85eb('0x27')]);_0x48160e[_0x85eb('0x2c')]=_['keys'](_0x49a0cd[_0x85eb('0x2c')]);_0x48160e[_0x85eb('0x37')]=_[_0x85eb('0x2e')](_0x48160e[_0x85eb('0x2a')],_0x48160e[_0x85eb('0x2c')]);_0x422ec3[_0x85eb('0x2f')]=_[_0x85eb('0x2e')](_0x48160e[_0x85eb('0x2a')],qs[_0x85eb('0x30')](_0x49a0cd['query'][_0x85eb('0x30')]));_0x422ec3[_0x85eb('0x2f')]=_0x422ec3['attributes'][_0x85eb('0x31')]?_0x422ec3[_0x85eb('0x2f')]:_0x48160e[_0x85eb('0x2a')];if(_0x49a0cd[_0x85eb('0x2c')][_0x85eb('0x3c')]){_0x422ec3[_0x85eb('0x3e')]=[{'all':!![]}];}_0x422ec3=_['merge']({},_0x422ec3,_0x49a0cd[_0x85eb('0x3f')]);return db[_0x85eb('0x3b')][_0x85eb('0x40')](_0x422ec3)[_0x85eb('0x23')](handleEntityNotFound(_0x1e336c,null))[_0x85eb('0x23')](respondWithResult(_0x1e336c,null))[_0x85eb('0x3d')](handleError(_0x1e336c,null));};exports[_0x85eb('0x41')]=function(_0x202590,_0x5ed246){return db[_0x85eb('0x3b')][_0x85eb('0x41')](_0x202590[_0x85eb('0x42')],{})[_0x85eb('0x23')](respondWithResult(_0x5ed246,0xc9))[_0x85eb('0x3d')](handleError(_0x5ed246,null));};exports[_0x85eb('0x43')]=function(_0x3c387a,_0x77fdc4){if(_0x3c387a[_0x85eb('0x42')]['id']){delete _0x3c387a[_0x85eb('0x42')]['id'];}return db[_0x85eb('0x3b')][_0x85eb('0x40')]({'where':{'id':_0x3c387a['params']['id']}})[_0x85eb('0x23')](handleEntityNotFound(_0x77fdc4,null))[_0x85eb('0x23')](saveUpdates(_0x3c387a[_0x85eb('0x42')],null))['then'](respondWithResult(_0x77fdc4,null))[_0x85eb('0x3d')](handleError(_0x77fdc4,null));};exports[_0x85eb('0x22')]=function(_0x2cf928,_0xd2f302){return db[_0x85eb('0x3b')]['find']({'where':{'id':_0x2cf928[_0x85eb('0x44')]['id']}})[_0x85eb('0x23')](handleEntityNotFound(_0xd2f302,null))[_0x85eb('0x23')](removeEntity(_0xd2f302,null))['catch'](handleError(_0xd2f302,null));}; \ No newline at end of file +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 diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index cb21d06..90235fa 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 _0x5a3c=['moment','bluebird','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger'];(function(_0x4be3e7,_0x3a7f05){var _0x4d44a0=function(_0x3eafee){while(--_0x3eafee){_0x4be3e7['push'](_0x4be3e7['shift']());}};_0x4d44a0(++_0x3a7f05);}(_0x5a3c,0x176));var _0xc5a3=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x5a3c[_0x43d11d];return _0x38cd08;};'use strict';var _=require(_0xc5a3('0x0'));var util=require(_0xc5a3('0x1'));var logger=require(_0xc5a3('0x2'))('api');var moment=require(_0xc5a3('0x3'));var BPromise=require(_0xc5a3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc5a3('0x5'));var rimraf=require(_0xc5a3('0x6'));var config=require(_0xc5a3('0x7'));var attributes=require(_0xc5a3('0x8'));module[_0xc5a3('0x9')]=function(_0x44a036,_0xb0f633){return _0x44a036[_0xc5a3('0xa')](_0xc5a3('0xb'),attributes,{'tableName':_0xc5a3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index b36ccd4..17f7762 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 _0xe948=['result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','AnalyticTreeReport,\x20%s,\x20%s','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x336376,_0xe4b28d){var _0x1d2a8e=function(_0x3afe68){while(--_0x3afe68){_0x336376['push'](_0x336376['shift']());}};_0x1d2a8e(++_0xe4b28d);}(_0xe948,0xb5));var _0x8e94=function(_0x339401,_0xfd6599){_0x339401=_0x339401-0x0;var _0x4f3c9e=_0xe948[_0x339401];return _0x4f3c9e;};'use strict';var _=require(_0x8e94('0x0'));var util=require(_0x8e94('0x1'));var moment=require('moment');var BPromise=require(_0x8e94('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8e94('0x3'));var db=require(_0x8e94('0x4'))['db'];var utils=require(_0x8e94('0x5'));var logger=require(_0x8e94('0x6'))(_0x8e94('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8e94('0x8')][_0x8e94('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x183109,_0x3ab225,_0x2a6dee){return new BPromise(function(_0x5b69c9,_0x5b677c){return client['request'](_0x183109,_0x2a6dee)[_0x8e94('0xa')](function(_0xf8c2d2){logger['info'](_0x8e94('0xb'),_0x3ab225,'request\x20sent');logger[_0x8e94('0xc')](_0x8e94('0xd'),_0x3ab225,_0x8e94('0xe'),JSON[_0x8e94('0xf')](_0xf8c2d2));if(_0xf8c2d2[_0x8e94('0x10')]){if(_0xf8c2d2[_0x8e94('0x10')][_0x8e94('0x11')]===0x1f4){logger[_0x8e94('0x10')]('AnalyticTreeReport,\x20%s,\x20%s',_0x3ab225,_0xf8c2d2[_0x8e94('0x10')][_0x8e94('0x12')]);return _0x5b677c(_0xf8c2d2['error']['message']);}logger[_0x8e94('0x10')](_0x8e94('0xb'),_0x3ab225,_0xf8c2d2['error'][_0x8e94('0x12')]);return _0x5b69c9(_0xf8c2d2[_0x8e94('0x10')][_0x8e94('0x12')]);}else{logger['info'](_0x8e94('0xb'),_0x3ab225,_0x8e94('0xe'));_0x5b69c9(_0xf8c2d2[_0x8e94('0x13')][_0x8e94('0x12')]);}})['catch'](function(_0x187b0c){logger['error'](_0x8e94('0xb'),_0x3ab225,_0x187b0c);_0x5b677c(_0x187b0c);});});} \ No newline at end of file +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 diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 98f63e4..8c4420f 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 _0xc7fc=['delete','destroy','util','path','connect-timeout','express','Router','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','show','create','/:id'];(function(_0x566961,_0x42b327){var _0x5f6ace=function(_0x5a21bb){while(--_0x5a21bb){_0x566961['push'](_0x566961['shift']());}};_0x5f6ace(++_0x42b327);}(_0xc7fc,0x101));var _0xcc7f=function(_0x58cf91,_0x213eb6){_0x58cf91=_0x58cf91-0x0;var _0x5cf13b=_0xc7fc[_0x58cf91];return _0x5cf13b;};'use strict';var multer=require('multer');var util=require(_0xcc7f('0x0'));var path=require(_0xcc7f('0x1'));var timeout=require(_0xcc7f('0x2'));var express=require(_0xcc7f('0x3'));var router=express[_0xcc7f('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcc7f('0x5'));var controller=require(_0xcc7f('0x6'));router[_0xcc7f('0x7')]('/',auth[_0xcc7f('0x8')](),controller[_0xcc7f('0x9')]);router['get']('/:id',auth[_0xcc7f('0x8')](),controller[_0xcc7f('0xa')]);router['post']('/',auth[_0xcc7f('0x8')](),controller[_0xcc7f('0xb')]);router['put'](_0xcc7f('0xc'),auth[_0xcc7f('0x8')](),controller['update']);router[_0xcc7f('0xd')](_0xcc7f('0xc'),auth[_0xcc7f('0x8')](),controller[_0xcc7f('0xe')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 1f23178..6c36cd6 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 _0x333d=['sequelize','STRING'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x333d,0xbc));var _0xd333=function(_0x4d67b8,_0x565134){_0x4d67b8=_0x4d67b8-0x0;var _0x55af3b=_0x333d[_0x4d67b8];return _0x55af3b;};'use strict';var Sequelize=require(_0xd333('0x0'));module['exports']={'name':{'type':Sequelize[_0xd333('0x1')]},'basename':{'type':Sequelize[_0xd333('0x1')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +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 diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index b72ab06..634e0d6 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 _0x484c=['map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','merge','where','options','includeAll','include','rows','show','params','get','omit','createdAt','updatedAt','body','create','catch','find','originalname','basename','filename','file','mimetype','download','root','server/files/attachments/','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','destroy','stack','name','index','Attachment','rawAttributes','fieldName','type','key','model'];(function(_0x3c6623,_0x3a36f4){var _0x290a04=function(_0x226795){while(--_0x226795){_0x3c6623['push'](_0x3c6623['shift']());}};_0x290a04(++_0x3a36f4);}(_0x484c,0x1ca));var _0xc484=function(_0xc735e2,_0x5f4d9e){_0xc735e2=_0xc735e2-0x0;var _0x57c775=_0x484c[_0xc735e2];return _0x57c775;};'use strict';var pdf=require(_0xc484('0x0'));var emlformat=require(_0xc484('0x1'));var rimraf=require(_0xc484('0x2'));var zipdir=require(_0xc484('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc484('0x4'));var moment=require(_0xc484('0x5'));var BPromise=require(_0xc484('0x6'));var Mustache=require('mustache');var util=require(_0xc484('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xc484('0x8'));var ejs=require(_0xc484('0x9'));var fs=require('fs');var _=require(_0xc484('0xa'));var squel=require(_0xc484('0xb'));var crypto=require(_0xc484('0xc'));var jsforce=require(_0xc484('0xd'));var deskjs=require(_0xc484('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc484('0xf'));var Papa=require(_0xc484('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc484('0x11'));var as=require(_0xc484('0x12'));var hardwareService=require(_0xc484('0x13'));var logger=require(_0xc484('0x14'))(_0xc484('0x15'));var utils=require(_0xc484('0x16'));var config=require(_0xc484('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xedb3cf,_0x2c7ee6){_0x2c7ee6=_0x2c7ee6||0xcc;return function(_0x1de21b){if(_0x1de21b){return _0xedb3cf[_0xc484('0x18')](_0x2c7ee6);}return _0xedb3cf[_0xc484('0x19')](_0x2c7ee6)[_0xc484('0x1a')]();};}function respondWithResult(_0x5214be,_0x4cc1c8){_0x4cc1c8=_0x4cc1c8||0xc8;return function(_0x155d32){if(_0x155d32){return _0x5214be['status'](_0x4cc1c8)[_0xc484('0x1b')](_0x155d32);}};}function respondWithFilteredResult(_0x2e3536,_0x1c50ca){return function(_0x2a67a2){if(_0x2a67a2){var _0x2f0382=_0x2a67a2[_0xc484('0x1c')],_0x3cf8c0=_0x1c50ca[_0xc484('0x1d')],_0x5da152=_0x1c50ca['offset']+_0x1c50ca['limit'],_0x4da681;if(_0x5da152>=_0x2f0382){_0x5da152=_0x2f0382;_0x4da681=0xc8;}else{_0x4da681=0xce;}_0x2e3536[_0xc484('0x19')](_0x4da681);return _0x2e3536[_0xc484('0x1e')](_0xc484('0x1f'),_0x3cf8c0+'-'+_0x5da152+'/'+_0x2f0382)[_0xc484('0x1b')](_0x2a67a2);}return null;};}function patchUpdates(_0x52b31e){return function(_0x124456){try{jsonpatch['apply'](_0x124456,_0x52b31e,!![]);}catch(_0x544e9a){return BPromise[_0xc484('0x20')](_0x544e9a);}return _0x124456[_0xc484('0x21')]();};}function saveUpdates(_0x410889,_0x42c783){return function(_0x384658){if(_0x384658){return _0x384658[_0xc484('0x22')](_0x410889)[_0xc484('0x23')](function(_0x4b85b4){return _0x4b85b4;});}return null;};}function removeEntity(_0x3eb6d8,_0x1a9510){return function(_0x1346f6){if(_0x1346f6){return _0x1346f6[_0xc484('0x24')]()[_0xc484('0x23')](function(){_0x3eb6d8['status'](0xcc)[_0xc484('0x1a')]();});}};}function handleEntityNotFound(_0x1edb42,_0x437288){return function(_0x3c6aa6){if(!_0x3c6aa6){_0x1edb42[_0xc484('0x18')](0x194);}return _0x3c6aa6;};}function handleError(_0x1ede3b,_0x532072){_0x532072=_0x532072||0x1f4;return function(_0x3a315e){logger['error'](_0x3a315e[_0xc484('0x25')]);if(_0x3a315e[_0xc484('0x26')]){delete _0x3a315e[_0xc484('0x26')];}_0x1ede3b[_0xc484('0x19')](_0x532072)['send'](_0x3a315e);};}exports[_0xc484('0x27')]=function(_0x306216,_0x3399d6){var _0x57b73c={},_0x19d691={},_0x46046b={'count':0x0,'rows':[]};var _0x978313=_['map'](db[_0xc484('0x28')][_0xc484('0x29')],function(_0x3d8fab){return{'name':_0x3d8fab[_0xc484('0x2a')],'type':_0x3d8fab[_0xc484('0x2b')][_0xc484('0x2c')]};});_0x19d691[_0xc484('0x2d')]=_[_0xc484('0x2e')](_0x978313,'name');_0x19d691[_0xc484('0x2f')]=_[_0xc484('0x30')](_0x306216[_0xc484('0x2f')]);_0x19d691[_0xc484('0x31')]=_[_0xc484('0x32')](_0x19d691['model'],_0x19d691[_0xc484('0x2f')]);_0x57b73c[_0xc484('0x33')]=_[_0xc484('0x32')](_0x19d691[_0xc484('0x2d')],qs['fields'](_0x306216['query'][_0xc484('0x34')]));_0x57b73c['attributes']=_0x57b73c[_0xc484('0x33')][_0xc484('0x35')]?_0x57b73c[_0xc484('0x33')]:_0x19d691[_0xc484('0x2d')];if(!_0x306216[_0xc484('0x2f')][_0xc484('0x36')](_0xc484('0x37'))){_0x57b73c[_0xc484('0x38')]=qs['limit'](_0x306216[_0xc484('0x2f')][_0xc484('0x38')]);_0x57b73c['offset']=qs['offset'](_0x306216[_0xc484('0x2f')][_0xc484('0x1d')]);}_0x57b73c[_0xc484('0x39')]=qs[_0xc484('0x3a')](_0x306216[_0xc484('0x2f')][_0xc484('0x3a')]);_0x57b73c['where']=qs[_0xc484('0x31')](_['pick'](_0x306216[_0xc484('0x2f')],_0x19d691[_0xc484('0x31')]));if(_0x306216[_0xc484('0x2f')][_0xc484('0x3b')]){_0x57b73c['where']=_[_0xc484('0x3c')](_0x57b73c[_0xc484('0x3d')],{'$or':_['map'](_0x978313,function(_0x26ba2d){if(_0x26ba2d[_0xc484('0x2b')]!=='VIRTUAL'){var _0x49bb03={};_0x49bb03[_0x26ba2d['name']]={'$like':'%'+_0x306216[_0xc484('0x2f')]['filter']+'%'};return _0x49bb03;}})});}_0x57b73c=_['merge']({},_0x57b73c,_0x306216[_0xc484('0x3e')]);var _0x52af3d={'where':_0x57b73c[_0xc484('0x3d')]};return db[_0xc484('0x28')]['count'](_0x52af3d)[_0xc484('0x23')](function(_0x40ed3a){_0x46046b[_0xc484('0x1c')]=_0x40ed3a;if(_0x306216['query'][_0xc484('0x3f')]){_0x57b73c[_0xc484('0x40')]=[{'all':!![]}];}return db[_0xc484('0x28')]['findAll'](_0x57b73c);})['then'](function(_0x4e192f){_0x46046b[_0xc484('0x41')]=_0x4e192f;return _0x46046b;})[_0xc484('0x23')](respondWithFilteredResult(_0x3399d6,_0x57b73c))['catch'](handleError(_0x3399d6,null));};exports[_0xc484('0x42')]=function(_0x5ef747,_0x2ca550){var _0x43972b={'raw':!![],'where':{'id':_0x5ef747['params']['id']}},_0x251c46={};_0x251c46[_0xc484('0x2d')]=_[_0xc484('0x30')](db[_0xc484('0x28')]['rawAttributes']);_0x251c46[_0xc484('0x2f')]=_['keys'](_0x5ef747[_0xc484('0x2f')]);_0x251c46[_0xc484('0x31')]=_[_0xc484('0x32')](_0x251c46[_0xc484('0x2d')],_0x251c46[_0xc484('0x2f')]);_0x43972b['attributes']=_[_0xc484('0x32')](_0x251c46[_0xc484('0x2d')],qs[_0xc484('0x34')](_0x5ef747[_0xc484('0x2f')][_0xc484('0x34')]));_0x43972b[_0xc484('0x33')]=_0x43972b['attributes'][_0xc484('0x35')]?_0x43972b[_0xc484('0x33')]:_0x251c46[_0xc484('0x2d')];if(_0x5ef747['query'][_0xc484('0x3f')]){_0x43972b[_0xc484('0x40')]=[{'all':!![]}];}_0x43972b=_['merge']({},_0x43972b,_0x5ef747[_0xc484('0x3e')]);return db[_0xc484('0x28')]['find'](_0x43972b)[_0xc484('0x23')](handleEntityNotFound(_0x2ca550,null))[_0xc484('0x23')](respondWithResult(_0x2ca550,null))['catch'](handleError(_0x2ca550,null));};exports['clone']=function(_0x35cec2,_0x5f0858){var _0x3af955={'where':{'id':_0x35cec2[_0xc484('0x43')]['id']}},_0x2826f5={};_0x2826f5[_0xc484('0x2d')]=_[_0xc484('0x30')](db[_0xc484('0x28')][_0xc484('0x29')]);_0x3af955[_0xc484('0x33')]=_[_0xc484('0x32')](_0x2826f5[_0xc484('0x2d')],qs[_0xc484('0x34')](_0x35cec2[_0xc484('0x2f')][_0xc484('0x34')]));_0x3af955[_0xc484('0x33')]=_0x3af955['attributes'][_0xc484('0x35')]?_0x3af955[_0xc484('0x33')]:_0x2826f5[_0xc484('0x2d')];if(_0x35cec2[_0xc484('0x2f')][_0xc484('0x3f')]){_0x3af955['include']=[{'all':!![]}];}_0x3af955=_[_0xc484('0x3c')]({},_0x3af955,_0x35cec2[_0xc484('0x3e')]);return db['Attachment']['find'](_0x3af955)[_0xc484('0x23')](handleEntityNotFound(_0x5f0858,null))[_0xc484('0x23')](function(_0x55a842){if(_0x55a842){var _0x2807a8=_0x55a842[_0xc484('0x44')]({'plain':!![]});_0x2807a8=qs[_0xc484('0x45')](_0x2807a8,['id',_0xc484('0x46'),_0xc484('0x47')]);_0x35cec2[_0xc484('0x48')]=_[_0xc484('0x45')](_0x35cec2[_0xc484('0x48')],['id',_0xc484('0x46'),_0xc484('0x47')]);return db[_0xc484('0x28')][_0xc484('0x49')](_['merge'](_0x2807a8,_0x35cec2[_0xc484('0x48')]),{'include':_0x35cec2[_0xc484('0x2f')][_0xc484('0x3f')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x5f0858,0xc9))[_0xc484('0x4a')](handleError(_0x5f0858,null));};exports[_0xc484('0x22')]=function(_0x5390ea,_0x3a850a){if(_0x5390ea[_0xc484('0x48')]['id']){delete _0x5390ea[_0xc484('0x48')]['id'];}return db[_0xc484('0x28')][_0xc484('0x4b')]({'where':{'id':_0x5390ea[_0xc484('0x43')]['id']}})[_0xc484('0x23')](handleEntityNotFound(_0x3a850a,null))[_0xc484('0x23')](saveUpdates(_0x5390ea[_0xc484('0x48')],null))[_0xc484('0x23')](respondWithResult(_0x3a850a,null))['catch'](handleError(_0x3a850a,null));};exports[_0xc484('0x24')]=function(_0xc79104,_0x2ef699){return db[_0xc484('0x28')][_0xc484('0x4b')]({'where':{'id':_0xc79104['params']['id']}})[_0xc484('0x23')](handleEntityNotFound(_0x2ef699,null))[_0xc484('0x23')](removeEntity(_0x2ef699,null))[_0xc484('0x4a')](handleError(_0x2ef699,null));};exports['create']=function(_0x267666,_0x27492f,_0xd310ae){_0x267666[_0xc484('0x48')][_0xc484('0x26')]=_0x267666['file'][_0xc484('0x4c')];_0x267666[_0xc484('0x48')][_0xc484('0x4d')]=_0x267666['file'][_0xc484('0x4e')];_0x267666[_0xc484('0x48')][_0xc484('0x2b')]=_0x267666[_0xc484('0x4f')][_0xc484('0x50')];return db[_0xc484('0x28')]['create'](_0x267666['body'])[_0xc484('0x23')](respondWithResult(_0x27492f,0xc9))[_0xc484('0x4a')](handleError(_0x27492f,null));};exports[_0xc484('0x51')]=function(_0x7eae97,_0x1bd9d3,_0x39666a){return db['Attachment']['findOne']({'where':{'id':_0x7eae97[_0xc484('0x43')]['id']},'raw':!![]})[_0xc484('0x23')](handleEntityNotFound(_0x1bd9d3,null))[_0xc484('0x23')](function(_0x3757ec){if(_0x3757ec){return _0x1bd9d3[_0xc484('0x51')](path['join'](config[_0xc484('0x52')],_0xc484('0x53'),_0x3757ec[_0xc484('0x4d')]));}})[_0xc484('0x4a')](handleError(_0x1bd9d3,null));}; \ No newline at end of file +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 diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index af29fc2..ae09ceb 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 _0x1f92=['request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','lodash','../../config/logger','api'];(function(_0xaf6f47,_0x67519c){var _0x163e68=function(_0x4c00f0){while(--_0x4c00f0){_0xaf6f47['push'](_0xaf6f47['shift']());}};_0x163e68(++_0x67519c);}(_0x1f92,0x1ad));var _0x21f9=function(_0x3227cf,_0x3e7e4c){_0x3227cf=_0x3227cf-0x0;var _0x581e7b=_0x1f92[_0x3227cf];return _0x581e7b;};'use strict';var _=require(_0x21f9('0x0'));var util=require('util');var logger=require(_0x21f9('0x1'))(_0x21f9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x21f9('0x3'));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(_0x259f4e,_0x3be0f2){return _0x259f4e[_0x21f9('0x9')](_0x21f9('0xa'),attributes,{'tableName':_0x21f9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 17e7f28..a6f6d26 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 _0xfc54=['catch','CreateAttachment','Attachment','create','body','options','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x5c8fd0,_0x560ba2){var _0x84cbbd=function(_0x8451a6){while(--_0x8451a6){_0x5c8fd0['push'](_0x5c8fd0['shift']());}};_0x84cbbd(++_0x560ba2);}(_0xfc54,0x10c));var _0x4fc5=function(_0x35335f,_0x4861ff){_0x35335f=_0x35335f-0x0;var _0x4a9103=_0xfc54[_0x35335f];return _0x4a9103;};'use strict';var _=require(_0x4fc5('0x0'));var util=require(_0x4fc5('0x1'));var moment=require(_0x4fc5('0x2'));var BPromise=require('bluebird');var rs=require(_0x4fc5('0x3'));var fs=require('fs');var Redis=require(_0x4fc5('0x4'));var db=require(_0x4fc5('0x5'))['db'];var utils=require(_0x4fc5('0x6'));var logger=require('../../config/logger')(_0x4fc5('0x7'));var config=require(_0x4fc5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4fc5('0x9')][_0x4fc5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x325529,_0x2944cf,_0xedf31b){return new BPromise(function(_0x3d0ec5,_0x44be45){return client[_0x4fc5('0xb')](_0x325529,_0xedf31b)[_0x4fc5('0xc')](function(_0x54dd6a){logger[_0x4fc5('0xd')](_0x4fc5('0xe'),_0x2944cf,_0x4fc5('0xf'));logger[_0x4fc5('0x10')]('Attachment,\x20%s,\x20%s,\x20%s',_0x2944cf,_0x4fc5('0xf'),JSON[_0x4fc5('0x11')](_0x54dd6a));if(_0x54dd6a[_0x4fc5('0x12')]){if(_0x54dd6a[_0x4fc5('0x12')][_0x4fc5('0x13')]===0x1f4){logger['error'](_0x4fc5('0xe'),_0x2944cf,_0x54dd6a[_0x4fc5('0x12')][_0x4fc5('0x14')]);return _0x44be45(_0x54dd6a[_0x4fc5('0x12')][_0x4fc5('0x14')]);}logger['error'](_0x4fc5('0xe'),_0x2944cf,_0x54dd6a[_0x4fc5('0x12')][_0x4fc5('0x14')]);return _0x3d0ec5(_0x54dd6a[_0x4fc5('0x12')][_0x4fc5('0x14')]);}else{logger[_0x4fc5('0xd')](_0x4fc5('0xe'),_0x2944cf,_0x4fc5('0xf'));_0x3d0ec5(_0x54dd6a[_0x4fc5('0x15')]['message']);}})[_0x4fc5('0x16')](function(_0x2fed14){logger[_0x4fc5('0x12')](_0x4fc5('0xe'),_0x2944cf,_0x2fed14);_0x44be45(_0x2fed14);});});}exports[_0x4fc5('0x17')]=function(_0x3e6281){var _0x473ca9=this;return new Promise(function(_0x39a774,_0x5952d7){return db[_0x4fc5('0x18')][_0x4fc5('0x19')](_0x3e6281[_0x4fc5('0x1a')],{'raw':_0x3e6281[_0x4fc5('0x1b')]?_0x3e6281[_0x4fc5('0x1b')][_0x4fc5('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x13fbbb){logger['info'](_0x4fc5('0x17'),_0x3e6281);logger[_0x4fc5('0x10')](_0x4fc5('0x17'),_0x3e6281,JSON[_0x4fc5('0x11')](_0x13fbbb));_0x39a774(_0x13fbbb);})['catch'](function(_0x31ef63){logger[_0x4fc5('0x12')](_0x4fc5('0x17'),_0x31ef63[_0x4fc5('0x14')],_0x3e6281);_0x5952d7(_0x473ca9[_0x4fc5('0x12')](0x1f4,_0x31ef63['message']));});});}; \ No newline at end of file +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 diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 9caa2d9..6dc996b 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 _0xe139=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','/:id','/:id/download','isAuthenticated','download','post','/:id/clone','clone','diskStorage','join','root','server/files/attachments/','replace','file','create','put','update','delete','destroy','exports','multer','path'];(function(_0x1f3890,_0x2f9aad){var _0x4af351=function(_0xd4cdfa){while(--_0xd4cdfa){_0x1f3890['push'](_0x1f3890['shift']());}};_0x4af351(++_0x2f9aad);}(_0xe139,0x1eb));var _0x9e13=function(_0x29cf3d,_0xe3c764){_0x29cf3d=_0x29cf3d-0x0;var _0x2c21b5=_0xe139[_0x29cf3d];return _0x2c21b5;};'use strict';var multer=require(_0x9e13('0x0'));var util=require('util');var path=require(_0x9e13('0x1'));var timeout=require(_0x9e13('0x2'));var express=require(_0x9e13('0x3'));var router=express['Router']();var auth=require(_0x9e13('0x4'));var interaction=require(_0x9e13('0x5'));var config=require(_0x9e13('0x6'));var controller=require(_0x9e13('0x7'));router[_0x9e13('0x8')]('/',auth['isAuthenticated'](),controller[_0x9e13('0x9')]);router[_0x9e13('0x8')](_0x9e13('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x9e13('0x8')](_0x9e13('0xb'),auth[_0x9e13('0xc')](),controller[_0x9e13('0xd')]);router[_0x9e13('0xe')](_0x9e13('0xf'),auth[_0x9e13('0xc')](),controller[_0x9e13('0x10')]);var upload=multer({'storage':multer[_0x9e13('0x11')]({'destination':function(_0x16f2a2,_0x338fb8,_0x4ccb75){_0x4ccb75(null,path[_0x9e13('0x12')](config[_0x9e13('0x13')],_0x9e13('0x14')));},'filename':function(_0x540019,_0x17482e,_0x2df0aa){_0x2df0aa(null,util['format']('%s-%s',Date['now'](),_0x17482e['originalname'][_0x9e13('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x9e13('0xe')]('/',upload['single'](_0x9e13('0x16')),controller[_0x9e13('0x17')]);router[_0x9e13('0x18')](_0x9e13('0xa'),auth[_0x9e13('0xc')](),controller[_0x9e13('0x19')]);router[_0x9e13('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x9e13('0x1b')]);module[_0x9e13('0x1c')]=router; \ No newline at end of file +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 diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index d16de97..21ee5f2 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 _0x3593=['profile','email','callback','clientID','secret','Setting','findOne','allowedLoginAttempts','blockDuration','User','find','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','minutes','clearBlockUser','then','getLicense','catch','lodash','passport','Strategy','moment','../../config/environment','../../components/auth/service','../../config/utils','login','authenticate','google','/login'];(function(_0x380a93,_0x63d51d){var _0x2be539=function(_0x8ff520){while(--_0x8ff520){_0x380a93['push'](_0x380a93['shift']());}};_0x2be539(++_0x63d51d);}(_0x3593,0x81));var _0x3359=function(_0x24bb57,_0x4b43f4){_0x24bb57=_0x24bb57-0x0;var _0x329956=_0x3593[_0x24bb57];return _0x329956;};'use strict';var _=require(_0x3359('0x0'));var passport=require(_0x3359('0x1'));var GoogleStrategy=require('passport-google-oauth20')[_0x3359('0x2')];var moment=require(_0x3359('0x3'));var db=require('../../mysqldb')['db'];var config=require(_0x3359('0x4'));var signToken=require(_0x3359('0x5'))['signToken'];var utils=require(_0x3359('0x6'));exports[_0x3359('0x7')]=passport[_0x3359('0x8')](_0x3359('0x9'),{'failureRedirect':_0x3359('0xa'),'scope':[_0x3359('0xb'),_0x3359('0xc')],'session':![]});exports[_0x3359('0xd')]=passport[_0x3359('0x8')](_0x3359('0x9'),{'failureRedirect':_0x3359('0xa'),'session':![]});passport['use'](new GoogleStrategy({'clientID':config['google']?config[_0x3359('0x9')][_0x3359('0xe')]:'id','clientSecret':config['google']?config['google']['clientSecret']:_0x3359('0xf'),'callbackURL':config[_0x3359('0x9')]?config[_0x3359('0x9')]['callbackURL']:''},function(_0x3482b4,_0x251e7b,_0x3e27bd,_0x3e20c){var _0x4b1807,_0x1534b0;return db[_0x3359('0x10')][_0x3359('0x11')]({'where':{'id':0x1},'attributes':[_0x3359('0x12'),_0x3359('0x13')],'raw':!![]})['then'](function(_0x49cd51){_0x4b1807=_0x49cd51;return db[_0x3359('0x14')][_0x3359('0x15')]({'where':{'email':_['map'](_0x3e27bd['emails'],_0x3359('0x16')),'role':{'$or':[_0x3359('0x17'),_0x3359('0x18'),_0x3359('0x19')]}}});})['then'](function(_0xa42396){_0x1534b0=_0xa42396;if(_0x1534b0){if(_0x1534b0['disabled']){return _0x3e20c(_0x3359('0x1a'));}else if(_0x4b1807[_0x3359('0x13')]>0x0){if(_0x1534b0[_0x3359('0x1b')]){if(moment(_0x1534b0[_0x3359('0x1c')])[_0x3359('0x1d')](_0x4b1807[_0x3359('0x13')],_0x3359('0x1e'))>moment()){return _0x3e20c(_0x3359('0x1a'));}else{return utils[_0x3359('0x1f')](_0x1534b0,0x0,![],null)[_0x3359('0x20')](function(){return utils[_0x3359('0x21')](_0x1534b0);})['then'](function(){return _0x3e20c(null,_0x1534b0);});}}else{return utils[_0x3359('0x21')](_0x1534b0)[_0x3359('0x20')](function(){return _0x3e20c(null,_0x1534b0);});}}else{return utils[_0x3359('0x21')](_0x1534b0)[_0x3359('0x20')](function(){return _0x3e20c(null,_0x1534b0);});}}return _0x3e20c(_0x3359('0x1a'));})[_0x3359('0x22')](function(_0x23b6eb){_0x3e20c(_0x23b6eb);});})); \ No newline at end of file +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 diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 454cfb0..6dc2e3e 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 _0x8c25=['passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','login','isMiddleware','setTokenCookie','express'];(function(_0x310569,_0x88f484){var _0x4ee804=function(_0x53ce8d){while(--_0x53ce8d){_0x310569['push'](_0x310569['shift']());}};_0x4ee804(++_0x88f484);}(_0x8c25,0x15e));var _0x58c2=function(_0x2df7ff,_0x151467){_0x2df7ff=_0x2df7ff-0x0;var _0x450661=_0x8c25[_0x2df7ff];return _0x450661;};'use strict';var express=require(_0x58c2('0x0'));var passport=require(_0x58c2('0x1'));var router=express[_0x58c2('0x2')]();var controller=require(_0x58c2('0x3'));var userController=require(_0x58c2('0x4'));var authService=require(_0x58c2('0x5'));router['get']('/',controller[_0x58c2('0x6')]);router['get']('/callback',controller['callback'],authService[_0x58c2('0x7')],userController['login'],authService[_0x58c2('0x8')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 8a2e4cb..c7532de 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 _0x0683=['authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockedAt','add','clearBlockUser','getLicense','catch','MailAccount','find','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service','host','port','secure','authentication','auth','pass','merge','email','request','SendMail','error','format','send','message','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','minutes','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','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','reset','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','Password\x20reset!','use','passport','Strategy','jayson/promise','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blocked','loginAttempts','admin','user','agent'];(function(_0x554292,_0x82948a){var _0x3dd555=function(_0xab7590){while(--_0xab7590){_0x554292['push'](_0x554292['shift']());}};_0x3dd555(++_0x82948a);}(_0x0683,0xe1));var _0x3068=function(_0x5ea445,_0x570685){_0x5ea445=_0x5ea445-0x0;var _0x5a50ea=_0x0683[_0x5ea445];return _0x5a50ea;};'use strict';var util=require('util');var passport=require(_0x3068('0x0'));var LocalStrategy=require('passport-local')[_0x3068('0x1')];var jayson=require(_0x3068('0x2'));var _=require('lodash');var rs=require(_0x3068('0x3'));var moment=require(_0x3068('0x4'));var db=require(_0x3068('0x5'))['db'];var authService=require(_0x3068('0x6'));var utils=require(_0x3068('0x7'));var client=jayson[_0x3068('0x8')]['http']({'port':0x232b});function localAuthenticate(_0x2f5773,_0x35c655,_0x5c7ca0,_0x38d93a){var _0x1aec00,_0x39dcbc;return db[_0x3068('0x9')][_0x3068('0xa')]({'where':{'id':0x1},'attributes':[_0x3068('0xb'),_0x3068('0xc')],'raw':!![]})[_0x3068('0xd')](function(_0x4eb072){_0x1aec00=_0x4eb072;return _0x2f5773[_0x3068('0xa')]({'attributes':['id',_0x3068('0xe'),_0x3068('0xf'),_0x3068('0x10'),_0x3068('0x11'),_0x3068('0x12'),_0x3068('0x13'),'blockedAt',_0x3068('0x14')],'where':{'name':_0x35c655,'role':{'$or':[_0x3068('0x15'),_0x3068('0x16'),_0x3068('0x17')]}}});})[_0x3068('0xd')](function(_0x532dfb){if(!_0x532dfb||_0x532dfb&&_0x532dfb[_0x3068('0xe')]!==_0x35c655){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x39dcbc=_0x532dfb;return _0x39dcbc;}})[_0x3068('0xd')](function(){_0x39dcbc[_0x3068('0x18')](_0x5c7ca0,function(_0x475f77,_0x4c7817){var _0x1d4ad8=_0x39dcbc[_0x3068('0x14')]+0x1;if(_0x475f77){return _0x38d93a(_0x475f77);}else if(!_0x4c7817){if(_0x39dcbc['disabled']){return _0x38d93a(null,![],{'message':_0x3068('0x19')});}else if(_0x1aec00[_0x3068('0xb')]>0x0){if(_0x39dcbc['blocked']){if(_0x1aec00[_0x3068('0xc')]>0x0){if(moment(_0x39dcbc[_0x3068('0x1a')])[_0x3068('0x1b')](_0x1aec00[_0x3068('0xc')],'minutes')>moment()){return _0x38d93a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x3068('0x1c')](_0x39dcbc,_0x1d4ad8,![],null)[_0x3068('0xd')](function(){return _0x38d93a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x38d93a(null,![],{'message':_0x3068('0x19')});}}else{if(_0x1d4ad8>=_0x1aec00[_0x3068('0xb')]){return utils[_0x3068('0x1c')](_0x39dcbc,0x0,!![],moment())[_0x3068('0xd')](function(){return _0x38d93a(null,![],{'message':_0x3068('0x19')});});}else{return utils['clearBlockUser'](_0x39dcbc,_0x1d4ad8,![],null)[_0x3068('0xd')](function(){return _0x38d93a(null,![],{'message':_0x3068('0x19')});});}}}else{return _0x38d93a(null,![],{'message':_0x3068('0x19')});}}else{if(_0x39dcbc[_0x3068('0x12')]){return _0x38d93a(null,![],{'message':_0x3068('0x19')});}else if(_0x1aec00['allowedLoginAttempts']>0x0){if(_0x39dcbc['blocked']){if(_0x1aec00['blockDuration']>0x0){if(moment(_0x39dcbc[_0x3068('0x1a')])[_0x3068('0x1b')](_0x1aec00[_0x3068('0xc')],'minutes')>moment()){return _0x38d93a(null,![],{'message':_0x3068('0x19')});}else{return utils[_0x3068('0x1c')](_0x39dcbc,0x0,![],null)[_0x3068('0xd')](function(){return utils[_0x3068('0x1d')](_0x39dcbc);})[_0x3068('0xd')](function(){return _0x38d93a(null,_0x39dcbc);});}}else{return _0x38d93a(null,![],{'message':_0x3068('0x19')});}}else{return utils[_0x3068('0x1c')](_0x39dcbc,0x0,![],null)['then'](function(){return utils[_0x3068('0x1d')](_0x39dcbc);})['then'](function(){return _0x38d93a(null,_0x39dcbc);})[_0x3068('0x1e')](function(_0x39ea41){return _0x38d93a(null,![],_0x39ea41);});}}else{if(_0x39dcbc['blocked']){return _0x38d93a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x3068('0x1d')](_0x39dcbc)[_0x3068('0xd')](function(){return _0x38d93a(null,_0x39dcbc);});}}}});})[_0x3068('0x1e')](function(_0xc0bec1){return _0x38d93a(null,![],_0xc0bec1);});}function sendServiceMail(_0x2709b9){return db[_0x3068('0x1f')][_0x3068('0x20')]({'where':{'service':!![]},'attributes':['id',_0x3068('0xe'),'email'],'include':[{'model':db['MailServerOut'],'as':'Smtp'}]})[_0x3068('0xd')](function(_0x3c9dfa){if(!_0x3c9dfa){throw new Error(_0x3068('0x21'));}var _0xcde2cc={'tls':{'rejectUnauthorized':![]}};if(_0x3c9dfa[_0x3068('0x22')][_0x3068('0x23')]){_0xcde2cc[_0x3068('0x23')]=_0x3c9dfa[_0x3068('0x22')]['service'];}else{_0xcde2cc['host']=_0x3c9dfa[_0x3068('0x22')][_0x3068('0x24')];_0xcde2cc[_0x3068('0x25')]=_0x3c9dfa[_0x3068('0x22')][_0x3068('0x25')];_0xcde2cc['secure']=_0x3c9dfa[_0x3068('0x22')][_0x3068('0x26')];}if(_0x3c9dfa['Smtp'][_0x3068('0x27')]){_0xcde2cc[_0x3068('0x28')]={'user':_0x3c9dfa['Smtp']['user'],'pass':_0x3c9dfa['Smtp'][_0x3068('0x29')]};}var _0xfe6094={'account':_0xcde2cc,'message':_[_0x3068('0x2a')]({'from':util['format']('\x22%s\x22\x20<%s>',_0x3c9dfa[_0x3068('0xe')],_0x3c9dfa[_0x3068('0x2b')]||_0x3c9dfa['Smtp'][_0x3068('0x16')])},_0x2709b9)};return client[_0x3068('0x2c')](_0x3068('0x2d'),_0xfe6094);})[_0x3068('0xd')](function(_0x48fe79){if(_0x48fe79[_0x3068('0x2e')]){throw new Error(util[_0x3068('0x2f')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x48fe79[_0x3068('0x2e')]['message']||JSON['stringify'](_0x48fe79[_0x3068('0x2e')])));}return!![];});}function handleError(_0x4216e8,_0x4902af,_0x1d9507){return _0x4216e8['status'](_0x4902af||0x1f4)[_0x3068('0x30')]({'message':_0x1d9507?_0x1d9507[_0x3068('0x31')]||_0x1d9507:''});}function checkPasswordPattern(_0x36fab8,_0x35fb83,_0x5b8330){if(_0x5b8330){var _0x9bb764=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x9bb764[_0x3068('0x32')](_0x35fb83)){return _0x36fab8;}else{throw new Error(_0x3068('0x33'));}}else{return _0x36fab8;}}exports[_0x3068('0x34')]=function(_0x47228f,_0x32bc1b,_0x3ef68c){passport['authenticate'](_0x3068('0x35'),function(_0x59ea86,_0x233c7b,_0x1e8b12){var _0x426d18=_0x59ea86||_0x1e8b12;if(_0x426d18){return handleError(_0x32bc1b,0x191,_0x426d18);}if(!_0x233c7b){return handleError(_0x32bc1b,0x194,{'message':_0x3068('0x36')});}else{var _0x3838d3={'payload':{'id':_0x233c7b['id'],'role':_0x233c7b[_0x3068('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0x3068('0x37')](_0x3838d3)[_0x3068('0xd')](function(_0xbf8444){_0x32bc1b[_0x3068('0x38')]({'id':_0x233c7b['id'],'token':_0xbf8444,'statusCall':'','isAlreadyLogged':_0x233c7b['online']});});}})(_0x47228f,_0x32bc1b,_0x3ef68c);};exports[_0x3068('0x39')]=function(_0x380fcc,_0x5c86cb,_0x489d9b){if(!_0x380fcc[_0x3068('0x3a')][_0x3068('0x2b')]){return handleError(_0x5c86cb,0x1f4,{'message':_0x3068('0x3b')});}var _0x3a2730=rs[_0x3068('0x3c')]();_0x380fcc[_0x3068('0x3a')][_0x3068('0x2b')]=_0x380fcc[_0x3068('0x3a')][_0x3068('0x2b')][_0x3068('0x3d')]()[_0x3068('0x3e')]();var _0x5eb97f;return db[_0x3068('0x9')][_0x3068('0xa')]({'where':{'id':0x1},'attributes':[_0x3068('0xb'),'blockDuration'],'raw':!![]})[_0x3068('0xd')](function(_0x1801eb){_0x5eb97f=_0x1801eb;return db[_0x3068('0x3f')][_0x3068('0x20')]({'where':{'email':_0x380fcc[_0x3068('0x3a')][_0x3068('0x2b')]}});})[_0x3068('0xd')](function(_0x9f15f6){if(!_0x9f15f6){throw new Error(_0x3068('0x40'));}if(_0x9f15f6[_0x3068('0x12')]){throw new Error(_0x3068('0x41'));}if(_0x9f15f6[_0x3068('0x13')]){if(moment(_0x9f15f6['blockedAt'])[_0x3068('0x1b')](_0x5eb97f[_0x3068('0xc')],_0x3068('0x42'))>moment()){throw new Error(_0x3068('0x43'));}else{_0x9f15f6[_0x3068('0x13')]=![];_0x9f15f6[_0x3068('0x1a')]=null;}}_0x9f15f6[_0x3068('0x44')]=_0x3a2730;_0x9f15f6['resetPasswordExpires']=Date['now']()+0x36ee80;return _0x9f15f6[_0x3068('0x45')]();})[_0x3068('0xd')](function(){return sendServiceMail({'to':_0x380fcc[_0x3068('0x3a')]['email'],'subject':_0x3068('0x46'),'text':_0x3068('0x47')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x3068('0x48')+_0x380fcc[_0x3068('0x49')][_0x3068('0x24')]+'/reset/'+_0x3a2730+'\x0a\x0a'+_0x3068('0x4a')});})['then'](function(){_0x5c86cb[_0x3068('0x4b')](0xc8)['send']({'message':'Reset\x20Email\x20sent!'});})[_0x3068('0x1e')](function(_0xeaa3ad){return handleError(_0x5c86cb,0x1f4,_0xeaa3ad);});};exports[_0x3068('0x4c')]=function(_0x6612ea,_0x4bb826,_0x4368ba){var _0x5b3477;return db[_0x3068('0x3f')][_0x3068('0x20')]({'where':{'resetPasswordToken':_0x6612ea['params'][_0x3068('0x4d')],'resetPasswordExpires':{'$gt':Date[_0x3068('0x4e')]()}}})['then'](function(_0x5b296d){_0x5b3477=_0x5b296d;if(!_0x5b3477){throw new Error(_0x3068('0x4f'));}return db['Setting']['findOne']({'attributes':['id','securePassword']});})[_0x3068('0xd')](function(_0x2fa810){return checkPasswordPattern(_0x2fa810,_0x6612ea[_0x3068('0x3a')][_0x3068('0xf')],_0x2fa810[_0x3068('0x50')]);})[_0x3068('0xd')](function(){_0x5b3477[_0x3068('0xf')]=_0x6612ea[_0x3068('0x3a')][_0x3068('0xf')];_0x5b3477['resetPasswordToken']=null;_0x5b3477['resetPasswordExpires']=null;return _0x5b3477[_0x3068('0x45')]();})[_0x3068('0xd')](function(){_0x4bb826[_0x3068('0x4b')](0xc8)[_0x3068('0x30')]({'message':_0x3068('0x51')});})['catch'](function(_0x54209f){return handleError(_0x4bb826,0x1f4,_0x54209f);});};passport[_0x3068('0x52')](new LocalStrategy({'usernameField':_0x3068('0xe'),'passwordField':_0x3068('0xf')},function(_0x7e647f,_0x2fa987,_0x3fc28b){return localAuthenticate(db['User'],_0x7e647f,_0x2fa987,_0x3fc28b);})); \ No newline at end of file +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 diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 0380224..3cf44ba 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 _0xca1f=['forgot','reset','exports','express','./authLocal.controller','post','login','/forgot'];(function(_0x505d38,_0x469242){var _0x32eb3b=function(_0x54778a){while(--_0x54778a){_0x505d38['push'](_0x505d38['shift']());}};_0x32eb3b(++_0x469242);}(_0xca1f,0xa3));var _0xfca1=function(_0x424e30,_0x3ee2c6){_0x424e30=_0x424e30-0x0;var _0x2c7c0c=_0xca1f[_0x424e30];return _0x2c7c0c;};'use strict';var express=require(_0xfca1('0x0'));var router=express['Router']();var controller=require(_0xfca1('0x1'));router[_0xfca1('0x2')]('/',controller[_0xfca1('0x3')]);router[_0xfca1('0x2')](_0xfca1('0x4'),controller[_0xfca1('0x5')]);router[_0xfca1('0x2')]('/reset/:token',controller[_0xfca1('0x6')]);module[_0xfca1('0x7')]=router; \ No newline at end of file +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 diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index f97833c..ac314d2 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 _0x5e6b=['exports','STRING','BOOLEAN','INTEGER'];(function(_0x16771d,_0x224c60){var _0x386f11=function(_0x3d7a87){while(--_0x3d7a87){_0x16771d['push'](_0x16771d['shift']());}};_0x386f11(++_0x224c60);}(_0x5e6b,0x104));var _0xb5e6=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x5e6b[_0x5f3f88];return _0xd08119;};'use strict';var Sequelize=require('sequelize');module[_0xb5e6('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0xb5e6('0x1')]},'description':{'type':Sequelize[_0xb5e6('0x1')]},'status':{'type':Sequelize[_0xb5e6('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xb5e6('0x3')],'defaultValue':0xa}}; \ No newline at end of file +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 diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index c51d3e2..ca9e257 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 _0x0a2d=['save','update','then','destroy','error','name','send','map','Automation','rawAttributes','type','key','model','query','filters','attributes','intersection','length','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','catch','show','keys','fields','include','find','create','body','addConditions','Condition','params','ids','getConditions','hasOwnProperty','nolimit','Action','addActions','omit','getActions','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','json','apply','reject'];(function(_0x233b1d,_0x54d2b3){var _0x5c962b=function(_0x3d7cde){while(--_0x3d7cde){_0x233b1d['push'](_0x233b1d['shift']());}};_0x5c962b(++_0x54d2b3);}(_0x0a2d,0x132));var _0xd0a2=function(_0x5a66dd,_0x3dabad){_0x5a66dd=_0x5a66dd-0x0;var _0x5bfbd7=_0x0a2d[_0x5a66dd];return _0x5bfbd7;};'use strict';var pdf=require(_0xd0a2('0x0'));var emlformat=require(_0xd0a2('0x1'));var rimraf=require(_0xd0a2('0x2'));var zipdir=require(_0xd0a2('0x3'));var jsonpatch=require(_0xd0a2('0x4'));var rp=require('request-promise');var moment=require(_0xd0a2('0x5'));var BPromise=require(_0xd0a2('0x6'));var Mustache=require(_0xd0a2('0x7'));var util=require('util');var path=require(_0xd0a2('0x8'));var sox=require(_0xd0a2('0x9'));var csv=require(_0xd0a2('0xa'));var ejs=require(_0xd0a2('0xb'));var fs=require('fs');var _=require(_0xd0a2('0xc'));var squel=require(_0xd0a2('0xd'));var crypto=require(_0xd0a2('0xe'));var jsforce=require(_0xd0a2('0xf'));var deskjs=require(_0xd0a2('0x10'));var toCsv=require(_0xd0a2('0xa'));var querystring=require(_0xd0a2('0x11'));var Papa=require(_0xd0a2('0x12'));var Redis=require(_0xd0a2('0x13'));var authService=require(_0xd0a2('0x14'));var qs=require(_0xd0a2('0x15'));var as=require(_0xd0a2('0x16'));var hardwareService=require(_0xd0a2('0x17'));var logger=require(_0xd0a2('0x18'))(_0xd0a2('0x19'));var utils=require('../../config/utils');var config=require(_0xd0a2('0x1a'));var db=require(_0xd0a2('0x1b'))['db'];function respondWithStatusCode(_0x49fd87,_0x89b423){_0x89b423=_0x89b423||0xcc;return function(_0x3182aa){if(_0x3182aa){return _0x49fd87[_0xd0a2('0x1c')](_0x89b423);}return _0x49fd87['status'](_0x89b423)[_0xd0a2('0x1d')]();};}function respondWithResult(_0x48856c,_0x2dccd3){_0x2dccd3=_0x2dccd3||0xc8;return function(_0x31d702){if(_0x31d702){return _0x48856c[_0xd0a2('0x1e')](_0x2dccd3)['json'](_0x31d702);}};}function respondWithFilteredResult(_0x4f53af,_0x4171a8){return function(_0x3a715a){if(_0x3a715a){var _0x27ad33=_0x3a715a[_0xd0a2('0x1f')],_0x3910c6=_0x4171a8['offset'],_0x3f2e1b=_0x4171a8[_0xd0a2('0x20')]+_0x4171a8[_0xd0a2('0x21')],_0x22e808;if(_0x3f2e1b>=_0x27ad33){_0x3f2e1b=_0x27ad33;_0x22e808=0xc8;}else{_0x22e808=0xce;}_0x4f53af[_0xd0a2('0x1e')](_0x22e808);return _0x4f53af[_0xd0a2('0x22')]('Content-Range',_0x3910c6+'-'+_0x3f2e1b+'/'+_0x27ad33)[_0xd0a2('0x23')](_0x3a715a);}return null;};}function patchUpdates(_0x12f681){return function(_0x2e8457){try{jsonpatch[_0xd0a2('0x24')](_0x2e8457,_0x12f681,!![]);}catch(_0x41b40a){return BPromise[_0xd0a2('0x25')](_0x41b40a);}return _0x2e8457[_0xd0a2('0x26')]();};}function saveUpdates(_0x1508bb,_0x38de5b){return function(_0x2d973f){if(_0x2d973f){return _0x2d973f[_0xd0a2('0x27')](_0x1508bb)[_0xd0a2('0x28')](function(_0x495b00){return _0x495b00;});}return null;};}function removeEntity(_0xab36a7,_0x4bc9bc){return function(_0x2f5d37){if(_0x2f5d37){return _0x2f5d37[_0xd0a2('0x29')]()[_0xd0a2('0x28')](function(){_0xab36a7[_0xd0a2('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18ecc4,_0x3c1ff9){return function(_0x454c7d){if(!_0x454c7d){_0x18ecc4[_0xd0a2('0x1c')](0x194);}return _0x454c7d;};}function handleError(_0x27ef16,_0x5b185b){_0x5b185b=_0x5b185b||0x1f4;return function(_0xb7637a){logger[_0xd0a2('0x2a')](_0xb7637a['stack']);if(_0xb7637a[_0xd0a2('0x2b')]){delete _0xb7637a[_0xd0a2('0x2b')];}_0x27ef16[_0xd0a2('0x1e')](_0x5b185b)[_0xd0a2('0x2c')](_0xb7637a);};}exports['index']=function(_0x9bc335,_0x5e7b3d){var _0x38f37d={},_0x1ceefd={},_0x4ea51a={'count':0x0,'rows':[]};var _0x14525d=_[_0xd0a2('0x2d')](db[_0xd0a2('0x2e')][_0xd0a2('0x2f')],function(_0x26e0c9){return{'name':_0x26e0c9['fieldName'],'type':_0x26e0c9[_0xd0a2('0x30')][_0xd0a2('0x31')]};});_0x1ceefd[_0xd0a2('0x32')]=_[_0xd0a2('0x2d')](_0x14525d,_0xd0a2('0x2b'));_0x1ceefd[_0xd0a2('0x33')]=_['keys'](_0x9bc335[_0xd0a2('0x33')]);_0x1ceefd[_0xd0a2('0x34')]=_['intersection'](_0x1ceefd[_0xd0a2('0x32')],_0x1ceefd['query']);_0x38f37d[_0xd0a2('0x35')]=_[_0xd0a2('0x36')](_0x1ceefd['model'],qs['fields'](_0x9bc335[_0xd0a2('0x33')]['fields']));_0x38f37d['attributes']=_0x38f37d['attributes'][_0xd0a2('0x37')]?_0x38f37d['attributes']:_0x1ceefd[_0xd0a2('0x32')];if(!_0x9bc335['query']['hasOwnProperty']('nolimit')){_0x38f37d['limit']=qs[_0xd0a2('0x21')](_0x9bc335[_0xd0a2('0x33')][_0xd0a2('0x21')]);_0x38f37d[_0xd0a2('0x20')]=qs[_0xd0a2('0x20')](_0x9bc335[_0xd0a2('0x33')][_0xd0a2('0x20')]);}_0x38f37d[_0xd0a2('0x38')]=qs[_0xd0a2('0x39')](_0x9bc335['query'][_0xd0a2('0x39')]);_0x38f37d['where']=qs[_0xd0a2('0x34')](_[_0xd0a2('0x3a')](_0x9bc335[_0xd0a2('0x33')],_0x1ceefd[_0xd0a2('0x34')]));if(_0x9bc335[_0xd0a2('0x33')][_0xd0a2('0x3b')]){_0x38f37d[_0xd0a2('0x3c')]=_[_0xd0a2('0x3d')](_0x38f37d['where'],{'$or':_[_0xd0a2('0x2d')](_0x14525d,function(_0x288ac4){if(_0x288ac4['type']!==_0xd0a2('0x3e')){var _0x590556={};_0x590556[_0x288ac4['name']]={'$like':'%'+_0x9bc335[_0xd0a2('0x33')][_0xd0a2('0x3b')]+'%'};return _0x590556;}})});}_0x38f37d=_[_0xd0a2('0x3d')]({},_0x38f37d,_0x9bc335[_0xd0a2('0x3f')]);var _0x1cc156={'where':_0x38f37d[_0xd0a2('0x3c')]};return db['Automation'][_0xd0a2('0x1f')](_0x1cc156)[_0xd0a2('0x28')](function(_0x34fe88){_0x4ea51a[_0xd0a2('0x1f')]=_0x34fe88;if(_0x9bc335[_0xd0a2('0x33')][_0xd0a2('0x40')]){_0x38f37d['include']=[{'all':!![]}];}return db[_0xd0a2('0x2e')][_0xd0a2('0x41')](_0x38f37d);})['then'](function(_0x3d7f75){_0x4ea51a['rows']=_0x3d7f75;return _0x4ea51a;})['then'](respondWithFilteredResult(_0x5e7b3d,_0x38f37d))[_0xd0a2('0x42')](handleError(_0x5e7b3d,null));};exports[_0xd0a2('0x43')]=function(_0x47f874,_0x2d6fa4){var _0x568e9f={'raw':![],'where':{'id':_0x47f874['params']['id']}},_0x5c138c={};_0x5c138c['model']=_['keys'](db[_0xd0a2('0x2e')][_0xd0a2('0x2f')]);_0x5c138c[_0xd0a2('0x33')]=_[_0xd0a2('0x44')](_0x47f874[_0xd0a2('0x33')]);_0x5c138c[_0xd0a2('0x34')]=_['intersection'](_0x5c138c[_0xd0a2('0x32')],_0x5c138c[_0xd0a2('0x33')]);_0x568e9f[_0xd0a2('0x35')]=_[_0xd0a2('0x36')](_0x5c138c[_0xd0a2('0x32')],qs[_0xd0a2('0x45')](_0x47f874['query'][_0xd0a2('0x45')]));_0x568e9f[_0xd0a2('0x35')]=_0x568e9f[_0xd0a2('0x35')][_0xd0a2('0x37')]?_0x568e9f[_0xd0a2('0x35')]:_0x5c138c['model'];if(_0x47f874[_0xd0a2('0x33')]['includeAll']){_0x568e9f[_0xd0a2('0x46')]=[{'all':!![]}];}_0x568e9f=_[_0xd0a2('0x3d')]({},_0x568e9f,_0x47f874['options']);return db['Automation'][_0xd0a2('0x47')](_0x568e9f)[_0xd0a2('0x28')](handleEntityNotFound(_0x2d6fa4,null))['then'](respondWithResult(_0x2d6fa4,null))[_0xd0a2('0x42')](handleError(_0x2d6fa4,null));};exports['create']=function(_0x42b891,_0x4b25b9){return db[_0xd0a2('0x2e')][_0xd0a2('0x48')](_0x42b891['body'],{})[_0xd0a2('0x28')](respondWithResult(_0x4b25b9,0xc9))[_0xd0a2('0x42')](handleError(_0x4b25b9,null));};exports[_0xd0a2('0x27')]=function(_0x5ae771,_0x202c28){if(_0x5ae771[_0xd0a2('0x49')]['id']){delete _0x5ae771['body']['id'];}return db[_0xd0a2('0x2e')]['find']({'where':{'id':_0x5ae771['params']['id']}})[_0xd0a2('0x28')](handleEntityNotFound(_0x202c28,null))['then'](saveUpdates(_0x5ae771[_0xd0a2('0x49')],null))[_0xd0a2('0x28')](respondWithResult(_0x202c28,null))[_0xd0a2('0x42')](handleError(_0x202c28,null));};exports[_0xd0a2('0x29')]=function(_0x251adc,_0x3962b8){return db[_0xd0a2('0x2e')][_0xd0a2('0x47')]({'where':{'id':_0x251adc['params']['id']}})['then'](handleEntityNotFound(_0x3962b8,null))[_0xd0a2('0x28')](removeEntity(_0x3962b8,null))[_0xd0a2('0x42')](handleError(_0x3962b8,null));};exports[_0xd0a2('0x4a')]=function(_0x16089f,_0x55a0a2,_0x39ab09){return db[_0xd0a2('0x4b')][_0xd0a2('0x47')]({'where':{'id':_0x16089f[_0xd0a2('0x4c')]['id']}})[_0xd0a2('0x28')](handleEntityNotFound(_0x55a0a2,null))[_0xd0a2('0x28')](function(_0x38bf5c){if(_0x38bf5c){return _0x38bf5c[_0xd0a2('0x4a')](_0x16089f[_0xd0a2('0x49')]['ids'],_['omit'](_0x16089f[_0xd0a2('0x49')],[_0xd0a2('0x4d'),'id'])||{});}})[_0xd0a2('0x28')](respondWithResult(_0x55a0a2,null))['catch'](handleError(_0x55a0a2,null));};exports[_0xd0a2('0x4e')]=function(_0x2fc2f5,_0xd37411,_0x43c520){var _0x23e2aa={};var _0x13215b={};var _0x4d5df8;var _0x526cb2;return db[_0xd0a2('0x2e')]['findOne']({'where':{'id':_0x2fc2f5[_0xd0a2('0x4c')]['id']}})['then'](handleEntityNotFound(_0xd37411,null))[_0xd0a2('0x28')](function(_0x1d2a6d){if(_0x1d2a6d){_0x4d5df8=_0x1d2a6d;_0x13215b[_0xd0a2('0x32')]=_[_0xd0a2('0x44')](db[_0xd0a2('0x4b')]['rawAttributes']);_0x13215b['query']=_[_0xd0a2('0x44')](_0x2fc2f5[_0xd0a2('0x33')]);_0x13215b[_0xd0a2('0x34')]=_['intersection'](_0x13215b[_0xd0a2('0x32')],_0x13215b[_0xd0a2('0x33')]);_0x23e2aa[_0xd0a2('0x35')]=_[_0xd0a2('0x36')](_0x13215b[_0xd0a2('0x32')],qs['fields'](_0x2fc2f5[_0xd0a2('0x33')][_0xd0a2('0x45')]));_0x23e2aa['attributes']=_0x23e2aa['attributes'][_0xd0a2('0x37')]?_0x23e2aa[_0xd0a2('0x35')]:_0x13215b[_0xd0a2('0x32')];_0x23e2aa[_0xd0a2('0x38')]=qs['sort'](_0x2fc2f5[_0xd0a2('0x33')]['sort']);_0x23e2aa[_0xd0a2('0x3c')]=qs[_0xd0a2('0x34')](_['pick'](_0x2fc2f5[_0xd0a2('0x33')],_0x13215b[_0xd0a2('0x34')]));if(_0x2fc2f5[_0xd0a2('0x33')][_0xd0a2('0x3b')]){_0x23e2aa[_0xd0a2('0x3c')]=_['merge'](_0x23e2aa[_0xd0a2('0x3c')],{'$or':_[_0xd0a2('0x2d')](_0x23e2aa[_0xd0a2('0x35')],function(_0x38675d){var _0x43af92={};_0x43af92[_0x38675d]={'$like':'%'+_0x2fc2f5[_0xd0a2('0x33')]['filter']+'%'};return _0x43af92;})});}_0x23e2aa=_[_0xd0a2('0x3d')]({},_0x23e2aa,_0x2fc2f5[_0xd0a2('0x3f')]);return _0x4d5df8[_0xd0a2('0x4e')](_0x23e2aa);}})[_0xd0a2('0x28')](function(_0x2f6e42){if(_0x2f6e42){_0x526cb2=_0x2f6e42['length'];if(!_0x2fc2f5[_0xd0a2('0x33')][_0xd0a2('0x4f')](_0xd0a2('0x50'))){_0x23e2aa[_0xd0a2('0x21')]=qs[_0xd0a2('0x21')](_0x2fc2f5['query'][_0xd0a2('0x21')]);_0x23e2aa[_0xd0a2('0x20')]=qs[_0xd0a2('0x20')](_0x2fc2f5[_0xd0a2('0x33')][_0xd0a2('0x20')]);}return _0x4d5df8[_0xd0a2('0x4e')](_0x23e2aa);}})[_0xd0a2('0x28')](function(_0x3f5e47){if(_0x3f5e47){return _0x3f5e47?{'count':_0x526cb2,'rows':_0x3f5e47}:null;}})[_0xd0a2('0x28')](respondWithResult(_0xd37411,null))['catch'](handleError(_0xd37411,null));};exports['addActions']=function(_0x2b4933,_0x192407,_0x30884){return db[_0xd0a2('0x51')][_0xd0a2('0x47')]({'where':{'id':_0x2b4933['params']['id']}})['then'](handleEntityNotFound(_0x192407,null))['then'](function(_0x1914dd){if(_0x1914dd){return _0x1914dd[_0xd0a2('0x52')](_0x2b4933[_0xd0a2('0x49')][_0xd0a2('0x4d')],_[_0xd0a2('0x53')](_0x2b4933[_0xd0a2('0x49')],['ids','id'])||{});}})[_0xd0a2('0x28')](respondWithResult(_0x192407,null))[_0xd0a2('0x42')](handleError(_0x192407,null));};exports[_0xd0a2('0x54')]=function(_0x39192d,_0x5bc2eb,_0x47183b){var _0x65af0b={};var _0x55ce7f={};var _0x2e792c;var _0x39603a;return db[_0xd0a2('0x2e')][_0xd0a2('0x55')]({'where':{'id':_0x39192d[_0xd0a2('0x4c')]['id']}})[_0xd0a2('0x28')](handleEntityNotFound(_0x5bc2eb,null))[_0xd0a2('0x28')](function(_0x364a33){if(_0x364a33){_0x2e792c=_0x364a33;_0x55ce7f['model']=_[_0xd0a2('0x44')](db[_0xd0a2('0x51')][_0xd0a2('0x2f')]);_0x55ce7f['query']=_[_0xd0a2('0x44')](_0x39192d[_0xd0a2('0x33')]);_0x55ce7f[_0xd0a2('0x34')]=_[_0xd0a2('0x36')](_0x55ce7f[_0xd0a2('0x32')],_0x55ce7f[_0xd0a2('0x33')]);_0x65af0b['attributes']=_['intersection'](_0x55ce7f[_0xd0a2('0x32')],qs[_0xd0a2('0x45')](_0x39192d[_0xd0a2('0x33')][_0xd0a2('0x45')]));_0x65af0b[_0xd0a2('0x35')]=_0x65af0b['attributes'][_0xd0a2('0x37')]?_0x65af0b[_0xd0a2('0x35')]:_0x55ce7f[_0xd0a2('0x32')];_0x65af0b['order']=qs[_0xd0a2('0x39')](_0x39192d[_0xd0a2('0x33')][_0xd0a2('0x39')]);_0x65af0b[_0xd0a2('0x3c')]=qs['filters'](_['pick'](_0x39192d[_0xd0a2('0x33')],_0x55ce7f[_0xd0a2('0x34')]));if(_0x39192d[_0xd0a2('0x33')][_0xd0a2('0x3b')]){_0x65af0b[_0xd0a2('0x3c')]=_[_0xd0a2('0x3d')](_0x65af0b[_0xd0a2('0x3c')],{'$or':_[_0xd0a2('0x2d')](_0x65af0b[_0xd0a2('0x35')],function(_0x138748){var _0x1cb6cf={};_0x1cb6cf[_0x138748]={'$like':'%'+_0x39192d['query'][_0xd0a2('0x3b')]+'%'};return _0x1cb6cf;})});}_0x65af0b=_['merge']({},_0x65af0b,_0x39192d[_0xd0a2('0x3f')]);return _0x2e792c['getActions'](_0x65af0b);}})[_0xd0a2('0x28')](function(_0x4f2fa6){if(_0x4f2fa6){_0x39603a=_0x4f2fa6[_0xd0a2('0x37')];if(!_0x39192d[_0xd0a2('0x33')][_0xd0a2('0x4f')](_0xd0a2('0x50'))){_0x65af0b['limit']=qs[_0xd0a2('0x21')](_0x39192d[_0xd0a2('0x33')][_0xd0a2('0x21')]);_0x65af0b['offset']=qs[_0xd0a2('0x20')](_0x39192d[_0xd0a2('0x33')][_0xd0a2('0x20')]);}return _0x2e792c[_0xd0a2('0x54')](_0x65af0b);}})['then'](function(_0x7b17dc){if(_0x7b17dc){return _0x7b17dc?{'count':_0x39603a,'rows':_0x7b17dc}:null;}})['then'](respondWithResult(_0x5bc2eb,null))[_0xd0a2('0x42')](handleError(_0x5bc2eb,null));}; \ No newline at end of file +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 diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index cc6b3b2..06afb7b 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 _0x9e9c=['bluebird','path','rimraf','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','lodash','api'];(function(_0x1927d7,_0x4a9be6){var _0x2a73f5=function(_0x1691a3){while(--_0x1691a3){_0x1927d7['push'](_0x1927d7['shift']());}};_0x2a73f5(++_0x4a9be6);}(_0x9e9c,0xa3));var _0xc9e9=function(_0x44c768,_0x552a5e){_0x44c768=_0x44c768-0x0;var _0x55daf5=_0x9e9c[_0x44c768];return _0x55daf5;};'use strict';var _=require(_0xc9e9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc9e9('0x1'));var moment=require('moment');var BPromise=require(_0xc9e9('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc9e9('0x3'));var rimraf=require(_0xc9e9('0x4'));var config=require(_0xc9e9('0x5'));var attributes=require(_0xc9e9('0x6'));module[_0xc9e9('0x7')]=function(_0x88e868,_0x3f6719){return _0x88e868[_0xc9e9('0x8')](_0xc9e9('0x9'),attributes,{'tableName':_0xc9e9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 0e8970b..b988cb6 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 _0x0c48=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x315ddb,_0x18a5cf){var _0xacbbf4=function(_0x28b82b){while(--_0x28b82b){_0x315ddb['push'](_0x315ddb['shift']());}};_0xacbbf4(++_0x18a5cf);}(_0x0c48,0xed));var _0x80c4=function(_0x49434f,_0x316922){_0x49434f=_0x49434f-0x0;var _0x281a4e=_0x0c48[_0x49434f];return _0x281a4e;};'use strict';var _=require(_0x80c4('0x0'));var util=require(_0x80c4('0x1'));var moment=require(_0x80c4('0x2'));var BPromise=require(_0x80c4('0x3'));var rs=require(_0x80c4('0x4'));var fs=require('fs');var Redis=require(_0x80c4('0x5'));var db=require(_0x80c4('0x6'))['db'];var utils=require(_0x80c4('0x7'));var logger=require(_0x80c4('0x8'))(_0x80c4('0x9'));var config=require(_0x80c4('0xa'));var jayson=require(_0x80c4('0xb'));var client=jayson[_0x80c4('0xc')][_0x80c4('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xa87cb8,_0x32abb3,_0x5cd7fb){return new BPromise(function(_0x350a57,_0x213734){return client[_0x80c4('0xe')](_0xa87cb8,_0x5cd7fb)[_0x80c4('0xf')](function(_0xac4132){logger[_0x80c4('0x10')](_0x80c4('0x11'),_0x32abb3,_0x80c4('0x12'));logger[_0x80c4('0x13')]('Automation,\x20%s,\x20%s,\x20%s',_0x32abb3,'request\x20sent',JSON[_0x80c4('0x14')](_0xac4132));if(_0xac4132['error']){if(_0xac4132[_0x80c4('0x15')][_0x80c4('0x16')]===0x1f4){logger[_0x80c4('0x15')](_0x80c4('0x11'),_0x32abb3,_0xac4132[_0x80c4('0x15')]['message']);return _0x213734(_0xac4132[_0x80c4('0x15')][_0x80c4('0x17')]);}logger[_0x80c4('0x15')](_0x80c4('0x11'),_0x32abb3,_0xac4132['error'][_0x80c4('0x17')]);return _0x350a57(_0xac4132[_0x80c4('0x15')]['message']);}else{logger[_0x80c4('0x10')](_0x80c4('0x11'),_0x32abb3,'request\x20sent');_0x350a57(_0xac4132[_0x80c4('0x18')][_0x80c4('0x17')]);}})[_0x80c4('0x19')](function(_0x4f4f34){logger[_0x80c4('0x15')](_0x80c4('0x11'),_0x32abb3,_0x4f4f34);_0x213734(_0x4f4f34);});});} \ No newline at end of file +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 diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 786dc71..430b042 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 _0x1760=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post','addActions','put','update','delete','multer','path','connect-timeout','express'];(function(_0x50dc96,_0x58dbbb){var _0x49e161=function(_0x52d921){while(--_0x52d921){_0x50dc96['push'](_0x50dc96['shift']());}};_0x49e161(++_0x58dbbb);}(_0x1760,0x11a));var _0x0176=function(_0x1dd2ea,_0x10ea64){_0x1dd2ea=_0x1dd2ea-0x0;var _0x411967=_0x1760[_0x1dd2ea];return _0x411967;};'use strict';var multer=require(_0x0176('0x0'));var util=require('util');var path=require(_0x0176('0x1'));var timeout=require(_0x0176('0x2'));var express=require(_0x0176('0x3'));var router=express[_0x0176('0x4')]();var auth=require(_0x0176('0x5'));var interaction=require(_0x0176('0x6'));var config=require(_0x0176('0x7'));var controller=require(_0x0176('0x8'));router[_0x0176('0x9')]('/',auth[_0x0176('0xa')](),controller['index']);router[_0x0176('0x9')](_0x0176('0xb'),auth[_0x0176('0xa')](),controller[_0x0176('0xc')]);router['get'](_0x0176('0xd'),auth[_0x0176('0xa')](),controller[_0x0176('0xe')]);router[_0x0176('0x9')](_0x0176('0xf'),auth[_0x0176('0xa')](),controller[_0x0176('0x10')]);router[_0x0176('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0176('0x11')](_0x0176('0xd'),auth[_0x0176('0xa')](),controller['addConditions']);router['post'](_0x0176('0xf'),auth['isAuthenticated'](),controller[_0x0176('0x12')]);router[_0x0176('0x13')]('/:id',auth[_0x0176('0xa')](),controller[_0x0176('0x14')]);router[_0x0176('0x15')](_0x0176('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 4ac2152..4738fbb 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 _0x8e52=['#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ENUM','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time'];(function(_0x486cca,_0x8cd1e8){var _0x405bd2=function(_0x2d8938){while(--_0x2d8938){_0x486cca['push'](_0x486cca['shift']());}};_0x405bd2(++_0x8cd1e8);}(_0x8e52,0x1d6));var _0x28e5=function(_0x4a599b,_0x1d2125){_0x4a599b=_0x4a599b-0x0;var _0x2d53d3=_0x8e52[_0x4a599b];return _0x2d53d3;};'use strict';var Sequelize=require(_0x28e5('0x0'));module['exports']={'name':{'type':Sequelize[_0x28e5('0x1')],'unique':_0x28e5('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x28e5('0x3')),'allowNull':![],'defaultValue':_0x28e5('0x3')},'description':{'type':Sequelize[_0x28e5('0x1')]},'active':{'type':Sequelize[_0x28e5('0x4')],'defaultValue':0x0,'comment':_0x28e5('0x5')},'limitCalls':{'type':Sequelize[_0x28e5('0x6')](0x4)[_0x28e5('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x28e5('0x8')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x28e5('0x6')](0x3)[_0x28e5('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x28e5('0x9')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x28e5('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x28e5('0x6')](0x5)[_0x28e5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x28e5('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x28e5('0x6')](0x3)[_0x28e5('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x28e5('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x28e5('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x28e5('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x28e5('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x28e5('0x6')](0x5)[_0x28e5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x28e5('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x28e5('0x6')](0x3)[_0x28e5('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x28e5('0xf')},'dialTimezone':{'type':Sequelize[_0x28e5('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x28e5('0x1')],'defaultValue':_0x28e5('0x10')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x28e5('0x11'),_0x28e5('0x12'),_0x28e5('0x13')),'defaultValue':_0x28e5('0x11')},'dialAMDActive':{'type':Sequelize[_0x28e5('0x4')],'defaultValue':0x0,'comment':_0x28e5('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x28e5('0x6')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x28e5('0x15')},'dialAMDGreeting':{'type':Sequelize[_0x28e5('0x6')](0x9)[_0x28e5('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x28e5('0x6')](0x9)[_0x28e5('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x28e5('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x28e5('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x28e5('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0x28e5('0x6')](0x9)[_0x28e5('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x28e5('0x6')](0x9)[_0x28e5('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x28e5('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x28e5('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x28e5('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x28e5('0x6')](0x5)[_0x28e5('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x28e5('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x28e5('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x28e5('0x1c')](_0x28e5('0x1d'),_0x28e5('0x1e')),'defaultValue':_0x28e5('0x1d')},'dialPrefix':{'type':Sequelize[_0x28e5('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x28e5('0x1f')},'dialCutDigit':{'type':Sequelize[_0x28e5('0x6')](0x3)[_0x28e5('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x28e5('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x28e5('0x6')](0x5)[_0x28e5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x28e5('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x28e5('0x20')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x28e5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x28e5('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x28e5('0x6')](0x3)[_0x28e5('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x28e5('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x28e5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x28e5('0x6')](0x3)[_0x28e5('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x28e5('0x6')](0x5)[_0x28e5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x28e5('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x28e5('0x6')](0x3)[_0x28e5('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x28e5('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x28e5('0x6')](0x5)[_0x28e5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x28e5('0x25')}}; \ No newline at end of file +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 diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 135b581..df342e9 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 _0x54ef=['rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','UserProfileResource','stack','name','send','index','Campaign','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','show','params','keys','fields','includeAll','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','include','omit','updatedAt','createdAt','body','getHoppers','nolimit','order','CampaignId','getHopperHistories','findOne','CmHopperHistory','hasOwnProperty','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','spread','dialCheckDuplicateType','insert','into','fromQuery','scheduledAt','ContactId','ListId','select','phone','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','cm_hopper','push','sequelize','all','removeLists','CmHopper','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x54ef,0x112));var _0xf54e=function(_0x55f9d8,_0x52e33d){_0x55f9d8=_0x55f9d8-0x0;var _0x46297f=_0x54ef[_0x55f9d8];return _0x46297f;};'use strict';var pdf=require(_0xf54e('0x0'));var emlformat=require(_0xf54e('0x1'));var rimraf=require(_0xf54e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf54e('0x3'));var rp=require(_0xf54e('0x4'));var moment=require(_0xf54e('0x5'));var BPromise=require(_0xf54e('0x6'));var Mustache=require(_0xf54e('0x7'));var util=require(_0xf54e('0x8'));var path=require(_0xf54e('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf54e('0xa'));var fs=require('fs');var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var as=require(_0xf54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54e('0x14'))(_0xf54e('0x15'));var utils=require(_0xf54e('0x16'));var config=require(_0xf54e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x358c88,_0x4b0ee1){_0x4b0ee1=_0x4b0ee1||0xcc;return function(_0x4bd828){if(_0x4bd828){return _0x358c88[_0xf54e('0x18')](_0x4b0ee1);}return _0x358c88[_0xf54e('0x19')](_0x4b0ee1)[_0xf54e('0x1a')]();};}function respondWithResult(_0x380f26,_0x5644aa){_0x5644aa=_0x5644aa||0xc8;return function(_0x331732){if(_0x331732){return _0x380f26[_0xf54e('0x19')](_0x5644aa)[_0xf54e('0x1b')](_0x331732);}};}function respondWithFilteredResult(_0x15f639,_0x56828e){return function(_0x2366ee){if(_0x2366ee){var _0x389abc=_0x2366ee[_0xf54e('0x1c')],_0x3eb415=_0x56828e[_0xf54e('0x1d')],_0x5c5d00=_0x56828e[_0xf54e('0x1d')]+_0x56828e[_0xf54e('0x1e')],_0x4af633;if(_0x5c5d00>=_0x389abc){_0x5c5d00=_0x389abc;_0x4af633=0xc8;}else{_0x4af633=0xce;}_0x15f639[_0xf54e('0x19')](_0x4af633);return _0x15f639[_0xf54e('0x1f')](_0xf54e('0x20'),_0x3eb415+'-'+_0x5c5d00+'/'+_0x389abc)[_0xf54e('0x1b')](_0x2366ee);}return null;};}function patchUpdates(_0x1dcc04){return function(_0x4689fe){try{jsonpatch[_0xf54e('0x21')](_0x4689fe,_0x1dcc04,!![]);}catch(_0x50fc66){return BPromise['reject'](_0x50fc66);}return _0x4689fe[_0xf54e('0x22')]();};}function saveUpdates(_0x59f338,_0x3e1556){return function(_0x1bfe99){if(_0x1bfe99){return _0x1bfe99[_0xf54e('0x23')](_0x59f338)[_0xf54e('0x24')](function(_0xf64f12){return _0xf64f12;});}return null;};}function removeEntity(_0x3887b0,_0x388aa0){return function(_0x11985e){if(_0x11985e){return _0x11985e[_0xf54e('0x25')]()[_0xf54e('0x24')](function(){var _0x1c58bd=_0x11985e['get']({'plain':!![]});var _0x6f6d29='IvrCampaigns';return db[_0xf54e('0x26')][_0xf54e('0x25')]({'where':{'type':_0x6f6d29,'resourceId':_0x1c58bd['id']}})[_0xf54e('0x24')](function(){return _0x11985e;});})[_0xf54e('0x24')](function(){_0x3887b0[_0xf54e('0x19')](0xcc)[_0xf54e('0x1a')]();});}};}function handleEntityNotFound(_0x1e08d1,_0x43488d){return function(_0x2342a9){if(!_0x2342a9){_0x1e08d1[_0xf54e('0x18')](0x194);}return _0x2342a9;};}function handleError(_0xf6cdd7,_0x39c0ae){_0x39c0ae=_0x39c0ae||0x1f4;return function(_0x2ea001){logger['error'](_0x2ea001[_0xf54e('0x27')]);if(_0x2ea001['name']){delete _0x2ea001[_0xf54e('0x28')];}_0xf6cdd7['status'](_0x39c0ae)[_0xf54e('0x29')](_0x2ea001);};}exports[_0xf54e('0x2a')]=function(_0x21ba00,_0xa13cd0){var _0x25b643={},_0x3993e4={},_0x36f985={'count':0x0,'rows':[]};var _0x54bd8f=_['map'](db[_0xf54e('0x2b')][_0xf54e('0x2c')],function(_0x2ec92e){return{'name':_0x2ec92e[_0xf54e('0x2d')],'type':_0x2ec92e[_0xf54e('0x2e')][_0xf54e('0x2f')]};});_0x3993e4[_0xf54e('0x30')]=_[_0xf54e('0x31')](_0x54bd8f,_0xf54e('0x28'));_0x3993e4[_0xf54e('0x32')]=_['keys'](_0x21ba00['query']);_0x3993e4[_0xf54e('0x33')]=_[_0xf54e('0x34')](_0x3993e4['model'],_0x3993e4[_0xf54e('0x32')]);_0x25b643[_0xf54e('0x35')]=_[_0xf54e('0x34')](_0x3993e4[_0xf54e('0x30')],qs['fields'](_0x21ba00['query']['fields']));_0x25b643[_0xf54e('0x35')]=_0x25b643[_0xf54e('0x35')][_0xf54e('0x36')]?_0x25b643[_0xf54e('0x35')]:_0x3993e4[_0xf54e('0x30')];if(!_0x21ba00[_0xf54e('0x32')]['hasOwnProperty']('nolimit')){_0x25b643['limit']=qs[_0xf54e('0x1e')](_0x21ba00[_0xf54e('0x32')]['limit']);_0x25b643['offset']=qs[_0xf54e('0x1d')](_0x21ba00[_0xf54e('0x32')][_0xf54e('0x1d')]);}_0x25b643['order']=qs[_0xf54e('0x37')](_0x21ba00[_0xf54e('0x32')]['sort']);_0x25b643[_0xf54e('0x38')]=qs[_0xf54e('0x33')](_[_0xf54e('0x39')](_0x21ba00[_0xf54e('0x32')],_0x3993e4[_0xf54e('0x33')]));if(_0x21ba00[_0xf54e('0x32')]['filter']){_0x25b643['where']=_[_0xf54e('0x3a')](_0x25b643[_0xf54e('0x38')],{'$or':_[_0xf54e('0x31')](_0x54bd8f,function(_0x4b1f84){if(_0x4b1f84[_0xf54e('0x2e')]!==_0xf54e('0x3b')){var _0x448054={};_0x448054[_0x4b1f84[_0xf54e('0x28')]]={'$like':'%'+_0x21ba00[_0xf54e('0x32')][_0xf54e('0x3c')]+'%'};return _0x448054;}})});}_0x25b643=_[_0xf54e('0x3a')]({},_0x25b643,_0x21ba00[_0xf54e('0x3d')]);var _0x8b4c={'where':_0x25b643[_0xf54e('0x38')]};return db[_0xf54e('0x2b')][_0xf54e('0x1c')](_0x8b4c)[_0xf54e('0x24')](function(_0x2625fd){_0x36f985[_0xf54e('0x1c')]=_0x2625fd;if(_0x21ba00['query']['includeAll']){_0x25b643['include']=[{'all':!![]}];}return db[_0xf54e('0x2b')][_0xf54e('0x3e')](_0x25b643);})['then'](function(_0x3dae9b){_0x36f985[_0xf54e('0x3f')]=_0x3dae9b;return _0x36f985;})[_0xf54e('0x24')](respondWithFilteredResult(_0xa13cd0,_0x25b643))['catch'](handleError(_0xa13cd0,null));};exports[_0xf54e('0x40')]=function(_0x13d145,_0x1e016e){var _0x794be7={'raw':![],'where':{'id':_0x13d145[_0xf54e('0x41')]['id']}},_0x4b1931={};_0x4b1931[_0xf54e('0x30')]=_[_0xf54e('0x42')](db[_0xf54e('0x2b')]['rawAttributes']);_0x4b1931[_0xf54e('0x32')]=_[_0xf54e('0x42')](_0x13d145[_0xf54e('0x32')]);_0x4b1931[_0xf54e('0x33')]=_[_0xf54e('0x34')](_0x4b1931[_0xf54e('0x30')],_0x4b1931['query']);_0x794be7[_0xf54e('0x35')]=_['intersection'](_0x4b1931[_0xf54e('0x30')],qs['fields'](_0x13d145[_0xf54e('0x32')][_0xf54e('0x43')]));_0x794be7[_0xf54e('0x35')]=_0x794be7['attributes'][_0xf54e('0x36')]?_0x794be7[_0xf54e('0x35')]:_0x4b1931[_0xf54e('0x30')];if(_0x13d145[_0xf54e('0x32')][_0xf54e('0x44')]){_0x794be7['include']=[{'all':!![]}];}_0x794be7=_[_0xf54e('0x3a')]({},_0x794be7,_0x13d145[_0xf54e('0x3d')]);return db[_0xf54e('0x2b')][_0xf54e('0x45')](_0x794be7)['then'](handleEntityNotFound(_0x1e016e,null))[_0xf54e('0x24')](respondWithResult(_0x1e016e,null))[_0xf54e('0x46')](handleError(_0x1e016e,null));};exports['create']=function(_0x22c842,_0xd4d956){return db[_0xf54e('0x2b')][_0xf54e('0x47')](_0x22c842['body'],{})[_0xf54e('0x24')](function(_0x2b645e){var _0x2527f6=_0x22c842[_0xf54e('0x48')][_0xf54e('0x49')]({'plain':!![]});if(!_0x2527f6)throw new Error(_0xf54e('0x4a'));if(_0x2527f6[_0xf54e('0x4b')]===_0xf54e('0x48')){var _0x15bfef=_0x2b645e[_0xf54e('0x49')]({'plain':!![]});var _0xaf9bf0=_0xf54e('0x4c');return db[_0xf54e('0x4d')][_0xf54e('0x45')]({'where':{'name':_0xaf9bf0,'userProfileId':_0x2527f6[_0xf54e('0x4e')]},'raw':!![]})[_0xf54e('0x24')](function(_0x40d8ab){if(_0x40d8ab&&_0x40d8ab[_0xf54e('0x4f')]===0x0){return db[_0xf54e('0x26')][_0xf54e('0x47')]({'name':_0x15bfef['name'],'resourceId':_0x15bfef['id'],'type':_0x40d8ab['name'],'sectionId':_0x40d8ab['id']},{})[_0xf54e('0x24')](function(){return _0x2b645e;});}else{return _0x2b645e;}})[_0xf54e('0x46')](function(_0x45861b){logger[_0xf54e('0x50')](_0xf54e('0x51'),_0x45861b);throw _0x45861b;});}return _0x2b645e;})[_0xf54e('0x24')](respondWithResult(_0xd4d956,0xc9))[_0xf54e('0x46')](handleError(_0xd4d956,null));};exports[_0xf54e('0x52')]=function(_0x89b811,_0xdf63c4){var _0x1df308={'where':{'id':_0x89b811[_0xf54e('0x41')]['id']}},_0x59c313={};_0x59c313[_0xf54e('0x30')]=_[_0xf54e('0x42')](db[_0xf54e('0x2b')][_0xf54e('0x2c')]);_0x1df308[_0xf54e('0x35')]=_[_0xf54e('0x34')](_0x59c313['model'],qs[_0xf54e('0x43')](_0x89b811[_0xf54e('0x32')][_0xf54e('0x43')]));_0x1df308['attributes']=_0x1df308[_0xf54e('0x35')]['length']?_0x1df308[_0xf54e('0x35')]:_0x59c313[_0xf54e('0x30')];if(_0x89b811[_0xf54e('0x32')]['includeAll']){_0x1df308[_0xf54e('0x53')]=[{'all':!![]}];}_0x1df308=_[_0xf54e('0x3a')]({},_0x1df308,_0x89b811[_0xf54e('0x3d')]);return db[_0xf54e('0x2b')][_0xf54e('0x45')](_0x1df308)[_0xf54e('0x24')](handleEntityNotFound(_0xdf63c4,null))[_0xf54e('0x24')](function(_0x55d57f){if(_0x55d57f){var _0x55de5c=_0x55d57f[_0xf54e('0x49')]({'plain':!![]});_0x55de5c=qs[_0xf54e('0x54')](_0x55de5c,['id','createdAt',_0xf54e('0x55')]);_0x89b811['body']=_[_0xf54e('0x54')](_0x89b811['body'],['id',_0xf54e('0x56'),_0xf54e('0x55')]);return db[_0xf54e('0x2b')][_0xf54e('0x47')](_[_0xf54e('0x3a')](_0x55de5c,_0x89b811[_0xf54e('0x57')]),{'include':_0x89b811['query']['includeAll']?[{'all':!![]}]:undefined})[_0xf54e('0x24')](function(_0x2b273d){var _0x493011=_0x89b811['user'][_0xf54e('0x49')]({'plain':!![]});if(!_0x493011)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x493011[_0xf54e('0x4b')]===_0xf54e('0x48')){var _0x47596c=_0x2b273d[_0xf54e('0x49')]({'plain':!![]});var _0x1d7c52=_0xf54e('0x4c');return db[_0xf54e('0x4d')][_0xf54e('0x45')]({'where':{'name':_0x1d7c52,'userProfileId':_0x493011[_0xf54e('0x4e')]},'raw':!![]})[_0xf54e('0x24')](function(_0x1f9dad){if(_0x1f9dad&&_0x1f9dad[_0xf54e('0x4f')]===0x0){return db[_0xf54e('0x26')][_0xf54e('0x47')]({'name':_0x47596c['name'],'resourceId':_0x47596c['id'],'type':_0x1f9dad[_0xf54e('0x28')],'sectionId':_0x1f9dad['id']},{})[_0xf54e('0x24')](function(){return _0x2b273d;});}else{return _0x2b273d;}})[_0xf54e('0x46')](function(_0x11908b){logger[_0xf54e('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x11908b);throw _0x11908b;});}return _0x2b273d;});}})[_0xf54e('0x24')](respondWithResult(_0xdf63c4,0xc9))[_0xf54e('0x46')](handleError(_0xdf63c4,null));};exports['update']=function(_0x51ec35,_0x2818cf){if(_0x51ec35['body']['id']){delete _0x51ec35[_0xf54e('0x57')]['id'];}return db[_0xf54e('0x2b')][_0xf54e('0x45')]({'where':{'id':_0x51ec35[_0xf54e('0x41')]['id']}})['then'](handleEntityNotFound(_0x2818cf,null))[_0xf54e('0x24')](saveUpdates(_0x51ec35['body'],null))[_0xf54e('0x24')](respondWithResult(_0x2818cf,null))[_0xf54e('0x46')](handleError(_0x2818cf,null));};exports[_0xf54e('0x25')]=function(_0x5de2f5,_0x2d04db){return db['Campaign'][_0xf54e('0x45')]({'where':{'id':_0x5de2f5[_0xf54e('0x41')]['id']}})['then'](handleEntityNotFound(_0x2d04db,null))[_0xf54e('0x24')](removeEntity(_0x2d04db,null))['catch'](handleError(_0x2d04db,null));};exports[_0xf54e('0x58')]=function(_0x2df028,_0x33acd3,_0x38405c){var _0x21159f={'raw':!![],'where':{}};var _0x54ee29={};var _0x3a9dd7={'count':0x0,'rows':[]};return db[_0xf54e('0x2b')]['findOne']({'where':{'id':_0x2df028[_0xf54e('0x41')]['id']}})[_0xf54e('0x24')](handleEntityNotFound(_0x33acd3,null))['then'](function(_0x8e7a38){if(_0x8e7a38){_0x54ee29[_0xf54e('0x30')]=_[_0xf54e('0x42')](db['CmHopper'][_0xf54e('0x2c')]);_0x54ee29['query']=_[_0xf54e('0x42')](_0x2df028[_0xf54e('0x32')]);_0x54ee29['filters']=_[_0xf54e('0x34')](_0x54ee29[_0xf54e('0x30')],_0x54ee29[_0xf54e('0x32')]);_0x21159f[_0xf54e('0x35')]=_[_0xf54e('0x34')](_0x54ee29[_0xf54e('0x30')],qs[_0xf54e('0x43')](_0x2df028[_0xf54e('0x32')][_0xf54e('0x43')]));_0x21159f[_0xf54e('0x35')]=_0x21159f[_0xf54e('0x35')]['length']?_0x21159f[_0xf54e('0x35')]:_0x54ee29[_0xf54e('0x30')];if(!_0x2df028[_0xf54e('0x32')]['hasOwnProperty'](_0xf54e('0x59'))){_0x21159f[_0xf54e('0x1e')]=qs[_0xf54e('0x1e')](_0x2df028[_0xf54e('0x32')][_0xf54e('0x1e')]);_0x21159f[_0xf54e('0x1d')]=qs[_0xf54e('0x1d')](_0x2df028['query'][_0xf54e('0x1d')]);}_0x21159f[_0xf54e('0x5a')]=qs[_0xf54e('0x37')](_0x2df028['query'][_0xf54e('0x37')]);_0x21159f[_0xf54e('0x38')]=qs[_0xf54e('0x33')](_[_0xf54e('0x39')](_0x2df028['query'],_0x54ee29['filters']));_0x21159f[_0xf54e('0x38')][_0xf54e('0x5b')]=_0x8e7a38['id'];if(_0x2df028[_0xf54e('0x32')][_0xf54e('0x3c')]){_0x21159f[_0xf54e('0x38')]=_[_0xf54e('0x3a')](_0x21159f[_0xf54e('0x38')],{'$or':_[_0xf54e('0x31')](_0x21159f[_0xf54e('0x35')],function(_0x205b47){var _0x4e6f8f={};_0x4e6f8f[_0x205b47]={'$like':'%'+_0x2df028[_0xf54e('0x32')][_0xf54e('0x3c')]+'%'};return _0x4e6f8f;})});}_0x21159f=_[_0xf54e('0x3a')]({},_0x21159f,_0x2df028[_0xf54e('0x3d')]);return db['CmHopper'][_0xf54e('0x1c')]({'where':_0x21159f[_0xf54e('0x38')]})[_0xf54e('0x24')](function(_0x213206){_0x3a9dd7['count']=_0x213206;if(_0x2df028[_0xf54e('0x32')][_0xf54e('0x44')]){_0x21159f[_0xf54e('0x53')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x21159f);})[_0xf54e('0x24')](function(_0x1a5a77){_0x3a9dd7[_0xf54e('0x3f')]=_0x1a5a77;return _0x3a9dd7;});}})[_0xf54e('0x24')](respondWithFilteredResult(_0x33acd3,_0x21159f))[_0xf54e('0x46')](handleError(_0x33acd3,null));};exports[_0xf54e('0x5c')]=function(_0x2b42f5,_0x824202,_0x8093bc){var _0x4adf60={'raw':!![],'where':{}};var _0xa5de47={};var _0x3edfa0={'count':0x0,'rows':[]};return db[_0xf54e('0x2b')][_0xf54e('0x5d')]({'where':{'id':_0x2b42f5[_0xf54e('0x41')]['id']}})[_0xf54e('0x24')](handleEntityNotFound(_0x824202,null))[_0xf54e('0x24')](function(_0x9a8f4f){if(_0x9a8f4f){_0xa5de47[_0xf54e('0x30')]=_[_0xf54e('0x42')](db[_0xf54e('0x5e')][_0xf54e('0x2c')]);_0xa5de47['query']=_[_0xf54e('0x42')](_0x2b42f5[_0xf54e('0x32')]);_0xa5de47['filters']=_['intersection'](_0xa5de47[_0xf54e('0x30')],_0xa5de47[_0xf54e('0x32')]);_0x4adf60[_0xf54e('0x35')]=_[_0xf54e('0x34')](_0xa5de47[_0xf54e('0x30')],qs[_0xf54e('0x43')](_0x2b42f5[_0xf54e('0x32')][_0xf54e('0x43')]));_0x4adf60[_0xf54e('0x35')]=_0x4adf60['attributes'][_0xf54e('0x36')]?_0x4adf60[_0xf54e('0x35')]:_0xa5de47[_0xf54e('0x30')];if(!_0x2b42f5['query'][_0xf54e('0x5f')]('nolimit')){_0x4adf60[_0xf54e('0x1e')]=qs['limit'](_0x2b42f5[_0xf54e('0x32')][_0xf54e('0x1e')]);_0x4adf60['offset']=qs['offset'](_0x2b42f5[_0xf54e('0x32')][_0xf54e('0x1d')]);}_0x4adf60[_0xf54e('0x5a')]=qs[_0xf54e('0x37')](_0x2b42f5[_0xf54e('0x32')]['sort']);_0x4adf60['where']=qs[_0xf54e('0x33')](_[_0xf54e('0x39')](_0x2b42f5[_0xf54e('0x32')],_0xa5de47[_0xf54e('0x33')]));_0x4adf60[_0xf54e('0x38')][_0xf54e('0x5b')]=_0x9a8f4f['id'];if(_0x2b42f5[_0xf54e('0x32')][_0xf54e('0x3c')]){_0x4adf60[_0xf54e('0x38')]=_[_0xf54e('0x3a')](_0x4adf60['where'],{'$or':_[_0xf54e('0x31')](_0x4adf60[_0xf54e('0x35')],function(_0x4d4667){var _0x4fd274={};_0x4fd274[_0x4d4667]={'$like':'%'+_0x2b42f5[_0xf54e('0x32')][_0xf54e('0x3c')]+'%'};return _0x4fd274;})});}_0x4adf60=_[_0xf54e('0x3a')]({},_0x4adf60,_0x2b42f5[_0xf54e('0x3d')]);return db[_0xf54e('0x5e')]['count']({'where':_0x4adf60[_0xf54e('0x38')]})[_0xf54e('0x24')](function(_0xd631af){_0x3edfa0[_0xf54e('0x1c')]=_0xd631af;if(_0x2b42f5['query'][_0xf54e('0x44')]){_0x4adf60[_0xf54e('0x53')]=[{'all':!![]}];}return db[_0xf54e('0x5e')][_0xf54e('0x3e')](_0x4adf60);})['then'](function(_0x289946){_0x3edfa0[_0xf54e('0x3f')]=_0x289946;return _0x3edfa0;});}})[_0xf54e('0x24')](respondWithFilteredResult(_0x824202,_0x4adf60))[_0xf54e('0x46')](handleError(_0x824202,null));};exports[_0xf54e('0x60')]=function(_0x4daac7,_0x2cb0cd,_0x536202){var _0x54cb92={'raw':!![],'where':{}};var _0x963253={};var _0x2d3d16={'count':0x0,'rows':[]};return db[_0xf54e('0x2b')][_0xf54e('0x5d')]({'where':{'id':_0x4daac7[_0xf54e('0x41')]['id']}})[_0xf54e('0x24')](handleEntityNotFound(_0x2cb0cd,null))[_0xf54e('0x24')](function(_0x7ad573){if(_0x7ad573){_0x963253[_0xf54e('0x30')]=_['keys'](db[_0xf54e('0x61')][_0xf54e('0x2c')]);_0x963253[_0xf54e('0x32')]=_[_0xf54e('0x42')](_0x4daac7[_0xf54e('0x32')]);_0x963253[_0xf54e('0x33')]=_['intersection'](_0x963253[_0xf54e('0x30')],_0x963253[_0xf54e('0x32')]);_0x54cb92[_0xf54e('0x35')]=_[_0xf54e('0x34')](_0x963253[_0xf54e('0x30')],qs[_0xf54e('0x43')](_0x4daac7['query'][_0xf54e('0x43')]));_0x54cb92[_0xf54e('0x35')]=_0x54cb92[_0xf54e('0x35')][_0xf54e('0x36')]?_0x54cb92['attributes']:_0x963253['model'];if(!_0x4daac7[_0xf54e('0x32')][_0xf54e('0x5f')](_0xf54e('0x59'))){_0x54cb92[_0xf54e('0x1e')]=qs[_0xf54e('0x1e')](_0x4daac7[_0xf54e('0x32')]['limit']);_0x54cb92[_0xf54e('0x1d')]=qs[_0xf54e('0x1d')](_0x4daac7[_0xf54e('0x32')][_0xf54e('0x1d')]);}_0x54cb92[_0xf54e('0x5a')]=qs[_0xf54e('0x37')](_0x4daac7['query'][_0xf54e('0x37')]);_0x54cb92['where']=qs[_0xf54e('0x33')](_['pick'](_0x4daac7[_0xf54e('0x32')],_0x963253[_0xf54e('0x33')]));_0x54cb92[_0xf54e('0x38')][_0xf54e('0x5b')]=_0x7ad573['id'];if(_0x4daac7[_0xf54e('0x32')]['filter']){_0x54cb92[_0xf54e('0x38')]=_[_0xf54e('0x3a')](_0x54cb92['where'],{'$or':_[_0xf54e('0x31')](_0x54cb92[_0xf54e('0x35')],function(_0x42dc85){var _0x3e646d={};_0x3e646d[_0x42dc85]={'$like':'%'+_0x4daac7['query'][_0xf54e('0x3c')]+'%'};return _0x3e646d;})});}_0x54cb92=_[_0xf54e('0x3a')]({},_0x54cb92,_0x4daac7['options']);return db[_0xf54e('0x61')]['count']({'where':_0x54cb92['where']})[_0xf54e('0x24')](function(_0x51910e){_0x2d3d16[_0xf54e('0x1c')]=_0x51910e;if(_0x4daac7[_0xf54e('0x32')][_0xf54e('0x44')]){_0x54cb92[_0xf54e('0x53')]=[{'all':!![]}];}return db[_0xf54e('0x61')]['findAll'](_0x54cb92);})[_0xf54e('0x24')](function(_0x351239){_0x2d3d16[_0xf54e('0x3f')]=_0x351239;return _0x2d3d16;});}})[_0xf54e('0x24')](respondWithFilteredResult(_0x2cb0cd,_0x54cb92))['catch'](handleError(_0x2cb0cd,null));};exports[_0xf54e('0x62')]=function(_0x52d9fa,_0x1da57f,_0x1e6414){var _0x4cfa3f={'raw':!![],'where':{}};var _0x236f93={};var _0xe0a229={'count':0x0,'rows':[]};return db[_0xf54e('0x2b')][_0xf54e('0x5d')]({'where':{'id':_0x52d9fa['params']['id']}})[_0xf54e('0x24')](handleEntityNotFound(_0x1da57f,null))[_0xf54e('0x24')](function(_0x72535e){if(_0x72535e){_0x236f93['model']=_['keys'](db[_0xf54e('0x63')]['rawAttributes']);_0x236f93['query']=_['keys'](_0x52d9fa[_0xf54e('0x32')]);_0x236f93[_0xf54e('0x33')]=_[_0xf54e('0x34')](_0x236f93[_0xf54e('0x30')],_0x236f93[_0xf54e('0x32')]);_0x4cfa3f[_0xf54e('0x35')]=_[_0xf54e('0x34')](_0x236f93[_0xf54e('0x30')],qs[_0xf54e('0x43')](_0x52d9fa['query'][_0xf54e('0x43')]));_0x4cfa3f['attributes']=_0x4cfa3f[_0xf54e('0x35')][_0xf54e('0x36')]?_0x4cfa3f['attributes']:_0x236f93[_0xf54e('0x30')];if(!_0x52d9fa['query'][_0xf54e('0x5f')](_0xf54e('0x59'))){_0x4cfa3f[_0xf54e('0x1e')]=qs[_0xf54e('0x1e')](_0x52d9fa[_0xf54e('0x32')][_0xf54e('0x1e')]);_0x4cfa3f['offset']=qs['offset'](_0x52d9fa['query'][_0xf54e('0x1d')]);}_0x4cfa3f['order']=qs[_0xf54e('0x37')](_0x52d9fa[_0xf54e('0x32')][_0xf54e('0x37')]);_0x4cfa3f[_0xf54e('0x38')]=qs[_0xf54e('0x33')](_['pick'](_0x52d9fa[_0xf54e('0x32')],_0x236f93[_0xf54e('0x33')]));_0x4cfa3f[_0xf54e('0x38')][_0xf54e('0x5b')]=_0x72535e['id'];if(_0x52d9fa[_0xf54e('0x32')][_0xf54e('0x3c')]){_0x4cfa3f['where']=_[_0xf54e('0x3a')](_0x4cfa3f[_0xf54e('0x38')],{'$or':_[_0xf54e('0x31')](_0x4cfa3f[_0xf54e('0x35')],function(_0x1a80ff){var _0x516eeb={};_0x516eeb[_0x1a80ff]={'$like':'%'+_0x52d9fa[_0xf54e('0x32')][_0xf54e('0x3c')]+'%'};return _0x516eeb;})});}_0x4cfa3f=_[_0xf54e('0x3a')]({},_0x4cfa3f,_0x52d9fa[_0xf54e('0x3d')]);return db[_0xf54e('0x63')][_0xf54e('0x1c')]({'where':_0x4cfa3f[_0xf54e('0x38')]})[_0xf54e('0x24')](function(_0x2e42f7){_0xe0a229['count']=_0x2e42f7;if(_0x52d9fa[_0xf54e('0x32')][_0xf54e('0x44')]){_0x4cfa3f['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0xf54e('0x3e')](_0x4cfa3f);})['then'](function(_0x40bf28){_0xe0a229[_0xf54e('0x3f')]=_0x40bf28;return _0xe0a229;});}})[_0xf54e('0x24')](respondWithFilteredResult(_0x1da57f,_0x4cfa3f))[_0xf54e('0x46')](handleError(_0x1da57f,null));};exports['getLists']=function(_0x406140,_0x3c4a66,_0x59fb9a){var _0x90ad88={};var _0x3797bf={};var _0x1ac57a;var _0x458450;return db[_0xf54e('0x2b')][_0xf54e('0x5d')]({'where':{'id':_0x406140[_0xf54e('0x41')]['id']}})[_0xf54e('0x24')](handleEntityNotFound(_0x3c4a66,null))[_0xf54e('0x24')](function(_0x3634bc){if(_0x3634bc){_0x1ac57a=_0x3634bc;_0x3797bf[_0xf54e('0x30')]=_['keys'](db['CmList'][_0xf54e('0x2c')]);_0x3797bf[_0xf54e('0x32')]=_[_0xf54e('0x42')](_0x406140[_0xf54e('0x32')]);_0x3797bf[_0xf54e('0x33')]=_['intersection'](_0x3797bf[_0xf54e('0x30')],_0x3797bf[_0xf54e('0x32')]);_0x90ad88[_0xf54e('0x35')]=_[_0xf54e('0x34')](_0x3797bf['model'],qs[_0xf54e('0x43')](_0x406140[_0xf54e('0x32')][_0xf54e('0x43')]));_0x90ad88[_0xf54e('0x35')]=_0x90ad88[_0xf54e('0x35')][_0xf54e('0x36')]?_0x90ad88[_0xf54e('0x35')]:_0x3797bf[_0xf54e('0x30')];_0x90ad88[_0xf54e('0x5a')]=qs[_0xf54e('0x37')](_0x406140[_0xf54e('0x32')][_0xf54e('0x37')]);_0x90ad88[_0xf54e('0x38')]=qs[_0xf54e('0x33')](_['pick'](_0x406140[_0xf54e('0x32')],_0x3797bf['filters']));if(_0x406140['query'][_0xf54e('0x3c')]){_0x90ad88[_0xf54e('0x38')]=_[_0xf54e('0x3a')](_0x90ad88[_0xf54e('0x38')],{'$or':_[_0xf54e('0x31')](_0x90ad88[_0xf54e('0x35')],function(_0x396f98){var _0x113020={};_0x113020[_0x396f98]={'$like':'%'+_0x406140[_0xf54e('0x32')][_0xf54e('0x3c')]+'%'};return _0x113020;})});}_0x90ad88=_[_0xf54e('0x3a')]({},_0x90ad88,_0x406140[_0xf54e('0x3d')]);return _0x1ac57a[_0xf54e('0x64')](_0x90ad88);}})['then'](function(_0x3ff4a5){if(_0x3ff4a5){_0x458450=_0x3ff4a5[_0xf54e('0x36')];if(!_0x406140[_0xf54e('0x32')][_0xf54e('0x5f')](_0xf54e('0x59'))){_0x90ad88['limit']=qs['limit'](_0x406140[_0xf54e('0x32')][_0xf54e('0x1e')]);_0x90ad88['offset']=qs['offset'](_0x406140[_0xf54e('0x32')]['offset']);}return _0x1ac57a[_0xf54e('0x64')](_0x90ad88);}})[_0xf54e('0x24')](function(_0x6e09bf){if(_0x6e09bf){return _0x6e09bf?{'count':_0x458450,'rows':_0x6e09bf}:null;}})[_0xf54e('0x24')](respondWithResult(_0x3c4a66,null))[_0xf54e('0x46')](handleError(_0x3c4a66,null));};exports[_0xf54e('0x65')]=function(_0x50bff9,_0x39fc7d,_0x2e0cf9){var _0x5cf1e4,_0x3fc819;return db[_0xf54e('0x2b')]['find']({'where':{'id':_0x50bff9[_0xf54e('0x41')]['id']}})[_0xf54e('0x24')](handleEntityNotFound(_0x39fc7d,null))[_0xf54e('0x24')](function(_0x54efa9){if(_0x54efa9){_0x3fc819=_0x54efa9;return _0x54efa9['addLists'](_0x50bff9[_0xf54e('0x57')][_0xf54e('0x66')],_['omit'](_0x50bff9['body'],['ids','id'])||{});}return null;})[_0xf54e('0x67')](function(_0x32b55f){var _0x11fb0c;_0x5cf1e4=_0x32b55f||[];var _0x5072aa=[];if(_0x32b55f){for(var _0x187b1c=0x0;_0x187b1c<_0x32b55f[_0xf54e('0x36')];_0x187b1c+=0x1){var _0x28d019=_0x32b55f[_0x187b1c][_0xf54e('0x49')]({'plain':!![]});_0x3fc819[_0xf54e('0x68')]=_0x50bff9['body']['dialCheckDuplicateType']?_0x50bff9['body']['dialCheckDuplicateType']:_0x3fc819['dialCheckDuplicateType'];switch(_0x3fc819[_0xf54e('0x68')]){case'always':_0x11fb0c=squel[_0xf54e('0x69')]()[_0xf54e('0x6a')]('cm_hopper')[_0xf54e('0x6b')](['phone',_0xf54e('0x6c'),_0xf54e('0x6d'),_0xf54e('0x6e'),_0xf54e('0x5b'),_0xf54e('0x56'),_0xf54e('0x55')],squel[_0xf54e('0x6f')]()['field'](_0xf54e('0x70'),_0xf54e('0x70'))[_0xf54e('0x71')](_0xf54e('0x72'),_0xf54e('0x6c'))['field']('id',_0xf54e('0x6d'))[_0xf54e('0x71')](_0x28d019[_0xf54e('0x73')][_0xf54e('0x74')](),_0xf54e('0x6e'))[_0xf54e('0x71')](_0x50bff9['params']['id']['toString'](),'CampaignId')[_0xf54e('0x71')](_0xf54e('0x72'),_0xf54e('0x56'))[_0xf54e('0x71')](_0xf54e('0x72'),'updatedAt')[_0xf54e('0x75')](_0xf54e('0x76'))['where'](_0xf54e('0x77'))[_0xf54e('0x38')](_0xf54e('0x78'),_0x28d019['CmListId'][_0xf54e('0x74')]())[_0xf54e('0x38')](_0xf54e('0x79'))[_0xf54e('0x38')](_0xf54e('0x7a'),squel[_0xf54e('0x6f')]()[_0xf54e('0x71')](_0xf54e('0x7b'))['from'](_0xf54e('0x7c'))['where'](_0xf54e('0x7d'),_0x50bff9[_0xf54e('0x41')]['id'][_0xf54e('0x74')]()))[_0xf54e('0x38')](_0xf54e('0x7a'),squel[_0xf54e('0x6f')]()[_0xf54e('0x71')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0xf54e('0x38')]('CampaignId\x20=\x20?',_0x50bff9[_0xf54e('0x41')]['id']['toString']())))[_0xf54e('0x74')]();break;case _0xf54e('0x7e'):_0x11fb0c=squel['insert']()[_0xf54e('0x6a')](_0xf54e('0x7f'))[_0xf54e('0x6b')]([_0xf54e('0x70'),_0xf54e('0x6c'),_0xf54e('0x6d'),_0xf54e('0x6e'),_0xf54e('0x5b'),_0xf54e('0x56'),_0xf54e('0x55')],squel[_0xf54e('0x6f')]()['field'](_0xf54e('0x70'),_0xf54e('0x70'))[_0xf54e('0x71')]('NOW()',_0xf54e('0x6c'))['field']('id',_0xf54e('0x6d'))[_0xf54e('0x71')](_0x28d019[_0xf54e('0x73')][_0xf54e('0x74')](),_0xf54e('0x6e'))[_0xf54e('0x71')](_0x50bff9[_0xf54e('0x41')]['id'][_0xf54e('0x74')](),_0xf54e('0x5b'))[_0xf54e('0x71')](_0xf54e('0x72'),'createdAt')['field']('NOW()',_0xf54e('0x55'))[_0xf54e('0x75')](_0xf54e('0x76'))['where'](_0xf54e('0x77'))[_0xf54e('0x38')]('ListId\x20=\x20?',_0x28d019[_0xf54e('0x73')][_0xf54e('0x74')]())[_0xf54e('0x38')](_0xf54e('0x79'))[_0xf54e('0x38')](_0xf54e('0x7a'),squel[_0xf54e('0x6f')]()['field']('COALESCE(phone,\x27\x27)')[_0xf54e('0x75')](_0xf54e('0x7f'))[_0xf54e('0x38')](_0xf54e('0x7d'),_0x50bff9['params']['id'][_0xf54e('0x74')]())))[_0xf54e('0x74')]();break;default:_0x11fb0c=squel['insert']()[_0xf54e('0x6a')]('cm_hopper')[_0xf54e('0x6b')]([_0xf54e('0x70'),_0xf54e('0x6c'),_0xf54e('0x6d'),'ListId',_0xf54e('0x5b'),'createdAt',_0xf54e('0x55')],squel[_0xf54e('0x6f')]()[_0xf54e('0x71')](_0xf54e('0x70'),'phone')['field'](_0xf54e('0x72'),_0xf54e('0x6c'))[_0xf54e('0x71')]('id','ContactId')[_0xf54e('0x71')](_0x28d019[_0xf54e('0x73')]['toString'](),_0xf54e('0x6e'))[_0xf54e('0x71')](_0x50bff9[_0xf54e('0x41')]['id'][_0xf54e('0x74')](),_0xf54e('0x5b'))[_0xf54e('0x71')]('NOW()',_0xf54e('0x56'))[_0xf54e('0x71')](_0xf54e('0x72'),_0xf54e('0x55'))[_0xf54e('0x75')](_0xf54e('0x76'))[_0xf54e('0x38')](_0xf54e('0x77'))[_0xf54e('0x38')](_0xf54e('0x78'),_0x28d019[_0xf54e('0x73')][_0xf54e('0x74')]())[_0xf54e('0x38')](_0xf54e('0x79')))[_0xf54e('0x74')]();}_0x5072aa[_0xf54e('0x80')](db[_0xf54e('0x81')]['query'](_0x11fb0c));}return BPromise[_0xf54e('0x82')](_0x5072aa);}})[_0xf54e('0x24')](function(){return _0x5cf1e4;})[_0xf54e('0x24')](respondWithResult(_0x39fc7d,null))['catch'](handleError(_0x39fc7d,null));};exports[_0xf54e('0x83')]=function(_0x3b3d45,_0x40aae0,_0x2f90de){return db[_0xf54e('0x2b')]['find']({'where':{'id':_0x3b3d45[_0xf54e('0x41')]['id']}})['then'](handleEntityNotFound(_0x40aae0,null))[_0xf54e('0x24')](function(_0xa70512){if(_0xa70512){return _0xa70512['removeLists'](_0x3b3d45[_0xf54e('0x32')][_0xf54e('0x66')]);}})[_0xf54e('0x24')](function(_0x4026ea){if(_0x4026ea){return db[_0xf54e('0x84')][_0xf54e('0x25')]({'where':{'ListId':_0x3b3d45[_0xf54e('0x32')][_0xf54e('0x66')],'CampaignId':_0x3b3d45[_0xf54e('0x41')]['id']}})['then'](function(){return _0x4026ea;});}})[_0xf54e('0x24')](respondWithStatusCode(_0x40aae0,null))['catch'](handleError(_0x40aae0,null));};exports[_0xf54e('0x85')]=function(_0x380881,_0x54869f,_0x15184a){var _0x54c75b={'raw':!![],'where':{}};var _0x3da876={};var _0x826b2f={'count':0x0,'rows':[]};return db['Campaign'][_0xf54e('0x5d')]({'where':{'id':_0x380881[_0xf54e('0x41')]['id']}})['then'](handleEntityNotFound(_0x54869f,null))['then'](function(_0x526f27){if(_0x526f27){_0x3da876[_0xf54e('0x30')]=_[_0xf54e('0x42')](db[_0xf54e('0x86')][_0xf54e('0x2c')]);_0x3da876[_0xf54e('0x32')]=_[_0xf54e('0x42')](_0x380881[_0xf54e('0x32')]);_0x3da876[_0xf54e('0x33')]=_['intersection'](_0x3da876['model'],_0x3da876[_0xf54e('0x32')]);_0x54c75b[_0xf54e('0x35')]=_[_0xf54e('0x34')](_0x3da876[_0xf54e('0x30')],qs[_0xf54e('0x43')](_0x380881['query'][_0xf54e('0x43')]));_0x54c75b['attributes']=_0x54c75b['attributes'][_0xf54e('0x36')]?_0x54c75b[_0xf54e('0x35')]:_0x3da876[_0xf54e('0x30')];if(!_0x380881[_0xf54e('0x32')][_0xf54e('0x5f')](_0xf54e('0x59'))){_0x54c75b[_0xf54e('0x1e')]=qs['limit'](_0x380881[_0xf54e('0x32')][_0xf54e('0x1e')]);_0x54c75b[_0xf54e('0x1d')]=qs[_0xf54e('0x1d')](_0x380881[_0xf54e('0x32')]['offset']);}_0x54c75b[_0xf54e('0x5a')]=qs[_0xf54e('0x37')](_0x380881[_0xf54e('0x32')][_0xf54e('0x37')]);_0x54c75b[_0xf54e('0x38')]=qs['filters'](_['pick'](_0x380881[_0xf54e('0x32')],_0x3da876[_0xf54e('0x33')]));_0x54c75b[_0xf54e('0x38')]['CampaignId']=_0x526f27['id'];if(_0x380881[_0xf54e('0x32')][_0xf54e('0x3c')]){_0x54c75b[_0xf54e('0x38')]=_[_0xf54e('0x3a')](_0x54c75b['where'],{'$or':_[_0xf54e('0x31')](_0x54c75b[_0xf54e('0x35')],function(_0x3219be){var _0x4b3de5={};_0x4b3de5[_0x3219be]={'$like':'%'+_0x380881[_0xf54e('0x32')][_0xf54e('0x3c')]+'%'};return _0x4b3de5;})});}_0x54c75b=_[_0xf54e('0x3a')]({},_0x54c75b,_0x380881[_0xf54e('0x3d')]);return db[_0xf54e('0x86')][_0xf54e('0x1c')]({'where':_0x54c75b[_0xf54e('0x38')]})[_0xf54e('0x24')](function(_0x51b684){_0x826b2f[_0xf54e('0x1c')]=_0x51b684;if(_0x380881[_0xf54e('0x32')][_0xf54e('0x44')]){_0x54c75b[_0xf54e('0x53')]=[{'all':!![]}];}return db['CmList']['findAll'](_0x54c75b);})['then'](function(_0x4b96cb){_0x826b2f[_0xf54e('0x3f')]=_0x4b96cb;return _0x826b2f;});}})[_0xf54e('0x24')](respondWithFilteredResult(_0x54869f,_0x54c75b))[_0xf54e('0x46')](handleError(_0x54869f,null));};exports['addBlackLists']=function(_0x5a84b8,_0xd82fad,_0x5debcf){var _0x21319b,_0x59f6fc;return db[_0xf54e('0x2b')][_0xf54e('0x45')]({'where':{'id':_0x5a84b8[_0xf54e('0x41')]['id']}})['then'](handleEntityNotFound(_0xd82fad,null))[_0xf54e('0x24')](function(_0x260b7a){if(_0x260b7a){_0x59f6fc=_0x260b7a;return _0x260b7a[_0xf54e('0x87')](_0x5a84b8[_0xf54e('0x57')]['ids'],_[_0xf54e('0x54')](_0x5a84b8[_0xf54e('0x57')],[_0xf54e('0x66'),'id'])||{});}return null;})[_0xf54e('0x67')](function(_0x20947f){var _0x4713cf;_0x21319b=_0x20947f||[];var _0x57f6af=[];if(_0x20947f){for(var _0x31e4c1=0x0;_0x31e4c1<_0x20947f['length'];_0x31e4c1+=0x1){var _0x4d406a=_0x20947f[_0x31e4c1][_0xf54e('0x49')]({'plain':!![]});_0x4713cf=squel['insert']()[_0xf54e('0x6a')](_0xf54e('0x88'))['fromQuery'](['phone',_0xf54e('0x6d'),'ListId',_0xf54e('0x5b'),_0xf54e('0x56'),'updatedAt'],squel[_0xf54e('0x6f')]()['field'](_0xf54e('0x70'),_0xf54e('0x70'))['field']('id',_0xf54e('0x6d'))[_0xf54e('0x71')](_0x4d406a[_0xf54e('0x73')][_0xf54e('0x74')](),_0xf54e('0x6e'))[_0xf54e('0x71')](_0x5a84b8[_0xf54e('0x41')]['id'][_0xf54e('0x74')](),_0xf54e('0x5b'))['field']('NOW()',_0xf54e('0x56'))[_0xf54e('0x71')](_0xf54e('0x72'),_0xf54e('0x55'))['from'](_0xf54e('0x76'))[_0xf54e('0x38')]('deletedAt\x20IS\x20NULL')[_0xf54e('0x38')](_0xf54e('0x78'),_0x4d406a[_0xf54e('0x73')][_0xf54e('0x74')]())[_0xf54e('0x38')](_0xf54e('0x79')))[_0xf54e('0x74')]();_0x57f6af[_0xf54e('0x80')](db[_0xf54e('0x81')][_0xf54e('0x32')](_0x4713cf));}return BPromise[_0xf54e('0x82')](_0x57f6af);}})['then'](function(){return _0x21319b;})['then'](respondWithResult(_0xd82fad,null))[_0xf54e('0x46')](handleError(_0xd82fad,null));};exports[_0xf54e('0x89')]=function(_0x30327d,_0x26a904,_0x20f555){return db[_0xf54e('0x2b')]['find']({'where':{'id':_0x30327d[_0xf54e('0x41')]['id']}})[_0xf54e('0x24')](handleEntityNotFound(_0x26a904,null))['then'](function(_0x410b61){if(_0x410b61){return _0x410b61[_0xf54e('0x89')](_0x30327d[_0xf54e('0x32')][_0xf54e('0x66')]);}})['then'](function(_0x55f815){if(_0x55f815){return db[_0xf54e('0x63')][_0xf54e('0x25')]({'where':{'ListId':_0x30327d[_0xf54e('0x32')][_0xf54e('0x66')],'CampaignId':_0x30327d['params']['id']}})['then'](function(){return _0x55f815;});}})[_0xf54e('0x24')](respondWithStatusCode(_0x26a904,null))[_0xf54e('0x46')](handleError(_0x26a904,null));}; \ No newline at end of file +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 diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 510b9be..88f4754 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 _0x1a3d=['api','moment','path','rimraf','../../config/environment','./campaign.attributes','exports','define','Campaign','campaigns','lodash','util','../../config/logger'];(function(_0x522c6d,_0x4d250d){var _0x26300d=function(_0x3ab228){while(--_0x3ab228){_0x522c6d['push'](_0x522c6d['shift']());}};_0x26300d(++_0x4d250d);}(_0x1a3d,0x176));var _0xd1a3=function(_0x41bd16,_0x1ac675){_0x41bd16=_0x41bd16-0x0;var _0x1768a6=_0x1a3d[_0x41bd16];return _0x1768a6;};'use strict';var _=require(_0xd1a3('0x0'));var util=require(_0xd1a3('0x1'));var logger=require(_0xd1a3('0x2'))(_0xd1a3('0x3'));var moment=require(_0xd1a3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd1a3('0x5'));var rimraf=require(_0xd1a3('0x6'));var config=require(_0xd1a3('0x7'));var attributes=require(_0xd1a3('0x8'));module[_0xd1a3('0x9')]=function(_0x3233bf,_0x4ada94){return _0x3233bf[_0xd1a3('0xa')](_0xd1a3('0xb'),attributes,{'tableName':_0xd1a3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 8a08895..8fb2e16 100644 --- a/server/api/campaign/campaign.rpc.js +++ b/server/api/campaign/campaign.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x2d7116,_0xbf7571){var _0x3a82c6=function(_0x3b8a17){while(--_0x3b8a17){_0x2d7116['push'](_0x2d7116['shift']());}};_0x3a82c6(++_0xbf7571);}(_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 moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file +var _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_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 diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 92a3896..8393ed7 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 _0x7bc8=['../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','/:id/blacklists','getBlackLists','post','clone','addLists','addBlackLists','put','delete','/:id','destroy','removeLists','removeBlackLists','exports','multer','path','express','Router','../../components/auth/service'];(function(_0x47e549,_0x2e53d6){var _0x251374=function(_0x400458){while(--_0x400458){_0x47e549['push'](_0x47e549['shift']());}};_0x251374(++_0x2e53d6);}(_0x7bc8,0x1a8));var _0x87bc=function(_0xcb3a26,_0x517914){_0xcb3a26=_0xcb3a26-0x0;var _0x557b78=_0x7bc8[_0xcb3a26];return _0x557b78;};'use strict';var multer=require(_0x87bc('0x0'));var util=require('util');var path=require(_0x87bc('0x1'));var timeout=require('connect-timeout');var express=require(_0x87bc('0x2'));var router=express[_0x87bc('0x3')]();var auth=require(_0x87bc('0x4'));var interaction=require(_0x87bc('0x5'));var config=require(_0x87bc('0x6'));var controller=require(_0x87bc('0x7'));router[_0x87bc('0x8')]('/',auth[_0x87bc('0x9')](),controller[_0x87bc('0xa')]);router[_0x87bc('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x87bc('0xb')]);router[_0x87bc('0x8')](_0x87bc('0xc'),auth[_0x87bc('0x9')](),controller['getHoppers']);router[_0x87bc('0x8')](_0x87bc('0xd'),auth['isAuthenticated'](),controller[_0x87bc('0xe')]);router[_0x87bc('0x8')](_0x87bc('0xf'),auth[_0x87bc('0x9')](),controller[_0x87bc('0x10')]);router['get'](_0x87bc('0x11'),auth[_0x87bc('0x9')](),controller[_0x87bc('0x12')]);router[_0x87bc('0x8')](_0x87bc('0x13'),auth[_0x87bc('0x9')](),controller['getLists']);router['get'](_0x87bc('0x14'),auth[_0x87bc('0x9')](),controller[_0x87bc('0x15')]);router[_0x87bc('0x16')]('/',auth[_0x87bc('0x9')](),controller['create']);router[_0x87bc('0x16')]('/:id/clone',auth[_0x87bc('0x9')](),controller[_0x87bc('0x17')]);router[_0x87bc('0x16')]('/:id/lists',auth[_0x87bc('0x9')](),controller[_0x87bc('0x18')]);router[_0x87bc('0x16')](_0x87bc('0x14'),auth[_0x87bc('0x9')](),controller[_0x87bc('0x19')]);router[_0x87bc('0x1a')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x87bc('0x1b')](_0x87bc('0x1c'),auth[_0x87bc('0x9')](),controller[_0x87bc('0x1d')]);router['delete']('/:id/lists',auth[_0x87bc('0x9')](),controller[_0x87bc('0x1e')]);router['delete'](_0x87bc('0x14'),auth[_0x87bc('0x9')](),controller[_0x87bc('0x1f')]);module[_0x87bc('0x20')]=router; \ No newline at end of file +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 diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index e1ee625..e34617a 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 _0x8c35=['getDataValue','key','exports','STRING','VIRTUAL'];(function(_0x5d15cb,_0x3501b9){var _0x3bd8f9=function(_0x57c04e){while(--_0x57c04e){_0x5d15cb['push'](_0x5d15cb['shift']());}};_0x3bd8f9(++_0x3501b9);}(_0x8c35,0xfc));var _0x58c3=function(_0x49653c,_0x8624d7){_0x49653c=_0x49653c-0x0;var _0x4ba4b1=_0x8c35[_0x49653c];return _0x4ba4b1;};'use strict';var Sequelize=require('sequelize');module[_0x58c3('0x0')]={'key':{'type':Sequelize[_0x58c3('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x58c3('0x1')]},'name':{'type':Sequelize[_0x58c3('0x2')],'get':function(){return this[_0x58c3('0x3')](_0x58c3('0x4'));}}}; \ No newline at end of file +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 diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 2939d82..f2a75ac 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 _0x9957=['limit','set','Content-Range','reject','save','then','destroy','get','CannedAnswers','UserProfileResource','stack','name','send','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','options','CannedAnswer','count','include','catch','show','params','keys','length','includeAll','find','update','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','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','sendStatus','status','end','json','offset'];(function(_0x40c20b,_0x5f205b){var _0x17636b=function(_0x2beb99){while(--_0x2beb99){_0x40c20b['push'](_0x40c20b['shift']());}};_0x17636b(++_0x5f205b);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];function respondWithStatusCode(_0x2cb37a,_0x19a27e){_0x19a27e=_0x19a27e||0xcc;return function(_0x385f00){if(_0x385f00){return _0x2cb37a[_0x7995('0x1a')](_0x19a27e);}return _0x2cb37a[_0x7995('0x1b')](_0x19a27e)[_0x7995('0x1c')]();};}function respondWithResult(_0x4cc004,_0x58f5ad){_0x58f5ad=_0x58f5ad||0xc8;return function(_0x2b4e94){if(_0x2b4e94){return _0x4cc004[_0x7995('0x1b')](_0x58f5ad)[_0x7995('0x1d')](_0x2b4e94);}};}function respondWithFilteredResult(_0x321ae8,_0x3f1d3e){return function(_0x1a5310){if(_0x1a5310){var _0x2202ce=_0x1a5310['count'],_0x41cbf0=_0x3f1d3e[_0x7995('0x1e')],_0x5377e5=_0x3f1d3e[_0x7995('0x1e')]+_0x3f1d3e[_0x7995('0x1f')],_0x2eeacc;if(_0x5377e5>=_0x2202ce){_0x5377e5=_0x2202ce;_0x2eeacc=0xc8;}else{_0x2eeacc=0xce;}_0x321ae8[_0x7995('0x1b')](_0x2eeacc);return _0x321ae8[_0x7995('0x20')](_0x7995('0x21'),_0x41cbf0+'-'+_0x5377e5+'/'+_0x2202ce)['json'](_0x1a5310);}return null;};}function patchUpdates(_0x54c9ae){return function(_0x2536c8){try{jsonpatch['apply'](_0x2536c8,_0x54c9ae,!![]);}catch(_0x555f74){return BPromise[_0x7995('0x22')](_0x555f74);}return _0x2536c8[_0x7995('0x23')]();};}function saveUpdates(_0x4cbe10,_0x3a9b54){return function(_0x51f276){if(_0x51f276){return _0x51f276['update'](_0x4cbe10)[_0x7995('0x24')](function(_0x327b1f){return _0x327b1f;});}return null;};}function removeEntity(_0x350fd9,_0x1a8568){return function(_0x460924){if(_0x460924){return _0x460924[_0x7995('0x25')]()['then'](function(){var _0x32a09a=_0x460924[_0x7995('0x26')]({'plain':!![]});var _0x204507=_0x7995('0x27');return db[_0x7995('0x28')][_0x7995('0x25')]({'where':{'type':_0x204507,'resourceId':_0x32a09a['id']}})[_0x7995('0x24')](function(){return _0x460924;});})[_0x7995('0x24')](function(){_0x350fd9['status'](0xcc)[_0x7995('0x1c')]();});}};}function handleEntityNotFound(_0x34e70c,_0x401dc3){return function(_0x268ce7){if(!_0x268ce7){_0x34e70c[_0x7995('0x1a')](0x194);}return _0x268ce7;};}function handleError(_0x2a307e,_0x56691a){_0x56691a=_0x56691a||0x1f4;return function(_0x47625f){logger['error'](_0x47625f[_0x7995('0x29')]);if(_0x47625f[_0x7995('0x2a')]){delete _0x47625f[_0x7995('0x2a')];}_0x2a307e[_0x7995('0x1b')](_0x56691a)[_0x7995('0x2b')](_0x47625f);};}exports['index']=function(_0x9b2a15,_0x514445){var _0x456a28={},_0x3250e0={},_0x4253e5={'count':0x0,'rows':[]};var _0x574574=_['map'](db['CannedAnswer'][_0x7995('0x2c')],function(_0xe6b0b3){return{'name':_0xe6b0b3[_0x7995('0x2d')],'type':_0xe6b0b3[_0x7995('0x2e')][_0x7995('0x2f')]};});_0x3250e0[_0x7995('0x30')]=_['map'](_0x574574,'name');_0x3250e0[_0x7995('0x31')]=_['keys'](_0x9b2a15[_0x7995('0x31')]);_0x3250e0[_0x7995('0x32')]=_[_0x7995('0x33')](_0x3250e0[_0x7995('0x30')],_0x3250e0[_0x7995('0x31')]);_0x456a28['attributes']=_[_0x7995('0x33')](_0x3250e0[_0x7995('0x30')],qs['fields'](_0x9b2a15['query']['fields']));_0x456a28[_0x7995('0x34')]=_0x456a28[_0x7995('0x34')]['length']?_0x456a28[_0x7995('0x34')]:_0x3250e0['model'];if(!_0x9b2a15[_0x7995('0x31')][_0x7995('0x35')](_0x7995('0x36'))){_0x456a28['limit']=qs['limit'](_0x9b2a15[_0x7995('0x31')]['limit']);_0x456a28['offset']=qs[_0x7995('0x1e')](_0x9b2a15[_0x7995('0x31')]['offset']);}_0x456a28[_0x7995('0x37')]=qs[_0x7995('0x38')](_0x9b2a15[_0x7995('0x31')][_0x7995('0x38')]);_0x456a28[_0x7995('0x39')]=qs['filters'](_[_0x7995('0x3a')](_0x9b2a15[_0x7995('0x31')],_0x3250e0[_0x7995('0x32')]));if(_0x9b2a15[_0x7995('0x31')]['filter']){_0x456a28[_0x7995('0x39')]=_[_0x7995('0x3b')](_0x456a28[_0x7995('0x39')],{'$or':_[_0x7995('0x3c')](_0x574574,function(_0x1f5bee){if(_0x1f5bee[_0x7995('0x2e')]!=='VIRTUAL'){var _0x183a68={};_0x183a68[_0x1f5bee[_0x7995('0x2a')]]={'$like':'%'+_0x9b2a15[_0x7995('0x31')][_0x7995('0x3d')]+'%'};return _0x183a68;}})});}_0x456a28=_[_0x7995('0x3b')]({},_0x456a28,_0x9b2a15[_0x7995('0x3e')]);var _0x14d638={'where':_0x456a28[_0x7995('0x39')]};return db[_0x7995('0x3f')][_0x7995('0x40')](_0x14d638)[_0x7995('0x24')](function(_0x270d52){_0x4253e5[_0x7995('0x40')]=_0x270d52;if(_0x9b2a15['query']['includeAll']){_0x456a28[_0x7995('0x41')]=[{'all':!![]}];}return db[_0x7995('0x3f')]['findAll'](_0x456a28);})['then'](function(_0x3f8522){_0x4253e5['rows']=_0x3f8522;return _0x4253e5;})['then'](respondWithFilteredResult(_0x514445,_0x456a28))[_0x7995('0x42')](handleError(_0x514445,null));};exports[_0x7995('0x43')]=function(_0x35c8ff,_0x576b96){var _0x46ac4f={'raw':!![],'where':{'id':_0x35c8ff[_0x7995('0x44')]['id']}},_0x5e85b9={};_0x5e85b9['model']=_['keys'](db[_0x7995('0x3f')][_0x7995('0x2c')]);_0x5e85b9[_0x7995('0x31')]=_[_0x7995('0x45')](_0x35c8ff['query']);_0x5e85b9[_0x7995('0x32')]=_[_0x7995('0x33')](_0x5e85b9[_0x7995('0x30')],_0x5e85b9[_0x7995('0x31')]);_0x46ac4f['attributes']=_['intersection'](_0x5e85b9[_0x7995('0x30')],qs['fields'](_0x35c8ff[_0x7995('0x31')]['fields']));_0x46ac4f[_0x7995('0x34')]=_0x46ac4f['attributes'][_0x7995('0x46')]?_0x46ac4f[_0x7995('0x34')]:_0x5e85b9['model'];if(_0x35c8ff[_0x7995('0x31')][_0x7995('0x47')]){_0x46ac4f[_0x7995('0x41')]=[{'all':!![]}];}_0x46ac4f=_[_0x7995('0x3b')]({},_0x46ac4f,_0x35c8ff['options']);return db[_0x7995('0x3f')][_0x7995('0x48')](_0x46ac4f)[_0x7995('0x24')](handleEntityNotFound(_0x576b96,null))['then'](respondWithResult(_0x576b96,null))[_0x7995('0x42')](handleError(_0x576b96,null));};exports[_0x7995('0x49')]=function(_0x511567,_0x3d8ae3){if(_0x511567[_0x7995('0x4a')]['id']){delete _0x511567['body']['id'];}return db[_0x7995('0x3f')][_0x7995('0x48')]({'where':{'id':_0x511567['params']['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x3d8ae3,null))['then'](saveUpdates(_0x511567[_0x7995('0x4a')],null))[_0x7995('0x24')](respondWithResult(_0x3d8ae3,null))[_0x7995('0x42')](handleError(_0x3d8ae3,null));};exports[_0x7995('0x25')]=function(_0xddf537,_0x14b537){return db[_0x7995('0x3f')]['find']({'where':{'id':_0xddf537[_0x7995('0x44')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x14b537,null))[_0x7995('0x24')](removeEntity(_0x14b537,null))['catch'](handleError(_0x14b537,null));};exports[_0x7995('0x4b')]=function(_0x1fe77e,_0x12d4b8){var _0x47d1d8={'key':_0x1fe77e['body']['key']};if(_0x1fe77e[_0x7995('0x4a')][_0x7995('0x4c')]){_0x47d1d8['MailAccountId']=_0x1fe77e[_0x7995('0x4a')][_0x7995('0x4c')];}else if(_0x1fe77e[_0x7995('0x4a')][_0x7995('0x4d')]){_0x47d1d8[_0x7995('0x4d')]=_0x1fe77e['body'][_0x7995('0x4d')];}else if(_0x1fe77e['body'][_0x7995('0x4e')]){_0x47d1d8[_0x7995('0x4e')]=_0x1fe77e[_0x7995('0x4a')]['OpenchannelAccountId'];}else if(_0x1fe77e['body']['ChatWebsiteId']){_0x47d1d8['ChatWebsiteId']=_0x1fe77e[_0x7995('0x4a')][_0x7995('0x4f')];}return db[_0x7995('0x3f')][_0x7995('0x48')]({'where':_0x47d1d8})[_0x7995('0x24')](function(_0x357e60){if(_0x357e60){throw new db[(_0x7995('0x50'))][(_0x7995('0x51'))](_0x7995('0x52'));}return db[_0x7995('0x3f')][_0x7995('0x4b')](_0x1fe77e[_0x7995('0x4a')]);})[_0x7995('0x24')](function(_0x35bea3){var _0x1ea1dc=_0x1fe77e[_0x7995('0x53')][_0x7995('0x26')]({'plain':!![]});if(!_0x1ea1dc)throw new Error(_0x7995('0x54'));if(_0x1ea1dc[_0x7995('0x55')]==='user'){var _0x56a374=_0x35bea3[_0x7995('0x26')]({'plain':!![]});return db[_0x7995('0x56')][_0x7995('0x48')]({'where':{'name':'CannedAnswers','userProfileId':_0x1ea1dc['userProfileId']},'raw':!![]})[_0x7995('0x24')](function(_0x197b52){if(_0x197b52&&_0x197b52[_0x7995('0x57')]===0x0){return db[_0x7995('0x28')]['create']({'name':_0x56a374[_0x7995('0x2a')],'resourceId':_0x56a374['id'],'type':_0x197b52[_0x7995('0x2a')],'sectionId':_0x197b52['id']},{})[_0x7995('0x24')](function(){return _0x35bea3;});}else{return _0x35bea3;}})[_0x7995('0x42')](function(_0x502d43){logger['error'](_0x7995('0x58'),_0x502d43);throw _0x502d43;});}return _0x35bea3;})[_0x7995('0x24')](respondWithResult(_0x12d4b8,0xc9))[_0x7995('0x42')](handleError(_0x12d4b8,null));}; \ No newline at end of file +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 diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 5ce92eb..22c4252 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 _0x31c2=['path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','request-promise'];(function(_0x42ce25,_0x7f11aa){var _0x14b4cd=function(_0x9e4b0c){while(--_0x9e4b0c){_0x42ce25['push'](_0x42ce25['shift']());}};_0x14b4cd(++_0x7f11aa);}(_0x31c2,0x98));var _0x231c=function(_0x3f7a0e,_0x10e1d4){_0x3f7a0e=_0x3f7a0e-0x0;var _0x2b2308=_0x31c2[_0x3f7a0e];return _0x2b2308;};'use strict';var _=require(_0x231c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x231c('0x1'));var moment=require(_0x231c('0x2'));var BPromise=require('bluebird');var rp=require(_0x231c('0x3'));var fs=require('fs');var path=require(_0x231c('0x4'));var rimraf=require(_0x231c('0x5'));var config=require(_0x231c('0x6'));var attributes=require(_0x231c('0x7'));module[_0x231c('0x8')]=function(_0x21b4df,_0x4442b9){return _0x21b4df['define'](_0x231c('0x9'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x231c('0xa'),'collate':_0x231c('0xb')});}; \ No newline at end of file +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 diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 11b59cb..4e513ba 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 _0x84ad=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x26e19d,_0x39a66b){var _0x1119f3=function(_0x5b3c4e){while(--_0x5b3c4e){_0x26e19d['push'](_0x26e19d['shift']());}};_0x1119f3(++_0x39a66b);}(_0x84ad,0x1ca));var _0xd84a=function(_0x14f7fe,_0x5132c4){_0x14f7fe=_0x14f7fe-0x0;var _0x3d8309=_0x84ad[_0x14f7fe];return _0x3d8309;};'use strict';var _=require(_0xd84a('0x0'));var util=require('util');var moment=require(_0xd84a('0x1'));var BPromise=require(_0xd84a('0x2'));var rs=require(_0xd84a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd84a('0x4'))['db'];var utils=require(_0xd84a('0x5'));var logger=require(_0xd84a('0x6'))('rpc');var config=require(_0xd84a('0x7'));var jayson=require(_0xd84a('0x8'));var client=jayson[_0xd84a('0x9')][_0xd84a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4369d2,_0x5f0271,_0x59cdb5){return new BPromise(function(_0x11626e,_0x3cf4a6){return client[_0xd84a('0xb')](_0x4369d2,_0x59cdb5)[_0xd84a('0xc')](function(_0x5da7f3){logger[_0xd84a('0xd')](_0xd84a('0xe'),_0x5f0271,_0xd84a('0xf'));logger[_0xd84a('0x10')]('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x5f0271,_0xd84a('0xf'),JSON['stringify'](_0x5da7f3));if(_0x5da7f3[_0xd84a('0x11')]){if(_0x5da7f3[_0xd84a('0x11')][_0xd84a('0x12')]===0x1f4){logger['error'](_0xd84a('0xe'),_0x5f0271,_0x5da7f3['error'][_0xd84a('0x13')]);return _0x3cf4a6(_0x5da7f3[_0xd84a('0x11')]['message']);}logger[_0xd84a('0x11')](_0xd84a('0xe'),_0x5f0271,_0x5da7f3[_0xd84a('0x11')]['message']);return _0x11626e(_0x5da7f3[_0xd84a('0x11')][_0xd84a('0x13')]);}else{logger[_0xd84a('0xd')](_0xd84a('0xe'),_0x5f0271,_0xd84a('0xf'));_0x11626e(_0x5da7f3[_0xd84a('0x14')][_0xd84a('0x13')]);}})[_0xd84a('0x15')](function(_0x457b63){logger[_0xd84a('0x11')]('CannedAnswer,\x20%s,\x20%s',_0x5f0271,_0x457b63);_0x3cf4a6(_0x457b63);});});} \ No newline at end of file +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 diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index d8dca6a..fcf3b3c 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 _0xabee=['update','delete','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','post','create'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xabee,0x11b));var _0xeabe=function(_0x497bcd,_0x2eaa8e){_0x497bcd=_0x497bcd-0x0;var _0x2c915f=_0xabee[_0x497bcd];return _0x2c915f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xeabe('0x0'));var express=require(_0xeabe('0x1'));var router=express[_0xeabe('0x2')]();var auth=require(_0xeabe('0x3'));var interaction=require(_0xeabe('0x4'));var config=require(_0xeabe('0x5'));var controller=require('./cannedAnswer.controller');router[_0xeabe('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xeabe('0x7'),auth[_0xeabe('0x8')](),controller['show']);router[_0xeabe('0x9')]('/',auth['isAuthenticated'](),controller[_0xeabe('0xa')]);router['put'](_0xeabe('0x7'),auth[_0xeabe('0x8')](),controller[_0xeabe('0xb')]);router[_0xeabe('0xc')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xeabe('0xd')]=router; \ No newline at end of file +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 diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 5e19549..2b7275c 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 _0x8925=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x1177f3,_0x358467){var _0x5a1383=function(_0x4a3aea){while(--_0x4a3aea){_0x1177f3['push'](_0x1177f3['shift']());}};_0x5a1383(++_0x358467);}(_0x8925,0x112));var _0x5892=function(_0x3557d0,_0x39f204){_0x3557d0=_0x3557d0-0x0;var _0x38d56c=_0x8925[_0x3557d0];return _0x38d56c;};'use strict';var Sequelize=require(_0x5892('0x0'));module[_0x5892('0x1')]={'calldate':{'type':Sequelize[_0x5892('0x2')],'allowNull':![],'defaultValue':_0x5892('0x3')},'clid':{'type':Sequelize[_0x5892('0x4')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x5892('0x4')]},'dcontext':{'type':Sequelize[_0x5892('0x4')]},'channel':{'type':Sequelize[_0x5892('0x4')]},'dstchannel':{'type':Sequelize[_0x5892('0x4')]},'lastapp':{'type':Sequelize[_0x5892('0x4')]},'lastdata':{'type':Sequelize[_0x5892('0x4')]},'duration':{'type':Sequelize[_0x5892('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x5892('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x5892('0x4')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x5892('0x4')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x5892('0x4')]},'linkedid':{'type':Sequelize[_0x5892('0x4')]},'sequence':{'type':Sequelize[_0x5892('0x4')]},'peeraccount':{'type':Sequelize[_0x5892('0x4')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x5892('0x4')]}}; \ No newline at end of file +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 diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 1bac152..be17ec8 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 _0x6f8d=['bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','length','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x4ef292,_0x52d8f4){var _0x138e1c=function(_0x125a39){while(--_0x125a39){_0x4ef292['push'](_0x4ef292['shift']());}};_0x138e1c(++_0x52d8f4);}(_0x6f8d,0x11d));var _0xd6f8=function(_0x295314,_0x17b250){_0x295314=_0x295314-0x0;var _0x584b0c=_0x6f8d[_0x295314];return _0x584b0c;};'use strict';var pdf=require(_0xd6f8('0x0'));var emlformat=require(_0xd6f8('0x1'));var rimraf=require(_0xd6f8('0x2'));var zipdir=require(_0xd6f8('0x3'));var jsonpatch=require(_0xd6f8('0x4'));var rp=require(_0xd6f8('0x5'));var moment=require(_0xd6f8('0x6'));var BPromise=require(_0xd6f8('0x7'));var Mustache=require(_0xd6f8('0x8'));var util=require('util');var path=require('path');var sox=require(_0xd6f8('0x9'));var csv=require(_0xd6f8('0xa'));var ejs=require(_0xd6f8('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd6f8('0xc'));var crypto=require(_0xd6f8('0xd'));var jsforce=require(_0xd6f8('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd6f8('0xa'));var querystring=require(_0xd6f8('0xf'));var Papa=require('papaparse');var Redis=require(_0xd6f8('0x10'));var authService=require(_0xd6f8('0x11'));var qs=require(_0xd6f8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6f8('0x13'));var logger=require(_0xd6f8('0x14'))('api');var utils=require(_0xd6f8('0x15'));var config=require('../../config/environment');var db=require(_0xd6f8('0x16'))['db'];function respondWithStatusCode(_0x5c263b,_0x782a1e){_0x782a1e=_0x782a1e||0xcc;return function(_0x17cb8d){if(_0x17cb8d){return _0x5c263b[_0xd6f8('0x17')](_0x782a1e);}return _0x5c263b[_0xd6f8('0x18')](_0x782a1e)[_0xd6f8('0x19')]();};}function respondWithResult(_0x5e98e9,_0x159af8){_0x159af8=_0x159af8||0xc8;return function(_0x2624dd){if(_0x2624dd){return _0x5e98e9[_0xd6f8('0x18')](_0x159af8)[_0xd6f8('0x1a')](_0x2624dd);}};}function respondWithFilteredResult(_0x1839f5,_0x196bb5){return function(_0x475fbf){if(_0x475fbf){var _0xe9f4e3=_0x475fbf[_0xd6f8('0x1b')],_0x411ec8=_0x196bb5[_0xd6f8('0x1c')],_0x4f7fe6=_0x196bb5[_0xd6f8('0x1c')]+_0x196bb5[_0xd6f8('0x1d')],_0x356b1f;if(_0x4f7fe6>=_0xe9f4e3){_0x4f7fe6=_0xe9f4e3;_0x356b1f=0xc8;}else{_0x356b1f=0xce;}_0x1839f5['status'](_0x356b1f);return _0x1839f5['set'](_0xd6f8('0x1e'),_0x411ec8+'-'+_0x4f7fe6+'/'+_0xe9f4e3)[_0xd6f8('0x1a')](_0x475fbf);}return null;};}function patchUpdates(_0x4053b7){return function(_0x430b85){try{jsonpatch[_0xd6f8('0x1f')](_0x430b85,_0x4053b7,!![]);}catch(_0x208677){return BPromise[_0xd6f8('0x20')](_0x208677);}return _0x430b85[_0xd6f8('0x21')]();};}function saveUpdates(_0x50f2e1,_0x54fe5d){return function(_0x447c12){if(_0x447c12){return _0x447c12[_0xd6f8('0x22')](_0x50f2e1)[_0xd6f8('0x23')](function(_0xcd4b04){return _0xcd4b04;});}return null;};}function removeEntity(_0x4c307b,_0x2f45ae){return function(_0x10a8c1){if(_0x10a8c1){return _0x10a8c1[_0xd6f8('0x24')]()[_0xd6f8('0x23')](function(){_0x4c307b[_0xd6f8('0x18')](0xcc)[_0xd6f8('0x19')]();});}};}function handleEntityNotFound(_0x57403f,_0x55bf4b){return function(_0x328c87){if(!_0x328c87){_0x57403f[_0xd6f8('0x17')](0x194);}return _0x328c87;};}function handleError(_0x5c9443,_0x3ade7b){_0x3ade7b=_0x3ade7b||0x1f4;return function(_0x1d1cd2){logger['error'](_0x1d1cd2[_0xd6f8('0x25')]);if(_0x1d1cd2[_0xd6f8('0x26')]){delete _0x1d1cd2[_0xd6f8('0x26')];}_0x5c9443['status'](_0x3ade7b)[_0xd6f8('0x27')](_0x1d1cd2);};}exports[_0xd6f8('0x28')]=function(_0x29355a,_0x230313){var _0x4732e4={},_0x4574ef={},_0x39592a={'count':0x0,'rows':[]};var _0x43c46a=_[_0xd6f8('0x29')](db[_0xd6f8('0x2a')][_0xd6f8('0x2b')],function(_0x476a7f){return{'name':_0x476a7f[_0xd6f8('0x2c')],'type':_0x476a7f[_0xd6f8('0x2d')][_0xd6f8('0x2e')]};});_0x4574ef[_0xd6f8('0x2f')]=_['map'](_0x43c46a,_0xd6f8('0x26'));_0x4574ef[_0xd6f8('0x30')]=_['keys'](_0x29355a[_0xd6f8('0x30')]);_0x4574ef[_0xd6f8('0x31')]=_[_0xd6f8('0x32')](_0x4574ef['model'],_0x4574ef[_0xd6f8('0x30')]);_0x4732e4['attributes']=_[_0xd6f8('0x32')](_0x4574ef['model'],qs[_0xd6f8('0x33')](_0x29355a[_0xd6f8('0x30')][_0xd6f8('0x33')]));_0x4732e4[_0xd6f8('0x34')]=_0x4732e4['attributes']['length']?_0x4732e4[_0xd6f8('0x34')]:_0x4574ef[_0xd6f8('0x2f')];if(!_0x29355a[_0xd6f8('0x30')][_0xd6f8('0x35')](_0xd6f8('0x36'))){_0x4732e4[_0xd6f8('0x1d')]=qs[_0xd6f8('0x1d')](_0x29355a[_0xd6f8('0x30')][_0xd6f8('0x1d')]);_0x4732e4['offset']=qs['offset'](_0x29355a[_0xd6f8('0x30')][_0xd6f8('0x1c')]);}_0x4732e4[_0xd6f8('0x37')]=qs[_0xd6f8('0x38')](_0x29355a[_0xd6f8('0x30')][_0xd6f8('0x38')]);_0x4732e4[_0xd6f8('0x39')]=qs['filters'](_[_0xd6f8('0x3a')](_0x29355a[_0xd6f8('0x30')],_0x4574ef[_0xd6f8('0x31')]));if(_0x29355a[_0xd6f8('0x30')][_0xd6f8('0x3b')]){_0x4732e4['where']=_[_0xd6f8('0x3c')](_0x4732e4['where'],{'$or':_[_0xd6f8('0x29')](_0x43c46a,function(_0x18db3a){if(_0x18db3a[_0xd6f8('0x2d')]!==_0xd6f8('0x3d')){var _0x59acc6={};_0x59acc6[_0x18db3a['name']]={'$like':'%'+_0x29355a[_0xd6f8('0x30')]['filter']+'%'};return _0x59acc6;}})});}_0x4732e4=_[_0xd6f8('0x3c')]({},_0x4732e4,_0x29355a[_0xd6f8('0x3e')]);var _0xc2ec5d={'where':_0x4732e4['where']};return db[_0xd6f8('0x2a')][_0xd6f8('0x1b')](_0xc2ec5d)[_0xd6f8('0x23')](function(_0x4b4ba4){_0x39592a['count']=_0x4b4ba4;if(_0x29355a[_0xd6f8('0x30')][_0xd6f8('0x3f')]){_0x4732e4['include']=[{'all':!![]}];}return db[_0xd6f8('0x2a')]['findAll'](_0x4732e4);})[_0xd6f8('0x23')](function(_0x342c67){_0x39592a[_0xd6f8('0x40')]=_0x342c67;return _0x39592a;})['then'](respondWithFilteredResult(_0x230313,_0x4732e4))[_0xd6f8('0x41')](handleError(_0x230313,null));};exports[_0xd6f8('0x42')]=function(_0x1fd691,_0x22f820){var _0x2168fa={'raw':!![],'where':{'id':_0x1fd691['params']['id']}},_0x12c70e={};_0x12c70e[_0xd6f8('0x2f')]=_['keys'](db[_0xd6f8('0x2a')][_0xd6f8('0x2b')]);_0x12c70e['query']=_['keys'](_0x1fd691[_0xd6f8('0x30')]);_0x12c70e[_0xd6f8('0x31')]=_[_0xd6f8('0x32')](_0x12c70e['model'],_0x12c70e[_0xd6f8('0x30')]);_0x2168fa[_0xd6f8('0x34')]=_[_0xd6f8('0x32')](_0x12c70e[_0xd6f8('0x2f')],qs[_0xd6f8('0x33')](_0x1fd691[_0xd6f8('0x30')][_0xd6f8('0x33')]));_0x2168fa['attributes']=_0x2168fa['attributes'][_0xd6f8('0x43')]?_0x2168fa[_0xd6f8('0x34')]:_0x12c70e[_0xd6f8('0x2f')];if(_0x1fd691[_0xd6f8('0x30')][_0xd6f8('0x3f')]){_0x2168fa['include']=[{'all':!![]}];}_0x2168fa=_[_0xd6f8('0x3c')]({},_0x2168fa,_0x1fd691[_0xd6f8('0x3e')]);return db[_0xd6f8('0x2a')][_0xd6f8('0x44')](_0x2168fa)[_0xd6f8('0x23')](handleEntityNotFound(_0x22f820,null))[_0xd6f8('0x23')](respondWithResult(_0x22f820,null))[_0xd6f8('0x41')](handleError(_0x22f820,null));};exports[_0xd6f8('0x45')]=function(_0x261686,_0x59f397){return db[_0xd6f8('0x2a')][_0xd6f8('0x45')](_0x261686[_0xd6f8('0x46')],{})['then'](respondWithResult(_0x59f397,0xc9))['catch'](handleError(_0x59f397,null));};exports['update']=function(_0x2fcefc,_0x359a9b){if(_0x2fcefc[_0xd6f8('0x46')]['id']){delete _0x2fcefc['body']['id'];}return db[_0xd6f8('0x2a')]['find']({'where':{'id':_0x2fcefc[_0xd6f8('0x47')]['id']}})[_0xd6f8('0x23')](handleEntityNotFound(_0x359a9b,null))['then'](saveUpdates(_0x2fcefc[_0xd6f8('0x46')],null))[_0xd6f8('0x23')](respondWithResult(_0x359a9b,null))[_0xd6f8('0x41')](handleError(_0x359a9b,null));};exports[_0xd6f8('0x24')]=function(_0x1c47c8,_0x3fee32){return db[_0xd6f8('0x2a')][_0xd6f8('0x44')]({'where':{'id':_0x1c47c8[_0xd6f8('0x47')]['id']}})['then'](handleEntityNotFound(_0x3fee32,null))['then'](removeEntity(_0x3fee32,null))[_0xd6f8('0x41')](handleError(_0x3fee32,null));};exports[_0xd6f8('0x48')]=function(_0x4e719f,_0x486074){return db[_0xd6f8('0x2a')][_0xd6f8('0x48')]()[_0xd6f8('0x23')](respondWithResult(_0x486074,null))['catch'](handleError(_0x486074,null));}; \ No newline at end of file +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 diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 25ca670..8c6e63d 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 _0xdb28=['../../config/environment','exports','Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdb28,0x106));var _0x8db2=function(_0x41d722,_0x17d944){_0x41d722=_0x41d722-0x0;var _0x237cd9=_0xdb28[_0x41d722];return _0x237cd9;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var logger=require(_0x8db2('0x2'))(_0x8db2('0x3'));var moment=require('moment');var BPromise=require(_0x8db2('0x4'));var rp=require(_0x8db2('0x5'));var fs=require('fs');var path=require(_0x8db2('0x6'));var rimraf=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var attributes=require('./cdr.attributes');module[_0x8db2('0x9')]=function(_0x1d2dd3,_0x5f42ee){return _0x1d2dd3['define'](_0x8db2('0xa'),attributes,{'tableName':_0x8db2('0xb'),'paranoid':![],'indexes':[{'name':_0x8db2('0xc'),'fields':[_0x8db2('0xc')]},{'name':_0x8db2('0xd'),'fields':[_0x8db2('0xd')]},{'name':_0x8db2('0xe'),'fields':['disposition']},{'name':_0x8db2('0xf'),'fields':[_0x8db2('0xf')]},{'name':_0x8db2('0x10'),'fields':['src']},{'name':_0x8db2('0x11'),'fields':[_0x8db2('0x11')]}],'timestamps':![]});}; \ No newline at end of file +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 diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 781b619..71d352d 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 _0x36df=['../../config/environment','jayson/promise','client','http','request','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x461c9e,_0x9a67cd){var _0x144e35=function(_0x17d055){while(--_0x17d055){_0x461c9e['push'](_0x461c9e['shift']());}};_0x144e35(++_0x9a67cd);}(_0x36df,0x103));var _0xf36d=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x36df[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xf36d('0x0'));var util=require(_0xf36d('0x1'));var moment=require(_0xf36d('0x2'));var BPromise=require(_0xf36d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf36d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf36d('0x5'));var logger=require(_0xf36d('0x6'))('rpc');var config=require(_0xf36d('0x7'));var jayson=require(_0xf36d('0x8'));var client=jayson[_0xf36d('0x9')][_0xf36d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4688dc,_0x18572,_0x1a994d){return new BPromise(function(_0x7e0215,_0x260fe5){return client[_0xf36d('0xb')](_0x4688dc,_0x1a994d)['then'](function(_0x5b4fdf){logger[_0xf36d('0xc')](_0xf36d('0xd'),_0x18572,_0xf36d('0xe'));logger[_0xf36d('0xf')]('Cdr,\x20%s,\x20%s,\x20%s',_0x18572,_0xf36d('0xe'),JSON['stringify'](_0x5b4fdf));if(_0x5b4fdf[_0xf36d('0x10')]){if(_0x5b4fdf[_0xf36d('0x10')]['code']===0x1f4){logger[_0xf36d('0x10')]('Cdr,\x20%s,\x20%s',_0x18572,_0x5b4fdf[_0xf36d('0x10')][_0xf36d('0x11')]);return _0x260fe5(_0x5b4fdf[_0xf36d('0x10')][_0xf36d('0x11')]);}logger[_0xf36d('0x10')](_0xf36d('0xd'),_0x18572,_0x5b4fdf[_0xf36d('0x10')][_0xf36d('0x11')]);return _0x7e0215(_0x5b4fdf[_0xf36d('0x10')][_0xf36d('0x11')]);}else{logger[_0xf36d('0xc')](_0xf36d('0xd'),_0x18572,'request\x20sent');_0x7e0215(_0x5b4fdf['result']['message']);}})[_0xf36d('0x12')](function(_0x1b5acd){logger[_0xf36d('0x10')](_0xf36d('0xd'),_0x18572,_0x1b5acd);_0x260fe5(_0x1b5acd);});});} \ No newline at end of file +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 diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 6566cfc..704cd89 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 _0x0a41=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','/describe','/:id','create','update','delete'];(function(_0x2b17fc,_0x2de853){var _0x54d91e=function(_0x5eb51c){while(--_0x5eb51c){_0x2b17fc['push'](_0x2b17fc['shift']());}};_0x54d91e(++_0x2de853);}(_0x0a41,0x79));var _0x10a4=function(_0x4b18ea,_0x2c070a){_0x4b18ea=_0x4b18ea-0x0;var _0x28ec1c=_0x0a41[_0x4b18ea];return _0x28ec1c;};'use strict';var multer=require(_0x10a4('0x0'));var util=require(_0x10a4('0x1'));var path=require(_0x10a4('0x2'));var timeout=require(_0x10a4('0x3'));var express=require(_0x10a4('0x4'));var router=express[_0x10a4('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x10a4('0x6'));var controller=require('./cdr.controller');router[_0x10a4('0x7')]('/',auth[_0x10a4('0x8')](),controller[_0x10a4('0x9')]);router[_0x10a4('0x7')](_0x10a4('0xa'),auth[_0x10a4('0x8')](),controller['describe']);router[_0x10a4('0x7')](_0x10a4('0xb'),auth[_0x10a4('0x8')](),controller['show']);router['post']('/',auth[_0x10a4('0x8')](),controller[_0x10a4('0xc')]);router['put'](_0x10a4('0xb'),auth['isAuthenticated'](),controller[_0x10a4('0xd')]);router[_0x10a4('0xe')](_0x10a4('0xb'),auth[_0x10a4('0x8')](),controller[_0x10a4('0xf')]);module[_0x10a4('0x10')]=router; \ No newline at end of file +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 diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index c438ff8..7281bc5 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 _0x52c7=['INTEGER','STRING','noop','TEXT','*,*,*,*','exports'];(function(_0x2a3e5f,_0x24c745){var _0xfdbebc=function(_0x1c1bd2){while(--_0x1c1bd2){_0x2a3e5f['push'](_0x2a3e5f['shift']());}};_0xfdbebc(++_0x24c745);}(_0x52c7,0x18b));var _0x752c=function(_0x2b012b,_0x463e28){_0x2b012b=_0x2b012b-0x0;var _0x32c4cf=_0x52c7[_0x2b012b];return _0x32c4cf;};'use strict';var Sequelize=require('sequelize');module[_0x752c('0x0')]={'priority':{'type':Sequelize[_0x752c('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x752c('0x2')],'allowNull':![],'defaultValue':_0x752c('0x3')},'appdata':{'type':Sequelize[_0x752c('0x4')]()},'description':{'type':Sequelize[_0x752c('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x752c('0x5')}}; \ No newline at end of file +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 diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 9042024..b31b85c 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 _0x43a5=['moment','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','sendStatus','error','name','send','show','params','keys','ChatApplication','rawAttributes','query','intersection','model','attributes','fields','includeAll','merge','options','find','body','catch','html-pdf','zip-dir','fast-json-patch','request-promise'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x43a5,0x146));var _0x543a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x43a5[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require(_0x543a('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x543a('0x1'));var jsonpatch=require(_0x543a('0x2'));var rp=require(_0x543a('0x3'));var moment=require(_0x543a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x543a('0x5'));var sox=require('sox');var csv=require(_0x543a('0x6'));var ejs=require(_0x543a('0x7'));var fs=require('fs');var _=require(_0x543a('0x8'));var squel=require(_0x543a('0x9'));var crypto=require('crypto');var jsforce=require(_0x543a('0xa'));var deskjs=require(_0x543a('0xb'));var toCsv=require(_0x543a('0x6'));var querystring=require(_0x543a('0xc'));var Papa=require(_0x543a('0xd'));var Redis=require(_0x543a('0xe'));var authService=require(_0x543a('0xf'));var qs=require(_0x543a('0x10'));var as=require(_0x543a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x543a('0x12'))(_0x543a('0x13'));var utils=require(_0x543a('0x14'));var config=require(_0x543a('0x15'));var db=require(_0x543a('0x16'))['db'];function respondWithStatusCode(_0x44f7ab,_0x324deb){_0x324deb=_0x324deb||0xcc;return function(_0x114c4b){if(_0x114c4b){return _0x44f7ab['sendStatus'](_0x324deb);}return _0x44f7ab[_0x543a('0x17')](_0x324deb)['end']();};}function respondWithResult(_0x312213,_0x360bd7){_0x360bd7=_0x360bd7||0xc8;return function(_0x15c75b){if(_0x15c75b){return _0x312213[_0x543a('0x17')](_0x360bd7)[_0x543a('0x18')](_0x15c75b);}};}function respondWithFilteredResult(_0x1e7adf,_0x43a09f){return function(_0x1ed0c9){if(_0x1ed0c9){var _0x8b82aa=_0x1ed0c9[_0x543a('0x19')],_0x4991cc=_0x43a09f['offset'],_0x289a9a=_0x43a09f[_0x543a('0x1a')]+_0x43a09f[_0x543a('0x1b')],_0x57f894;if(_0x289a9a>=_0x8b82aa){_0x289a9a=_0x8b82aa;_0x57f894=0xc8;}else{_0x57f894=0xce;}_0x1e7adf[_0x543a('0x17')](_0x57f894);return _0x1e7adf[_0x543a('0x1c')]('Content-Range',_0x4991cc+'-'+_0x289a9a+'/'+_0x8b82aa)[_0x543a('0x18')](_0x1ed0c9);}return null;};}function patchUpdates(_0x288d24){return function(_0x3675d0){try{jsonpatch[_0x543a('0x1d')](_0x3675d0,_0x288d24,!![]);}catch(_0x3cea14){return BPromise[_0x543a('0x1e')](_0x3cea14);}return _0x3675d0[_0x543a('0x1f')]();};}function saveUpdates(_0x4e86e4,_0x20e844){return function(_0x2e2a99){if(_0x2e2a99){return _0x2e2a99[_0x543a('0x20')](_0x4e86e4)[_0x543a('0x21')](function(_0x57372e){return _0x57372e;});}return null;};}function removeEntity(_0x5510c9,_0x362468){return function(_0x3842e0){if(_0x3842e0){return _0x3842e0[_0x543a('0x22')]()['then'](function(){_0x5510c9[_0x543a('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe94253,_0x3fd536){return function(_0x20aac9){if(!_0x20aac9){_0xe94253[_0x543a('0x23')](0x194);}return _0x20aac9;};}function handleError(_0x31ed21,_0x466bba){_0x466bba=_0x466bba||0x1f4;return function(_0x465990){logger[_0x543a('0x24')](_0x465990['stack']);if(_0x465990['name']){delete _0x465990[_0x543a('0x25')];}_0x31ed21[_0x543a('0x17')](_0x466bba)[_0x543a('0x26')](_0x465990);};}exports[_0x543a('0x27')]=function(_0x404e17,_0x261a73){var _0x36aea6={'raw':!![],'where':{'id':_0x404e17[_0x543a('0x28')]['id']}},_0x129c1c={};_0x129c1c['model']=_[_0x543a('0x29')](db[_0x543a('0x2a')][_0x543a('0x2b')]);_0x129c1c[_0x543a('0x2c')]=_['keys'](_0x404e17[_0x543a('0x2c')]);_0x129c1c['filters']=_[_0x543a('0x2d')](_0x129c1c[_0x543a('0x2e')],_0x129c1c[_0x543a('0x2c')]);_0x36aea6[_0x543a('0x2f')]=_[_0x543a('0x2d')](_0x129c1c[_0x543a('0x2e')],qs[_0x543a('0x30')](_0x404e17['query'][_0x543a('0x30')]));_0x36aea6[_0x543a('0x2f')]=_0x36aea6[_0x543a('0x2f')]['length']?_0x36aea6[_0x543a('0x2f')]:_0x129c1c[_0x543a('0x2e')];if(_0x404e17[_0x543a('0x2c')][_0x543a('0x31')]){_0x36aea6['include']=[{'all':!![]}];}_0x36aea6=_[_0x543a('0x32')]({},_0x36aea6,_0x404e17[_0x543a('0x33')]);return db[_0x543a('0x2a')][_0x543a('0x34')](_0x36aea6)[_0x543a('0x21')](handleEntityNotFound(_0x261a73,null))['then'](respondWithResult(_0x261a73,null))['catch'](handleError(_0x261a73,null));};exports[_0x543a('0x20')]=function(_0x340e3e,_0x3d5150){if(_0x340e3e['body']['id']){delete _0x340e3e[_0x543a('0x35')]['id'];}return db['ChatApplication'][_0x543a('0x34')]({'where':{'id':_0x340e3e[_0x543a('0x28')]['id']}})[_0x543a('0x21')](handleEntityNotFound(_0x3d5150,null))[_0x543a('0x21')](saveUpdates(_0x340e3e['body'],null))[_0x543a('0x21')](respondWithResult(_0x3d5150,null))[_0x543a('0x36')](handleError(_0x3d5150,null));};exports[_0x543a('0x22')]=function(_0x3df145,_0x137767){return db[_0x543a('0x2a')]['find']({'where':{'id':_0x3df145[_0x543a('0x28')]['id']}})['then'](handleEntityNotFound(_0x137767,null))[_0x543a('0x21')](removeEntity(_0x137767,null))[_0x543a('0x36')](handleError(_0x137767,null));}; \ No newline at end of file +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 diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 0955fc5..9635873 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(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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(_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 diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index db00a27..f40d5bd 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 _0x9f4d=['../../config/utils','../../config/logger','../../config/environment','client','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x127d07,_0x5b0254){var _0x14d7a2=function(_0x24d5f1){while(--_0x24d5f1){_0x127d07['push'](_0x127d07['shift']());}};_0x14d7a2(++_0x5b0254);}(_0x9f4d,0x189));var _0xd9f4=function(_0x16e4c4,_0x1e67a1){_0x16e4c4=_0x16e4c4-0x0;var _0x2896fe=_0x9f4d[_0x16e4c4];return _0x2896fe;};'use strict';var _=require(_0xd9f4('0x0'));var util=require(_0xd9f4('0x1'));var moment=require(_0xd9f4('0x2'));var BPromise=require(_0xd9f4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd9f4('0x4'));var db=require(_0xd9f4('0x5'))['db'];var utils=require(_0xd9f4('0x6'));var logger=require(_0xd9f4('0x7'))('rpc');var config=require(_0xd9f4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9f4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ec69d,_0x57f0a6,_0x25c8e1){return new BPromise(function(_0x29b7e2,_0x5d3732){return client['request'](_0x3ec69d,_0x25c8e1)[_0xd9f4('0xa')](function(_0x57345c){logger[_0xd9f4('0xb')](_0xd9f4('0xc'),_0x57f0a6,_0xd9f4('0xd'));logger[_0xd9f4('0xe')](_0xd9f4('0xf'),_0x57f0a6,_0xd9f4('0xd'),JSON[_0xd9f4('0x10')](_0x57345c));if(_0x57345c[_0xd9f4('0x11')]){if(_0x57345c[_0xd9f4('0x11')][_0xd9f4('0x12')]===0x1f4){logger[_0xd9f4('0x11')](_0xd9f4('0xc'),_0x57f0a6,_0x57345c['error'][_0xd9f4('0x13')]);return _0x5d3732(_0x57345c[_0xd9f4('0x11')][_0xd9f4('0x13')]);}logger[_0xd9f4('0x11')]('ChatApplication,\x20%s,\x20%s',_0x57f0a6,_0x57345c[_0xd9f4('0x11')][_0xd9f4('0x13')]);return _0x29b7e2(_0x57345c[_0xd9f4('0x11')][_0xd9f4('0x13')]);}else{logger[_0xd9f4('0xb')](_0xd9f4('0xc'),_0x57f0a6,_0xd9f4('0xd'));_0x29b7e2(_0x57345c[_0xd9f4('0x14')][_0xd9f4('0x13')]);}})['catch'](function(_0x22cd3a){logger[_0xd9f4('0x11')]('ChatApplication,\x20%s,\x20%s',_0x57f0a6,_0x22cd3a);_0x5d3732(_0x22cd3a);});});} \ No newline at end of file +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 diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index f67f30c..b5b870d 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 _0xfc88=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','/:id','put','isAuthenticated','update','delete','destroy','exports','multer','util','connect-timeout','Router'];(function(_0x54f970,_0x1791cf){var _0x5ba1e7=function(_0x42d1f6){while(--_0x42d1f6){_0x54f970['push'](_0x54f970['shift']());}};_0x5ba1e7(++_0x1791cf);}(_0xfc88,0x65));var _0x8fc8=function(_0x371cfd,_0x306eea){_0x371cfd=_0x371cfd-0x0;var _0x1efe38=_0xfc88[_0x371cfd];return _0x1efe38;};'use strict';var multer=require(_0x8fc8('0x0'));var util=require(_0x8fc8('0x1'));var path=require('path');var timeout=require(_0x8fc8('0x2'));var express=require('express');var router=express[_0x8fc8('0x3')]();var auth=require(_0x8fc8('0x4'));var interaction=require(_0x8fc8('0x5'));var config=require(_0x8fc8('0x6'));var controller=require(_0x8fc8('0x7'));router['get'](_0x8fc8('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x8fc8('0x9')](_0x8fc8('0x8'),auth[_0x8fc8('0xa')](),controller[_0x8fc8('0xb')]);router[_0x8fc8('0xc')](_0x8fc8('0x8'),auth['isAuthenticated'](),controller[_0x8fc8('0xd')]);module[_0x8fc8('0xe')]=router; \ No newline at end of file +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 diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 022b69a..88a43fc 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 _0x680c=['STRING','BOOLEAN','sequelize','exports'];(function(_0x5175f3,_0x4ae05c){var _0x10e6e2=function(_0x10fb80){while(--_0x10fb80){_0x5175f3['push'](_0x5175f3['shift']());}};_0x10e6e2(++_0x4ae05c);}(_0x680c,0x1ae));var _0xc680=function(_0x18b36c,_0x3fd9e5){_0x18b36c=_0x18b36c-0x0;var _0x3efbfa=_0x680c[_0x18b36c];return _0x3efbfa;};'use strict';var Sequelize=require(_0xc680('0x0'));module[_0xc680('0x1')]={'name':{'type':Sequelize[_0xc680('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xc680('0x3')],'defaultValue':!![]}}; \ No newline at end of file +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 diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 31c25b6..1a4b359 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 _0x0f6d=['params','keys','find','create','body','describe','ChatInternalMessage','user','addMembers','omit','getMembers','findOne','User','nolimit','removeMembers','ids','addMessage','ChatGroupId','$gte','split','YYYY-MM-DD\x20HH:mm:ss','getMessages','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','client','http','test','Sequelize','ValidationError','request','then','info','debug','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','reject','update','destroy','stack','send','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','include','rows','show'];(function(_0x21a9dc,_0x43c07d){var _0x5da87c=function(_0x5af6cd){while(--_0x5af6cd){_0x21a9dc['push'](_0x21a9dc['shift']());}};_0x5da87c(++_0x43c07d);}(_0x0f6d,0xf4));var _0xd0f6=function(_0x176317,_0x4897b3){_0x176317=_0x176317-0x0;var _0xef2759=_0x0f6d[_0x176317];return _0xef2759;};'use strict';var pdf=require(_0xd0f6('0x0'));var emlformat=require(_0xd0f6('0x1'));var rimraf=require(_0xd0f6('0x2'));var zipdir=require(_0xd0f6('0x3'));var jsonpatch=require(_0xd0f6('0x4'));var rp=require(_0xd0f6('0x5'));var moment=require('moment');var BPromise=require(_0xd0f6('0x6'));var Mustache=require(_0xd0f6('0x7'));var util=require(_0xd0f6('0x8'));var path=require(_0xd0f6('0x9'));var sox=require(_0xd0f6('0xa'));var csv=require(_0xd0f6('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd0f6('0xc'));var crypto=require(_0xd0f6('0xd'));var jsforce=require(_0xd0f6('0xe'));var deskjs=require(_0xd0f6('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd0f6('0x10'));var Papa=require(_0xd0f6('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd0f6('0x12'));var as=require(_0xd0f6('0x13'));var hardwareService=require(_0xd0f6('0x14'));var logger=require(_0xd0f6('0x15'))(_0xd0f6('0x16'));var utils=require(_0xd0f6('0x17'));var config=require(_0xd0f6('0x18'));var db=require(_0xd0f6('0x19'))['db'];config[_0xd0f6('0x1a')]=_[_0xd0f6('0x1b')](config[_0xd0f6('0x1a')],{'host':_0xd0f6('0x1c'),'port':0x18eb});var socket=require(_0xd0f6('0x1d'))(new Redis(config[_0xd0f6('0x1a')]));require(_0xd0f6('0x1e'))[_0xd0f6('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0xd0f6('0x20')][_0xd0f6('0x21')]({'port':0x232a});function checkPasswordPattern(_0x499e87,_0x559436,_0x291846){if(_0x291846){var _0x52969c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x52969c[_0xd0f6('0x22')](_0x559436)){return _0x499e87;}else{throw new db[(_0xd0f6('0x23'))][(_0xd0f6('0x24'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x499e87;}}function respondWithRpcPromise(_0x52e01f,_0xc1edd3,_0x34f8b6,_0x67faba){return new BPromise(function(_0x1cf046,_0x37d8f0){var _0x47a5a5=_0x67faba||client;return _0x47a5a5[_0xd0f6('0x25')](_0x52e01f,_0x34f8b6)[_0xd0f6('0x26')](function(_0x295a7e){logger[_0xd0f6('0x27')]('ChatGroup,\x20%s,\x20%s',_0xc1edd3,'request\x20sent');logger[_0xd0f6('0x28')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0xc1edd3,'request\x20sent',JSON[_0xd0f6('0x29')](_0x295a7e));if(_0x295a7e[_0xd0f6('0x2a')]){if(_0x295a7e[_0xd0f6('0x2a')][_0xd0f6('0x2b')]===0x1f4){logger[_0xd0f6('0x2a')](_0xd0f6('0x2c'),_0xc1edd3,_0x295a7e[_0xd0f6('0x2a')][_0xd0f6('0x2d')]);return _0x37d8f0(_0x295a7e[_0xd0f6('0x2a')][_0xd0f6('0x2d')]);}logger[_0xd0f6('0x2a')](_0xd0f6('0x2c'),_0xc1edd3,_0x295a7e[_0xd0f6('0x2a')][_0xd0f6('0x2d')]);return _0x1cf046(_0x295a7e[_0xd0f6('0x2a')][_0xd0f6('0x2d')]);}else{logger[_0xd0f6('0x27')](_0xd0f6('0x2c'),_0xc1edd3,'request\x20sent');_0x1cf046(_0x295a7e[_0xd0f6('0x2e')][_0xd0f6('0x2d')]);}})[_0xd0f6('0x2f')](function(_0x4c91de){logger[_0xd0f6('0x2a')](_0xd0f6('0x2c'),_0xc1edd3,_0x4c91de);_0x37d8f0(_0x4c91de);});});}function respondWithStatusCode(_0x5588b9,_0x375983){_0x375983=_0x375983||0xcc;return function(_0x3d92f1){if(_0x3d92f1){return _0x5588b9[_0xd0f6('0x30')](_0x375983);}return _0x5588b9[_0xd0f6('0x31')](_0x375983)[_0xd0f6('0x32')]();};}function respondWithResult(_0x39c72d,_0x39ac6a){_0x39ac6a=_0x39ac6a||0xc8;return function(_0x2d4eec){if(_0x2d4eec){return _0x39c72d[_0xd0f6('0x31')](_0x39ac6a)[_0xd0f6('0x33')](_0x2d4eec);}};}function respondWithFilteredResult(_0x4bca0e,_0x33c751){return function(_0xc95d9f){if(_0xc95d9f){var _0x59ff36=_0xc95d9f[_0xd0f6('0x34')],_0xff3d4d=_0x33c751[_0xd0f6('0x35')],_0x240405=_0x33c751['offset']+_0x33c751['limit'],_0x525011;if(_0x240405>=_0x59ff36){_0x240405=_0x59ff36;_0x525011=0xc8;}else{_0x525011=0xce;}_0x4bca0e[_0xd0f6('0x31')](_0x525011);return _0x4bca0e[_0xd0f6('0x36')](_0xd0f6('0x37'),_0xff3d4d+'-'+_0x240405+'/'+_0x59ff36)[_0xd0f6('0x33')](_0xc95d9f);}return null;};}function patchUpdates(_0x1d2cb2){return function(_0x294a5e){try{jsonpatch['apply'](_0x294a5e,_0x1d2cb2,!![]);}catch(_0x3b6ba8){return BPromise[_0xd0f6('0x38')](_0x3b6ba8);}return _0x294a5e['save']();};}function saveUpdates(_0x4f1553,_0x43fa10){return function(_0x5b02a4){if(_0x5b02a4){return _0x5b02a4[_0xd0f6('0x39')](_0x4f1553)[_0xd0f6('0x26')](function(_0x1f1538){return _0x1f1538;});}return null;};}function removeEntity(_0x43c517,_0x51af21){return function(_0x3be84f){if(_0x3be84f){return _0x3be84f[_0xd0f6('0x3a')]()[_0xd0f6('0x26')](function(){_0x43c517['status'](0xcc)[_0xd0f6('0x32')]();});}};}function handleEntityNotFound(_0x438842,_0x8af6ad){return function(_0x5558ba){if(!_0x5558ba){_0x438842['sendStatus'](0x194);}return _0x5558ba;};}function handleError(_0x249fa6,_0x1f781f){_0x1f781f=_0x1f781f||0x1f4;return function(_0x2ef3d8){logger[_0xd0f6('0x2a')](_0x2ef3d8[_0xd0f6('0x3b')]);if(_0x2ef3d8['name']){delete _0x2ef3d8['name'];}_0x249fa6[_0xd0f6('0x31')](_0x1f781f)[_0xd0f6('0x3c')](_0x2ef3d8);};}exports['index']=function(_0x4cf9da,_0x3418ce){var _0x4b78b1={},_0xaf74b9={},_0x15a9c8={'count':0x0,'rows':[]};var _0x2e942f=_[_0xd0f6('0x3d')](db[_0xd0f6('0x3e')][_0xd0f6('0x3f')],function(_0x49cdf4){return{'name':_0x49cdf4[_0xd0f6('0x40')],'type':_0x49cdf4[_0xd0f6('0x41')][_0xd0f6('0x42')]};});_0xaf74b9[_0xd0f6('0x43')]=_[_0xd0f6('0x3d')](_0x2e942f,'name');_0xaf74b9['query']=_['keys'](_0x4cf9da[_0xd0f6('0x44')]);_0xaf74b9[_0xd0f6('0x45')]=_[_0xd0f6('0x46')](_0xaf74b9[_0xd0f6('0x43')],_0xaf74b9['query']);_0x4b78b1['attributes']=_[_0xd0f6('0x46')](_0xaf74b9[_0xd0f6('0x43')],qs[_0xd0f6('0x47')](_0x4cf9da[_0xd0f6('0x44')][_0xd0f6('0x47')]));_0x4b78b1[_0xd0f6('0x48')]=_0x4b78b1[_0xd0f6('0x48')][_0xd0f6('0x49')]?_0x4b78b1['attributes']:_0xaf74b9['model'];if(!_0x4cf9da[_0xd0f6('0x44')][_0xd0f6('0x4a')]('nolimit')){_0x4b78b1[_0xd0f6('0x4b')]=qs[_0xd0f6('0x4b')](_0x4cf9da['query']['limit']);_0x4b78b1['offset']=qs['offset'](_0x4cf9da[_0xd0f6('0x44')][_0xd0f6('0x35')]);}_0x4b78b1[_0xd0f6('0x4c')]=qs[_0xd0f6('0x4d')](_0x4cf9da['query'][_0xd0f6('0x4d')]);_0x4b78b1[_0xd0f6('0x4e')]=qs[_0xd0f6('0x45')](_[_0xd0f6('0x4f')](_0x4cf9da[_0xd0f6('0x44')],_0xaf74b9[_0xd0f6('0x45')]));if(_0x4cf9da[_0xd0f6('0x44')][_0xd0f6('0x50')]){_0x4b78b1[_0xd0f6('0x4e')]=_[_0xd0f6('0x51')](_0x4b78b1[_0xd0f6('0x4e')],{'$or':_[_0xd0f6('0x3d')](_0x2e942f,function(_0x2ff6be){if(_0x2ff6be['type']!==_0xd0f6('0x52')){var _0x14f3a9={};_0x14f3a9[_0x2ff6be[_0xd0f6('0x53')]]={'$like':'%'+_0x4cf9da[_0xd0f6('0x44')][_0xd0f6('0x50')]+'%'};return _0x14f3a9;}})});}_0x4b78b1=_[_0xd0f6('0x51')]({},_0x4b78b1,_0x4cf9da[_0xd0f6('0x54')]);var _0x15f062={'where':_0x4b78b1[_0xd0f6('0x4e')]};return db[_0xd0f6('0x3e')][_0xd0f6('0x34')](_0x15f062)['then'](function(_0x25aedc){_0x15a9c8[_0xd0f6('0x34')]=_0x25aedc;if(_0x4cf9da[_0xd0f6('0x44')][_0xd0f6('0x55')]){_0x4b78b1[_0xd0f6('0x56')]=[{'all':!![]}];}return db[_0xd0f6('0x3e')]['findAll'](_0x4b78b1);})[_0xd0f6('0x26')](function(_0x5f4fb8){_0x15a9c8[_0xd0f6('0x57')]=_0x5f4fb8;return _0x15a9c8;})[_0xd0f6('0x26')](respondWithFilteredResult(_0x3418ce,_0x4b78b1))['catch'](handleError(_0x3418ce,null));};exports[_0xd0f6('0x58')]=function(_0x4086dd,_0x1554ba){var _0x50820d={'raw':!![],'where':{'id':_0x4086dd[_0xd0f6('0x59')]['id']}},_0x308f55={};_0x308f55[_0xd0f6('0x43')]=_[_0xd0f6('0x5a')](db[_0xd0f6('0x3e')]['rawAttributes']);_0x308f55[_0xd0f6('0x44')]=_[_0xd0f6('0x5a')](_0x4086dd[_0xd0f6('0x44')]);_0x308f55[_0xd0f6('0x45')]=_[_0xd0f6('0x46')](_0x308f55['model'],_0x308f55[_0xd0f6('0x44')]);_0x50820d[_0xd0f6('0x48')]=_['intersection'](_0x308f55[_0xd0f6('0x43')],qs[_0xd0f6('0x47')](_0x4086dd[_0xd0f6('0x44')]['fields']));_0x50820d[_0xd0f6('0x48')]=_0x50820d[_0xd0f6('0x48')][_0xd0f6('0x49')]?_0x50820d[_0xd0f6('0x48')]:_0x308f55[_0xd0f6('0x43')];if(_0x4086dd[_0xd0f6('0x44')]['includeAll']){_0x50820d['include']=[{'all':!![]}];}_0x50820d=_[_0xd0f6('0x51')]({},_0x50820d,_0x4086dd[_0xd0f6('0x54')]);return db['ChatGroup'][_0xd0f6('0x5b')](_0x50820d)[_0xd0f6('0x26')](handleEntityNotFound(_0x1554ba,null))[_0xd0f6('0x26')](respondWithResult(_0x1554ba,null))[_0xd0f6('0x2f')](handleError(_0x1554ba,null));};exports[_0xd0f6('0x5c')]=function(_0x322d15,_0x2ace76){return db[_0xd0f6('0x3e')][_0xd0f6('0x5c')](_0x322d15[_0xd0f6('0x5d')],{})[_0xd0f6('0x26')](respondWithResult(_0x2ace76,0xc9))[_0xd0f6('0x2f')](handleError(_0x2ace76,null));};exports[_0xd0f6('0x39')]=function(_0x4b1e98,_0x1e4455){if(_0x4b1e98['body']['id']){delete _0x4b1e98[_0xd0f6('0x5d')]['id'];}return db[_0xd0f6('0x3e')][_0xd0f6('0x5b')]({'where':{'id':_0x4b1e98['params']['id']}})['then'](handleEntityNotFound(_0x1e4455,null))['then'](saveUpdates(_0x4b1e98[_0xd0f6('0x5d')],null))[_0xd0f6('0x26')](respondWithResult(_0x1e4455,null))[_0xd0f6('0x2f')](handleError(_0x1e4455,null));};exports[_0xd0f6('0x3a')]=function(_0x4ac681,_0x341222){return db[_0xd0f6('0x3e')][_0xd0f6('0x5b')]({'where':{'id':_0x4ac681[_0xd0f6('0x59')]['id']}})[_0xd0f6('0x26')](handleEntityNotFound(_0x341222,null))['then'](removeEntity(_0x341222,null))['catch'](handleError(_0x341222,null));};exports[_0xd0f6('0x5e')]=function(_0x1af486,_0x41202c){return db[_0xd0f6('0x3e')][_0xd0f6('0x5e')]()[_0xd0f6('0x26')](respondWithResult(_0x41202c,null))[_0xd0f6('0x2f')](handleError(_0x41202c,null));};exports['getUnread']=function(_0x30be90,_0x36e6dd,_0x324613){return db[_0xd0f6('0x5f')]['count']({'where':{'ChatGroupId':_0x30be90['params']['id'],'ToId':_0x30be90[_0xd0f6('0x60')]['id'],'read':![]}})[_0xd0f6('0x26')](function(_0x2a5b53){return{'id':_['toInteger'](_0x30be90[_0xd0f6('0x59')]['id']),'count':_0x2a5b53};})[_0xd0f6('0x26')](respondWithResult(_0x36e6dd,null))[_0xd0f6('0x2f')](handleError(_0x36e6dd,null));};exports[_0xd0f6('0x61')]=function(_0x5c14c6,_0x429415,_0x263576){return db[_0xd0f6('0x3e')][_0xd0f6('0x5b')]({'where':{'id':_0x5c14c6[_0xd0f6('0x59')]['id']}})[_0xd0f6('0x26')](handleEntityNotFound(_0x429415,null))[_0xd0f6('0x26')](function(_0x52e550){if(_0x52e550){return _0x52e550[_0xd0f6('0x61')](_0x5c14c6['body']['ids'],_[_0xd0f6('0x62')](_0x5c14c6[_0xd0f6('0x5d')],['ids','id'])||{});}})[_0xd0f6('0x26')](respondWithResult(_0x429415,null))[_0xd0f6('0x2f')](handleError(_0x429415,null));};exports[_0xd0f6('0x63')]=function(_0xea3142,_0x4b17ed,_0x2b61e8){var _0xb502f={};var _0x28f0d9={};var _0x3d6a0c;var _0x1dc3ab;return db[_0xd0f6('0x3e')][_0xd0f6('0x64')]({'where':{'id':_0xea3142[_0xd0f6('0x59')]['id']}})[_0xd0f6('0x26')](handleEntityNotFound(_0x4b17ed,null))[_0xd0f6('0x26')](function(_0x131df9){if(_0x131df9){_0x3d6a0c=_0x131df9;_0x28f0d9[_0xd0f6('0x43')]=_['keys'](db[_0xd0f6('0x65')][_0xd0f6('0x3f')]);_0x28f0d9[_0xd0f6('0x44')]=_[_0xd0f6('0x5a')](_0xea3142[_0xd0f6('0x44')]);_0x28f0d9[_0xd0f6('0x45')]=_[_0xd0f6('0x46')](_0x28f0d9[_0xd0f6('0x43')],_0x28f0d9[_0xd0f6('0x44')]);_0xb502f['attributes']=_['intersection'](_0x28f0d9['model'],qs[_0xd0f6('0x47')](_0xea3142[_0xd0f6('0x44')][_0xd0f6('0x47')]));_0xb502f[_0xd0f6('0x48')]=_0xb502f[_0xd0f6('0x48')][_0xd0f6('0x49')]?_0xb502f[_0xd0f6('0x48')]:_0x28f0d9['model'];_0xb502f[_0xd0f6('0x4c')]=qs[_0xd0f6('0x4d')](_0xea3142['query'][_0xd0f6('0x4d')]);_0xb502f[_0xd0f6('0x4e')]=qs['filters'](_[_0xd0f6('0x4f')](_0xea3142[_0xd0f6('0x44')],_0x28f0d9['filters']));if(_0xea3142[_0xd0f6('0x44')][_0xd0f6('0x50')]){_0xb502f[_0xd0f6('0x4e')]=_[_0xd0f6('0x51')](_0xb502f[_0xd0f6('0x4e')],{'$or':_[_0xd0f6('0x3d')](_0xb502f[_0xd0f6('0x48')],function(_0x311ca1){var _0xac6d9e={};_0xac6d9e[_0x311ca1]={'$like':'%'+_0xea3142['query'][_0xd0f6('0x50')]+'%'};return _0xac6d9e;})});}_0xb502f=_[_0xd0f6('0x51')]({},_0xb502f,_0xea3142[_0xd0f6('0x54')]);return _0x3d6a0c['getMembers'](_0xb502f);}})[_0xd0f6('0x26')](function(_0x51c0b9){if(_0x51c0b9){_0x1dc3ab=_0x51c0b9[_0xd0f6('0x49')];if(!_0xea3142[_0xd0f6('0x44')]['hasOwnProperty'](_0xd0f6('0x66'))){_0xb502f['limit']=qs[_0xd0f6('0x4b')](_0xea3142[_0xd0f6('0x44')]['limit']);_0xb502f[_0xd0f6('0x35')]=qs[_0xd0f6('0x35')](_0xea3142[_0xd0f6('0x44')][_0xd0f6('0x35')]);}return _0x3d6a0c['getMembers'](_0xb502f);}})[_0xd0f6('0x26')](function(_0x48c0f7){if(_0x48c0f7){return _0x48c0f7?{'count':_0x1dc3ab,'rows':_0x48c0f7}:null;}})[_0xd0f6('0x26')](respondWithResult(_0x4b17ed,null))[_0xd0f6('0x2f')](handleError(_0x4b17ed,null));};exports[_0xd0f6('0x67')]=function(_0xac1b4d,_0x4a6e0f,_0x135336){return db[_0xd0f6('0x3e')][_0xd0f6('0x5b')]({'where':{'id':_0xac1b4d[_0xd0f6('0x59')]['id']}})['then'](handleEntityNotFound(_0x4a6e0f,null))[_0xd0f6('0x26')](function(_0x3ebec6){if(_0x3ebec6){return _0x3ebec6[_0xd0f6('0x67')](_0xac1b4d[_0xd0f6('0x44')][_0xd0f6('0x68')]);}})[_0xd0f6('0x26')](respondWithStatusCode(_0x4a6e0f,null))[_0xd0f6('0x2f')](handleError(_0x4a6e0f,null));};exports[_0xd0f6('0x69')]=function(_0x4916a3,_0xd42b64,_0x1caf67){if(_0x4916a3['body']['id']){delete _0x4916a3['body']['id'];}return db['ChatGroup'][_0xd0f6('0x5b')]({'where':{'id':_0x4916a3[_0xd0f6('0x59')]['id']}})[_0xd0f6('0x26')](handleEntityNotFound(_0xd42b64,null))[_0xd0f6('0x26')](function(_0x4ac66e){if(_0x4ac66e){_0x4916a3['body'][_0xd0f6('0x6a')]=_0x4ac66e['id'];return db[_0xd0f6('0x5f')][_0xd0f6('0x5c')](_0x4916a3['body']);}})[_0xd0f6('0x26')](respondWithResult(_0xd42b64,null))[_0xd0f6('0x2f')](handleError(_0xd42b64,null));};exports['getMessages']=function(_0x2488f7,_0x5bcfe6,_0x41b9f3){var _0x57d9e6={};var _0x2865de={};var _0x257a6c;var _0x3cab66;return db[_0xd0f6('0x3e')][_0xd0f6('0x64')]({'where':{'id':_0x2488f7[_0xd0f6('0x59')]['id']}})[_0xd0f6('0x26')](handleEntityNotFound(_0x5bcfe6,null))[_0xd0f6('0x26')](function(_0x2b80c7){if(_0x2b80c7){_0x257a6c=_0x2b80c7;_0x2865de[_0xd0f6('0x43')]=_[_0xd0f6('0x5a')](db[_0xd0f6('0x5f')][_0xd0f6('0x3f')]);_0x2865de['query']=_[_0xd0f6('0x5a')](_0x2488f7[_0xd0f6('0x44')]);_0x2865de[_0xd0f6('0x45')]=_['intersection'](_0x2865de['model'],_0x2865de['query']);_0x57d9e6['attributes']=_[_0xd0f6('0x46')](_0x2865de[_0xd0f6('0x43')],qs[_0xd0f6('0x47')](_0x2488f7[_0xd0f6('0x44')]['fields']));_0x57d9e6[_0xd0f6('0x48')]=_0x57d9e6[_0xd0f6('0x48')]['length']?_0x57d9e6[_0xd0f6('0x48')]:_0x2865de['model'];_0x57d9e6['order']=qs['sort'](_0x2488f7['query'][_0xd0f6('0x4d')]);_0x57d9e6[_0xd0f6('0x4e')]=qs['filters'](_['pick'](_0x2488f7['query'],_0x2865de[_0xd0f6('0x45')]));if(_0x2488f7[_0xd0f6('0x44')]['filter']){_0x57d9e6[_0xd0f6('0x4e')]=_[_0xd0f6('0x51')](_0x57d9e6[_0xd0f6('0x4e')],{'$or':_[_0xd0f6('0x3d')](_0x57d9e6[_0xd0f6('0x48')],function(_0x18bfc6){var _0x45691d={};_0x45691d[_0x18bfc6]={'$like':'%'+_0x2488f7['query'][_0xd0f6('0x50')]+'%'};return _0x45691d;})});}if(_0x2488f7[_0xd0f6('0x44')][_0xd0f6('0x6b')]){var _0xf7edae=_0x2488f7[_0xd0f6('0x44')][_0xd0f6('0x6b')][_0xd0f6('0x6c')](',');var _0x440431={};_0x440431[_0xf7edae[0x0]]={'$gte':moment(_0xf7edae[0x1])['format'](_0xd0f6('0x6d'))};_0x57d9e6[_0xd0f6('0x4e')]=_[_0xd0f6('0x51')](_0x57d9e6[_0xd0f6('0x4e')],_0x440431);}_0x57d9e6=_[_0xd0f6('0x51')]({},_0x57d9e6,_0x2488f7['options']);return _0x257a6c[_0xd0f6('0x6e')](_0x57d9e6);}})['then'](function(_0x205b61){if(_0x205b61){_0x3cab66=_0x205b61[_0xd0f6('0x49')];if(!_0x2488f7['query']['hasOwnProperty'](_0xd0f6('0x66'))){_0x57d9e6['limit']=qs[_0xd0f6('0x4b')](_0x2488f7[_0xd0f6('0x44')][_0xd0f6('0x4b')]);_0x57d9e6['offset']=qs[_0xd0f6('0x35')](_0x2488f7['query']['offset']);}return _0x257a6c[_0xd0f6('0x6e')](_0x57d9e6);}})[_0xd0f6('0x26')](function(_0x1dc56e){if(_0x1dc56e){return _0x1dc56e?{'count':_0x3cab66,'rows':_0x1dc56e}:null;}})['then'](respondWithResult(_0x5bcfe6,null))[_0xd0f6('0x2f')](handleError(_0x5bcfe6,null));}; \ No newline at end of file +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 diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index e68f549..866f3f5 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 _0xadb5=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x597484,_0x199340){var _0x218e64=function(_0x390d55){while(--_0x390d55){_0x597484['push'](_0x597484['shift']());}};_0x218e64(++_0x199340);}(_0xadb5,0xad));var _0x5adb=function(_0x4cdb68,_0x1f89ff){_0x4cdb68=_0x4cdb68-0x0;var _0x27e301=_0xadb5[_0x4cdb68];return _0x27e301;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x5adb('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x5adb('0x1')](0x0);var events={'afterCreate':_0x5adb('0x2'),'afterUpdate':_0x5adb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x248dc6){return function(_0x31457,_0x2e3ef4,_0x4cb1d1){ChatGroupEvents[_0x5adb('0x4')](_0x248dc6+':'+_0x31457['id'],_0x31457);ChatGroupEvents[_0x5adb('0x4')](_0x248dc6,_0x31457);_0x4cb1d1(null);};}for(var e in events){if(events[_0x5adb('0x5')](e)){var event=events[e];ChatGroup[_0x5adb('0x6')](e,emitEvent(event));}}module[_0x5adb('0x7')]=ChatGroupEvents; \ No newline at end of file +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 diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index b30cae1..81cc989 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 _0x1134=['ChatGroup','chat_groups','lodash','util','api','moment','request-promise','path','../../config/environment','exports'];(function(_0x1a3e44,_0x3167f2){var _0x40e456=function(_0x3de427){while(--_0x3de427){_0x1a3e44['push'](_0x1a3e44['shift']());}};_0x40e456(++_0x3167f2);}(_0x1134,0x19c));var _0x4113=function(_0x67970d,_0x59110e){_0x67970d=_0x67970d-0x0;var _0x291a55=_0x1134[_0x67970d];return _0x291a55;};'use strict';var _=require(_0x4113('0x0'));var util=require(_0x4113('0x1'));var logger=require('../../config/logger')(_0x4113('0x2'));var moment=require(_0x4113('0x3'));var BPromise=require('bluebird');var rp=require(_0x4113('0x4'));var fs=require('fs');var path=require(_0x4113('0x5'));var rimraf=require('rimraf');var config=require(_0x4113('0x6'));var attributes=require('./chatGroup.attributes');module[_0x4113('0x7')]=function(_0x499091,_0x39ca01){return _0x499091['define'](_0x4113('0x8'),attributes,{'tableName':_0x4113('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index bbb4202..b47534b 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 _0x5168=['randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','./chatGroup.socket','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x2dae63,_0x5888c7){var _0x374647=function(_0x3624aa){while(--_0x3624aa){_0x2dae63['push'](_0x2dae63['shift']());}};_0x374647(++_0x5888c7);}(_0x5168,0x140));var _0x8516=function(_0xe9aaa7,_0x3be524){_0xe9aaa7=_0xe9aaa7-0x0;var _0x4b5689=_0x5168[_0xe9aaa7];return _0x4b5689;};'use strict';var _=require(_0x8516('0x0'));var util=require(_0x8516('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8516('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8516('0x3'))(_0x8516('0x4'));var config=require(_0x8516('0x5'));var jayson=require(_0x8516('0x6'));var client=jayson['client'][_0x8516('0x7')]({'port':0x232a});config['redis']=_[_0x8516('0x8')](config['redis'],{'host':_0x8516('0x9'),'port':0x18eb});var socket=require(_0x8516('0xa'))(new Redis(config[_0x8516('0xb')]));require(_0x8516('0xc'))['register'](socket);function respondWithRpcPromise(_0x3c0905,_0x2203e6,_0x431feb){return new BPromise(function(_0x94b2a4,_0x16fc6c){return client['request'](_0x3c0905,_0x431feb)[_0x8516('0xd')](function(_0xb0377e){logger[_0x8516('0xe')](_0x8516('0xf'),_0x2203e6,_0x8516('0x10'));logger['debug'](_0x8516('0x11'),_0x2203e6,_0x8516('0x10'),JSON[_0x8516('0x12')](_0xb0377e));if(_0xb0377e[_0x8516('0x13')]){if(_0xb0377e[_0x8516('0x13')][_0x8516('0x14')]===0x1f4){logger['error'](_0x8516('0xf'),_0x2203e6,_0xb0377e[_0x8516('0x13')][_0x8516('0x15')]);return _0x16fc6c(_0xb0377e[_0x8516('0x13')][_0x8516('0x15')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x2203e6,_0xb0377e[_0x8516('0x13')][_0x8516('0x15')]);return _0x94b2a4(_0xb0377e[_0x8516('0x13')]['message']);}else{logger['info'](_0x8516('0xf'),_0x2203e6,_0x8516('0x10'));_0x94b2a4(_0xb0377e[_0x8516('0x16')][_0x8516('0x15')]);}})['catch'](function(_0x4f53b5){logger[_0x8516('0x13')](_0x8516('0xf'),_0x2203e6,_0x4f53b5);_0x16fc6c(_0x4f53b5);});});} \ No newline at end of file +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 diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 17ad8cb..7a270be 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 _0x37fc=['register','length','chatGroup:','./chatGroup.events','save','remove','update','emit'];(function(_0x31dde9,_0x12e816){var _0x1fbf2d=function(_0x1d1bf6){while(--_0x1d1bf6){_0x31dde9['push'](_0x31dde9['shift']());}};_0x1fbf2d(++_0x12e816);}(_0x37fc,0xd3));var _0xc37f=function(_0x337a27,_0x5a045d){_0x337a27=_0x337a27-0x0;var _0x28596d=_0x37fc[_0x337a27];return _0x28596d;};'use strict';var ChatGroupEvents=require(_0xc37f('0x0'));var events=[_0xc37f('0x1'),_0xc37f('0x2'),_0xc37f('0x3')];function createListener(_0x46a9ef,_0x5f03b7){return function(_0x171a5c){_0x5f03b7[_0xc37f('0x4')](_0x46a9ef,_0x171a5c);};}function removeListener(_0xd0dd6b,_0x38a9c4){return function(){ChatGroupEvents['removeListener'](_0xd0dd6b,_0x38a9c4);};}exports[_0xc37f('0x5')]=function(_0x51af0e){for(var _0x496aa9=0x0,_0x36e709=events[_0xc37f('0x6')];_0x496aa9<_0x36e709;_0x496aa9++){var _0x21c125=events[_0x496aa9];var _0x19017a=createListener(_0xc37f('0x7')+_0x21c125,_0x51af0e);ChatGroupEvents['on'](_0x21c125,_0x19017a);}}; \ No newline at end of file +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 diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index a740beb..d992646 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 _0x9e5d=['post','put','/:id','delete','destroy','removeMembers','exports','multer','util','connect-timeout','express','Router','../../config/environment','./chatGroup.controller','index','get','/describe','describe','show','/:id/unread','isAuthenticated','getUnread','/:id/members','getMembers','/:id/messages'];(function(_0x2abca8,_0x4c63d3){var _0x45d797=function(_0x101a14){while(--_0x101a14){_0x2abca8['push'](_0x2abca8['shift']());}};_0x45d797(++_0x4c63d3);}(_0x9e5d,0x1e2));var _0xd9e5=function(_0x3c4a7c,_0x2f4e3c){_0x3c4a7c=_0x3c4a7c-0x0;var _0xf13d1e=_0x9e5d[_0x3c4a7c];return _0xf13d1e;};'use strict';var multer=require(_0xd9e5('0x0'));var util=require(_0xd9e5('0x1'));var path=require('path');var timeout=require(_0xd9e5('0x2'));var express=require(_0xd9e5('0x3'));var router=express[_0xd9e5('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd9e5('0x5'));var controller=require(_0xd9e5('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xd9e5('0x7')]);router[_0xd9e5('0x8')](_0xd9e5('0x9'),auth['isAuthenticated'](),controller[_0xd9e5('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xd9e5('0xb')]);router[_0xd9e5('0x8')](_0xd9e5('0xc'),auth[_0xd9e5('0xd')](),controller[_0xd9e5('0xe')]);router[_0xd9e5('0x8')](_0xd9e5('0xf'),auth[_0xd9e5('0xd')](),controller[_0xd9e5('0x10')]);router[_0xd9e5('0x8')](_0xd9e5('0x11'),auth[_0xd9e5('0xd')](),controller['getMessages']);router[_0xd9e5('0x12')]('/',auth[_0xd9e5('0xd')](),controller['create']);router[_0xd9e5('0x12')](_0xd9e5('0xf'),auth[_0xd9e5('0xd')](),controller['addMembers']);router[_0xd9e5('0x12')]('/:id/messages',auth[_0xd9e5('0xd')](),controller['addMessage']);router[_0xd9e5('0x13')](_0xd9e5('0x14'),auth[_0xd9e5('0xd')](),controller['update']);router[_0xd9e5('0x15')](_0xd9e5('0x14'),auth[_0xd9e5('0xd')](),controller[_0xd9e5('0x16')]);router[_0xd9e5('0x15')](_0xd9e5('0xf'),auth[_0xd9e5('0xd')](),controller[_0xd9e5('0x17')]);module[_0xd9e5('0x18')]=router; \ No newline at end of file +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 diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index b659f44..005c3da 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 _0xe9b9=['exports','BOOLEAN','INTEGER','ENUM','star','TEXT','STRING','DATE','long'];(function(_0x38cbb1,_0x82eda8){var _0x1ddd2e=function(_0x10ad53){while(--_0x10ad53){_0x38cbb1['push'](_0x38cbb1['shift']());}};_0x1ddd2e(++_0x82eda8);}(_0xe9b9,0x1a7));var _0x9e9b=function(_0x54aea3,_0xae7d81){_0x54aea3=_0x54aea3-0x0;var _0x21ae46=_0xe9b9[_0x54aea3];return _0x21ae46;};'use strict';var Sequelize=require('sequelize');module[_0x9e9b('0x0')]={'closed':{'type':Sequelize[_0x9e9b('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x9e9b('0x2')]},'ratingType':{'type':Sequelize[_0x9e9b('0x3')]('star','thumb'),'defaultValue':_0x9e9b('0x4')},'ratingMessage':{'type':Sequelize[_0x9e9b('0x5')]},'pathTranscript':{'type':Sequelize[_0x9e9b('0x5')]},'mailTranscript':{'type':Sequelize[_0x9e9b('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x9e9b('0x7')]},'disposition':{'type':Sequelize[_0x9e9b('0x6')]},'note':{'type':Sequelize[_0x9e9b('0x6')]},'browserName':{'type':Sequelize[_0x9e9b('0x6')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x9e9b('0x6')]},'osVersion':{'type':Sequelize[_0x9e9b('0x6')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x9e9b('0x6')]},'deviceType':{'type':Sequelize[_0x9e9b('0x6')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x9e9b('0x6')]},'formData':{'type':Sequelize[_0x9e9b('0x5')](_0x9e9b('0x8'))},'read1stAt':{'type':Sequelize[_0x9e9b('0x7')]},'lastMsgAt':{'type':Sequelize[_0x9e9b('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x9e9b('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x9e9b('0x6')]}}; \ No newline at end of file +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 diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index cc26462..ff4eb64 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 _0x4b19=['entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','originalname','basename','filename','file','mimetype','attachmentDownload','findOne','Unauthorized','Attachment','attachId','join','root','server/files/attachments/','close','mailTranscript','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','ChatMessage','Messages','ChatWebsite','agentAlias','System','customer','format','%s%d','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailAccount','MailServerOut','Smtp','service','port','secure','authentication','SendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','getMessages','sort','ChatInteractionId','includeAll','findAll','getMyMessages','includeAgent','addTags','setTags','ids','Tag','emit','removeTags','download','unix','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','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.','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','customerIp','tail','existsSync','createReadStream','pipe','out','Contact','server','views','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','jayson/promise','client','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','name','Users','map','fullname','TagIds','Tags','split','push','catch','index','ChatInteraction','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','select','field','color','tools_tags','u.id','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','forEach','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','some','compact','isEmpty','i.ChatWebsiteId\x20IN\x20?','createdAt','$gte','parse','$lte','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','resolve','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','sequelize','toString','keyBy','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','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','all','rows','params','include','options','create','describe','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x4d2d5b,_0x923a35){var _0x46a798=function(_0x53c559){while(--_0x53c559){_0x4d2d5b['push'](_0x4d2d5b['shift']());}};_0x46a798(++_0x923a35);}(_0x4b19,0x195));var _0x94b1=function(_0xb38a96,_0xfeb8f0){_0xb38a96=_0xb38a96-0x0;var _0x1a362a=_0x4b19[_0xb38a96];return _0x1a362a;};'use strict';var pdf=require(_0x94b1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x94b1('0x1'));var zipdir=require(_0x94b1('0x2'));var jsonpatch=require(_0x94b1('0x3'));var rp=require('request-promise');var moment=require(_0x94b1('0x4'));var BPromise=require(_0x94b1('0x5'));var Mustache=require(_0x94b1('0x6'));var util=require('util');var path=require(_0x94b1('0x7'));var sox=require(_0x94b1('0x8'));var csv=require('to-csv');var ejs=require(_0x94b1('0x9'));var fs=require('fs');var _=require(_0x94b1('0xa'));var squel=require('squel');var crypto=require(_0x94b1('0xb'));var jsforce=require(_0x94b1('0xc'));var deskjs=require(_0x94b1('0xd'));var toCsv=require('to-csv');var querystring=require(_0x94b1('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x94b1('0xf'));var qs=require(_0x94b1('0x10'));var as=require(_0x94b1('0x11'));var hardwareService=require(_0x94b1('0x12'));var logger=require(_0x94b1('0x13'))(_0x94b1('0x14'));var utils=require('../../config/utils');var config=require(_0x94b1('0x15'));var db=require(_0x94b1('0x16'))['db'];config[_0x94b1('0x17')]=_[_0x94b1('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x94b1('0x19'))(new Redis(config[_0x94b1('0x17')]));require('./chatInteraction.socket')['register'](socket);var jayson=require(_0x94b1('0x1a'));var client=jayson[_0x94b1('0x1b')]['http']({'port':0x232b});var client9004=jayson[_0x94b1('0x1b')]['http']({'port':0x232c});function checkPasswordPattern(_0x4ea6a4,_0x192c03,_0x1f0560){if(_0x1f0560){var _0x258e98=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x258e98[_0x94b1('0x1c')](_0x192c03)){return _0x4ea6a4;}else{throw new db['Sequelize'][(_0x94b1('0x1d'))](_0x94b1('0x1e'));}}else{return _0x4ea6a4;}}function respondWithRpcPromise(_0xa29b90,_0x224099,_0x3a6ae0,_0x1abb7f){return new BPromise(function(_0x2d33dc,_0x59d7cf){var _0x30f969=_0x1abb7f||client;return _0x30f969[_0x94b1('0x1f')](_0xa29b90,_0x3a6ae0)[_0x94b1('0x20')](function(_0x5deb20){logger[_0x94b1('0x21')](_0x94b1('0x22'),_0x224099,'request\x20sent');logger[_0x94b1('0x23')](_0x94b1('0x24'),_0x224099,_0x94b1('0x25'),JSON[_0x94b1('0x26')](_0x5deb20));if(_0x5deb20[_0x94b1('0x27')]){if(_0x5deb20[_0x94b1('0x27')][_0x94b1('0x28')]===0x1f4){logger[_0x94b1('0x27')](_0x94b1('0x22'),_0x224099,_0x5deb20[_0x94b1('0x27')]['message']);return _0x59d7cf(_0x5deb20[_0x94b1('0x27')][_0x94b1('0x29')]);}logger[_0x94b1('0x27')]('ChatInteraction,\x20%s,\x20%s',_0x224099,_0x5deb20[_0x94b1('0x27')]['message']);return _0x2d33dc(_0x5deb20[_0x94b1('0x27')][_0x94b1('0x29')]);}else{logger[_0x94b1('0x21')](_0x94b1('0x22'),_0x224099,'request\x20sent');_0x2d33dc(_0x5deb20['result'][_0x94b1('0x29')]);}})['catch'](function(_0x1aa525){logger['error'](_0x94b1('0x22'),_0x224099,_0x1aa525);_0x59d7cf(_0x1aa525);});});}function respondWithStatusCode(_0x2f06b1,_0x1eda8c){_0x1eda8c=_0x1eda8c||0xcc;return function(_0x4c2732){if(_0x4c2732){return _0x2f06b1[_0x94b1('0x2a')](_0x1eda8c);}return _0x2f06b1[_0x94b1('0x2b')](_0x1eda8c)[_0x94b1('0x2c')]();};}function respondWithResult(_0x319618,_0xd86145){_0xd86145=_0xd86145||0xc8;return function(_0x43b67c){if(_0x43b67c){return _0x319618[_0x94b1('0x2b')](_0xd86145)[_0x94b1('0x2d')](_0x43b67c);}};}function respondWithFilteredResult(_0x1e79e2,_0x597af3){return function(_0x2eb1fa){if(_0x2eb1fa){var _0xf621ea=_0x2eb1fa[_0x94b1('0x2e')],_0x47f019=_0x597af3[_0x94b1('0x2f')],_0x42630a=_0x597af3[_0x94b1('0x2f')]+_0x597af3[_0x94b1('0x30')],_0x1fe766;if(_0x42630a>=_0xf621ea){_0x42630a=_0xf621ea;_0x1fe766=0xc8;}else{_0x1fe766=0xce;}_0x1e79e2['status'](_0x1fe766);return _0x1e79e2[_0x94b1('0x31')]('Content-Range',_0x47f019+'-'+_0x42630a+'/'+_0xf621ea)[_0x94b1('0x2d')](_0x2eb1fa);}return null;};}function patchUpdates(_0x51d67c){return function(_0x57e497){try{jsonpatch[_0x94b1('0x32')](_0x57e497,_0x51d67c,!![]);}catch(_0x171d44){return BPromise[_0x94b1('0x33')](_0x171d44);}return _0x57e497[_0x94b1('0x34')]();};}function saveUpdates(_0x35b97c,_0x195514){return function(_0x26f33d){if(_0x26f33d){return _0x26f33d[_0x94b1('0x35')](_0x35b97c)[_0x94b1('0x20')](function(_0x18de6f){return _0x18de6f;});}return null;};}function removeEntity(_0x3cd875,_0xaff15e){return function(_0x500772){if(_0x500772){return _0x500772['destroy']()[_0x94b1('0x20')](function(){_0x3cd875[_0x94b1('0x2b')](0xcc)[_0x94b1('0x2c')]();});}};}function handleEntityNotFound(_0x2f5e6c,_0x2c7e43){return function(_0x2ba486){if(!_0x2ba486){_0x2f5e6c[_0x94b1('0x2a')](0x194);}return _0x2ba486;};}function handleError(_0x36a2f8,_0x4285dd){_0x4285dd=_0x4285dd||0x1f4;return function(_0x586eaa){logger[_0x94b1('0x27')](_0x586eaa['stack']);if(_0x586eaa[_0x94b1('0x36')]){delete _0x586eaa[_0x94b1('0x36')];}_0x36a2f8[_0x94b1('0x2b')](_0x4285dd)['send'](_0x586eaa);};}function getInteractionUsers(_0x357798,_0x21dd65){return new BPromise(function(_0x27c9e4,_0x5628eb){try{if(_0x21dd65[_0x357798['id']]){_0x357798[_0x94b1('0x37')]=_[_0x94b1('0x38')](_0x21dd65[_0x357798['id']],function(_0x1d4168){return{'id':_0x1d4168['id'],'fullname':_0x1d4168[_0x94b1('0x39')]};});}}catch(_0x3e5b02){_0x5628eb(_0x3e5b02);}_0x27c9e4(_0x357798);});}function getInteractionTags(_0x2e6fb9,_0x292964){return new BPromise(function(_0x127e6c,_0x737da9){try{if(_0x2e6fb9[_0x94b1('0x3a')]){_0x2e6fb9[_0x94b1('0x3b')]=[];_0x2e6fb9[_0x94b1('0x3a')][_0x94b1('0x3c')](',')['forEach'](function(_0x34b148){_0x2e6fb9[_0x94b1('0x3b')][_0x94b1('0x3d')](_0x292964[_0x34b148]);});}delete _0x2e6fb9[_0x94b1('0x3a')];}catch(_0x2e6d0f){_0x737da9(_0x2e6d0f);}_0x127e6c(_0x2e6fb9);});}function updateChatInteraction(_0x5c05c6,_0xc6732a,_0x158d1a){return new BPromise(function(_0x186575,_0x300747){return getInteractionUsers(_0x5c05c6,_0x158d1a)[_0x94b1('0x20')](function(_0x2c9398){return getInteractionTags(_0x2c9398,_0xc6732a);})['then'](function(_0x439323){_0x186575(_0x439323);})[_0x94b1('0x3e')](function(_0x592daa){_0x300747(_0x592daa);});});}exports[_0x94b1('0x3f')]=function(_0x19d4e4,_0x59311b){var _0x2c7359={},_0x442157={},_0x287bac={'count':0x0,'rows':[]};var _0x4b5068=_[_0x94b1('0x38')](db[_0x94b1('0x40')][_0x94b1('0x41')],function(_0xeb94e4){return{'name':_0xeb94e4[_0x94b1('0x42')],'type':_0xeb94e4[_0x94b1('0x43')][_0x94b1('0x44')]};});_0x442157['model']=_[_0x94b1('0x38')](_0x4b5068,_0x94b1('0x36'));_0x442157[_0x94b1('0x45')]=_['keys'](_0x19d4e4[_0x94b1('0x45')]);_0x442157[_0x94b1('0x46')]=_['intersection'](_0x442157[_0x94b1('0x47')],_0x442157[_0x94b1('0x45')]);_0x2c7359[_0x94b1('0x48')]=_[_0x94b1('0x49')](_0x442157[_0x94b1('0x47')],qs[_0x94b1('0x4a')](_0x19d4e4[_0x94b1('0x45')][_0x94b1('0x4a')]));_0x2c7359[_0x94b1('0x48')]=_0x2c7359[_0x94b1('0x48')][_0x94b1('0x4b')]?_0x2c7359[_0x94b1('0x48')]:_0x442157[_0x94b1('0x47')];if(!_0x19d4e4[_0x94b1('0x45')][_0x94b1('0x4c')](_0x94b1('0x4d'))){_0x2c7359[_0x94b1('0x30')]=qs[_0x94b1('0x30')](_0x19d4e4[_0x94b1('0x45')]['limit']);_0x2c7359[_0x94b1('0x2f')]=qs['offset'](_0x19d4e4[_0x94b1('0x45')][_0x94b1('0x2f')]);}_0x2c7359[_0x94b1('0x4e')]=qs['sort'](_0x19d4e4['query']['sort']);_0x2c7359[_0x94b1('0x4f')]=qs[_0x94b1('0x46')](_[_0x94b1('0x50')](_0x19d4e4['query'],_0x442157['filters']));var _0x4d2af3=[];var _0x227f50=squel[_0x94b1('0x51')]()[_0x94b1('0x52')]('id')[_0x94b1('0x52')](_0x94b1('0x36'))[_0x94b1('0x52')](_0x94b1('0x53'))['from'](_0x94b1('0x54'));var _0x1986af=squel[_0x94b1('0x51')]()[_0x94b1('0x52')](_0x94b1('0x55'))[_0x94b1('0x52')](_0x94b1('0x56'))[_0x94b1('0x52')](_0x94b1('0x57'))[_0x94b1('0x58')](_0x94b1('0x59'),'ui')[_0x94b1('0x5a')](_0x94b1('0x5b'),'u',_0x94b1('0x5c'));var _0x4c968d=squel[_0x94b1('0x51')]()[_0x94b1('0x58')](_0x94b1('0x5d'),'i')[_0x94b1('0x5a')](_0x94b1('0x5e'),'c',_0x94b1('0x5f'))[_0x94b1('0x5a')](_0x94b1('0x5b'),'o',_0x94b1('0x60'))['left_join'](_0x94b1('0x61'),'a',_0x94b1('0x62'))[_0x94b1('0x5a')](_0x94b1('0x63'),'me',_0x94b1('0x64'))[_0x94b1('0x5a')]('chat_interaction_has_tags','it',_0x94b1('0x65'))[_0x94b1('0x5a')](_0x94b1('0x54'),'t',_0x94b1('0x66'));var _0x240581=squel[_0x94b1('0x67')]();var _0x2d985e=[];var _0x15b80c=squel[_0x94b1('0x67')]();var _0x502d2c;if(_0x19d4e4['query'][_0x94b1('0x68')]){_0x502d2c=as[_0x94b1('0x69')](_0x19d4e4[_0x94b1('0x45')][_0x94b1('0x68')]);var _0x21caaa=_0x502d2c[_0x94b1('0x6a')];for(var _0x152a22=0x0;_0x152a22<_0x502d2c[_0x94b1('0x6b')][_0x94b1('0x4b')];_0x152a22++){var _0x65157d=_0x502d2c[_0x94b1('0x6b')][_0x152a22];var _0xacf1f4='i';var _0x4d22ac=_['find'](_0x4b5068,[_0x94b1('0x36'),_0x65157d[_0x94b1('0x52')]]);if(!_0x4d22ac){switch(_0x65157d[_0x94b1('0x52')]){case _0x94b1('0x6c'):if(_0x65157d[_0x94b1('0x6d')]==0x1){_0x4c968d['having']('`'+_0x65157d[_0x94b1('0x52')]+_0x94b1('0x6e'));}else{_0x4c968d[_0x94b1('0x6f')]('`'+_0x65157d[_0x94b1('0x52')]+_0x94b1('0x70'));}break;case'Contact':if(_0x65157d['operator']===_0x94b1('0x71')){if(_0x65157d[_0x94b1('0x6d')][_0x94b1('0x3c')]('\x20')['length']>0x1){_0x240581[_0x21caaa](_0x94b1('0x72'),qs[_0x94b1('0x73')](_0x65157d['value']),null);}else{var _0x5ee8a5='%'+_0x65157d[_0x94b1('0x6d')]+'%';_0x240581[_0x21caaa](_0x94b1('0x74'),_0x5ee8a5,_0x5ee8a5,_0x5ee8a5);}}else{_0x4d22ac=_[_0x94b1('0x75')](_0x4b5068,[_0x94b1('0x36'),_0x94b1('0x76')]);_0x65157d[_0x94b1('0x52')]=_0x94b1('0x76');_0x6b2878=as[_0x94b1('0x77')](_0xacf1f4,_0x4d22ac['type'],_0x65157d);_0x240581[_0x21caaa](_0x6b2878[_0x94b1('0x78')],_0x6b2878['value'][_0x94b1('0x79')],_0x6b2878[_0x94b1('0x6d')][_0x94b1('0x2c')]);}break;case'Tag':var _0x1b70b2=_0x65157d['value'][_0x94b1('0x3c')](',')[_0x94b1('0x38')](function(_0x137a37){return Number(_0x137a37);});_0x1b70b2[_0x94b1('0x7a')](function(_0x331682){_0x15b80c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x331682+',%');});_0x2d985e=_['union'](_0x2d985e,_0x1b70b2);break;case _0x94b1('0x7b'):if(_0x65157d[_0x94b1('0x7c')]===_0x94b1('0x71')){_0x240581[_0x21caaa](_0x94b1('0x7d'),'%'+_0x65157d[_0x94b1('0x6d')]+'%',null);}else{_0x4d22ac=_[_0x94b1('0x75')](_0x4b5068,[_0x94b1('0x36'),_0x94b1('0x7e')]);_0x65157d['field']='UserId';_0x6b2878=as[_0x94b1('0x77')](_0xacf1f4,_0x4d22ac['type'],_0x65157d);_0x240581[_0x21caaa](_0x6b2878[_0x94b1('0x78')],_0x6b2878['value'][_0x94b1('0x79')],_0x6b2878[_0x94b1('0x6d')][_0x94b1('0x2c')]);}break;case _0x94b1('0x7f'):_0x6b2878=as[_0x94b1('0x77')]('me',null,_0x65157d);_0x240581[_0x21caaa](_0x6b2878[_0x94b1('0x78')],_0x6b2878['value'][_0x94b1('0x79')],_0x6b2878[_0x94b1('0x6d')][_0x94b1('0x2c')]);break;}}else{var _0x6b2878=as[_0x94b1('0x77')](_0xacf1f4,_0x4d22ac[_0x94b1('0x43')],_0x65157d);_0x240581[_0x21caaa](_0x6b2878[_0x94b1('0x78')],_0x6b2878['value'][_0x94b1('0x79')],_0x6b2878[_0x94b1('0x6d')][_0x94b1('0x2c')]);}}}else{var _0xd40396=_(_0x19d4e4[_0x94b1('0x45')])[_0x94b1('0x80')]()[_0x94b1('0x38')](function(_0x4b5cf7){return _[_0x94b1('0x81')](_0x4b5068,['name',_0x4b5cf7])?_0x4b5cf7:undefined;})[_0x94b1('0x82')]()[_0x94b1('0x6d')]();if(!_[_0x94b1('0x83')](_0xd40396)){_0xd40396[_0x94b1('0x7a')](function(_0x47bc66){if(_0x47bc66==='ChatWebsiteId'){_0x4c968d[_0x94b1('0x4f')](_0x94b1('0x84'),[]['concat'](_0x19d4e4[_0x94b1('0x45')][_0x47bc66]));}else if(_0x47bc66===_0x94b1('0x85')){var _0xc57189=JSON['parse'](_0x19d4e4[_0x94b1('0x45')][_0x47bc66])[_0x94b1('0x86')];var _0x40874c=JSON[_0x94b1('0x87')](_0x19d4e4['query'][_0x47bc66])[_0x94b1('0x88')];_0x4c968d['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xc57189,_0x40874c);}else{if(_0x19d4e4['query'][_0x47bc66]===_0x94b1('0x89')){_0x4c968d[_0x94b1('0x4f')]('i.'+_0x47bc66+_0x94b1('0x8a'));}else{_0x4c968d['where']('i.'+_0x47bc66+'\x20=\x20?',_0x19d4e4['query'][_0x47bc66]);}}});}if(_0x19d4e4[_0x94b1('0x45')][_0x94b1('0x8b')]){if(_0x19d4e4['query']['read']==0x1){_0x4c968d['having'](_0x94b1('0x8c'));}else{_0x4c968d[_0x94b1('0x6f')](_0x94b1('0x8d'));}}if(_0x19d4e4[_0x94b1('0x45')]['tag']){_0x2d985e=_['isArray'](_0x19d4e4[_0x94b1('0x45')][_0x94b1('0x8e')])?_0x19d4e4[_0x94b1('0x45')][_0x94b1('0x8e')]:new Array(_0x19d4e4['query']['tag']);_0x2d985e['forEach'](function(_0x355543){_0x15b80c['or'](_0x94b1('0x8f'),'%,'+_0x355543+',%');});}if(_0x19d4e4[_0x94b1('0x45')][_0x94b1('0x90')]){var _0xa4dfd1=_0x19d4e4['query'][_0x94b1('0x90')][_0x94b1('0x91')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x94b1('0x92'));if(qs['isNumeric'](_0xa4dfd1)){_0x240581['or']('i.id\x20LIKE\x20?',_0xa4dfd1+'%');}else{_0x240581['or'](_0x94b1('0x93'),qs['getFullTextValue'](_0xa4dfd1))['or'](_0x94b1('0x94'),_0xa4dfd1+'%');}}}_0x4c968d[_0x94b1('0x4f')](_0x240581);_0x4c968d[_0x94b1('0x95')](_0x94b1('0x96'));var _0x219b5d={'type':db['Sequelize'][_0x94b1('0x97')]['SELECT'],'raw':!![]};var _0x101517=_0x4c968d[_0x94b1('0x98')]();_0x101517[_0x94b1('0x52')]('i.id');_0x101517[_0x94b1('0x52')](_0x94b1('0x99'),'unreadMessages');if(_0x2c7359['order']){_0x2c7359[_0x94b1('0x4e')][_0x94b1('0x7a')](function(_0x2a0d93){_0x4c968d[_0x94b1('0x4e')]('i.'+_0x2a0d93[0x0],_0x2a0d93[0x1]==='DESC'?![]:!![]);});}if(!_[_0x94b1('0x83')](_0x2d985e)){_0x4c968d['having'](_0x15b80c);_0x101517[_0x94b1('0x4f')]('t.id\x20IN\x20?',_0x2d985e);}BPromise[_0x94b1('0x9a')]()['then'](function(){if(!_0x502d2c){if(_0x19d4e4['query'][_0x94b1('0x9b')]||_0x19d4e4[_0x94b1('0x45')]['journey'])return;_0x101517[_0x94b1('0x4f')](_0x94b1('0x9c'));_0x4c968d[_0x94b1('0x4f')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}return _0x19d4e4[_0x94b1('0x9d')][_0x94b1('0x9e')]({'attributes':['id'],'raw':!![]})[_0x94b1('0x20')](function(_0x5d722e){if(_[_0x94b1('0x83')](_0x5d722e)){_0x101517['where']('i.ChatWebsiteId\x20IS\x20NULL');_0x4c968d[_0x94b1('0x4f')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x101517[_0x94b1('0x4f')]('i.ChatWebsiteId\x20IN\x20?',_[_0x94b1('0x38')](_0x5d722e,'id'));_0x4c968d['where'](_0x94b1('0x84'),_['map'](_0x5d722e,'id'));}});})[_0x94b1('0x20')](function(){db[_0x94b1('0x9f')][_0x94b1('0x45')](_0x101517[_0x94b1('0xa0')](),_0x219b5d)[_0x94b1('0x20')](function(_0xd11449){_0x287bac['count']=_0xd11449[_0x94b1('0x4b')];if(_0x287bac[_0x94b1('0x2e')]===0x0)return[];return db[_0x94b1('0x9f')][_0x94b1('0x45')](_0x227f50[_0x94b1('0xa0')](),_0x219b5d)[_0x94b1('0x20')](function(_0x5093d8){_0x4d2af3=_[_0x94b1('0xa1')](_0x5093d8,'id');_0x219b5d=_[_0x94b1('0xa2')](_0x219b5d,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x19d4e4[_0x94b1('0x45')][_0x94b1('0x4a')]){_0x2c7359[_0x94b1('0x48')][_0x94b1('0x7a')](function(_0x2d3c76){_0x4c968d[_0x94b1('0x52')]('i.'+_0x2d3c76);});}else{_0x4c968d[_0x94b1('0x52')](_0x94b1('0x99'),_0x94b1('0x6c'));_0x4c968d[_0x94b1('0x52')](_0x94b1('0xa3'),_0x94b1('0xa4'));_0x4c968d[_0x94b1('0x52')](_0x94b1('0xa5'),_0x94b1('0xa6'));_0x4c968d[_0x94b1('0x52')](_0x94b1('0xa7'));_0x4c968d[_0x94b1('0x52')](_0x94b1('0xa8'),_0x94b1('0xa9'));_0x4c968d[_0x94b1('0x52')](_0x94b1('0xaa'),_0x94b1('0xab'));_0x4c968d[_0x94b1('0x52')](_0x94b1('0xac'),_0x94b1('0xad'));_0x4c968d[_0x94b1('0x52')](_0x94b1('0xae'),_0x94b1('0xaf'));_0x4c968d[_0x94b1('0x52')](_0x94b1('0xb0'),_0x94b1('0xb1'));_0x4c968d['field'](_0x94b1('0xb2'),_0x94b1('0xb3'));_0x4c968d['field']('o.fullname',_0x94b1('0xb4'));_0x4c968d['field'](_0x94b1('0xb5'),'Owner.internal');_0x4c968d[_0x94b1('0x52')](_0x94b1('0xb6'),_0x94b1('0x3a'));}_0x4c968d['limit'](_0x2c7359['limit']);_0x4c968d[_0x94b1('0x2f')](_0x2c7359[_0x94b1('0x2f')]);return db[_0x94b1('0x9f')][_0x94b1('0x45')](_0x4c968d[_0x94b1('0xa0')](),_0x219b5d);})[_0x94b1('0x20')](function(_0x2ddfa6){_0x1986af['where'](_0x94b1('0xb7'),_[_0x94b1('0x38')](_0x2ddfa6,'id'));return db[_0x94b1('0x9f')][_0x94b1('0x45')](_0x1986af[_0x94b1('0xa0')](),_0x219b5d)[_0x94b1('0x20')](function(_0x516659){var _0x27267f=_[_0x94b1('0xb8')](_0x516659,'ChatInteractionId');var _0x22e08e=[];_0x2ddfa6[_0x94b1('0x7a')](function(_0x5ab0af){_0x22e08e[_0x94b1('0x3d')](updateChatInteraction(_0x5ab0af,_0x4d2af3,_0x27267f));});return BPromise[_0x94b1('0xb9')](_0x22e08e);});});})[_0x94b1('0x20')](function(_0x568ad6){_0x287bac[_0x94b1('0xba')]=_0x568ad6;return _0x287bac;})[_0x94b1('0x20')](respondWithFilteredResult(_0x59311b,_0x2c7359));})['catch'](handleError(_0x59311b,null));};exports['show']=function(_0x438cdb,_0x3d1e1e){var _0x26c84a={'raw':![],'where':{'id':_0x438cdb[_0x94b1('0xbb')]['id']}},_0x4e44c4={};_0x4e44c4[_0x94b1('0x47')]=_[_0x94b1('0x80')](db[_0x94b1('0x40')][_0x94b1('0x41')]);_0x4e44c4[_0x94b1('0x45')]=_['keys'](_0x438cdb[_0x94b1('0x45')]);_0x4e44c4[_0x94b1('0x46')]=_[_0x94b1('0x49')](_0x4e44c4[_0x94b1('0x47')],_0x4e44c4[_0x94b1('0x45')]);_0x26c84a['attributes']=_[_0x94b1('0x49')](_0x4e44c4['model'],qs['fields'](_0x438cdb[_0x94b1('0x45')][_0x94b1('0x4a')]));_0x26c84a[_0x94b1('0x48')]=_0x26c84a[_0x94b1('0x48')]['length']?_0x26c84a[_0x94b1('0x48')]:_0x4e44c4[_0x94b1('0x47')];if(_0x438cdb[_0x94b1('0x45')]['includeAll']){_0x26c84a[_0x94b1('0xbc')]=[{'all':!![]}];}_0x26c84a=_[_0x94b1('0xa2')]({},_0x26c84a,_0x438cdb[_0x94b1('0xbd')]);return db['ChatInteraction'][_0x94b1('0x75')](_0x26c84a)[_0x94b1('0x20')](handleEntityNotFound(_0x3d1e1e,null))['then'](respondWithResult(_0x3d1e1e,null))[_0x94b1('0x3e')](handleError(_0x3d1e1e,null));};exports[_0x94b1('0xbe')]=function(_0x13c0c3,_0x3923c5){return db[_0x94b1('0x40')]['create'](_0x13c0c3['body'],{})['then'](respondWithResult(_0x3923c5,0xc9))[_0x94b1('0x3e')](handleError(_0x3923c5,null));};exports[_0x94b1('0x35')]=function(_0x22202e,_0x5a4eb6){if(_0x22202e[_0x94b1('0x7f')]['id']){delete _0x22202e[_0x94b1('0x7f')]['id'];}return db[_0x94b1('0x40')][_0x94b1('0x75')]({'where':{'id':_0x22202e[_0x94b1('0xbb')]['id']}})[_0x94b1('0x20')](handleEntityNotFound(_0x5a4eb6,null))[_0x94b1('0x20')](saveUpdates(_0x22202e[_0x94b1('0x7f')],null))[_0x94b1('0x20')](respondWithResult(_0x5a4eb6,null))[_0x94b1('0x3e')](handleError(_0x5a4eb6,null));};exports['destroy']=function(_0x2254c6,_0x23f144){return db[_0x94b1('0x40')][_0x94b1('0x75')]({'where':{'id':_0x2254c6[_0x94b1('0xbb')]['id']}})[_0x94b1('0x20')](handleEntityNotFound(_0x23f144,null))[_0x94b1('0x20')](removeEntity(_0x23f144,null))[_0x94b1('0x3e')](handleError(_0x23f144,null));};exports[_0x94b1('0xbf')]=function(_0x4b6ae3,_0x5bd532){return db['ChatInteraction'][_0x94b1('0xbf')]()[_0x94b1('0x20')](respondWithResult(_0x5bd532,null))[_0x94b1('0x3e')](handleError(_0x5bd532,null));};exports[_0x94b1('0xc0')]=function(_0x51b24c,_0x1057de){if(_0x51b24c[_0x94b1('0x7f')]['id']){delete _0x51b24c[_0x94b1('0x7f')]['id'];}return db[_0x94b1('0x40')][_0x94b1('0x75')]({'where':{'id':_0x51b24c[_0x94b1('0xbb')]['id']}})['then'](handleEntityNotFound(_0x1057de,null))['then'](saveUpdates(_0x51b24c['body'],null))['then'](respondWithResult(_0x1057de,null))[_0x94b1('0x3e')](handleError(_0x1057de,null));};exports[_0x94b1('0xc1')]=function(_0x213bcd,_0x45ad88,_0x193aec){if(_0x213bcd[_0x94b1('0x7f')]['id']){delete _0x213bcd[_0x94b1('0x7f')]['id'];}return db[_0x94b1('0x40')]['find']({'where':{'id':_0x213bcd[_0x94b1('0xbb')]['id']}})[_0x94b1('0x20')](function(_0x175436){if(!_0x175436){logger['error'](_0x94b1('0xc2'),_0x94b1('0xc1'),0x194,_0x94b1('0xc3'));_0x45ad88[_0x94b1('0x2a')](0x194);}else{if(_0x175436[_0x94b1('0x7e')]){throw new db['Sequelize'][(_0x94b1('0x1d'))](_0x94b1('0xc4'));}}return _0x175436;})[_0x94b1('0x20')](function(_0x2f4211){if(_0x2f4211){return _0x2f4211[_0x94b1('0x35')]({'closed':_0x213bcd[_0x94b1('0x7f')][_0x94b1('0xc5')],'disposition':_0x213bcd[_0x94b1('0x7f')][_0x94b1('0xc6')]})[_0x94b1('0x20')](function(_0x51a3be){return _0x51a3be;});}})['then'](function(_0x848cf8){return respondWithRpcPromise(_0x94b1('0xc7'),_0x94b1('0xc1'),_0x213bcd[_0x94b1('0x7f')],client9004);})[_0x94b1('0x20')](respondWithResult(_0x45ad88,null))[_0x94b1('0x3e')](handleError(_0x45ad88,null));};exports['attachmentUpload']=function(_0x448480,_0x4dd54c,_0xafaac){_0x448480['body'][_0x94b1('0x36')]=_0x448480['file'][_0x94b1('0xc8')];_0x448480[_0x94b1('0x7f')][_0x94b1('0xc9')]=_0x448480['file'][_0x94b1('0xca')];_0x448480[_0x94b1('0x7f')][_0x94b1('0x43')]=_0x448480[_0x94b1('0xcb')][_0x94b1('0xcc')];return db['Attachment']['create'](_0x448480[_0x94b1('0x7f')])[_0x94b1('0x20')](respondWithResult(_0x4dd54c,0xc9))[_0x94b1('0x3e')](handleError(_0x4dd54c,null));};exports[_0x94b1('0xcd')]=function(_0x408933,_0x540d60,_0x5eead5){return db[_0x94b1('0x40')][_0x94b1('0xce')]({'where':{'id':_0x408933[_0x94b1('0xbb')]['id']},'raw':!![]})[_0x94b1('0x20')](handleEntityNotFound(_0x540d60,null))['then'](function(_0x560ca0){if(_0x560ca0){if(_0x560ca0[_0x94b1('0xc5')]){return _0x540d60[_0x94b1('0x2b')](0x193)['json']({'status':0x193,'message':_0x94b1('0xcf')});}return db[_0x94b1('0xd0')][_0x94b1('0xce')]({'where':{'id':_0x408933[_0x94b1('0x45')][_0x94b1('0xd1')]},'raw':!![]})['then'](handleEntityNotFound(_0x540d60,null));}})[_0x94b1('0x20')](function(_0x5e4296){if(_0x5e4296){return _0x540d60['download'](path[_0x94b1('0xd2')](config[_0x94b1('0xd3')],_0x94b1('0xd4'),_0x5e4296[_0x94b1('0xc9')]));}})[_0x94b1('0x3e')](handleError(_0x540d60,null));};exports[_0x94b1('0xd5')]=function(_0x4195a2,_0x3925f6){var _0x1bb516=null;var _0x4742f8=null;var _0x13a409=null;var _0x547c8a=null;if(_0x4195a2[_0x94b1('0x7f')]['id']){delete _0x4195a2['body']['id'];}if(_0x4195a2[_0x94b1('0x7f')][_0x94b1('0xd6')]){_0x547c8a=path[_0x94b1('0xd2')](config[_0x94b1('0xd3')],_0x94b1('0xd7'),util['format'](_0x94b1('0xd8'),Date[_0x94b1('0xd9')]()));_0x4195a2[_0x94b1('0x7f')][_0x94b1('0xda')]=_0x547c8a;}return db['ChatInteraction']['find']({'where':{'id':_0x4195a2[_0x94b1('0xbb')]['id']},'include':[{'model':db[_0x94b1('0xdb')],'as':_0x94b1('0xdc'),'include':[{'model':db['User'],'as':_0x94b1('0x7b')}]}]})[_0x94b1('0x20')](handleEntityNotFound(_0x3925f6,null))[_0x94b1('0x20')](saveUpdates(_0x4195a2[_0x94b1('0x7f')],null))[_0x94b1('0x20')](function(_0x2f495d){if(_0x2f495d){_0x1bb516=_0x2f495d;return db[_0x94b1('0xdd')][_0x94b1('0x75')]({'where':{'id':_0x1bb516[_0x94b1('0x9b')]}});}})['then'](function(_0x1a9d61){if(_0x1a9d61){_0x13a409=_0x1a9d61;return db['CmContact'][_0x94b1('0x75')]({'where':{'id':_0x1bb516['ContactId']}});}})[_0x94b1('0x20')](function(_0x1edb79){if(_0x1edb79){_0x4742f8=_0x1edb79;if(_0x547c8a){var _0x216789=null;for(var _0x452429=0x1;_0x452429<_0x1bb516[_0x94b1('0xdc')][_0x94b1('0x4b')];++_0x452429){_0x216789=_0x1bb516[_0x94b1('0xdc')][_0x452429];var _0x2d5543=_0x216789['UserId']?util['format']('%s%d',_0x13a409[_0x94b1('0xde')],_0x216789[_0x94b1('0x7e')]):_0x94b1('0xdf');var _0x4bae16=_0x4195a2[_0x94b1('0x7f')][_0x94b1('0xe0')]||util[_0x94b1('0xe1')](_0x94b1('0xe2'),_0x94b1('0xe3'),_0x216789['ContactId']);switch(_0x13a409[_0x94b1('0xe4')]){case _0x94b1('0xe5'):_0x2d5543=_0x216789[_0x94b1('0x7e')]?util[_0x94b1('0xe1')](_0x94b1('0xe2'),_0x13a409[_0x94b1('0xde')],_0x216789[_0x94b1('0x7e')]):_0x94b1('0xdf');break;case _0x94b1('0xe6'):_0x2d5543=_0x216789[_0x94b1('0x7e')]?_0x216789[_0x94b1('0x7b')][_0x94b1('0xe7')]||_0x216789[_0x94b1('0x7b')][_0x94b1('0x39')]:'System';break;case _0x94b1('0xe8'):_0x2d5543=_0x216789[_0x94b1('0x7e')]?_0x216789[_0x94b1('0x7b')][_0x94b1('0x39')]:_0x94b1('0xdf');break;default:_0x2d5543=_0x216789[_0x94b1('0x7e')]?util[_0x94b1('0xe1')](_0x94b1('0xe2'),_0x13a409[_0x94b1('0xde')],_0x216789[_0x94b1('0x7e')]):_0x94b1('0xdf');}var _0x4ebe4b=util[_0x94b1('0xe1')](_0x94b1('0xe9'),moment(_0x216789[_0x94b1('0x85')])['format'](_0x94b1('0xea')),_0x216789[_0x94b1('0xeb')]==='in'?_0x4bae16:_0x2d5543,_0x216789[_0x94b1('0x7f')]);if(!_0x216789[_0x94b1('0xec')]){fs['appendFileSync'](_0x547c8a,_0x4ebe4b);}}return db[_0x94b1('0xed')][_0x94b1('0xce')]({'where':{'service':!![]},'include':[{'model':db[_0x94b1('0xee')],'as':'Smtp','raw':!![]}]});}}})[_0x94b1('0x20')](function(_0x509f1a){if(_0x509f1a&&_0x509f1a[_0x94b1('0xef')]&&_0x4195a2[_0x94b1('0x7f')]){var _0x30522d={'tls':{'rejectUnauthorized':![]}};if(_0x509f1a[_0x94b1('0xef')][_0x94b1('0xf0')]){_0x30522d['service']=_0x509f1a[_0x94b1('0xef')][_0x94b1('0xf0')];}else{_0x30522d['host']=_0x509f1a[_0x94b1('0xef')]['host'];_0x30522d[_0x94b1('0xf1')]=_0x509f1a[_0x94b1('0xef')][_0x94b1('0xf1')];_0x30522d[_0x94b1('0xf2')]=_0x509f1a[_0x94b1('0xef')][_0x94b1('0xf2')];}if(_0x509f1a[_0x94b1('0xef')][_0x94b1('0xf3')]){_0x30522d['auth']={'user':_0x509f1a['Smtp'][_0x94b1('0x9d')],'pass':_0x509f1a[_0x94b1('0xef')]['pass']};}return respondWithRpcPromise(_0x94b1('0xf4'),'sendMail',{'account':_0x30522d,'message':{'from':util[_0x94b1('0xe1')]('\x22%s\x22\x20<%s>',_0x509f1a['name'],_0x509f1a['email']||_0x509f1a['Smtp'][_0x94b1('0x9d')]),'to':_0x4195a2['body'][_0x94b1('0xd6')],'subject':_0x94b1('0xf5'),'text':util[_0x94b1('0xe1')](_0x94b1('0xf6'),_0x4195a2['body'][_0x94b1('0xd6')]),'attachments':[{'path':_0x547c8a}]}})[_0x94b1('0x20')](function(){return _0x1bb516;})[_0x94b1('0x3e')](function(_0x112eab){console[_0x94b1('0x27')](_0x112eab);});}else{return _0x1bb516;}})['then'](respondWithStatusCode(_0x3925f6,0xc8))[_0x94b1('0x3e')](handleError(_0x3925f6,null));};exports['addMessage']=function(_0x2f4baf,_0x20830a,_0x221c40){return db[_0x94b1('0xdb')]['find']({'where':{'id':_0x2f4baf['params']['id']}})[_0x94b1('0x20')](handleEntityNotFound(_0x20830a,null))['then'](function(_0x460d4e){if(_0x460d4e){return _0x460d4e[_0x94b1('0xf7')](_0x2f4baf[_0x94b1('0x7f')]['ids'],_[_0x94b1('0xf8')](_0x2f4baf[_0x94b1('0x7f')],['ids','id'])||{});}})['then'](respondWithResult(_0x20830a,null))[_0x94b1('0x3e')](handleError(_0x20830a,null));};exports[_0x94b1('0xf9')]=function(_0x562b18,_0xd822e7,_0x35f198){var _0x2f2f21={'raw':![],'where':{}};var _0x23e4b3={};var _0x1a7888={'count':0x0,'rows':[]};return db[_0x94b1('0x40')][_0x94b1('0xce')]({'where':{'id':_0x562b18[_0x94b1('0xbb')]['id']}})[_0x94b1('0x20')](handleEntityNotFound(_0xd822e7,null))[_0x94b1('0x20')](function(_0x2dcf42){if(_0x2dcf42){_0x23e4b3[_0x94b1('0x47')]=_['keys'](db[_0x94b1('0xdb')]['rawAttributes']);_0x23e4b3[_0x94b1('0x45')]=_[_0x94b1('0x80')](_0x562b18[_0x94b1('0x45')]);_0x23e4b3[_0x94b1('0x46')]=_['intersection'](_0x23e4b3[_0x94b1('0x47')],_0x23e4b3[_0x94b1('0x45')]);_0x2f2f21['attributes']=_[_0x94b1('0x49')](_0x23e4b3[_0x94b1('0x47')],qs['fields'](_0x562b18[_0x94b1('0x45')]['fields']));_0x2f2f21[_0x94b1('0x48')]=_0x2f2f21['attributes'][_0x94b1('0x4b')]?_0x2f2f21[_0x94b1('0x48')]:_0x23e4b3[_0x94b1('0x47')];if(!_0x562b18[_0x94b1('0x45')][_0x94b1('0x4c')](_0x94b1('0x4d'))){_0x2f2f21['limit']=qs[_0x94b1('0x30')](_0x562b18[_0x94b1('0x45')]['limit']);_0x2f2f21[_0x94b1('0x2f')]=qs[_0x94b1('0x2f')](_0x562b18[_0x94b1('0x45')][_0x94b1('0x2f')]);}_0x2f2f21[_0x94b1('0x4e')]=qs[_0x94b1('0xfa')](_0x562b18[_0x94b1('0x45')][_0x94b1('0xfa')]);_0x2f2f21[_0x94b1('0x4f')]=qs[_0x94b1('0x46')](_[_0x94b1('0x50')](_0x562b18[_0x94b1('0x45')],_0x23e4b3[_0x94b1('0x46')]));_0x2f2f21[_0x94b1('0x4f')][_0x94b1('0xfb')]=_0x2dcf42['id'];if(_0x562b18['query'][_0x94b1('0x90')]){_0x2f2f21[_0x94b1('0x4f')]=_[_0x94b1('0xa2')](_0x2f2f21[_0x94b1('0x4f')],{'$or':_[_0x94b1('0x38')](_0x2f2f21[_0x94b1('0x48')],function(_0x3c847f){var _0x2af531={};_0x2af531[_0x3c847f]={'$like':'%'+_0x562b18['query'][_0x94b1('0x90')]+'%'};return _0x2af531;})});}if(_0x562b18[_0x94b1('0x45')][_0x94b1('0x86')]){var _0x206c71=_0x562b18[_0x94b1('0x45')][_0x94b1('0x86')][_0x94b1('0x3c')](',');var _0x51a884={};_0x51a884[_0x206c71[0x0]]={'$gte':moment(_0x206c71[0x1])[_0x94b1('0xe1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2f2f21[_0x94b1('0x4f')]=_['merge'](_0x2f2f21[_0x94b1('0x4f')],_0x51a884);}_0x2f2f21=_['merge']({},_0x2f2f21,_0x562b18['options']);return db[_0x94b1('0xdb')][_0x94b1('0x2e')]({'where':_0x2f2f21[_0x94b1('0x4f')]})[_0x94b1('0x20')](function(_0x40d853){_0x1a7888['count']=_0x40d853;if(_0x562b18[_0x94b1('0x45')][_0x94b1('0xfc')]){_0x2f2f21[_0x94b1('0xbc')]=[{'all':!![]}];}return db['ChatMessage'][_0x94b1('0xfd')](_0x2f2f21);})[_0x94b1('0x20')](function(_0x146dfc){_0x1a7888[_0x94b1('0xba')]=_0x146dfc;return _0x1a7888;});}})[_0x94b1('0x20')](respondWithFilteredResult(_0xd822e7,_0x2f2f21))[_0x94b1('0x3e')](handleError(_0xd822e7,null));};exports[_0x94b1('0xfe')]=function(_0x4ad7db,_0x285419,_0x1375e1){var _0x1f9bd1={'where':{}},_0x32d816={},_0x187582={'count':0x0,'rows':[]};return db[_0x94b1('0x40')][_0x94b1('0xce')]({'where':{'id':_0x4ad7db[_0x94b1('0xbb')]['id']}})['then'](handleEntityNotFound(_0x285419,null))[_0x94b1('0x20')](function(_0x5ddecc){if(_0x5ddecc){_0x32d816[_0x94b1('0x47')]=_[_0x94b1('0x80')](db[_0x94b1('0xdb')][_0x94b1('0x41')]);_0x32d816[_0x94b1('0x45')]=_[_0x94b1('0x80')](_0x4ad7db[_0x94b1('0x45')]);_0x32d816['filters']=_[_0x94b1('0x49')](_0x32d816[_0x94b1('0x47')],_0x32d816['query']);_0x1f9bd1[_0x94b1('0x48')]=_[_0x94b1('0x49')](_0x32d816[_0x94b1('0x47')],qs[_0x94b1('0x4a')](_0x4ad7db[_0x94b1('0x45')][_0x94b1('0x4a')]));_0x1f9bd1['attributes']=_0x1f9bd1[_0x94b1('0x48')][_0x94b1('0x4b')]?_0x1f9bd1['attributes']:_0x32d816[_0x94b1('0x47')];if(!_0x4ad7db[_0x94b1('0x45')][_0x94b1('0x4c')](_0x94b1('0x4d'))){_0x1f9bd1[_0x94b1('0x30')]=qs['limit'](_0x4ad7db['query'][_0x94b1('0x30')]);_0x1f9bd1['offset']=qs[_0x94b1('0x2f')](_0x4ad7db[_0x94b1('0x45')][_0x94b1('0x2f')]);}_0x1f9bd1[_0x94b1('0x4e')]=qs[_0x94b1('0xfa')](_0x4ad7db['query'][_0x94b1('0xfa')]);_0x1f9bd1[_0x94b1('0x4f')]=qs['filters'](_[_0x94b1('0x50')](_0x4ad7db['query'],_0x32d816[_0x94b1('0x46')]));_0x1f9bd1['where']['ChatInteractionId']=_0x5ddecc['id'];if(_0x4ad7db[_0x94b1('0x45')][_0x94b1('0x90')]){_0x1f9bd1[_0x94b1('0x4f')]=_[_0x94b1('0xa2')](_0x1f9bd1[_0x94b1('0x4f')],{'$or':_[_0x94b1('0x38')](_0x1f9bd1[_0x94b1('0x48')],function(_0x578013){var _0x3243db={};_0x3243db[_0x578013]={'$like':'%'+_0x4ad7db['query'][_0x94b1('0x90')]+'%'};return _0x3243db;})});}_0x1f9bd1[_0x94b1('0x4f')]['secret']=![];if(_0x4ad7db[_0x94b1('0x45')]['id']){_0x1f9bd1[_0x94b1('0x4f')]['id']={'$gt':_0x4ad7db[_0x94b1('0x45')]['id']};}_0x1f9bd1=_[_0x94b1('0xa2')]({},_0x1f9bd1,_0x4ad7db[_0x94b1('0xbd')]);return db[_0x94b1('0xdb')][_0x94b1('0x2e')]({'where':_0x1f9bd1['where']})[_0x94b1('0x20')](function(_0x659a05){_0x187582[_0x94b1('0x2e')]=_0x659a05;_0x1f9bd1[_0x94b1('0xbc')]=[];if(_0x4ad7db[_0x94b1('0x45')][_0x94b1('0xff')]){_0x1f9bd1['include'][_0x94b1('0x3d')]({'model':db[_0x94b1('0x7b')],'as':_0x94b1('0x7b'),'attributes':['id',_0x94b1('0x39'),'alias']});}if(_0x4ad7db['query'][_0x94b1('0xfc')]){_0x1f9bd1[_0x94b1('0xbc')]=[{'all':!![]}];}return db['ChatMessage'][_0x94b1('0xfd')](_0x1f9bd1);})[_0x94b1('0x20')](function(_0x23fb6e){_0x187582[_0x94b1('0xba')]=_0x23fb6e;return _0x187582;});}})[_0x94b1('0x20')](respondWithFilteredResult(_0x285419,_0x1f9bd1))[_0x94b1('0x3e')](handleError(_0x285419,null));};exports[_0x94b1('0x100')]=function(_0x268e4f,_0x4484cb,_0x17e886){return db[_0x94b1('0x40')][_0x94b1('0x75')]({'where':{'id':_0x268e4f[_0x94b1('0xbb')]['id']}})[_0x94b1('0x20')](handleEntityNotFound(_0x4484cb,null))[_0x94b1('0x20')](function(_0x4e5905){if(_0x4e5905){return _0x4e5905[_0x94b1('0x101')](_0x268e4f[_0x94b1('0x7f')][_0x94b1('0x102')],_['omit'](_0x268e4f[_0x94b1('0x7f')],[_0x94b1('0x102'),'id'])||{})['spread'](function(){return db[_0x94b1('0x103')]['findAll']({'attributes':['id','name',_0x94b1('0x53')],'where':{'id':_0x268e4f[_0x94b1('0x7f')][_0x94b1('0x102')]}});})[_0x94b1('0x20')](function(_0x5c7caa){socket[_0x94b1('0x104')]('chatInteractionTags:save',{'id':Number(_0x268e4f[_0x94b1('0xbb')]['id']),'tags':_0x5c7caa||[]});return{'id':Number(_0x268e4f['params']['id']),'tags':_0x5c7caa||[]};});}})['then'](respondWithResult(_0x4484cb,null))['catch'](handleError(_0x4484cb,null));};exports[_0x94b1('0x105')]=function(_0x27baab,_0x23ab4a,_0x5b16f8){return db[_0x94b1('0x40')][_0x94b1('0x75')]({'where':{'id':_0x27baab[_0x94b1('0xbb')]['id']}})[_0x94b1('0x20')](handleEntityNotFound(_0x23ab4a,null))[_0x94b1('0x20')](function(_0x223fd1){if(_0x223fd1){return _0x223fd1[_0x94b1('0x105')](_0x27baab[_0x94b1('0x45')]['ids']);}})[_0x94b1('0x20')](respondWithStatusCode(_0x23ab4a,null))['catch'](handleError(_0x23ab4a,null));};exports[_0x94b1('0x106')]=function(_0xbe4ab5,_0x10d28f){var _0x400b07=moment()[_0x94b1('0x107')]()[_0x94b1('0xa0')]();var _0x2e1cbe=path[_0x94b1('0xd2')](config[_0x94b1('0xd3')],'server',_0x94b1('0x108'),_0x94b1('0x109'));var _0x4beaa8=path[_0x94b1('0xd2')](config[_0x94b1('0xd3')],'server',_0x94b1('0x108'),_0x94b1('0x10a'));var _0x36b436=path[_0x94b1('0xd2')](_0x2e1cbe,_0x400b07);var _0x1f0de4=util[_0x94b1('0xe1')](_0x94b1('0x10b'),_0xbe4ab5[_0x94b1('0xbb')]['id'],_0x400b07);var _0x16136d=path[_0x94b1('0xd2')](_0x2e1cbe,_0x1f0de4);var _0x25a28b=[];_0x25a28b[_0x94b1('0x3d')]({'model':db[_0x94b1('0x7b')],'as':'User','attributes':['id',_0x94b1('0x39')],'raw':!![]});_0x25a28b[_0x94b1('0x3d')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x94b1('0x10c'),_0x94b1('0x10d')],'raw':!![]});if(_0xbe4ab5[_0x94b1('0x45')][_0x94b1('0x10a')]){_0x25a28b[_0x94b1('0x3d')]({'model':db[_0x94b1('0xd0')],'as':'Attachment','raw':!![]});}var _0x3dd722=[{'model':db['ChatMessage'],'as':_0x94b1('0xdc'),'attributes':['id',_0x94b1('0x7f'),_0x94b1('0x85'),'direction',_0x94b1('0xec'),_0x94b1('0x8b')],'include':_0x25a28b}];_0x3dd722['push']({'model':db[_0x94b1('0xdd')],'as':_0x94b1('0x10e'),'attributes':['id',_0x94b1('0x36')]});_0x3dd722[_0x94b1('0x3d')]({'model':db[_0x94b1('0x7b')],'as':_0x94b1('0x10f'),'attributes':['id',_0x94b1('0x39')]});return db['ChatInteraction'][_0x94b1('0x75')]({'where':{'id':_0xbe4ab5['params']['id']},'include':_0x3dd722})[_0x94b1('0x20')](handleEntityNotFound(_0x10d28f,null))['then'](function(_0x2d4863){if(_0x2d4863){var _0x527204=_0x2d4863[_0x94b1('0x110')]({'plain':!![]});fs[_0x94b1('0x111')](_0x36b436);var _0x252c8f={'format':'A4','border':_0x94b1('0x112'),'header':{'height':_0x94b1('0x113'),'contents':{'first':_0x94b1('0x114')}},'footer':{'height':_0x94b1('0x115'),'contents':{'default':util[_0x94b1('0xe1')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0x94b1('0xe1')](_0x94b1('0x116'),_0x94b1('0x117'),_0x527204['id']),moment()['format'](_0x94b1('0x118'))[_0x94b1('0xa0')]())}}};var _0x1046b8={'channel':_0x94b1('0x117'),'account':_0x527204[_0x94b1('0x10e')][_0x94b1('0x36')],'agent':_0x527204[_0x94b1('0x10f')]?_0x527204['Owner']['fullname']:_0x94b1('0x119'),'createdAt':moment(_0x527204[_0x94b1('0x85')])[_0x94b1('0xe1')](_0x94b1('0x11a'))[_0x94b1('0xa0')](),'closedAt':_0x527204[_0x94b1('0xc5')]?moment(_0x527204[_0x94b1('0x11b')])[_0x94b1('0xe1')](_0x94b1('0x11a'))[_0x94b1('0xa0')]():'','disposition':_0x527204[_0x94b1('0xc6')],'chatInfo':{'browser':_0x527204[_0x94b1('0x11c')],'os':_0x527204['osName'],'referer':_0x527204['referer'],'customerIp':_0x527204[_0x94b1('0x11d')],'customerPort':_0x527204['customerPort']?_0x527204['customerPort']:_0x94b1('0x119')},'messages':_(_0x527204[_0x94b1('0xdc')])[_0x94b1('0x11e')]()[_0x94b1('0x90')]({'secret':![]})[_0x94b1('0x38')](function(_0x1bed17){if(_0x1bed17[_0x94b1('0xd0')]){var _0x136ac3=path[_0x94b1('0xd2')](_0x4beaa8,_0x1bed17['Attachment']['basename']);if(fs[_0x94b1('0x11f')](_0x136ac3)){fs[_0x94b1('0x120')](_0x136ac3)[_0x94b1('0x121')](fs['createWriteStream'](path[_0x94b1('0xd2')](_0x36b436,_0x1bed17['Attachment'][_0x94b1('0xc9')])));}}return{'date':moment(_0x1bed17[_0x94b1('0x85')])['format'](_0x94b1('0x11a'))['toString'](),'sender':_0x1bed17[_0x94b1('0xeb')]===_0x94b1('0x122')?_0x1bed17[_0x94b1('0x7b')]?_0x1bed17[_0x94b1('0x7b')][_0x94b1('0x39')]:_0x94b1('0xdf'):_0x1bed17[_0x94b1('0x123')][_0x94b1('0x10c')]+(_0x1bed17['Contact']['lastName']?'\x20'+_0x1bed17[_0x94b1('0x123')][_0x94b1('0x10d')]:''),'body':_0x1bed17[_0x94b1('0xd0')]?_0x1bed17[_0x94b1('0xd0')][_0x94b1('0xc9')]:_0x1bed17[_0x94b1('0x7f')],'direction':_0x1bed17[_0x94b1('0xeb')]==='out'?'A':'C','secret':_0x1bed17['secret'],'read':_0x1bed17[_0x94b1('0x8b')],'attachment':_0x1bed17['Attachment']};})['value']()};return ejs['renderFile'](path[_0x94b1('0xd2')](config[_0x94b1('0xd3')],_0x94b1('0x124'),_0x94b1('0x125'),_0x94b1('0x126')),{'interaction':_0x1046b8})['then'](function(_0x42fdec){return new BPromise(function(_0x49e927,_0x4fa504){pdf['create'](_0x42fdec,_0x252c8f)[_0x94b1('0x127')](path[_0x94b1('0xd2')](_0x36b436,_0x94b1('0x128')+_0x527204['id']+'-'+_0x400b07+_0x94b1('0x129')),function(_0x46eecd,_0x376f68){if(_0x46eecd)return _0x4fa504(_0x46eecd);_0x49e927(_0x376f68);});});})[_0x94b1('0x20')](function(){return new BPromise(function(_0x39958f,_0xbc244b){zipdir(_0x36b436,{'saveTo':_0x16136d},function(_0x6ee6d2,_0x267a44){if(_0x6ee6d2)return _0xbc244b(_0x6ee6d2);return _0x39958f(_0x267a44);});})[_0x94b1('0x20')](function(){return new BPromise(function(_0x64e990,_0xeeef69){rimraf(_0x36b436,function(_0x5d0ddd){if(_0x5d0ddd)_0xeeef69(_0x5d0ddd);return _0x64e990();});});})[_0x94b1('0x20')](function(){return _0x10d28f[_0x94b1('0x106')](_0x16136d,_0x1f0de4,function(_0x3bee5e){if(_0x3bee5e){console[_0x94b1('0x12a')]('err',_0x3bee5e);}else{fs[_0x94b1('0x12b')](_0x16136d);}});});});}else{return _0x10d28f[_0x94b1('0x2a')](0xc8);}})[_0x94b1('0x3e')](handleError(_0x10d28f,null));}; \ No newline at end of file +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 diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 8cea8b9..5168c90 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 _0x0a9c=['update','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hook','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x0a9c,0x181));var _0xc0a9=function(_0x1808e7,_0x42c8f3){_0x1808e7=_0x1808e7-0x0;var _0x5de455=_0x0a9c[_0x1808e7];return _0x5de455;};'use strict';var EventEmitter=require(_0xc0a9('0x0'));var ChatInteraction=require(_0xc0a9('0x1'))['db'][_0xc0a9('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0xc0a9('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xc0a9('0x4')](0x0);var events={'afterCreate':_0xc0a9('0x5'),'afterUpdate':_0xc0a9('0x6'),'afterDestroy':'remove'};function emitEvent(_0x5bd751){return function(_0x142e44,_0x1595c9,_0x571df1){_0x142e44[_0xc0a9('0x7')]({'attributes':['id'],'raw':!![]})[_0xc0a9('0x8')](function(_0x3937a0){_0x142e44[_0xc0a9('0x9')](_0xc0a9('0xa'),_0x3937a0['map'](function(_0x2e2f72){return{'id':_0x2e2f72['id']};}));return ChatMessage[_0xc0a9('0xb')]({'where':{'ChatInteractionId':_0x142e44['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc0a9('0x8')](function(_0x3da5c4){_0x142e44['setDataValue'](_0xc0a9('0xc'),_0x3da5c4[_0xc0a9('0xd')]);ChatInteractionEvents[_0xc0a9('0xe')](_0x5bd751+':'+_0x142e44['id'],_0x142e44);ChatInteractionEvents[_0xc0a9('0xe')](_0x5bd751,_0x142e44);_0x571df1(null);})[_0xc0a9('0xf')](_0x571df1(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0xc0a9('0x10')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +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 diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index ed284ee..6d23e7d 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 _0xddec=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','request-promise','rimraf','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','changed','closed','closedAt','format'];(function(_0x31be28,_0x598de7){var _0x4d23f2=function(_0x53828e){while(--_0x53828e){_0x31be28['push'](_0x31be28['shift']());}};_0x4d23f2(++_0x598de7);}(_0xddec,0xd3));var _0xcdde=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xddec[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xcdde('0x0'));var util=require(_0xcdde('0x1'));var logger=require(_0xcdde('0x2'))('api');var moment=require(_0xcdde('0x3'));var BPromise=require('bluebird');var rp=require(_0xcdde('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcdde('0x5'));var config=require('../../config/environment');var attributes=require(_0xcdde('0x6'));module[_0xcdde('0x7')]=function(_0x171ff3,_0x342303){return _0x171ff3['define'](_0xcdde('0x8'),attributes,{'tableName':_0xcdde('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xe7e5ed,_0x2acef3,_0x1a3096){if(_0xe7e5ed[_0xcdde('0xa')](_0xcdde('0xb'))){_0xe7e5ed[_0xcdde('0xc')]=moment()[_0xcdde('0xd')](_0xcdde('0xe'));}_0x1a3096(null,_0xe7e5ed);}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +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 diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index bf4c3f2..a4f7f4b 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 _0xccaf=['ChatInteraction,\x20%s,\x20%s','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','AddTagsToChatInteraction','find','addTags','omit','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','./chatInteraction.socket','register','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x510de5,_0x1ac5d6){var _0x48df9e=function(_0x51b4a9){while(--_0x51b4a9){_0x510de5['push'](_0x510de5['shift']());}};_0x48df9e(++_0x1ac5d6);}(_0xccaf,0x1b7));var _0xfcca=function(_0x1ca29f,_0x318ac5){_0x1ca29f=_0x1ca29f-0x0;var _0x576c3b=_0xccaf[_0x1ca29f];return _0x576c3b;};'use strict';var _=require(_0xfcca('0x0'));var util=require(_0xfcca('0x1'));var moment=require('moment');var BPromise=require(_0xfcca('0x2'));var rs=require(_0xfcca('0x3'));var fs=require('fs');var Redis=require(_0xfcca('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfcca('0x5'));var logger=require(_0xfcca('0x6'))(_0xfcca('0x7'));var config=require(_0xfcca('0x8'));var jayson=require(_0xfcca('0x9'));var client=jayson['client'][_0xfcca('0xa')]({'port':0x232a});config[_0xfcca('0xb')]=_['defaults'](config[_0xfcca('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfcca('0xb')]));require(_0xfcca('0xc'))[_0xfcca('0xd')](socket);function respondWithRpcPromise(_0x14de9b,_0xb3b963,_0x2744ea){return new BPromise(function(_0x562aa3,_0x8e6242){return client[_0xfcca('0xe')](_0x14de9b,_0x2744ea)[_0xfcca('0xf')](function(_0x324b39){logger[_0xfcca('0x10')]('ChatInteraction,\x20%s,\x20%s',_0xb3b963,_0xfcca('0x11'));logger[_0xfcca('0x12')](_0xfcca('0x13'),_0xb3b963,'request\x20sent',JSON[_0xfcca('0x14')](_0x324b39));if(_0x324b39[_0xfcca('0x15')]){if(_0x324b39[_0xfcca('0x15')][_0xfcca('0x16')]===0x1f4){logger['error'](_0xfcca('0x17'),_0xb3b963,_0x324b39[_0xfcca('0x15')]['message']);return _0x8e6242(_0x324b39['error'][_0xfcca('0x18')]);}logger['error'](_0xfcca('0x17'),_0xb3b963,_0x324b39[_0xfcca('0x15')][_0xfcca('0x18')]);return _0x562aa3(_0x324b39[_0xfcca('0x15')]['message']);}else{logger['info'](_0xfcca('0x17'),_0xb3b963,_0xfcca('0x11'));_0x562aa3(_0x324b39[_0xfcca('0x19')][_0xfcca('0x18')]);}})[_0xfcca('0x1a')](function(_0x2c07bd){logger[_0xfcca('0x15')]('ChatInteraction,\x20%s,\x20%s',_0xb3b963,_0x2c07bd);_0x8e6242(_0x2c07bd);});});}exports[_0xfcca('0x1b')]=function(_0x10be5f){var _0x3728a0=this;return new Promise(function(_0x1b5601,_0x98a5e1){return db[_0xfcca('0x1c')][_0xfcca('0x1d')](_0x10be5f[_0xfcca('0x1e')],{'raw':_0x10be5f[_0xfcca('0x1f')]?_0x10be5f[_0xfcca('0x1f')][_0xfcca('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10be5f['options']?_0x10be5f[_0xfcca('0x1f')][_0xfcca('0x21')]||null:null,'attributes':_0x10be5f['options']?_0x10be5f['options'][_0xfcca('0x22')]||null:null,'limit':_0x10be5f['options']?_0x10be5f['options']['limit']||null:null})['then'](function(_0x56b20b){logger[_0xfcca('0x10')](_0xfcca('0x1b'),_0x10be5f);logger['debug'](_0xfcca('0x1b'),_0x10be5f,JSON[_0xfcca('0x14')](_0x56b20b));_0x1b5601(_0x56b20b);})['catch'](function(_0x30dc47){logger[_0xfcca('0x15')](_0xfcca('0x1b'),_0x30dc47[_0xfcca('0x18')],_0x10be5f);_0x98a5e1(_0x3728a0['error'](0x1f4,_0x30dc47[_0xfcca('0x18')]));});});};exports[_0xfcca('0x23')]=function(_0x1d4ec3){return new Promise(function(_0x179f69,_0x3b39a6){return db[_0xfcca('0x1c')][_0xfcca('0x24')]({'where':_0x1d4ec3[_0xfcca('0x1f')]?_0x1d4ec3[_0xfcca('0x1f')][_0xfcca('0x21')]||null:null})['then'](function(_0x21bb0c){if(_0x21bb0c){return _0x21bb0c[_0xfcca('0x25')](_0x1d4ec3[_0xfcca('0x1e')]['ids'],_[_0xfcca('0x26')](_0x1d4ec3[_0xfcca('0x1e')],[_0xfcca('0x27'),'id'])||{});}})[_0xfcca('0x28')](function(_0x5ebe57){logger['info']('AddTags',_0x1d4ec3);logger[_0xfcca('0x12')](_0xfcca('0x29'),_0x1d4ec3,JSON['stringify'](_0x5ebe57));_0x179f69(_0x5ebe57);})['catch'](function(_0x157911){logger['error'](_0xfcca('0x29'),_0x157911[_0xfcca('0x18')],_0x1d4ec3);_0x3b39a6(_this[_0xfcca('0x15')](0x1f4,_0x157911[_0xfcca('0x18')]));});});}; \ No newline at end of file +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 diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 8e4d4ad..3c7705e 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 _0xc087=['chatInteraction:','./chatInteraction.events','save','update','emit','removeListener','register','length'];(function(_0x48852f,_0x5e9ac0){var _0x442640=function(_0x2a11c4){while(--_0x2a11c4){_0x48852f['push'](_0x48852f['shift']());}};_0x442640(++_0x5e9ac0);}(_0xc087,0x1f1));var _0x7c08=function(_0x2c96f6,_0x877207){_0x2c96f6=_0x2c96f6-0x0;var _0x6d4808=_0xc087[_0x2c96f6];return _0x6d4808;};'use strict';var ChatInteractionEvents=require(_0x7c08('0x0'));var events=[_0x7c08('0x1'),'remove',_0x7c08('0x2')];function createListener(_0x2a2f9d,_0x1b5b98){return function(_0x40e271){_0x1b5b98[_0x7c08('0x3')](_0x2a2f9d,_0x40e271);};}function removeListener(_0x1e4a4b,_0x5109fb){return function(){ChatInteractionEvents[_0x7c08('0x4')](_0x1e4a4b,_0x5109fb);};}exports[_0x7c08('0x5')]=function(_0x5c7676){for(var _0xce3d9e=0x0,_0x1367bf=events[_0x7c08('0x6')];_0xce3d9e<_0x1367bf;_0xce3d9e++){var _0x47ec82=events[_0xce3d9e];var _0x1f0ad9=createListener(_0x7c08('0x7')+_0x47ec82,_0x5c7676);ChatInteractionEvents['on'](_0x47ec82,_0x1f0ad9);}}; \ No newline at end of file +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 diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 2a20028..976263e 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 _0x8a58=['Router','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chatinteraction:addtags','addTags','put','chat','chatinteraction:update','update','customUpdate','/:id/abandon','abandon','/:id/close','delete','removeTags','util','path','express'];(function(_0x16a764,_0x33ca9d){var _0x389df7=function(_0x350168){while(--_0x350168){_0x16a764['push'](_0x16a764['shift']());}};_0x389df7(++_0x33ca9d);}(_0x8a58,0xfc));var _0x88a5=function(_0x1dbd91,_0xed2f59){_0x1dbd91=_0x1dbd91-0x0;var _0xd2f56e=_0x8a58[_0x1dbd91];return _0xd2f56e;};'use strict';var multer=require('multer');var util=require(_0x88a5('0x0'));var path=require(_0x88a5('0x1'));var timeout=require('connect-timeout');var express=require(_0x88a5('0x2'));var router=express[_0x88a5('0x3')]();var auth=require(_0x88a5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x88a5('0x5'));var controller=require(_0x88a5('0x6'));router[_0x88a5('0x7')]('/',auth[_0x88a5('0x8')](),controller[_0x88a5('0x9')]);router[_0x88a5('0x7')](_0x88a5('0xa'),auth[_0x88a5('0x8')](),controller[_0x88a5('0xb')]);router[_0x88a5('0x7')](_0x88a5('0xc'),auth[_0x88a5('0xd')](),controller['show']);router['get'](_0x88a5('0xe'),auth[_0x88a5('0xd')](),controller['attachmentDownload']);router[_0x88a5('0x7')](_0x88a5('0xf'),auth[_0x88a5('0x8')](),controller[_0x88a5('0x10')]);router['get'](_0x88a5('0x11'),auth[_0x88a5('0xd')](),controller[_0x88a5('0x12')]);router[_0x88a5('0x7')](_0x88a5('0x13'),auth[_0x88a5('0x8')](),controller[_0x88a5('0x14')]);router[_0x88a5('0x15')]('/',auth['isAuthenticated'](),controller[_0x88a5('0x16')]);var upload=multer({'storage':multer[_0x88a5('0x17')]({'destination':function(_0x16e342,_0x3740d3,_0xaa3106){_0xaa3106(null,path[_0x88a5('0x18')](config[_0x88a5('0x19')],_0x88a5('0x1a')));},'filename':function(_0x41d6f9,_0x234d89,_0x2fadbc){_0x2fadbc(null,util[_0x88a5('0x1b')](_0x88a5('0x1c'),Date[_0x88a5('0x1d')](),_0x234d89[_0x88a5('0x1e')][_0x88a5('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x88a5('0x15')](_0x88a5('0x20'),upload[_0x88a5('0x21')](_0x88a5('0x22')),controller[_0x88a5('0x23')]);router[_0x88a5('0x15')](_0x88a5('0xf'),auth[_0x88a5('0xd')](),controller[_0x88a5('0x24')]);router[_0x88a5('0x15')](_0x88a5('0x25'),auth[_0x88a5('0x8')](),interaction[_0x88a5('0x26')]('chat',_0x88a5('0x27')),controller[_0x88a5('0x28')]);router[_0x88a5('0x29')](_0x88a5('0xc'),auth['isAuthenticated'](),interaction[_0x88a5('0x26')](_0x88a5('0x2a'),_0x88a5('0x2b')),controller[_0x88a5('0x2c')]);router[_0x88a5('0x29')]('/:id/custom_update',controller[_0x88a5('0x2d')]);router[_0x88a5('0x29')](_0x88a5('0x2e'),auth['isChatInteractionAuthorized'](),controller[_0x88a5('0x2f')]);router[_0x88a5('0x29')](_0x88a5('0x30'),controller['close']);router[_0x88a5('0x31')](_0x88a5('0xc'),auth[_0x88a5('0x8')](),interaction[_0x88a5('0x26')](_0x88a5('0x2a'),'chatinteraction:destroy'),controller['destroy']);router[_0x88a5('0x31')](_0x88a5('0x25'),auth[_0x88a5('0x8')](),controller[_0x88a5('0x32')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 015a75f..666cdd2 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.attributes.js +++ b/server/api/chatInternalMessage/chatInternalMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['INTEGER','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x2876c8,_0x560e0f){var _0x3972f0=function(_0x3ca514){while(--_0x3ca514){_0x2876c8['push'](_0x2876c8['shift']());}};_0x3972f0(++_0x560e0f);}(_0x5f2f,0x73));var _0xf5f2=function(_0xbe8994,_0x543cd7){_0xbe8994=_0xbe8994-0x0;var _0x1f2d34=_0x5f2f[_0xbe8994];return _0x1f2d34;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xf5f2('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xf5f2('0x5')]}}; \ No newline at end of file +var _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 diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 9cde8b6..f101281 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 _0x570d=['get','messages','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','User','agent','admin','user','role','userpic','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','UserProfileSection','Agents','userProfileId','autoAssociation','isEmpty','push','createdAt','FromId','ToId','read','-createdAt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./chatInternalMessage.socket','register','sendStatus','status','end','json','count','offset','limit','apply','reject','save','then','destroy','error','stack','name','send','ChatInternalMessage','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','catch','params','create','body','update','find','describe'];(function(_0x2820b2,_0x283c16){var _0x52c515=function(_0x141239){while(--_0x141239){_0x2820b2['push'](_0x2820b2['shift']());}};_0x52c515(++_0x283c16);}(_0x570d,0xee));var _0xd570=function(_0xf7bf02,_0x13da13){_0xf7bf02=_0xf7bf02-0x0;var _0x4f263f=_0x570d[_0xf7bf02];return _0x4f263f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd570('0x0'));var rimraf=require(_0xd570('0x1'));var zipdir=require(_0xd570('0x2'));var jsonpatch=require(_0xd570('0x3'));var rp=require(_0xd570('0x4'));var moment=require(_0xd570('0x5'));var BPromise=require(_0xd570('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd570('0x7'));var sox=require(_0xd570('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xd570('0x9'));var squel=require('squel');var crypto=require(_0xd570('0xa'));var jsforce=require(_0xd570('0xb'));var deskjs=require(_0xd570('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd570('0xd'));var Papa=require(_0xd570('0xe'));var Redis=require(_0xd570('0xf'));var authService=require(_0xd570('0x10'));var qs=require(_0xd570('0x11'));var as=require(_0xd570('0x12'));var hardwareService=require(_0xd570('0x13'));var logger=require(_0xd570('0x14'))(_0xd570('0x15'));var utils=require(_0xd570('0x16'));var config=require('../../config/environment');var db=require(_0xd570('0x17'))['db'];config[_0xd570('0x18')]=_[_0xd570('0x19')](config[_0xd570('0x18')],{'host':_0xd570('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd570('0x1b'))[_0xd570('0x1c')](socket);function respondWithStatusCode(_0x1049f2,_0x5ea8c8){_0x5ea8c8=_0x5ea8c8||0xcc;return function(_0x166fdc){if(_0x166fdc){return _0x1049f2[_0xd570('0x1d')](_0x5ea8c8);}return _0x1049f2[_0xd570('0x1e')](_0x5ea8c8)[_0xd570('0x1f')]();};}function respondWithResult(_0x2e9133,_0x32e24d){_0x32e24d=_0x32e24d||0xc8;return function(_0x49fa6f){if(_0x49fa6f){return _0x2e9133[_0xd570('0x1e')](_0x32e24d)[_0xd570('0x20')](_0x49fa6f);}};}function respondWithFilteredResult(_0x384b57,_0x1362c8){return function(_0x1b2fbc){if(_0x1b2fbc){var _0x3a2870=_0x1b2fbc[_0xd570('0x21')],_0x53cbf7=_0x1362c8[_0xd570('0x22')],_0x3e05c6=_0x1362c8['offset']+_0x1362c8[_0xd570('0x23')],_0x1e831d;if(_0x3e05c6>=_0x3a2870){_0x3e05c6=_0x3a2870;_0x1e831d=0xc8;}else{_0x1e831d=0xce;}_0x384b57[_0xd570('0x1e')](_0x1e831d);return _0x384b57['set']('Content-Range',_0x53cbf7+'-'+_0x3e05c6+'/'+_0x3a2870)[_0xd570('0x20')](_0x1b2fbc);}return null;};}function patchUpdates(_0x436d02){return function(_0x40267f){try{jsonpatch[_0xd570('0x24')](_0x40267f,_0x436d02,!![]);}catch(_0x24596d){return BPromise[_0xd570('0x25')](_0x24596d);}return _0x40267f[_0xd570('0x26')]();};}function saveUpdates(_0x20cc31,_0x4eb5f1){return function(_0x5b4d4c){if(_0x5b4d4c){return _0x5b4d4c['update'](_0x20cc31)[_0xd570('0x27')](function(_0x339679){return _0x339679;});}return null;};}function removeEntity(_0x1d52dd,_0x16760a){return function(_0x31e908){if(_0x31e908){return _0x31e908[_0xd570('0x28')]()['then'](function(){_0x1d52dd[_0xd570('0x1e')](0xcc)[_0xd570('0x1f')]();});}};}function handleEntityNotFound(_0x565315,_0x458b76){return function(_0x37975c){if(!_0x37975c){_0x565315[_0xd570('0x1d')](0x194);}return _0x37975c;};}function handleError(_0x4ccf3a,_0x3ad07f){_0x3ad07f=_0x3ad07f||0x1f4;return function(_0x14e987){logger[_0xd570('0x29')](_0x14e987[_0xd570('0x2a')]);if(_0x14e987[_0xd570('0x2b')]){delete _0x14e987[_0xd570('0x2b')];}_0x4ccf3a[_0xd570('0x1e')](_0x3ad07f)[_0xd570('0x2c')](_0x14e987);};}exports['index']=function(_0x2f8418,_0x3cf9cc){var _0x5f2358={},_0x43c437={},_0x11620a={'count':0x0,'rows':[]};var _0x7ad63d=_['map'](db[_0xd570('0x2d')][_0xd570('0x2e')],function(_0x718d52){return{'name':_0x718d52[_0xd570('0x2f')],'type':_0x718d52[_0xd570('0x30')][_0xd570('0x31')]};});_0x43c437[_0xd570('0x32')]=_[_0xd570('0x33')](_0x7ad63d,_0xd570('0x2b'));_0x43c437[_0xd570('0x34')]=_[_0xd570('0x35')](_0x2f8418['query']);_0x43c437['filters']=_[_0xd570('0x36')](_0x43c437[_0xd570('0x32')],_0x43c437['query']);_0x5f2358[_0xd570('0x37')]=_['intersection'](_0x43c437['model'],qs[_0xd570('0x38')](_0x2f8418[_0xd570('0x34')]['fields']));_0x5f2358[_0xd570('0x37')]=_0x5f2358['attributes'][_0xd570('0x39')]?_0x5f2358['attributes']:_0x43c437[_0xd570('0x32')];if(!_0x2f8418['query'][_0xd570('0x3a')](_0xd570('0x3b'))){_0x5f2358[_0xd570('0x23')]=qs[_0xd570('0x23')](_0x2f8418['query'][_0xd570('0x23')]);_0x5f2358[_0xd570('0x22')]=qs[_0xd570('0x22')](_0x2f8418[_0xd570('0x34')][_0xd570('0x22')]);}_0x5f2358[_0xd570('0x3c')]=qs['sort'](_0x2f8418[_0xd570('0x34')][_0xd570('0x3d')]);_0x5f2358[_0xd570('0x3e')]=qs['filters'](_['pick'](_0x2f8418[_0xd570('0x34')],_0x43c437[_0xd570('0x3f')]));if(_0x2f8418['query'][_0xd570('0x40')]){_0x5f2358[_0xd570('0x3e')]=_['merge'](_0x5f2358[_0xd570('0x3e')],{'$or':_['map'](_0x7ad63d,function(_0x3ace08){if(_0x3ace08[_0xd570('0x30')]!=='VIRTUAL'){var _0x2ede59={};_0x2ede59[_0x3ace08[_0xd570('0x2b')]]={'$like':'%'+_0x2f8418[_0xd570('0x34')][_0xd570('0x40')]+'%'};return _0x2ede59;}})});}_0x5f2358=_[_0xd570('0x41')]({},_0x5f2358,_0x2f8418[_0xd570('0x42')]);var _0x5ba082={'where':_0x5f2358[_0xd570('0x3e')]};return db['ChatInternalMessage']['count'](_0x5ba082)['then'](function(_0x45fd98){_0x11620a['count']=_0x45fd98;if(_0x2f8418[_0xd570('0x34')][_0xd570('0x43')]){_0x5f2358[_0xd570('0x44')]=[{'all':!![]}];}return db[_0xd570('0x2d')][_0xd570('0x45')](_0x5f2358);})['then'](function(_0x358374){_0x11620a['rows']=_0x358374;return _0x11620a;})['then'](respondWithFilteredResult(_0x3cf9cc,_0x5f2358))[_0xd570('0x46')](handleError(_0x3cf9cc,null));};exports['show']=function(_0x14899b,_0x41bb8f){var _0x1b3ba2={'raw':!![],'where':{'id':_0x14899b[_0xd570('0x47')]['id']}},_0x2a5dec={};_0x2a5dec['model']=_[_0xd570('0x35')](db[_0xd570('0x2d')]['rawAttributes']);_0x2a5dec['query']=_[_0xd570('0x35')](_0x14899b[_0xd570('0x34')]);_0x2a5dec[_0xd570('0x3f')]=_['intersection'](_0x2a5dec[_0xd570('0x32')],_0x2a5dec[_0xd570('0x34')]);_0x1b3ba2[_0xd570('0x37')]=_[_0xd570('0x36')](_0x2a5dec[_0xd570('0x32')],qs['fields'](_0x14899b[_0xd570('0x34')][_0xd570('0x38')]));_0x1b3ba2[_0xd570('0x37')]=_0x1b3ba2['attributes'][_0xd570('0x39')]?_0x1b3ba2[_0xd570('0x37')]:_0x2a5dec['model'];if(_0x14899b['query'][_0xd570('0x43')]){_0x1b3ba2[_0xd570('0x44')]=[{'all':!![]}];}_0x1b3ba2=_[_0xd570('0x41')]({},_0x1b3ba2,_0x14899b['options']);return db['ChatInternalMessage']['find'](_0x1b3ba2)[_0xd570('0x27')](handleEntityNotFound(_0x41bb8f,null))[_0xd570('0x27')](respondWithResult(_0x41bb8f,null))[_0xd570('0x46')](handleError(_0x41bb8f,null));};exports[_0xd570('0x48')]=function(_0x2a2d98,_0x95848c){return db[_0xd570('0x2d')][_0xd570('0x48')](_0x2a2d98[_0xd570('0x49')],{})['then'](respondWithResult(_0x95848c,0xc9))[_0xd570('0x46')](handleError(_0x95848c,null));};exports[_0xd570('0x4a')]=function(_0x1795b1,_0x4d78d3){if(_0x1795b1[_0xd570('0x49')]['id']){delete _0x1795b1['body']['id'];}return db[_0xd570('0x2d')][_0xd570('0x4b')]({'where':{'id':_0x1795b1[_0xd570('0x47')]['id']}})[_0xd570('0x27')](handleEntityNotFound(_0x4d78d3,null))[_0xd570('0x27')](saveUpdates(_0x1795b1[_0xd570('0x49')],null))[_0xd570('0x27')](respondWithResult(_0x4d78d3,null))['catch'](handleError(_0x4d78d3,null));};exports[_0xd570('0x28')]=function(_0x54b8a8,_0x246047){return db[_0xd570('0x2d')]['find']({'where':{'id':_0x54b8a8[_0xd570('0x47')]['id']}})[_0xd570('0x27')](handleEntityNotFound(_0x246047,null))['then'](removeEntity(_0x246047,null))[_0xd570('0x46')](handleError(_0x246047,null));};exports['describe']=function(_0x378ac6,_0xef2240){return db[_0xd570('0x2d')][_0xd570('0x4c')]()[_0xd570('0x27')](respondWithResult(_0xef2240,null))[_0xd570('0x46')](handleError(_0xef2240,null));};function wrapUser(_0x2fcc4c){return function(_0x53003c){var _0x57139d=_0x2fcc4c[_0xd570('0x4d')]({'plain':!![]});_0x57139d[_0xd570('0x4e')]=[];if(_0x53003c){_0x57139d[_0xd570('0x4f')]=_0x53003c['createdAt'];_0x57139d[_0xd570('0x50')]=_0x53003c;}else{_0x57139d['lastMessageAt']=moment(0x0)[_0xd570('0x51')](_0xd570('0x52'));_0x57139d[_0xd570('0x50')]={};}return _0x57139d;};}exports['getUsers']=function(_0x13462a,_0x4dc2b6,_0x31580f){var _0x3b8ccb=[];return db[_0xd570('0x53')][_0xd570('0x45')]({'where':{'role':[_0xd570('0x54'),_0xd570('0x55'),_0xd570('0x56')]},'attributes':['id','fullname',_0xd570('0x2b'),_0xd570('0x57'),_0xd570('0x58'),'internal',_0xd570('0x59'),_0xd570('0x5a'),_0xd570('0x5b'),_0xd570('0x5c')],'order':qs[_0xd570('0x3d')]('-online'),'include':[{'model':db[_0xd570('0x5d')],'as':'VoiceQueues','attributes':['id',_0xd570('0x2b'),_0xd570('0x30')],'through':{'attributes':[]}}]})[_0xd570('0x27')](function(_0x22bf33){if(_0x22bf33){var _0x19f4aa=_0x13462a[_0xd570('0x56')][_0xd570('0x4d')]({'plain':!![]});if(!_0x19f4aa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x19f4aa['role']==='user'){return db[_0xd570('0x5e')][_0xd570('0x4b')]({'where':{'name':_0xd570('0x5f'),'userProfileId':_0x19f4aa[_0xd570('0x60')]},'raw':!![]})[_0xd570('0x27')](function(_0x560f6f){if(_0x560f6f){if(_0x560f6f[_0xd570('0x61')]===0x0){return db['UserProfileResource'][_0xd570('0x45')]({'where':{'sectionId':_0x560f6f['id']},'raw':!![]})[_0xd570('0x27')](function(_0x3ce2ba){var _0x94e7ba=[];if(_[_0xd570('0x62')](_0x3ce2ba)){_0x94e7ba=_[_0xd570('0x40')](_0x22bf33,function(_0x1ceee1){if(_0x1ceee1[_0xd570('0x57')]!==_0xd570('0x54')){return _0x1ceee1;}});return _0x94e7ba;}else{for(var _0x23e3e5=0x0;_0x23e3e5<_0x22bf33[_0xd570('0x39')];_0x23e3e5++){var _0x3cc598=_0x22bf33[_0x23e3e5];if(_0x3cc598['role']===_0xd570('0x54')){var _0x301573=_[_0xd570('0x4b')](_0x3ce2ba,function(_0x376173){return _0x376173['resourceId']===_0x3cc598['id'];});if(_0x301573)_0x94e7ba[_0xd570('0x63')](_0x3cc598);}else{_0x94e7ba['push'](_0x3cc598);}}return _0x94e7ba;}});}else{return _0x22bf33;}}else{var _0x4ec7c3=_['filter'](_0x22bf33,function(_0x46df4a){if(_0x46df4a[_0xd570('0x57')]!==_0xd570('0x54')){return _0x46df4a;}});return _0x4ec7c3;}});}else{return _0x22bf33;}}})['then'](function(_0x1ded8c){var _0x5067d3=[];if(_0x1ded8c){_0x3b8ccb=_0x1ded8c;for(var _0x51d4d8=0x0;_0x51d4d8<_0x1ded8c[_0xd570('0x39')];_0x51d4d8+=0x1){_0x3b8ccb[_0x51d4d8]['messages']=[];_0x5067d3['push'](db[_0xd570('0x2d')][_0xd570('0x4b')]({'where':{'FromId':[_0x13462a[_0xd570('0x56')]['id'],_0x1ded8c[_0x51d4d8]['id']],'ToId':[_0x13462a['user']['id'],_0x1ded8c[_0x51d4d8]['id']],'ChatGroupId':null},'attributes':['id',_0xd570('0x64'),_0xd570('0x65'),_0xd570('0x66'),_0xd570('0x67'),_0xd570('0x49')],'order':qs[_0xd570('0x3d')](_0xd570('0x68')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xd570('0x27')](wrapUser(_0x1ded8c[_0x51d4d8])));}return BPromise['all'](_0x5067d3);}return[];})['then'](function(_0x4d0ff1){return{'rows':_0x4d0ff1,'count':_0x4d0ff1['length']};})['then'](respondWithResult(_0x4dc2b6,null))['catch'](handleError(_0x4dc2b6,null));}; \ No newline at end of file +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 diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index ebc8416..5bfaa0e 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 _0x177a=['remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','update'];(function(_0x11b639,_0xbeca94){var _0x11c068=function(_0x28842c){while(--_0x28842c){_0x11b639['push'](_0x11b639['shift']());}};_0x11c068(++_0xbeca94);}(_0x177a,0xdd));var _0xa177=function(_0x147afe,_0x31ee18){_0x147afe=_0x147afe-0x0;var _0x44b16c=_0x177a[_0x147afe];return _0x44b16c;};'use strict';var EventEmitter=require(_0xa177('0x0'));var ChatInternalMessage=require('../../mysqldb')['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xa177('0x1')](0x0);var events={'afterCreate':_0xa177('0x2'),'afterUpdate':_0xa177('0x3'),'afterDestroy':_0xa177('0x4')};function emitEvent(_0x4275db){return function(_0x471a81,_0x5ce1ad,_0x243aee){ChatInternalMessageEvents[_0xa177('0x5')](_0x4275db+':'+_0x471a81['id'],_0x471a81);ChatInternalMessageEvents[_0xa177('0x5')](_0x4275db,_0x471a81);_0x243aee(null);};}for(var e in events){if(events[_0xa177('0x6')](e)){var event=events[e];ChatInternalMessage[_0xa177('0x7')](e,emitEvent(event));}}module[_0xa177('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +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 diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index a5c70bb..1705eee 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 _0xbaf0=['define','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','exports'];(function(_0x31f60b,_0x15cbdf){var _0x1d81be=function(_0x4af3e9){while(--_0x4af3e9){_0x31f60b['push'](_0x31f60b['shift']());}};_0x1d81be(++_0x15cbdf);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'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':!![],'charset':'utf8mb4','collate':_0x0baf('0xd')});}; \ No newline at end of file +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 diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 126ddf6..4fd362c 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 _0x1018=['stringify','error','code','message','ChatInternalMessage,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','then','info','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x9f1d45,_0x3ed644){var _0x22e96c=function(_0x42d49e){while(--_0x42d49e){_0x9f1d45['push'](_0x9f1d45['shift']());}};_0x22e96c(++_0x3ed644);}(_0x1018,0xa9));var _0x8101=function(_0x3e4079,_0x7d0dbe){_0x3e4079=_0x3e4079-0x0;var _0x23a68a=_0x1018[_0x3e4079];return _0x23a68a;};'use strict';var _=require(_0x8101('0x0'));var util=require(_0x8101('0x1'));var moment=require(_0x8101('0x2'));var BPromise=require('bluebird');var rs=require(_0x8101('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8101('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8101('0x5'))(_0x8101('0x6'));var config=require(_0x8101('0x7'));var jayson=require(_0x8101('0x8'));var client=jayson[_0x8101('0x9')][_0x8101('0xa')]({'port':0x232a});config[_0x8101('0xb')]=_[_0x8101('0xc')](config[_0x8101('0xb')],{'host':_0x8101('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8101('0xb')]));require('./chatInternalMessage.socket')[_0x8101('0xe')](socket);function respondWithRpcPromise(_0x5079e6,_0x16aab8,_0x226d92){return new BPromise(function(_0x1b8b8a,_0x163904){return client['request'](_0x5079e6,_0x226d92)[_0x8101('0xf')](function(_0x2edd48){logger[_0x8101('0x10')]('ChatInternalMessage,\x20%s,\x20%s',_0x16aab8,'request\x20sent');logger[_0x8101('0x11')](_0x8101('0x12'),_0x16aab8,_0x8101('0x13'),JSON[_0x8101('0x14')](_0x2edd48));if(_0x2edd48[_0x8101('0x15')]){if(_0x2edd48[_0x8101('0x15')][_0x8101('0x16')]===0x1f4){logger[_0x8101('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x16aab8,_0x2edd48['error'][_0x8101('0x17')]);return _0x163904(_0x2edd48[_0x8101('0x15')][_0x8101('0x17')]);}logger['error'](_0x8101('0x18'),_0x16aab8,_0x2edd48[_0x8101('0x15')][_0x8101('0x17')]);return _0x1b8b8a(_0x2edd48[_0x8101('0x15')][_0x8101('0x17')]);}else{logger[_0x8101('0x10')](_0x8101('0x18'),_0x16aab8,'request\x20sent');_0x1b8b8a(_0x2edd48[_0x8101('0x19')]['message']);}})[_0x8101('0x1a')](function(_0x41f312){logger['error'](_0x8101('0x18'),_0x16aab8,_0x41f312);_0x163904(_0x41f312);});});} \ No newline at end of file +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 diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index d5acf7f..09735de 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 _0xa4de=['update','emit','removeListener','register','chatInternalMessage:','./chatInternalMessage.events'];(function(_0xa60ead,_0x15cffc){var _0xd0c34=function(_0x19268f){while(--_0x19268f){_0xa60ead['push'](_0xa60ead['shift']());}};_0xd0c34(++_0x15cffc);}(_0xa4de,0x10d));var _0xea4d=function(_0x4d0ebd,_0x17ab0b){_0x4d0ebd=_0x4d0ebd-0x0;var _0x594e9c=_0xa4de[_0x4d0ebd];return _0x594e9c;};'use strict';var ChatInternalMessageEvents=require(_0xea4d('0x0'));var events=['save','remove',_0xea4d('0x1')];function createListener(_0x2857a3,_0xf1af92){return function(_0x3ee016){_0xf1af92[_0xea4d('0x2')](_0x2857a3,_0x3ee016);};}function removeListener(_0x111a9e,_0x23785){return function(){ChatInternalMessageEvents[_0xea4d('0x3')](_0x111a9e,_0x23785);};}exports[_0xea4d('0x4')]=function(_0x24d5fe){for(var _0x604a6a=0x0,_0x2af8a5=events['length'];_0x604a6a<_0x2af8a5;_0x604a6a++){var _0x12d0bb=events[_0x604a6a];var _0x4f98e8=createListener(_0xea4d('0x5')+_0x12d0bb,_0x24d5fe);ChatInternalMessageEvents['on'](_0x12d0bb,_0x4f98e8);}}; \ No newline at end of file +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 diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index dc746e7..80f182f 100644 --- a/server/api/chatInternalMessage/index.js +++ b/server/api/chatInternalMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','describe','/users','isAuthenticated','getUsers','/:id','post','create','put','update','delete','destroy'];(function(_0x2598b3,_0x1cc0a8){var _0x55607f=function(_0x3b37fd){while(--_0x3b37fd){_0x2598b3['push'](_0x2598b3['shift']());}};_0x55607f(++_0x1cc0a8);}(_0x70e0,0x17b));var _0x070e=function(_0x239142,_0x23ebf6){_0x239142=_0x239142-0x0;var _0x219c6e=_0x70e0[_0x239142];return _0x219c6e;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var auth=require(_0x070e('0x4'));var interaction=require(_0x070e('0x5'));var config=require(_0x070e('0x6'));var controller=require('./chatInternalMessage.controller');router[_0x070e('0x7')]('/',auth['isAuthenticated'](),controller[_0x070e('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x070e('0x9')]);router[_0x070e('0x7')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0xc')]);router[_0x070e('0x7')](_0x070e('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x070e('0xe')]('/',auth[_0x070e('0xb')](),controller[_0x070e('0xf')]);router[_0x070e('0x10')](_0x070e('0xd'),controller[_0x070e('0x11')]);router[_0x070e('0x12')](_0x070e('0xd'),auth[_0x070e('0xb')](),controller[_0x070e('0x13')]);module[_0x070e('0x14')]=router; \ No newline at end of file +var _0xe706=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_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 diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index d7ae0fb..deeecdf 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 _0xda8f=['ENUM','out','DATE','sequelize','TEXT','medium','BOOLEAN'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xda8f,0x96));var _0xfda8=function(_0x2ceeb9,_0x128600){_0x2ceeb9=_0x2ceeb9-0x0;var _0x125647=_0xda8f[_0x2ceeb9];return _0x125647;};'use strict';var Sequelize=require(_0xfda8('0x0'));module['exports']={'body':{'type':Sequelize[_0xfda8('0x1')](_0xfda8('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xfda8('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xfda8('0x4')]('in',_0xfda8('0x5')),'defaultValue':_0xfda8('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xfda8('0x6')]}}; \ No newline at end of file +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 diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 3e02668..cab03c2 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 _0x6c95=['limit','set','apply','save','destroy','name','send','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filters','where','merge','VIRTUAL','options','ChatMessage','includeAll','show','params','include','find','create','body','update','chat-interactions','accept','chat','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','ChatInteraction','ChatInteractionId','read1stAt','format','interaction','role','AcceptMessage','acceptMessage','interface','channel','event','EventManager','acceptmessage','parse','formData','reject','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','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','socket.io-emitter','./chatMessage.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','info','ChatMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset'];(function(_0x38bca0,_0x3ddc99){var _0x5e11b3=function(_0x3c5699){while(--_0x3c5699){_0x38bca0['push'](_0x38bca0['shift']());}};_0x5e11b3(++_0x3ddc99);}(_0x6c95,0x19e));var _0x56c9=function(_0x420c58,_0x7c601c){_0x420c58=_0x420c58-0x0;var _0x23cd58=_0x6c95[_0x420c58];return _0x23cd58;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x56c9('0x0'));var rimraf=require(_0x56c9('0x1'));var zipdir=require(_0x56c9('0x2'));var jsonpatch=require(_0x56c9('0x3'));var rp=require(_0x56c9('0x4'));var moment=require('moment');var BPromise=require(_0x56c9('0x5'));var Mustache=require(_0x56c9('0x6'));var util=require('util');var path=require(_0x56c9('0x7'));var sox=require(_0x56c9('0x8'));var csv=require(_0x56c9('0x9'));var ejs=require(_0x56c9('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x56c9('0xb'));var deskjs=require(_0x56c9('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x56c9('0xd'));var Redis=require(_0x56c9('0xe'));var authService=require(_0x56c9('0xf'));var qs=require(_0x56c9('0x10'));var as=require(_0x56c9('0x11'));var hardwareService=require(_0x56c9('0x12'));var logger=require('../../config/logger')(_0x56c9('0x13'));var utils=require(_0x56c9('0x14'));var config=require(_0x56c9('0x15'));var db=require(_0x56c9('0x16'))['db'];config[_0x56c9('0x17')]=_[_0x56c9('0x18')](config[_0x56c9('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x56c9('0x19'))(new Redis(config[_0x56c9('0x17')]));require(_0x56c9('0x1a'))[_0x56c9('0x1b')](socket);var jayson=require(_0x56c9('0x1c'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x56c9('0x1d')][_0x56c9('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x782e89,_0x35f96e,_0xe9e1b1){if(_0xe9e1b1){var _0x3b7bec=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3b7bec['test'](_0x35f96e)){return _0x782e89;}else{throw new db[(_0x56c9('0x1f'))]['ValidationError'](_0x56c9('0x20'));}}else{return _0x782e89;}}function respondWithRpcPromise(_0x73a12f,_0x20322c,_0x3460a7,_0x596843){return new BPromise(function(_0x5adaeb,_0x4fcb0b){var _0x51abf7=_0x596843||client;return _0x51abf7[_0x56c9('0x21')](_0x73a12f,_0x3460a7)[_0x56c9('0x22')](function(_0x386da6){logger[_0x56c9('0x23')](_0x56c9('0x24'),_0x20322c,_0x56c9('0x25'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x20322c,_0x56c9('0x25'),JSON[_0x56c9('0x26')](_0x386da6));if(_0x386da6[_0x56c9('0x27')]){if(_0x386da6['error'][_0x56c9('0x28')]===0x1f4){logger[_0x56c9('0x27')]('ChatMessage,\x20%s,\x20%s',_0x20322c,_0x386da6[_0x56c9('0x27')][_0x56c9('0x29')]);return _0x4fcb0b(_0x386da6[_0x56c9('0x27')][_0x56c9('0x29')]);}logger['error'](_0x56c9('0x24'),_0x20322c,_0x386da6[_0x56c9('0x27')][_0x56c9('0x29')]);return _0x5adaeb(_0x386da6[_0x56c9('0x27')][_0x56c9('0x29')]);}else{logger[_0x56c9('0x23')]('ChatMessage,\x20%s,\x20%s',_0x20322c,_0x56c9('0x25'));_0x5adaeb(_0x386da6[_0x56c9('0x2a')][_0x56c9('0x29')]);}})[_0x56c9('0x2b')](function(_0x4e12b2){logger[_0x56c9('0x27')](_0x56c9('0x24'),_0x20322c,_0x4e12b2);_0x4fcb0b(_0x4e12b2);});});}function respondWithStatusCode(_0x3b9d2d,_0x50a682){_0x50a682=_0x50a682||0xcc;return function(_0x3a1ff5){if(_0x3a1ff5){return _0x3b9d2d[_0x56c9('0x2c')](_0x50a682);}return _0x3b9d2d[_0x56c9('0x2d')](_0x50a682)[_0x56c9('0x2e')]();};}function respondWithResult(_0x293605,_0x5530ca){_0x5530ca=_0x5530ca||0xc8;return function(_0x114f0d){if(_0x114f0d){return _0x293605['status'](_0x5530ca)[_0x56c9('0x2f')](_0x114f0d);}};}function respondWithFilteredResult(_0x240ea8,_0xdb9c46){return function(_0x5b1add){if(_0x5b1add){var _0x995a2e=_0x5b1add[_0x56c9('0x30')],_0x2bc171=_0xdb9c46[_0x56c9('0x31')],_0xa851dd=_0xdb9c46[_0x56c9('0x31')]+_0xdb9c46[_0x56c9('0x32')],_0x13f73f;if(_0xa851dd>=_0x995a2e){_0xa851dd=_0x995a2e;_0x13f73f=0xc8;}else{_0x13f73f=0xce;}_0x240ea8[_0x56c9('0x2d')](_0x13f73f);return _0x240ea8[_0x56c9('0x33')]('Content-Range',_0x2bc171+'-'+_0xa851dd+'/'+_0x995a2e)[_0x56c9('0x2f')](_0x5b1add);}return null;};}function patchUpdates(_0x404b5a){return function(_0x725680){try{jsonpatch[_0x56c9('0x34')](_0x725680,_0x404b5a,!![]);}catch(_0x2a2c82){return BPromise['reject'](_0x2a2c82);}return _0x725680[_0x56c9('0x35')]();};}function saveUpdates(_0x3fdbe5,_0x247db1){return function(_0x3ac277){if(_0x3ac277){return _0x3ac277['update'](_0x3fdbe5)[_0x56c9('0x22')](function(_0x5d754d){return _0x5d754d;});}return null;};}function removeEntity(_0x4fa988,_0x36165e){return function(_0x28bbe5){if(_0x28bbe5){return _0x28bbe5[_0x56c9('0x36')]()['then'](function(){_0x4fa988['status'](0xcc)[_0x56c9('0x2e')]();});}};}function handleEntityNotFound(_0x142fe5,_0x150ada){return function(_0xb7c487){if(!_0xb7c487){_0x142fe5[_0x56c9('0x2c')](0x194);}return _0xb7c487;};}function handleError(_0x342a92,_0x321c85){_0x321c85=_0x321c85||0x1f4;return function(_0x77a58e){logger[_0x56c9('0x27')](_0x77a58e['stack']);if(_0x77a58e[_0x56c9('0x37')]){delete _0x77a58e[_0x56c9('0x37')];}_0x342a92[_0x56c9('0x2d')](_0x321c85)[_0x56c9('0x38')](_0x77a58e);};}exports['index']=function(_0xe45a43,_0x1d323b){var _0x58fac9={},_0x13ef81={},_0x448c84={'count':0x0,'rows':[]};var _0x3263f0=_['map'](db['ChatMessage'][_0x56c9('0x39')],function(_0x58fd26){return{'name':_0x58fd26[_0x56c9('0x3a')],'type':_0x58fd26[_0x56c9('0x3b')][_0x56c9('0x3c')]};});_0x13ef81['model']=_[_0x56c9('0x3d')](_0x3263f0,_0x56c9('0x37'));_0x13ef81[_0x56c9('0x3e')]=_[_0x56c9('0x3f')](_0xe45a43['query']);_0x13ef81['filters']=_[_0x56c9('0x40')](_0x13ef81[_0x56c9('0x41')],_0x13ef81['query']);_0x58fac9[_0x56c9('0x42')]=_[_0x56c9('0x40')](_0x13ef81[_0x56c9('0x41')],qs[_0x56c9('0x43')](_0xe45a43[_0x56c9('0x3e')]['fields']));_0x58fac9[_0x56c9('0x42')]=_0x58fac9[_0x56c9('0x42')][_0x56c9('0x44')]?_0x58fac9[_0x56c9('0x42')]:_0x13ef81['model'];if(!_0xe45a43[_0x56c9('0x3e')][_0x56c9('0x45')]('nolimit')){_0x58fac9[_0x56c9('0x32')]=qs[_0x56c9('0x32')](_0xe45a43[_0x56c9('0x3e')][_0x56c9('0x32')]);_0x58fac9[_0x56c9('0x31')]=qs[_0x56c9('0x31')](_0xe45a43[_0x56c9('0x3e')]['offset']);}_0x58fac9[_0x56c9('0x46')]=qs[_0x56c9('0x47')](_0xe45a43[_0x56c9('0x3e')][_0x56c9('0x47')]);_0x58fac9['where']=qs[_0x56c9('0x48')](_['pick'](_0xe45a43[_0x56c9('0x3e')],_0x13ef81['filters']));if(_0xe45a43['query']['filter']){_0x58fac9[_0x56c9('0x49')]=_[_0x56c9('0x4a')](_0x58fac9[_0x56c9('0x49')],{'$or':_[_0x56c9('0x3d')](_0x3263f0,function(_0xc1bce2){if(_0xc1bce2[_0x56c9('0x3b')]!==_0x56c9('0x4b')){var _0x3e5a51={};_0x3e5a51[_0xc1bce2[_0x56c9('0x37')]]={'$like':'%'+_0xe45a43['query']['filter']+'%'};return _0x3e5a51;}})});}_0x58fac9=_[_0x56c9('0x4a')]({},_0x58fac9,_0xe45a43[_0x56c9('0x4c')]);var _0x3b984c={'where':_0x58fac9[_0x56c9('0x49')]};return db[_0x56c9('0x4d')]['count'](_0x3b984c)[_0x56c9('0x22')](function(_0x29e29a){_0x448c84[_0x56c9('0x30')]=_0x29e29a;if(_0xe45a43['query'][_0x56c9('0x4e')]){_0x58fac9['include']=[{'all':!![]}];}return db[_0x56c9('0x4d')]['findAll'](_0x58fac9);})[_0x56c9('0x22')](function(_0x426c68){_0x448c84['rows']=_0x426c68;return _0x448c84;})[_0x56c9('0x22')](respondWithFilteredResult(_0x1d323b,_0x58fac9))[_0x56c9('0x2b')](handleError(_0x1d323b,null));};exports[_0x56c9('0x4f')]=function(_0x3aaa4e,_0x3d0c5e){var _0x5ab8a7={'raw':!![],'where':{'id':_0x3aaa4e[_0x56c9('0x50')]['id']}},_0x53a241={};_0x53a241['model']=_['keys'](db['ChatMessage'][_0x56c9('0x39')]);_0x53a241[_0x56c9('0x3e')]=_[_0x56c9('0x3f')](_0x3aaa4e[_0x56c9('0x3e')]);_0x53a241['filters']=_[_0x56c9('0x40')](_0x53a241[_0x56c9('0x41')],_0x53a241[_0x56c9('0x3e')]);_0x5ab8a7[_0x56c9('0x42')]=_['intersection'](_0x53a241[_0x56c9('0x41')],qs[_0x56c9('0x43')](_0x3aaa4e[_0x56c9('0x3e')]['fields']));_0x5ab8a7[_0x56c9('0x42')]=_0x5ab8a7['attributes'][_0x56c9('0x44')]?_0x5ab8a7['attributes']:_0x53a241['model'];if(_0x3aaa4e[_0x56c9('0x3e')][_0x56c9('0x4e')]){_0x5ab8a7[_0x56c9('0x51')]=[{'all':!![]}];}_0x5ab8a7=_[_0x56c9('0x4a')]({},_0x5ab8a7,_0x3aaa4e['options']);return db[_0x56c9('0x4d')][_0x56c9('0x52')](_0x5ab8a7)['then'](handleEntityNotFound(_0x3d0c5e,null))['then'](respondWithResult(_0x3d0c5e,null))['catch'](handleError(_0x3d0c5e,null));};exports['create']=function(_0x37648,_0x5c5b02){return db[_0x56c9('0x4d')][_0x56c9('0x53')](_0x37648[_0x56c9('0x54')],{})['then'](respondWithResult(_0x5c5b02,0xc9))[_0x56c9('0x2b')](handleError(_0x5c5b02,null));};exports[_0x56c9('0x55')]=function(_0x219799,_0x1d4721){if(_0x219799['body']['id']){delete _0x219799[_0x56c9('0x54')]['id'];}return db[_0x56c9('0x4d')][_0x56c9('0x52')]({'where':{'id':_0x219799[_0x56c9('0x50')]['id']}})[_0x56c9('0x22')](handleEntityNotFound(_0x1d4721,null))['then'](saveUpdates(_0x219799['body'],null))[_0x56c9('0x22')](respondWithResult(_0x1d4721,null))['catch'](handleError(_0x1d4721,null));};exports[_0x56c9('0x36')]=function(_0x541812,_0x29882a){return db['ChatMessage']['find']({'where':{'id':_0x541812[_0x56c9('0x50')]['id']}})[_0x56c9('0x22')](handleEntityNotFound(_0x29882a,null))['then'](removeEntity(_0x29882a,null))[_0x56c9('0x2b')](handleError(_0x29882a,null));};exports['describe']=function(_0xa15673,_0x45dc76){return db[_0x56c9('0x4d')]['describe']()[_0x56c9('0x22')](respondWithResult(_0x45dc76,null))['catch'](handleError(_0x45dc76,null));};var interaction_log=require('../../config/logger')(_0x56c9('0x56'));exports[_0x56c9('0x57')]=function(_0x51984d,_0x8ca56d,_0x5a355e){var _0x3afe23={'channel':_0x56c9('0x58')};if(_0x51984d[_0x56c9('0x54')]['id']){delete _0x51984d[_0x56c9('0x54')]['id'];}_0x51984d[_0x56c9('0x54')][_0x56c9('0x59')]=!![];_0x51984d[_0x56c9('0x54')][_0x56c9('0x5a')]=moment()['format'](_0x56c9('0x5b'));_0x51984d[_0x56c9('0x54')][_0x56c9('0x5c')]=_0x51984d[_0x56c9('0x54')][_0x56c9('0x5c')]||_0x51984d[_0x56c9('0x5d')]['id'];return db['ChatMessage'][_0x56c9('0x52')]({'where':{'id':_0x51984d['params']['id'],'UserId':null},'include':[{'model':db[_0x56c9('0x5e')],'as':_0x56c9('0x5f')}]})[_0x56c9('0x22')](handleEntityNotFound(_0x8ca56d,null))[_0x56c9('0x22')](saveUpdates(_0x51984d[_0x56c9('0x54')],null))[_0x56c9('0x22')](function(_0x592db3){if(_0x592db3){_0x3afe23[_0x56c9('0x29')]=_0x592db3[_0x56c9('0x60')]({'plain':!![]});return db[_0x56c9('0x61')]['find']({'where':{'id':_0x592db3[_0x56c9('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x8ca56d,null))[_0x56c9('0x22')](function(_0x3c0ca){if(_0x3c0ca){return _0x3c0ca[_0x56c9('0x55')]({'UserId':_0x51984d[_0x56c9('0x54')]['UserId'],'read1stAt':_['isNil'](_0x3c0ca[_0x56c9('0x63')])?moment()[_0x56c9('0x64')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x56c9('0x22')](function(_0x17cd1c){if(_0x17cd1c){_0x3afe23[_0x56c9('0x65')]=_0x17cd1c['get']({'plain':!![]});interaction_log['info']('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x51984d['user']['id'],_0x51984d[_0x56c9('0x5d')][_0x56c9('0x37')],_0x51984d[_0x56c9('0x5d')][_0x56c9('0x66')],_0x3afe23['interaction']['id'],_0x51984d['body']?JSON[_0x56c9('0x26')](_0x51984d[_0x56c9('0x54')]):'null');return respondWithRpcPromise(_0x56c9('0x67'),_0x56c9('0x68'),_0x3afe23);}return null;})[_0x56c9('0x22')](function(_0x3c7e9a){if(_0x3c7e9a){if(_0x51984d[_0x56c9('0x54')]['manual']){_0x3afe23['message'][_0x56c9('0x69')]=util[_0x56c9('0x64')]('SIP/%s',_0x51984d[_0x56c9('0x5d')][_0x56c9('0x37')]);_0x3afe23[_0x56c9('0x29')][_0x56c9('0x6a')]=_0x3afe23[_0x56c9('0x6a')];_0x3afe23[_0x56c9('0x29')][_0x56c9('0x6b')]=_0x56c9('0x57');return respondWithRpcPromise('EventManager',_0x56c9('0x6c'),{'event':_0x56c9('0x6d'),'message':_['merge'](_0x3afe23['message'],JSON[_0x56c9('0x6e')](_0x3afe23[_0x56c9('0x65')][_0x56c9('0x6f')]))},client9002)[_0x56c9('0x22')](function(){return _0x3afe23;});}return _0x3afe23;}return null;})[_0x56c9('0x22')](respondWithResult(_0x8ca56d,null))[_0x56c9('0x2b')](handleError(_0x8ca56d,null));};var interaction_log=require('../../config/logger')(_0x56c9('0x56'));exports[_0x56c9('0x70')]=function(_0x574267,_0x1adf6a,_0xa65416){var _0x4954dd={'agent':{},'channel':_0x56c9('0x58')};if(_0x574267[_0x56c9('0x54')]['id']){delete _0x574267[_0x56c9('0x54')]['id'];}_0x574267[_0x56c9('0x54')][_0x56c9('0x5c')]=_0x574267[_0x56c9('0x54')][_0x56c9('0x5c')]||_0x574267[_0x56c9('0x5d')]['id'];_0x4954dd['agent']['id']=_0x574267[_0x56c9('0x54')][_0x56c9('0x5c')];return db['ChatMessage'][_0x56c9('0x52')]({'where':{'id':_0x574267['params']['id'],'UserId':null}})[_0x56c9('0x22')](handleEntityNotFound(_0x1adf6a,null))['then'](function(_0x2f1907){if(_0x2f1907){_0x4954dd['message']=_0x2f1907['get']({'plain':!![]});return db['ChatInteraction'][_0x56c9('0x52')]({'where':{'id':_0x2f1907['ChatInteractionId']}});}return null;})[_0x56c9('0x22')](handleEntityNotFound(_0x1adf6a,null))[_0x56c9('0x22')](function(_0x59b349){if(_0x59b349){_0x4954dd[_0x56c9('0x65')]=_0x59b349[_0x56c9('0x60')]({'plain':!![]});interaction_log[_0x56c9('0x23')](_0x56c9('0x71'),_0x574267[_0x56c9('0x5d')]['id'],_0x574267[_0x56c9('0x5d')][_0x56c9('0x37')],_0x574267[_0x56c9('0x5d')][_0x56c9('0x66')],_0x4954dd[_0x56c9('0x65')]['id'],_0x574267[_0x56c9('0x54')]?JSON[_0x56c9('0x26')](_0x574267[_0x56c9('0x54')]):'null');return respondWithRpcPromise('RejectMessage',_0x56c9('0x72'),_0x4954dd);}return null;})['then'](function(_0x11257a){if(_0x11257a){_0x11257a[_0x56c9('0x29')][_0x56c9('0x69')]=util['format']('SIP/%s',_0x574267['user'][_0x56c9('0x37')]);_0x11257a[_0x56c9('0x29')][_0x56c9('0x6a')]=_0x4954dd[_0x56c9('0x6a')];_0x11257a[_0x56c9('0x29')][_0x56c9('0x6b')]=_0x56c9('0x70');respondWithRpcPromise(_0x56c9('0x6c'),'EventManager',{'event':_0x56c9('0x73'),'message':_0x11257a[_0x56c9('0x29')]},client9002);return _0x4954dd;}return null;})[_0x56c9('0x22')](respondWithResult(_0x1adf6a,null))['catch'](handleError(_0x1adf6a,null));}; \ No newline at end of file +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 diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 12d0110..0b9356b 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 _0x2106=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','events','ChatMessage'];(function(_0x54a6d9,_0x132320){var _0x42aab8=function(_0x1b907f){while(--_0x1b907f){_0x54a6d9['push'](_0x54a6d9['shift']());}};_0x42aab8(++_0x132320);}(_0x2106,0x1c6));var _0x6210=function(_0x191c9d,_0x477535){_0x191c9d=_0x191c9d-0x0;var _0x47d5a0=_0x2106[_0x191c9d];return _0x47d5a0;};'use strict';var EventEmitter=require(_0x6210('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x6210('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x6210('0x2')](0x0);var events={'afterCreate':_0x6210('0x3'),'afterUpdate':'update','afterDestroy':_0x6210('0x4')};function emitEvent(_0x249052){return function(_0x286575,_0x21927e,_0x3193ec){ChatMessageEvents['emit'](_0x249052+':'+_0x286575['id'],_0x286575);ChatMessageEvents[_0x6210('0x5')](_0x249052,_0x286575);_0x3193ec(null);};}for(var e in events){if(events[_0x6210('0x6')](e)){var event=events[e];ChatMessage[_0x6210('0x7')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +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 diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 5bb2ff9..72a0a2f 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 _0x205c=['../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','UserId','findOne','update','createdAt','catch','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x836465,_0x5442ae){var _0x2150ea=function(_0x4f4bc2){while(--_0x4f4bc2){_0x836465['push'](_0x836465['shift']());}};_0x2150ea(++_0x5442ae);}(_0x205c,0xb4));var _0xc205=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x205c[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0xc205('0x0'));var util=require(_0xc205('0x1'));var logger=require(_0xc205('0x2'))(_0xc205('0x3'));var moment=require(_0xc205('0x4'));var BPromise=require(_0xc205('0x5'));var rp=require(_0xc205('0x6'));var fs=require('fs');var path=require(_0xc205('0x7'));var rimraf=require(_0xc205('0x8'));var config=require(_0xc205('0x9'));var attributes=require(_0xc205('0xa'));module[_0xc205('0xb')]=function(_0x33db1c,_0x1df575){return _0x33db1c[_0xc205('0xc')](_0xc205('0xd'),attributes,{'tableName':_0xc205('0xe'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0xc205('0xf')],'type':_0xc205('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2c9891,_0x260eaa,_0x859d7f){var _0x216b27=_0x33db1c['models'];var _0x5ae418=_0x2c9891[_0xc205('0x11')]({'plain':!![]});if(_0x5ae418[_0xc205('0x12')][_0xc205('0x13')]()==='in'||_0x5ae418[_0xc205('0x12')][_0xc205('0x13')]()===_0xc205('0x14')&&!_0x5ae418[_0xc205('0x15')]&&!_['isNil'](_0x5ae418[_0xc205('0x16')])){_0x216b27['ChatInteraction'][_0xc205('0x17')]({'where':{'id':_0x5ae418['ChatInteractionId']}})['then'](function(_0xa942e9){if(_0xa942e9){_0xa942e9[_0xc205('0x18')]({'lastMsgAt':_0x5ae418[_0xc205('0x19')],'lastMsgDirection':_0x5ae418[_0xc205('0x12')][_0xc205('0x13')]()});}})[_0xc205('0x1a')](function(_0x387085){console['error'](_0x387085);});}_0x859d7f();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +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 diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index eab28c0..fbb55b4 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 _0x2af5=['defaults','localhost','./chatMessage.socket','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateChatMessage','ChatMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0x465aa9,_0x1bf1c8){var _0x4104e4=function(_0x388bb8){while(--_0x388bb8){_0x465aa9['push'](_0x465aa9['shift']());}};_0x4104e4(++_0x1bf1c8);}(_0x2af5,0x77));var _0x52af=function(_0xb32bc0,_0x1c470a){_0xb32bc0=_0xb32bc0-0x0;var _0x5a5cac=_0x2af5[_0xb32bc0];return _0x5a5cac;};'use strict';var _=require(_0x52af('0x0'));var util=require(_0x52af('0x1'));var moment=require(_0x52af('0x2'));var BPromise=require(_0x52af('0x3'));var rs=require(_0x52af('0x4'));var fs=require('fs');var Redis=require(_0x52af('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x52af('0x6'));var logger=require(_0x52af('0x7'))(_0x52af('0x8'));var config=require('../../config/environment');var jayson=require(_0x52af('0x9'));var client=jayson[_0x52af('0xa')][_0x52af('0xb')]({'port':0x232a});config[_0x52af('0xc')]=_[_0x52af('0xd')](config[_0x52af('0xc')],{'host':_0x52af('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x52af('0xc')]));require(_0x52af('0xf'))['register'](socket);function respondWithRpcPromise(_0x42f909,_0x36f034,_0xf84c8b){return new BPromise(function(_0x331133,_0x83516e){return client[_0x52af('0x10')](_0x42f909,_0xf84c8b)[_0x52af('0x11')](function(_0x4ec517){logger['info'](_0x52af('0x12'),_0x36f034,_0x52af('0x13'));logger[_0x52af('0x14')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x36f034,_0x52af('0x13'),JSON[_0x52af('0x15')](_0x4ec517));if(_0x4ec517[_0x52af('0x16')]){if(_0x4ec517['error'][_0x52af('0x17')]===0x1f4){logger[_0x52af('0x16')](_0x52af('0x12'),_0x36f034,_0x4ec517[_0x52af('0x16')][_0x52af('0x18')]);return _0x83516e(_0x4ec517[_0x52af('0x16')][_0x52af('0x18')]);}logger[_0x52af('0x16')]('ChatMessage,\x20%s,\x20%s',_0x36f034,_0x4ec517['error'][_0x52af('0x18')]);return _0x331133(_0x4ec517[_0x52af('0x16')][_0x52af('0x18')]);}else{logger[_0x52af('0x19')](_0x52af('0x12'),_0x36f034,_0x52af('0x13'));_0x331133(_0x4ec517['result']['message']);}})[_0x52af('0x1a')](function(_0x478ff8){logger['error']('ChatMessage,\x20%s,\x20%s',_0x36f034,_0x478ff8);_0x83516e(_0x478ff8);});});}exports[_0x52af('0x1b')]=function(_0x46d9f7){var _0x3253d2=this;return new Promise(function(_0x22785f,_0x51500d){return db[_0x52af('0x1c')][_0x52af('0x1d')](_0x46d9f7[_0x52af('0x1e')],{'raw':_0x46d9f7['options']?_0x46d9f7[_0x52af('0x1f')][_0x52af('0x20')]===undefined?!![]:![]:!![]})[_0x52af('0x11')](function(_0xd3ff28){logger[_0x52af('0x19')]('CreateChatMessage',_0x46d9f7);logger['debug']('CreateChatMessage',_0x46d9f7,JSON['stringify'](_0xd3ff28));_0x22785f(_0xd3ff28);})[_0x52af('0x1a')](function(_0x408a60){logger['error'](_0x52af('0x1b'),_0x408a60['message'],_0x46d9f7);_0x51500d(_0x3253d2[_0x52af('0x16')](0x1f4,_0x408a60[_0x52af('0x18')]));});});}; \ No newline at end of file +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 diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 9b2fa89..815adf6 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 _0xdb28=['remove','update','emit','register','length','chatMessage:','./chatMessage.events','save'];(function(_0x4ad553,_0x586c5a){var _0x136750=function(_0x11dfbc){while(--_0x11dfbc){_0x4ad553['push'](_0x4ad553['shift']());}};_0x136750(++_0x586c5a);}(_0xdb28,0x106));var _0x8db2=function(_0x171015,_0x53556e){_0x171015=_0x171015-0x0;var _0x5946e3=_0xdb28[_0x171015];return _0x5946e3;};'use strict';var ChatMessageEvents=require(_0x8db2('0x0'));var events=[_0x8db2('0x1'),_0x8db2('0x2'),_0x8db2('0x3')];function createListener(_0x585da1,_0x1f4c45){return function(_0x11c26d){_0x1f4c45[_0x8db2('0x4')](_0x585da1,_0x11c26d);};}function removeListener(_0x4426fe,_0x11109e){return function(){ChatMessageEvents['removeListener'](_0x4426fe,_0x11109e);};}exports[_0x8db2('0x5')]=function(_0x1d2dd3){for(var _0x5f42ee=0x0,_0x494b40=events[_0x8db2('0x6')];_0x5f42ee<_0x494b40;_0x5f42ee++){var _0x46932f=events[_0x5f42ee];var _0x131537=createListener(_0x8db2('0x7')+_0x46932f,_0x1d2dd3);ChatMessageEvents['on'](_0x46932f,_0x131537);}}; \ No newline at end of file +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 diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index d5fdd18..9d517e8 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 _0xf5cd=['destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','post','tracked','create','put','update','accept'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xf5cd,0xca));var _0xdf5c=function(_0x162ef0,_0x345e28){_0x162ef0=_0x162ef0-0x0;var _0x4d5ec3=_0xf5cd[_0x162ef0];return _0x4d5ec3;};'use strict';var multer=require('multer');var util=require(_0xdf5c('0x0'));var path=require(_0xdf5c('0x1'));var timeout=require(_0xdf5c('0x2'));var express=require(_0xdf5c('0x3'));var router=express[_0xdf5c('0x4')]();var auth=require(_0xdf5c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdf5c('0x6'));var controller=require('./chatMessage.controller');router[_0xdf5c('0x7')]('/',auth[_0xdf5c('0x8')](),controller[_0xdf5c('0x9')]);router[_0xdf5c('0x7')]('/describe',auth[_0xdf5c('0x8')](),controller[_0xdf5c('0xa')]);router[_0xdf5c('0x7')](_0xdf5c('0xb'),auth[_0xdf5c('0x8')](),controller['show']);router[_0xdf5c('0xc')]('/',auth[_0xdf5c('0x8')](),interaction[_0xdf5c('0xd')]('chat','chatmessage:create'),controller[_0xdf5c('0xe')]);router[_0xdf5c('0xf')](_0xdf5c('0xb'),controller[_0xdf5c('0x10')]);router[_0xdf5c('0xf')]('/:id/accept',auth[_0xdf5c('0x8')](),controller[_0xdf5c('0x11')]);router[_0xdf5c('0xf')]('/:id/reject',auth[_0xdf5c('0x8')](),controller['reject']);router['delete'](_0xdf5c('0xb'),auth['isAuthenticated'](),controller[_0xdf5c('0x12')]);module[_0xdf5c('0x13')]=router; \ No newline at end of file +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 diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 13f2c32..f276477 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 _0x178a=['sequelize','exports','TEXT','medium'];(function(_0x26b8b5,_0xf5c2c1){var _0x2150a9=function(_0x1ca1be){while(--_0x1ca1be){_0x26b8b5['push'](_0x26b8b5['shift']());}};_0x2150a9(++_0xf5c2c1);}(_0x178a,0x8c));var _0xa178=function(_0x158eef,_0x4a0a7d){_0x158eef=_0x158eef-0x0;var _0x26cd34=_0x178a[_0x158eef];return _0x26cd34;};'use strict';var Sequelize=require(_0xa178('0x0'));module[_0xa178('0x1')]={'body':{'type':Sequelize[_0xa178('0x2')](_0xa178('0x3')),'allowNull':![]}}; \ No newline at end of file +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 diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 8dfe1ea..426a9ad 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 _0x1314=['end','status','count','offset','limit','set','json','apply','reject','save','then','error','stack','index','map','rawAttributes','type','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','filters','pick','filter','where','merge','VIRTUAL','options','ChatOfflineMessage','include','rows','catch','params','includeAll','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x1314,0x1e6));var _0x4131=function(_0x2df523,_0x11b09e){_0x2df523=_0x2df523-0x0;var _0x43f919=_0x1314[_0x2df523];return _0x43f919;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4131('0x0'));var rimraf=require(_0x4131('0x1'));var zipdir=require(_0x4131('0x2'));var jsonpatch=require(_0x4131('0x3'));var rp=require(_0x4131('0x4'));var moment=require(_0x4131('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4131('0x6'));var util=require(_0x4131('0x7'));var path=require(_0x4131('0x8'));var sox=require(_0x4131('0x9'));var csv=require(_0x4131('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4131('0xb'));var squel=require(_0x4131('0xc'));var crypto=require(_0x4131('0xd'));var jsforce=require(_0x4131('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4131('0xa'));var querystring=require(_0x4131('0xf'));var Papa=require(_0x4131('0x10'));var Redis=require(_0x4131('0x11'));var authService=require(_0x4131('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4131('0x13'));var logger=require(_0x4131('0x14'))(_0x4131('0x15'));var utils=require(_0x4131('0x16'));var config=require(_0x4131('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5cea63,_0x223487){_0x223487=_0x223487||0xcc;return function(_0x1e3864){if(_0x1e3864){return _0x5cea63[_0x4131('0x18')](_0x223487);}return _0x5cea63['status'](_0x223487)[_0x4131('0x19')]();};}function respondWithResult(_0x442060,_0x20f218){_0x20f218=_0x20f218||0xc8;return function(_0x498ee6){if(_0x498ee6){return _0x442060[_0x4131('0x1a')](_0x20f218)['json'](_0x498ee6);}};}function respondWithFilteredResult(_0xcd9d0f,_0x2b0588){return function(_0x6c226c){if(_0x6c226c){var _0x450368=_0x6c226c[_0x4131('0x1b')],_0x3f68ed=_0x2b0588[_0x4131('0x1c')],_0x5cbcbd=_0x2b0588[_0x4131('0x1c')]+_0x2b0588[_0x4131('0x1d')],_0x5d5b69;if(_0x5cbcbd>=_0x450368){_0x5cbcbd=_0x450368;_0x5d5b69=0xc8;}else{_0x5d5b69=0xce;}_0xcd9d0f['status'](_0x5d5b69);return _0xcd9d0f[_0x4131('0x1e')]('Content-Range',_0x3f68ed+'-'+_0x5cbcbd+'/'+_0x450368)[_0x4131('0x1f')](_0x6c226c);}return null;};}function patchUpdates(_0x262e00){return function(_0x10bcb7){try{jsonpatch[_0x4131('0x20')](_0x10bcb7,_0x262e00,!![]);}catch(_0x1142ad){return BPromise[_0x4131('0x21')](_0x1142ad);}return _0x10bcb7[_0x4131('0x22')]();};}function saveUpdates(_0x1902f6,_0x43f527){return function(_0x563997){if(_0x563997){return _0x563997['update'](_0x1902f6)['then'](function(_0x41d4a8){return _0x41d4a8;});}return null;};}function removeEntity(_0x52a2e9,_0x4240bf){return function(_0x5dfd99){if(_0x5dfd99){return _0x5dfd99['destroy']()[_0x4131('0x23')](function(){_0x52a2e9[_0x4131('0x1a')](0xcc)[_0x4131('0x19')]();});}};}function handleEntityNotFound(_0x29a46e,_0x2d3c5e){return function(_0x2c356f){if(!_0x2c356f){_0x29a46e[_0x4131('0x18')](0x194);}return _0x2c356f;};}function handleError(_0x20754e,_0x597d93){_0x597d93=_0x597d93||0x1f4;return function(_0x38c816){logger[_0x4131('0x24')](_0x38c816[_0x4131('0x25')]);if(_0x38c816['name']){delete _0x38c816['name'];}_0x20754e['status'](_0x597d93)['send'](_0x38c816);};}exports[_0x4131('0x26')]=function(_0x16caa6,_0x37b33c){var _0x28b435={},_0x38b195={},_0x194024={'count':0x0,'rows':[]};var _0x52399b=_[_0x4131('0x27')](db['ChatOfflineMessage'][_0x4131('0x28')],function(_0x222b80){return{'name':_0x222b80['fieldName'],'type':_0x222b80[_0x4131('0x29')][_0x4131('0x2a')]};});_0x38b195[_0x4131('0x2b')]=_[_0x4131('0x27')](_0x52399b,_0x4131('0x2c'));_0x38b195[_0x4131('0x2d')]=_[_0x4131('0x2e')](_0x16caa6[_0x4131('0x2d')]);_0x38b195['filters']=_[_0x4131('0x2f')](_0x38b195['model'],_0x38b195[_0x4131('0x2d')]);_0x28b435[_0x4131('0x30')]=_[_0x4131('0x2f')](_0x38b195[_0x4131('0x2b')],qs[_0x4131('0x31')](_0x16caa6[_0x4131('0x2d')]['fields']));_0x28b435[_0x4131('0x30')]=_0x28b435[_0x4131('0x30')][_0x4131('0x32')]?_0x28b435[_0x4131('0x30')]:_0x38b195[_0x4131('0x2b')];if(!_0x16caa6['query'][_0x4131('0x33')](_0x4131('0x34'))){_0x28b435[_0x4131('0x1d')]=qs[_0x4131('0x1d')](_0x16caa6['query'][_0x4131('0x1d')]);_0x28b435[_0x4131('0x1c')]=qs[_0x4131('0x1c')](_0x16caa6[_0x4131('0x2d')]['offset']);}_0x28b435[_0x4131('0x35')]=qs['sort'](_0x16caa6[_0x4131('0x2d')]['sort']);_0x28b435['where']=qs[_0x4131('0x36')](_[_0x4131('0x37')](_0x16caa6[_0x4131('0x2d')],_0x38b195[_0x4131('0x36')]));if(_0x16caa6[_0x4131('0x2d')][_0x4131('0x38')]){_0x28b435[_0x4131('0x39')]=_[_0x4131('0x3a')](_0x28b435[_0x4131('0x39')],{'$or':_[_0x4131('0x27')](_0x52399b,function(_0xdc7942){if(_0xdc7942[_0x4131('0x29')]!==_0x4131('0x3b')){var _0x271658={};_0x271658[_0xdc7942[_0x4131('0x2c')]]={'$like':'%'+_0x16caa6[_0x4131('0x2d')][_0x4131('0x38')]+'%'};return _0x271658;}})});}_0x28b435=_[_0x4131('0x3a')]({},_0x28b435,_0x16caa6[_0x4131('0x3c')]);var _0x44573b={'where':_0x28b435[_0x4131('0x39')]};return db[_0x4131('0x3d')][_0x4131('0x1b')](_0x44573b)[_0x4131('0x23')](function(_0x50d4ad){_0x194024['count']=_0x50d4ad;if(_0x16caa6[_0x4131('0x2d')]['includeAll']){_0x28b435[_0x4131('0x3e')]=[{'all':!![]}];}return db[_0x4131('0x3d')]['findAll'](_0x28b435);})[_0x4131('0x23')](function(_0x59afd8){_0x194024[_0x4131('0x3f')]=_0x59afd8;return _0x194024;})['then'](respondWithFilteredResult(_0x37b33c,_0x28b435))[_0x4131('0x40')](handleError(_0x37b33c,null));};exports['show']=function(_0x20fdc4,_0x8a1e18){var _0x3fb021={'raw':!![],'where':{'id':_0x20fdc4[_0x4131('0x41')]['id']}},_0x4ef15d={};_0x4ef15d['model']=_[_0x4131('0x2e')](db[_0x4131('0x3d')]['rawAttributes']);_0x4ef15d[_0x4131('0x2d')]=_[_0x4131('0x2e')](_0x20fdc4['query']);_0x4ef15d[_0x4131('0x36')]=_[_0x4131('0x2f')](_0x4ef15d['model'],_0x4ef15d[_0x4131('0x2d')]);_0x3fb021['attributes']=_[_0x4131('0x2f')](_0x4ef15d['model'],qs[_0x4131('0x31')](_0x20fdc4[_0x4131('0x2d')][_0x4131('0x31')]));_0x3fb021[_0x4131('0x30')]=_0x3fb021['attributes']['length']?_0x3fb021[_0x4131('0x30')]:_0x4ef15d[_0x4131('0x2b')];if(_0x20fdc4['query'][_0x4131('0x42')]){_0x3fb021[_0x4131('0x3e')]=[{'all':!![]}];}_0x3fb021=_['merge']({},_0x3fb021,_0x20fdc4['options']);return db[_0x4131('0x3d')][_0x4131('0x43')](_0x3fb021)['then'](handleEntityNotFound(_0x8a1e18,null))['then'](respondWithResult(_0x8a1e18,null))[_0x4131('0x40')](handleError(_0x8a1e18,null));};exports[_0x4131('0x44')]=function(_0x40384c,_0x4976e2){return db[_0x4131('0x3d')]['create'](_0x40384c[_0x4131('0x45')],{})[_0x4131('0x23')](respondWithResult(_0x4976e2,0xc9))[_0x4131('0x40')](handleError(_0x4976e2,null));};exports[_0x4131('0x46')]=function(_0x377189,_0x680c3c){if(_0x377189[_0x4131('0x45')]['id']){delete _0x377189[_0x4131('0x45')]['id'];}return db[_0x4131('0x3d')]['find']({'where':{'id':_0x377189['params']['id']}})[_0x4131('0x23')](handleEntityNotFound(_0x680c3c,null))[_0x4131('0x23')](saveUpdates(_0x377189[_0x4131('0x45')],null))[_0x4131('0x23')](respondWithResult(_0x680c3c,null))[_0x4131('0x40')](handleError(_0x680c3c,null));};exports[_0x4131('0x47')]=function(_0x3640d2,_0x3427d8){return db[_0x4131('0x3d')][_0x4131('0x43')]({'where':{'id':_0x3640d2[_0x4131('0x41')]['id']}})[_0x4131('0x23')](handleEntityNotFound(_0x3427d8,null))['then'](removeEntity(_0x3427d8,null))[_0x4131('0x40')](handleError(_0x3427d8,null));};exports['describe']=function(_0x7e8fd0,_0x39e4d8){return db['ChatOfflineMessage'][_0x4131('0x48')]()[_0x4131('0x23')](respondWithResult(_0x39e4d8,null))[_0x4131('0x40')](handleError(_0x39e4d8,null));}; \ No newline at end of file +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 diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index a69fb23..16afab9 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 _0x5c12=['request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','define','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5c12,0x188));var _0x25c1=function(_0x1d80be,_0x3a60ff){_0x1d80be=_0x1d80be-0x0;var _0xf9a4f3=_0x5c12[_0x1d80be];return _0xf9a4f3;};'use strict';var _=require('lodash');var util=require(_0x25c1('0x0'));var logger=require(_0x25c1('0x1'))('api');var moment=require(_0x25c1('0x2'));var BPromise=require(_0x25c1('0x3'));var rp=require(_0x25c1('0x4'));var fs=require('fs');var path=require(_0x25c1('0x5'));var rimraf=require(_0x25c1('0x6'));var config=require(_0x25c1('0x7'));var attributes=require(_0x25c1('0x8'));module['exports']=function(_0x204287,_0x42ac16){return _0x204287[_0x25c1('0x9')]('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x25c1('0xa'),'collate':_0x25c1('0xb')});}; \ No newline at end of file +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 diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index f32e719..6f4ca2c 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 _0xd01f=['jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3fd5de,_0x5d56b3){var _0x525c81=function(_0x17bf42){while(--_0x17bf42){_0x3fd5de['push'](_0x3fd5de['shift']());}};_0x525c81(++_0x5d56b3);}(_0xd01f,0xe6));var _0xfd01=function(_0x4307e1,_0x1335bc){_0x4307e1=_0x4307e1-0x0;var _0xef6ef2=_0xd01f[_0x4307e1];return _0xef6ef2;};'use strict';var _=require('lodash');var util=require(_0xfd01('0x0'));var moment=require(_0xfd01('0x1'));var BPromise=require(_0xfd01('0x2'));var rs=require(_0xfd01('0x3'));var fs=require('fs');var Redis=require(_0xfd01('0x4'));var db=require(_0xfd01('0x5'))['db'];var utils=require(_0xfd01('0x6'));var logger=require(_0xfd01('0x7'))(_0xfd01('0x8'));var config=require(_0xfd01('0x9'));var jayson=require(_0xfd01('0xa'));var client=jayson[_0xfd01('0xb')][_0xfd01('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e7985,_0x17bfcb,_0x44ef06){return new BPromise(function(_0x57cc5b,_0x17f6ae){return client[_0xfd01('0xd')](_0x2e7985,_0x44ef06)[_0xfd01('0xe')](function(_0xbf8835){logger[_0xfd01('0xf')](_0xfd01('0x10'),_0x17bfcb,_0xfd01('0x11'));logger[_0xfd01('0x12')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x17bfcb,'request\x20sent',JSON['stringify'](_0xbf8835));if(_0xbf8835[_0xfd01('0x13')]){if(_0xbf8835['error'][_0xfd01('0x14')]===0x1f4){logger[_0xfd01('0x13')](_0xfd01('0x10'),_0x17bfcb,_0xbf8835[_0xfd01('0x13')]['message']);return _0x17f6ae(_0xbf8835[_0xfd01('0x13')][_0xfd01('0x15')]);}logger[_0xfd01('0x13')](_0xfd01('0x10'),_0x17bfcb,_0xbf8835[_0xfd01('0x13')][_0xfd01('0x15')]);return _0x57cc5b(_0xbf8835[_0xfd01('0x13')][_0xfd01('0x15')]);}else{logger[_0xfd01('0xf')](_0xfd01('0x10'),_0x17bfcb,_0xfd01('0x11'));_0x57cc5b(_0xbf8835[_0xfd01('0x16')][_0xfd01('0x15')]);}})[_0xfd01('0x17')](function(_0xd5156e){logger[_0xfd01('0x13')](_0xfd01('0x10'),_0x17bfcb,_0xd5156e);_0x17f6ae(_0xd5156e);});});} \ No newline at end of file +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 diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 1367ccb..eb24cac 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 _0x431b=['show','post','put','update','delete','/:id','destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','get','/describe','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x431b,0xc3));var _0xb431=function(_0xd4470d,_0x47318d){_0xd4470d=_0xd4470d-0x0;var _0x5544c5=_0x431b[_0xd4470d];return _0x5544c5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb431('0x0'));var timeout=require(_0xb431('0x1'));var express=require('express');var router=express[_0xb431('0x2')]();var auth=require(_0xb431('0x3'));var interaction=require(_0xb431('0x4'));var config=require('../../config/environment');var controller=require(_0xb431('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb431('0x6')](_0xb431('0x7'),auth[_0xb431('0x8')](),controller['describe']);router[_0xb431('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xb431('0x9')]);router[_0xb431('0xa')]('/',auth[_0xb431('0x8')](),controller['create']);router[_0xb431('0xb')]('/:id',auth[_0xb431('0x8')](),controller[_0xb431('0xc')]);router[_0xb431('0xd')](_0xb431('0xe'),auth[_0xb431('0x8')](),controller[_0xb431('0xf')]);module[_0xb431('0x10')]=router; \ No newline at end of file +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 diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 849bae1..1a62c26 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 _0xf598=['sequelize','exports','STRING','mouseOver','timeout','INTEGER'];(function(_0x4cb3cf,_0x1e3093){var _0x394367=function(_0x15d00b){while(--_0x15d00b){_0x4cb3cf['push'](_0x4cb3cf['shift']());}};_0x394367(++_0x1e3093);}(_0xf598,0x6c));var _0x8f59=function(_0x49cb2a,_0x2bec9f){_0x49cb2a=_0x49cb2a-0x0;var _0x587793=_0xf598[_0x49cb2a];return _0x587793;};'use strict';var Sequelize=require(_0x8f59('0x0'));module[_0x8f59('0x1')]={'name':{'type':Sequelize[_0x8f59('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8f59('0x3'),_0x8f59('0x4')),'defaultValue':_0x8f59('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x8f59('0x5')]}}; \ No newline at end of file +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 diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 8dc6151..a371ed1 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(_0x4b3af0,_0x25652d){var _0x14b986=function(_0x7c691a){while(--_0x7c691a){_0x4b3af0['push'](_0x4b3af0['shift']());}};_0x14b986(++_0x25652d);}(_0x70e0,0x17b));var _0x070e=function(_0x8060aa,_0x673bb1){_0x8060aa=_0x8060aa-0x0;var _0x1a22aa=_0x70e0[_0x8060aa];return _0x1a22aa;};'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 _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 diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 59015d6..efe11ed 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 _0xea81=['api','moment','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','../../config/logger'];(function(_0x184cc6,_0x4961ee){var _0x3f7435=function(_0x448fed){while(--_0x448fed){_0x184cc6['push'](_0x184cc6['shift']());}};_0x3f7435(++_0x4961ee);}(_0xea81,0xc7));var _0x1ea8=function(_0x5adf3f,_0x100188){_0x5adf3f=_0x5adf3f-0x0;var _0x559507=_0xea81[_0x5adf3f];return _0x559507;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1ea8('0x0'))(_0x1ea8('0x1'));var moment=require(_0x1ea8('0x2'));var BPromise=require('bluebird');var rp=require(_0x1ea8('0x3'));var fs=require('fs');var path=require(_0x1ea8('0x4'));var rimraf=require(_0x1ea8('0x5'));var config=require(_0x1ea8('0x6'));var attributes=require(_0x1ea8('0x7'));module[_0x1ea8('0x8')]=function(_0x336119,_0x40dace){return _0x336119[_0x1ea8('0x9')]('ChatProactiveAction',attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index d7838e2..e10d980 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 _0x68e4=['request','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x3e9c73,_0x3f6788){var _0x4ea5a9=function(_0x223939){while(--_0x223939){_0x3e9c73['push'](_0x3e9c73['shift']());}};_0x4ea5a9(++_0x3f6788);}(_0x68e4,0x1c3));var _0x468e=function(_0x5d01a7,_0x3975b3){_0x5d01a7=_0x5d01a7-0x0;var _0x2b2345=_0x68e4[_0x5d01a7];return _0x2b2345;};'use strict';var _=require(_0x468e('0x0'));var util=require(_0x468e('0x1'));var moment=require(_0x468e('0x2'));var BPromise=require(_0x468e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x468e('0x4'))['db'];var utils=require(_0x468e('0x5'));var logger=require('../../config/logger')(_0x468e('0x6'));var config=require(_0x468e('0x7'));var jayson=require(_0x468e('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xf18c28,_0x597f5b,_0x1458b3){return new BPromise(function(_0x4ab28d,_0x307a0d){return client[_0x468e('0x9')](_0xf18c28,_0x1458b3)[_0x468e('0xa')](function(_0xe70188){logger['info'](_0x468e('0xb'),_0x597f5b,_0x468e('0xc'));logger[_0x468e('0xd')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x597f5b,_0x468e('0xc'),JSON[_0x468e('0xe')](_0xe70188));if(_0xe70188[_0x468e('0xf')]){if(_0xe70188[_0x468e('0xf')][_0x468e('0x10')]===0x1f4){logger[_0x468e('0xf')](_0x468e('0xb'),_0x597f5b,_0xe70188[_0x468e('0xf')][_0x468e('0x11')]);return _0x307a0d(_0xe70188[_0x468e('0xf')][_0x468e('0x11')]);}logger[_0x468e('0xf')](_0x468e('0xb'),_0x597f5b,_0xe70188[_0x468e('0xf')][_0x468e('0x11')]);return _0x4ab28d(_0xe70188[_0x468e('0xf')]['message']);}else{logger['info'](_0x468e('0xb'),_0x597f5b,'request\x20sent');_0x4ab28d(_0xe70188[_0x468e('0x12')]['message']);}})[_0x468e('0x13')](function(_0x48cd1d){logger[_0x468e('0xf')](_0x468e('0xb'),_0x597f5b,_0x48cd1d);_0x307a0d(_0x48cd1d);});});} \ No newline at end of file +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 diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 0ca3e3a..0f8e266 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 _0x1d80=['./chatProactiveAction.controller','/:id','isAuthenticated','show','create','delete','exports','multer','util','Router','../../components/interaction/service','../../config/environment'];(function(_0x137aa0,_0x167c1a){var _0x4115b1=function(_0x56e5b3){while(--_0x56e5b3){_0x137aa0['push'](_0x137aa0['shift']());}};_0x4115b1(++_0x167c1a);}(_0x1d80,0xaf));var _0x01d8=function(_0x545022,_0x3b72cc){_0x545022=_0x545022-0x0;var _0x212216=_0x1d80[_0x545022];return _0x212216;};'use strict';var multer=require(_0x01d8('0x0'));var util=require(_0x01d8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x01d8('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x01d8('0x3'));var config=require(_0x01d8('0x4'));var controller=require(_0x01d8('0x5'));router['get'](_0x01d8('0x6'),auth[_0x01d8('0x7')](),controller[_0x01d8('0x8')]);router['post']('/',auth[_0x01d8('0x7')](),controller[_0x01d8('0x9')]);router['put'](_0x01d8('0x6'),auth[_0x01d8('0x7')](),controller['update']);router[_0x01d8('0xa')](_0x01d8('0x6'),auth[_0x01d8('0x7')](),controller['destroy']);module[_0x01d8('0xb')]=router; \ No newline at end of file +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 diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 821b631..28386aa 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 _0xe401=['INTEGER','ENUM','rrmemory','beepall','sequelize','exports','name'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xe401,0x1af));var _0x1e40=function(_0x32748c,_0x4f634f){_0x32748c=_0x32748c-0x0;var _0x54486d=_0xe401[_0x32748c];return _0x54486d;};'use strict';var Sequelize=require(_0x1e40('0x0'));module[_0x1e40('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1e40('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x1e40('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1e40('0x4')](_0x1e40('0x5'),_0x1e40('0x6'),'roundrobin')}}; \ No newline at end of file +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 diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 891e4bf..afc560d 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 _0x13c5=['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','stringify','error','ChatQueue,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','limit','set','apply','save','update','destroy','get','ChatQueues','name','ChatQueue','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserChatQueue','intersection','ChatQueueId','User','findAndCountAll','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','length','hasOwnProperty','addTeams','ids','Agents','interface','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','isEmpty','removeAgents','userChatQueue:remove','addAgents','isArray','getAgents','html-pdf','bluebird','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','redis','socket.io-emitter','register','jayson/promise'];(function(_0x47e7dd,_0x51b041){var _0x38501f=function(_0x5ba66d){while(--_0x5ba66d){_0x47e7dd['push'](_0x47e7dd['shift']());}};_0x38501f(++_0x51b041);}(_0x13c5,0x7a));var _0x513c=function(_0x5a591e,_0x636aff){_0x5a591e=_0x5a591e-0x0;var _0xf426eb=_0x13c5[_0x5a591e];return _0xf426eb;};'use strict';var pdf=require(_0x513c('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x513c('0x1'));var Mustache=require('mustache');var util=require('util');var path=require(_0x513c('0x2'));var sox=require(_0x513c('0x3'));var csv=require(_0x513c('0x4'));var ejs=require(_0x513c('0x5'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x513c('0x6'));var jsforce=require(_0x513c('0x7'));var deskjs=require(_0x513c('0x8'));var toCsv=require(_0x513c('0x4'));var querystring=require(_0x513c('0x9'));var Papa=require(_0x513c('0xa'));var Redis=require(_0x513c('0xb'));var authService=require(_0x513c('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x513c('0xd'));var hardwareService=require(_0x513c('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0x513c('0xf'));var config=require(_0x513c('0x10'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x513c('0x11')],{'host':'localhost','port':0x18eb});var socket=require(_0x513c('0x12'))(new Redis(config[_0x513c('0x11')]));require('./chatQueue.socket')[_0x513c('0x13')](socket);var jayson=require(_0x513c('0x14'));var client=jayson[_0x513c('0x15')][_0x513c('0x16')]({'port':0x232a});function checkPasswordPattern(_0x31e044,_0x57f359,_0x31cad0){if(_0x31cad0){var _0x592bbb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x592bbb[_0x513c('0x17')](_0x57f359)){return _0x31e044;}else{throw new db[(_0x513c('0x18'))][(_0x513c('0x19'))](_0x513c('0x1a'));}}else{return _0x31e044;}}function respondWithRpcPromise(_0x597794,_0x48abf0,_0x4c2247,_0x100bc7){return new BPromise(function(_0x341b20,_0x51196d){var _0x58b89f=_0x100bc7||client;return _0x58b89f[_0x513c('0x1b')](_0x597794,_0x4c2247)[_0x513c('0x1c')](function(_0x3c4ab){logger[_0x513c('0x1d')]('ChatQueue,\x20%s,\x20%s',_0x48abf0,_0x513c('0x1e'));logger[_0x513c('0x1f')](_0x513c('0x20'),_0x48abf0,_0x513c('0x1e'),JSON[_0x513c('0x21')](_0x3c4ab));if(_0x3c4ab['error']){if(_0x3c4ab[_0x513c('0x22')]['code']===0x1f4){logger[_0x513c('0x22')](_0x513c('0x23'),_0x48abf0,_0x3c4ab[_0x513c('0x22')][_0x513c('0x24')]);return _0x51196d(_0x3c4ab[_0x513c('0x22')]['message']);}logger['error'](_0x513c('0x23'),_0x48abf0,_0x3c4ab[_0x513c('0x22')]['message']);return _0x341b20(_0x3c4ab[_0x513c('0x22')][_0x513c('0x24')]);}else{logger['info'](_0x513c('0x23'),_0x48abf0,_0x513c('0x1e'));_0x341b20(_0x3c4ab[_0x513c('0x25')][_0x513c('0x24')]);}})[_0x513c('0x26')](function(_0x168854){logger[_0x513c('0x22')]('ChatQueue,\x20%s,\x20%s',_0x48abf0,_0x168854);_0x51196d(_0x168854);});});}function respondWithStatusCode(_0x398b01,_0x100181){_0x100181=_0x100181||0xcc;return function(_0x2c7eec){if(_0x2c7eec){return _0x398b01[_0x513c('0x27')](_0x100181);}return _0x398b01[_0x513c('0x28')](_0x100181)['end']();};}function respondWithResult(_0xe8acaa,_0x28de12){_0x28de12=_0x28de12||0xc8;return function(_0x3cbe93){if(_0x3cbe93){return _0xe8acaa[_0x513c('0x28')](_0x28de12)[_0x513c('0x29')](_0x3cbe93);}};}function respondWithFilteredResult(_0x19a47e,_0x5c850f){return function(_0x564ef8){if(_0x564ef8){var _0x3e642b=_0x564ef8[_0x513c('0x2a')],_0x5d74ea=_0x5c850f['offset'],_0x2ee6aa=_0x5c850f[_0x513c('0x2b')]+_0x5c850f[_0x513c('0x2c')],_0x2bd36b;if(_0x2ee6aa>=_0x3e642b){_0x2ee6aa=_0x3e642b;_0x2bd36b=0xc8;}else{_0x2bd36b=0xce;}_0x19a47e[_0x513c('0x28')](_0x2bd36b);return _0x19a47e[_0x513c('0x2d')]('Content-Range',_0x5d74ea+'-'+_0x2ee6aa+'/'+_0x3e642b)[_0x513c('0x29')](_0x564ef8);}return null;};}function patchUpdates(_0x198761){return function(_0x4cc1b6){try{jsonpatch[_0x513c('0x2e')](_0x4cc1b6,_0x198761,!![]);}catch(_0x7c8306){return BPromise['reject'](_0x7c8306);}return _0x4cc1b6[_0x513c('0x2f')]();};}function saveUpdates(_0x38fe47,_0x418311){return function(_0x3665f3){if(_0x3665f3){return _0x3665f3[_0x513c('0x30')](_0x38fe47)['then'](function(_0x526384){return _0x526384;});}return null;};}function removeEntity(_0x262a9f,_0x529d7f){return function(_0x45f34d){if(_0x45f34d){return _0x45f34d[_0x513c('0x31')]()[_0x513c('0x1c')](function(){var _0x2a5472=_0x45f34d[_0x513c('0x32')]({'plain':!![]});var _0x40acf3=_0x513c('0x33');return db['UserProfileResource'][_0x513c('0x31')]({'where':{'type':_0x40acf3,'resourceId':_0x2a5472['id']}})[_0x513c('0x1c')](function(){return _0x45f34d;});})[_0x513c('0x1c')](function(){_0x262a9f[_0x513c('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x474234,_0x51918a){return function(_0x230d95){if(!_0x230d95){_0x474234[_0x513c('0x27')](0x194);}return _0x230d95;};}function handleError(_0x54e858,_0x47e8a3){_0x47e8a3=_0x47e8a3||0x1f4;return function(_0x421eb6){logger['error'](_0x421eb6['stack']);if(_0x421eb6[_0x513c('0x34')]){delete _0x421eb6['name'];}_0x54e858[_0x513c('0x28')](_0x47e8a3)['send'](_0x421eb6);};}exports['index']=function(_0x1874b1,_0x27b192){var _0x3aee99={},_0x54237b={},_0x131d12={'count':0x0,'rows':[]};var _0x4bc902=_['map'](db[_0x513c('0x35')][_0x513c('0x36')],function(_0x4e73a5){return{'name':_0x4e73a5[_0x513c('0x37')],'type':_0x4e73a5[_0x513c('0x38')][_0x513c('0x39')]};});_0x54237b['model']=_[_0x513c('0x3a')](_0x4bc902,_0x513c('0x34'));_0x54237b[_0x513c('0x3b')]=_[_0x513c('0x3c')](_0x1874b1[_0x513c('0x3b')]);_0x54237b[_0x513c('0x3d')]=_['intersection'](_0x54237b[_0x513c('0x3e')],_0x54237b[_0x513c('0x3b')]);_0x3aee99[_0x513c('0x3f')]=_['intersection'](_0x54237b[_0x513c('0x3e')],qs[_0x513c('0x40')](_0x1874b1[_0x513c('0x3b')][_0x513c('0x40')]));_0x3aee99[_0x513c('0x3f')]=_0x3aee99[_0x513c('0x3f')]['length']?_0x3aee99[_0x513c('0x3f')]:_0x54237b[_0x513c('0x3e')];if(!_0x1874b1[_0x513c('0x3b')]['hasOwnProperty'](_0x513c('0x41'))){_0x3aee99[_0x513c('0x2c')]=qs[_0x513c('0x2c')](_0x1874b1[_0x513c('0x3b')][_0x513c('0x2c')]);_0x3aee99[_0x513c('0x2b')]=qs['offset'](_0x1874b1[_0x513c('0x3b')][_0x513c('0x2b')]);}_0x3aee99[_0x513c('0x42')]=qs[_0x513c('0x43')](_0x1874b1[_0x513c('0x3b')][_0x513c('0x43')]);_0x3aee99[_0x513c('0x44')]=qs[_0x513c('0x3d')](_[_0x513c('0x45')](_0x1874b1['query'],_0x54237b['filters']));if(_0x1874b1['query'][_0x513c('0x46')]){_0x3aee99[_0x513c('0x44')]=_[_0x513c('0x47')](_0x3aee99['where'],{'$or':_[_0x513c('0x3a')](_0x4bc902,function(_0x2d37d3){if(_0x2d37d3[_0x513c('0x38')]!==_0x513c('0x48')){var _0x19ec27={};_0x19ec27[_0x2d37d3[_0x513c('0x34')]]={'$like':'%'+_0x1874b1[_0x513c('0x3b')][_0x513c('0x46')]+'%'};return _0x19ec27;}})});}_0x3aee99=_['merge']({},_0x3aee99,_0x1874b1[_0x513c('0x49')]);var _0x19c05a={'where':_0x3aee99[_0x513c('0x44')]};return db[_0x513c('0x35')][_0x513c('0x2a')](_0x19c05a)[_0x513c('0x1c')](function(_0x3e9e8d){_0x131d12['count']=_0x3e9e8d;if(_0x1874b1[_0x513c('0x3b')][_0x513c('0x4a')]){_0x3aee99['include']=[{'all':!![]}];}return db['ChatQueue'][_0x513c('0x4b')](_0x3aee99);})[_0x513c('0x1c')](function(_0x42eb80){_0x131d12[_0x513c('0x4c')]=_0x42eb80;return _0x131d12;})[_0x513c('0x1c')](respondWithFilteredResult(_0x27b192,_0x3aee99))[_0x513c('0x26')](handleError(_0x27b192,null));};exports[_0x513c('0x4d')]=function(_0x27237d,_0x40ce03){var _0xcf8da7={'raw':!![],'where':{'id':_0x27237d[_0x513c('0x4e')]['id']}},_0x486bed={};_0x486bed[_0x513c('0x3e')]=_[_0x513c('0x3c')](db['ChatQueue']['rawAttributes']);_0x486bed[_0x513c('0x3b')]=_[_0x513c('0x3c')](_0x27237d['query']);_0x486bed[_0x513c('0x3d')]=_['intersection'](_0x486bed[_0x513c('0x3e')],_0x486bed[_0x513c('0x3b')]);_0xcf8da7[_0x513c('0x3f')]=_['intersection'](_0x486bed[_0x513c('0x3e')],qs[_0x513c('0x40')](_0x27237d[_0x513c('0x3b')][_0x513c('0x40')]));_0xcf8da7['attributes']=_0xcf8da7[_0x513c('0x3f')]['length']?_0xcf8da7[_0x513c('0x3f')]:_0x486bed[_0x513c('0x3e')];if(_0x27237d['query'][_0x513c('0x4a')]){_0xcf8da7[_0x513c('0x4f')]=[{'all':!![]}];}_0xcf8da7=_[_0x513c('0x47')]({},_0xcf8da7,_0x27237d[_0x513c('0x49')]);return db[_0x513c('0x35')][_0x513c('0x50')](_0xcf8da7)[_0x513c('0x1c')](handleEntityNotFound(_0x40ce03,null))[_0x513c('0x1c')](respondWithResult(_0x40ce03,null))[_0x513c('0x26')](handleError(_0x40ce03,null));};exports[_0x513c('0x51')]=function(_0x12be9f,_0xfa2258){return db['ChatQueue'][_0x513c('0x51')](_0x12be9f[_0x513c('0x52')],{})[_0x513c('0x1c')](function(_0x6b9c66){var _0x2c6771=_0x12be9f[_0x513c('0x53')][_0x513c('0x32')]({'plain':!![]});if(!_0x2c6771)throw new Error(_0x513c('0x54'));if(_0x2c6771['role']===_0x513c('0x53')){var _0x484e8d=_0x6b9c66[_0x513c('0x32')]({'plain':!![]});var _0x108e75='ChatQueues';return db[_0x513c('0x55')]['find']({'where':{'name':_0x108e75,'userProfileId':_0x2c6771[_0x513c('0x56')]},'raw':!![]})[_0x513c('0x1c')](function(_0x2a0d4c){if(_0x2a0d4c&&_0x2a0d4c['autoAssociation']===0x0){return db[_0x513c('0x57')][_0x513c('0x51')]({'name':_0x484e8d['name'],'resourceId':_0x484e8d['id'],'type':_0x2a0d4c[_0x513c('0x34')],'sectionId':_0x2a0d4c['id']},{})[_0x513c('0x1c')](function(){return _0x6b9c66;});}else{return _0x6b9c66;}})[_0x513c('0x26')](function(_0x193d37){logger['error'](_0x513c('0x58'),_0x193d37);throw _0x193d37;});}return _0x6b9c66;})[_0x513c('0x1c')](respondWithResult(_0xfa2258,0xc9))[_0x513c('0x26')](handleError(_0xfa2258,null));};exports['update']=function(_0x570fb4,_0x300eb0){if(_0x570fb4[_0x513c('0x52')]['id']){delete _0x570fb4['body']['id'];}return db[_0x513c('0x35')][_0x513c('0x50')]({'where':{'id':_0x570fb4[_0x513c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x300eb0,null))[_0x513c('0x1c')](saveUpdates(_0x570fb4[_0x513c('0x52')],null))[_0x513c('0x1c')](respondWithResult(_0x300eb0,null))[_0x513c('0x26')](handleError(_0x300eb0,null));};exports[_0x513c('0x31')]=function(_0x1e7cca,_0x550066){return db[_0x513c('0x35')][_0x513c('0x50')]({'where':{'id':_0x1e7cca[_0x513c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x550066,null))[_0x513c('0x1c')](removeEntity(_0x550066,null))[_0x513c('0x26')](handleError(_0x550066,null));};exports[_0x513c('0x59')]=function(_0x29e44a,_0x4eafde){return db['ChatQueue'][_0x513c('0x59')]()[_0x513c('0x1c')](respondWithResult(_0x4eafde,null))[_0x513c('0x26')](handleError(_0x4eafde,null));};exports['getMembers']=function(_0x405a0b,_0x39ef2b,_0x1078f7){var _0x725286={'raw':!![],'where':{}},_0x52f060={},_0x2af7f9;return db[_0x513c('0x35')][_0x513c('0x5a')]({'where':{'id':_0x405a0b[_0x513c('0x4e')]['id']}})[_0x513c('0x1c')](handleEntityNotFound(_0x39ef2b,null))['then'](function(_0x36544e){if(_0x36544e){_0x2af7f9=_0x36544e[_0x513c('0x32')]({'plain':!![]});_0x52f060[_0x513c('0x3e')]=_[_0x513c('0x3c')](db[_0x513c('0x5b')][_0x513c('0x36')]);_0x52f060[_0x513c('0x3b')]=_[_0x513c('0x3c')](_0x405a0b['query']);_0x52f060[_0x513c('0x3d')]=_['intersection'](_0x52f060['model'],_0x52f060[_0x513c('0x3b')]);_0x725286[_0x513c('0x3f')]=_[_0x513c('0x5c')](_0x52f060[_0x513c('0x3e')],qs['fields'](_0x405a0b[_0x513c('0x3b')][_0x513c('0x40')]));_0x725286['attributes']=_0x725286['attributes']['length']?_0x725286[_0x513c('0x3f')]:_0x52f060[_0x513c('0x3e')];if(!_0x405a0b[_0x513c('0x3b')]['hasOwnProperty'](_0x513c('0x41'))){_0x725286[_0x513c('0x2c')]=qs[_0x513c('0x2c')](_0x405a0b['query'][_0x513c('0x2c')]);_0x725286[_0x513c('0x2b')]=qs[_0x513c('0x2b')](_0x405a0b[_0x513c('0x3b')][_0x513c('0x2b')]);}_0x725286[_0x513c('0x42')]=qs[_0x513c('0x43')](_0x405a0b[_0x513c('0x3b')]['sort']);_0x725286[_0x513c('0x44')]=qs[_0x513c('0x3d')](_[_0x513c('0x45')](_0x405a0b[_0x513c('0x3b')],_0x52f060['filters']));_0x725286[_0x513c('0x44')][_0x513c('0x5d')]=_0x36544e['id'];if(_0x405a0b[_0x513c('0x3b')][_0x513c('0x46')]){_0x725286[_0x513c('0x44')]=_['merge'](_0x725286[_0x513c('0x44')],{'$or':_['map'](_0x725286[_0x513c('0x3f')],function(_0x40af0c){var _0x167403={};_0x167403[_0x40af0c]={'$like':'%'+_0x405a0b[_0x513c('0x3b')]['filter']+'%'};return _0x167403;})});}_0x725286=_['merge']({},_0x725286,_0x405a0b[_0x513c('0x49')]);return db[_0x513c('0x5b')][_0x513c('0x4b')](_0x725286);}})['then'](function(_0x5cb91b){if(_0x5cb91b){return db[_0x513c('0x5e')][_0x513c('0x5f')]({'where':{'id':_['map'](_0x5cb91b,'UserId'),'role':_0x513c('0x60')},'attributes':['id','name',_0x513c('0x61'),_0x513c('0x62'),_0x513c('0x63')]});}})[_0x513c('0x1c')](function(_0x5ef3e3){if(_0x5ef3e3){return{'count':_0x5ef3e3[_0x513c('0x2a')],'rows':_[_0x513c('0x3a')](_0x5ef3e3['rows'],function(_0x25580a){return{'membername':_0x25580a[_0x513c('0x34')],'UserId':_0x25580a['id'],'queue_name':_0x2af7f9['name'],'ChatQueueId':_0x2af7f9['id'],'interface':util[_0x513c('0x64')](_0x513c('0x65'),_0x513c('0x66'),_0x25580a[_0x513c('0x34')]),'penalty':0x0,'paused':_0x25580a[_0x513c('0x61')],'createdAt':_0x25580a['createdAt'],'updatedAt':_0x25580a[_0x513c('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x513c('0x1c')](respondWithFilteredResult(_0x39ef2b,_0x725286))['catch'](handleError(_0x39ef2b,null));};exports[_0x513c('0x67')]=function(_0x581c88,_0x14e978,_0x5568b2){var _0x402d1d={};var _0x583822={};var _0x364755;var _0x3961eb;return db[_0x513c('0x35')][_0x513c('0x5a')]({'where':{'id':_0x581c88['params']['id']}})[_0x513c('0x1c')](handleEntityNotFound(_0x14e978,null))['then'](function(_0x3ca1db){if(_0x3ca1db){_0x364755=_0x3ca1db;_0x583822[_0x513c('0x3e')]=_['keys'](db[_0x513c('0x68')][_0x513c('0x36')]);_0x583822[_0x513c('0x3b')]=_[_0x513c('0x3c')](_0x581c88[_0x513c('0x3b')]);_0x583822[_0x513c('0x3d')]=_[_0x513c('0x5c')](_0x583822['model'],_0x583822[_0x513c('0x3b')]);_0x402d1d[_0x513c('0x3f')]=_[_0x513c('0x5c')](_0x583822['model'],qs[_0x513c('0x40')](_0x581c88[_0x513c('0x3b')][_0x513c('0x40')]));_0x402d1d['attributes']=_0x402d1d[_0x513c('0x3f')]['length']?_0x402d1d[_0x513c('0x3f')]:_0x583822[_0x513c('0x3e')];_0x402d1d['order']=qs[_0x513c('0x43')](_0x581c88['query'][_0x513c('0x43')]);_0x402d1d[_0x513c('0x44')]=qs[_0x513c('0x3d')](_[_0x513c('0x45')](_0x581c88[_0x513c('0x3b')],_0x583822[_0x513c('0x3d')]));if(_0x581c88[_0x513c('0x3b')][_0x513c('0x46')]){_0x402d1d[_0x513c('0x44')]=_[_0x513c('0x47')](_0x402d1d[_0x513c('0x44')],{'$or':_[_0x513c('0x3a')](_0x402d1d[_0x513c('0x3f')],function(_0x5475b1){var _0x363c44={};_0x363c44[_0x5475b1]={'$like':'%'+_0x581c88['query'][_0x513c('0x46')]+'%'};return _0x363c44;})});}_0x402d1d=_['merge']({},_0x402d1d,_0x581c88['options']);return _0x364755['getTeams'](_0x402d1d);}})[_0x513c('0x1c')](function(_0x1670fc){if(_0x1670fc){_0x3961eb=_0x1670fc[_0x513c('0x69')];if(!_0x581c88[_0x513c('0x3b')][_0x513c('0x6a')]('nolimit')){_0x402d1d[_0x513c('0x2c')]=qs[_0x513c('0x2c')](_0x581c88[_0x513c('0x3b')][_0x513c('0x2c')]);_0x402d1d[_0x513c('0x2b')]=qs[_0x513c('0x2b')](_0x581c88[_0x513c('0x3b')][_0x513c('0x2b')]);}return _0x364755[_0x513c('0x67')](_0x402d1d);}})[_0x513c('0x1c')](function(_0x5b813b){if(_0x5b813b){return _0x5b813b?{'count':_0x3961eb,'rows':_0x5b813b}:null;}})['then'](respondWithResult(_0x14e978,null))['catch'](handleError(_0x14e978,null));};exports[_0x513c('0x6b')]=function(_0x5dcc77,_0x1c3166,_0x445eec){var _0x1cc13c=_0x5dcc77[_0x513c('0x52')][_0x513c('0x6c')];return db[_0x513c('0x68')][_0x513c('0x4b')]({'where':{'id':_0x1cc13c},'attributes':['id'],'include':[{'model':db['User'],'as':_0x513c('0x6d'),'attributes':['id','name','online','voicePause',_0x513c('0x6e')],'raw':!![]}]})[_0x513c('0x1c')](function(_0x36c7dc){if(_0x36c7dc){var _0x54f1a1=_['flatMap'](_0x36c7dc,function(_0x163679){var _0x5eec39=_0x163679[_0x513c('0x32')]({'plain':!![]});return _0x5eec39[_0x513c('0x6d')];});return db[_0x513c('0x35')][_0x513c('0x50')]({'where':{'id':_0x5dcc77[_0x513c('0x4e')]['id']}})[_0x513c('0x1c')](function(_0x53a4cc){return db[_0x513c('0x6f')][_0x513c('0x70')](function(_0x44fab1){return _0x53a4cc[_0x513c('0x6b')](_0x1cc13c,{'transaction':_0x44fab1})[_0x513c('0x1c')](function(){return BPromise[_0x513c('0x71')](_0x54f1a1,function(_0x6c47d7){return db[_0x513c('0x5b')][_0x513c('0x72')]({'where':{'UserId':_0x6c47d7['id'],'ChatQueueId':_0x5dcc77[_0x513c('0x4e')]['id']},'transaction':_0x44fab1});});})[_0x513c('0x1c')](function(){_0x54f1a1[_0x513c('0x73')](function(_0x583b96){socket[_0x513c('0x74')](_0x513c('0x75'),{'UserId':_0x583b96['id'],'ChatQueueId':_0x53a4cc['id']});});});});});}})[_0x513c('0x1c')](respondWithStatusCode(_0x1c3166,null))[_0x513c('0x26')](handleError(_0x1c3166,null));};exports[_0x513c('0x76')]=function(_0x93b218,_0xdf998c,_0x4fbfad){return db[_0x513c('0x68')][_0x513c('0x4b')]({'where':{'id':_0x93b218[_0x513c('0x3b')][_0x513c('0x6c')]},'attributes':['id'],'include':[{'model':db[_0x513c('0x5e')],'as':_0x513c('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x513c('0x1c')](handleEntityNotFound(_0xdf998c,null))[_0x513c('0x1c')](function(_0x948cc){var _0x37f87f=_[_0x513c('0x3a')](_0x948cc,'id');var _0x821ac8=[];var _0x33d747=[];var _0x2ff92a=squel[_0x513c('0x77')]();_0x2ff92a[_0x513c('0x78')](_0x513c('0x79'))['from'](_0x513c('0x7a'),'tq')[_0x513c('0x7b')](_0x513c('0x7c'),'ut',_0x513c('0x7d'))[_0x513c('0x44')](_0x513c('0x7e'),_0x93b218[_0x513c('0x4e')]['id']);for(var _0x476283=0x0;_0x476283<_0x948cc[_0x513c('0x69')];_0x476283+=0x1){let _0x3c2b16=_0x948cc[_0x476283];for(var _0x3ab4ff=0x0;_0x3ab4ff<_0x3c2b16['Agents'][_0x513c('0x69')];_0x3ab4ff+=0x1){let _0x45cecf=_0x3c2b16[_0x513c('0x6d')][_0x3ab4ff];var _0xe48d71=_0x2ff92a['clone']();_0xe48d71['where'](_0x513c('0x7f'),_0x45cecf['id']);_0x33d747[_0x513c('0x80')](db[_0x513c('0x6f')][_0x513c('0x3b')](_0xe48d71[_0x513c('0x81')](),{'type':db['sequelize'][_0x513c('0x82')][_0x513c('0x83')]})[_0x513c('0x1c')](function(_0x40d7d0){if(_0x40d7d0['length']===0x1){return _0x45cecf['id'];}else{var _0x23c5a0=_[_0x513c('0x84')](_[_0x513c('0x3a')](_0x40d7d0,_0x513c('0x85')),function(_0x41b655){return _['includes'](_0x37f87f,_0x41b655);});if(_0x23c5a0){return _0x45cecf['id'];}}}));}}return BPromise[_0x513c('0x86')](_0x33d747)[_0x513c('0x1c')](function(_0x4fac10){_0x821ac8=_(_0x821ac8)[_0x513c('0x87')](_0x4fac10)[_0x513c('0x88')]()['value']();return db['ChatQueue']['find']({'where':{'id':_0x93b218[_0x513c('0x4e')]['id']}})[_0x513c('0x1c')](function(_0x451043){return db[_0x513c('0x6f')][_0x513c('0x70')](function(_0x364221){return _0x451043['removeTeams'](_0x93b218[_0x513c('0x3b')][_0x513c('0x6c')],{'transaction':_0x364221})[_0x513c('0x1c')](function(){if(!_[_0x513c('0x89')](_0x821ac8)){return _0x451043[_0x513c('0x8a')](_0x821ac8,{'transaction':_0x364221});}})[_0x513c('0x1c')](function(){_0x821ac8[_0x513c('0x73')](function(_0x381cc8){socket[_0x513c('0x74')](_0x513c('0x8b'),{'UserId':_0x381cc8,'ChatQueueId':_0x451043['id']});});});});});});})[_0x513c('0x1c')](respondWithStatusCode(_0xdf998c,null))[_0x513c('0x26')](handleError(_0xdf998c,null));};exports[_0x513c('0x8c')]=function(_0xa416e0,_0x119ef6,_0xd8c703){return db[_0x513c('0x35')][_0x513c('0x50')]({'where':{'id':_0xa416e0[_0x513c('0x4e')]['id']}})[_0x513c('0x1c')](handleEntityNotFound(_0x119ef6,null))['then'](function(_0x51817d){if(_0x51817d){return _0x51817d[_0x513c('0x8c')](_0xa416e0[_0x513c('0x52')]['ids'],_['omit'](_0xa416e0[_0x513c('0x52')],[_0x513c('0x6c'),'id'])||{})['spread'](function(_0x5261a8){for(var _0x5af11b=0x0;_0x5af11b<_0xa416e0[_0x513c('0x52')][_0x513c('0x6c')]['length'];_0x5af11b+=0x1){socket[_0x513c('0x74')]('userChatQueue:save',{'UserId':_0xa416e0[_0x513c('0x52')][_0x513c('0x6c')][_0x5af11b],'ChatQueueId':_0xa416e0['params']['id']});}return _0x5261a8;});}})[_0x513c('0x1c')](respondWithResult(_0x119ef6,null))['catch'](handleError(_0x119ef6,null));};exports[_0x513c('0x8a')]=function(_0xb68731,_0x42472c,_0x20b88d){return db[_0x513c('0x35')][_0x513c('0x50')]({'where':{'id':_0xb68731[_0x513c('0x4e')]['id']}})[_0x513c('0x1c')](handleEntityNotFound(_0x42472c,null))[_0x513c('0x1c')](function(_0x59e8b4){if(_0x59e8b4){return _0x59e8b4[_0x513c('0x8a')](_0xb68731[_0x513c('0x3b')][_0x513c('0x6c')])['then'](function(){if(_[_0x513c('0x8d')](_0xb68731[_0x513c('0x3b')][_0x513c('0x6c')])){for(var _0x4f1838=0x0;_0x4f1838<_0xb68731[_0x513c('0x3b')][_0x513c('0x6c')][_0x513c('0x69')];_0x4f1838+=0x1){socket['emit'](_0x513c('0x8b'),{'UserId':Number(_0xb68731[_0x513c('0x3b')][_0x513c('0x6c')][_0x4f1838]),'ChatQueueId':Number(_0xb68731[_0x513c('0x4e')]['id'])});}}else{socket[_0x513c('0x74')](_0x513c('0x8b'),{'UserId':Number(_0xb68731[_0x513c('0x3b')][_0x513c('0x6c')]),'ChatQueueId':Number(_0xb68731[_0x513c('0x4e')]['id'])});}});}})[_0x513c('0x1c')](respondWithStatusCode(_0x42472c,null))['catch'](handleError(_0x42472c,null));};exports[_0x513c('0x8e')]=function(_0x613aa8,_0x52228b,_0x5a2740){var _0x3e3e0f={};var _0x2b00c9={};var _0x3991d5;var _0x13daa2;return db[_0x513c('0x35')]['findOne']({'where':{'id':_0x613aa8[_0x513c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x52228b,null))['then'](function(_0xfec7e1){if(_0xfec7e1){_0x3991d5=_0xfec7e1;_0x2b00c9['model']=_[_0x513c('0x3c')](db[_0x513c('0x5e')][_0x513c('0x36')]);_0x2b00c9[_0x513c('0x3b')]=_[_0x513c('0x3c')](_0x613aa8['query']);_0x2b00c9['filters']=_[_0x513c('0x5c')](_0x2b00c9[_0x513c('0x3e')],_0x2b00c9['query']);_0x3e3e0f[_0x513c('0x3f')]=_['intersection'](_0x2b00c9[_0x513c('0x3e')],qs[_0x513c('0x40')](_0x613aa8[_0x513c('0x3b')]['fields']));_0x3e3e0f['attributes']=_0x3e3e0f[_0x513c('0x3f')][_0x513c('0x69')]?_0x3e3e0f[_0x513c('0x3f')]:_0x2b00c9[_0x513c('0x3e')];_0x3e3e0f[_0x513c('0x42')]=qs[_0x513c('0x43')](_0x613aa8[_0x513c('0x3b')][_0x513c('0x43')]);_0x3e3e0f['where']=qs[_0x513c('0x3d')](_[_0x513c('0x45')](_0x613aa8[_0x513c('0x3b')],_0x2b00c9[_0x513c('0x3d')]));if(_0x613aa8['query'][_0x513c('0x46')]){_0x3e3e0f[_0x513c('0x44')]=_['merge'](_0x3e3e0f[_0x513c('0x44')],{'$or':_[_0x513c('0x3a')](_0x3e3e0f[_0x513c('0x3f')],function(_0x41ed24){var _0x21276b={};_0x21276b[_0x41ed24]={'$like':'%'+_0x613aa8['query'][_0x513c('0x46')]+'%'};return _0x21276b;})});}_0x3e3e0f=_['merge']({},_0x3e3e0f,_0x613aa8[_0x513c('0x49')]);return _0x3991d5[_0x513c('0x8e')](_0x3e3e0f);}})['then'](function(_0x576908){if(_0x576908){_0x13daa2=_0x576908[_0x513c('0x69')];if(!_0x613aa8[_0x513c('0x3b')][_0x513c('0x6a')](_0x513c('0x41'))){_0x3e3e0f[_0x513c('0x2c')]=qs[_0x513c('0x2c')](_0x613aa8['query']['limit']);_0x3e3e0f['offset']=qs[_0x513c('0x2b')](_0x613aa8[_0x513c('0x3b')][_0x513c('0x2b')]);}return _0x3991d5[_0x513c('0x8e')](_0x3e3e0f);}})[_0x513c('0x1c')](function(_0x5af531){if(_0x5af531){return _0x5af531?{'count':_0x13daa2,'rows':_0x5af531}:null;}})[_0x513c('0x1c')](respondWithResult(_0x52228b,null))[_0x513c('0x26')](handleError(_0x52228b,null));}; \ No newline at end of file +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 diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 059427f..f8ecc8d 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(_0x32208e,_0x1b0092){var _0x2700a1=function(_0xe2fe49){while(--_0xe2fe49){_0x32208e['push'](_0x32208e['shift']());}};_0x2700a1(++_0x1b0092);}(_0xb10b,0x12a));var _0xbb10=function(_0x19a1bf,_0xd46be){_0x19a1bf=_0x19a1bf-0x0;var _0x4e8a3e=_0xb10b[_0x19a1bf];return _0x4e8a3e;};'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 _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 diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 1c0d1c1..22f17ff 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 _0x0452=['./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x2a07c9,_0x185c10){var _0x4e5723=function(_0x43ae97){while(--_0x43ae97){_0x2a07c9['push'](_0x2a07c9['shift']());}};_0x4e5723(++_0x185c10);}(_0x0452,0x1f3));var _0x2045=function(_0x1cd6e4,_0xbab29b){_0x1cd6e4=_0x1cd6e4-0x0;var _0x1cbbf5=_0x0452[_0x1cd6e4];return _0x1cbbf5;};'use strict';var _=require(_0x2045('0x0'));var util=require(_0x2045('0x1'));var logger=require(_0x2045('0x2'))(_0x2045('0x3'));var moment=require(_0x2045('0x4'));var BPromise=require('bluebird');var rp=require(_0x2045('0x5'));var fs=require('fs');var path=require(_0x2045('0x6'));var rimraf=require(_0x2045('0x7'));var config=require('../../config/environment');var attributes=require(_0x2045('0x8'));module[_0x2045('0x9')]=function(_0x9d614c,_0x4cd77b){return _0x9d614c[_0x2045('0xa')](_0x2045('0xb'),attributes,{'tableName':_0x2045('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 54306d8..229c779 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 _0xa702=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','defaults','redis','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetChatQueue','ChatQueue','findAll','options','attributes','limit','include','map','model','ShowChatQueue','find','raw'];(function(_0x5aff84,_0x2dc9f1){var _0x151fc8=function(_0x399808){while(--_0x399808){_0x5aff84['push'](_0x5aff84['shift']());}};_0x151fc8(++_0x2dc9f1);}(_0xa702,0x1ae));var _0x2a70=function(_0x24def0,_0x1d6487){_0x24def0=_0x24def0-0x0;var _0x420ed6=_0xa702[_0x24def0];return _0x420ed6;};'use strict';var _=require(_0x2a70('0x0'));var util=require(_0x2a70('0x1'));var moment=require(_0x2a70('0x2'));var BPromise=require(_0x2a70('0x3'));var rs=require(_0x2a70('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a70('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2a70('0x6'));var config=require('../../config/environment');var jayson=require(_0x2a70('0x7'));var client=jayson[_0x2a70('0x8')]['http']({'port':0x232a});config['redis']=_[_0x2a70('0x9')](config[_0x2a70('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x2a70('0xb'))(new Redis(config['redis']));require(_0x2a70('0xc'))[_0x2a70('0xd')](socket);function respondWithRpcPromise(_0x1b4b60,_0xee19e8,_0x5b2b40){return new BPromise(function(_0xe9145f,_0x2fcb36){return client[_0x2a70('0xe')](_0x1b4b60,_0x5b2b40)[_0x2a70('0xf')](function(_0x941803){logger[_0x2a70('0x10')](_0x2a70('0x11'),_0xee19e8,'request\x20sent');logger[_0x2a70('0x12')](_0x2a70('0x13'),_0xee19e8,_0x2a70('0x14'),JSON[_0x2a70('0x15')](_0x941803));if(_0x941803[_0x2a70('0x16')]){if(_0x941803['error'][_0x2a70('0x17')]===0x1f4){logger[_0x2a70('0x16')]('ChatQueue,\x20%s,\x20%s',_0xee19e8,_0x941803[_0x2a70('0x16')][_0x2a70('0x18')]);return _0x2fcb36(_0x941803['error'][_0x2a70('0x18')]);}logger[_0x2a70('0x16')]('ChatQueue,\x20%s,\x20%s',_0xee19e8,_0x941803['error'][_0x2a70('0x18')]);return _0xe9145f(_0x941803[_0x2a70('0x16')][_0x2a70('0x18')]);}else{logger[_0x2a70('0x10')](_0x2a70('0x11'),_0xee19e8,'request\x20sent');_0xe9145f(_0x941803[_0x2a70('0x19')][_0x2a70('0x18')]);}})['catch'](function(_0x4de9bd){logger[_0x2a70('0x16')](_0x2a70('0x11'),_0xee19e8,_0x4de9bd);_0x2fcb36(_0x4de9bd);});});}exports[_0x2a70('0x1a')]=function(_0x48cef4){var _0x12682d=this;return new Promise(function(_0x203670,_0x1b7764){return db[_0x2a70('0x1b')][_0x2a70('0x1c')]({'raw':_0x48cef4[_0x2a70('0x1d')]?_0x48cef4[_0x2a70('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x48cef4['options']?_0x48cef4[_0x2a70('0x1d')]['where']||null:null,'attributes':_0x48cef4[_0x2a70('0x1d')]?_0x48cef4[_0x2a70('0x1d')][_0x2a70('0x1e')]||null:null,'limit':_0x48cef4[_0x2a70('0x1d')]?_0x48cef4[_0x2a70('0x1d')][_0x2a70('0x1f')]||null:null,'include':_0x48cef4[_0x2a70('0x1d')]?_0x48cef4[_0x2a70('0x1d')][_0x2a70('0x20')]?_[_0x2a70('0x21')](_0x48cef4[_0x2a70('0x1d')][_0x2a70('0x20')],function(_0x530b1b){return{'model':db[_0x530b1b['model']],'as':_0x530b1b['as'],'attributes':_0x530b1b[_0x2a70('0x1e')],'include':_0x530b1b[_0x2a70('0x20')]?_[_0x2a70('0x21')](_0x530b1b[_0x2a70('0x20')],function(_0x5b04be){return{'model':db[_0x5b04be[_0x2a70('0x22')]],'as':_0x5b04be['as'],'attributes':_0x5b04be[_0x2a70('0x1e')],'include':_0x5b04be[_0x2a70('0x20')]?_[_0x2a70('0x21')](_0x5b04be['include'],function(_0x588efc){return{'model':db[_0x588efc['model']],'as':_0x588efc['as'],'attributes':_0x588efc[_0x2a70('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x22fb1b){logger['info'](_0x2a70('0x1a'),_0x48cef4);logger['debug'](_0x2a70('0x1a'),_0x48cef4,JSON[_0x2a70('0x15')](_0x22fb1b));_0x203670(_0x22fb1b);})['catch'](function(_0x4b0d70){logger[_0x2a70('0x16')](_0x2a70('0x1a'),_0x4b0d70['message'],_0x48cef4);_0x1b7764(_0x12682d[_0x2a70('0x16')](0x1f4,_0x4b0d70[_0x2a70('0x18')]));});});};exports[_0x2a70('0x23')]=function(_0x2174a6){var _0x5954d2=this;return new Promise(function(_0x203e02,_0x10fe85){return db[_0x2a70('0x1b')][_0x2a70('0x24')]({'raw':_0x2174a6[_0x2a70('0x1d')]?_0x2174a6[_0x2a70('0x1d')][_0x2a70('0x25')]===undefined?!![]:![]:!![],'where':_0x2174a6[_0x2a70('0x1d')]?_0x2174a6['options']['where']||null:null,'attributes':_0x2174a6[_0x2a70('0x1d')]?_0x2174a6[_0x2a70('0x1d')]['attributes']||null:null,'include':_0x2174a6[_0x2a70('0x1d')]?_0x2174a6[_0x2a70('0x1d')][_0x2a70('0x20')]?_[_0x2a70('0x21')](_0x2174a6[_0x2a70('0x1d')][_0x2a70('0x20')],function(_0x2c0f36){return{'model':db[_0x2c0f36[_0x2a70('0x22')]],'as':_0x2c0f36['as'],'attributes':_0x2c0f36[_0x2a70('0x1e')],'include':_0x2c0f36['include']?_[_0x2a70('0x21')](_0x2c0f36[_0x2a70('0x20')],function(_0x46b3f7){return{'model':db[_0x46b3f7['model']],'as':_0x46b3f7['as'],'attributes':_0x46b3f7[_0x2a70('0x1e')],'include':_0x46b3f7[_0x2a70('0x20')]?_[_0x2a70('0x21')](_0x46b3f7[_0x2a70('0x20')],function(_0x4165eb){return{'model':db[_0x4165eb[_0x2a70('0x22')]],'as':_0x4165eb['as'],'attributes':_0x4165eb[_0x2a70('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2a70('0xf')](function(_0x5f4241){logger[_0x2a70('0x10')](_0x2a70('0x23'),_0x2174a6);logger[_0x2a70('0x12')](_0x2a70('0x23'),_0x2174a6,JSON[_0x2a70('0x15')](_0x5f4241));_0x203e02(_0x5f4241);})[_0x2a70('0x26')](function(_0x5182d2){logger[_0x2a70('0x16')](_0x2a70('0x23'),_0x5182d2[_0x2a70('0x18')],_0x2174a6);_0x10fe85(_0x5954d2['error'](0x1f4,_0x5182d2[_0x2a70('0x18')]));});});}; \ No newline at end of file +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 diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index dd8bddd..0e95b80 100644 --- a/server/api/chatQueue/chatQueue.socket.js +++ b/server/api/chatQueue/chatQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['remove','update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x2264a1,_0x1a38b7){var _0x14de54=function(_0x1f5036){while(--_0x1f5036){_0x2264a1['push'](_0x2264a1['shift']());}};_0x14de54(++_0x1a38b7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1afadf,_0x357131){_0x1afadf=_0x1afadf-0x0;var _0x3a3b4a=_0x5f2f[_0x1afadf];return _0x3a3b4a;};'use strict';var ChatQueueEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatQueueEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatQueueEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file +var _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 diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index c7a6de3..291a06a 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 _0xab82=['/:id/users','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','connect-timeout','Router','../../components/auth/service','./chatQueue.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/teams'];(function(_0x4843f9,_0x4af459){var _0x193c6a=function(_0x51eca9){while(--_0x51eca9){_0x4843f9['push'](_0x4843f9['shift']());}};_0x193c6a(++_0x4af459);}(_0xab82,0x18c));var _0x2ab8=function(_0x5b35bd,_0x54e699){_0x5b35bd=_0x5b35bd-0x0;var _0x45302a=_0xab82[_0x5b35bd];return _0x45302a;};'use strict';var multer=require(_0x2ab8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2ab8('0x1'));var express=require('express');var router=express[_0x2ab8('0x2')]();var auth=require(_0x2ab8('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2ab8('0x4'));router['get']('/',auth[_0x2ab8('0x5')](),controller['index']);router[_0x2ab8('0x6')](_0x2ab8('0x7'),auth[_0x2ab8('0x5')](),controller[_0x2ab8('0x8')]);router[_0x2ab8('0x6')](_0x2ab8('0x9'),auth[_0x2ab8('0x5')](),controller[_0x2ab8('0xa')]);router['get']('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0x2ab8('0x6')](_0x2ab8('0xb'),auth['isAuthenticated'](),controller['getTeams']);router['get'](_0x2ab8('0xc'),auth[_0x2ab8('0x5')](),controller['getAgents']);router[_0x2ab8('0xd')]('/',auth[_0x2ab8('0x5')](),controller[_0x2ab8('0xe')]);router['post'](_0x2ab8('0xb'),auth[_0x2ab8('0x5')](),controller[_0x2ab8('0xf')]);router[_0x2ab8('0xd')](_0x2ab8('0xc'),auth[_0x2ab8('0x5')](),controller[_0x2ab8('0x10')]);router[_0x2ab8('0x11')](_0x2ab8('0x9'),auth[_0x2ab8('0x5')](),controller[_0x2ab8('0x12')]);router[_0x2ab8('0x13')](_0x2ab8('0x9'),auth[_0x2ab8('0x5')](),controller[_0x2ab8('0x14')]);router['delete'](_0x2ab8('0xb'),auth['isAuthenticated'](),controller[_0x2ab8('0x15')]);router[_0x2ab8('0x13')](_0x2ab8('0xc'),auth[_0x2ab8('0x5')](),controller[_0x2ab8('0x16')]);module[_0x2ab8('0x17')]=router; \ No newline at end of file +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 diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 47d8636..fbee766 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 _0xdee9=['sequelize','exports','STRING','DATE'];(function(_0x3b690c,_0x48c609){var _0x382af6=function(_0x5f2a32){while(--_0x5f2a32){_0x3b690c['push'](_0x3b690c['shift']());}};_0x382af6(++_0x48c609);}(_0xdee9,0x138));var _0x9dee=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xdee9[_0x1abb09];return _0xea1c07;};'use strict';var moment=require('moment');var Sequelize=require(_0x9dee('0x0'));module[_0x9dee('0x1')]={'uniqueid':{'type':Sequelize[_0x9dee('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x9dee('0x3')]},'leaveAt':{'type':Sequelize[_0x9dee('0x3')]},'acceptAt':{'type':Sequelize[_0x9dee('0x3')]},'exitAt':{'type':Sequelize[_0x9dee('0x3')]},'reason':{'type':Sequelize[_0x9dee('0x2')]}}; \ No newline at end of file +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 diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index aff3119..3c67adf 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 _0xf922=['nolimit','limit','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','ejs','lodash','squel','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','reject','save','update','then','destroy','error','stack','name','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x544ab2,_0x5120c6){var _0x4a3f71=function(_0x562970){while(--_0x562970){_0x544ab2['push'](_0x544ab2['shift']());}};_0x4a3f71(++_0x5120c6);}(_0xf922,0x1ef));var _0x2f92=function(_0x4a21d9,_0x39c503){_0x4a21d9=_0x4a21d9-0x0;var _0xc35abb=_0xf922[_0x4a21d9];return _0xc35abb;};'use strict';var pdf=require(_0x2f92('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2f92('0x1'));var zipdir=require(_0x2f92('0x2'));var jsonpatch=require(_0x2f92('0x3'));var rp=require('request-promise');var moment=require(_0x2f92('0x4'));var BPromise=require(_0x2f92('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2f92('0x6'));var csv=require('to-csv');var ejs=require(_0x2f92('0x7'));var fs=require('fs');var _=require(_0x2f92('0x8'));var squel=require(_0x2f92('0x9'));var crypto=require('crypto');var jsforce=require(_0x2f92('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x2f92('0xb'));var querystring=require('querystring');var Papa=require(_0x2f92('0xc'));var Redis=require(_0x2f92('0xd'));var authService=require(_0x2f92('0xe'));var qs=require(_0x2f92('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x2f92('0x10'));var config=require(_0x2f92('0x11'));var db=require(_0x2f92('0x12'))['db'];function respondWithStatusCode(_0x24749c,_0x128679){_0x128679=_0x128679||0xcc;return function(_0x3fa50e){if(_0x3fa50e){return _0x24749c[_0x2f92('0x13')](_0x128679);}return _0x24749c[_0x2f92('0x14')](_0x128679)[_0x2f92('0x15')]();};}function respondWithResult(_0x477315,_0x2ba4d1){_0x2ba4d1=_0x2ba4d1||0xc8;return function(_0x503606){if(_0x503606){return _0x477315['status'](_0x2ba4d1)[_0x2f92('0x16')](_0x503606);}};}function respondWithFilteredResult(_0x59377a,_0x3ecb65){return function(_0x345148){if(_0x345148){var _0x447f0f=_0x345148[_0x2f92('0x17')],_0x481be2=_0x3ecb65['offset'],_0x508d81=_0x3ecb65[_0x2f92('0x18')]+_0x3ecb65['limit'],_0x428877;if(_0x508d81>=_0x447f0f){_0x508d81=_0x447f0f;_0x428877=0xc8;}else{_0x428877=0xce;}_0x59377a[_0x2f92('0x14')](_0x428877);return _0x59377a['set']('Content-Range',_0x481be2+'-'+_0x508d81+'/'+_0x447f0f)['json'](_0x345148);}return null;};}function patchUpdates(_0x4b9bfc){return function(_0x1efb81){try{jsonpatch['apply'](_0x1efb81,_0x4b9bfc,!![]);}catch(_0x206166){return BPromise[_0x2f92('0x19')](_0x206166);}return _0x1efb81[_0x2f92('0x1a')]();};}function saveUpdates(_0x26476d,_0x50b490){return function(_0x2d7e51){if(_0x2d7e51){return _0x2d7e51[_0x2f92('0x1b')](_0x26476d)[_0x2f92('0x1c')](function(_0x3e0ae5){return _0x3e0ae5;});}return null;};}function removeEntity(_0x31b721,_0x566f64){return function(_0x451076){if(_0x451076){return _0x451076[_0x2f92('0x1d')]()['then'](function(){_0x31b721['status'](0xcc)[_0x2f92('0x15')]();});}};}function handleEntityNotFound(_0x58d2a1,_0x25df87){return function(_0x4d6a25){if(!_0x4d6a25){_0x58d2a1[_0x2f92('0x13')](0x194);}return _0x4d6a25;};}function handleError(_0x22982e,_0x49803c){_0x49803c=_0x49803c||0x1f4;return function(_0x7e48c2){logger[_0x2f92('0x1e')](_0x7e48c2[_0x2f92('0x1f')]);if(_0x7e48c2[_0x2f92('0x20')]){delete _0x7e48c2[_0x2f92('0x20')];}_0x22982e[_0x2f92('0x14')](_0x49803c)['send'](_0x7e48c2);};}exports[_0x2f92('0x21')]=function(_0x50608a,_0x472c84){var _0x1fcf8b={},_0x464317={},_0x135749={'count':0x0,'rows':[]};var _0xefd13d=_[_0x2f92('0x22')](db[_0x2f92('0x23')][_0x2f92('0x24')],function(_0x404cad){return{'name':_0x404cad[_0x2f92('0x25')],'type':_0x404cad[_0x2f92('0x26')][_0x2f92('0x27')]};});_0x464317[_0x2f92('0x28')]=_[_0x2f92('0x22')](_0xefd13d,_0x2f92('0x20'));_0x464317[_0x2f92('0x29')]=_[_0x2f92('0x2a')](_0x50608a[_0x2f92('0x29')]);_0x464317[_0x2f92('0x2b')]=_[_0x2f92('0x2c')](_0x464317[_0x2f92('0x28')],_0x464317[_0x2f92('0x29')]);_0x1fcf8b[_0x2f92('0x2d')]=_[_0x2f92('0x2c')](_0x464317[_0x2f92('0x28')],qs[_0x2f92('0x2e')](_0x50608a[_0x2f92('0x29')]['fields']));_0x1fcf8b[_0x2f92('0x2d')]=_0x1fcf8b[_0x2f92('0x2d')][_0x2f92('0x2f')]?_0x1fcf8b[_0x2f92('0x2d')]:_0x464317['model'];if(!_0x50608a['query'][_0x2f92('0x30')](_0x2f92('0x31'))){_0x1fcf8b[_0x2f92('0x32')]=qs['limit'](_0x50608a[_0x2f92('0x29')][_0x2f92('0x32')]);_0x1fcf8b[_0x2f92('0x18')]=qs[_0x2f92('0x18')](_0x50608a['query'][_0x2f92('0x18')]);}_0x1fcf8b['order']=qs[_0x2f92('0x33')](_0x50608a[_0x2f92('0x29')]['sort']);_0x1fcf8b[_0x2f92('0x34')]=qs[_0x2f92('0x2b')](_[_0x2f92('0x35')](_0x50608a[_0x2f92('0x29')],_0x464317[_0x2f92('0x2b')]));if(_0x50608a[_0x2f92('0x29')][_0x2f92('0x36')]){_0x1fcf8b[_0x2f92('0x34')]=_[_0x2f92('0x37')](_0x1fcf8b[_0x2f92('0x34')],{'$or':_[_0x2f92('0x22')](_0xefd13d,function(_0x17ac71){if(_0x17ac71['type']!=='VIRTUAL'){var _0x53abf2={};_0x53abf2[_0x17ac71[_0x2f92('0x20')]]={'$like':'%'+_0x50608a[_0x2f92('0x29')]['filter']+'%'};return _0x53abf2;}})});}_0x1fcf8b=_[_0x2f92('0x37')]({},_0x1fcf8b,_0x50608a['options']);var _0x329a72={'where':_0x1fcf8b['where']};return db[_0x2f92('0x23')][_0x2f92('0x17')](_0x329a72)[_0x2f92('0x1c')](function(_0x44d45f){_0x135749[_0x2f92('0x17')]=_0x44d45f;if(_0x50608a['query'][_0x2f92('0x38')]){_0x1fcf8b['include']=[{'all':!![]}];}return db[_0x2f92('0x23')][_0x2f92('0x39')](_0x1fcf8b);})['then'](function(_0x5b5c26){_0x135749[_0x2f92('0x3a')]=_0x5b5c26;return _0x135749;})['then'](respondWithFilteredResult(_0x472c84,_0x1fcf8b))[_0x2f92('0x3b')](handleError(_0x472c84,null));};exports[_0x2f92('0x3c')]=function(_0x1bb07b,_0x50ccf1){var _0x4c0c1c={'raw':!![],'where':{'id':_0x1bb07b[_0x2f92('0x3d')]['id']}},_0x39c75b={};_0x39c75b[_0x2f92('0x28')]=_[_0x2f92('0x2a')](db[_0x2f92('0x23')][_0x2f92('0x24')]);_0x39c75b[_0x2f92('0x29')]=_[_0x2f92('0x2a')](_0x1bb07b[_0x2f92('0x29')]);_0x39c75b[_0x2f92('0x2b')]=_['intersection'](_0x39c75b[_0x2f92('0x28')],_0x39c75b[_0x2f92('0x29')]);_0x4c0c1c[_0x2f92('0x2d')]=_[_0x2f92('0x2c')](_0x39c75b[_0x2f92('0x28')],qs[_0x2f92('0x2e')](_0x1bb07b[_0x2f92('0x29')][_0x2f92('0x2e')]));_0x4c0c1c['attributes']=_0x4c0c1c[_0x2f92('0x2d')][_0x2f92('0x2f')]?_0x4c0c1c[_0x2f92('0x2d')]:_0x39c75b[_0x2f92('0x28')];if(_0x1bb07b[_0x2f92('0x29')][_0x2f92('0x38')]){_0x4c0c1c[_0x2f92('0x3e')]=[{'all':!![]}];}_0x4c0c1c=_[_0x2f92('0x37')]({},_0x4c0c1c,_0x1bb07b[_0x2f92('0x3f')]);return db[_0x2f92('0x23')][_0x2f92('0x40')](_0x4c0c1c)[_0x2f92('0x1c')](handleEntityNotFound(_0x50ccf1,null))['then'](respondWithResult(_0x50ccf1,null))[_0x2f92('0x3b')](handleError(_0x50ccf1,null));};exports[_0x2f92('0x41')]=function(_0xdb0e8c,_0x445e10){return db['ChatQueueReport']['create'](_0xdb0e8c[_0x2f92('0x42')],{})[_0x2f92('0x1c')](respondWithResult(_0x445e10,0xc9))['catch'](handleError(_0x445e10,null));};exports[_0x2f92('0x1b')]=function(_0xb3a5c0,_0x4dc56b){if(_0xb3a5c0[_0x2f92('0x42')]['id']){delete _0xb3a5c0[_0x2f92('0x42')]['id'];}return db['ChatQueueReport']['find']({'where':{'id':_0xb3a5c0[_0x2f92('0x3d')]['id']}})[_0x2f92('0x1c')](handleEntityNotFound(_0x4dc56b,null))[_0x2f92('0x1c')](saveUpdates(_0xb3a5c0['body'],null))[_0x2f92('0x1c')](respondWithResult(_0x4dc56b,null))[_0x2f92('0x3b')](handleError(_0x4dc56b,null));};exports['destroy']=function(_0x11b736,_0x2f6c9a){return db['ChatQueueReport'][_0x2f92('0x40')]({'where':{'id':_0x11b736[_0x2f92('0x3d')]['id']}})[_0x2f92('0x1c')](handleEntityNotFound(_0x2f6c9a,null))[_0x2f92('0x1c')](removeEntity(_0x2f6c9a,null))['catch'](handleError(_0x2f6c9a,null));};exports['describe']=function(_0x574f2c,_0x2133bf){return db[_0x2f92('0x23')][_0x2f92('0x43')]()['then'](respondWithResult(_0x2133bf,null))[_0x2f92('0x3b')](handleError(_0x2133bf,null));}; \ No newline at end of file +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 diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index b946c6b..12dfbda 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 _0x7327=['ChatQueueReport','report_chat_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x51b6a2,_0x44ad01){var _0x588351=function(_0x592d4d){while(--_0x592d4d){_0x51b6a2['push'](_0x51b6a2['shift']());}};_0x588351(++_0x44ad01);}(_0x7327,0x10d));var _0x7732=function(_0x4d18e,_0x37ce03){_0x4d18e=_0x4d18e-0x0;var _0x321637=_0x7327[_0x4d18e];return _0x321637;};'use strict';var _=require(_0x7732('0x0'));var util=require(_0x7732('0x1'));var logger=require(_0x7732('0x2'))('api');var moment=require(_0x7732('0x3'));var BPromise=require(_0x7732('0x4'));var rp=require(_0x7732('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7732('0x6'));var config=require(_0x7732('0x7'));var attributes=require(_0x7732('0x8'));module[_0x7732('0x9')]=function(_0x1bf68d,_0x5463cd){return _0x1bf68d[_0x7732('0xa')](_0x7732('0xb'),attributes,{'tableName':_0x7732('0xc'),'paranoid':![],'indexes':[{'name':_0x7732('0xd'),'fields':[_0x7732('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 8c408bb..80849f3 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 _0xef3f=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ChatQueueReport','create','body','then','CreateChatQueueReport','UpdateChatQueueReport','update','options','raw','where','attributes','limit','util'];(function(_0x1e2a33,_0x18a3bf){var _0x2c57c0=function(_0x5edfc6){while(--_0x5edfc6){_0x1e2a33['push'](_0x1e2a33['shift']());}};_0x2c57c0(++_0x18a3bf);}(_0xef3f,0x117));var _0xfef3=function(_0xc84a20,_0x37a91f){_0xc84a20=_0xc84a20-0x0;var _0x1516f6=_0xef3f[_0xc84a20];return _0x1516f6;};'use strict';var _=require('lodash');var util=require(_0xfef3('0x0'));var moment=require(_0xfef3('0x1'));var BPromise=require('bluebird');var rs=require(_0xfef3('0x2'));var fs=require('fs');var Redis=require(_0xfef3('0x3'));var db=require(_0xfef3('0x4'))['db'];var utils=require(_0xfef3('0x5'));var logger=require(_0xfef3('0x6'))(_0xfef3('0x7'));var config=require(_0xfef3('0x8'));var jayson=require(_0xfef3('0x9'));var client=jayson[_0xfef3('0xa')][_0xfef3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f8835,_0x4ffadc,_0x43a526){return new BPromise(function(_0x3dfef8,_0x56de97){return client[_0xfef3('0xc')](_0x2f8835,_0x43a526)['then'](function(_0xc65a85){logger[_0xfef3('0xd')](_0xfef3('0xe'),_0x4ffadc,_0xfef3('0xf'));logger[_0xfef3('0x10')](_0xfef3('0x11'),_0x4ffadc,_0xfef3('0xf'),JSON[_0xfef3('0x12')](_0xc65a85));if(_0xc65a85[_0xfef3('0x13')]){if(_0xc65a85['error']['code']===0x1f4){logger[_0xfef3('0x13')](_0xfef3('0xe'),_0x4ffadc,_0xc65a85[_0xfef3('0x13')]['message']);return _0x56de97(_0xc65a85['error'][_0xfef3('0x14')]);}logger[_0xfef3('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x4ffadc,_0xc65a85[_0xfef3('0x13')]['message']);return _0x3dfef8(_0xc65a85[_0xfef3('0x13')][_0xfef3('0x14')]);}else{logger['info'](_0xfef3('0xe'),_0x4ffadc,_0xfef3('0xf'));_0x3dfef8(_0xc65a85[_0xfef3('0x15')][_0xfef3('0x14')]);}})[_0xfef3('0x16')](function(_0x3ab85d){logger[_0xfef3('0x13')](_0xfef3('0xe'),_0x4ffadc,_0x3ab85d);_0x56de97(_0x3ab85d);});});}exports['CreateChatQueueReport']=function(_0x14d0a5){var _0x1a57c9=this;return new Promise(function(_0x5219d7,_0x3bb30a){return db[_0xfef3('0x17')][_0xfef3('0x18')](_0x14d0a5[_0xfef3('0x19')],{'raw':_0x14d0a5['options']?_0x14d0a5['options']['raw']===undefined?!![]:![]:!![]})[_0xfef3('0x1a')](function(_0x2a660c){logger[_0xfef3('0xd')]('CreateChatQueueReport',_0x14d0a5);logger['debug'](_0xfef3('0x1b'),_0x14d0a5,JSON[_0xfef3('0x12')](_0x2a660c));_0x5219d7(_0x2a660c);})['catch'](function(_0x58d678){logger[_0xfef3('0x13')]('CreateChatQueueReport',_0x58d678['message'],_0x14d0a5);_0x3bb30a(_0x1a57c9[_0xfef3('0x13')](0x1f4,_0x58d678[_0xfef3('0x14')]));});});};exports[_0xfef3('0x1c')]=function(_0x4f7910){var _0x593fbe=this;return new Promise(function(_0x107575,_0x10eb1a){return db[_0xfef3('0x17')][_0xfef3('0x1d')](_0x4f7910[_0xfef3('0x19')],{'raw':_0x4f7910[_0xfef3('0x1e')]?_0x4f7910[_0xfef3('0x1e')][_0xfef3('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f7910[_0xfef3('0x1e')]?_0x4f7910[_0xfef3('0x1e')][_0xfef3('0x20')]||null:null,'attributes':_0x4f7910[_0xfef3('0x1e')]?_0x4f7910[_0xfef3('0x1e')][_0xfef3('0x21')]||null:null,'limit':_0x4f7910[_0xfef3('0x1e')]?_0x4f7910[_0xfef3('0x1e')][_0xfef3('0x22')]||null:null})['then'](function(_0x2a0949){logger[_0xfef3('0xd')](_0xfef3('0x1c'),_0x4f7910);logger[_0xfef3('0x10')]('UpdateChatQueueReport',_0x4f7910,JSON[_0xfef3('0x12')](_0x2a0949));_0x107575(_0x2a0949);})[_0xfef3('0x16')](function(_0x1cd884){logger['error'](_0xfef3('0x1c'),_0x1cd884['message'],_0x4f7910);_0x10eb1a(_0x593fbe[_0xfef3('0x13')](0x1f4,_0x1cd884[_0xfef3('0x14')]));});});}; \ No newline at end of file +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 diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index bb406fb..2bdf4a6 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 _0x6923=['delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','/describe','get','/:id','show','create','update'];(function(_0x4ddd33,_0x32e00b){var _0x21e740=function(_0x24da79){while(--_0x24da79){_0x4ddd33['push'](_0x4ddd33['shift']());}};_0x21e740(++_0x32e00b);}(_0x6923,0x123));var _0x3692=function(_0x49f6a8,_0x155050){_0x49f6a8=_0x49f6a8-0x0;var _0xdb3eee=_0x6923[_0x49f6a8];return _0xdb3eee;};'use strict';var multer=require('multer');var util=require(_0x3692('0x0'));var path=require(_0x3692('0x1'));var timeout=require(_0x3692('0x2'));var express=require(_0x3692('0x3'));var router=express[_0x3692('0x4')]();var auth=require(_0x3692('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3692('0x6'));var controller=require(_0x3692('0x7'));router['get']('/',auth[_0x3692('0x8')](),controller['index']);router['get'](_0x3692('0x9'),auth[_0x3692('0x8')](),controller['describe']);router[_0x3692('0xa')](_0x3692('0xb'),auth[_0x3692('0x8')](),controller[_0x3692('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3692('0xd')]);router['put'](_0x3692('0xb'),auth['isAuthenticated'](),controller[_0x3692('0xe')]);router[_0x3692('0xf')](_0x3692('0xb'),auth['isAuthenticated'](),controller[_0x3692('0x10')]);module[_0x3692('0x11')]=router; \ No newline at end of file +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 diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index b5ad04b..e0c4612 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 _0xd59a=['DATE','moment','sequelize','exports','STRING','ENUM','account','agent','queue'];(function(_0x4962f9,_0x282d81){var _0x407be1=function(_0x5648eb){while(--_0x5648eb){_0x4962f9['push'](_0x4962f9['shift']());}};_0x407be1(++_0x282d81);}(_0xd59a,0x1f0));var _0xad59=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd59a[_0x321bb2];return _0x9c12ed;};'use strict';var moment=require(_0xad59('0x0'));var Sequelize=require(_0xad59('0x1'));module[_0xad59('0x2')]={'uniqueid':{'type':Sequelize[_0xad59('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xad59('0x4')](_0xad59('0x5'),_0xad59('0x6'),'queue'),'allowNull':![],'defaultValue':_0xad59('0x7')},'transferredAt':{'type':Sequelize[_0xad59('0x8')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +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 diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index fc3c098..98a2140 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 _0x1e81=['where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','params','rawAttributes','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','set','json','apply','save','update','then','destroy','error','name','send','index','map','ChatTransferReport','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0x1e81,0x9f));var _0x11e8=function(_0x11fdfb,_0x5e73b6){_0x11fdfb=_0x11fdfb-0x0;var _0x5e764f=_0x1e81[_0x11fdfb];return _0x5e764f;};'use strict';var pdf=require(_0x11e8('0x0'));var emlformat=require(_0x11e8('0x1'));var rimraf=require(_0x11e8('0x2'));var zipdir=require(_0x11e8('0x3'));var jsonpatch=require(_0x11e8('0x4'));var rp=require('request-promise');var moment=require(_0x11e8('0x5'));var BPromise=require(_0x11e8('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x11e8('0x7'));var sox=require(_0x11e8('0x8'));var csv=require('to-csv');var ejs=require(_0x11e8('0x9'));var fs=require('fs');var _=require(_0x11e8('0xa'));var squel=require('squel');var crypto=require(_0x11e8('0xb'));var jsforce=require(_0x11e8('0xc'));var deskjs=require(_0x11e8('0xd'));var toCsv=require(_0x11e8('0xe'));var querystring=require(_0x11e8('0xf'));var Papa=require(_0x11e8('0x10'));var Redis=require(_0x11e8('0x11'));var authService=require(_0x11e8('0x12'));var qs=require(_0x11e8('0x13'));var as=require(_0x11e8('0x14'));var hardwareService=require(_0x11e8('0x15'));var logger=require(_0x11e8('0x16'))('api');var utils=require(_0x11e8('0x17'));var config=require(_0x11e8('0x18'));var db=require(_0x11e8('0x19'))['db'];function respondWithStatusCode(_0x4492c4,_0x2a99cc){_0x2a99cc=_0x2a99cc||0xcc;return function(_0x5a29d7){if(_0x5a29d7){return _0x4492c4[_0x11e8('0x1a')](_0x2a99cc);}return _0x4492c4[_0x11e8('0x1b')](_0x2a99cc)['end']();};}function respondWithResult(_0x45905a,_0x9dd780){_0x9dd780=_0x9dd780||0xc8;return function(_0x25d14e){if(_0x25d14e){return _0x45905a['status'](_0x9dd780)['json'](_0x25d14e);}};}function respondWithFilteredResult(_0x3c209a,_0x33aff6){return function(_0x245ad9){if(_0x245ad9){var _0x27ca4d=_0x245ad9['count'],_0x93f117=_0x33aff6['offset'],_0x5a2c3a=_0x33aff6[_0x11e8('0x1c')]+_0x33aff6[_0x11e8('0x1d')],_0x252a06;if(_0x5a2c3a>=_0x27ca4d){_0x5a2c3a=_0x27ca4d;_0x252a06=0xc8;}else{_0x252a06=0xce;}_0x3c209a[_0x11e8('0x1b')](_0x252a06);return _0x3c209a[_0x11e8('0x1e')]('Content-Range',_0x93f117+'-'+_0x5a2c3a+'/'+_0x27ca4d)[_0x11e8('0x1f')](_0x245ad9);}return null;};}function patchUpdates(_0x1b7666){return function(_0x473098){try{jsonpatch[_0x11e8('0x20')](_0x473098,_0x1b7666,!![]);}catch(_0xe389ba){return BPromise['reject'](_0xe389ba);}return _0x473098[_0x11e8('0x21')]();};}function saveUpdates(_0x24fa8c,_0x311625){return function(_0x506f38){if(_0x506f38){return _0x506f38[_0x11e8('0x22')](_0x24fa8c)[_0x11e8('0x23')](function(_0x38bfba){return _0x38bfba;});}return null;};}function removeEntity(_0x5043d0,_0x3eecca){return function(_0x105b75){if(_0x105b75){return _0x105b75[_0x11e8('0x24')]()[_0x11e8('0x23')](function(){_0x5043d0[_0x11e8('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40b23e,_0x362b15){return function(_0x450a9c){if(!_0x450a9c){_0x40b23e[_0x11e8('0x1a')](0x194);}return _0x450a9c;};}function handleError(_0x13c1c0,_0x44a898){_0x44a898=_0x44a898||0x1f4;return function(_0x37ae4e){logger[_0x11e8('0x25')](_0x37ae4e['stack']);if(_0x37ae4e['name']){delete _0x37ae4e[_0x11e8('0x26')];}_0x13c1c0[_0x11e8('0x1b')](_0x44a898)[_0x11e8('0x27')](_0x37ae4e);};}exports[_0x11e8('0x28')]=function(_0x2864da,_0x4e35fb){var _0x4ff2fe={},_0x4457ee={},_0x34797d={'count':0x0,'rows':[]};var _0x3c3ee6=_[_0x11e8('0x29')](db[_0x11e8('0x2a')]['rawAttributes'],function(_0x28fdce){return{'name':_0x28fdce['fieldName'],'type':_0x28fdce[_0x11e8('0x2b')]['key']};});_0x4457ee[_0x11e8('0x2c')]=_[_0x11e8('0x29')](_0x3c3ee6,'name');_0x4457ee[_0x11e8('0x2d')]=_[_0x11e8('0x2e')](_0x2864da[_0x11e8('0x2d')]);_0x4457ee[_0x11e8('0x2f')]=_[_0x11e8('0x30')](_0x4457ee[_0x11e8('0x2c')],_0x4457ee['query']);_0x4ff2fe[_0x11e8('0x31')]=_[_0x11e8('0x30')](_0x4457ee['model'],qs[_0x11e8('0x32')](_0x2864da[_0x11e8('0x2d')][_0x11e8('0x32')]));_0x4ff2fe[_0x11e8('0x31')]=_0x4ff2fe[_0x11e8('0x31')]['length']?_0x4ff2fe[_0x11e8('0x31')]:_0x4457ee[_0x11e8('0x2c')];if(!_0x2864da[_0x11e8('0x2d')]['hasOwnProperty'](_0x11e8('0x33'))){_0x4ff2fe[_0x11e8('0x1d')]=qs['limit'](_0x2864da[_0x11e8('0x2d')][_0x11e8('0x1d')]);_0x4ff2fe[_0x11e8('0x1c')]=qs[_0x11e8('0x1c')](_0x2864da[_0x11e8('0x2d')][_0x11e8('0x1c')]);}_0x4ff2fe[_0x11e8('0x34')]=qs[_0x11e8('0x35')](_0x2864da[_0x11e8('0x2d')]['sort']);_0x4ff2fe[_0x11e8('0x36')]=qs['filters'](_[_0x11e8('0x37')](_0x2864da[_0x11e8('0x2d')],_0x4457ee[_0x11e8('0x2f')]));if(_0x2864da[_0x11e8('0x2d')][_0x11e8('0x38')]){_0x4ff2fe[_0x11e8('0x36')]=_[_0x11e8('0x39')](_0x4ff2fe[_0x11e8('0x36')],{'$or':_['map'](_0x3c3ee6,function(_0x24520a){if(_0x24520a[_0x11e8('0x2b')]!==_0x11e8('0x3a')){var _0xe4d712={};_0xe4d712[_0x24520a['name']]={'$like':'%'+_0x2864da[_0x11e8('0x2d')][_0x11e8('0x38')]+'%'};return _0xe4d712;}})});}_0x4ff2fe=_[_0x11e8('0x39')]({},_0x4ff2fe,_0x2864da[_0x11e8('0x3b')]);var _0x43b0d1={'where':_0x4ff2fe[_0x11e8('0x36')]};return db[_0x11e8('0x2a')][_0x11e8('0x3c')](_0x43b0d1)['then'](function(_0x5de98f){_0x34797d['count']=_0x5de98f;if(_0x2864da[_0x11e8('0x2d')][_0x11e8('0x3d')]){_0x4ff2fe[_0x11e8('0x3e')]=[{'all':!![]}];}return db[_0x11e8('0x2a')][_0x11e8('0x3f')](_0x4ff2fe);})[_0x11e8('0x23')](function(_0x1af452){_0x34797d['rows']=_0x1af452;return _0x34797d;})[_0x11e8('0x23')](respondWithFilteredResult(_0x4e35fb,_0x4ff2fe))[_0x11e8('0x40')](handleError(_0x4e35fb,null));};exports['show']=function(_0x34c0e0,_0x583568){var _0x29fea3={'raw':!![],'where':{'id':_0x34c0e0[_0x11e8('0x41')]['id']}},_0xec72b0={};_0xec72b0[_0x11e8('0x2c')]=_[_0x11e8('0x2e')](db[_0x11e8('0x2a')][_0x11e8('0x42')]);_0xec72b0['query']=_[_0x11e8('0x2e')](_0x34c0e0[_0x11e8('0x2d')]);_0xec72b0[_0x11e8('0x2f')]=_[_0x11e8('0x30')](_0xec72b0[_0x11e8('0x2c')],_0xec72b0['query']);_0x29fea3[_0x11e8('0x31')]=_['intersection'](_0xec72b0[_0x11e8('0x2c')],qs[_0x11e8('0x32')](_0x34c0e0[_0x11e8('0x2d')][_0x11e8('0x32')]));_0x29fea3[_0x11e8('0x31')]=_0x29fea3['attributes']['length']?_0x29fea3[_0x11e8('0x31')]:_0xec72b0[_0x11e8('0x2c')];if(_0x34c0e0[_0x11e8('0x2d')][_0x11e8('0x3d')]){_0x29fea3['include']=[{'all':!![]}];}_0x29fea3=_['merge']({},_0x29fea3,_0x34c0e0['options']);return db['ChatTransferReport'][_0x11e8('0x43')](_0x29fea3)[_0x11e8('0x23')](handleEntityNotFound(_0x583568,null))[_0x11e8('0x23')](respondWithResult(_0x583568,null))[_0x11e8('0x40')](handleError(_0x583568,null));};exports[_0x11e8('0x44')]=function(_0x53cd9e,_0x2c0d83){return db[_0x11e8('0x2a')][_0x11e8('0x44')](_0x53cd9e['body'],{})[_0x11e8('0x23')](respondWithResult(_0x2c0d83,0xc9))[_0x11e8('0x40')](handleError(_0x2c0d83,null));};exports[_0x11e8('0x22')]=function(_0x158df7,_0x2f5f32){if(_0x158df7['body']['id']){delete _0x158df7['body']['id'];}return db[_0x11e8('0x2a')][_0x11e8('0x43')]({'where':{'id':_0x158df7['params']['id']}})[_0x11e8('0x23')](handleEntityNotFound(_0x2f5f32,null))[_0x11e8('0x23')](saveUpdates(_0x158df7[_0x11e8('0x45')],null))['then'](respondWithResult(_0x2f5f32,null))[_0x11e8('0x40')](handleError(_0x2f5f32,null));};exports[_0x11e8('0x24')]=function(_0x1894b3,_0x4d865a){return db[_0x11e8('0x2a')][_0x11e8('0x43')]({'where':{'id':_0x1894b3[_0x11e8('0x41')]['id']}})['then'](handleEntityNotFound(_0x4d865a,null))[_0x11e8('0x23')](removeEntity(_0x4d865a,null))[_0x11e8('0x40')](handleError(_0x4d865a,null));};exports[_0x11e8('0x46')]=function(_0x297e26,_0x5d8e5e){return db['ChatTransferReport'][_0x11e8('0x46')]()[_0x11e8('0x23')](respondWithResult(_0x5d8e5e,null))[_0x11e8('0x40')](handleError(_0x5d8e5e,null));}; \ No newline at end of file +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 diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 4d994ac..99842f6 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 _0xc50c=['ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define'];(function(_0x2c27fa,_0x310e53){var _0x14b6f7=function(_0x5adcde){while(--_0x5adcde){_0x2c27fa['push'](_0x2c27fa['shift']());}};_0x14b6f7(++_0x310e53);}(_0xc50c,0x114));var _0xcc50=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xc50c[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xcc50('0x0'));var util=require(_0xcc50('0x1'));var logger=require(_0xcc50('0x2'))(_0xcc50('0x3'));var moment=require(_0xcc50('0x4'));var BPromise=require(_0xcc50('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc50('0x6'));var rimraf=require('rimraf');var config=require(_0xcc50('0x7'));var attributes=require('./chatTransferReport.attributes');module[_0xcc50('0x8')]=function(_0xac20c4,_0x4cbf5a){return _0xac20c4[_0xcc50('0x9')](_0xcc50('0xa'),attributes,{'tableName':_0xcc50('0xb'),'paranoid':![],'indexes':[{'name':_0xcc50('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index c3e779f..8d2e11c 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 _0x746c=['rpc','jayson/promise','client','http','then','info','ChatTransferReport,\x20%s,\x20%s','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2badeb,_0xfa4aef){var _0x523813=function(_0x345df5){while(--_0x345df5){_0x2badeb['push'](_0x2badeb['shift']());}};_0x523813(++_0xfa4aef);}(_0x746c,0xf5));var _0xc746=function(_0x322107,_0x5465f1){_0x322107=_0x322107-0x0;var _0x3d7f4d=_0x746c[_0x322107];return _0x3d7f4d;};'use strict';var _=require(_0xc746('0x0'));var util=require(_0xc746('0x1'));var moment=require('moment');var BPromise=require(_0xc746('0x2'));var rs=require(_0xc746('0x3'));var fs=require('fs');var Redis=require(_0xc746('0x4'));var db=require(_0xc746('0x5'))['db'];var utils=require(_0xc746('0x6'));var logger=require(_0xc746('0x7'))(_0xc746('0x8'));var config=require('../../config/environment');var jayson=require(_0xc746('0x9'));var client=jayson[_0xc746('0xa')][_0xc746('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36ad7e,_0x29b466,_0x5622d9){return new BPromise(function(_0x37bbe1,_0x2836e5){return client['request'](_0x36ad7e,_0x5622d9)[_0xc746('0xc')](function(_0x5cc8fe){logger[_0xc746('0xd')](_0xc746('0xe'),_0x29b466,'request\x20sent');logger['debug'](_0xc746('0xf'),_0x29b466,_0xc746('0x10'),JSON[_0xc746('0x11')](_0x5cc8fe));if(_0x5cc8fe['error']){if(_0x5cc8fe['error'][_0xc746('0x12')]===0x1f4){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x29b466,_0x5cc8fe[_0xc746('0x13')]['message']);return _0x2836e5(_0x5cc8fe[_0xc746('0x13')][_0xc746('0x14')]);}logger[_0xc746('0x13')]('ChatTransferReport,\x20%s,\x20%s',_0x29b466,_0x5cc8fe[_0xc746('0x13')][_0xc746('0x14')]);return _0x37bbe1(_0x5cc8fe['error'][_0xc746('0x14')]);}else{logger[_0xc746('0xd')](_0xc746('0xe'),_0x29b466,_0xc746('0x10'));_0x37bbe1(_0x5cc8fe[_0xc746('0x15')][_0xc746('0x14')]);}})[_0xc746('0x16')](function(_0x23146e){logger['error'](_0xc746('0xe'),_0x29b466,_0x23146e);_0x2836e5(_0x23146e);});});} \ No newline at end of file +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 diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 917716e..9f34970 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 _0x5f2f=['/describe','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x194d92,_0x289428){var _0x178d7e=function(_0x394044){while(--_0x394044){_0x194d92['push'](_0x194d92['shift']());}};_0x178d7e(++_0x289428);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5cb6e6,_0xe39d){_0x5cb6e6=_0x5cb6e6-0x0;var _0x3df59d=_0x5f2f[_0x5cb6e6];return _0x3df59d;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./chatTransferReport.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xd')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['put'](_0xf5f2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf5f2('0xf')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);module[_0xf5f2('0x11')]=router; \ No newline at end of file +var _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 diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index e0c9220..bd70bc9 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 _0xb2c9=['input','name','text','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','address','email','Agent','#9f946a','#ffffff','INTEGER','BOOLEAN','ENUM','squared','rounded','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','star','thumb','TEXT','stringify'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0xb2c9,0x1aa));var _0x9b2c=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0xb2c9[_0x18cd5b];return _0x5eaa52;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x9b2c('0x0')]={'name':{'type':Sequelize[_0x9b2c('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x9b2c('0x1')],'allowNull':![],'unique':_0x9b2c('0x2')},'description':{'type':Sequelize[_0x9b2c('0x1')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x9b2c('0x3')},'mapKeyOffline':{'type':Sequelize[_0x9b2c('0x1')],'defaultValue':_0x9b2c('0x3')},'key':{'type':Sequelize[_0x9b2c('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x9b2c('0x1')],'defaultValue':_0x9b2c('0x4')},'customerAlias':{'type':Sequelize[_0x9b2c('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x9b2c('0x1')],'allowNull':![],'defaultValue':_0x9b2c('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x9b2c('0x1')],'allowNull':![],'defaultValue':_0x9b2c('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9b2c('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x9b2c('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x9b2c('0x1')]},'animation':{'type':Sequelize[_0x9b2c('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x9b2c('0x9')]('rounded',_0x9b2c('0xa')),'defaultValue':_0x9b2c('0xb')},'header_online':{'type':Sequelize[_0x9b2c('0x1')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x9b2c('0xc')},'offline_chat_button':{'type':Sequelize[_0x9b2c('0x1')],'defaultValue':_0x9b2c('0xd')},'header_offline':{'type':Sequelize[_0x9b2c('0x1')],'defaultValue':_0x9b2c('0xe')},'download_transcript':{'type':Sequelize[_0x9b2c('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x9b2c('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x9b2c('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x9b2c('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x9b2c('0x1')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x9b2c('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x9b2c('0x1')],'defaultValue':_0x9b2c('0x11')},'noteTitle':{'type':Sequelize[_0x9b2c('0x1')],'defaultValue':_0x9b2c('0x12')},'placeholderMessage':{'type':Sequelize[_0x9b2c('0x1')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x9b2c('0x1')],'defaultValue':_0x9b2c('0x13')},'closingMessageButton':{'type':Sequelize[_0x9b2c('0x1')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x9b2c('0x1')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x9b2c('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x9b2c('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x9b2c('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x9b2c('0x9')](_0x9b2c('0x14'),_0x9b2c('0x15')),'defaultValue':_0x9b2c('0x14')},'ratingStarsNumber':{'type':Sequelize[_0x9b2c('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x9b2c('0x16')],'defaultValue':function(){return JSON[_0x9b2c('0x17')]({'items':[{'type':_0x9b2c('0x18'),'variable':null,'config':{'placeholder':_0x9b2c('0x19'),'type':_0x9b2c('0x1a'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x9b2c('0x18'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x9b2c('0x3'),'type':_0x9b2c('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x9b2c('0x1b')](_0x9b2c('0x1c'))?JSON[_0x9b2c('0x1d')](this['getDataValue'](_0x9b2c('0x1c'))):{};},'set':function(_0x3573cd){return this[_0x9b2c('0x1e')](_0x9b2c('0x1c'),JSON[_0x9b2c('0x17')](_0x3573cd));}},'offlineForm':{'type':Sequelize[_0x9b2c('0x16')],'defaultValue':function(){return JSON[_0x9b2c('0x17')]({'items':[{'type':_0x9b2c('0x18'),'props':{'title':_0x9b2c('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x9b2c('0x3')},'variable':null},{'type':_0x9b2c('0x1f'),'config':{'placeholder':'Comments'},'props':{'title':_0x9b2c('0x20'),'helpText':_0x9b2c('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x9b2c('0x1b')](_0x9b2c('0x22'))?JSON[_0x9b2c('0x1d')](this[_0x9b2c('0x1b')](_0x9b2c('0x22'))):{};},'set':function(_0x56a5b0){return this[_0x9b2c('0x1e')]('offlineForm',JSON[_0x9b2c('0x17')](_0x56a5b0));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x9b2c('0x23')]();}},'autoclose':{'type':Sequelize[_0x9b2c('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x9b2c('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x9b2c('0x1')]},'forwardOffline':{'type':Sequelize[_0x9b2c('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x9b2c('0x1')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x9b2c('0x1')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x9b2c('0x1')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x9b2c('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x9b2c('0x1')],'defaultValue':_0x9b2c('0x24')},'skipUnmanaged':{'type':Sequelize[_0x9b2c('0x1')],'defaultValue':_0x9b2c('0x25')},'sendUnmanaged':{'type':Sequelize[_0x9b2c('0x1')],'defaultValue':_0x9b2c('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x9b2c('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x9b2c('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x9b2c('0x16')]},'showAgentAvatar':{'type':Sequelize[_0x9b2c('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x9b2c('0x1')]},'notificationTemplate':{'type':Sequelize[_0x9b2c('0x16')],'defaultValue':function(){return _0x9b2c('0x26');}},'notificationSound':{'type':Sequelize[_0x9b2c('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9b2c('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x9b2c('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x9b2c('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0x9b2c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x9b2c('0x1')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x9b2c('0x1')],'defaultValue':_0x9b2c('0x28')},'defaultTitle':{'type':Sequelize[_0x9b2c('0x1')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x9b2c('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x9b2c('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x9b2c('0x1')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x9b2c('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9b2c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9b2c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x9b2c('0x1')],'defaultValue':_0x9b2c('0x29')},'systemAvatar':{'type':Sequelize[_0x9b2c('0x16')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9b2c('0x7')],'comment':_0x9b2c('0x2a')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x396ef9){if(!_0x396ef9)this[_0x9b2c('0x1e')](_0x9b2c('0x2b'),null);this[_0x9b2c('0x1e')](_0x9b2c('0x2c'),_0x396ef9);}}}; \ No newline at end of file +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 diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 8233653..1104495 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 _0xa5d2=['server/files/images/avatars/default_avatar.png','isNil','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','user-agent','getResult','chat','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','Contacts','DESC','Applications','account','applications','orderBy','priority','asc','ListId','contact','customerIp','cf-connecting-ip','headers','x-forwarded-for','first','split','firstName','lastName','referer','browser','format','%s\x20%s','version','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','messageId','created','autoclose','push','close','unmanaged','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','EventManager','offline','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','Owner','internal','Tag','Tags','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','inspect','No\x20timezone','Interval','Intervals','getProactiveActions','../../config/license/util','virtual','License','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.js','remote','stringify','connection','remoteAddress','replace','alignment','verticalAlignment','color','textColor','addApplications','sequelize','transaction','ChatApplication','bulkCreate','getApplications','addProactiveActions','omit','ChatProactiveAction','getFields','online','false','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Contact','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','request-promise','moment','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','register','client','http','test','Sequelize','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','get','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','key','model','map','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','user','role','ChatWebsites','userProfileId','autoAssociation','body','describe','addDisposition','Disposition','getDispositions','findOne','ChatWebsiteId','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addLogo','sitepic','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','systemAvatar','root','server/files/images/logos/default_logo.png','getLicense','custom','server/files/images/logos/','download','getAvatar','join'];(function(_0x3a03de,_0x189cb0){var _0x4883aa=function(_0x4bc6df){while(--_0x4bc6df){_0x3a03de['push'](_0x3a03de['shift']());}};_0x4883aa(++_0x189cb0);}(_0xa5d2,0xa9));var _0x2a5d=function(_0x4540bf,_0x101271){_0x4540bf=_0x4540bf-0x0;var _0x50f3e2=_0xa5d2[_0x4540bf];return _0x50f3e2;};'use strict';var pdf=require(_0x2a5d('0x0'));var emlformat=require(_0x2a5d('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2a5d('0x2'));var moment=require(_0x2a5d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2a5d('0x4'));var util=require('util');var path=require(_0x2a5d('0x5'));var sox=require('sox');var csv=require(_0x2a5d('0x6'));var ejs=require(_0x2a5d('0x7'));var fs=require('fs');var _=require(_0x2a5d('0x8'));var squel=require(_0x2a5d('0x9'));var crypto=require(_0x2a5d('0xa'));var jsforce=require(_0x2a5d('0xb'));var deskjs=require(_0x2a5d('0xc'));var toCsv=require(_0x2a5d('0x6'));var querystring=require(_0x2a5d('0xd'));var Papa=require(_0x2a5d('0xe'));var Redis=require(_0x2a5d('0xf'));var authService=require(_0x2a5d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2a5d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2a5d('0x12'))('api');var utils=require(_0x2a5d('0x13'));var config=require(_0x2a5d('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x2a5d('0x15')](config[_0x2a5d('0x16')],{'host':_0x2a5d('0x17'),'port':0x18eb});var socket=require(_0x2a5d('0x18'))(new Redis(config[_0x2a5d('0x16')]));require('./chatWebsite.socket')[_0x2a5d('0x19')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x2a5d('0x1a')][_0x2a5d('0x1b')]({'port':0x232a});var client9003=jayson[_0x2a5d('0x1a')][_0x2a5d('0x1b')]({'port':0x232b});function checkPasswordPattern(_0x597ac6,_0x533518,_0x238541){if(_0x238541){var _0x334acf=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x334acf[_0x2a5d('0x1c')](_0x533518)){return _0x597ac6;}else{throw new db[(_0x2a5d('0x1d'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x597ac6;}}function respondWithRpcPromise(_0x5a27ee,_0x1bea98,_0xc1e695,_0x4ee50a){return new BPromise(function(_0x4fdde3,_0xa2c53b){var _0x4f40b7=_0x4ee50a||client;return _0x4f40b7[_0x2a5d('0x1e')](_0x5a27ee,_0xc1e695)[_0x2a5d('0x1f')](function(_0x29ae23){logger[_0x2a5d('0x20')](_0x2a5d('0x21'),_0x1bea98,'request\x20sent');logger[_0x2a5d('0x22')](_0x2a5d('0x23'),_0x1bea98,_0x2a5d('0x24'),JSON['stringify'](_0x29ae23));if(_0x29ae23['error']){if(_0x29ae23[_0x2a5d('0x25')][_0x2a5d('0x26')]===0x1f4){logger[_0x2a5d('0x25')](_0x2a5d('0x21'),_0x1bea98,_0x29ae23['error']['message']);return _0xa2c53b(_0x29ae23['error']['message']);}logger[_0x2a5d('0x25')](_0x2a5d('0x21'),_0x1bea98,_0x29ae23[_0x2a5d('0x25')][_0x2a5d('0x27')]);return _0x4fdde3(_0x29ae23[_0x2a5d('0x25')][_0x2a5d('0x27')]);}else{logger['info'](_0x2a5d('0x21'),_0x1bea98,'request\x20sent');_0x4fdde3(_0x29ae23['result']['message']);}})['catch'](function(_0x5e9234){logger[_0x2a5d('0x25')](_0x2a5d('0x21'),_0x1bea98,_0x5e9234);_0xa2c53b(_0x5e9234);});});}function respondWithStatusCode(_0x8efd58,_0x24b0e4){_0x24b0e4=_0x24b0e4||0xcc;return function(_0xc17b48){if(_0xc17b48){return _0x8efd58[_0x2a5d('0x28')](_0x24b0e4);}return _0x8efd58[_0x2a5d('0x29')](_0x24b0e4)[_0x2a5d('0x2a')]();};}function respondWithResult(_0x3e8178,_0xee25c5){_0xee25c5=_0xee25c5||0xc8;return function(_0x5dd75){if(_0x5dd75){return _0x3e8178['status'](_0xee25c5)[_0x2a5d('0x2b')](_0x5dd75);}};}function respondWithFilteredResult(_0x57270d,_0x9b8dad){return function(_0x45a1ab){if(_0x45a1ab){var _0x170b63=_0x45a1ab[_0x2a5d('0x2c')],_0x1329af=_0x9b8dad[_0x2a5d('0x2d')],_0x448f6b=_0x9b8dad[_0x2a5d('0x2d')]+_0x9b8dad[_0x2a5d('0x2e')],_0x3f45b9;if(_0x448f6b>=_0x170b63){_0x448f6b=_0x170b63;_0x3f45b9=0xc8;}else{_0x3f45b9=0xce;}_0x57270d[_0x2a5d('0x29')](_0x3f45b9);return _0x57270d[_0x2a5d('0x2f')](_0x2a5d('0x30'),_0x1329af+'-'+_0x448f6b+'/'+_0x170b63)['json'](_0x45a1ab);}return null;};}function patchUpdates(_0x1ea5d5){return function(_0x1492be){try{jsonpatch['apply'](_0x1492be,_0x1ea5d5,!![]);}catch(_0x3fac88){return BPromise[_0x2a5d('0x31')](_0x3fac88);}return _0x1492be[_0x2a5d('0x32')]();};}function saveUpdates(_0x1d7da2,_0x5bd933){return function(_0x307ee6){if(_0x307ee6){return _0x307ee6[_0x2a5d('0x33')](_0x1d7da2)['then'](function(_0x4e345e){return _0x4e345e;});}return null;};}function removeEntity(_0x30e8fa,_0x8d8901){return function(_0x3ca429){if(_0x3ca429){return _0x3ca429[_0x2a5d('0x34')]()[_0x2a5d('0x1f')](function(){var _0x545ab8=_0x3ca429[_0x2a5d('0x35')]({'plain':!![]});var _0x2e9372='ChatWebsites';return db[_0x2a5d('0x36')]['destroy']({'where':{'type':_0x2e9372,'resourceId':_0x545ab8['id']}})['then'](function(){return _0x3ca429;});})[_0x2a5d('0x1f')](function(){_0x30e8fa['status'](0xcc)[_0x2a5d('0x2a')]();});}};}function handleEntityNotFound(_0x5e318c,_0x26420c){return function(_0x31cf2a){if(!_0x31cf2a){_0x5e318c[_0x2a5d('0x28')](0x194);}return _0x31cf2a;};}function handleError(_0x4bc930,_0x4081cc){_0x4081cc=_0x4081cc||0x1f4;return function(_0x5dff3f){logger['error'](_0x5dff3f[_0x2a5d('0x37')]);if(_0x5dff3f['name']){delete _0x5dff3f[_0x2a5d('0x38')];}_0x4bc930[_0x2a5d('0x29')](_0x4081cc)['send'](_0x5dff3f);};}exports[_0x2a5d('0x39')]=function(_0x353feb,_0x180db1){var _0xbaf217={'include':[{'model':db[_0x2a5d('0x3a')],'as':_0x2a5d('0x3b')}]},_0x1d9a6f={},_0x3cf120={'count':0x0,'rows':[]};var _0x170db4=_['map'](db[_0x2a5d('0x3c')][_0x2a5d('0x3d')],function(_0x404774){return{'name':_0x404774[_0x2a5d('0x3e')],'type':_0x404774['type'][_0x2a5d('0x3f')]};});_0x1d9a6f[_0x2a5d('0x40')]=_[_0x2a5d('0x41')](_0x170db4,_0x2a5d('0x38'));_0x1d9a6f[_0x2a5d('0x42')]=_['keys'](_0x353feb[_0x2a5d('0x42')]);_0x1d9a6f['filters']=_['intersection'](_0x1d9a6f['model'],_0x1d9a6f[_0x2a5d('0x42')]);_0xbaf217[_0x2a5d('0x43')]=_[_0x2a5d('0x44')](_0x1d9a6f[_0x2a5d('0x40')],qs['fields'](_0x353feb['query'][_0x2a5d('0x45')]));_0xbaf217['attributes']=_0xbaf217[_0x2a5d('0x43')]['length']?_0xbaf217[_0x2a5d('0x43')]:_0x1d9a6f[_0x2a5d('0x40')];if(!_0x353feb[_0x2a5d('0x42')][_0x2a5d('0x46')](_0x2a5d('0x47'))){_0xbaf217[_0x2a5d('0x2e')]=qs['limit'](_0x353feb[_0x2a5d('0x42')]['limit']);_0xbaf217[_0x2a5d('0x2d')]=qs['offset'](_0x353feb[_0x2a5d('0x42')][_0x2a5d('0x2d')]);}_0xbaf217[_0x2a5d('0x48')]=qs[_0x2a5d('0x49')](_0x353feb['query'][_0x2a5d('0x49')]);_0xbaf217[_0x2a5d('0x4a')]=qs[_0x2a5d('0x4b')](_[_0x2a5d('0x4c')](_0x353feb[_0x2a5d('0x42')],_0x1d9a6f['filters']));if(_0x353feb[_0x2a5d('0x42')][_0x2a5d('0x4d')]){_0xbaf217[_0x2a5d('0x4a')]=_[_0x2a5d('0x4e')](_0xbaf217[_0x2a5d('0x4a')],{'$or':_['map'](_0x170db4,function(_0x2333bd){if(_0x2333bd[_0x2a5d('0x4f')]!==_0x2a5d('0x50')){var _0x493371={};_0x493371[_0x2333bd['name']]={'$like':'%'+_0x353feb[_0x2a5d('0x42')][_0x2a5d('0x4d')]+'%'};return _0x493371;}})});}_0xbaf217=_[_0x2a5d('0x4e')]({},_0xbaf217,_0x353feb[_0x2a5d('0x51')]);var _0x1d55e4={'where':_0xbaf217[_0x2a5d('0x4a')]};return db[_0x2a5d('0x3c')][_0x2a5d('0x2c')](_0x1d55e4)[_0x2a5d('0x1f')](function(_0x4646a3){_0x3cf120[_0x2a5d('0x2c')]=_0x4646a3;if(_0x353feb[_0x2a5d('0x42')][_0x2a5d('0x52')]){_0xbaf217[_0x2a5d('0x53')]=[{'all':!![]}];}return db['ChatWebsite'][_0x2a5d('0x54')](_0xbaf217);})[_0x2a5d('0x1f')](function(_0xea18bd){_0x3cf120[_0x2a5d('0x55')]=_0xea18bd;return _0x3cf120;})['then'](respondWithFilteredResult(_0x180db1,_0xbaf217))[_0x2a5d('0x56')](handleError(_0x180db1,null));};exports[_0x2a5d('0x57')]=function(_0x70f109,_0x2300fc){var _0x3fc59b={'raw':![],'where':{'id':_0x70f109[_0x2a5d('0x58')]['id']},'include':[{'model':db[_0x2a5d('0x3a')],'as':_0x2a5d('0x3b')}]},_0x5d753c={};_0x5d753c[_0x2a5d('0x40')]=_[_0x2a5d('0x59')](db[_0x2a5d('0x3c')][_0x2a5d('0x3d')]);_0x5d753c[_0x2a5d('0x42')]=_[_0x2a5d('0x59')](_0x70f109[_0x2a5d('0x42')]);_0x5d753c[_0x2a5d('0x4b')]=_[_0x2a5d('0x44')](_0x5d753c[_0x2a5d('0x40')],_0x5d753c[_0x2a5d('0x42')]);_0x3fc59b['attributes']=_['intersection'](_0x5d753c[_0x2a5d('0x40')],qs[_0x2a5d('0x45')](_0x70f109[_0x2a5d('0x42')]['fields']));_0x3fc59b[_0x2a5d('0x43')]=_0x3fc59b['attributes'][_0x2a5d('0x5a')]?_0x3fc59b[_0x2a5d('0x43')]:_0x5d753c['model'];if(_0x70f109['query'][_0x2a5d('0x52')]){_0x3fc59b[_0x2a5d('0x53')]=[{'all':!![]}];}_0x3fc59b=_[_0x2a5d('0x4e')]({},_0x3fc59b,_0x70f109[_0x2a5d('0x51')]);return db['ChatWebsite'][_0x2a5d('0x5b')](_0x3fc59b)['then'](handleEntityNotFound(_0x2300fc,null))['then'](respondWithResult(_0x2300fc,null))[_0x2a5d('0x56')](handleError(_0x2300fc,null));};exports[_0x2a5d('0x5c')]=function(_0x4452a7,_0x47a14d){return db[_0x2a5d('0x3c')][_0x2a5d('0x5c')](_0x4452a7['body'],{})[_0x2a5d('0x1f')](function(_0x563efb){var _0x40d04f=_0x4452a7[_0x2a5d('0x5d')][_0x2a5d('0x35')]({'plain':!![]});if(!_0x40d04f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40d04f[_0x2a5d('0x5e')]==='user'){var _0x4fa34e=_0x563efb[_0x2a5d('0x35')]({'plain':!![]});var _0x52f2bc=_0x2a5d('0x5f');return db['UserProfileSection'][_0x2a5d('0x5b')]({'where':{'name':_0x52f2bc,'userProfileId':_0x40d04f[_0x2a5d('0x60')]},'raw':!![]})['then'](function(_0x56e3d0){if(_0x56e3d0&&_0x56e3d0[_0x2a5d('0x61')]===0x0){return db[_0x2a5d('0x36')]['create']({'name':_0x4fa34e[_0x2a5d('0x38')],'resourceId':_0x4fa34e['id'],'type':_0x56e3d0['name'],'sectionId':_0x56e3d0['id']},{})[_0x2a5d('0x1f')](function(){return _0x563efb;});}else{return _0x563efb;}})['catch'](function(_0x30a768){logger[_0x2a5d('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x30a768);throw _0x30a768;});}return _0x563efb;})['then'](respondWithResult(_0x47a14d,0xc9))[_0x2a5d('0x56')](handleError(_0x47a14d,null));};exports['update']=function(_0x1f0287,_0x2b18be){if(_0x1f0287['body']['id']){delete _0x1f0287[_0x2a5d('0x62')]['id'];}return db['ChatWebsite'][_0x2a5d('0x5b')]({'where':{'id':_0x1f0287[_0x2a5d('0x58')]['id']},'include':[{'model':db[_0x2a5d('0x3a')],'as':'mandatoryDispositionPause'}]})[_0x2a5d('0x1f')](handleEntityNotFound(_0x2b18be,null))[_0x2a5d('0x1f')](saveUpdates(_0x1f0287[_0x2a5d('0x62')],null))[_0x2a5d('0x1f')](respondWithResult(_0x2b18be,null))[_0x2a5d('0x56')](handleError(_0x2b18be,null));};exports[_0x2a5d('0x34')]=function(_0x1678ec,_0x5b3b15){return db[_0x2a5d('0x3c')][_0x2a5d('0x5b')]({'where':{'id':_0x1678ec['params']['id']}})[_0x2a5d('0x1f')](handleEntityNotFound(_0x5b3b15,null))[_0x2a5d('0x1f')](removeEntity(_0x5b3b15,null))[_0x2a5d('0x56')](handleError(_0x5b3b15,null));};exports[_0x2a5d('0x63')]=function(_0xbf6d23,_0x1962a8){return db[_0x2a5d('0x3c')][_0x2a5d('0x63')]()['then'](respondWithResult(_0x1962a8,null))[_0x2a5d('0x56')](handleError(_0x1962a8,null));};exports[_0x2a5d('0x64')]=function(_0xf11c6f,_0x51c477,_0x229e7c){if(_0xf11c6f['body']['id']){delete _0xf11c6f[_0x2a5d('0x62')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0xf11c6f[_0x2a5d('0x58')]['id']}})[_0x2a5d('0x1f')](handleEntityNotFound(_0x51c477,null))[_0x2a5d('0x1f')](function(_0x123cc0){if(_0x123cc0){_0xf11c6f[_0x2a5d('0x62')]['ChatWebsiteId']=_0x123cc0['id'];return db[_0x2a5d('0x65')]['create'](_0xf11c6f['body']);}})[_0x2a5d('0x1f')](respondWithResult(_0x51c477,null))['catch'](handleError(_0x51c477,null));};exports[_0x2a5d('0x66')]=function(_0x192260,_0x486781,_0x18c5d0){var _0x28cc78={'raw':![],'where':{}};var _0x5c4ae8={};var _0x44dbec={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x2a5d('0x67')]({'where':{'id':_0x192260[_0x2a5d('0x58')]['id']}})['then'](handleEntityNotFound(_0x486781,null))[_0x2a5d('0x1f')](function(_0x1f1241){if(_0x1f1241){_0x5c4ae8[_0x2a5d('0x40')]=_[_0x2a5d('0x59')](db[_0x2a5d('0x65')][_0x2a5d('0x3d')]);_0x5c4ae8[_0x2a5d('0x42')]=_['keys'](_0x192260[_0x2a5d('0x42')]);_0x5c4ae8[_0x2a5d('0x4b')]=_[_0x2a5d('0x44')](_0x5c4ae8[_0x2a5d('0x40')],_0x5c4ae8[_0x2a5d('0x42')]);_0x28cc78['attributes']=_[_0x2a5d('0x44')](_0x5c4ae8[_0x2a5d('0x40')],qs[_0x2a5d('0x45')](_0x192260[_0x2a5d('0x42')]['fields']));_0x28cc78[_0x2a5d('0x43')]=_0x28cc78[_0x2a5d('0x43')][_0x2a5d('0x5a')]?_0x28cc78[_0x2a5d('0x43')]:_0x5c4ae8[_0x2a5d('0x40')];if(!_0x192260[_0x2a5d('0x42')][_0x2a5d('0x46')](_0x2a5d('0x47'))){_0x28cc78[_0x2a5d('0x2e')]=qs[_0x2a5d('0x2e')](_0x192260[_0x2a5d('0x42')][_0x2a5d('0x2e')]);_0x28cc78[_0x2a5d('0x2d')]=qs[_0x2a5d('0x2d')](_0x192260['query'][_0x2a5d('0x2d')]);}_0x28cc78[_0x2a5d('0x48')]=qs['sort'](_0x192260[_0x2a5d('0x42')][_0x2a5d('0x49')]);_0x28cc78[_0x2a5d('0x4a')]=qs[_0x2a5d('0x4b')](_['pick'](_0x192260[_0x2a5d('0x42')],_0x5c4ae8[_0x2a5d('0x4b')]));_0x28cc78['where'][_0x2a5d('0x68')]=_0x1f1241['id'];if(_0x192260['query']['filter']){_0x28cc78[_0x2a5d('0x4a')]=_['merge'](_0x28cc78[_0x2a5d('0x4a')],{'$or':_[_0x2a5d('0x41')](_0x28cc78[_0x2a5d('0x43')],function(_0x23d767){var _0x23502a={};_0x23502a[_0x23d767]={'$like':'%'+_0x192260[_0x2a5d('0x42')][_0x2a5d('0x4d')]+'%'};return _0x23502a;})});}_0x28cc78=_[_0x2a5d('0x4e')]({},_0x28cc78,_0x192260['options']);return db[_0x2a5d('0x65')][_0x2a5d('0x2c')]({'where':_0x28cc78['where']})['then'](function(_0x1ea625){_0x44dbec[_0x2a5d('0x2c')]=_0x1ea625;if(_0x192260['query']['includeAll']){_0x28cc78[_0x2a5d('0x53')]=[{'all':!![]}];}return db[_0x2a5d('0x65')]['findAll'](_0x28cc78);})[_0x2a5d('0x1f')](function(_0x57a02b){_0x44dbec[_0x2a5d('0x55')]=_0x57a02b;return _0x44dbec;});}})[_0x2a5d('0x1f')](respondWithFilteredResult(_0x486781,_0x28cc78))['catch'](handleError(_0x486781,null));};exports[_0x2a5d('0x69')]=function(_0x48a462,_0xdd8d20,_0x5d4f57){return db[_0x2a5d('0x3c')][_0x2a5d('0x5b')]({'where':{'id':_0x48a462[_0x2a5d('0x58')]['id']}})[_0x2a5d('0x1f')](handleEntityNotFound(_0xdd8d20,null))['then'](function(_0x14a15b){if(_0x14a15b){return _0x14a15b[_0x2a5d('0x69')](_0x48a462['query'][_0x2a5d('0x6a')]);}})[_0x2a5d('0x1f')](respondWithStatusCode(_0xdd8d20,null))[_0x2a5d('0x56')](handleError(_0xdd8d20,null));};exports[_0x2a5d('0x6b')]=function(_0x7b6c2b,_0x51fdea,_0x1c7cec){if(_0x7b6c2b['body']['id']){delete _0x7b6c2b[_0x2a5d('0x62')]['id'];}return db[_0x2a5d('0x3c')]['find']({'where':{'id':_0x7b6c2b[_0x2a5d('0x58')]['id']}})[_0x2a5d('0x1f')](handleEntityNotFound(_0x51fdea,null))[_0x2a5d('0x1f')](function(_0x47ac58){if(_0x47ac58){_0x7b6c2b[_0x2a5d('0x62')][_0x2a5d('0x68')]=_0x47ac58['id'];return db['CannedAnswer'][_0x2a5d('0x5c')](_0x7b6c2b[_0x2a5d('0x62')]);}})[_0x2a5d('0x1f')](respondWithResult(_0x51fdea,null))[_0x2a5d('0x56')](handleError(_0x51fdea,null));};exports[_0x2a5d('0x6c')]=function(_0x2e5a38,_0x5cddc6,_0xa51b43){var _0x2ed039={'raw':![],'where':{}};var _0x3a5f1a={};var _0x5d254b={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x2a5d('0x67')]({'where':{'id':_0x2e5a38[_0x2a5d('0x58')]['id']}})[_0x2a5d('0x1f')](handleEntityNotFound(_0x5cddc6,null))[_0x2a5d('0x1f')](function(_0x1dc0e8){if(_0x1dc0e8){_0x3a5f1a[_0x2a5d('0x40')]=_['keys'](db[_0x2a5d('0x6d')][_0x2a5d('0x3d')]);_0x3a5f1a[_0x2a5d('0x42')]=_[_0x2a5d('0x59')](_0x2e5a38[_0x2a5d('0x42')]);_0x3a5f1a[_0x2a5d('0x4b')]=_[_0x2a5d('0x44')](_0x3a5f1a[_0x2a5d('0x40')],_0x3a5f1a[_0x2a5d('0x42')]);_0x2ed039[_0x2a5d('0x43')]=_['intersection'](_0x3a5f1a[_0x2a5d('0x40')],qs[_0x2a5d('0x45')](_0x2e5a38[_0x2a5d('0x42')][_0x2a5d('0x45')]));_0x2ed039[_0x2a5d('0x43')]=_0x2ed039['attributes']['length']?_0x2ed039[_0x2a5d('0x43')]:_0x3a5f1a[_0x2a5d('0x40')];if(!_0x2e5a38[_0x2a5d('0x42')][_0x2a5d('0x46')](_0x2a5d('0x47'))){_0x2ed039[_0x2a5d('0x2e')]=qs[_0x2a5d('0x2e')](_0x2e5a38['query']['limit']);_0x2ed039['offset']=qs[_0x2a5d('0x2d')](_0x2e5a38[_0x2a5d('0x42')][_0x2a5d('0x2d')]);}_0x2ed039[_0x2a5d('0x48')]=qs[_0x2a5d('0x49')](_0x2e5a38[_0x2a5d('0x42')][_0x2a5d('0x49')]);_0x2ed039[_0x2a5d('0x4a')]=qs['filters'](_[_0x2a5d('0x4c')](_0x2e5a38[_0x2a5d('0x42')],_0x3a5f1a['filters']));_0x2ed039['where']['ChatWebsiteId']=_0x1dc0e8['id'];if(_0x2e5a38[_0x2a5d('0x42')][_0x2a5d('0x4d')]){_0x2ed039['where']=_['merge'](_0x2ed039[_0x2a5d('0x4a')],{'$or':_[_0x2a5d('0x41')](_0x2ed039[_0x2a5d('0x43')],function(_0x14fc15){var _0x150f15={};_0x150f15[_0x14fc15]={'$like':'%'+_0x2e5a38['query']['filter']+'%'};return _0x150f15;})});}_0x2ed039=_[_0x2a5d('0x4e')]({},_0x2ed039,_0x2e5a38[_0x2a5d('0x51')]);return db[_0x2a5d('0x6d')]['count']({'where':_0x2ed039['where']})[_0x2a5d('0x1f')](function(_0x13450f){_0x5d254b['count']=_0x13450f;if(_0x2e5a38[_0x2a5d('0x42')][_0x2a5d('0x52')]){_0x2ed039[_0x2a5d('0x53')]=[{'all':!![]}];}return db[_0x2a5d('0x6d')][_0x2a5d('0x54')](_0x2ed039);})[_0x2a5d('0x1f')](function(_0x5b0d6c){_0x5d254b[_0x2a5d('0x55')]=_0x5b0d6c;return _0x5d254b;});}})[_0x2a5d('0x1f')](respondWithFilteredResult(_0x5cddc6,_0x2ed039))[_0x2a5d('0x56')](handleError(_0x5cddc6,null));};exports[_0x2a5d('0x6e')]=function(_0x5e01b4,_0x461157,_0x536c6a){return db[_0x2a5d('0x3c')][_0x2a5d('0x5b')]({'where':{'id':_0x5e01b4[_0x2a5d('0x58')]['id']}})[_0x2a5d('0x1f')](handleEntityNotFound(_0x461157,null))['then'](function(_0x681f3a){if(_0x681f3a){return _0x681f3a[_0x2a5d('0x6e')](_0x5e01b4[_0x2a5d('0x42')][_0x2a5d('0x6a')]);}})['then'](respondWithStatusCode(_0x461157,null))[_0x2a5d('0x56')](handleError(_0x461157,null));};exports[_0x2a5d('0x6f')]=function(_0x5349b4,_0x17491c,_0x1314fd){_0x5349b4[_0x2a5d('0x62')][_0x2a5d('0x70')]=_0x5349b4[_0x2a5d('0x71')][_0x2a5d('0x72')];return db[_0x2a5d('0x3c')][_0x2a5d('0x5b')]({'where':{'id':_0x5349b4[_0x2a5d('0x58')]['id']}})[_0x2a5d('0x1f')](handleEntityNotFound(_0x17491c,null))[_0x2a5d('0x1f')](saveUpdates(_0x5349b4['body'],null))['then'](respondWithResult(_0x17491c,null))[_0x2a5d('0x56')](handleError(_0x17491c,null));};exports['addAvatar']=function(_0x46b193,_0xe0bdfe,_0x309282){_0x46b193['body'][_0x2a5d('0x73')]=_0x46b193[_0x2a5d('0x71')][_0x2a5d('0x72')];return db['ChatWebsite']['find']({'where':{'id':_0x46b193[_0x2a5d('0x58')]['id']}})['then'](handleEntityNotFound(_0xe0bdfe,null))[_0x2a5d('0x1f')](saveUpdates(_0x46b193[_0x2a5d('0x62')],null))[_0x2a5d('0x1f')](respondWithResult(_0xe0bdfe,null))[_0x2a5d('0x56')](handleError(_0xe0bdfe,null));};exports[_0x2a5d('0x74')]=function(_0x116dc6,_0x3e94b0,_0x3feb6e){_0x116dc6['body'][_0x2a5d('0x75')]=_0x116dc6[_0x2a5d('0x71')][_0x2a5d('0x72')];return db['ChatWebsite'][_0x2a5d('0x5b')]({'where':{'id':_0x116dc6[_0x2a5d('0x58')]['id']}})[_0x2a5d('0x1f')](handleEntityNotFound(_0x3e94b0,null))[_0x2a5d('0x1f')](saveUpdates(_0x116dc6['body'],null))[_0x2a5d('0x1f')](respondWithResult(_0x3e94b0,null))[_0x2a5d('0x56')](handleError(_0x3e94b0,null));};exports['addSystemAvatar']=function(_0x4d7e97,_0x3ddb6b,_0x1828e9){_0x4d7e97[_0x2a5d('0x62')][_0x2a5d('0x76')]=_0x4d7e97[_0x2a5d('0x71')][_0x2a5d('0x72')];return db[_0x2a5d('0x3c')][_0x2a5d('0x5b')]({'where':{'id':_0x4d7e97[_0x2a5d('0x58')]['id']}})[_0x2a5d('0x1f')](handleEntityNotFound(_0x3ddb6b,null))[_0x2a5d('0x1f')](saveUpdates(_0x4d7e97[_0x2a5d('0x62')],null))[_0x2a5d('0x1f')](respondWithResult(_0x3ddb6b,null))[_0x2a5d('0x56')](handleError(_0x3ddb6b,null));};exports['getLogo']=function(_0x8c9189,_0x23aea9,_0xafa624){var _0x3f6a8c=path['join'](config[_0x2a5d('0x77')],_0x2a5d('0x78'));var _0x169d4a={'where':{'id':_0x8c9189[_0x2a5d('0x58')]['id']},'attributes':['id',_0x2a5d('0x70')],'raw':!![]};var _0xf76fbf=![];return require('../../config/license/util')[_0x2a5d('0x79')]()[_0x2a5d('0x1f')](function(_0x429008){if(_0x429008){_0xf76fbf=_0x429008[_0x2a5d('0x7a')];}})[_0x2a5d('0x1f')](function(){return db[_0x2a5d('0x3c')][_0x2a5d('0x5b')](_0x169d4a);})[_0x2a5d('0x1f')](handleEntityNotFound(_0x23aea9,null))['then'](function(_0x5e25f1){if(_0x5e25f1){if(!_['isNil'](_0x5e25f1[_0x2a5d('0x70')])){if(fs['existsSync'](path['join'](config[_0x2a5d('0x77')],'server/files/images/logos/',_0x5e25f1[_0x2a5d('0x70')]))&&_0xf76fbf){_0x3f6a8c=path['join'](config['root'],_0x2a5d('0x7b'),_0x5e25f1[_0x2a5d('0x70')]);}}return _0x23aea9[_0x2a5d('0x7c')](_0x3f6a8c);}})[_0x2a5d('0x56')](handleError(_0x23aea9,null));};exports[_0x2a5d('0x7d')]=function(_0xfbc97,_0x880177,_0x184312){var _0x271238=path[_0x2a5d('0x7e')](config[_0x2a5d('0x77')],_0x2a5d('0x7f'));var _0x24297d={'where':{'id':_0xfbc97['params']['id']},'attributes':['id',_0x2a5d('0x73')],'raw':!![]};return db[_0x2a5d('0x3c')]['find'](_0x24297d)[_0x2a5d('0x1f')](handleEntityNotFound(_0x880177,null))[_0x2a5d('0x1f')](function(_0x24ebd3){if(_0x24ebd3){if(!_[_0x2a5d('0x80')](_0x24ebd3[_0x2a5d('0x73')])){if(fs[_0x2a5d('0x81')](path['join'](config[_0x2a5d('0x77')],_0x2a5d('0x82'),_0x24ebd3[_0x2a5d('0x73')]))){_0x271238=path[_0x2a5d('0x7e')](config[_0x2a5d('0x77')],_0x2a5d('0x82'),_0x24ebd3['agentAvatar']);}}return _0x880177[_0x2a5d('0x7c')](_0x271238);}})[_0x2a5d('0x56')](handleError(_0x880177,null));};exports[_0x2a5d('0x83')]=function(_0x138568,_0x7ae47b,_0x13ddf6){var _0x1c8de8=path['join'](config[_0x2a5d('0x77')],_0x2a5d('0x84'));var _0x5c25a7={'where':{'id':_0x138568['params']['id']},'attributes':['id',_0x2a5d('0x75'),'showCustomerAvatar'],'raw':!![]};return db['ChatWebsite'][_0x2a5d('0x5b')](_0x5c25a7)[_0x2a5d('0x1f')](handleEntityNotFound(_0x7ae47b,null))[_0x2a5d('0x1f')](function(_0x46f35b){if(_0x46f35b){if(!_[_0x2a5d('0x80')](_0x46f35b[_0x2a5d('0x75')])){if(fs['existsSync'](path['join'](config[_0x2a5d('0x77')],_0x2a5d('0x82'),_0x46f35b[_0x2a5d('0x75')]))&&_0x46f35b[_0x2a5d('0x85')]){_0x1c8de8=path[_0x2a5d('0x7e')](config[_0x2a5d('0x77')],_0x2a5d('0x82'),_0x46f35b['customerAvatar']);}}return _0x7ae47b[_0x2a5d('0x7c')](_0x1c8de8);}})[_0x2a5d('0x56')](handleError(_0x7ae47b,null));};exports[_0x2a5d('0x86')]=function(_0x46108b,_0x4edf3c,_0x5aefe3){var _0x2c81d3=path[_0x2a5d('0x7e')](config[_0x2a5d('0x77')],_0x2a5d('0x87'));var _0x208781={'where':{'id':_0x46108b[_0x2a5d('0x58')]['id']},'attributes':['id',_0x2a5d('0x76')],'raw':!![]};return db[_0x2a5d('0x3c')][_0x2a5d('0x5b')](_0x208781)[_0x2a5d('0x1f')](handleEntityNotFound(_0x4edf3c,null))[_0x2a5d('0x1f')](function(_0x5a1922){if(_0x5a1922){if(!_[_0x2a5d('0x80')](_0x5a1922[_0x2a5d('0x76')])){if(fs['existsSync'](path[_0x2a5d('0x7e')](config[_0x2a5d('0x77')],'server/files/images/avatars/',_0x5a1922[_0x2a5d('0x76')]))){_0x2c81d3=path[_0x2a5d('0x7e')](config[_0x2a5d('0x77')],_0x2a5d('0x82'),_0x5a1922[_0x2a5d('0x76')]);}}return _0x4edf3c[_0x2a5d('0x7c')](_0x2c81d3);}})[_0x2a5d('0x56')](handleError(_0x4edf3c,null));};exports[_0x2a5d('0x88')]=function(_0x2b0ad4,_0x5d514e,_0x5c8467){var _0x10ff21=require(_0x2a5d('0x89'));var _0x4ddc0c=new _0x10ff21();var _0x151a2a=_0x4ddc0c[_0x2a5d('0x8a')](_0x2b0ad4['headers'][_0x2a5d('0x8b')])[_0x2a5d('0x8c')]();var _0x31e32a={'body':_0x2b0ad4[_0x2a5d('0x62')],'channel':_0x2a5d('0x8d')};var _0x191ec4=[];var _0x2badca=[];var _0x544cf9={};var _0x1e432e=![];return db[_0x2a5d('0x8e')][_0x2a5d('0x63')]()['then'](function(_0x3b957c){if(!_0x3b957c){throw new db[(_0x2a5d('0x1d'))][(_0x2a5d('0x8f'))](_0x2a5d('0x90'));}_0x191ec4=_[_0x2a5d('0x91')](_[_0x2a5d('0x59')](_0x3b957c),[_0x2a5d('0x92'),'updatedAt']);_0x2badca=_['difference'](_[_0x2a5d('0x59')](_0x3b957c),[_0x2a5d('0x92'),_0x2a5d('0x93'),_0x2a5d('0x94'),'ListId']);if(_0x2b0ad4[_0x2a5d('0x62')]['id']){delete _0x2b0ad4[_0x2a5d('0x62')]['id'];}if(_[_0x2a5d('0x80')](_0x2b0ad4['body']['from'])){throw new db['Sequelize'][(_0x2a5d('0x8f'))](_0x2a5d('0x95'));}if(_[_0x2a5d('0x80')](_0x2b0ad4[_0x2a5d('0x62')][_0x2a5d('0x62')])||_0x2b0ad4[_0x2a5d('0x62')][_0x2a5d('0x62')]===''){throw new db[(_0x2a5d('0x1d'))][(_0x2a5d('0x8f'))](_0x2a5d('0x96'));}if(_[_0x2a5d('0x80')](_0x2b0ad4[_0x2a5d('0x62')][_0x2a5d('0x97')])){throw new db[(_0x2a5d('0x1d'))][(_0x2a5d('0x8f'))](_0x2a5d('0x98')+_0x2badca);}if(!_['includes'](_0x2badca,_0x2b0ad4[_0x2a5d('0x62')][_0x2a5d('0x97')])){throw new db[(_0x2a5d('0x1d'))]['ValidationError'](_0x2a5d('0x99')+_0x2badca);}_0x544cf9[_0x2b0ad4[_0x2a5d('0x62')]['mapKey']]=_0x2b0ad4['body'][_0x2a5d('0x9a')];})[_0x2a5d('0x1f')](function(){return db[_0x2a5d('0x3c')][_0x2a5d('0x5b')]({'where':{'id':_0x2b0ad4[_0x2a5d('0x58')]['id']},'include':[{'model':db[_0x2a5d('0x9b')],'as':_0x2a5d('0x9c'),'include':[{'model':db['CmContact'],'as':_0x2a5d('0x9d'),'where':_0x544cf9,'limit':0x1,'order':[['updatedAt',_0x2a5d('0x9e')]]}]},{'model':db['ChatApplication'],'as':_0x2a5d('0x9f')}]});})[_0x2a5d('0x1f')](handleEntityNotFound(_0x5d514e,null))['then'](function(_0x340b1b){if(_0x340b1b&&_0x340b1b[_0x2a5d('0x9c')]){_0x31e32a[_0x2a5d('0xa0')]=_0x340b1b;_0x31e32a[_0x2a5d('0xa1')]=_0x340b1b['Applications'];_0x31e32a['list']=_0x340b1b[_0x2a5d('0x9c')];_0x31e32a[_0x2a5d('0xa1')]=_[_0x2a5d('0xa2')](_0x31e32a[_0x2a5d('0xa1')],[_0x2a5d('0xa3')],[_0x2a5d('0xa4')]);if(_0x31e32a['account'][_0x2a5d('0x9f')]){delete _0x31e32a['account'][_0x2a5d('0x9f')];}if(_0x31e32a[_0x2a5d('0xa0')][_0x2a5d('0x9c')]&&_0x31e32a[_0x2a5d('0xa0')][_0x2a5d('0x9c')][_0x2a5d('0x9d')]['length']){return _0x31e32a[_0x2a5d('0xa0')][_0x2a5d('0x9c')]['Contacts'][0x0];}var _0x1dbcfc=_[_0x2a5d('0x15')](_0x2b0ad4[_0x2a5d('0x62')],{'firstName':_0x2b0ad4[_0x2a5d('0x62')][_0x2a5d('0x9a')],'ListId':_0x340b1b[_0x2a5d('0xa5')]});_0x1dbcfc[_0x2b0ad4[_0x2a5d('0x62')][_0x2a5d('0x97')]]=_0x2b0ad4['body'][_0x2a5d('0x9a')];return db[_0x2a5d('0x8e')][_0x2a5d('0x5c')](_0x1dbcfc,{'fields':_0x191ec4,'raw':!![]});}})['then'](handleEntityNotFound(_0x5d514e,null))['then'](function(_0x54e036){_0x31e32a[_0x2a5d('0xa6')]=_0x54e036;var _0xfe56f9=_0x2b0ad4[_0x2a5d('0x62')][_0x2a5d('0xa7')];if(_0x2b0ad4['headers'][_0x2a5d('0xa8')]){_0xfe56f9=_0x2b0ad4[_0x2a5d('0xa9')][_0x2a5d('0xa8')];}else if(_0x2b0ad4[_0x2a5d('0xa9')][_0x2a5d('0xaa')]){_0xfe56f9=_[_0x2a5d('0xab')](_0x2b0ad4[_0x2a5d('0xa9')][_0x2a5d('0xaa')][_0x2a5d('0xac')](','));}if(_0x54e036){var _0x5f2ee2={'ContactId':_0x54e036['id'],'ChatWebsiteId':_0x2b0ad4['params']['id'],'from':(_0x54e036[_0x2a5d('0xad')]||'')+'\x20'+(_0x54e036[_0x2a5d('0xae')]||''),'customerIp':_0xfe56f9,'customerPort':_0x2b0ad4[_0x2a5d('0xa9')]['x-real-port']?_0x2b0ad4[_0x2a5d('0xa9')]['x-real-port']:null,'referer':_0x2b0ad4[_0x2a5d('0x62')][_0x2a5d('0xaf')],'browserName':_0x151a2a[_0x2a5d('0xb0')][_0x2a5d('0x38')]&&_0x151a2a[_0x2a5d('0xb0')]['version']?util[_0x2a5d('0xb1')](_0x2a5d('0xb2'),_0x151a2a['browser'][_0x2a5d('0x38')],_0x151a2a[_0x2a5d('0xb0')][_0x2a5d('0xb3')]):_0x2a5d('0xb4'),'browserVersion':_0x151a2a[_0x2a5d('0xb0')][_0x2a5d('0xb3')]||'unknown','osName':util[_0x2a5d('0xb1')]('%s\x20%s',_0x151a2a['os'][_0x2a5d('0x38')],_0x151a2a['os'][_0x2a5d('0xb3')]),'osVersion':_0x151a2a['os'][_0x2a5d('0xb3')],'deviceModel':_0x151a2a['device']['model']&&_0x151a2a[_0x2a5d('0xb5')][_0x2a5d('0xb6')]?util[_0x2a5d('0xb1')](_0x2a5d('0xb7'),_0x151a2a[_0x2a5d('0xb5')][_0x2a5d('0x40')],_0x151a2a[_0x2a5d('0xb5')][_0x2a5d('0xb6')],_0x151a2a['device']['type']):null,'deviceVendor':_0x151a2a[_0x2a5d('0xb5')][_0x2a5d('0xb6')],'deviceType':_0x151a2a[_0x2a5d('0xb5')]['type'],'formData':JSON['stringify'](_0x2b0ad4['body'])};var _0x399b6b={'ChatWebsiteId':_0x2b0ad4[_0x2a5d('0x58')]['id'],'closed':![]};if(_0x2b0ad4[_0x2a5d('0x62')][_0x2a5d('0xb8')]){_0x399b6b['threadId']=_0x2b0ad4[_0x2a5d('0x62')][_0x2a5d('0xb8')];return db[_0x2a5d('0xb9')][_0x2a5d('0x5b')]({'where':_0x399b6b})[_0x2a5d('0x1f')](function(_0x50334a){if(_0x50334a){return[_0x50334a,![]];}_0x5f2ee2[_0x2a5d('0xb8')]=_0x2b0ad4['body'][_0x2a5d('0xb8')];_0x5f2ee2[_0x2a5d('0xba')]=_0x2b0ad4[_0x2a5d('0x62')][_0x2a5d('0xba')];return db['ChatInteraction'][_0x2a5d('0x5c')](_0x5f2ee2)[_0x2a5d('0x1f')](function(_0x2c912b){return[_0x2c912b,!![]];});});}_0x399b6b[_0x2a5d('0xbb')]=_0x54e036['id'];if(_0x2b0ad4[_0x2a5d('0x62')][_0x2a5d('0xbc')]&&_0x2b0ad4[_0x2a5d('0x62')][_0x2a5d('0xbc')]['id']){_0x399b6b['id']=_0x2b0ad4['body'][_0x2a5d('0xbc')]['id'];return db[_0x2a5d('0xb9')]['find']({'where':_0x399b6b})[_0x2a5d('0x1f')](function(_0x36dda1){if(_0x36dda1){return[_0x36dda1,![]];}return db[_0x2a5d('0xb9')][_0x2a5d('0x5c')](_0x5f2ee2)[_0x2a5d('0x1f')](function(_0x1bdf9c){return[_0x1bdf9c,!![]];});});}return db[_0x2a5d('0xb9')][_0x2a5d('0x5c')](_0x5f2ee2)[_0x2a5d('0x1f')](function(_0x102a8a){return[_0x102a8a,!![]];});}})['spread'](function(_0x483807,_0x366aa3){if(_0x483807){_0x1e432e=_0x366aa3;if(!_0x366aa3){var _0x16f78a={'from':(_0x31e32a['contact'][_0x2a5d('0xad')]||'')+'\x20'+(_0x31e32a[_0x2a5d('0xa6')]['lastName']||'')};if(_0x2b0ad4[_0x2a5d('0x62')][_0x2a5d('0xb8')]&&_0x2b0ad4['body'][_0x2a5d('0xbd')]&&_0x2b0ad4[_0x2a5d('0x62')][_0x2a5d('0xb8')]!=_0x2b0ad4[_0x2a5d('0x62')]['messageId']){_0x16f78a[_0x2a5d('0xb8')]=_0x2b0ad4[_0x2a5d('0x62')][_0x2a5d('0xbd')];}return _0x483807[_0x2a5d('0x33')](_0x16f78a);}else{return _0x483807;}}})[_0x2a5d('0x1f')](function(_0x2589bc){_0x31e32a['interaction']=_0x2589bc[_0x2a5d('0x35')]({'plain':!![]});_0x31e32a[_0x2a5d('0xbc')]['created']=_0x1e432e;if(_0x31e32a[_0x2a5d('0xbc')][_0x2a5d('0xbe')]){if(_0x31e32a[_0x2a5d('0xa0')][_0x2a5d('0xbf')]){_0x31e32a[_0x2a5d('0xa1')][_0x2a5d('0xc0')]({'id':0x0,'priority':_0x31e32a['applications'][_0x2a5d('0x5a')]+0x1,'app':_0x2a5d('0xc1'),'appdata':_0x2a5d('0xc2'),'interval':'*,*,*,*'});}}return db['ChatMessage']['create']({'body':_0x2b0ad4[_0x2a5d('0x62')][_0x2a5d('0x62')],'ChatWebsiteId':_0x2b0ad4[_0x2a5d('0x58')]['id'],'ChatInteractionId':_0x2589bc['id'],'direction':'in','ContactId':_0x31e32a['contact']['id'],'AttachmentId':_0x2b0ad4[_0x2a5d('0x62')][_0x2a5d('0xc3')]});})[_0x2a5d('0x1f')](function(_0x35dc2b){_0x31e32a['message']=_0x35dc2b;if(_0x31e32a[_0x2a5d('0xbc')][_0x2a5d('0xc4')]){return db[_0x2a5d('0xc5')][_0x2a5d('0x5b')]({'attributes':['id',_0x2a5d('0x38')],'where':{'id':_0x31e32a['interaction']['UserId']}})['then'](function(_0x167ab0){if(_0x167ab0){_0x31e32a['applications'][_0x2a5d('0xc6')]({'id':0x0,'priority':0x0,'app':_0x2a5d('0xc7'),'appdata':_0x167ab0['name']+','+(_0x31e32a[_0x2a5d('0xa0')][_0x2a5d('0xc8')]||0xa),'interval':_0x2a5d('0xc9')});_0x31e32a[_0x2a5d('0xca')]=!![];}return respondWithRpcPromise(_0x2a5d('0xcb'),'startRouting',_0x31e32a);});}return respondWithRpcPromise(_0x2a5d('0xcb'),'startRouting',_0x31e32a);})[_0x2a5d('0x1f')](function(_0x452992){respondWithRpcPromise(_0x2a5d('0xcc'),'EventManager',{'event':'notify','message':_0x452992},client9002);return _0x452992;})[_0x2a5d('0x1f')](respondWithResult(_0x5d514e,null))[_0x2a5d('0x56')](handleError(_0x5d514e,null));};exports[_0x2a5d('0xcd')]=function(_0xcf0535,_0x95d5b0,_0x433aa4){var _0x5613f0,_0x588530,_0x50d324;var _0xa89fc1=[];var _0x43fad9=[];var _0x42abe7={};return db[_0x2a5d('0x8e')][_0x2a5d('0x63')]()[_0x2a5d('0x1f')](function(_0x3677a6){if(!_0x3677a6){throw new db[(_0x2a5d('0x1d'))][(_0x2a5d('0x8f'))](_0x2a5d('0x90'));}_0x43fad9=_[_0x2a5d('0x91')](_[_0x2a5d('0x59')](_0x3677a6),['createdAt','updatedAt']);_0xa89fc1=_['difference'](_['keys'](_0x3677a6),[_0x2a5d('0x92'),_0x2a5d('0x93'),_0x2a5d('0x94'),_0x2a5d('0xa5')]);if(_0xcf0535['body']['id']){delete _0xcf0535[_0x2a5d('0x62')]['id'];}if(_[_0x2a5d('0x80')](_0xcf0535[_0x2a5d('0x62')]['from'])){throw _0x95d5b0['status'](0x1f4)[_0x2a5d('0xce')](new db[(_0x2a5d('0x1d'))][(_0x2a5d('0x8f'))]('from\x20is\x20mandatory'));}if(_['isNil'](_0xcf0535[_0x2a5d('0x62')][_0x2a5d('0x62')])||_0xcf0535['body'][_0x2a5d('0x62')]===''){throw _0x95d5b0[_0x2a5d('0x29')](0x1f4)['send'](new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x2a5d('0x80')](_0xcf0535[_0x2a5d('0x62')][_0x2a5d('0xcf')])){throw _0x95d5b0['status'](0x1f4)[_0x2a5d('0xce')](new db[(_0x2a5d('0x1d'))][(_0x2a5d('0x8f'))](_0x2a5d('0xd0')+_0xa89fc1));}if(!_[_0x2a5d('0xd1')](_0xa89fc1,_0xcf0535[_0x2a5d('0x62')][_0x2a5d('0xcf')])){throw _0x95d5b0[_0x2a5d('0x29')](0x1f4)['send'](new db['Sequelize']['ValidationError'](_0x2a5d('0xd2')+_0xa89fc1));}_0x42abe7[_0xcf0535[_0x2a5d('0x62')][_0x2a5d('0xcf')]]=_0xcf0535['body']['from'];})[_0x2a5d('0x1f')](function(){return db[_0x2a5d('0x3c')][_0x2a5d('0x5b')]({'where':{'id':_0xcf0535['params']['id']},'include':[{'model':db['CmList'],'as':_0x2a5d('0x9c')}]});})['then'](handleEntityNotFound(_0x95d5b0,null))['then'](function(_0x2b128a){if(_0x2b128a&&_0x2b128a[_0x2a5d('0x9c')]){_0x588530=_0x2b128a;var _0x148b19=_[_0x2a5d('0x15')](_0xcf0535[_0x2a5d('0x62')],{'firstName':_0xcf0535[_0x2a5d('0x62')][_0x2a5d('0x9a')],'phone':_0xcf0535['body'][_0x2a5d('0x9a')],'ListId':_0x2b128a[_0x2a5d('0xa5')]});_0x148b19[_0xcf0535[_0x2a5d('0x62')][_0x2a5d('0xcf')]]=_0xcf0535['body'][_0x2a5d('0x9a')];return db[_0x2a5d('0x8e')][_0x2a5d('0xd3')]({'where':_0x42abe7,'defaults':_0x148b19});}})[_0x2a5d('0xd4')](function(_0x37d27d){if(_0x37d27d){_0x50d324=_0x37d27d;var _0x1cfb9d=fs[_0x2a5d('0xd5')](path[_0x2a5d('0x7e')](config[_0x2a5d('0x77')],_0x2a5d('0xd6')),_0x2a5d('0xd7'));var _0x2392f0=ejs[_0x2a5d('0xd8')](_0x1cfb9d,{'body':_[_0x2a5d('0xd9')](_0xcf0535[_0x2a5d('0x62')][_0x2a5d('0x62')]),'bodyTitle':_0x588530[_0x2a5d('0xda')]});return db['ChatOfflineMessage']['create']({'body':_0x2392f0,'ContactId':_0x37d27d['id'],'ChatWebsiteId':_0x588530['id']});}})[_0x2a5d('0x1f')](function(_0x13a2b2){if(_0x13a2b2){_0x5613f0=_0x13a2b2;return db[_0x2a5d('0xdb')][_0x2a5d('0x67')]({'where':{'service':!![]},'include':[{'model':db[_0x2a5d('0xdc')],'as':_0x2a5d('0xdd'),'raw':!![]}]});}})[_0x2a5d('0x1f')](function(_0x3659ef){if(_0x3659ef&&_0x3659ef['Smtp']&&_0x588530[_0x2a5d('0xde')]){var _0x27d47b={'tls':{'rejectUnauthorized':![]}};if(_0x3659ef[_0x2a5d('0xdd')][_0x2a5d('0xdf')]){_0x27d47b[_0x2a5d('0xdf')]=_0x3659ef['Smtp'][_0x2a5d('0xdf')];}else{_0x27d47b[_0x2a5d('0xe0')]=_0x3659ef[_0x2a5d('0xdd')][_0x2a5d('0xe0')];_0x27d47b[_0x2a5d('0xe1')]=_0x3659ef[_0x2a5d('0xdd')][_0x2a5d('0xe1')];_0x27d47b[_0x2a5d('0xe2')]=_0x3659ef[_0x2a5d('0xdd')][_0x2a5d('0xe2')];}if(_0x3659ef['Smtp'][_0x2a5d('0xe3')]){_0x27d47b['auth']={'user':_0x3659ef[_0x2a5d('0xdd')][_0x2a5d('0x5d')],'pass':_0x3659ef[_0x2a5d('0xdd')][_0x2a5d('0xe4')]};}return respondWithRpcPromise(_0x2a5d('0xe5'),_0x2a5d('0xe6'),{'account':_0x27d47b,'message':{'from':util[_0x2a5d('0xb1')](_0x2a5d('0xe7'),_0x3659ef[_0x2a5d('0x38')],_0x3659ef[_0x2a5d('0xe8')]||_0x3659ef[_0x2a5d('0xdd')][_0x2a5d('0x5d')]),'to':_0x588530['forwardOfflineAddress'],'subject':_0x588530[_0x2a5d('0xe9')],'text':_0x5613f0[_0x2a5d('0x62')]}},client9003)[_0x2a5d('0x1f')](function(){return _0x5613f0;})['catch'](function(_0x5d2507){console[_0x2a5d('0x25')](_0x5d2507);});}})[_0x2a5d('0x1f')](function(){if(_0x5613f0){return _0x5613f0;}})[_0x2a5d('0x1f')](respondWithResult(_0x95d5b0,null))[_0x2a5d('0x56')](handleError(_0x95d5b0,null));};exports['addInteraction']=function(_0x5cd25d,_0x51aa06,_0x4e97d8){return db[_0x2a5d('0xb9')][_0x2a5d('0x5b')]({'where':{'id':_0x5cd25d[_0x2a5d('0x58')]['id']}})[_0x2a5d('0x1f')](handleEntityNotFound(_0x51aa06,null))[_0x2a5d('0x1f')](function(_0x44b551){if(_0x44b551){return _0x44b551[_0x2a5d('0xea')](_0x5cd25d[_0x2a5d('0x62')][_0x2a5d('0x6a')],_['omit'](_0x5cd25d[_0x2a5d('0x62')],[_0x2a5d('0x6a'),'id'])||{});}})['then'](respondWithResult(_0x51aa06,null))[_0x2a5d('0x56')](handleError(_0x51aa06,null));};exports['getInteractions']=function(_0x59f7ce,_0x448812,_0x21d729){var _0x50de83={'raw':![],'where':{}};var _0x5167d3={};var _0x3d8929={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x2a5d('0x67')]({'where':{'id':_0x59f7ce[_0x2a5d('0x58')]['id']}})[_0x2a5d('0x1f')](handleEntityNotFound(_0x448812,null))[_0x2a5d('0x1f')](function(_0xf9cac7){if(_0xf9cac7){_0x5167d3[_0x2a5d('0x40')]=_['keys'](db[_0x2a5d('0xb9')][_0x2a5d('0x3d')]);_0x5167d3[_0x2a5d('0x42')]=_[_0x2a5d('0x59')](_0x59f7ce['query']);_0x5167d3['filters']=_[_0x2a5d('0x44')](_0x5167d3[_0x2a5d('0x40')],_0x5167d3['query']);_0x50de83['attributes']=_['intersection'](_0x5167d3['model'],qs[_0x2a5d('0x45')](_0x59f7ce['query'][_0x2a5d('0x45')]));_0x50de83[_0x2a5d('0x43')]=_0x50de83[_0x2a5d('0x43')]['length']?_0x50de83['attributes']:_0x5167d3['model'];if(!_0x59f7ce[_0x2a5d('0x42')]['hasOwnProperty']('nolimit')){_0x50de83['limit']=qs[_0x2a5d('0x2e')](_0x59f7ce[_0x2a5d('0x42')][_0x2a5d('0x2e')]);_0x50de83['offset']=qs['offset'](_0x59f7ce['query'][_0x2a5d('0x2d')]);}_0x50de83['order']=qs[_0x2a5d('0x49')](_0x59f7ce['query'][_0x2a5d('0x49')]);_0x50de83[_0x2a5d('0x4a')]=qs[_0x2a5d('0x4b')](_['pick'](_0x59f7ce[_0x2a5d('0x42')],_0x5167d3[_0x2a5d('0x4b')]));_0x50de83[_0x2a5d('0x4a')][_0x2a5d('0x68')]=_0xf9cac7['id'];if(_0x59f7ce[_0x2a5d('0x42')]['filter']){_0x50de83['where']=_['merge'](_0x50de83['where'],{'$or':_[_0x2a5d('0x41')](_0x50de83[_0x2a5d('0x43')],function(_0x346541){var _0x2cc807={};_0x2cc807[_0x346541]={'$like':'%'+_0x59f7ce['query'][_0x2a5d('0x4d')]+'%'};return _0x2cc807;})});}_0x50de83=_[_0x2a5d('0x4e')]({},_0x50de83,_0x59f7ce[_0x2a5d('0x51')]);return db[_0x2a5d('0xb9')]['count']({'where':_0x50de83[_0x2a5d('0x4a')]})['then'](function(_0x3f32b5){_0x3d8929['count']=_0x3f32b5;if(_0x59f7ce[_0x2a5d('0x42')]['includeAll']){_0x50de83['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x2a5d('0xc5')],'as':_0x2a5d('0xeb'),'attributes':[_0x2a5d('0x38'),'fullname',_0x2a5d('0xec')],'required':![]},{'model':db[_0x2a5d('0xed')],'as':_0x2a5d('0xee'),'attributes':['id',_0x2a5d('0x38'),'color'],'where':_0x59f7ce[_0x2a5d('0x42')]['tag']?{'id':_0x59f7ce[_0x2a5d('0x42')][_0x2a5d('0xef')]}:undefined,'required':_0x59f7ce['query'][_0x2a5d('0xef')]?!![]:![]}];}return db[_0x2a5d('0xb9')][_0x2a5d('0x54')](_0x50de83);})[_0x2a5d('0x1f')](function(_0x3bb258){_0x3d8929[_0x2a5d('0x55')]=_0x3bb258;return _0x3d8929;});}})[_0x2a5d('0x1f')](respondWithFilteredResult(_0x448812,_0x50de83))[_0x2a5d('0x56')](handleError(_0x448812,null));};function iftimePromise(_0x21339d,_0x581c37){return respondWithRpcPromise(_0x2a5d('0xf0'),_0x2a5d('0xf1'),{'command':_0x581c37[_0x2a5d('0xf2')]?util['format'](_0x2a5d('0xf3'),_0x21339d[_0x2a5d('0xf4')],_0x581c37[_0x2a5d('0xf2')]):util[_0x2a5d('0xb1')]('iftime\x20%s',_0x21339d[_0x2a5d('0xf4')])},client9002)[_0x2a5d('0x1f')](function(_0x4d6606){var _0x24b653=_0x4d6606&&_0x4d6606[_0x2a5d('0xf5')](_0x2a5d('0xf6'))>=0x0?!![]:![];logger[_0x2a5d('0x20')](_0x2a5d('0xf7'),_0x581c37['id'],_0x21339d['id'],_0x21339d[_0x2a5d('0xf4')],_0x24b653?'ONLINE':_0x2a5d('0xf8'),_0x581c37[_0x2a5d('0xf2')]?_0x581c37[_0x2a5d('0xf2')]:'No\x20timezone');return _0x24b653;})['catch'](function(_0x4d74f8){logger[_0x2a5d('0x25')](_0x2a5d('0xf7'),_0x581c37['id'],_0x21339d['id'],_0x21339d[_0x2a5d('0xf4')],util[_0x2a5d('0xf9')](_0x4d74f8,{'showHidden':![],'depth':null}),_0x581c37[_0x2a5d('0xf2')]?_0x581c37[_0x2a5d('0xf2')]:_0x2a5d('0xfa'));return![];});}exports[_0x2a5d('0xf1')]=function(_0x4c01d6,_0x4fe932,_0x4e9b7d){var _0x25d031=0x0;var _0x770fe2=0x0;var _0x2b3e2e=![];var _0x3437e4;var _0x28e2cd;return db[_0x2a5d('0x3c')]['find']({'where':{'id':_0x4c01d6[_0x2a5d('0x58')]['id']},'include':[{'model':db[_0x2a5d('0xfb')],'as':_0x2a5d('0xfb'),'include':[{'model':db[_0x2a5d('0xfb')],'as':_0x2a5d('0xfc'),'attributes':['id','interval'],'raw':!![]}]}]})[_0x2a5d('0x1f')](handleEntityNotFound(_0x4fe932,null))[_0x2a5d('0x1f')](function(_0x191a2b){if(_0x191a2b){_0x3437e4=_0x191a2b;return _0x191a2b[_0x2a5d('0xfd')]({'raw':!![]});}})[_0x2a5d('0x1f')](function(_0x488e7b){if(_0x3437e4){if(_0x488e7b){_0x28e2cd=_0x488e7b;}}return require(_0x2a5d('0xfe'))[_0x2a5d('0x79')]();})['then'](function(_0x235945){if(_0x235945){_0x770fe2=_0x235945[_0x2a5d('0xff')];_0x2b3e2e=_0x235945['custom'];}})[_0x2a5d('0x1f')](function(){return db[_0x2a5d('0xb9')][_0x2a5d('0x2c')]({'where':{'closed':![]}});})['then'](function(_0x5c56ab){_0x25d031=_0x5c56ab;if(_0x770fe2&&_0x5c56ab>_0x770fe2){return db[_0x2a5d('0x100')]['findOne']({'where':{'id':0x1}})[_0x2a5d('0x1f')](function(_0x2b96e3){if(_0x2b96e3){_0x2b96e3[_0x2a5d('0x101')](_0x2a5d('0x102'));}});}})['then'](function(){if(_0x3437e4['Interval']&&_0x3437e4['Interval'][_0x2a5d('0xfc')]){var _0x3e78fe=[];for(var _0x433bb1=0x0;_0x433bb1<_0x3437e4[_0x2a5d('0xfb')][_0x2a5d('0xfc')][_0x2a5d('0x5a')];_0x433bb1++){var _0x92b312=_0x3437e4[_0x2a5d('0xfb')][_0x2a5d('0xfc')][_0x433bb1][_0x2a5d('0x35')]({'plain':!![]});_0x3e78fe['push'](iftimePromise(_0x92b312,_0x3437e4));}return BPromise[_0x2a5d('0x103')](_0x3e78fe)['then'](function(_0x30de1f){return _[_0x2a5d('0x104')](_0x30de1f);});}else{return!![];}})[_0x2a5d('0x1f')](function(_0x33b05e){var _0x5d5be2=fs[_0x2a5d('0xd5')](path[_0x2a5d('0x7e')](config['root'],_0x2a5d('0x105')),_0x2a5d('0xd7'));var _0x48c053={'remote':_0x3437e4[_0x2a5d('0x106')],'query':querystring[_0x2a5d('0x107')](_[_0x2a5d('0x4e')](_0x3437e4[_0x2a5d('0x35')]({'plain':!![]}),{'customerIp':_0x4c01d6[_0x2a5d('0xa9')][_0x2a5d('0xaa')]||_0x4c01d6['headers']['x-real-ip']||_0x4c01d6[_0x2a5d('0x108')][_0x2a5d('0x109')]||_0x4c01d6['ip'],'referer':_0x4c01d6['headers'][_0x2a5d('0xaf')],'openedInteractions':_0x25d031,'maxInteractions':_0x770fe2,'virtual':_0x2b3e2e[_0x2a5d('0xff')],'online':_0x33b05e,'custom':_0x2b3e2e}))[_0x2a5d('0x10a')](/'/g,'\x5c\x27')};_0x4fe932[_0x2a5d('0xce')](ejs[_0x2a5d('0xd8')](Mustache[_0x2a5d('0xd8')](_0x5d5be2,_0x48c053),{'proactiveActions':_0x28e2cd,'alignment':_0x3437e4[_0x2a5d('0x10b')],'verticalAlignment':_0x3437e4[_0x2a5d('0x10c')],'div_color':_0x3437e4[_0x2a5d('0x10d')],'text_color':_0x3437e4[_0x2a5d('0x10e')]}));})[_0x2a5d('0x56')](handleError(_0x4fe932,null));};exports[_0x2a5d('0x10f')]=function(_0x342fbc,_0x110977,_0x21f5a7){return db['ChatWebsite']['findOne']({'where':{'id':_0x342fbc['params']['id']}})[_0x2a5d('0x1f')](handleEntityNotFound(_0x110977,null))[_0x2a5d('0x1f')](function(_0xff40e2){if(_0xff40e2){return db[_0x2a5d('0x110')][_0x2a5d('0x111')](function(_0x8a3af4){return db[_0x2a5d('0x112')]['destroy']({'where':{'ChatWebsiteId':_0x342fbc['params']['id']},'transaction':_0x8a3af4})['then'](function(_0x52e359){var _0x4bd336=_[_0x2a5d('0x41')](_0x342fbc[_0x2a5d('0x62')],function(_0x1c9f05){_0x1c9f05['ChatWebsiteId']=_0x342fbc[_0x2a5d('0x58')]['id'];return _0x1c9f05;});return db[_0x2a5d('0x112')][_0x2a5d('0x113')](_0x4bd336,{'transaction':_0x8a3af4});});})[_0x2a5d('0x1f')](function(){return db[_0x2a5d('0x112')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x342fbc[_0x2a5d('0x58')]['id']},'order':_0x2a5d('0xa3')});});}})[_0x2a5d('0x1f')](respondWithResult(_0x110977,null))[_0x2a5d('0x56')](handleError(_0x110977,null));};exports[_0x2a5d('0x114')]=function(_0x2c39a9,_0x55420f,_0x5db140){var _0x24b1a4={};var _0xc23256={};var _0x21f6a5;var _0x4abd73;return db[_0x2a5d('0x3c')][_0x2a5d('0x67')]({'where':{'id':_0x2c39a9[_0x2a5d('0x58')]['id']}})['then'](handleEntityNotFound(_0x55420f,null))[_0x2a5d('0x1f')](function(_0x275866){if(_0x275866){_0x21f6a5=_0x275866;_0xc23256[_0x2a5d('0x40')]=_[_0x2a5d('0x59')](db[_0x2a5d('0x112')][_0x2a5d('0x3d')]);_0xc23256['query']=_[_0x2a5d('0x59')](_0x2c39a9[_0x2a5d('0x42')]);_0xc23256[_0x2a5d('0x4b')]=_[_0x2a5d('0x44')](_0xc23256[_0x2a5d('0x40')],_0xc23256[_0x2a5d('0x42')]);_0x24b1a4[_0x2a5d('0x43')]=_['intersection'](_0xc23256[_0x2a5d('0x40')],qs[_0x2a5d('0x45')](_0x2c39a9[_0x2a5d('0x42')][_0x2a5d('0x45')]));_0x24b1a4[_0x2a5d('0x43')]=_0x24b1a4[_0x2a5d('0x43')][_0x2a5d('0x5a')]?_0x24b1a4['attributes']:_0xc23256[_0x2a5d('0x40')];_0x24b1a4[_0x2a5d('0x48')]=qs[_0x2a5d('0x49')](_0x2c39a9['query'][_0x2a5d('0x49')]);_0x24b1a4[_0x2a5d('0x4a')]=qs[_0x2a5d('0x4b')](_['pick'](_0x2c39a9[_0x2a5d('0x42')],_0xc23256[_0x2a5d('0x4b')]));if(_0x2c39a9[_0x2a5d('0x42')][_0x2a5d('0x4d')]){_0x24b1a4[_0x2a5d('0x4a')]=_[_0x2a5d('0x4e')](_0x24b1a4[_0x2a5d('0x4a')],{'$or':_[_0x2a5d('0x41')](_0x24b1a4[_0x2a5d('0x43')],function(_0x37c843){var _0x55d501={};_0x55d501[_0x37c843]={'$like':'%'+_0x2c39a9[_0x2a5d('0x42')][_0x2a5d('0x4d')]+'%'};return _0x55d501;})});}_0x24b1a4=_[_0x2a5d('0x4e')]({},_0x24b1a4,_0x2c39a9[_0x2a5d('0x51')]);return _0x21f6a5[_0x2a5d('0x114')](_0x24b1a4);}})[_0x2a5d('0x1f')](function(_0x4577bf){if(_0x4577bf){_0x4abd73=_0x4577bf['length'];if(!_0x2c39a9[_0x2a5d('0x42')][_0x2a5d('0x46')](_0x2a5d('0x47'))){_0x24b1a4[_0x2a5d('0x2e')]=qs[_0x2a5d('0x2e')](_0x2c39a9[_0x2a5d('0x42')][_0x2a5d('0x2e')]);_0x24b1a4[_0x2a5d('0x2d')]=qs[_0x2a5d('0x2d')](_0x2c39a9[_0x2a5d('0x42')][_0x2a5d('0x2d')]);}return _0x21f6a5[_0x2a5d('0x114')](_0x24b1a4);}})[_0x2a5d('0x1f')](function(_0x459d6b){if(_0x459d6b){return _0x459d6b?{'count':_0x4abd73,'rows':_0x459d6b}:null;}})[_0x2a5d('0x1f')](respondWithResult(_0x55420f,null))[_0x2a5d('0x56')](handleError(_0x55420f,null));};exports['addProactiveActions']=function(_0x492075,_0x150ace,_0x65ac61){return db['chatProactiveAction'][_0x2a5d('0x5b')]({'where':{'id':_0x492075[_0x2a5d('0x58')]['id']}})[_0x2a5d('0x1f')](handleEntityNotFound(_0x150ace,null))[_0x2a5d('0x1f')](function(_0x37a559){if(_0x37a559){return _0x37a559[_0x2a5d('0x115')](_0x492075['body'][_0x2a5d('0x6a')],_[_0x2a5d('0x116')](_0x492075[_0x2a5d('0x62')],['ids','id'])||{});}})[_0x2a5d('0x1f')](respondWithResult(_0x150ace,null))[_0x2a5d('0x56')](handleError(_0x150ace,null));};exports['getProactiveActions']=function(_0x4ba3b8,_0x4e194f,_0x1f42af){var _0x128612={};var _0x5ba0d5={};var _0x2de7eb;var _0x467023;return db[_0x2a5d('0x3c')][_0x2a5d('0x67')]({'where':{'id':_0x4ba3b8[_0x2a5d('0x58')]['id']}})[_0x2a5d('0x1f')](handleEntityNotFound(_0x4e194f,null))[_0x2a5d('0x1f')](function(_0x17ebe7){if(_0x17ebe7){_0x2de7eb=_0x17ebe7;_0x5ba0d5['model']=_['keys'](db[_0x2a5d('0x117')][_0x2a5d('0x3d')]);_0x5ba0d5[_0x2a5d('0x42')]=_[_0x2a5d('0x59')](_0x4ba3b8[_0x2a5d('0x42')]);_0x5ba0d5[_0x2a5d('0x4b')]=_[_0x2a5d('0x44')](_0x5ba0d5[_0x2a5d('0x40')],_0x5ba0d5[_0x2a5d('0x42')]);_0x128612[_0x2a5d('0x43')]=_[_0x2a5d('0x44')](_0x5ba0d5['model'],qs[_0x2a5d('0x45')](_0x4ba3b8['query'][_0x2a5d('0x45')]));_0x128612[_0x2a5d('0x43')]=_0x128612[_0x2a5d('0x43')][_0x2a5d('0x5a')]?_0x128612['attributes']:_0x5ba0d5[_0x2a5d('0x40')];_0x128612[_0x2a5d('0x48')]=qs[_0x2a5d('0x49')](_0x4ba3b8[_0x2a5d('0x42')][_0x2a5d('0x49')]);_0x128612[_0x2a5d('0x4a')]=qs[_0x2a5d('0x4b')](_[_0x2a5d('0x4c')](_0x4ba3b8[_0x2a5d('0x42')],_0x5ba0d5[_0x2a5d('0x4b')]));if(_0x4ba3b8[_0x2a5d('0x42')][_0x2a5d('0x4d')]){_0x128612[_0x2a5d('0x4a')]=_[_0x2a5d('0x4e')](_0x128612[_0x2a5d('0x4a')],{'$or':_[_0x2a5d('0x41')](_0x128612['attributes'],function(_0x3d4717){var _0x43824f={};_0x43824f[_0x3d4717]={'$like':'%'+_0x4ba3b8[_0x2a5d('0x42')][_0x2a5d('0x4d')]+'%'};return _0x43824f;})});}_0x128612=_[_0x2a5d('0x4e')]({},_0x128612,_0x4ba3b8['options']);return _0x2de7eb['getProactiveActions'](_0x128612);}})[_0x2a5d('0x1f')](function(_0x39d593){if(_0x39d593){_0x467023=_0x39d593['length'];if(!_0x4ba3b8[_0x2a5d('0x42')][_0x2a5d('0x46')](_0x2a5d('0x47'))){_0x128612['limit']=qs['limit'](_0x4ba3b8['query'][_0x2a5d('0x2e')]);_0x128612['offset']=qs[_0x2a5d('0x2d')](_0x4ba3b8['query'][_0x2a5d('0x2d')]);}return _0x2de7eb[_0x2a5d('0xfd')](_0x128612);}})['then'](function(_0x1ed0a0){if(_0x1ed0a0){return _0x1ed0a0?{'count':_0x467023,'rows':_0x1ed0a0}:null;}})[_0x2a5d('0x1f')](respondWithResult(_0x4e194f,null))[_0x2a5d('0x56')](handleError(_0x4e194f,null));};exports[_0x2a5d('0x118')]=function(_0x3288f5,_0x26927d,_0x2fd906){var _0x3af802=_0x3288f5[_0x2a5d('0x42')][_0x2a5d('0x119')]===_0x2a5d('0x11a')?'offlineForm':_0x2a5d('0x11b');return db[_0x2a5d('0x3c')][_0x2a5d('0x5b')]({'attributes':['id',_0x3af802],'where':{'id':_0x3288f5[_0x2a5d('0x58')]['id']}})[_0x2a5d('0x1f')](handleEntityNotFound(_0x26927d,null))['then'](function(_0x10329f){if(_0x10329f){var _0x50eec0=_0x10329f[_0x3af802];var _0x5d2dda=_0x50eec0&&_0x50eec0[_0x2a5d('0x11c')]?_0x50eec0[_0x2a5d('0x11c')]:[];_0x26927d[_0x2a5d('0xce')]({'fromKey':_[_0x2a5d('0x80')](_0x50eec0['fromKey'])?undefined:_0x50eec0[_0x2a5d('0x11d')],'count':_0x5d2dda['length'],'rows':_0x5d2dda});}})['catch'](handleError(_0x26927d,null));};exports[_0x2a5d('0x11e')]=function(_0x5822a2,_0xf4b625,_0x529a76){var _0x3360d2={'raw':![],'where':{}};var _0x5f13ac={};var _0x35fe60={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x2a5d('0x67')]({'where':{'id':_0x5822a2[_0x2a5d('0x58')]['id']}})[_0x2a5d('0x1f')](handleEntityNotFound(_0xf4b625,null))['then'](function(_0x506e47){if(_0x506e47){_0x5f13ac[_0x2a5d('0x40')]=_[_0x2a5d('0x59')](db[_0x2a5d('0x11f')][_0x2a5d('0x3d')]);_0x5f13ac[_0x2a5d('0x42')]=_[_0x2a5d('0x59')](_0x5822a2[_0x2a5d('0x42')]);_0x5f13ac[_0x2a5d('0x4b')]=_[_0x2a5d('0x44')](_0x5f13ac[_0x2a5d('0x40')],_0x5f13ac['query']);_0x3360d2[_0x2a5d('0x43')]=_[_0x2a5d('0x44')](_0x5f13ac[_0x2a5d('0x40')],qs[_0x2a5d('0x45')](_0x5822a2[_0x2a5d('0x42')][_0x2a5d('0x45')]));_0x3360d2[_0x2a5d('0x43')]=_0x3360d2['attributes'][_0x2a5d('0x5a')]?_0x3360d2['attributes']:_0x5f13ac['model'];if(!_0x5822a2[_0x2a5d('0x42')]['hasOwnProperty'](_0x2a5d('0x47'))){_0x3360d2[_0x2a5d('0x2e')]=qs[_0x2a5d('0x2e')](_0x5822a2[_0x2a5d('0x42')][_0x2a5d('0x2e')]);_0x3360d2[_0x2a5d('0x2d')]=qs[_0x2a5d('0x2d')](_0x5822a2['query'][_0x2a5d('0x2d')]);}_0x3360d2[_0x2a5d('0x48')]=qs[_0x2a5d('0x49')](_0x5822a2[_0x2a5d('0x42')][_0x2a5d('0x49')]);_0x3360d2['where']=qs['filters'](_[_0x2a5d('0x4c')](_0x5822a2['query'],_0x5f13ac[_0x2a5d('0x4b')]));_0x3360d2[_0x2a5d('0x4a')][_0x2a5d('0x68')]=_0x506e47['id'];if(_0x5822a2[_0x2a5d('0x42')][_0x2a5d('0x4d')]){_0x3360d2[_0x2a5d('0x4a')]=_[_0x2a5d('0x4e')](_0x3360d2[_0x2a5d('0x4a')],{'$or':_['map'](_0x3360d2[_0x2a5d('0x43')],function(_0xba189f){var _0x419f24={};_0x419f24[_0xba189f]={'$like':'%'+_0x5822a2[_0x2a5d('0x42')][_0x2a5d('0x4d')]+'%'};return _0x419f24;})});}_0x3360d2=_[_0x2a5d('0x4e')]({},_0x3360d2,_0x5822a2[_0x2a5d('0x51')]);return db[_0x2a5d('0x11f')][_0x2a5d('0x2c')]({'where':_0x3360d2[_0x2a5d('0x4a')]})['then'](function(_0x339a07){_0x35fe60[_0x2a5d('0x2c')]=_0x339a07;if(_0x5822a2[_0x2a5d('0x42')][_0x2a5d('0x52')]){_0x3360d2['include']=[{'all':!![]}];}else{_0x3360d2[_0x2a5d('0x53')]=[{'model':db[_0x2a5d('0x8e')],'as':_0x2a5d('0x120'),'required':![]}];}return db[_0x2a5d('0x11f')][_0x2a5d('0x54')](_0x3360d2);})['then'](function(_0x597ce6){_0x35fe60['rows']=_0x597ce6;return _0x35fe60;});}})[_0x2a5d('0x1f')](respondWithFilteredResult(_0xf4b625,_0x3360d2))[_0x2a5d('0x56')](handleError(_0xf4b625,null));};exports[_0x2a5d('0x121')]=function(_0x3107db,_0x387b7a,_0x5f5de0){return db[_0x2a5d('0x3c')]['find']({'where':{'id':_0x3107db[_0x2a5d('0x58')]['id']}})[_0x2a5d('0x1f')](handleEntityNotFound(_0x387b7a,null))[_0x2a5d('0x1f')](function(_0x56a2f3){if(_0x56a2f3){return _0x56a2f3['addAgents'](_0x3107db['body'][_0x2a5d('0x6a')],_[_0x2a5d('0x116')](_0x3107db[_0x2a5d('0x62')],[_0x2a5d('0x6a'),'id'])||{})[_0x2a5d('0xd4')](function(_0x27162f){for(var _0x49021f=0x0;_0x49021f<_0x3107db['body'][_0x2a5d('0x6a')][_0x2a5d('0x5a')];_0x49021f+=0x1){socket[_0x2a5d('0x122')](_0x2a5d('0x123'),{'UserId':_0x3107db[_0x2a5d('0x62')]['ids'][_0x49021f],'ChatWebsiteId':_0x3107db[_0x2a5d('0x58')]['id']});}return _0x27162f;});}})['then'](respondWithResult(_0x387b7a,null))[_0x2a5d('0x56')](handleError(_0x387b7a,null));};exports[_0x2a5d('0x124')]=function(_0x183cb6,_0x3c9ca2,_0x42c83e){return db[_0x2a5d('0x3c')][_0x2a5d('0x5b')]({'where':{'id':_0x183cb6[_0x2a5d('0x58')]['id']}})['then'](handleEntityNotFound(_0x3c9ca2,null))[_0x2a5d('0x1f')](function(_0x48ab6f){if(_0x48ab6f){return _0x48ab6f[_0x2a5d('0x124')](_0x183cb6['query'][_0x2a5d('0x6a')])[_0x2a5d('0x1f')](function(){if(_[_0x2a5d('0x125')](_0x183cb6['query'][_0x2a5d('0x6a')])){for(var _0x2e5a91=0x0;_0x2e5a91<_0x183cb6[_0x2a5d('0x42')][_0x2a5d('0x6a')][_0x2a5d('0x5a')];_0x2e5a91+=0x1){socket[_0x2a5d('0x122')](_0x2a5d('0x126'),{'UserId':Number(_0x183cb6['query'][_0x2a5d('0x6a')][_0x2e5a91]),'ChatWebsiteId':Number(_0x183cb6['params']['id'])});}}else{socket[_0x2a5d('0x122')](_0x2a5d('0x126'),{'UserId':Number(_0x183cb6[_0x2a5d('0x42')][_0x2a5d('0x6a')]),'ChatWebsiteId':Number(_0x183cb6['params']['id'])});}});}})[_0x2a5d('0x1f')](respondWithStatusCode(_0x3c9ca2,null))[_0x2a5d('0x56')](handleError(_0x3c9ca2,null));};exports[_0x2a5d('0x127')]=function(_0x3fbf48,_0x2d4d46,_0x3bd91b){var _0x442e5f={};var _0x45662e={};var _0x4320aa;var _0x236986;return db['ChatWebsite'][_0x2a5d('0x67')]({'where':{'id':_0x3fbf48[_0x2a5d('0x58')]['id']}})[_0x2a5d('0x1f')](handleEntityNotFound(_0x2d4d46,null))['then'](function(_0x180d0b){if(_0x180d0b){_0x4320aa=_0x180d0b;_0x45662e[_0x2a5d('0x40')]=_[_0x2a5d('0x59')](db[_0x2a5d('0xc5')][_0x2a5d('0x3d')]);_0x45662e[_0x2a5d('0x42')]=_[_0x2a5d('0x59')](_0x3fbf48[_0x2a5d('0x42')]);_0x45662e['filters']=_[_0x2a5d('0x44')](_0x45662e[_0x2a5d('0x40')],_0x45662e[_0x2a5d('0x42')]);_0x442e5f[_0x2a5d('0x43')]=_[_0x2a5d('0x44')](_0x45662e[_0x2a5d('0x40')],qs[_0x2a5d('0x45')](_0x3fbf48['query'][_0x2a5d('0x45')]));_0x442e5f[_0x2a5d('0x43')]=_0x442e5f[_0x2a5d('0x43')][_0x2a5d('0x5a')]?_0x442e5f[_0x2a5d('0x43')]:_0x45662e['model'];_0x442e5f['order']=qs[_0x2a5d('0x49')](_0x3fbf48[_0x2a5d('0x42')][_0x2a5d('0x49')]);_0x442e5f[_0x2a5d('0x4a')]=qs[_0x2a5d('0x4b')](_['pick'](_0x3fbf48[_0x2a5d('0x42')],_0x45662e[_0x2a5d('0x4b')]));if(_0x3fbf48[_0x2a5d('0x42')][_0x2a5d('0x4d')]){_0x442e5f['where']=_[_0x2a5d('0x4e')](_0x442e5f[_0x2a5d('0x4a')],{'$or':_['map'](_0x442e5f[_0x2a5d('0x43')],function(_0xc9cb16){var _0xde5ac5={};_0xde5ac5[_0xc9cb16]={'$like':'%'+_0x3fbf48['query'][_0x2a5d('0x4d')]+'%'};return _0xde5ac5;})});}_0x442e5f=_['merge']({},_0x442e5f,_0x3fbf48[_0x2a5d('0x51')]);return _0x4320aa[_0x2a5d('0x127')](_0x442e5f);}})[_0x2a5d('0x1f')](function(_0x17cb4f){if(_0x17cb4f){_0x236986=_0x17cb4f[_0x2a5d('0x5a')];if(!_0x3fbf48[_0x2a5d('0x42')][_0x2a5d('0x46')](_0x2a5d('0x47'))){_0x442e5f['limit']=qs['limit'](_0x3fbf48[_0x2a5d('0x42')]['limit']);_0x442e5f[_0x2a5d('0x2d')]=qs[_0x2a5d('0x2d')](_0x3fbf48[_0x2a5d('0x42')][_0x2a5d('0x2d')]);}return _0x4320aa['getAgents'](_0x442e5f);}})[_0x2a5d('0x1f')](function(_0x390b68){if(_0x390b68){return _0x390b68?{'count':_0x236986,'rows':_0x390b68}:null;}})[_0x2a5d('0x1f')](respondWithResult(_0x2d4d46,null))['catch'](handleError(_0x2d4d46,null));}; \ No newline at end of file +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 diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index daa50da..a7cf7e2 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 _0x83f1=['exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','emit','hasOwnProperty','hook'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x83f1,0x1cc));var _0x183f=function(_0x2f82f5,_0x1e96c6){_0x2f82f5=_0x2f82f5-0x0;var _0x27f617=_0x83f1[_0x2f82f5];return _0x27f617;};'use strict';var EventEmitter=require(_0x183f('0x0'));var ChatWebsite=require(_0x183f('0x1'))['db'][_0x183f('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x183f('0x3')](0x0);var events={'afterCreate':_0x183f('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x459395){return function(_0x2668ca,_0x7f265,_0x2436de){ChatWebsiteEvents[_0x183f('0x5')](_0x459395+':'+_0x2668ca['id'],_0x2668ca);ChatWebsiteEvents['emit'](_0x459395,_0x2668ca);_0x2436de(null);};}for(var e in events){if(events[_0x183f('0x6')](e)){var event=events[e];ChatWebsite[_0x183f('0x7')](e,emitEvent(event));}}module[_0x183f('0x8')]=ChatWebsiteEvents; \ No newline at end of file +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 diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 2cd30ab..d800516 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 _0x0713=['moment','bluebird','request-promise','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','../../config/logger','api'];(function(_0x519079,_0x4f0b89){var _0x2f900b=function(_0x1adb1e){while(--_0x1adb1e){_0x519079['push'](_0x519079['shift']());}};_0x2f900b(++_0x4f0b89);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _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 diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 749177a..5eeca4b 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 _0xc2c7=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','localhost','socket.io-emitter','redis','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x2166c0,_0xa986aa){var _0x2f68d5=function(_0x4869e3){while(--_0x4869e3){_0x2166c0['push'](_0x2166c0['shift']());}};_0x2f68d5(++_0xa986aa);}(_0xc2c7,0x134));var _0x7c2c=function(_0x5dde67,_0x5007e3){_0x5dde67=_0x5dde67-0x0;var _0x4a71d0=_0xc2c7[_0x5dde67];return _0x4a71d0;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x7c2c('0xb'),'port':0x18eb});var socket=require(_0x7c2c('0xc'))(new Redis(config[_0x7c2c('0xd')]));require(_0x7c2c('0xe'))[_0x7c2c('0xf')](socket);function respondWithRpcPromise(_0x57b107,_0x3093d2,_0x307bec){return new BPromise(function(_0x285ff6,_0x1bfeaf){return client[_0x7c2c('0x10')](_0x57b107,_0x307bec)[_0x7c2c('0x11')](function(_0x2cb057){logger[_0x7c2c('0x12')](_0x7c2c('0x13'),_0x3093d2,_0x7c2c('0x14'));logger[_0x7c2c('0x15')](_0x7c2c('0x16'),_0x3093d2,_0x7c2c('0x14'),JSON[_0x7c2c('0x17')](_0x2cb057));if(_0x2cb057[_0x7c2c('0x18')]){if(_0x2cb057[_0x7c2c('0x18')]['code']===0x1f4){logger['error'](_0x7c2c('0x13'),_0x3093d2,_0x2cb057[_0x7c2c('0x18')][_0x7c2c('0x19')]);return _0x1bfeaf(_0x2cb057['error'][_0x7c2c('0x19')]);}logger[_0x7c2c('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x3093d2,_0x2cb057[_0x7c2c('0x18')]['message']);return _0x285ff6(_0x2cb057[_0x7c2c('0x18')]['message']);}else{logger[_0x7c2c('0x12')](_0x7c2c('0x13'),_0x3093d2,_0x7c2c('0x14'));_0x285ff6(_0x2cb057[_0x7c2c('0x1a')][_0x7c2c('0x19')]);}})[_0x7c2c('0x1b')](function(_0x2c1378){logger[_0x7c2c('0x18')](_0x7c2c('0x13'),_0x3093d2,_0x2c1378);_0x1bfeaf(_0x2c1378);});});} \ No newline at end of file +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 diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 26d1ec5..69f77f4 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 _0x7a54=['remove','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x4980d4,_0x976b46){var _0x2e31ca=function(_0x4522ae){while(--_0x4522ae){_0x4980d4['push'](_0x4980d4['shift']());}};_0x2e31ca(++_0x976b46);}(_0x7a54,0x106));var _0x47a5=function(_0x5874ce,_0x1440be){_0x5874ce=_0x5874ce-0x0;var _0x2ebf49=_0x7a54[_0x5874ce];return _0x2ebf49;};'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 +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 diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index bb809b5..3d30eb0 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 _0xf628=['destroy','delete','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','describe','/:id','show','/:id/canned_answers','/:id/logo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','getProactiveActions','/:id/fields','/:id/offline_messages','getOfflineMessages','/:id/users','addDisposition','post','addAnswer','format','%s-%s','single','file','addLogo','diskStorage','join','root','now','originalname','/:id/avatar','addAvatar','server/files/images/avatars/','addSystemAvatar','notify','/:id/offline','offline','addInteraction','addApplications','addProactiveActions','addAgents','put','update'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xf628,0x7f));var _0x8f62=function(_0x5b4f62,_0x1946e5){_0x5b4f62=_0x5b4f62-0x0;var _0x3da57f=_0xf628[_0x5b4f62];return _0x3da57f;};'use strict';var multer=require(_0x8f62('0x0'));var util=require(_0x8f62('0x1'));var path=require(_0x8f62('0x2'));var timeout=require(_0x8f62('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8f62('0x4'));var config=require(_0x8f62('0x5'));var controller=require(_0x8f62('0x6'));router[_0x8f62('0x7')]('/',auth[_0x8f62('0x8')](),controller['index']);router[_0x8f62('0x7')]('/describe',auth[_0x8f62('0x8')](),controller[_0x8f62('0x9')]);router['get'](_0x8f62('0xa'),auth[_0x8f62('0x8')](),controller[_0x8f62('0xb')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router['get'](_0x8f62('0xc'),auth[_0x8f62('0x8')](),controller['getAnswers']);router[_0x8f62('0x7')](_0x8f62('0xd'),controller['getLogo']);router['get']('/:id/avatar',controller[_0x8f62('0xe')]);router[_0x8f62('0x7')](_0x8f62('0xf'),controller[_0x8f62('0x10')]);router[_0x8f62('0x7')](_0x8f62('0x11'),controller[_0x8f62('0x12')]);router['get'](_0x8f62('0x13'),auth['isAuthenticated'](),controller[_0x8f62('0x14')]);router['get'](_0x8f62('0x15'),controller[_0x8f62('0x16')]);router[_0x8f62('0x7')](_0x8f62('0x17'),auth['isAuthenticated'](),controller[_0x8f62('0x18')]);router[_0x8f62('0x7')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x8f62('0x19')]);router['get'](_0x8f62('0x1a'),controller['getFields']);router[_0x8f62('0x7')](_0x8f62('0x1b'),auth[_0x8f62('0x8')](),controller[_0x8f62('0x1c')]);router['get'](_0x8f62('0x1d'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0x8f62('0x8')](),controller['create']);router['post']('/:id/dispositions',auth[_0x8f62('0x8')](),controller[_0x8f62('0x1e')]);router[_0x8f62('0x1f')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x8f62('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x276b02,_0x1cfb60,_0x51adba){_0x51adba(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x24e6ac,_0x72b937,_0x4cc363){_0x4cc363(null,util[_0x8f62('0x21')](_0x8f62('0x22'),Date['now'](),_0x72b937['originalname']));}})});router[_0x8f62('0x1f')](_0x8f62('0xd'),upload[_0x8f62('0x23')](_0x8f62('0x24')),controller[_0x8f62('0x25')]);var upload=multer({'storage':multer[_0x8f62('0x26')]({'destination':function(_0x2a0000,_0x2ca228,_0x5b9961){_0x5b9961(null,path[_0x8f62('0x27')](config[_0x8f62('0x28')],'server/files/images/avatars/'));},'filename':function(_0x428ff3,_0x5f2e12,_0x2c5040){_0x2c5040(null,util[_0x8f62('0x21')](_0x8f62('0x22'),Date[_0x8f62('0x29')](),_0x5f2e12[_0x8f62('0x2a')]));}})});router['post'](_0x8f62('0x2b'),upload[_0x8f62('0x23')]('file'),controller[_0x8f62('0x2c')]);var upload=multer({'storage':multer[_0x8f62('0x26')]({'destination':function(_0x39f6fd,_0x12db63,_0x2c0f15){_0x2c0f15(null,path[_0x8f62('0x27')](config[_0x8f62('0x28')],_0x8f62('0x2d')));},'filename':function(_0x3effba,_0x32d508,_0x27b4eb){_0x27b4eb(null,util[_0x8f62('0x21')](_0x8f62('0x22'),Date['now'](),_0x32d508['originalname']));}})});router[_0x8f62('0x1f')](_0x8f62('0xf'),upload[_0x8f62('0x23')](_0x8f62('0x24')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x8f62('0x26')]({'destination':function(_0x1a7b2c,_0x2e3658,_0x53f7f4){_0x53f7f4(null,path[_0x8f62('0x27')](config[_0x8f62('0x28')],_0x8f62('0x2d')));},'filename':function(_0x36264a,_0x41e83a,_0x1f9c93){_0x1f9c93(null,util['format']('%s-%s',Date[_0x8f62('0x29')](),_0x41e83a['originalname']));}})});router[_0x8f62('0x1f')](_0x8f62('0x11'),upload['single']('file'),controller[_0x8f62('0x2e')]);router[_0x8f62('0x1f')]('/:id/notify',controller[_0x8f62('0x2f')]);router[_0x8f62('0x1f')](_0x8f62('0x30'),controller[_0x8f62('0x31')]);router[_0x8f62('0x1f')](_0x8f62('0x13'),auth['isAuthenticated'](),controller[_0x8f62('0x32')]);router[_0x8f62('0x1f')](_0x8f62('0x17'),auth[_0x8f62('0x8')](),controller[_0x8f62('0x33')]);router['post']('/:id/proactive_actions',auth[_0x8f62('0x8')](),controller[_0x8f62('0x34')]);router[_0x8f62('0x1f')]('/:id/users',auth['isAuthenticated'](),controller[_0x8f62('0x35')]);router[_0x8f62('0x36')](_0x8f62('0xa'),auth[_0x8f62('0x8')](),controller[_0x8f62('0x37')]);router['delete'](_0x8f62('0xa'),auth[_0x8f62('0x8')](),controller[_0x8f62('0x38')]);router['delete']('/:id/dispositions',auth[_0x8f62('0x8')](),controller['removeDispositions']);router[_0x8f62('0x39')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x8f62('0x3a')]);router['delete'](_0x8f62('0x1d'),auth[_0x8f62('0x8')](),controller[_0x8f62('0x3b')]);module[_0x8f62('0x3c')]=router; \ No newline at end of file +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 diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 5a6889e..ad6cb2e 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 _0x6afc=['STRING','AmazonAWS','Google','sequelize'];(function(_0x3bf740,_0x13ca00){var _0xf712c2=function(_0x176d08){while(--_0x176d08){_0x3bf740['push'](_0x3bf740['shift']());}};_0xf712c2(++_0x13ca00);}(_0x6afc,0x16b));var _0xc6af=function(_0x54c734,_0xc5cf3a){_0x54c734=_0x54c734-0x0;var _0x6bdb37=_0x6afc[_0x54c734];return _0x6bdb37;};'use strict';var Sequelize=require(_0xc6af('0x0'));module['exports']={'name':{'type':Sequelize[_0xc6af('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0xc6af('0x2'),_0xc6af('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xc6af('0x1')]}}; \ No newline at end of file +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 diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 23f987d..e42522b 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 _0x40a4=['create','body','destroy','html-pdf','eml-format','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','count','offset','limit','json','apply','reject','save','then','end','stack','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','includeAll','CloudProvider','findAll','rows','catch','show','params','rawAttributes','include','options','find'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x40a4,0x148));var _0x440a=function(_0x5a73bb,_0x3c362b){_0x5a73bb=_0x5a73bb-0x0;var _0x3fc212=_0x40a4[_0x5a73bb];return _0x3fc212;};'use strict';var pdf=require(_0x440a('0x0'));var emlformat=require(_0x440a('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x440a('0x2'));var Mustache=require('mustache');var util=require(_0x440a('0x3'));var path=require(_0x440a('0x4'));var sox=require(_0x440a('0x5'));var csv=require(_0x440a('0x6'));var ejs=require(_0x440a('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x440a('0x8'));var crypto=require(_0x440a('0x9'));var jsforce=require(_0x440a('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x440a('0x6'));var querystring=require(_0x440a('0xb'));var Papa=require('papaparse');var Redis=require(_0x440a('0xc'));var authService=require(_0x440a('0xd'));var qs=require(_0x440a('0xe'));var as=require(_0x440a('0xf'));var hardwareService=require(_0x440a('0x10'));var logger=require(_0x440a('0x11'))(_0x440a('0x12'));var utils=require(_0x440a('0x13'));var config=require('../../config/environment');var db=require(_0x440a('0x14'))['db'];function respondWithStatusCode(_0x72fa89,_0x3adb19){_0x3adb19=_0x3adb19||0xcc;return function(_0x917b06){if(_0x917b06){return _0x72fa89[_0x440a('0x15')](_0x3adb19);}return _0x72fa89[_0x440a('0x16')](_0x3adb19)['end']();};}function respondWithResult(_0xf99830,_0x1f8d4e){_0x1f8d4e=_0x1f8d4e||0xc8;return function(_0x10b149){if(_0x10b149){return _0xf99830[_0x440a('0x16')](_0x1f8d4e)['json'](_0x10b149);}};}function respondWithFilteredResult(_0x536252,_0x18e535){return function(_0x2d969a){if(_0x2d969a){var _0x5a63da=_0x2d969a[_0x440a('0x17')],_0x2b32a1=_0x18e535[_0x440a('0x18')],_0x4a92be=_0x18e535[_0x440a('0x18')]+_0x18e535[_0x440a('0x19')],_0x3e8d8b;if(_0x4a92be>=_0x5a63da){_0x4a92be=_0x5a63da;_0x3e8d8b=0xc8;}else{_0x3e8d8b=0xce;}_0x536252[_0x440a('0x16')](_0x3e8d8b);return _0x536252['set']('Content-Range',_0x2b32a1+'-'+_0x4a92be+'/'+_0x5a63da)[_0x440a('0x1a')](_0x2d969a);}return null;};}function patchUpdates(_0x4351d8){return function(_0x439aeb){try{jsonpatch[_0x440a('0x1b')](_0x439aeb,_0x4351d8,!![]);}catch(_0xa2a1b4){return BPromise[_0x440a('0x1c')](_0xa2a1b4);}return _0x439aeb[_0x440a('0x1d')]();};}function saveUpdates(_0x3c8076,_0x9576e7){return function(_0x416e4b){if(_0x416e4b){return _0x416e4b['update'](_0x3c8076)[_0x440a('0x1e')](function(_0x348c4e){return _0x348c4e;});}return null;};}function removeEntity(_0x4438df,_0x196deb){return function(_0x2fde8e){if(_0x2fde8e){return _0x2fde8e['destroy']()[_0x440a('0x1e')](function(){_0x4438df[_0x440a('0x16')](0xcc)[_0x440a('0x1f')]();});}};}function handleEntityNotFound(_0x543385,_0x48d50e){return function(_0x614996){if(!_0x614996){_0x543385[_0x440a('0x15')](0x194);}return _0x614996;};}function handleError(_0x1c6d3d,_0x28635b){_0x28635b=_0x28635b||0x1f4;return function(_0x120585){logger['error'](_0x120585[_0x440a('0x20')]);if(_0x120585['name']){delete _0x120585['name'];}_0x1c6d3d[_0x440a('0x16')](_0x28635b)['send'](_0x120585);};}exports['index']=function(_0x1a4477,_0x4f9682){var _0x58c320={},_0x5a4caa={},_0x423c5b={'count':0x0,'rows':[]};var _0x51e8e5=_['map'](db['CloudProvider']['rawAttributes'],function(_0x33e65d){return{'name':_0x33e65d[_0x440a('0x21')],'type':_0x33e65d[_0x440a('0x22')][_0x440a('0x23')]};});_0x5a4caa[_0x440a('0x24')]=_[_0x440a('0x25')](_0x51e8e5,'name');_0x5a4caa['query']=_[_0x440a('0x26')](_0x1a4477['query']);_0x5a4caa[_0x440a('0x27')]=_[_0x440a('0x28')](_0x5a4caa[_0x440a('0x24')],_0x5a4caa[_0x440a('0x29')]);_0x58c320[_0x440a('0x2a')]=_[_0x440a('0x28')](_0x5a4caa['model'],qs[_0x440a('0x2b')](_0x1a4477[_0x440a('0x29')]['fields']));_0x58c320[_0x440a('0x2a')]=_0x58c320['attributes'][_0x440a('0x2c')]?_0x58c320[_0x440a('0x2a')]:_0x5a4caa[_0x440a('0x24')];if(!_0x1a4477['query']['hasOwnProperty']('nolimit')){_0x58c320['limit']=qs['limit'](_0x1a4477[_0x440a('0x29')]['limit']);_0x58c320[_0x440a('0x18')]=qs[_0x440a('0x18')](_0x1a4477[_0x440a('0x29')][_0x440a('0x18')]);}_0x58c320['order']=qs[_0x440a('0x2d')](_0x1a4477[_0x440a('0x29')][_0x440a('0x2d')]);_0x58c320[_0x440a('0x2e')]=qs[_0x440a('0x27')](_[_0x440a('0x2f')](_0x1a4477[_0x440a('0x29')],_0x5a4caa[_0x440a('0x27')]),_0x51e8e5);if(_0x1a4477[_0x440a('0x29')][_0x440a('0x30')]){_0x58c320['where']=_[_0x440a('0x31')](_0x58c320[_0x440a('0x2e')],{'$or':_['map'](_0x51e8e5,function(_0x4a6d1c){if(_0x4a6d1c['type']!==_0x440a('0x32')){var _0x188165={};_0x188165[_0x4a6d1c['name']]={'$like':'%'+_0x1a4477[_0x440a('0x29')]['filter']+'%'};return _0x188165;}})});}_0x58c320=_[_0x440a('0x31')]({},_0x58c320,_0x1a4477['options']);var _0x59ea28={'where':_0x58c320[_0x440a('0x2e')]};return db['CloudProvider'][_0x440a('0x17')](_0x59ea28)[_0x440a('0x1e')](function(_0x58b1ea){_0x423c5b[_0x440a('0x17')]=_0x58b1ea;if(_0x1a4477[_0x440a('0x29')][_0x440a('0x33')]){_0x58c320['include']=[{'all':!![]}];}return db[_0x440a('0x34')][_0x440a('0x35')](_0x58c320);})['then'](function(_0x1124fb){_0x423c5b[_0x440a('0x36')]=_0x1124fb;return _0x423c5b;})[_0x440a('0x1e')](respondWithFilteredResult(_0x4f9682,_0x58c320))[_0x440a('0x37')](handleError(_0x4f9682,null));};exports[_0x440a('0x38')]=function(_0x43266f,_0x13d3ba){var _0x272010={'raw':!![],'where':{'id':_0x43266f[_0x440a('0x39')]['id']}},_0x70ce7c={};_0x70ce7c[_0x440a('0x24')]=_[_0x440a('0x26')](db['CloudProvider'][_0x440a('0x3a')]);_0x70ce7c['query']=_[_0x440a('0x26')](_0x43266f[_0x440a('0x29')]);_0x70ce7c[_0x440a('0x27')]=_['intersection'](_0x70ce7c[_0x440a('0x24')],_0x70ce7c[_0x440a('0x29')]);_0x272010[_0x440a('0x2a')]=_[_0x440a('0x28')](_0x70ce7c[_0x440a('0x24')],qs[_0x440a('0x2b')](_0x43266f[_0x440a('0x29')][_0x440a('0x2b')]));_0x272010[_0x440a('0x2a')]=_0x272010[_0x440a('0x2a')]['length']?_0x272010['attributes']:_0x70ce7c['model'];if(_0x43266f[_0x440a('0x29')]['includeAll']){_0x272010[_0x440a('0x3b')]=[{'all':!![]}];}_0x272010=_[_0x440a('0x31')]({},_0x272010,_0x43266f[_0x440a('0x3c')]);return db[_0x440a('0x34')][_0x440a('0x3d')](_0x272010)[_0x440a('0x1e')](handleEntityNotFound(_0x13d3ba,null))['then'](respondWithResult(_0x13d3ba,null))[_0x440a('0x37')](handleError(_0x13d3ba,null));};exports[_0x440a('0x3e')]=function(_0x3b9c99,_0x48de3f){return db[_0x440a('0x34')][_0x440a('0x3e')](_0x3b9c99['body'],{})[_0x440a('0x1e')](respondWithResult(_0x48de3f,0xc9))['catch'](handleError(_0x48de3f,null));};exports['update']=function(_0x126d4c,_0x1cff48){if(_0x126d4c[_0x440a('0x3f')]['id']){delete _0x126d4c['body']['id'];}return db[_0x440a('0x34')][_0x440a('0x3d')]({'where':{'id':_0x126d4c[_0x440a('0x39')]['id']}})[_0x440a('0x1e')](handleEntityNotFound(_0x1cff48,null))[_0x440a('0x1e')](saveUpdates(_0x126d4c[_0x440a('0x3f')],null))[_0x440a('0x1e')](respondWithResult(_0x1cff48,null))[_0x440a('0x37')](handleError(_0x1cff48,null));};exports[_0x440a('0x40')]=function(_0x189eac,_0x253838){return db[_0x440a('0x34')][_0x440a('0x3d')]({'where':{'id':_0x189eac[_0x440a('0x39')]['id']}})['then'](handleEntityNotFound(_0x253838,null))[_0x440a('0x1e')](removeEntity(_0x253838,null))[_0x440a('0x37')](handleError(_0x253838,null));}; \ No newline at end of file +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 diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 3eed926..747e19c 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 _0x03cc=['define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cloudProvider.attributes'];(function(_0x1126c7,_0x3dcf53){var _0x2a5e5f=function(_0x16d99c){while(--_0x16d99c){_0x1126c7['push'](_0x1126c7['shift']());}};_0x2a5e5f(++_0x3dcf53);}(_0x03cc,0x189));var _0xc03c=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x03cc[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0xc03c('0x0'));var util=require(_0xc03c('0x1'));var logger=require(_0xc03c('0x2'))(_0xc03c('0x3'));var moment=require(_0xc03c('0x4'));var BPromise=require(_0xc03c('0x5'));var rp=require(_0xc03c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc03c('0x7'));var config=require(_0xc03c('0x8'));var attributes=require(_0xc03c('0x9'));module['exports']=function(_0x386c05,_0x20f85e){return _0x386c05[_0xc03c('0xa')](_0xc03c('0xb'),attributes,{'tableName':_0xc03c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 8712116..9caeab4 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 _0x010e=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','debug','request\x20sent','stringify','error','code','message','CloudProvider,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x15718f,_0x5d9f0b){var _0x2c29d2=function(_0x2a3b4f){while(--_0x2a3b4f){_0x15718f['push'](_0x15718f['shift']());}};_0x2c29d2(++_0x5d9f0b);}(_0x010e,0x1c7));var _0xe010=function(_0x40c380,_0x4c8f79){_0x40c380=_0x40c380-0x0;var _0x453757=_0x010e[_0x40c380];return _0x453757;};'use strict';var _=require(_0xe010('0x0'));var util=require(_0xe010('0x1'));var moment=require('moment');var BPromise=require(_0xe010('0x2'));var rs=require(_0xe010('0x3'));var fs=require('fs');var Redis=require(_0xe010('0x4'));var db=require(_0xe010('0x5'))['db'];var utils=require(_0xe010('0x6'));var logger=require(_0xe010('0x7'))(_0xe010('0x8'));var config=require(_0xe010('0x9'));var jayson=require(_0xe010('0xa'));var client=jayson[_0xe010('0xb')][_0xe010('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c4836,_0x443866,_0x42fa37){return new BPromise(function(_0x1cb26f,_0x36df49){return client['request'](_0x5c4836,_0x42fa37)['then'](function(_0x612ea0){logger[_0xe010('0xd')]('CloudProvider,\x20%s,\x20%s',_0x443866,'request\x20sent');logger[_0xe010('0xe')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x443866,_0xe010('0xf'),JSON[_0xe010('0x10')](_0x612ea0));if(_0x612ea0[_0xe010('0x11')]){if(_0x612ea0[_0xe010('0x11')][_0xe010('0x12')]===0x1f4){logger['error']('CloudProvider,\x20%s,\x20%s',_0x443866,_0x612ea0[_0xe010('0x11')]['message']);return _0x36df49(_0x612ea0[_0xe010('0x11')]['message']);}logger[_0xe010('0x11')]('CloudProvider,\x20%s,\x20%s',_0x443866,_0x612ea0['error'][_0xe010('0x13')]);return _0x1cb26f(_0x612ea0['error']['message']);}else{logger[_0xe010('0xd')](_0xe010('0x14'),_0x443866,_0xe010('0xf'));_0x1cb26f(_0x612ea0[_0xe010('0x15')][_0xe010('0x13')]);}})[_0xe010('0x16')](function(_0x3cd92b){logger[_0xe010('0x11')](_0xe010('0x14'),_0x443866,_0x3cd92b);_0x36df49(_0x3cd92b);});});} \ No newline at end of file +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 diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 2d73c9a..4db662b 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 _0xc4cd=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','./cloudProvider.controller','get','isAuthenticated','index','/:id','show','post','put','exports','multer','util'];(function(_0x17cdcc,_0x29d5de){var _0x38f5f6=function(_0x55f444){while(--_0x55f444){_0x17cdcc['push'](_0x17cdcc['shift']());}};_0x38f5f6(++_0x29d5de);}(_0xc4cd,0x184));var _0xdc4c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4cd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xdc4c('0x0'));var util=require(_0xdc4c('0x1'));var path=require('path');var timeout=require(_0xdc4c('0x2'));var express=require(_0xdc4c('0x3'));var router=express['Router']();var auth=require(_0xdc4c('0x4'));var interaction=require(_0xdc4c('0x5'));var config=require('../../config/environment');var controller=require(_0xdc4c('0x6'));router[_0xdc4c('0x7')]('/',auth[_0xdc4c('0x8')](),controller[_0xdc4c('0x9')]);router[_0xdc4c('0x7')](_0xdc4c('0xa'),auth[_0xdc4c('0x8')](),controller[_0xdc4c('0xb')]);router[_0xdc4c('0xc')]('/',auth[_0xdc4c('0x8')](),controller['create']);router[_0xdc4c('0xd')](_0xdc4c('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xdc4c('0xa'),auth[_0xdc4c('0x8')](),controller['destroy']);module[_0xdc4c('0xe')]=router; \ No newline at end of file +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 diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 6d54dc8..1619d34 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 _0xe4ed=['sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe4ed,0x1e6));var _0xde4e=function(_0x579fd5,_0xb1baf){_0x579fd5=_0x579fd5-0x0;var _0x3f6367=_0xe4ed[_0x579fd5];return _0x3f6367;};'use strict';var Sequelize=require(_0xde4e('0x0'));module[_0xde4e('0x1')]={'name':{'type':Sequelize[_0xde4e('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xde4e('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xde4e('0x2')]},'phone':{'type':Sequelize[_0xde4e('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xde4e('0x2')]},'street':{'type':Sequelize[_0xde4e('0x2')]},'postalCode':{'type':Sequelize[_0xde4e('0x2')]},'city':{'type':Sequelize[_0xde4e('0x2')]},'country':{'type':Sequelize[_0xde4e('0x2')]},'email':{'type':Sequelize[_0xde4e('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xde4e('0x2')]},'sCity':{'type':Sequelize[_0xde4e('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xde4e('0x2')]}}; \ No newline at end of file +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 diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index db3189b..157766f 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 _0xfabd=['sort','where','filters','pick','filter','merge','map','include','rows','show','rawAttributes','includeAll','options','find','catch','create','body','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addContacts','CmContact','ids','omit','getContacts','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','index','CmCompany','describe','model','keys','query','intersection','attributes','fields','length','nolimit','limit','order'];(function(_0x3a6d3e,_0x4f0ac5){var _0x735896=function(_0x2eb1ed){while(--_0x2eb1ed){_0x3a6d3e['push'](_0x3a6d3e['shift']());}};_0x735896(++_0x4f0ac5);}(_0xfabd,0x1ce));var _0xdfab=function(_0x14dad3,_0x317509){_0x14dad3=_0x14dad3-0x0;var _0x505178=_0xfabd[_0x14dad3];return _0x505178;};'use strict';var pdf=require(_0xdfab('0x0'));var emlformat=require(_0xdfab('0x1'));var rimraf=require(_0xdfab('0x2'));var zipdir=require(_0xdfab('0x3'));var jsonpatch=require(_0xdfab('0x4'));var rp=require(_0xdfab('0x5'));var moment=require('moment');var BPromise=require(_0xdfab('0x6'));var Mustache=require(_0xdfab('0x7'));var util=require(_0xdfab('0x8'));var path=require('path');var sox=require(_0xdfab('0x9'));var csv=require('to-csv');var ejs=require(_0xdfab('0xa'));var fs=require('fs');var _=require(_0xdfab('0xb'));var squel=require(_0xdfab('0xc'));var crypto=require(_0xdfab('0xd'));var jsforce=require(_0xdfab('0xe'));var deskjs=require(_0xdfab('0xf'));var toCsv=require(_0xdfab('0x10'));var querystring=require(_0xdfab('0x11'));var Papa=require('papaparse');var Redis=require(_0xdfab('0x12'));var authService=require(_0xdfab('0x13'));var qs=require(_0xdfab('0x14'));var as=require(_0xdfab('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdfab('0x16'))(_0xdfab('0x17'));var utils=require(_0xdfab('0x18'));var config=require(_0xdfab('0x19'));var db=require(_0xdfab('0x1a'))['db'];function respondWithStatusCode(_0x559f35,_0x45884f){_0x45884f=_0x45884f||0xcc;return function(_0x411c21){if(_0x411c21){return _0x559f35[_0xdfab('0x1b')](_0x45884f);}return _0x559f35[_0xdfab('0x1c')](_0x45884f)[_0xdfab('0x1d')]();};}function respondWithResult(_0x28a3e7,_0x2ba275){_0x2ba275=_0x2ba275||0xc8;return function(_0x321711){if(_0x321711){return _0x28a3e7[_0xdfab('0x1c')](_0x2ba275)[_0xdfab('0x1e')](_0x321711);}};}function respondWithFilteredResult(_0x344331,_0xa150a2){return function(_0x4fae0b){if(_0x4fae0b){var _0x5f4bec=_0x4fae0b[_0xdfab('0x1f')],_0x4bf688=_0xa150a2[_0xdfab('0x20')],_0x5903b7=_0xa150a2[_0xdfab('0x20')]+_0xa150a2['limit'],_0x2426eb;if(_0x5903b7>=_0x5f4bec){_0x5903b7=_0x5f4bec;_0x2426eb=0xc8;}else{_0x2426eb=0xce;}_0x344331[_0xdfab('0x1c')](_0x2426eb);return _0x344331[_0xdfab('0x21')](_0xdfab('0x22'),_0x4bf688+'-'+_0x5903b7+'/'+_0x5f4bec)[_0xdfab('0x1e')](_0x4fae0b);}return null;};}function patchUpdates(_0x19cb7e){return function(_0x2d8e96){try{jsonpatch['apply'](_0x2d8e96,_0x19cb7e,!![]);}catch(_0x1c0a9c){return BPromise[_0xdfab('0x23')](_0x1c0a9c);}return _0x2d8e96[_0xdfab('0x24')]();};}function saveUpdates(_0x1f7f8c,_0x439671){return function(_0x537732){if(_0x537732){return _0x537732[_0xdfab('0x25')](_0x1f7f8c)[_0xdfab('0x26')](function(_0x6c6967){return _0x6c6967;});}return null;};}function removeEntity(_0x296492,_0x18c492){return function(_0x28fcc1){if(_0x28fcc1){return _0x28fcc1[_0xdfab('0x27')]()['then'](function(){var _0x3b5846=_0x28fcc1[_0xdfab('0x28')]({'plain':!![]});var _0x16b446=_0xdfab('0x29');return db[_0xdfab('0x2a')][_0xdfab('0x27')]({'where':{'type':_0x16b446,'resourceId':_0x3b5846['id']}})[_0xdfab('0x26')](function(){return _0x28fcc1;});})[_0xdfab('0x26')](function(){_0x296492['status'](0xcc)[_0xdfab('0x1d')]();});}};}function handleEntityNotFound(_0x14a1ca,_0x54572e){return function(_0x23f0f0){if(!_0x23f0f0){_0x14a1ca[_0xdfab('0x1b')](0x194);}return _0x23f0f0;};}function handleError(_0x639c64,_0x42b5f1){_0x42b5f1=_0x42b5f1||0x1f4;return function(_0x3873af){logger[_0xdfab('0x2b')](_0x3873af[_0xdfab('0x2c')]);if(_0x3873af[_0xdfab('0x2d')]){delete _0x3873af[_0xdfab('0x2d')];}_0x639c64['status'](_0x42b5f1)[_0xdfab('0x2e')](_0x3873af);};}exports[_0xdfab('0x2f')]=function(_0x370f51,_0x4d47fb){var _0x2bcee3={},_0x32a5d7={},_0x2ac8b9={'count':0x0,'rows':[]};return db[_0xdfab('0x30')][_0xdfab('0x31')]()['then'](function(_0x288330){_0x32a5d7[_0xdfab('0x32')]=_[_0xdfab('0x33')](_0x288330);_0x32a5d7[_0xdfab('0x34')]=_[_0xdfab('0x33')](_0x370f51[_0xdfab('0x34')]);_0x32a5d7['filters']=_[_0xdfab('0x35')](_0x32a5d7['model'],_0x32a5d7[_0xdfab('0x34')]);_0x2bcee3[_0xdfab('0x36')]=_[_0xdfab('0x35')](_0x32a5d7[_0xdfab('0x32')],qs[_0xdfab('0x37')](_0x370f51[_0xdfab('0x34')]['fields']));_0x2bcee3[_0xdfab('0x36')]=_0x2bcee3[_0xdfab('0x36')][_0xdfab('0x38')]?_0x2bcee3[_0xdfab('0x36')]:_0x32a5d7[_0xdfab('0x32')];if(!_0x370f51[_0xdfab('0x34')]['hasOwnProperty'](_0xdfab('0x39'))){_0x2bcee3[_0xdfab('0x3a')]=qs[_0xdfab('0x3a')](_0x370f51[_0xdfab('0x34')][_0xdfab('0x3a')]);_0x2bcee3[_0xdfab('0x20')]=qs['offset'](_0x370f51[_0xdfab('0x34')][_0xdfab('0x20')]);}_0x2bcee3[_0xdfab('0x3b')]=qs[_0xdfab('0x3c')](_0x370f51[_0xdfab('0x34')]['sort']);_0x2bcee3[_0xdfab('0x3d')]=qs[_0xdfab('0x3e')](_[_0xdfab('0x3f')](_0x370f51[_0xdfab('0x34')],_0x32a5d7[_0xdfab('0x3e')]));if(_0x370f51[_0xdfab('0x34')][_0xdfab('0x40')]){_0x2bcee3['where']=_[_0xdfab('0x41')](_0x2bcee3['where'],{'$or':_[_0xdfab('0x42')](_0x2bcee3['attributes'],function(_0x5cc24c){var _0x7543f0={};_0x7543f0[_0x5cc24c]={'$like':'%'+_0x370f51['query']['filter']+'%'};return _0x7543f0;})});}_0x2bcee3=_['merge']({},_0x2bcee3,_0x370f51['options']);var _0x201dd8={'where':_0x2bcee3[_0xdfab('0x3d')]};return db['CmCompany']['count'](_0x201dd8)['then'](function(_0x583d70){_0x2ac8b9[_0xdfab('0x1f')]=_0x583d70;if(_0x370f51[_0xdfab('0x34')]['includeAll']){_0x2bcee3[_0xdfab('0x43')]=[{'all':!![]}];}return db[_0xdfab('0x30')]['findAll'](_0x2bcee3);})['then'](function(_0x3f85d5){_0x2ac8b9[_0xdfab('0x44')]=_0x3f85d5;return _0x2ac8b9;})[_0xdfab('0x26')](respondWithFilteredResult(_0x4d47fb,_0x2bcee3))['catch'](handleError(_0x4d47fb,null));})['catch'](handleError(_0x4d47fb,null));};exports[_0xdfab('0x45')]=function(_0x2e1a51,_0x2aabc1){var _0xe9680f={'raw':![],'where':{'id':_0x2e1a51['params']['id']}},_0xfac2b8={};_0xfac2b8[_0xdfab('0x32')]=_[_0xdfab('0x33')](db[_0xdfab('0x30')][_0xdfab('0x46')]);_0xfac2b8['query']=_['keys'](_0x2e1a51['query']);_0xfac2b8[_0xdfab('0x3e')]=_['intersection'](_0xfac2b8[_0xdfab('0x32')],_0xfac2b8[_0xdfab('0x34')]);_0xe9680f['attributes']=_[_0xdfab('0x35')](_0xfac2b8[_0xdfab('0x32')],qs[_0xdfab('0x37')](_0x2e1a51[_0xdfab('0x34')][_0xdfab('0x37')]));_0xe9680f[_0xdfab('0x36')]=_0xe9680f[_0xdfab('0x36')][_0xdfab('0x38')]?_0xe9680f[_0xdfab('0x36')]:_0xfac2b8[_0xdfab('0x32')];if(_0x2e1a51[_0xdfab('0x34')][_0xdfab('0x47')]){_0xe9680f['include']=[{'all':!![]}];}_0xe9680f=_[_0xdfab('0x41')]({},_0xe9680f,_0x2e1a51[_0xdfab('0x48')]);return db[_0xdfab('0x30')][_0xdfab('0x49')](_0xe9680f)[_0xdfab('0x26')](handleEntityNotFound(_0x2aabc1,null))[_0xdfab('0x26')](respondWithResult(_0x2aabc1,null))[_0xdfab('0x4a')](handleError(_0x2aabc1,null));};exports['create']=function(_0x286640,_0x1f3473){return db[_0xdfab('0x30')][_0xdfab('0x4b')](_0x286640[_0xdfab('0x4c')],{})['then'](function(_0x9f9232){var _0xd55e=_0x286640['user'][_0xdfab('0x28')]({'plain':!![]});if(!_0xd55e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd55e['role']===_0xdfab('0x4d')){var _0xe0466c=_0x9f9232[_0xdfab('0x28')]({'plain':!![]});var _0x4d56df=_0xdfab('0x29');return db[_0xdfab('0x4e')][_0xdfab('0x49')]({'where':{'name':_0x4d56df,'userProfileId':_0xd55e['userProfileId']},'raw':!![]})['then'](function(_0x2e5aa8){if(_0x2e5aa8&&_0x2e5aa8[_0xdfab('0x4f')]===0x0){return db['UserProfileResource'][_0xdfab('0x4b')]({'name':_0xe0466c[_0xdfab('0x2d')],'resourceId':_0xe0466c['id'],'type':_0x2e5aa8['name'],'sectionId':_0x2e5aa8['id']},{})['then'](function(){return _0x9f9232;});}else{return _0x9f9232;}})['catch'](function(_0x40f521){logger[_0xdfab('0x2b')](_0xdfab('0x50'),_0x40f521);throw _0x40f521;});}return _0x9f9232;})['then'](respondWithResult(_0x1f3473,0xc9))[_0xdfab('0x4a')](handleError(_0x1f3473,null));};exports[_0xdfab('0x25')]=function(_0x28e334,_0x49a551){if(_0x28e334['body']['id']){delete _0x28e334[_0xdfab('0x4c')]['id'];}return db[_0xdfab('0x30')][_0xdfab('0x49')]({'where':{'id':_0x28e334[_0xdfab('0x51')]['id']}})['then'](handleEntityNotFound(_0x49a551,null))[_0xdfab('0x26')](saveUpdates(_0x28e334[_0xdfab('0x4c')],null))[_0xdfab('0x26')](respondWithResult(_0x49a551,null))['catch'](handleError(_0x49a551,null));};exports[_0xdfab('0x27')]=function(_0x265ac5,_0x1bf440){return db[_0xdfab('0x30')]['find']({'where':{'id':_0x265ac5[_0xdfab('0x51')]['id']}})['then'](handleEntityNotFound(_0x1bf440,null))['then'](removeEntity(_0x1bf440,null))[_0xdfab('0x4a')](handleError(_0x1bf440,null));};exports['describe']=function(_0x1b1785,_0x110bc0){return db[_0xdfab('0x30')][_0xdfab('0x31')]()[_0xdfab('0x26')](respondWithResult(_0x110bc0,null))[_0xdfab('0x4a')](handleError(_0x110bc0,null));};exports[_0xdfab('0x52')]=function(_0x4c8dbf,_0x502fad,_0x4e35f){return db[_0xdfab('0x53')][_0xdfab('0x49')]({'where':{'id':_0x4c8dbf[_0xdfab('0x51')]['id']}})[_0xdfab('0x26')](handleEntityNotFound(_0x502fad,null))[_0xdfab('0x26')](function(_0xe24f67){if(_0xe24f67){return _0xe24f67[_0xdfab('0x52')](_0x4c8dbf['body'][_0xdfab('0x54')],_[_0xdfab('0x55')](_0x4c8dbf[_0xdfab('0x4c')],[_0xdfab('0x54'),'id'])||{});}})[_0xdfab('0x26')](respondWithResult(_0x502fad,null))['catch'](handleError(_0x502fad,null));};exports['getContacts']=function(_0x155afe,_0x5b62a5,_0x27a2dc){var _0x39dea={};var _0x5c230f={};var _0x26b16d;var _0x2071ed;return db[_0xdfab('0x30')]['findOne']({'where':{'id':_0x155afe['params']['id']}})[_0xdfab('0x26')](handleEntityNotFound(_0x5b62a5,null))[_0xdfab('0x26')](function(_0x2f58b2){if(_0x2f58b2){_0x26b16d=_0x2f58b2;_0x5c230f[_0xdfab('0x32')]=_['keys'](db['CmContact'][_0xdfab('0x46')]);_0x5c230f['query']=_[_0xdfab('0x33')](_0x155afe[_0xdfab('0x34')]);_0x5c230f[_0xdfab('0x3e')]=_['intersection'](_0x5c230f[_0xdfab('0x32')],_0x5c230f[_0xdfab('0x34')]);_0x39dea[_0xdfab('0x36')]=_['intersection'](_0x5c230f[_0xdfab('0x32')],qs[_0xdfab('0x37')](_0x155afe[_0xdfab('0x34')][_0xdfab('0x37')]));_0x39dea[_0xdfab('0x36')]=_0x39dea[_0xdfab('0x36')][_0xdfab('0x38')]?_0x39dea[_0xdfab('0x36')]:_0x5c230f[_0xdfab('0x32')];_0x39dea[_0xdfab('0x3b')]=qs['sort'](_0x155afe[_0xdfab('0x34')]['sort']);_0x39dea['where']=qs[_0xdfab('0x3e')](_['pick'](_0x155afe[_0xdfab('0x34')],_0x5c230f[_0xdfab('0x3e')]));if(_0x155afe[_0xdfab('0x34')]['filter']){_0x39dea[_0xdfab('0x3d')]=_[_0xdfab('0x41')](_0x39dea[_0xdfab('0x3d')],{'$or':_[_0xdfab('0x42')](_0x39dea['attributes'],function(_0x262fb8){var _0x2236b7={};_0x2236b7[_0x262fb8]={'$like':'%'+_0x155afe[_0xdfab('0x34')][_0xdfab('0x40')]+'%'};return _0x2236b7;})});}_0x39dea=_['merge']({},_0x39dea,_0x155afe[_0xdfab('0x48')]);return _0x26b16d[_0xdfab('0x56')](_0x39dea);}})['then'](function(_0x2c77b2){if(_0x2c77b2){_0x2071ed=_0x2c77b2[_0xdfab('0x38')];if(!_0x155afe['query']['hasOwnProperty'](_0xdfab('0x39'))){_0x39dea['limit']=qs['limit'](_0x155afe['query'][_0xdfab('0x3a')]);_0x39dea[_0xdfab('0x20')]=qs[_0xdfab('0x20')](_0x155afe['query'][_0xdfab('0x20')]);}return _0x26b16d[_0xdfab('0x56')](_0x39dea);}})[_0xdfab('0x26')](function(_0x17d28c){if(_0x17d28c){return _0x17d28c?{'count':_0x2071ed,'rows':_0x17d28c}:null;}})[_0xdfab('0x26')](respondWithResult(_0x5b62a5,null))['catch'](handleError(_0x5b62a5,null));}; \ No newline at end of file +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 diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index a9163c5..7f028d8 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 _0xca9e=['CmCompany','cm_companies','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports'];(function(_0x69e19d,_0x25568c){var _0x4095e2=function(_0x56c2af){while(--_0x56c2af){_0x69e19d['push'](_0x69e19d['shift']());}};_0x4095e2(++_0x25568c);}(_0xca9e,0x136));var _0xeca9=function(_0x4f7d50,_0x32b2d1){_0x4f7d50=_0x4f7d50-0x0;var _0x26ec98=_0xca9e[_0x4f7d50];return _0x26ec98;};'use strict';var _=require(_0xeca9('0x0'));var util=require(_0xeca9('0x1'));var logger=require(_0xeca9('0x2'))(_0xeca9('0x3'));var moment=require(_0xeca9('0x4'));var BPromise=require(_0xeca9('0x5'));var rp=require(_0xeca9('0x6'));var fs=require('fs');var path=require(_0xeca9('0x7'));var rimraf=require(_0xeca9('0x8'));var config=require(_0xeca9('0x9'));var attributes=require(_0xeca9('0xa'));module[_0xeca9('0xb')]=function(_0x186a47,_0x305dc5){return _0x186a47['define'](_0xeca9('0xc'),attributes,{'tableName':_0xeca9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 6746f20..2c105dd 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 _0xe143=['lodash','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','request','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xe143,0x90));var _0x3e14=function(_0x48f050,_0x41da30){_0x48f050=_0x48f050-0x0;var _0x51f2f2=_0xe143[_0x48f050];return _0x51f2f2;};'use strict';var _=require(_0x3e14('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3e14('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3e14('0x2'));var db=require(_0x3e14('0x3'))['db'];var utils=require(_0x3e14('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x3e14('0x5'));var client=jayson['client'][_0x3e14('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4edaf7,_0x195176,_0x34d40e){return new BPromise(function(_0x552113,_0x131563){return client[_0x3e14('0x7')](_0x4edaf7,_0x34d40e)['then'](function(_0x4654fd){logger[_0x3e14('0x8')](_0x3e14('0x9'),_0x195176,_0x3e14('0xa'));logger[_0x3e14('0xb')](_0x3e14('0xc'),_0x195176,_0x3e14('0xa'),JSON['stringify'](_0x4654fd));if(_0x4654fd['error']){if(_0x4654fd[_0x3e14('0xd')][_0x3e14('0xe')]===0x1f4){logger[_0x3e14('0xd')](_0x3e14('0x9'),_0x195176,_0x4654fd[_0x3e14('0xd')][_0x3e14('0xf')]);return _0x131563(_0x4654fd['error'][_0x3e14('0xf')]);}logger[_0x3e14('0xd')](_0x3e14('0x9'),_0x195176,_0x4654fd[_0x3e14('0xd')]['message']);return _0x552113(_0x4654fd[_0x3e14('0xd')][_0x3e14('0xf')]);}else{logger['info'](_0x3e14('0x9'),_0x195176,_0x3e14('0xa'));_0x552113(_0x4654fd[_0x3e14('0x10')][_0x3e14('0xf')]);}})[_0x3e14('0x11')](function(_0x2e83a0){logger[_0x3e14('0xd')](_0x3e14('0x9'),_0x195176,_0x2e83a0);_0x131563(_0x2e83a0);});});} \ No newline at end of file +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 diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 83fe4fe..adc5ee2 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 _0x4325=['util','connect-timeout','express','Router','../../config/environment','./cmCompany.controller','get','index','isAuthenticated','/:id','show','post','create','addContacts','put','update','delete','destroy','multer'];(function(_0x1e0e80,_0x1f5ffa){var _0x50bd41=function(_0xcc3e0c){while(--_0xcc3e0c){_0x1e0e80['push'](_0x1e0e80['shift']());}};_0x50bd41(++_0x1f5ffa);}(_0x4325,0x1da));var _0x5432=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4325[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var path=require('path');var timeout=require(_0x5432('0x2'));var express=require(_0x5432('0x3'));var router=express[_0x5432('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5432('0x5'));var controller=require(_0x5432('0x6'));router[_0x5432('0x7')]('/',auth['isAuthenticated'](),controller[_0x5432('0x8')]);router[_0x5432('0x7')]('/describe',auth[_0x5432('0x9')](),controller['describe']);router[_0x5432('0x7')](_0x5432('0xa'),auth[_0x5432('0x9')](),controller[_0x5432('0xb')]);router[_0x5432('0x7')]('/:id/contacts',auth[_0x5432('0x9')](),controller['getContacts']);router[_0x5432('0xc')]('/',auth[_0x5432('0x9')](),controller[_0x5432('0xd')]);router[_0x5432('0xc')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x5432('0xe')]);router[_0x5432('0xf')]('/:id',auth[_0x5432('0x9')](),controller[_0x5432('0x10')]);router[_0x5432('0x11')](_0x5432('0xa'),auth[_0x5432('0x9')](),controller[_0x5432('0x12')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 2c848f7..f3e88ac 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 _0x2ccc=['UNSIGNED','NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER'];(function(_0x4b18d0,_0xe59b44){var _0x4c2c4c=function(_0x4e56b1){while(--_0x4e56b1){_0x4b18d0['push'](_0x4b18d0['shift']());}};_0x4c2c4c(++_0xe59b44);}(_0x2ccc,0x1d2));var _0xc2cc=function(_0x9db2c5,_0x888b24){_0x9db2c5=_0x9db2c5-0x0;var _0x589271=_0x2ccc[_0x9db2c5];return _0x589271;};'use strict';var _=require(_0xc2cc('0x0'));var Sequelize=require(_0xc2cc('0x1'));module[_0xc2cc('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xc2cc('0x3')]},'street':{'type':Sequelize[_0xc2cc('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xc2cc('0x3')]},'country':{'type':Sequelize[_0xc2cc('0x3')]},'dateOfBirth':{'type':Sequelize[_0xc2cc('0x3')]},'description':{'type':Sequelize[_0xc2cc('0x4')]},'phone':{'type':Sequelize[_0xc2cc('0x3')]},'mobile':{'type':Sequelize[_0xc2cc('0x3')]},'fax':{'type':Sequelize[_0xc2cc('0x3')]},'email':{'type':Sequelize[_0xc2cc('0x3')]},'url':{'type':Sequelize[_0xc2cc('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xc2cc('0x3')]},'twitter':{'type':Sequelize[_0xc2cc('0x3')]},'skype':{'type':Sequelize[_0xc2cc('0x3')]},'teams':{'type':Sequelize[_0xc2cc('0x3')]},'viber':{'type':Sequelize[_0xc2cc('0x3')]},'line':{'type':Sequelize[_0xc2cc('0x3')]},'wechat':{'type':Sequelize[_0xc2cc('0x3')]},'telegram':{'type':Sequelize[_0xc2cc('0x3')]},'UserId':{'type':Sequelize[_0xc2cc('0x5')]},'priority':{'type':Sequelize[_0xc2cc('0x5')](0x2)[_0xc2cc('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xc2cc('0x7')]}}; \ No newline at end of file +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 diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 0f45b94..0bd3534 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 _0x9261=['isNil','Contact','isEmpty','ListId','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','isArray','tag','filter','replace','getFullTextValue','isNumeric','c.phone\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','SELECT','clone','DESC','having','t.id\x20IN\x20?','some','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','toString','sequelize','merge','fields','c.lastName','c.phone','c.email','c.ListId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','destroy','params','tags','startsWith','columnName','CmCustomField','findAll','displayName','custom','values','catch','body','get','mergeWith','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','info','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','create','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','bulkCreate','each','duplicates','$or','findOrCreate','spread','color','omit','format','$and','cf_%d','setFields','id\x20=\x20?','toParam','phone','getTags','rawAttributes','sort','nolimit','setTags','getHoppers','ContactId','options','count','includeAll','pick','getHopperFinals','include','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_values','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','server/files/tmp','filename','0777','child_process','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','file','path','parse','meta','import','agent','binding','No\x20firstName\x20column\x20specified','fork','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','html-pdf','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/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./cmContact.socket','status','offset','json','save','update','then','end','sendStatus','error','stack','name','send','index','CmContact','describe','length','keys','cf_','push','findOne','trimStart','all','type','model','query','filters','intersection','attributes','hasOwnProperty','limit','order','where','select','field','from','tools_tags','cm_contacts','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','ct.CmContactId\x20=\x20c.id','left_join','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','find','Tag','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','and','uc.UserId\x20=\x20?','dateOfBirth','datetime','castTo','DATE','buildExpression','text'];(function(_0x2e7f0c,_0x14cd3d){var _0x5e579d=function(_0x28f73c){while(--_0x28f73c){_0x2e7f0c['push'](_0x2e7f0c['shift']());}};_0x5e579d(++_0x14cd3d);}(_0x9261,0x90));var _0x1926=function(_0x23c73d,_0x357b21){_0x23c73d=_0x23c73d-0x0;var _0x36ba47=_0x9261[_0x23c73d];return _0x36ba47;};'use strict';var pdf=require(_0x1926('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1926('0x1'));var jsonpatch=require(_0x1926('0x2'));var rp=require(_0x1926('0x3'));var moment=require(_0x1926('0x4'));var BPromise=require(_0x1926('0x5'));var Mustache=require('mustache');var util=require(_0x1926('0x6'));var path=require('path');var sox=require(_0x1926('0x7'));var csv=require(_0x1926('0x8'));var ejs=require(_0x1926('0x9'));var fs=require('fs');var _=require(_0x1926('0xa'));var squel=require(_0x1926('0xb'));var crypto=require(_0x1926('0xc'));var jsforce=require(_0x1926('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1926('0xe'));var Papa=require(_0x1926('0xf'));var Redis=require(_0x1926('0x10'));var authService=require(_0x1926('0x11'));var qs=require(_0x1926('0x12'));var as=require(_0x1926('0x13'));var hardwareService=require(_0x1926('0x14'));var logger=require('../../config/logger')(_0x1926('0x15'));var utils=require(_0x1926('0x16'));var config=require(_0x1926('0x17'));var db=require(_0x1926('0x18'))['db'];config['redis']=_[_0x1926('0x19')](config[_0x1926('0x1a')],{'host':_0x1926('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1926('0x1a')]));require(_0x1926('0x1c'))['register'](socket);function respondWithStatusCode(_0x7a587a,_0x34aa86){_0x34aa86=_0x34aa86||0xcc;return function(_0x113f61){if(_0x113f61){return _0x7a587a['sendStatus'](_0x34aa86);}return _0x7a587a[_0x1926('0x1d')](_0x34aa86)['end']();};}function respondWithResult(_0x1cf309,_0x29b38c){_0x29b38c=_0x29b38c||0xc8;return function(_0x443186){if(_0x443186){return _0x1cf309[_0x1926('0x1d')](_0x29b38c)['json'](_0x443186);}};}function respondWithFilteredResult(_0x34b942,_0x1b7ece){return function(_0x415794){if(_0x415794){var _0x22e753=_0x415794['count'],_0x302706=_0x1b7ece[_0x1926('0x1e')],_0x2ad434=_0x1b7ece[_0x1926('0x1e')]+_0x1b7ece['limit'],_0x6ec055;if(_0x2ad434>=_0x22e753){_0x2ad434=_0x22e753;_0x6ec055=0xc8;}else{_0x6ec055=0xce;}_0x34b942['status'](_0x6ec055);return _0x34b942['set']('Content-Range',_0x302706+'-'+_0x2ad434+'/'+_0x22e753)[_0x1926('0x1f')](_0x415794);}return null;};}function patchUpdates(_0x304e6f){return function(_0x3cc487){try{jsonpatch['apply'](_0x3cc487,_0x304e6f,!![]);}catch(_0x51f641){return BPromise['reject'](_0x51f641);}return _0x3cc487[_0x1926('0x20')]();};}function saveUpdates(_0x45d587,_0x2d214d){return function(_0xb20944){if(_0xb20944){return _0xb20944[_0x1926('0x21')](_0x45d587)[_0x1926('0x22')](function(_0x3a94cf){return _0x3a94cf;});}return null;};}function removeEntity(_0x598172,_0xb0d5f6){return function(_0x4b6355){if(_0x4b6355){return _0x4b6355['destroy']()[_0x1926('0x22')](function(){_0x598172['status'](0xcc)[_0x1926('0x23')]();});}};}function handleEntityNotFound(_0x183860,_0x3101b0){return function(_0x136709){if(!_0x136709){_0x183860[_0x1926('0x24')](0x194);}return _0x136709;};}function handleError(_0x25cc80,_0x2fb107){_0x2fb107=_0x2fb107||0x1f4;return function(_0x190718){logger[_0x1926('0x25')](_0x190718[_0x1926('0x26')]);if(_0x190718[_0x1926('0x27')]){delete _0x190718[_0x1926('0x27')];}_0x25cc80['status'](_0x2fb107)[_0x1926('0x28')](_0x190718);};}exports[_0x1926('0x29')]=function(_0x2709ba,_0x35592a){var _0x1116ba={},_0x40cfff={},_0x9e42a2={'count':0x0,'rows':[]};return db[_0x1926('0x2a')][_0x1926('0x2b')]()['then'](function(_0x4035e3){var _0x4d29fa=[];for(var _0x53dbbb=0x0;_0x53dbbb0x1){_0x2f1285['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x1926('0x68')](_0x50ac5e),null);}else{if(qs[_0x1926('0x69')](_0x50ac5e)){_0x2f1285['or']('c.id\x20LIKE\x20?',_0x50ac5e+'%');_0x2f1285['or'](_0x1926('0x6a'),_0x50ac5e+'%');_0x2f1285['or']('c.mobile\x20LIKE\x20?',_0x50ac5e+'%');_0x2f1285['or'](_0x1926('0x6b'),_0x50ac5e+'%');}else if(qs['isEmail'](_0x50ac5e)){_0x2f1285['or'](_0x1926('0x6c'),_0x50ac5e+'%');}else{_0x2f1285['or'](_0x1926('0x6d'),'%'+_0x50ac5e+'%');_0x2f1285['or']('c.lastName\x20LIKE\x20?','%'+_0x50ac5e+'%');_0x2f1285['or'](_0x1926('0x6c'),'%'+_0x50ac5e+'%');}}}}_0x168926[_0x1926('0x3c')](_0x2f1285);_0x168926[_0x1926('0x6e')](_0x1926('0x6f'));var _0x2b242e={'type':db[_0x1926('0x70')][_0x1926('0x71')][_0x1926('0x72')],'raw':!![]};var _0x446065=_0x168926[_0x1926('0x73')]()[_0x1926('0x3e')]('c.id');if(_0x1116ba[_0x1926('0x3b')]){_0x1116ba[_0x1926('0x3b')][_0x1926('0x52')](function(_0x2a0b12){_0x168926['order']('c.'+_0x2a0b12[0x0],_0x2a0b12[0x1]===_0x1926('0x74')?![]:!![]);});}if(!_['isEmpty'](_0x2e00c6)){_0x168926[_0x1926('0x75')](_0x341c0e);_0x446065[_0x1926('0x3c')](_0x1926('0x76'),_0x2e00c6);}BPromise['resolve']()[_0x1926('0x22')](function(){if(_0x2e2715&&!_[_0x1926('0x77')](_0x2e2715['conditions'],['field',_0x1926('0x54')])){return _0x2709ba['user'][_0x1926('0x78')]({'attributes':['id'],'raw':!![]})[_0x1926('0x22')](function(_0x582f62){if(_[_0x1926('0x5f')](_0x582f62)){_0x446065[_0x1926('0x3c')](_0x1926('0x79'));_0x168926['where'](_0x1926('0x79'));}else{_0x446065[_0x1926('0x3c')](_0x1926('0x7a'),_[_0x1926('0x51')](_0x582f62,'id'));_0x168926['where'](_0x1926('0x7a'),_['map'](_0x582f62,'id'));}});}else{return;}})[_0x1926('0x22')](function(){db['sequelize'][_0x1926('0x35')](_0x446065[_0x1926('0x7b')](),_0x2b242e)[_0x1926('0x22')](function(_0x48959d){_0x9e42a2['count']=_0x48959d['length'];if(_0x9e42a2['count']===0x0)return[];return db[_0x1926('0x7c')][_0x1926('0x35')](_0x15ff21[_0x1926('0x7b')](),_0x2b242e);})[_0x1926('0x22')](function(_0x4ce5f4){_0x181e79=_['keyBy'](_0x4ce5f4,'id');_0x2b242e=_[_0x1926('0x7d')](_0x2b242e,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2709ba[_0x1926('0x35')][_0x1926('0x7e')]){_0x1116ba[_0x1926('0x38')][_0x1926('0x52')](function(_0x18c08b){_0x168926['field']('c.'+_0x18c08b);});}else{_0x168926[_0x1926('0x3e')]('c.id');_0x168926['field']('c.firstName');_0x168926[_0x1926('0x3e')](_0x1926('0x7f'));_0x168926[_0x1926('0x3e')](_0x1926('0x80'));_0x168926[_0x1926('0x3e')]('c.mobile');_0x168926[_0x1926('0x3e')]('c.fax');_0x168926[_0x1926('0x3e')](_0x1926('0x81'));_0x168926[_0x1926('0x3e')](_0x1926('0x82'));_0x168926['field']('c.deletedAt');_0x168926[_0x1926('0x3e')](_0x1926('0x83'),'TagIds');}if(_0x1116ba[_0x1926('0x3a')])_0x168926[_0x1926('0x3a')](_0x1116ba[_0x1926('0x3a')]);if(_0x1116ba[_0x1926('0x1e')])_0x168926[_0x1926('0x1e')](_0x1116ba[_0x1926('0x1e')]);return db[_0x1926('0x7c')][_0x1926('0x35')](_0x168926[_0x1926('0x7b')](),_0x2b242e);})[_0x1926('0x22')](function(_0x3c898a){_0x3c898a['forEach'](function(_0x2fea5b){if(_0x2fea5b[_0x1926('0x84')]){_0x2fea5b[_0x1926('0x85')]=[];_0x2fea5b[_0x1926('0x84')][_0x1926('0x50')](',')[_0x1926('0x52')](function(_0x24cadd){_0x2fea5b[_0x1926('0x85')][_0x1926('0x2f')](_0x181e79[_0x24cadd]);});}delete _0x2fea5b[_0x1926('0x84')];});_0x9e42a2[_0x1926('0x86')]=_0x3c898a;return _0x9e42a2;})[_0x1926('0x22')](respondWithFilteredResult(_0x35592a,_0x1116ba));});})['catch'](handleError(_0x35592a,null));};exports[_0x1926('0x87')]=function(_0xcd099b,_0x3e29dd){return db[_0x1926('0x2a')]['find']({'where':{'id':_0xcd099b[_0x1926('0x88')]['id']}})['then'](handleEntityNotFound(_0x3e29dd,null))[_0x1926('0x22')](removeEntity(_0x3e29dd,null))['catch'](handleError(_0x3e29dd,null));};exports[_0x1926('0x2b')]=function(_0x47c738,_0x5a87a5){return db[_0x1926('0x2a')][_0x1926('0x2b')]()[_0x1926('0x22')](function(_0x25479a){delete _0x25479a[_0x1926('0x89')];for(var _0x456762=0x0;_0x456762=_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{}\s\\|]/g,'-');_0x3776ac(null,util[_0xa55c('0x1e')]('%s-%s%s',path[_0xa55c('0x1f')](_0xd643cc[_0xa55c('0x1c')],path[_0xa55c('0x20')](_0xd643cc[_0xa55c('0x1c')])),Date[_0xa55c('0x21')](),path['extname'](_0xd643cc[_0xa55c('0x1c')])));}})});router['post']('/csv',upload['single'](_0xa55c('0x22')),controller['uploadCsv']);var upload=multer({'storage':multer[_0xa55c('0x19')]({'destination':function(_0x190757,_0x3f64de,_0xf0e574){_0xf0e574(null,path[_0xa55c('0x1a')](config[_0xa55c('0x1b')],_0xa55c('0x23')));},'filename':function(_0x11e7f7,_0x192df2,_0x3cd152){_0x192df2[_0xa55c('0x1c')]=_0x192df2['originalname'][_0xa55c('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3cd152(null,util[_0xa55c('0x1e')](_0xa55c('0x24'),path[_0xa55c('0x1f')](_0x192df2['originalname'],path[_0xa55c('0x20')](_0x192df2[_0xa55c('0x1c')])),Date[_0xa55c('0x21')](),path[_0xa55c('0x20')](_0x192df2[_0xa55c('0x1c')])));}})});router[_0xa55c('0x12')]('/upload',upload[_0xa55c('0x25')]('file'),controller[_0xa55c('0x26')]);router[_0xa55c('0x12')](_0xa55c('0x27'),auth[_0xa55c('0x7')](),controller['import']);router[_0xa55c('0x28')](_0xa55c('0x29'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x2a')]);router[_0xa55c('0x2b')](_0xa55c('0x29'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x2c')]);module[_0xa55c('0x2d')]=router; \ No newline at end of file +var _0x3e74=['/:id/hopper_finals','/:id/jscripty_sessions','getJscriptySessions','merge','post','/create_many','bulkCreate','setTags','diskStorage','join','root','server/files/tmp','originalname','replace','%s-%s%s','basename','extname','now','single','file','format','/upload','upload','/upload/:id','import','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','./cmContact.controller','get','isAuthenticated','index','describe','/:id','getTags','/:id/hopper_histories','getHopperHistories'];(function(_0x3f697c,_0x1c2afd){var _0x555efb=function(_0x262475){while(--_0x262475){_0x3f697c['push'](_0x3f697c['shift']());}};_0x555efb(++_0x1c2afd);}(_0x3e74,0x175));var _0x43e7=function(_0x3f45f8,_0x2623ba){_0x3f45f8=_0x3f45f8-0x0;var _0x4b03e5=_0x3e74[_0x3f45f8];return _0x4b03e5;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/describe',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0x6')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller['show']);router[_0x43e7('0x6')]('/:id/tags',auth['isAuthenticated'](),controller[_0x43e7('0xb')]);router[_0x43e7('0x6')]('/:id/hoppers',auth[_0x43e7('0x7')](),controller['getHoppers']);router[_0x43e7('0x6')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router[_0x43e7('0x6')](_0x43e7('0xe'),auth[_0x43e7('0x7')](),controller['getHopperFinals']);router['get'](_0x43e7('0xf'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x10')]);router['post']('/merge',auth[_0x43e7('0x7')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x7')](),controller['create']);router['post'](_0x43e7('0x13'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x14')]);router['post']('/:id/tags',auth[_0x43e7('0x7')](),controller[_0x43e7('0x15')]);var upload=multer({'storage':multer[_0x43e7('0x16')]({'destination':function(_0x140657,_0x3776f5,_0x1f24fb){_0x1f24fb(null,path[_0x43e7('0x17')](config[_0x43e7('0x18')],_0x43e7('0x19')));},'filename':function(_0xab63cf,_0x191dd5,_0x177ee1){_0x191dd5['originalname']=_0x191dd5[_0x43e7('0x1a')][_0x43e7('0x1b')](/[+@&\/\\#,+()$~%'":*?<>{}\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 diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 28cdb18..9c94ee8 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 _0xcb2a=['setDataValue','alias','TEXT','long','type','select','parse','values','isArray','stringify','sequelize','getDataValue','STRING'];(function(_0x58459c,_0x1faa9d){var _0x153053=function(_0x291bb7){while(--_0x291bb7){_0x58459c['push'](_0x58459c['shift']());}};_0x153053(++_0x1faa9d);}(_0xcb2a,0xc0));var _0xacb2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcb2a[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xacb2('0x0'));var _=require('lodash');module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x30a478){return this[_0xacb2('0x1')]('alias');}},'alias':{'type':Sequelize[_0xacb2('0x2')],'allowNull':![],'set':function(_0x50aa19){this[_0xacb2('0x3')](_0xacb2('0x4'),_0x50aa19?_0x50aa19:this[_0xacb2('0x1')]('name'));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0xacb2('0x5')](_0xacb2('0x6')),'get':function(){if(this[_0xacb2('0x1')](_0xacb2('0x7'))===_0xacb2('0x8')){return JSON[_0xacb2('0x9')](this['getDataValue'](_0xacb2('0xa')));}else{return this[_0xacb2('0x1')](_0xacb2('0xa'));}},'set':function(_0x59678f){if(Array[_0xacb2('0xb')](_0x59678f)){this['setDataValue'](_0xacb2('0xa'),JSON[_0xacb2('0xc')](_0x59678f));}else{this[_0xacb2('0x3')](_0xacb2('0xa'),_0x59678f);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +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 diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 6198839..c7e24c1 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 _0x6d31=['bluebird','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','set','Content-Range','apply','save','update','destroy','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','CmCustomField','includeAll','include','findAll','rows','catch','show','intersection','find','body','params','sequelize','transaction','create','TEXT','text','number','Sequelize','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x5b0779,_0x40d92a){var _0x2d8671=function(_0x5cd62d){while(--_0x5cd62d){_0x5b0779['push'](_0x5b0779['shift']());}};_0x2d8671(++_0x40d92a);}(_0x6d31,0xfe));var _0x16d3=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x6d31[_0x9df060];return _0x338dfe;};'use strict';var pdf=require(_0x16d3('0x0'));var emlformat=require(_0x16d3('0x1'));var rimraf=require(_0x16d3('0x2'));var zipdir=require(_0x16d3('0x3'));var jsonpatch=require(_0x16d3('0x4'));var rp=require(_0x16d3('0x5'));var moment=require(_0x16d3('0x6'));var BPromise=require(_0x16d3('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x16d3('0x8'));var sox=require(_0x16d3('0x9'));var csv=require(_0x16d3('0xa'));var ejs=require(_0x16d3('0xb'));var fs=require('fs');var _=require(_0x16d3('0xc'));var squel=require('squel');var crypto=require(_0x16d3('0xd'));var jsforce=require(_0x16d3('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x16d3('0xf'));var Papa=require(_0x16d3('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x16d3('0x11'));var as=require(_0x16d3('0x12'));var hardwareService=require(_0x16d3('0x13'));var logger=require(_0x16d3('0x14'))('api');var utils=require(_0x16d3('0x15'));var config=require(_0x16d3('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36f0b4,_0x1dd844){_0x1dd844=_0x1dd844||0xcc;return function(_0x24c063){if(_0x24c063){return _0x36f0b4[_0x16d3('0x17')](_0x1dd844);}return _0x36f0b4[_0x16d3('0x18')](_0x1dd844)['end']();};}function respondWithResult(_0x2cc85a,_0x32f98e){_0x32f98e=_0x32f98e||0xc8;return function(_0x4ce54c){if(_0x4ce54c){return _0x2cc85a[_0x16d3('0x18')](_0x32f98e)[_0x16d3('0x19')](_0x4ce54c);}};}function respondWithFilteredResult(_0x184568,_0x58148c){return function(_0x18408c){if(_0x18408c){var _0x54b65a=_0x18408c[_0x16d3('0x1a')],_0x2e9ca5=_0x58148c[_0x16d3('0x1b')],_0x5fb1d0=_0x58148c[_0x16d3('0x1b')]+_0x58148c['limit'],_0x325c54;if(_0x5fb1d0>=_0x54b65a){_0x5fb1d0=_0x54b65a;_0x325c54=0xc8;}else{_0x325c54=0xce;}_0x184568[_0x16d3('0x18')](_0x325c54);return _0x184568[_0x16d3('0x1c')](_0x16d3('0x1d'),_0x2e9ca5+'-'+_0x5fb1d0+'/'+_0x54b65a)[_0x16d3('0x19')](_0x18408c);}return null;};}function patchUpdates(_0x3fdd80){return function(_0x16092d){try{jsonpatch[_0x16d3('0x1e')](_0x16092d,_0x3fdd80,!![]);}catch(_0x466310){return BPromise['reject'](_0x466310);}return _0x16092d[_0x16d3('0x1f')]();};}function saveUpdates(_0x540b43,_0x3ae6cf){return function(_0x5a5af2){if(_0x5a5af2){return _0x5a5af2[_0x16d3('0x20')](_0x540b43)['then'](function(_0x4d80b1){return _0x4d80b1;});}return null;};}function removeEntity(_0x5365d5,_0x43b0f4){return function(_0x77bd44){if(_0x77bd44){return _0x77bd44[_0x16d3('0x21')]()[_0x16d3('0x22')](function(){_0x5365d5[_0x16d3('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50d9ac,_0x3beb52){return function(_0x4a4a44){if(!_0x4a4a44){_0x50d9ac['sendStatus'](0x194);}return _0x4a4a44;};}function handleError(_0x2c9d0b,_0x4bec9e){_0x4bec9e=_0x4bec9e||0x1f4;return function(_0x3d1b99){logger[_0x16d3('0x23')](_0x3d1b99['stack']);if(_0x3d1b99[_0x16d3('0x24')]){delete _0x3d1b99[_0x16d3('0x24')];}_0x2c9d0b['status'](_0x4bec9e)[_0x16d3('0x25')](_0x3d1b99);};}exports[_0x16d3('0x26')]=function(_0x205381,_0x572594){var _0x46df70={},_0x19f96e={},_0xda72a1={'count':0x0,'rows':[]};var _0xe7833d=_[_0x16d3('0x27')](db['CmCustomField'][_0x16d3('0x28')],function(_0x2475d4){return{'name':_0x2475d4[_0x16d3('0x29')],'type':_0x2475d4[_0x16d3('0x2a')][_0x16d3('0x2b')]};});_0x19f96e[_0x16d3('0x2c')]=_[_0x16d3('0x2d')](_[_0x16d3('0x27')](_0xe7833d,_0x16d3('0x24')),[_0x16d3('0x24')]);_0x19f96e[_0x16d3('0x2e')]=_[_0x16d3('0x2f')](_0x205381[_0x16d3('0x2e')]);_0x19f96e[_0x16d3('0x30')]=_['intersection'](_0x19f96e[_0x16d3('0x2c')],_0x19f96e[_0x16d3('0x2e')]);_0x46df70[_0x16d3('0x31')]=_['intersection'](_0x19f96e[_0x16d3('0x2c')],qs[_0x16d3('0x32')](_0x205381[_0x16d3('0x2e')][_0x16d3('0x32')]));_0x46df70['attributes']=_0x46df70['attributes'][_0x16d3('0x33')]?_0x46df70[_0x16d3('0x31')]:_0x19f96e[_0x16d3('0x2c')];if(!_0x205381['query'][_0x16d3('0x34')](_0x16d3('0x35'))){_0x46df70[_0x16d3('0x36')]=qs[_0x16d3('0x36')](_0x205381['query'][_0x16d3('0x36')]);_0x46df70[_0x16d3('0x1b')]=qs[_0x16d3('0x1b')](_0x205381[_0x16d3('0x2e')]['offset']);}_0x46df70[_0x16d3('0x37')]=qs[_0x16d3('0x38')](_0x205381[_0x16d3('0x2e')][_0x16d3('0x38')]);_0x46df70['where']=qs[_0x16d3('0x30')](_['pick'](_0x205381['query'],_0x19f96e[_0x16d3('0x30')]));if(_0x205381['query'][_0x16d3('0x39')]){_0x46df70[_0x16d3('0x3a')]=_[_0x16d3('0x3b')](_0x46df70[_0x16d3('0x3a')],{'$or':_['map'](_0xe7833d,function(_0x423bb4){if(_0x423bb4[_0x16d3('0x2a')]!=='VIRTUAL'){var _0x12bf86={};_0x12bf86[_0x423bb4['name']]={'$like':'%'+_0x205381[_0x16d3('0x2e')][_0x16d3('0x39')]+'%'};return _0x12bf86;}})});}_0x46df70=_[_0x16d3('0x3b')]({},_0x46df70,_0x205381['options']);var _0x11d990={'where':_0x46df70[_0x16d3('0x3a')]};return db[_0x16d3('0x3c')][_0x16d3('0x1a')](_0x11d990)['then'](function(_0x4ecf79){_0xda72a1['count']=_0x4ecf79;if(_0x205381[_0x16d3('0x2e')][_0x16d3('0x3d')]){_0x46df70[_0x16d3('0x3e')]=[{'all':!![]}];}return db[_0x16d3('0x3c')][_0x16d3('0x3f')](_0x46df70);})[_0x16d3('0x22')](function(_0xd92635){_0xda72a1[_0x16d3('0x40')]=_0xd92635;return _0xda72a1;})['then'](respondWithFilteredResult(_0x572594,_0x46df70))[_0x16d3('0x41')](handleError(_0x572594,null));};exports[_0x16d3('0x42')]=function(_0x14f7ad,_0x5c8330){var _0x230cd4={'raw':!![],'where':{'id':_0x14f7ad['params']['id']}},_0x22d8fb={};_0x22d8fb[_0x16d3('0x2c')]=_[_0x16d3('0x2f')](db['CmCustomField'][_0x16d3('0x28')]);_0x22d8fb[_0x16d3('0x2e')]=_[_0x16d3('0x2f')](_0x14f7ad[_0x16d3('0x2e')]);_0x22d8fb[_0x16d3('0x30')]=_[_0x16d3('0x43')](_0x22d8fb[_0x16d3('0x2c')],_0x22d8fb[_0x16d3('0x2e')]);_0x230cd4[_0x16d3('0x31')]=_[_0x16d3('0x43')](_0x22d8fb['model'],qs['fields'](_0x14f7ad[_0x16d3('0x2e')][_0x16d3('0x32')]));_0x230cd4[_0x16d3('0x31')]=_0x230cd4[_0x16d3('0x31')]['length']?_0x230cd4[_0x16d3('0x31')]:_0x22d8fb['model'];if(_0x14f7ad[_0x16d3('0x2e')]['includeAll']){_0x230cd4[_0x16d3('0x3e')]=[{'all':!![]}];}_0x230cd4=_['merge']({},_0x230cd4,_0x14f7ad['options']);return db[_0x16d3('0x3c')][_0x16d3('0x44')](_0x230cd4)[_0x16d3('0x22')](handleEntityNotFound(_0x5c8330,null))[_0x16d3('0x22')](respondWithResult(_0x5c8330,null))[_0x16d3('0x41')](handleError(_0x5c8330,null));};exports[_0x16d3('0x20')]=function(_0x1437a0,_0x34f56e){if(_0x1437a0[_0x16d3('0x45')]['id']){delete _0x1437a0[_0x16d3('0x45')]['id'];}return db[_0x16d3('0x3c')][_0x16d3('0x44')]({'where':{'id':_0x1437a0['params']['id']}})[_0x16d3('0x22')](handleEntityNotFound(_0x34f56e,null))[_0x16d3('0x22')](saveUpdates(_0x1437a0[_0x16d3('0x45')],null))[_0x16d3('0x22')](respondWithResult(_0x34f56e,null))['catch'](handleError(_0x34f56e,null));};exports[_0x16d3('0x21')]=function(_0x15e3cb,_0x235fb7){return db[_0x16d3('0x3c')][_0x16d3('0x44')]({'where':{'id':_0x15e3cb[_0x16d3('0x46')]['id']}})[_0x16d3('0x22')](handleEntityNotFound(_0x235fb7,null))['then'](removeEntity(_0x235fb7,null))[_0x16d3('0x41')](handleError(_0x235fb7,null));};exports['create']=function(_0x15e1a0,_0x5e2783){var _0x295bd3;return db[_0x16d3('0x47')][_0x16d3('0x48')](function(_0x157a35){return db['CmCustomField'][_0x16d3('0x49')](_0x15e1a0[_0x16d3('0x45')],{'transaction':_0x157a35})[_0x16d3('0x22')](function(_0x6a2aac){_0x295bd3=_0x6a2aac;var _0x5cda5e={'type':db['Sequelize'][_0x16d3('0x4a')],'transaction':_0x157a35};switch(_0x15e1a0[_0x16d3('0x45')]['type']){case _0x16d3('0x4b'):_0x5cda5e[_0x16d3('0x2a')]=db['Sequelize'][_0x16d3('0x4a')];break;case _0x16d3('0x4c'):_0x5cda5e[_0x16d3('0x2a')]=db[_0x16d3('0x4d')][_0x16d3('0x4e')];break;case _0x16d3('0x4f'):_0x5cda5e['type']=db[_0x16d3('0x4d')][_0x16d3('0x50')];_0x5cda5e[_0x16d3('0x51')]=![];break;default:}return db['sequelize'][_0x16d3('0x52')][_0x16d3('0x53')](_0x16d3('0x54'),util[_0x16d3('0x55')](_0x16d3('0x56'),_0x295bd3['id']),_0x5cda5e);})['then'](function(){return _0x295bd3;});})['then'](respondWithResult(_0x5e2783,0xc9))[_0x16d3('0x41')](handleError(_0x5e2783,null));}; \ No newline at end of file +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 diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 9e8582b..76aacf6 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 _0x822f=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','CmCustomField','cm_custom_fields'];(function(_0x8be9fb,_0x2f90d9){var _0x3b41ac=function(_0x369a8f){while(--_0x369a8f){_0x8be9fb['push'](_0x8be9fb['shift']());}};_0x3b41ac(++_0x2f90d9);}(_0x822f,0x79));var _0xf822=function(_0x32d4b3,_0x833642){_0x32d4b3=_0x32d4b3-0x0;var _0x3f2ab2=_0x822f[_0x32d4b3];return _0x3f2ab2;};'use strict';var _=require(_0xf822('0x0'));var util=require('util');var logger=require(_0xf822('0x1'))('api');var moment=require(_0xf822('0x2'));var BPromise=require(_0xf822('0x3'));var rp=require(_0xf822('0x4'));var fs=require('fs');var path=require(_0xf822('0x5'));var rimraf=require(_0xf822('0x6'));var config=require(_0xf822('0x7'));var attributes=require(_0xf822('0x8'));module['exports']=function(_0x315deb,_0x2b32ef){return _0x315deb['define'](_0xf822('0x9'),attributes,{'tableName':_0xf822('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 5b6248c..b3b02e5 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 _0xb821=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','ioredis'];(function(_0x24f4f3,_0x41b6cc){var _0xb82a97=function(_0x35fbc1){while(--_0x35fbc1){_0x24f4f3['push'](_0x24f4f3['shift']());}};_0xb82a97(++_0x41b6cc);}(_0xb821,0xa7));var _0x1b82=function(_0x191dc7,_0x2ece2e){_0x191dc7=_0x191dc7-0x0;var _0x33896d=_0xb821[_0x191dc7];return _0x33896d;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var moment=require(_0x1b82('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b82('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1b82('0x3'))(_0x1b82('0x4'));var config=require(_0x1b82('0x5'));var jayson=require(_0x1b82('0x6'));var client=jayson['client'][_0x1b82('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x192434,_0x202a5f,_0x3632dd){return new BPromise(function(_0x18f45f,_0x7b87e8){return client[_0x1b82('0x8')](_0x192434,_0x3632dd)[_0x1b82('0x9')](function(_0x141673){logger['info'](_0x1b82('0xa'),_0x202a5f,_0x1b82('0xb'));logger[_0x1b82('0xc')](_0x1b82('0xd'),_0x202a5f,_0x1b82('0xb'),JSON[_0x1b82('0xe')](_0x141673));if(_0x141673[_0x1b82('0xf')]){if(_0x141673[_0x1b82('0xf')]['code']===0x1f4){logger[_0x1b82('0xf')](_0x1b82('0xa'),_0x202a5f,_0x141673[_0x1b82('0xf')][_0x1b82('0x10')]);return _0x7b87e8(_0x141673['error'][_0x1b82('0x10')]);}logger['error']('CmCustomField,\x20%s,\x20%s',_0x202a5f,_0x141673[_0x1b82('0xf')]['message']);return _0x18f45f(_0x141673[_0x1b82('0xf')][_0x1b82('0x10')]);}else{logger['info'](_0x1b82('0xa'),_0x202a5f,'request\x20sent');_0x18f45f(_0x141673['result'][_0x1b82('0x10')]);}})['catch'](function(_0x111247){logger[_0x1b82('0xf')](_0x1b82('0xa'),_0x202a5f,_0x111247);_0x7b87e8(_0x111247);});});} \ No newline at end of file +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 diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index a525ab6..60b1ac3 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 _0x0d35=['./cmCustomField.controller','get','index','/:id','show','post','isAuthenticated','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x48ea38,_0xb5b397){var _0xa6780=function(_0x1888ee){while(--_0x1888ee){_0x48ea38['push'](_0x48ea38['shift']());}};_0xa6780(++_0xb5b397);}(_0x0d35,0x8a));var _0x50d3=function(_0x110ab3,_0x2a6d2a){_0x110ab3=_0x110ab3-0x0;var _0x7c8dfc=_0x0d35[_0x110ab3];return _0x7c8dfc;};'use strict';var multer=require(_0x50d3('0x0'));var util=require(_0x50d3('0x1'));var path=require(_0x50d3('0x2'));var timeout=require(_0x50d3('0x3'));var express=require(_0x50d3('0x4'));var router=express[_0x50d3('0x5')]();var auth=require(_0x50d3('0x6'));var interaction=require(_0x50d3('0x7'));var config=require(_0x50d3('0x8'));var controller=require(_0x50d3('0x9'));router[_0x50d3('0xa')]('/',auth['isAuthenticated'](),controller[_0x50d3('0xb')]);router[_0x50d3('0xa')](_0x50d3('0xc'),auth['isAuthenticated'](),controller[_0x50d3('0xd')]);router[_0x50d3('0xe')]('/',auth[_0x50d3('0xf')](),controller[_0x50d3('0x10')]);router[_0x50d3('0x11')](_0x50d3('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x50d3('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x50d3('0x13')]);module[_0x50d3('0x14')]=router; \ No newline at end of file +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 diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index c248bdd..8513fca 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 _0x8d0e=['exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize'];(function(_0x300571,_0x282006){var _0x4af81e=function(_0x4314f4){while(--_0x4314f4){_0x300571['push'](_0x300571['shift']());}};_0x4af81e(++_0x282006);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x2723a2,_0x3345ee){_0x2723a2=_0x2723a2-0x0;var _0x4f99c1=_0x8d0e[_0x2723a2];return _0x4f99c1;};'use strict';var moment=require(_0xe8d0('0x0'));var Sequelize=require(_0xe8d0('0x1'));module[_0xe8d0('0x2')]={'phone':{'type':Sequelize[_0xe8d0('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xe8d0('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xe8d0('0x5')],'defaultValue':moment()[_0xe8d0('0x6')](_0xe8d0('0x7'))},'countbusyretry':{'type':Sequelize[_0xe8d0('0x8')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe8d0('0x8')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe8d0('0x5')]},'priority':{'type':Sequelize[_0xe8d0('0x8')](0x2)[_0xe8d0('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xe8d0('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xe8d0('0x8')],'unique':_0xe8d0('0xa')},'ListId':{'type':Sequelize[_0xe8d0('0x8')],'unique':_0xe8d0('0xa')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xe8d0('0x8')],'unique':_0xe8d0('0xa')},'CampaignId':{'type':Sequelize[_0xe8d0('0x8')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe8d0('0x8')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe8d0('0x8')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe8d0('0x8')],'defaultValue':0x0}}; \ No newline at end of file +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 diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 0666b0f..96bf1c9 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 _0xfd67=['$and','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','show','params','rawAttributes','intersection','includeAll','include','options','find','catch','create','update','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','calleridnum','phone','queue','ivr','CmContact','firstName','isNil','lastName','CmHopperFinal','getPreview','keys','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','format','YYYY-MM-DD\x20HH:mm:ss','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','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','Content-Range','apply','reject','save','then','destroy','send','CmHopper','fieldName','type','key','model','map','name','filters','query'];(function(_0x1efbe2,_0x22820c){var _0x58c164=function(_0x3b0187){while(--_0x3b0187){_0x1efbe2['push'](_0x1efbe2['shift']());}};_0x58c164(++_0x22820c);}(_0xfd67,0x6a));var _0x7fd6=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xfd67[_0x4b369d];return _0x571a98;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x7fd6('0x0'));var zipdir=require(_0x7fd6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7fd6('0x2'));var moment=require(_0x7fd6('0x3'));var BPromise=require(_0x7fd6('0x4'));var Mustache=require(_0x7fd6('0x5'));var util=require('util');var path=require(_0x7fd6('0x6'));var sox=require('sox');var csv=require(_0x7fd6('0x7'));var ejs=require(_0x7fd6('0x8'));var fs=require('fs');var _=require(_0x7fd6('0x9'));var squel=require(_0x7fd6('0xa'));var crypto=require(_0x7fd6('0xb'));var jsforce=require(_0x7fd6('0xc'));var deskjs=require(_0x7fd6('0xd'));var toCsv=require(_0x7fd6('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7fd6('0xe'));var qs=require(_0x7fd6('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7fd6('0x10'));var logger=require(_0x7fd6('0x11'))('api');var utils=require(_0x7fd6('0x12'));var config=require(_0x7fd6('0x13'));var db=require(_0x7fd6('0x14'))['db'];function respondWithStatusCode(_0x2de23b,_0x331010){_0x331010=_0x331010||0xcc;return function(_0x3d3f7a){if(_0x3d3f7a){return _0x2de23b[_0x7fd6('0x15')](_0x331010);}return _0x2de23b[_0x7fd6('0x16')](_0x331010)[_0x7fd6('0x17')]();};}function respondWithResult(_0x191fc9,_0x484b8b){_0x484b8b=_0x484b8b||0xc8;return function(_0x144730){if(_0x144730){return _0x191fc9[_0x7fd6('0x16')](_0x484b8b)[_0x7fd6('0x18')](_0x144730);}};}function respondWithFilteredResult(_0x85e0dd,_0x2411df){return function(_0x1366f9){if(_0x1366f9){var _0x4ebc7a=_0x1366f9[_0x7fd6('0x19')],_0x16d724=_0x2411df[_0x7fd6('0x1a')],_0x1be856=_0x2411df[_0x7fd6('0x1a')]+_0x2411df['limit'],_0x4bb0b7;if(_0x1be856>=_0x4ebc7a){_0x1be856=_0x4ebc7a;_0x4bb0b7=0xc8;}else{_0x4bb0b7=0xce;}_0x85e0dd[_0x7fd6('0x16')](_0x4bb0b7);return _0x85e0dd[_0x7fd6('0x1b')](_0x7fd6('0x1c'),_0x16d724+'-'+_0x1be856+'/'+_0x4ebc7a)[_0x7fd6('0x18')](_0x1366f9);}return null;};}function patchUpdates(_0x1be887){return function(_0x322e58){try{jsonpatch[_0x7fd6('0x1d')](_0x322e58,_0x1be887,!![]);}catch(_0x4ed49a){return BPromise[_0x7fd6('0x1e')](_0x4ed49a);}return _0x322e58[_0x7fd6('0x1f')]();};}function saveUpdates(_0x4a98bb,_0x3eb2e7){return function(_0x4678a9){if(_0x4678a9){return _0x4678a9['update'](_0x4a98bb)[_0x7fd6('0x20')](function(_0x28b135){return _0x28b135;});}return null;};}function removeEntity(_0x4a0884,_0x42f683){return function(_0x2cae13){if(_0x2cae13){return _0x2cae13[_0x7fd6('0x21')]()[_0x7fd6('0x20')](function(){_0x4a0884['status'](0xcc)[_0x7fd6('0x17')]();});}};}function handleEntityNotFound(_0x54261c,_0x59dd38){return function(_0x61ce16){if(!_0x61ce16){_0x54261c[_0x7fd6('0x15')](0x194);}return _0x61ce16;};}function handleError(_0x304f76,_0x4f987a){_0x4f987a=_0x4f987a||0x1f4;return function(_0x3c49bd){logger['error'](_0x3c49bd['stack']);if(_0x3c49bd['name']){delete _0x3c49bd['name'];}_0x304f76[_0x7fd6('0x16')](_0x4f987a)[_0x7fd6('0x22')](_0x3c49bd);};}exports['index']=function(_0x118132,_0x5e2e57){var _0x31f034={},_0x5d5f82={},_0x29988f={'count':0x0,'rows':[]};var _0x573ac3=_['map'](db[_0x7fd6('0x23')]['rawAttributes'],function(_0x11c0dc){return{'name':_0x11c0dc[_0x7fd6('0x24')],'type':_0x11c0dc[_0x7fd6('0x25')][_0x7fd6('0x26')]};});_0x5d5f82[_0x7fd6('0x27')]=_[_0x7fd6('0x28')](_0x573ac3,_0x7fd6('0x29'));_0x5d5f82['query']=_['keys'](_0x118132['query']);_0x5d5f82[_0x7fd6('0x2a')]=_['intersection'](_0x5d5f82[_0x7fd6('0x27')],_0x5d5f82[_0x7fd6('0x2b')]);_0x5d5f82['filters']=_['concat'](_0x5d5f82[_0x7fd6('0x2a')],[_0x7fd6('0x2c'),'$or',_0x7fd6('0x2d'),_0x7fd6('0x2e'),_0x7fd6('0x2f'),_0x7fd6('0x30'),_0x7fd6('0x31'),_0x7fd6('0x32'),_0x7fd6('0x33'),_0x7fd6('0x34'),_0x7fd6('0x35'),_0x7fd6('0x36'),_0x7fd6('0x37'),_0x7fd6('0x38'),_0x7fd6('0x39'),_0x7fd6('0x3a'),'$notILike',_0x7fd6('0x38'),_0x7fd6('0x3b'),_0x7fd6('0x3c'),_0x7fd6('0x3d'),_0x7fd6('0x3e')]);_0x31f034[_0x7fd6('0x3f')]=_['intersection'](_0x5d5f82[_0x7fd6('0x27')],qs[_0x7fd6('0x40')](_0x118132[_0x7fd6('0x2b')][_0x7fd6('0x40')]));_0x31f034[_0x7fd6('0x3f')]=_0x31f034[_0x7fd6('0x3f')][_0x7fd6('0x41')]?_0x31f034[_0x7fd6('0x3f')]:_0x5d5f82[_0x7fd6('0x27')];if(!_0x118132[_0x7fd6('0x2b')][_0x7fd6('0x42')](_0x7fd6('0x43'))){_0x31f034[_0x7fd6('0x44')]=qs['limit'](_0x118132[_0x7fd6('0x2b')]['limit']);_0x31f034[_0x7fd6('0x1a')]=qs[_0x7fd6('0x1a')](_0x118132[_0x7fd6('0x2b')][_0x7fd6('0x1a')]);}_0x31f034[_0x7fd6('0x45')]=qs[_0x7fd6('0x46')](_0x118132[_0x7fd6('0x2b')][_0x7fd6('0x46')]);_0x31f034[_0x7fd6('0x47')]=qs[_0x7fd6('0x2a')](_[_0x7fd6('0x48')](_0x118132[_0x7fd6('0x2b')],_0x5d5f82[_0x7fd6('0x2a')]));if(_0x118132['query'][_0x7fd6('0x49')]){_0x31f034[_0x7fd6('0x47')]=_[_0x7fd6('0x4a')](_0x31f034[_0x7fd6('0x47')],{'$or':_[_0x7fd6('0x28')](_0x573ac3,function(_0x5b96b0){if(_0x5b96b0[_0x7fd6('0x25')]!==_0x7fd6('0x4b')){var _0x2fd434={};_0x2fd434[_0x5b96b0[_0x7fd6('0x29')]]={'$like':'%'+_0x118132[_0x7fd6('0x2b')][_0x7fd6('0x49')]+'%'};return _0x2fd434;}})});}_0x31f034=_['merge']({},_0x31f034,_0x118132['options']);var _0x1f33f9={'where':_0x31f034[_0x7fd6('0x47')]};return db[_0x7fd6('0x23')][_0x7fd6('0x19')](_0x1f33f9)[_0x7fd6('0x20')](function(_0xef4fe3){_0x29988f['count']=_0xef4fe3;if(_0x118132['query']['includeAll']){_0x31f034['include']=[{'all':!![]}];}return db[_0x7fd6('0x23')][_0x7fd6('0x4c')](_0x31f034);})[_0x7fd6('0x20')](function(_0x227601){_0x29988f[_0x7fd6('0x4d')]=_0x227601;return _0x29988f;})[_0x7fd6('0x20')](respondWithFilteredResult(_0x5e2e57,_0x31f034))['catch'](handleError(_0x5e2e57,null));};exports[_0x7fd6('0x4e')]=function(_0x18dfc3,_0x3bf53e){var _0xef034d={'raw':!![],'where':{'id':_0x18dfc3[_0x7fd6('0x4f')]['id']}},_0x4701e8={};_0x4701e8[_0x7fd6('0x27')]=_['keys'](db[_0x7fd6('0x23')][_0x7fd6('0x50')]);_0x4701e8[_0x7fd6('0x2b')]=_['keys'](_0x18dfc3[_0x7fd6('0x2b')]);_0x4701e8[_0x7fd6('0x2a')]=_[_0x7fd6('0x51')](_0x4701e8['model'],_0x4701e8['query']);_0xef034d[_0x7fd6('0x3f')]=_[_0x7fd6('0x51')](_0x4701e8[_0x7fd6('0x27')],qs[_0x7fd6('0x40')](_0x18dfc3[_0x7fd6('0x2b')][_0x7fd6('0x40')]));_0xef034d[_0x7fd6('0x3f')]=_0xef034d[_0x7fd6('0x3f')][_0x7fd6('0x41')]?_0xef034d['attributes']:_0x4701e8['model'];if(_0x18dfc3[_0x7fd6('0x2b')][_0x7fd6('0x52')]){_0xef034d[_0x7fd6('0x53')]=[{'all':!![]}];}_0xef034d=_['merge']({},_0xef034d,_0x18dfc3[_0x7fd6('0x54')]);return db[_0x7fd6('0x23')][_0x7fd6('0x55')](_0xef034d)['then'](handleEntityNotFound(_0x3bf53e,null))[_0x7fd6('0x20')](respondWithResult(_0x3bf53e,null))[_0x7fd6('0x56')](handleError(_0x3bf53e,null));};exports['create']=function(_0x440515,_0x3527ee){return db[_0x7fd6('0x23')][_0x7fd6('0x57')](_0x440515['body'],{})['then'](respondWithResult(_0x3527ee,0xc9))['catch'](handleError(_0x3527ee,null));};exports[_0x7fd6('0x58')]=function(_0x2aba33,_0x1bbcd0){if(_0x2aba33[_0x7fd6('0x59')]['id']){delete _0x2aba33[_0x7fd6('0x59')]['id'];}return db[_0x7fd6('0x23')][_0x7fd6('0x55')]({'where':{'id':_0x2aba33[_0x7fd6('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1bbcd0,null))['then'](saveUpdates(_0x2aba33[_0x7fd6('0x59')],null))[_0x7fd6('0x20')](respondWithResult(_0x1bbcd0,null))['catch'](handleError(_0x1bbcd0,null));};exports[_0x7fd6('0x5a')]=function(_0x331354,_0x48bad6){return db[_0x7fd6('0x23')][_0x7fd6('0x5a')]()[_0x7fd6('0x20')](respondWithResult(_0x48bad6,null))[_0x7fd6('0x56')](handleError(_0x48bad6,null));};exports[_0x7fd6('0x21')]=function(_0x1ca788,_0x352074){var _0x226a12;return db[_0x7fd6('0x23')][_0x7fd6('0x55')]({'where':{'id':_0x1ca788[_0x7fd6('0x4f')]['id']}})['then'](handleEntityNotFound(_0x352074,null))[_0x7fd6('0x20')](function(_0x5a904a){if(_0x5a904a){return _0x5a904a[_0x7fd6('0x21')]()['then'](function(_0x4175df){return _0x4175df;});}})['then'](function(_0x3108bf){_0x226a12=_0x3108bf;if(_0x3108bf){if(_0x3108bf[_0x7fd6('0x5b')]||_0x3108bf[_0x7fd6('0x5c')]){return db[_0x3108bf['VoiceQueueId']?_0x7fd6('0x5d'):_0x7fd6('0x5e')][_0x7fd6('0x55')]({'where':{'id':_0x3108bf['VoiceQueueId']?_0x3108bf['VoiceQueueId']:_0x3108bf[_0x7fd6('0x5c')]},'attributes':['id',_0x7fd6('0x29')],'raw':!![]});}}})[_0x7fd6('0x20')](function(_0x2d3bd3){var _0x3987af={};if(_0x2d3bd3){_[_0x7fd6('0x4a')](_0x3987af,_[_0x7fd6('0x5f')](_0x226a12[_0x7fd6('0x60')],[_0x7fd6('0x61'),_0x7fd6('0x62'),'id']));_0x3987af[_0x7fd6('0x63')]=0x15;_0x3987af[_0x7fd6('0x64')]=_0x7fd6('0x65');_0x3987af[_0x7fd6('0x66')]=_0x2d3bd3[_0x7fd6('0x29')];_0x3987af[_0x7fd6('0x67')]=_0x1ca788[_0x7fd6('0x68')][_0x7fd6('0x29')];_0x3987af[_0x7fd6('0x69')]=_0x1ca788[_0x7fd6('0x68')]['id'];_0x3987af[_0x7fd6('0x65')]=!![];_0x3987af[_0x7fd6('0x6a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3987af[_0x7fd6('0x6b')]=_0x226a12[_0x7fd6('0x6c')];_0x3987af['campaigntype']=_0x226a12[_0x7fd6('0x5b')]?_0x7fd6('0x6d'):_0x7fd6('0x6e');return db[_0x7fd6('0x6f')][_0x7fd6('0x55')]({'where':{'id':_0x3987af['ContactId']},'attributes':[_0x7fd6('0x70'),'lastName']})[_0x7fd6('0x20')](function(_0x4a53e9){if(!_[_0x7fd6('0x71')](_0x352074)&&!_['isNil'](_0x4a53e9['firstName'])){_0x3987af['calleridname']=_0x4a53e9['firstName'];if(!_[_0x7fd6('0x71')](_0x4a53e9[_0x7fd6('0x72')])){_0x3987af['calleridname']+='\x20'+_0x4a53e9[_0x7fd6('0x72')];}}})['finally'](function(){return db[_0x7fd6('0x73')][_0x7fd6('0x57')](_0x3987af);});}})[_0x7fd6('0x20')](function(){return _0x352074[_0x7fd6('0x16')](0xcc)['end']();})[_0x7fd6('0x56')](handleError(_0x352074,null));};exports[_0x7fd6('0x74')]=function(_0x1ada41,_0x2f7fc3,_0x304386){var _0x33efb4=[];return db[_0x7fd6('0x6f')]['describe']()[_0x7fd6('0x20')](function(_0x137f95){_0x33efb4=_[_0x7fd6('0x75')](_0x137f95);return _0x1ada41[_0x7fd6('0x68')][_0x7fd6('0x76')]({'where':{'type':_0x7fd6('0x77'),'dialActive':!![],'dialMethod':_0x7fd6('0x78')},'attributes':['id',_0x7fd6('0x79')],'raw':!![]});})[_0x7fd6('0x20')](function(_0x4afb16){if(_0x4afb16&&_0x4afb16[_0x7fd6('0x41')]){return db[_0x7fd6('0x7a')][_0x7fd6('0x7b')](function(_0x2b7c03){var _0x4d74fd={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x7fd6('0x7c')](_0x7fd6('0x7d'))},'VoiceQueueId':{'$in':_[_0x7fd6('0x28')](_0x4afb16,'id')},'$or':[{'UserId':null},{'UserId':_0x1ada41['user']['id']}]};var _0x2a64bc=[];if(_0x1ada41[_0x7fd6('0x59')][_0x7fd6('0x7e')]&&_0x1ada41[_0x7fd6('0x59')][_0x7fd6('0x7e')]===_0x7fd6('0x7f')){if(!_[_0x7fd6('0x80')](_0x1ada41[_0x7fd6('0x59')][_0x7fd6('0x81')])){_0x4d74fd['id']={'$in':_0x1ada41[_0x7fd6('0x59')][_0x7fd6('0x81')]};}_0x2a64bc=[[_0x7fd6('0x82'),_0x7fd6('0x83')],['scheduledAt',_0x4afb16[0x0][_0x7fd6('0x79')]===_0x7fd6('0x83')?_0x7fd6('0x84'):_0x7fd6('0x83')],db['sequelize'][_0x7fd6('0x85')](_0x7fd6('0x86')),['id',_0x7fd6('0x84')]];}else{if(!_[_0x7fd6('0x80')](_0x1ada41['body'][_0x7fd6('0x81')])){_0x4d74fd['id']={'$notIn':_0x1ada41[_0x7fd6('0x59')][_0x7fd6('0x81')]};}_0x2a64bc=[[_0x7fd6('0x82'),_0x7fd6('0x84')],[_0x7fd6('0x87'),_0x4afb16[0x0][_0x7fd6('0x79')]],db['sequelize']['literal'](_0x7fd6('0x88')),['id','ASC']];}return db[_0x7fd6('0x23')][_0x7fd6('0x89')]({'attributes':['id','scheduledat'],'where':_0x4d74fd,'order':_0x2a64bc,'transaction':_0x2b7c03,'lock':_0x2b7c03['LOCK'][_0x7fd6('0x8a')],'include':[{'model':db['CmContact'],'as':_0x7fd6('0x8b'),'attributes':_0x33efb4,'include':[{'model':db[_0x7fd6('0x8c')],'as':_0x7fd6('0x8d'),'attributes':['id',_0x7fd6('0x29')]}]},{'model':db[_0x7fd6('0x8e')],'as':_0x7fd6('0x8f'),'attributes':['id','name']},{'model':db[_0x7fd6('0x5d')],'as':_0x7fd6('0x90'),'attributes':['id',_0x7fd6('0x29'),_0x7fd6('0x91')]}]})[_0x7fd6('0x20')](function(_0x493224){if(_0x493224){return _0x493224['update']({'UserId':_0x1ada41[_0x7fd6('0x68')]['id']},{'transaction':_0x2b7c03});}});});}})[_0x7fd6('0x20')](handleEntityNotFound(_0x2f7fc3,null))[_0x7fd6('0x20')](respondWithResult(_0x2f7fc3,null))[_0x7fd6('0x56')](handleError(_0x2f7fc3,null));};exports[_0x7fd6('0x92')]=function(_0x3ed000,_0x311978,_0x201f77){return _0x3ed000[_0x7fd6('0x68')][_0x7fd6('0x76')]({'where':{'type':_0x7fd6('0x77'),'dialActive':!![],'dialMethod':_0x7fd6('0x78')},'attributes':['id'],'raw':!![]})['then'](function(_0x53ccec){if(_0x53ccec&&_0x53ccec[_0x7fd6('0x41')]){return db['CmHopper'][_0x7fd6('0x19')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x7fd6('0x7c')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x7fd6('0x28')](_0x53ccec,'id')},'$or':[{'UserId':null},{'UserId':_0x3ed000[_0x7fd6('0x68')]['id']}]}});}return 0x0;})['then'](function(_0x4aaff9){if(!_[_0x7fd6('0x71')](_0x4aaff9)&&_[_0x7fd6('0x93')](_0x4aaff9)){return _0x311978[_0x7fd6('0x16')](0xc8)[_0x7fd6('0x18')]({'contacts':_0x4aaff9});}else{logger['error'](_0x7fd6('0x94'),_0x7fd6('0x92'),0x194,_0x7fd6('0x95'));_0x311978['sendStatus'](0x194);}})[_0x7fd6('0x56')](handleError(_0x311978,null));}; \ No newline at end of file +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 diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 8c44e08..2b13b1e 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 _0x5d7c=['scheduledat','priority','lodash','util','../../config/logger','api','bluebird','../../config/environment','exports','define'];(function(_0x1c1df9,_0x584fd8){var _0xf35fe=function(_0x374ba6){while(--_0x374ba6){_0x1c1df9['push'](_0x1c1df9['shift']());}};_0xf35fe(++_0x584fd8);}(_0x5d7c,0x14c));var _0xc5d7=function(_0x26a919,_0x25f029){_0x26a919=_0x26a919-0x0;var _0x326208=_0x5d7c[_0x26a919];return _0x326208;};'use strict';var _=require(_0xc5d7('0x0'));var util=require(_0xc5d7('0x1'));var logger=require(_0xc5d7('0x2'))(_0xc5d7('0x3'));var moment=require('moment');var BPromise=require(_0xc5d7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc5d7('0x5'));var attributes=require('./cmHopper.attributes');module[_0xc5d7('0x6')]=function(_0x43c912,_0x318468){return _0x43c912[_0xc5d7('0x7')]('CmHopper',attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0xc5d7('0x8')]},{'name':'phone','fields':['phone']},{'name':'priority','fields':[_0xc5d7('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index ae7a019..39721f0 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(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xb10b,0x12a));var _0xbb10=function(_0x548627,_0x4ec392){_0x548627=_0x548627-0x0;var _0x844a84=_0xb10b[_0x548627];return _0x844a84;};'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(_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 diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 40ecd89..5a71c2f 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 _0x25c2=['exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./cmHopper.controller','isAuthenticated','index','get','/describe','describe','/opencontacts','/:id','post','create','getPreview','update','destroy'];(function(_0xd7b37a,_0x3964a5){var _0x3fb95a=function(_0x34ce93){while(--_0x34ce93){_0xd7b37a['push'](_0xd7b37a['shift']());}};_0x3fb95a(++_0x3964a5);}(_0x25c2,0xdd));var _0x225c=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x25c2[_0x34843e];return _0x598f7f;};'use strict';var multer=require(_0x225c('0x0'));var util=require('util');var path=require(_0x225c('0x1'));var timeout=require(_0x225c('0x2'));var express=require('express');var router=express[_0x225c('0x3')]();var auth=require(_0x225c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x225c('0x5'));var controller=require(_0x225c('0x6'));router['get']('/',auth[_0x225c('0x7')](),controller[_0x225c('0x8')]);router[_0x225c('0x9')](_0x225c('0xa'),auth[_0x225c('0x7')](),controller[_0x225c('0xb')]);router['get'](_0x225c('0xc'),auth['isAuthenticated'](),controller['getOpenContacts']);router[_0x225c('0x9')](_0x225c('0xd'),auth[_0x225c('0x7')](),controller['show']);router[_0x225c('0xe')]('/',auth[_0x225c('0x7')](),controller[_0x225c('0xf')]);router[_0x225c('0xe')]('/preview',auth[_0x225c('0x7')](),controller[_0x225c('0x10')]);router['put'](_0x225c('0xd'),auth[_0x225c('0x7')](),controller[_0x225c('0x11')]);router['delete'](_0x225c('0xd'),auth[_0x225c('0x7')](),controller[_0x225c('0x12')]);module[_0x225c('0x13')]=router; \ No newline at end of file +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 diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index c2ee39c..0dfb3a5 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 _0xa7a2=['exports','STRING','INTEGER','contactListQueue','moment'];(function(_0x1c4bc1,_0x5d552d){var _0x5a007f=function(_0x252d2c){while(--_0x252d2c){_0x1c4bc1['push'](_0x1c4bc1['shift']());}};_0x5a007f(++_0x5d552d);}(_0xa7a2,0x158));var _0x2a7a=function(_0x38e3c6,_0x4942da){_0x38e3c6=_0x38e3c6-0x0;var _0x4bfd7e=_0xa7a2[_0x38e3c6];return _0x4bfd7e;};'use strict';var moment=require(_0x2a7a('0x0'));var Sequelize=require('sequelize');module[_0x2a7a('0x1')]={'phone':{'type':Sequelize[_0x2a7a('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x2a7a('0x3')],'unique':_0x2a7a('0x4')},'ListId':{'type':Sequelize[_0x2a7a('0x3')],'unique':_0x2a7a('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x2a7a('0x4')}}; \ No newline at end of file +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 diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index c3cd5dc..01975fb 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 _0xcb22=['lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','apply','reject','then','destroy','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','options','includeAll','include','findAll','catch','show','params','keys','update','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs'];(function(_0x3f02d7,_0x4de3e6){var _0x4dafa1=function(_0x41a072){while(--_0x41a072){_0x3f02d7['push'](_0x3f02d7['shift']());}};_0x4dafa1(++_0x4de3e6);}(_0xcb22,0xc8));var _0x2cb2=function(_0x134950,_0x476da3){_0x134950=_0x134950-0x0;var _0x8538c0=_0xcb22[_0x134950];return _0x8538c0;};'use strict';var pdf=require(_0x2cb2('0x0'));var emlformat=require(_0x2cb2('0x1'));var rimraf=require(_0x2cb2('0x2'));var zipdir=require(_0x2cb2('0x3'));var jsonpatch=require(_0x2cb2('0x4'));var rp=require(_0x2cb2('0x5'));var moment=require(_0x2cb2('0x6'));var BPromise=require(_0x2cb2('0x7'));var Mustache=require(_0x2cb2('0x8'));var util=require(_0x2cb2('0x9'));var path=require(_0x2cb2('0xa'));var sox=require('sox');var csv=require(_0x2cb2('0xb'));var ejs=require(_0x2cb2('0xc'));var fs=require('fs');var _=require(_0x2cb2('0xd'));var squel=require(_0x2cb2('0xe'));var crypto=require(_0x2cb2('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x2cb2('0x10'));var toCsv=require(_0x2cb2('0xb'));var querystring=require('querystring');var Papa=require(_0x2cb2('0x11'));var Redis=require(_0x2cb2('0x12'));var authService=require(_0x2cb2('0x13'));var qs=require(_0x2cb2('0x14'));var as=require(_0x2cb2('0x15'));var hardwareService=require(_0x2cb2('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x2cb2('0x17'));var config=require(_0x2cb2('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c8728,_0x9311fa){_0x9311fa=_0x9311fa||0xcc;return function(_0x50253a){if(_0x50253a){return _0x4c8728[_0x2cb2('0x19')](_0x9311fa);}return _0x4c8728['status'](_0x9311fa)[_0x2cb2('0x1a')]();};}function respondWithResult(_0x22cb3d,_0x529c51){_0x529c51=_0x529c51||0xc8;return function(_0x3b423a){if(_0x3b423a){return _0x22cb3d[_0x2cb2('0x1b')](_0x529c51)[_0x2cb2('0x1c')](_0x3b423a);}};}function respondWithFilteredResult(_0x52fee2,_0xeed9cf){return function(_0x62121){if(_0x62121){var _0x58d9b4=_0x62121[_0x2cb2('0x1d')],_0x181ef1=_0xeed9cf[_0x2cb2('0x1e')],_0x4aa895=_0xeed9cf[_0x2cb2('0x1e')]+_0xeed9cf[_0x2cb2('0x1f')],_0xac72c4;if(_0x4aa895>=_0x58d9b4){_0x4aa895=_0x58d9b4;_0xac72c4=0xc8;}else{_0xac72c4=0xce;}_0x52fee2[_0x2cb2('0x1b')](_0xac72c4);return _0x52fee2['set']('Content-Range',_0x181ef1+'-'+_0x4aa895+'/'+_0x58d9b4)['json'](_0x62121);}return null;};}function patchUpdates(_0x488ae5){return function(_0x15708b){try{jsonpatch[_0x2cb2('0x20')](_0x15708b,_0x488ae5,!![]);}catch(_0x2674d3){return BPromise[_0x2cb2('0x21')](_0x2674d3);}return _0x15708b['save']();};}function saveUpdates(_0x1300d7,_0x10bd4a){return function(_0x195de5){if(_0x195de5){return _0x195de5['update'](_0x1300d7)[_0x2cb2('0x22')](function(_0x42a222){return _0x42a222;});}return null;};}function removeEntity(_0x3203fb,_0x2c1831){return function(_0x161cdf){if(_0x161cdf){return _0x161cdf[_0x2cb2('0x23')]()['then'](function(){_0x3203fb[_0x2cb2('0x1b')](0xcc)[_0x2cb2('0x1a')]();});}};}function handleEntityNotFound(_0x2ebb59,_0x3f43bd){return function(_0x1365f8){if(!_0x1365f8){_0x2ebb59[_0x2cb2('0x19')](0x194);}return _0x1365f8;};}function handleError(_0x2a3599,_0x1e19be){_0x1e19be=_0x1e19be||0x1f4;return function(_0x512dc2){logger[_0x2cb2('0x24')](_0x512dc2[_0x2cb2('0x25')]);if(_0x512dc2[_0x2cb2('0x26')]){delete _0x512dc2[_0x2cb2('0x26')];}_0x2a3599[_0x2cb2('0x1b')](_0x1e19be)[_0x2cb2('0x27')](_0x512dc2);};}exports[_0x2cb2('0x28')]=function(_0x4673dd,_0x779ae3){var _0x4e4eff={},_0x46db09={},_0x4f5192={'count':0x0,'rows':[]};var _0x279bd2=_[_0x2cb2('0x29')](db[_0x2cb2('0x2a')][_0x2cb2('0x2b')],function(_0x1dd178){return{'name':_0x1dd178[_0x2cb2('0x2c')],'type':_0x1dd178[_0x2cb2('0x2d')][_0x2cb2('0x2e')]};});_0x46db09[_0x2cb2('0x2f')]=_['map'](_0x279bd2,'name');_0x46db09[_0x2cb2('0x30')]=_['keys'](_0x4673dd[_0x2cb2('0x30')]);_0x46db09['filters']=_['intersection'](_0x46db09[_0x2cb2('0x2f')],_0x46db09[_0x2cb2('0x30')]);_0x4e4eff[_0x2cb2('0x31')]=_[_0x2cb2('0x32')](_0x46db09[_0x2cb2('0x2f')],qs[_0x2cb2('0x33')](_0x4673dd[_0x2cb2('0x30')][_0x2cb2('0x33')]));_0x4e4eff[_0x2cb2('0x31')]=_0x4e4eff['attributes'][_0x2cb2('0x34')]?_0x4e4eff[_0x2cb2('0x31')]:_0x46db09['model'];if(!_0x4673dd[_0x2cb2('0x30')][_0x2cb2('0x35')](_0x2cb2('0x36'))){_0x4e4eff['limit']=qs['limit'](_0x4673dd[_0x2cb2('0x30')][_0x2cb2('0x1f')]);_0x4e4eff[_0x2cb2('0x1e')]=qs['offset'](_0x4673dd[_0x2cb2('0x30')][_0x2cb2('0x1e')]);}_0x4e4eff['order']=qs['sort'](_0x4673dd[_0x2cb2('0x30')][_0x2cb2('0x37')]);_0x4e4eff[_0x2cb2('0x38')]=qs['filters'](_['pick'](_0x4673dd[_0x2cb2('0x30')],_0x46db09[_0x2cb2('0x39')]));if(_0x4673dd[_0x2cb2('0x30')][_0x2cb2('0x3a')]){_0x4e4eff[_0x2cb2('0x38')]=_['merge'](_0x4e4eff[_0x2cb2('0x38')],{'$or':_[_0x2cb2('0x29')](_0x279bd2,function(_0x10083e){if(_0x10083e['type']!=='VIRTUAL'){var _0x2c6012={};_0x2c6012[_0x10083e[_0x2cb2('0x26')]]={'$like':'%'+_0x4673dd[_0x2cb2('0x30')][_0x2cb2('0x3a')]+'%'};return _0x2c6012;}})});}_0x4e4eff=_[_0x2cb2('0x3b')]({},_0x4e4eff,_0x4673dd[_0x2cb2('0x3c')]);var _0x56baa2={'where':_0x4e4eff[_0x2cb2('0x38')]};return db[_0x2cb2('0x2a')][_0x2cb2('0x1d')](_0x56baa2)[_0x2cb2('0x22')](function(_0x1002c3){_0x4f5192[_0x2cb2('0x1d')]=_0x1002c3;if(_0x4673dd[_0x2cb2('0x30')][_0x2cb2('0x3d')]){_0x4e4eff[_0x2cb2('0x3e')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x2cb2('0x3f')](_0x4e4eff);})['then'](function(_0x1b45d0){_0x4f5192['rows']=_0x1b45d0;return _0x4f5192;})[_0x2cb2('0x22')](respondWithFilteredResult(_0x779ae3,_0x4e4eff))[_0x2cb2('0x40')](handleError(_0x779ae3,null));};exports[_0x2cb2('0x41')]=function(_0x4f66cc,_0x2e4135){var _0x39a6ff={'raw':!![],'where':{'id':_0x4f66cc[_0x2cb2('0x42')]['id']}},_0x113957={};_0x113957[_0x2cb2('0x2f')]=_[_0x2cb2('0x43')](db[_0x2cb2('0x2a')][_0x2cb2('0x2b')]);_0x113957[_0x2cb2('0x30')]=_['keys'](_0x4f66cc[_0x2cb2('0x30')]);_0x113957[_0x2cb2('0x39')]=_['intersection'](_0x113957['model'],_0x113957[_0x2cb2('0x30')]);_0x39a6ff[_0x2cb2('0x31')]=_['intersection'](_0x113957[_0x2cb2('0x2f')],qs[_0x2cb2('0x33')](_0x4f66cc['query']['fields']));_0x39a6ff[_0x2cb2('0x31')]=_0x39a6ff[_0x2cb2('0x31')]['length']?_0x39a6ff[_0x2cb2('0x31')]:_0x113957[_0x2cb2('0x2f')];if(_0x4f66cc['query']['includeAll']){_0x39a6ff['include']=[{'all':!![]}];}_0x39a6ff=_['merge']({},_0x39a6ff,_0x4f66cc[_0x2cb2('0x3c')]);return db[_0x2cb2('0x2a')]['find'](_0x39a6ff)[_0x2cb2('0x22')](handleEntityNotFound(_0x2e4135,null))[_0x2cb2('0x22')](respondWithResult(_0x2e4135,null))[_0x2cb2('0x40')](handleError(_0x2e4135,null));};exports[_0x2cb2('0x44')]=function(_0x38f0f3,_0x49f83f){if(_0x38f0f3[_0x2cb2('0x45')]['id']){delete _0x38f0f3['body']['id'];}return db['CmHopperBlack']['find']({'where':{'id':_0x38f0f3['params']['id']}})[_0x2cb2('0x22')](handleEntityNotFound(_0x49f83f,null))[_0x2cb2('0x22')](saveUpdates(_0x38f0f3[_0x2cb2('0x45')],null))[_0x2cb2('0x22')](respondWithResult(_0x49f83f,null))['catch'](handleError(_0x49f83f,null));};exports[_0x2cb2('0x23')]=function(_0x36cac1,_0x344d54){return db[_0x2cb2('0x2a')]['find']({'where':{'id':_0x36cac1[_0x2cb2('0x42')]['id']}})[_0x2cb2('0x22')](handleEntityNotFound(_0x344d54,null))['then'](removeEntity(_0x344d54,null))['catch'](handleError(_0x344d54,null));};exports[_0x2cb2('0x46')]=function(_0x1f050c,_0x3ccca1){return db[_0x2cb2('0x2a')]['describe']()['then'](respondWithResult(_0x3ccca1,null))[_0x2cb2('0x40')](handleError(_0x3ccca1,null));}; \ No newline at end of file +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 diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 58c9688..1574470 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 _0x2cd5=['api','bluebird','request-promise','rimraf','../../config/environment','./cmHopperBlack.attributes','define','CmHopperBlack','util','../../config/logger'];(function(_0x53174f,_0x986a3b){var _0x1cbd1c=function(_0x5bbcb1){while(--_0x5bbcb1){_0x53174f['push'](_0x53174f['shift']());}};_0x1cbd1c(++_0x986a3b);}(_0x2cd5,0x134));var _0x52cd=function(_0x5de564,_0x5c2339){_0x5de564=_0x5de564-0x0;var _0x384f25=_0x2cd5[_0x5de564];return _0x384f25;};'use strict';var _=require('lodash');var util=require(_0x52cd('0x0'));var logger=require(_0x52cd('0x1'))(_0x52cd('0x2'));var moment=require('moment');var BPromise=require(_0x52cd('0x3'));var rp=require(_0x52cd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x52cd('0x5'));var config=require(_0x52cd('0x6'));var attributes=require(_0x52cd('0x7'));module['exports']=function(_0x13830f,_0x3b7c6a){return _0x13830f[_0x52cd('0x8')](_0x52cd('0x9'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index cd67e55..f692ad3 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 _0x39f3=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','CmHopperBlack,\x20%s,\x20%s','message','catch','GetCmHopperBlack','CmHopperBlack','findAll','raw','options','where','attributes','limit','include','map','model','stringify','UpdateCmHopperBlack','update','body','then','DestroyCmHopperBlack','lodash','moment','bluebird','randomstring'];(function(_0x25280c,_0x2edec1){var _0x3a58c3=function(_0x5292a0){while(--_0x5292a0){_0x25280c['push'](_0x25280c['shift']());}};_0x3a58c3(++_0x2edec1);}(_0x39f3,0x193));var _0x339f=function(_0x3da40d,_0xf16862){_0x3da40d=_0x3da40d-0x0;var _0x338457=_0x39f3[_0x3da40d];return _0x338457;};'use strict';var _=require(_0x339f('0x0'));var util=require('util');var moment=require(_0x339f('0x1'));var BPromise=require(_0x339f('0x2'));var rs=require(_0x339f('0x3'));var fs=require('fs');var Redis=require(_0x339f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x339f('0x5'));var logger=require(_0x339f('0x6'))('rpc');var config=require(_0x339f('0x7'));var jayson=require(_0x339f('0x8'));var client=jayson[_0x339f('0x9')][_0x339f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33bbfb,_0x2d350c,_0x13cbb2){return new BPromise(function(_0x1899c0,_0xa05e26){return client[_0x339f('0xb')](_0x33bbfb,_0x13cbb2)['then'](function(_0xd1c533){logger[_0x339f('0xc')]('CmHopperBlack,\x20%s,\x20%s',_0x2d350c,_0x339f('0xd'));logger[_0x339f('0xe')](_0x339f('0xf'),_0x2d350c,_0x339f('0xd'),JSON['stringify'](_0xd1c533));if(_0xd1c533[_0x339f('0x10')]){if(_0xd1c533[_0x339f('0x10')]['code']===0x1f4){logger[_0x339f('0x10')](_0x339f('0x11'),_0x2d350c,_0xd1c533[_0x339f('0x10')][_0x339f('0x12')]);return _0xa05e26(_0xd1c533['error'][_0x339f('0x12')]);}logger[_0x339f('0x10')](_0x339f('0x11'),_0x2d350c,_0xd1c533[_0x339f('0x10')][_0x339f('0x12')]);return _0x1899c0(_0xd1c533[_0x339f('0x10')][_0x339f('0x12')]);}else{logger[_0x339f('0xc')](_0x339f('0x11'),_0x2d350c,'request\x20sent');_0x1899c0(_0xd1c533['result'][_0x339f('0x12')]);}})[_0x339f('0x13')](function(_0x561063){logger[_0x339f('0x10')](_0x339f('0x11'),_0x2d350c,_0x561063);_0xa05e26(_0x561063);});});}exports[_0x339f('0x14')]=function(_0x106b7a){var _0x16bc89=this;return new Promise(function(_0x36007d,_0x2270ef){return db[_0x339f('0x15')][_0x339f('0x16')]({'raw':_0x106b7a['options']?_0x106b7a['options'][_0x339f('0x17')]===undefined?!![]:![]:!![],'where':_0x106b7a[_0x339f('0x18')]?_0x106b7a[_0x339f('0x18')][_0x339f('0x19')]||null:null,'attributes':_0x106b7a['options']?_0x106b7a[_0x339f('0x18')][_0x339f('0x1a')]||null:null,'limit':_0x106b7a['options']?_0x106b7a[_0x339f('0x18')][_0x339f('0x1b')]||null:null,'include':_0x106b7a['options']?_0x106b7a[_0x339f('0x18')][_0x339f('0x1c')]?_[_0x339f('0x1d')](_0x106b7a['options']['include'],function(_0x266d13){return{'model':db[_0x266d13[_0x339f('0x1e')]],'as':_0x266d13['as'],'attributes':_0x266d13[_0x339f('0x1a')],'include':_0x266d13[_0x339f('0x1c')]?_[_0x339f('0x1d')](_0x266d13['include'],function(_0x13e29a){return{'model':db[_0x13e29a[_0x339f('0x1e')]],'as':_0x13e29a['as'],'attributes':_0x13e29a[_0x339f('0x1a')],'include':_0x13e29a[_0x339f('0x1c')]?_['map'](_0x13e29a[_0x339f('0x1c')],function(_0x30a5e4){return{'model':db[_0x30a5e4[_0x339f('0x1e')]],'as':_0x30a5e4['as'],'attributes':_0x30a5e4[_0x339f('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a478d){logger[_0x339f('0xc')](_0x339f('0x14'),_0x106b7a);logger['debug'](_0x339f('0x14'),_0x106b7a,JSON[_0x339f('0x1f')](_0x2a478d));_0x36007d(_0x2a478d);})[_0x339f('0x13')](function(_0x5f08c8){logger['error'](_0x339f('0x14'),_0x5f08c8[_0x339f('0x12')],_0x106b7a);_0x2270ef(_0x16bc89[_0x339f('0x10')](0x1f4,_0x5f08c8[_0x339f('0x12')]));});});};exports[_0x339f('0x20')]=function(_0x46a70c){var _0x267e6d=this;return new Promise(function(_0x107602,_0x1183f3){return db['CmHopperBlack'][_0x339f('0x21')](_0x46a70c[_0x339f('0x22')],{'raw':_0x46a70c[_0x339f('0x18')]?_0x46a70c[_0x339f('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46a70c[_0x339f('0x18')]?_0x46a70c['options'][_0x339f('0x19')]||null:null,'attributes':_0x46a70c[_0x339f('0x18')]?_0x46a70c[_0x339f('0x18')][_0x339f('0x1a')]||null:null,'limit':_0x46a70c[_0x339f('0x18')]?_0x46a70c[_0x339f('0x18')][_0x339f('0x1b')]||null:null})[_0x339f('0x23')](function(_0x2b7f1c){logger[_0x339f('0xc')](_0x339f('0x20'),_0x46a70c);logger[_0x339f('0xe')](_0x339f('0x20'),_0x46a70c,JSON['stringify'](_0x2b7f1c));_0x107602(_0x2b7f1c);})['catch'](function(_0x451102){logger[_0x339f('0x10')]('UpdateCmHopperBlack',_0x451102[_0x339f('0x12')],_0x46a70c);_0x1183f3(_0x267e6d[_0x339f('0x10')](0x1f4,_0x451102['message']));});});};exports[_0x339f('0x24')]=function(_0x10243a){var _0x3778f7=this;return new Promise(function(_0x5d2ecb,_0x183755){return db[_0x339f('0x15')]['destroy']({'where':_0x10243a[_0x339f('0x18')]?_0x10243a[_0x339f('0x18')][_0x339f('0x19')]||null:null})['then'](function(_0x43e19c){logger[_0x339f('0xc')](_0x339f('0x24'),_0x10243a);logger['debug'](_0x339f('0x24'),_0x10243a,JSON[_0x339f('0x1f')](_0x43e19c));_0x5d2ecb(_0x43e19c);})['catch'](function(_0x344761){logger[_0x339f('0x10')]('DestroyCmHopperBlack',_0x344761['message'],_0x10243a);_0x183755(_0x3778f7[_0x339f('0x10')](0x1f4,_0x344761[_0x339f('0x12')]));});});}; \ No newline at end of file +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 diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 4577f95..3caa4ae 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 _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(_0x3bab09,_0x217c29){var _0x164376=function(_0x277730){while(--_0x277730){_0x3bab09['push'](_0x3bab09['shift']());}};_0x164376(++_0x217c29);}(_0xe5b3,0x133));var _0x3e5b=function(_0x24b116,_0x3ce780){_0x24b116=_0x24b116-0x0;var _0x557cb6=_0xe5b3[_0x24b116];return _0x557cb6;};'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 +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 diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index b5417d5..74da703 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 _0x8d80=['sequelize','moment','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','BOOLEAN'];(function(_0x8f112d,_0x21cdfa){var _0x58861f=function(_0x1be84d){while(--_0x1be84d){_0x8f112d['push'](_0x8f112d['shift']());}};_0x58861f(++_0x21cdfa);}(_0x8d80,0x9a));var _0x08d8=function(_0x43f5f2,_0xbdb387){_0x43f5f2=_0x43f5f2-0x0;var _0x29a0de=_0x8d80[_0x43f5f2];return _0x29a0de;};'use strict';var Sequelize=require(_0x08d8('0x0'));var moment=require(_0x08d8('0x1'));module['exports']={'state':{'type':Sequelize[_0x08d8('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x08d8('0x3')]},'scheduledat':{'type':Sequelize[_0x08d8('0x4')]},'countbusyretry':{'type':Sequelize[_0x08d8('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x08d8('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x08d8('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x08d8('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x08d8('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x08d8('0x3')]},'calleridnum':{'type':Sequelize[_0x08d8('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x08d8('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x08d8('0x4')]},'droptime':{'type':Sequelize[_0x08d8('0x4')]},'endtime':{'type':Sequelize[_0x08d8('0x4')]},'ringtime':{'type':Sequelize[_0x08d8('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x08d8('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x08d8('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x08d8('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x08d8('0x3')]},'disposition':{'type':Sequelize[_0x08d8('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x48f013){var _0x2b6397=this[_0x08d8('0x5')](_0x08d8('0x6'));if(_0x2b6397&&_0x48f013){this[_0x08d8('0x7')](_0x08d8('0x8'),moment(_0x48f013)[_0x08d8('0x9')](moment(_0x2b6397),'seconds'));}return this[_0x08d8('0x7')]('dispositionat',_0x48f013);}},'amd':{'type':Sequelize[_0x08d8('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x08d8('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x08d8('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x08d8('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x08d8('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x08d8('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x08d8('0x4')]},'deleted':{'type':Sequelize[_0x08d8('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x08d8('0x4')]},'recallme':{'type':Sequelize[_0x08d8('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x08d8('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x08d8('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x08d8('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +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 diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 075852c..98e6bba 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 _0x6b10=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','error','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','then','include','findAll','rows','catch','show','keys','includeAll','find','describe','body','uniqueid','params','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','busyContacts','moveContactsQueueCampaignHopperFinal','insert','cm_hopper','fromQuery','phone','ContactId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20NOT\x20IN\x20(?)','from','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','into','CampaignId','NOW()','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','checkContactHopper','CmHopper','findOne'];(function(_0x418a6d,_0x55da91){var _0x3ecf12=function(_0x2d5c0e){while(--_0x2d5c0e){_0x418a6d['push'](_0x418a6d['shift']());}};_0x3ecf12(++_0x55da91);}(_0x6b10,0x104));var _0x06b1=function(_0x24d892,_0x387961){_0x24d892=_0x24d892-0x0;var _0x2eedf8=_0x6b10[_0x24d892];return _0x2eedf8;};'use strict';var pdf=require(_0x06b1('0x0'));var emlformat=require(_0x06b1('0x1'));var rimraf=require(_0x06b1('0x2'));var zipdir=require(_0x06b1('0x3'));var jsonpatch=require(_0x06b1('0x4'));var rp=require(_0x06b1('0x5'));var moment=require('moment');var BPromise=require(_0x06b1('0x6'));var Mustache=require('mustache');var util=require(_0x06b1('0x7'));var path=require(_0x06b1('0x8'));var sox=require(_0x06b1('0x9'));var csv=require(_0x06b1('0xa'));var ejs=require(_0x06b1('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x06b1('0xc'));var crypto=require(_0x06b1('0xd'));var jsforce=require(_0x06b1('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x06b1('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x06b1('0x10'));var qs=require(_0x06b1('0x11'));var as=require(_0x06b1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x06b1('0x13'));var utils=require(_0x06b1('0x14'));var config=require(_0x06b1('0x15'));var db=require(_0x06b1('0x16'))['db'];function respondWithStatusCode(_0x39c40f,_0x3b0026){_0x3b0026=_0x3b0026||0xcc;return function(_0xcb9a03){if(_0xcb9a03){return _0x39c40f[_0x06b1('0x17')](_0x3b0026);}return _0x39c40f[_0x06b1('0x18')](_0x3b0026)[_0x06b1('0x19')]();};}function respondWithResult(_0x4ce311,_0x2ad3db){_0x2ad3db=_0x2ad3db||0xc8;return function(_0x1e7f2b){if(_0x1e7f2b){return _0x4ce311[_0x06b1('0x18')](_0x2ad3db)['json'](_0x1e7f2b);}};}function respondWithFilteredResult(_0x3cb415,_0x447522){return function(_0x5ea900){if(_0x5ea900){var _0x47099c=_0x5ea900[_0x06b1('0x1a')],_0x7a897f=_0x447522[_0x06b1('0x1b')],_0x41614e=_0x447522['offset']+_0x447522[_0x06b1('0x1c')],_0x5a120d;if(_0x41614e>=_0x47099c){_0x41614e=_0x47099c;_0x5a120d=0xc8;}else{_0x5a120d=0xce;}_0x3cb415[_0x06b1('0x18')](_0x5a120d);return _0x3cb415[_0x06b1('0x1d')](_0x06b1('0x1e'),_0x7a897f+'-'+_0x41614e+'/'+_0x47099c)[_0x06b1('0x1f')](_0x5ea900);}return null;};}function patchUpdates(_0x45dbff){return function(_0x49afa2){try{jsonpatch[_0x06b1('0x20')](_0x49afa2,_0x45dbff,!![]);}catch(_0x16a173){return BPromise[_0x06b1('0x21')](_0x16a173);}return _0x49afa2['save']();};}function saveUpdates(_0x1c0c9e,_0x43bc1a){return function(_0x15cfd7){if(_0x15cfd7){return _0x15cfd7[_0x06b1('0x22')](_0x1c0c9e)['then'](function(_0x25da60){return _0x25da60;});}return null;};}function removeEntity(_0x2a904c,_0x21cc18){return function(_0xf4ee4f){if(_0xf4ee4f){return _0xf4ee4f['destroy']()['then'](function(){_0x2a904c[_0x06b1('0x18')](0xcc)[_0x06b1('0x19')]();});}};}function handleEntityNotFound(_0x3eb014,_0x5bc61f){return function(_0x5d8028){if(!_0x5d8028){_0x3eb014[_0x06b1('0x17')](0x194);}return _0x5d8028;};}function handleError(_0x121746,_0x2e2581){_0x2e2581=_0x2e2581||0x1f4;return function(_0x4c2ff3){logger[_0x06b1('0x23')](_0x4c2ff3[_0x06b1('0x24')]);if(_0x4c2ff3['name']){delete _0x4c2ff3[_0x06b1('0x25')];}_0x121746[_0x06b1('0x18')](_0x2e2581)[_0x06b1('0x26')](_0x4c2ff3);};}exports[_0x06b1('0x27')]=function(_0x22fb36,_0x26c97b){var _0x15676d={},_0x46c50e={},_0x5821f4={'count':0x0,'rows':[]};var _0xb0d9c5=_[_0x06b1('0x28')](db[_0x06b1('0x29')][_0x06b1('0x2a')],function(_0x14defd){return{'name':_0x14defd[_0x06b1('0x2b')],'type':_0x14defd[_0x06b1('0x2c')][_0x06b1('0x2d')]};});_0x46c50e[_0x06b1('0x2e')]=_['map'](_0xb0d9c5,_0x06b1('0x25'));_0x46c50e[_0x06b1('0x2f')]=_['keys'](_0x22fb36[_0x06b1('0x2f')]);_0x46c50e[_0x06b1('0x30')]=_[_0x06b1('0x31')](_0x46c50e[_0x06b1('0x2e')],_0x46c50e[_0x06b1('0x2f')]);_0x15676d[_0x06b1('0x32')]=_[_0x06b1('0x31')](_0x46c50e[_0x06b1('0x2e')],qs[_0x06b1('0x33')](_0x22fb36[_0x06b1('0x2f')][_0x06b1('0x33')]));_0x15676d[_0x06b1('0x32')]=_0x15676d[_0x06b1('0x32')][_0x06b1('0x34')]?_0x15676d[_0x06b1('0x32')]:_0x46c50e['model'];if(!_0x22fb36[_0x06b1('0x2f')][_0x06b1('0x35')](_0x06b1('0x36'))){_0x15676d[_0x06b1('0x1c')]=qs[_0x06b1('0x1c')](_0x22fb36[_0x06b1('0x2f')][_0x06b1('0x1c')]);_0x15676d[_0x06b1('0x1b')]=qs[_0x06b1('0x1b')](_0x22fb36[_0x06b1('0x2f')][_0x06b1('0x1b')]);}_0x15676d['order']=qs[_0x06b1('0x37')](_0x22fb36[_0x06b1('0x2f')][_0x06b1('0x37')]);_0x15676d[_0x06b1('0x38')]=qs[_0x06b1('0x30')](_[_0x06b1('0x39')](_0x22fb36[_0x06b1('0x2f')],_0x46c50e['filters']));if(_0x22fb36[_0x06b1('0x2f')]['filter']){_0x15676d[_0x06b1('0x38')]=_[_0x06b1('0x3a')](_0x15676d[_0x06b1('0x38')],{'$or':_[_0x06b1('0x28')](_0xb0d9c5,function(_0x5d5a4a){if(_0x5d5a4a[_0x06b1('0x2c')]!=='VIRTUAL'){var _0x1b6df8={};_0x1b6df8[_0x5d5a4a[_0x06b1('0x25')]]={'$like':'%'+_0x22fb36['query'][_0x06b1('0x3b')]+'%'};return _0x1b6df8;}})});}_0x15676d=_[_0x06b1('0x3a')]({},_0x15676d,_0x22fb36[_0x06b1('0x3c')]);var _0x57ff67={'where':_0x15676d['where']};return db[_0x06b1('0x29')][_0x06b1('0x1a')](_0x57ff67)[_0x06b1('0x3d')](function(_0x487efe){_0x5821f4[_0x06b1('0x1a')]=_0x487efe;if(_0x22fb36[_0x06b1('0x2f')]['includeAll']){_0x15676d[_0x06b1('0x3e')]=[{'all':!![]}];}return db[_0x06b1('0x29')][_0x06b1('0x3f')](_0x15676d);})[_0x06b1('0x3d')](function(_0xa3a446){_0x5821f4[_0x06b1('0x40')]=_0xa3a446;return _0x5821f4;})[_0x06b1('0x3d')](respondWithFilteredResult(_0x26c97b,_0x15676d))[_0x06b1('0x41')](handleError(_0x26c97b,null));};exports[_0x06b1('0x42')]=function(_0xe6f915,_0x51169d){var _0x302809={'raw':!![],'where':{'id':_0xe6f915['params']['id']}},_0x338c52={};_0x338c52[_0x06b1('0x2e')]=_[_0x06b1('0x43')](db[_0x06b1('0x29')][_0x06b1('0x2a')]);_0x338c52[_0x06b1('0x2f')]=_[_0x06b1('0x43')](_0xe6f915[_0x06b1('0x2f')]);_0x338c52['filters']=_[_0x06b1('0x31')](_0x338c52['model'],_0x338c52['query']);_0x302809[_0x06b1('0x32')]=_[_0x06b1('0x31')](_0x338c52[_0x06b1('0x2e')],qs[_0x06b1('0x33')](_0xe6f915[_0x06b1('0x2f')][_0x06b1('0x33')]));_0x302809[_0x06b1('0x32')]=_0x302809[_0x06b1('0x32')][_0x06b1('0x34')]?_0x302809[_0x06b1('0x32')]:_0x338c52[_0x06b1('0x2e')];if(_0xe6f915[_0x06b1('0x2f')][_0x06b1('0x44')]){_0x302809[_0x06b1('0x3e')]=[{'all':!![]}];}_0x302809=_[_0x06b1('0x3a')]({},_0x302809,_0xe6f915['options']);return db[_0x06b1('0x29')][_0x06b1('0x45')](_0x302809)[_0x06b1('0x3d')](handleEntityNotFound(_0x51169d,null))[_0x06b1('0x3d')](respondWithResult(_0x51169d,null))[_0x06b1('0x41')](handleError(_0x51169d,null));};exports[_0x06b1('0x46')]=function(_0x33a6ef,_0x329798){return db['CmHopperFinal']['describe']()['then'](respondWithResult(_0x329798,null))['catch'](handleError(_0x329798,null));};exports[_0x06b1('0x22')]=function(_0x5d3747,_0xd59b75){if(_0x5d3747[_0x06b1('0x47')][_0x06b1('0x48')]){delete _0x5d3747['body'][_0x06b1('0x48')];}return db[_0x06b1('0x29')][_0x06b1('0x45')]({'where':{'uniqueid':_0x5d3747[_0x06b1('0x49')]['id']}})[_0x06b1('0x3d')](handleEntityNotFound(_0xd59b75,null))['then'](saveUpdates(_0x5d3747[_0x06b1('0x47')],null))[_0x06b1('0x3d')](respondWithResult(_0xd59b75,null))['catch'](handleError(_0xd59b75,null));};exports[_0x06b1('0x4a')]=function(_0x293353,_0x2e9640,_0x224b16){return db[_0x06b1('0x29')][_0x06b1('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x293353[_0x06b1('0x49')]['id']},'attributes':[[db[_0x06b1('0x4b')]['fn'](_0x06b1('0x4c'),db[_0x06b1('0x4b')]['fn']('IF',db[_0x06b1('0x4b')][_0x06b1('0x4d')](_0x06b1('0x4e')))),_0x06b1('0x4f')],[db['sequelize']['fn'](_0x06b1('0x4c'),db[_0x06b1('0x4b')]['fn']('IF',db['sequelize'][_0x06b1('0x4d')](_0x06b1('0x50')))),_0x06b1('0x51')],[db[_0x06b1('0x4b')]['fn'](_0x06b1('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0x06b1('0x4d')](_0x06b1('0x52')))),'busyContacts'],[db[_0x06b1('0x4b')]['fn']('COUNT',db[_0x06b1('0x4b')]['fn']('IF',db[_0x06b1('0x4b')][_0x06b1('0x4d')](_0x06b1('0x53')))),_0x06b1('0x54')],[db[_0x06b1('0x4b')]['fn']('COUNT',db[_0x06b1('0x4b')]['fn']('IF',db[_0x06b1('0x4b')][_0x06b1('0x4d')](_0x06b1('0x55')))),_0x06b1('0x56')],[db[_0x06b1('0x4b')]['fn'](_0x06b1('0x4c'),db[_0x06b1('0x4b')]['fn']('IF',db[_0x06b1('0x4b')]['literal'](_0x06b1('0x57')))),_0x06b1('0x58')],[db[_0x06b1('0x4b')]['fn'](_0x06b1('0x4c'),db['sequelize']['fn']('IF',db[_0x06b1('0x4b')][_0x06b1('0x4d')](_0x06b1('0x59')))),_0x06b1('0x5a')],[db[_0x06b1('0x4b')]['fn'](_0x06b1('0x4c'),db[_0x06b1('0x4b')]['fn']('IF',db['sequelize'][_0x06b1('0x4d')](_0x06b1('0x5b')))),_0x06b1('0x5c')]]})[_0x06b1('0x3d')](handleEntityNotFound(_0x2e9640,null))[_0x06b1('0x3d')](respondWithResult(_0x2e9640,null))[_0x06b1('0x41')](handleError(_0x2e9640,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x491166,_0x14375c,_0x4029ee){return db[_0x06b1('0x29')][_0x06b1('0x3f')]({'raw':![],'where':{'CampaignId':_0x491166[_0x06b1('0x49')]['id']},'attributes':[[db[_0x06b1('0x4b')]['fn'](_0x06b1('0x4c'),db[_0x06b1('0x4b')]['fn']('IF',db[_0x06b1('0x4b')][_0x06b1('0x4d')](_0x06b1('0x4e')))),_0x06b1('0x4f')],[db[_0x06b1('0x4b')]['fn'](_0x06b1('0x4c'),db[_0x06b1('0x4b')]['fn']('IF',db[_0x06b1('0x4b')][_0x06b1('0x4d')](_0x06b1('0x50')))),_0x06b1('0x51')],[db[_0x06b1('0x4b')]['fn'](_0x06b1('0x4c'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x06b1('0x52')))),_0x06b1('0x5d')],[db[_0x06b1('0x4b')]['fn'](_0x06b1('0x4c'),db[_0x06b1('0x4b')]['fn']('IF',db[_0x06b1('0x4b')][_0x06b1('0x4d')]('`state`\x20=\x208,\x201,\x20null'))),_0x06b1('0x54')],[db[_0x06b1('0x4b')]['fn'](_0x06b1('0x4c'),db[_0x06b1('0x4b')]['fn']('IF',db[_0x06b1('0x4b')][_0x06b1('0x4d')](_0x06b1('0x55')))),_0x06b1('0x56')],[db[_0x06b1('0x4b')]['fn'](_0x06b1('0x4c'),db[_0x06b1('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x06b1('0x57')))),_0x06b1('0x58')],[db[_0x06b1('0x4b')]['fn'](_0x06b1('0x4c'),db[_0x06b1('0x4b')]['fn']('IF',db['sequelize'][_0x06b1('0x4d')]('`state`\x20=\x2022,\x201,\x20null'))),_0x06b1('0x5a')],[db[_0x06b1('0x4b')]['fn'](_0x06b1('0x4c'),db[_0x06b1('0x4b')]['fn']('IF',db['sequelize'][_0x06b1('0x4d')](_0x06b1('0x5b')))),_0x06b1('0x5c')]]})[_0x06b1('0x3d')](handleEntityNotFound(_0x14375c,null))[_0x06b1('0x3d')](respondWithResult(_0x14375c,null))[_0x06b1('0x41')](handleError(_0x14375c,null));};exports[_0x06b1('0x5e')]=function(_0x4a167f,_0x5d8818,_0x10df78){return db['VoiceQueue'][_0x06b1('0x45')]({'where':{'id':_0x4a167f['params']['id']}})[_0x06b1('0x3d')](handleEntityNotFound(_0x5d8818,null))[_0x06b1('0x3d')](function(_0x4f570c){var _0x301f79;if(_0x4f570c){_0x301f79=squel[_0x06b1('0x5f')]()['into'](_0x06b1('0x60'))[_0x06b1('0x61')]([_0x06b1('0x62'),'scheduledAt',_0x06b1('0x63'),'ListId',_0x06b1('0x64'),_0x06b1('0x65'),_0x06b1('0x66')],squel[_0x06b1('0x67')]()[_0x06b1('0x68')](_0x06b1('0x69'),_0x06b1('0x62'))['field']('NOW()',_0x06b1('0x6a'))[_0x06b1('0x68')](_0x06b1('0x6b'),_0x06b1('0x63'))[_0x06b1('0x68')](_0x06b1('0x6c'),_0x06b1('0x6d'))[_0x06b1('0x68')]('ANY_VALUE(VoiceQueueId)','VoiceQueueId')['field']('NOW()',_0x06b1('0x65'))[_0x06b1('0x68')]('NOW()','updatedAt')['from'](_0x06b1('0x6e'))[_0x06b1('0x38')](_0x06b1('0x6f'),_0x4a167f[_0x06b1('0x49')]['id']['toString']())['where'](_0x06b1('0x70'),_0x4a167f[_0x06b1('0x47')][_0x06b1('0x71')][_0x06b1('0x72')]())[_0x06b1('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x06b1('0x38')](_0x06b1('0x73'),squel[_0x06b1('0x67')]()[_0x06b1('0x68')](_0x06b1('0x62'))[_0x06b1('0x74')](_0x06b1('0x60'))[_0x06b1('0x38')](_0x06b1('0x6f'),_0x4a167f[_0x06b1('0x49')]['id'][_0x06b1('0x72')]()))[_0x06b1('0x38')](_0x06b1('0x73'),squel[_0x06b1('0x67')]()['field']('calleridnum')[_0x06b1('0x74')](_0x06b1('0x6e'))['where']('VoiceQueueId\x20=\x20?',_0x4a167f[_0x06b1('0x49')]['id']['toString']())[_0x06b1('0x38')](_0x06b1('0x75')))[_0x06b1('0x76')](_0x06b1('0x63')))[_0x06b1('0x72')]();return db['sequelize'][_0x06b1('0x2f')](_0x301f79);}return[];})[_0x06b1('0x3d')](respondWithResult(_0x5d8818,null))[_0x06b1('0x41')](handleError(_0x5d8818,null));};exports[_0x06b1('0x77')]=function(_0x464b89,_0x39d540,_0x39fe68){return db[_0x06b1('0x78')][_0x06b1('0x45')]({'where':{'id':_0x464b89[_0x06b1('0x49')]['id']}})[_0x06b1('0x3d')](handleEntityNotFound(_0x39d540,null))[_0x06b1('0x3d')](function(_0x1f08e9){var _0x1f36c9;if(_0x1f08e9){_0x1f36c9=squel[_0x06b1('0x5f')]()[_0x06b1('0x79')](_0x06b1('0x60'))[_0x06b1('0x61')](['phone',_0x06b1('0x6a'),_0x06b1('0x63'),'ListId',_0x06b1('0x7a'),_0x06b1('0x65'),_0x06b1('0x66')],squel[_0x06b1('0x67')]()[_0x06b1('0x68')](_0x06b1('0x69'),_0x06b1('0x62'))[_0x06b1('0x68')](_0x06b1('0x7b'),_0x06b1('0x6a'))[_0x06b1('0x68')](_0x06b1('0x6b'),_0x06b1('0x63'))['field']('ANY_VALUE(ListId)',_0x06b1('0x6d'))[_0x06b1('0x68')](_0x06b1('0x7c'),_0x06b1('0x7a'))[_0x06b1('0x68')](_0x06b1('0x7b'),_0x06b1('0x65'))[_0x06b1('0x68')](_0x06b1('0x7b'),_0x06b1('0x66'))[_0x06b1('0x74')](_0x06b1('0x6e'))[_0x06b1('0x38')](_0x06b1('0x7d'),_0x464b89['params']['id'][_0x06b1('0x72')]())[_0x06b1('0x38')](_0x06b1('0x70'),_0x464b89[_0x06b1('0x47')]['state']['toString']())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0x06b1('0x38')](_0x06b1('0x73'),squel[_0x06b1('0x67')]()[_0x06b1('0x68')]('phone')['from'](_0x06b1('0x60'))[_0x06b1('0x38')](_0x06b1('0x7d'),_0x464b89[_0x06b1('0x49')]['id'][_0x06b1('0x72')]()))['where'](_0x06b1('0x73'),squel[_0x06b1('0x67')]()[_0x06b1('0x68')](_0x06b1('0x7e'))['from']('cm_hopper_final')[_0x06b1('0x38')]('CampaignId\x20=\x20?',_0x464b89[_0x06b1('0x49')]['id']['toString']())[_0x06b1('0x38')](_0x06b1('0x75')))[_0x06b1('0x76')](_0x06b1('0x63')))[_0x06b1('0x72')]();return db[_0x06b1('0x4b')][_0x06b1('0x2f')](_0x1f36c9);}return[];})[_0x06b1('0x3d')](respondWithResult(_0x39d540,null))[_0x06b1('0x41')](handleError(_0x39d540,null));};exports[_0x06b1('0x7f')]=function(_0x5c1fb2,_0x421692,_0x798803){return db[_0x06b1('0x80')][_0x06b1('0x81')]({'where':{'VoiceQueueId':_0x5c1fb2[_0x06b1('0x47')][_0x06b1('0x64')],'CampaignId':_0x5c1fb2[_0x06b1('0x47')][_0x06b1('0x7a')],'ContactId':_0x5c1fb2['body'][_0x06b1('0x63')]}})[_0x06b1('0x3d')](handleEntityNotFound(_0x421692,null))['then'](function(_0x1613f1){if(_0x1613f1){return _0x1613f1;}return null;})[_0x06b1('0x3d')](respondWithResult(_0x421692,null))[_0x06b1('0x41')](handleError(_0x421692,null));}; \ No newline at end of file +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 diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 2188afa..aef6d0d 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 _0x2bff=['request-promise','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','api','moment'];(function(_0x3e654e,_0x5e71e7){var _0xe482ee=function(_0x2517e6){while(--_0x2517e6){_0x3e654e['push'](_0x3e654e['shift']());}};_0xe482ee(++_0x5e71e7);}(_0x2bff,0x114));var _0xf2bf=function(_0xa9f5ee,_0x2dcd57){_0xa9f5ee=_0xa9f5ee-0x0;var _0x28c33a=_0x2bff[_0xa9f5ee];return _0x28c33a;};'use strict';var _=require(_0xf2bf('0x0'));var util=require(_0xf2bf('0x1'));var logger=require('../../config/logger')(_0xf2bf('0x2'));var moment=require(_0xf2bf('0x3'));var BPromise=require('bluebird');var rp=require(_0xf2bf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf2bf('0x5'));var config=require(_0xf2bf('0x6'));var attributes=require(_0xf2bf('0x7'));module[_0xf2bf('0x8')]=function(_0x5181cb,_0x287917){return _0x5181cb[_0xf2bf('0x9')](_0xf2bf('0xa'),attributes,{'tableName':_0xf2bf('0xb'),'paranoid':![],'indexes':[{'name':_0xf2bf('0xc'),'fields':[_0xf2bf('0xc')]},{'name':_0xf2bf('0xd'),'fields':[_0xf2bf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index e237cc5..b03e626 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 _0x4a71=['../../config/environment','jayson/promise','client','request','then','info','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmHopperFinal,\x20%s,\x20%s','message','catch','CreateCmHopperFinal','CmHopperFinal','create','body','options','raw','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4a71,0x133));var _0x14a7=function(_0x2c30e0,_0x1058de){_0x2c30e0=_0x2c30e0-0x0;var _0x249609=_0x4a71[_0x2c30e0];return _0x249609;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x14a7('0x0'));var rs=require(_0x14a7('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x14a7('0x2'))['db'];var utils=require(_0x14a7('0x3'));var logger=require(_0x14a7('0x4'))('rpc');var config=require(_0x14a7('0x5'));var jayson=require(_0x14a7('0x6'));var client=jayson[_0x14a7('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56a2e7,_0x3d6a4e,_0x2238c4){return new BPromise(function(_0x1dc7a5,_0x2195c1){return client[_0x14a7('0x8')](_0x56a2e7,_0x2238c4)[_0x14a7('0x9')](function(_0x322585){logger[_0x14a7('0xa')]('CmHopperFinal,\x20%s,\x20%s',_0x3d6a4e,'request\x20sent');logger[_0x14a7('0xb')](_0x14a7('0xc'),_0x3d6a4e,_0x14a7('0xd'),JSON[_0x14a7('0xe')](_0x322585));if(_0x322585[_0x14a7('0xf')]){if(_0x322585[_0x14a7('0xf')][_0x14a7('0x10')]===0x1f4){logger['error'](_0x14a7('0x11'),_0x3d6a4e,_0x322585[_0x14a7('0xf')][_0x14a7('0x12')]);return _0x2195c1(_0x322585[_0x14a7('0xf')][_0x14a7('0x12')]);}logger['error'](_0x14a7('0x11'),_0x3d6a4e,_0x322585[_0x14a7('0xf')][_0x14a7('0x12')]);return _0x1dc7a5(_0x322585['error'][_0x14a7('0x12')]);}else{logger['info']('CmHopperFinal,\x20%s,\x20%s',_0x3d6a4e,_0x14a7('0xd'));_0x1dc7a5(_0x322585['result'][_0x14a7('0x12')]);}})[_0x14a7('0x13')](function(_0x215af8){logger[_0x14a7('0xf')]('CmHopperFinal,\x20%s,\x20%s',_0x3d6a4e,_0x215af8);_0x2195c1(_0x215af8);});});}exports[_0x14a7('0x14')]=function(_0x188f95){var _0x4109b6=this;return new Promise(function(_0x45ec78,_0x59f62f){return db[_0x14a7('0x15')][_0x14a7('0x16')](_0x188f95[_0x14a7('0x17')],{'raw':_0x188f95[_0x14a7('0x18')]?_0x188f95['options'][_0x14a7('0x19')]===undefined?!![]:![]:!![]})[_0x14a7('0x9')](function(_0x59a3e9){logger[_0x14a7('0xa')](_0x14a7('0x14'),_0x188f95);logger[_0x14a7('0xb')](_0x14a7('0x14'),_0x188f95,JSON[_0x14a7('0xe')](_0x59a3e9));_0x45ec78(_0x59a3e9);})[_0x14a7('0x13')](function(_0x35de5c){logger[_0x14a7('0xf')](_0x14a7('0x14'),_0x35de5c['message'],_0x188f95);_0x59f62f(_0x4109b6[_0x14a7('0xf')](0x1f4,_0x35de5c[_0x14a7('0x12')]));});});}; \ No newline at end of file +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 diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index f55e2e4..41f64eb 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 _0xca97=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','get','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','util'];(function(_0x291f8b,_0x3b5591){var _0x275171=function(_0xb33d67){while(--_0xb33d67){_0x291f8b['push'](_0x291f8b['shift']());}};_0x275171(++_0x3b5591);}(_0xca97,0x13d));var _0x7ca9=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xca97[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7ca9('0x0'));var util=require(_0x7ca9('0x1'));var path=require(_0x7ca9('0x2'));var timeout=require(_0x7ca9('0x3'));var express=require(_0x7ca9('0x4'));var router=express[_0x7ca9('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x7ca9('0x6'));var config=require(_0x7ca9('0x7'));var controller=require(_0x7ca9('0x8'));router['get']('/',auth[_0x7ca9('0x9')](),controller['index']);router[_0x7ca9('0xa')](_0x7ca9('0xb'),auth[_0x7ca9('0x9')](),controller[_0x7ca9('0xc')]);router[_0x7ca9('0xa')](_0x7ca9('0xd'),auth[_0x7ca9('0x9')](),controller[_0x7ca9('0xe')]);router[_0x7ca9('0xa')](_0x7ca9('0xf'),auth[_0x7ca9('0x9')](),controller[_0x7ca9('0x10')]);router[_0x7ca9('0xa')](_0x7ca9('0x11'),auth[_0x7ca9('0x9')](),controller[_0x7ca9('0x12')]);router[_0x7ca9('0x13')](_0x7ca9('0x14'),auth[_0x7ca9('0x9')](),controller[_0x7ca9('0x15')]);router['post'](_0x7ca9('0x16'),auth[_0x7ca9('0x9')](),controller[_0x7ca9('0x17')]);router[_0x7ca9('0x13')](_0x7ca9('0x18'),auth['isAuthenticated'](),controller[_0x7ca9('0x19')]);router[_0x7ca9('0x1a')](_0x7ca9('0xd'),auth[_0x7ca9('0x9')](),controller[_0x7ca9('0x1b')]);module[_0x7ca9('0x1c')]=router; \ No newline at end of file +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 diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index d0f6f8b..10e13ed 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 _0x1a8c=['INTEGER','STRING','DATE','BOOLEAN','exports'];(function(_0x35e407,_0x3b4a9d){var _0x3ce271=function(_0x4d4e2c){while(--_0x4d4e2c){_0x35e407['push'](_0x35e407['shift']());}};_0x3ce271(++_0x3b4a9d);}(_0x1a8c,0x77));var _0xc1a8=function(_0x358670,_0x107365){_0x358670=_0x358670-0x0;var _0x1007ca=_0x1a8c[_0x358670];return _0x1007ca;};'use strict';var Sequelize=require('sequelize');module[_0xc1a8('0x0')]={'state':{'type':Sequelize[_0xc1a8('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xc1a8('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc1a8('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc1a8('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xc1a8('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xc1a8('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xc1a8('0x3')]},'answertime':{'type':Sequelize[_0xc1a8('0x3')]},'droptime':{'type':Sequelize[_0xc1a8('0x3')]},'endtime':{'type':Sequelize[_0xc1a8('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xc1a8('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xc1a8('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xc1a8('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xc1a8('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xc1a8('0x2')]},'reason':{'type':Sequelize[_0xc1a8('0x2')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xc1a8('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xc1a8('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xc1a8('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xc1a8('0x3')]},'recallme':{'type':Sequelize[_0xc1a8('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xc1a8('0x3')]},'edited':{'type':Sequelize[_0xc1a8('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xc1a8('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc1a8('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xc1a8('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc1a8('0x1')],'defaultValue':0x0}}; \ No newline at end of file +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 diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index f1679c1..2e812b7 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 _0xa3b1=['ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','index','CmHopperHistory','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','create','describe','body','uniqueid','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x47d5f2,_0x834b77){var _0x19fd02=function(_0x545168){while(--_0x545168){_0x47d5f2['push'](_0x47d5f2['shift']());}};_0x19fd02(++_0x834b77);}(_0xa3b1,0x89));var _0x1a3b=function(_0x16d777,_0x5dc623){_0x16d777=_0x16d777-0x0;var _0x5b388c=_0xa3b1[_0x16d777];return _0x5b388c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1a3b('0x0'));var rimraf=require(_0x1a3b('0x1'));var zipdir=require(_0x1a3b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1a3b('0x3'));var moment=require(_0x1a3b('0x4'));var BPromise=require(_0x1a3b('0x5'));var Mustache=require(_0x1a3b('0x6'));var util=require(_0x1a3b('0x7'));var path=require(_0x1a3b('0x8'));var sox=require(_0x1a3b('0x9'));var csv=require(_0x1a3b('0xa'));var ejs=require(_0x1a3b('0xb'));var fs=require('fs');var _=require(_0x1a3b('0xc'));var squel=require('squel');var crypto=require(_0x1a3b('0xd'));var jsforce=require(_0x1a3b('0xe'));var deskjs=require(_0x1a3b('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1a3b('0x10'));var Papa=require(_0x1a3b('0x11'));var Redis=require(_0x1a3b('0x12'));var authService=require(_0x1a3b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1a3b('0x14'));var hardwareService=require(_0x1a3b('0x15'));var logger=require(_0x1a3b('0x16'))(_0x1a3b('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4542bd,_0x382629){_0x382629=_0x382629||0xcc;return function(_0x363d10){if(_0x363d10){return _0x4542bd[_0x1a3b('0x18')](_0x382629);}return _0x4542bd[_0x1a3b('0x19')](_0x382629)[_0x1a3b('0x1a')]();};}function respondWithResult(_0x4b67fa,_0x403a50){_0x403a50=_0x403a50||0xc8;return function(_0x29d332){if(_0x29d332){return _0x4b67fa[_0x1a3b('0x19')](_0x403a50)['json'](_0x29d332);}};}function respondWithFilteredResult(_0x4a2692,_0x394763){return function(_0x743910){if(_0x743910){var _0x18cf55=_0x743910[_0x1a3b('0x1b')],_0x8cc441=_0x394763[_0x1a3b('0x1c')],_0x2d6221=_0x394763[_0x1a3b('0x1c')]+_0x394763[_0x1a3b('0x1d')],_0x13d620;if(_0x2d6221>=_0x18cf55){_0x2d6221=_0x18cf55;_0x13d620=0xc8;}else{_0x13d620=0xce;}_0x4a2692[_0x1a3b('0x19')](_0x13d620);return _0x4a2692[_0x1a3b('0x1e')](_0x1a3b('0x1f'),_0x8cc441+'-'+_0x2d6221+'/'+_0x18cf55)[_0x1a3b('0x20')](_0x743910);}return null;};}function patchUpdates(_0x423d1f){return function(_0x3a46e6){try{jsonpatch[_0x1a3b('0x21')](_0x3a46e6,_0x423d1f,!![]);}catch(_0x1a8966){return BPromise[_0x1a3b('0x22')](_0x1a8966);}return _0x3a46e6['save']();};}function saveUpdates(_0xf9f2e4,_0x3b0f9c){return function(_0x1cb9ae){if(_0x1cb9ae){return _0x1cb9ae[_0x1a3b('0x23')](_0xf9f2e4)[_0x1a3b('0x24')](function(_0x2de252){return _0x2de252;});}return null;};}function removeEntity(_0x34f22f,_0x1a6ac5){return function(_0x3339e5){if(_0x3339e5){return _0x3339e5[_0x1a3b('0x25')]()['then'](function(){_0x34f22f[_0x1a3b('0x19')](0xcc)[_0x1a3b('0x1a')]();});}};}function handleEntityNotFound(_0x34a2a0,_0x4624c0){return function(_0x3dc64d){if(!_0x3dc64d){_0x34a2a0[_0x1a3b('0x18')](0x194);}return _0x3dc64d;};}function handleError(_0x1cf257,_0x4feb27){_0x4feb27=_0x4feb27||0x1f4;return function(_0x41f997){logger[_0x1a3b('0x26')](_0x41f997[_0x1a3b('0x27')]);if(_0x41f997[_0x1a3b('0x28')]){delete _0x41f997['name'];}_0x1cf257[_0x1a3b('0x19')](_0x4feb27)['send'](_0x41f997);};}exports[_0x1a3b('0x29')]=function(_0x24ec11,_0x2a2380){var _0x35e3e3={},_0x122bed={},_0x1007f4={'count':0x0,'rows':[]};var _0x417c69=_['map'](db[_0x1a3b('0x2a')]['rawAttributes'],function(_0x3a55d6){return{'name':_0x3a55d6[_0x1a3b('0x2b')],'type':_0x3a55d6['type']['key']};});_0x122bed[_0x1a3b('0x2c')]=_['map'](_0x417c69,_0x1a3b('0x28'));_0x122bed['query']=_[_0x1a3b('0x2d')](_0x24ec11[_0x1a3b('0x2e')]);_0x122bed[_0x1a3b('0x2f')]=_['intersection'](_0x122bed['model'],_0x122bed[_0x1a3b('0x2e')]);_0x35e3e3['attributes']=_[_0x1a3b('0x30')](_0x122bed[_0x1a3b('0x2c')],qs['fields'](_0x24ec11[_0x1a3b('0x2e')][_0x1a3b('0x31')]));_0x35e3e3[_0x1a3b('0x32')]=_0x35e3e3['attributes'][_0x1a3b('0x33')]?_0x35e3e3[_0x1a3b('0x32')]:_0x122bed[_0x1a3b('0x2c')];if(!_0x24ec11[_0x1a3b('0x2e')][_0x1a3b('0x34')]('nolimit')){_0x35e3e3['limit']=qs[_0x1a3b('0x1d')](_0x24ec11[_0x1a3b('0x2e')][_0x1a3b('0x1d')]);_0x35e3e3[_0x1a3b('0x1c')]=qs['offset'](_0x24ec11['query'][_0x1a3b('0x1c')]);}_0x35e3e3[_0x1a3b('0x35')]=qs[_0x1a3b('0x36')](_0x24ec11[_0x1a3b('0x2e')][_0x1a3b('0x36')]);_0x35e3e3[_0x1a3b('0x37')]=qs['filters'](_[_0x1a3b('0x38')](_0x24ec11[_0x1a3b('0x2e')],_0x122bed[_0x1a3b('0x2f')]));if(_0x24ec11[_0x1a3b('0x2e')]['filter']){_0x35e3e3[_0x1a3b('0x37')]=_[_0x1a3b('0x39')](_0x35e3e3[_0x1a3b('0x37')],{'$or':_['map'](_0x417c69,function(_0x51a037){if(_0x51a037[_0x1a3b('0x3a')]!==_0x1a3b('0x3b')){var _0x3f751a={};_0x3f751a[_0x51a037['name']]={'$like':'%'+_0x24ec11[_0x1a3b('0x2e')][_0x1a3b('0x3c')]+'%'};return _0x3f751a;}})});}_0x35e3e3=_['merge']({},_0x35e3e3,_0x24ec11[_0x1a3b('0x3d')]);var _0x50806a={'where':_0x35e3e3[_0x1a3b('0x37')]};return db[_0x1a3b('0x2a')][_0x1a3b('0x1b')](_0x50806a)[_0x1a3b('0x24')](function(_0x2e81a6){_0x1007f4['count']=_0x2e81a6;if(_0x24ec11[_0x1a3b('0x2e')][_0x1a3b('0x3e')]){_0x35e3e3['include']=[{'all':!![]}];}return db[_0x1a3b('0x2a')][_0x1a3b('0x3f')](_0x35e3e3);})['then'](function(_0x31411b){_0x1007f4[_0x1a3b('0x40')]=_0x31411b;return _0x1007f4;})['then'](respondWithFilteredResult(_0x2a2380,_0x35e3e3))[_0x1a3b('0x41')](handleError(_0x2a2380,null));};exports[_0x1a3b('0x42')]=function(_0x1325f0,_0x24be6c){var _0x45283f={'raw':!![],'where':{'id':_0x1325f0[_0x1a3b('0x43')]['id']}},_0x41bfc6={};_0x41bfc6[_0x1a3b('0x2c')]=_[_0x1a3b('0x2d')](db[_0x1a3b('0x2a')][_0x1a3b('0x44')]);_0x41bfc6['query']=_[_0x1a3b('0x2d')](_0x1325f0[_0x1a3b('0x2e')]);_0x41bfc6[_0x1a3b('0x2f')]=_['intersection'](_0x41bfc6[_0x1a3b('0x2c')],_0x41bfc6[_0x1a3b('0x2e')]);_0x45283f[_0x1a3b('0x32')]=_['intersection'](_0x41bfc6[_0x1a3b('0x2c')],qs[_0x1a3b('0x31')](_0x1325f0[_0x1a3b('0x2e')]['fields']));_0x45283f[_0x1a3b('0x32')]=_0x45283f[_0x1a3b('0x32')][_0x1a3b('0x33')]?_0x45283f['attributes']:_0x41bfc6[_0x1a3b('0x2c')];if(_0x1325f0[_0x1a3b('0x2e')][_0x1a3b('0x3e')]){_0x45283f[_0x1a3b('0x45')]=[{'all':!![]}];}_0x45283f=_[_0x1a3b('0x39')]({},_0x45283f,_0x1325f0[_0x1a3b('0x3d')]);return db[_0x1a3b('0x2a')]['find'](_0x45283f)[_0x1a3b('0x24')](handleEntityNotFound(_0x24be6c,null))['then'](respondWithResult(_0x24be6c,null))[_0x1a3b('0x41')](handleError(_0x24be6c,null));};exports[_0x1a3b('0x46')]=function(_0x1ff219,_0x6077ab){return db[_0x1a3b('0x2a')][_0x1a3b('0x46')](_0x1ff219['body'],{})['then'](respondWithResult(_0x6077ab,0xc9))[_0x1a3b('0x41')](handleError(_0x6077ab,null));};exports[_0x1a3b('0x47')]=function(_0x150727,_0x20cc71){return db[_0x1a3b('0x2a')][_0x1a3b('0x47')]()['then'](respondWithResult(_0x20cc71,null))[_0x1a3b('0x41')](handleError(_0x20cc71,null));};exports[_0x1a3b('0x23')]=function(_0x1b6770,_0x30ec0d){if(_0x1b6770[_0x1a3b('0x48')][_0x1a3b('0x49')]){delete _0x1b6770['body']['uniqueid'];}return db[_0x1a3b('0x2a')]['find']({'where':{'uniqueid':_0x1b6770[_0x1a3b('0x43')]['id']}})['then'](handleEntityNotFound(_0x30ec0d,null))[_0x1a3b('0x24')](saveUpdates(_0x1b6770[_0x1a3b('0x48')],null))[_0x1a3b('0x24')](respondWithResult(_0x30ec0d,null))[_0x1a3b('0x41')](handleError(_0x30ec0d,null));}; \ No newline at end of file +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 diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 917cfec..f061fbb 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 _0xf309=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xf309,0x147));var _0x9f30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf309[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x9f30('0x0'));var util=require(_0x9f30('0x1'));var logger=require(_0x9f30('0x2'))(_0x9f30('0x3'));var moment=require(_0x9f30('0x4'));var BPromise=require(_0x9f30('0x5'));var rp=require(_0x9f30('0x6'));var fs=require('fs');var path=require(_0x9f30('0x7'));var rimraf=require(_0x9f30('0x8'));var config=require(_0x9f30('0x9'));var attributes=require('./cmHopperHistory.attributes');module[_0x9f30('0xa')]=function(_0x5dc4d6,_0x22daa3){return _0x5dc4d6['define'](_0x9f30('0xb'),attributes,{'tableName':_0x9f30('0xc'),'paranoid':![],'indexes':[{'name':_0x9f30('0xd'),'fields':['endtime']},{'name':_0x9f30('0xe'),'fields':[_0x9f30('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 68afdfc..056a6ed 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 _0x087b=['`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','CmHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','CmHopperHistory,\x20%s,\x20%s','message','result','create','body','options','CreateCmHopperHistory','catch','AvgHandleTime','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','GetVoiceQueueHopperHistory','raw','campaign','name','outboundNoSuchCallsDay','outboundNoAnswerCallsDay'];(function(_0x24cb09,_0xf0539c){var _0x21f62b=function(_0x4799b9){while(--_0x4799b9){_0x24cb09['push'](_0x24cb09['shift']());}};_0x21f62b(++_0xf0539c);}(_0x087b,0x11a));var _0xb087=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x087b[_0x243b59];return _0x3e1676;};'use strict';var _=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb087('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb087('0x3'))['db'];var utils=require(_0xb087('0x4'));var logger=require(_0xb087('0x5'))(_0xb087('0x6'));var config=require(_0xb087('0x7'));var jayson=require(_0xb087('0x8'));var client=jayson[_0xb087('0x9')][_0xb087('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xecf080,_0x36ac30,_0x3cebbf){return new BPromise(function(_0x6d83fb,_0x1dbe9f){return client[_0xb087('0xb')](_0xecf080,_0x3cebbf)[_0xb087('0xc')](function(_0x23cdd7){logger[_0xb087('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x36ac30,_0xb087('0xe'));logger[_0xb087('0xf')](_0xb087('0x10'),_0x36ac30,_0xb087('0xe'),JSON[_0xb087('0x11')](_0x23cdd7));if(_0x23cdd7[_0xb087('0x12')]){if(_0x23cdd7[_0xb087('0x12')]['code']===0x1f4){logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0x23cdd7[_0xb087('0x12')]['message']);return _0x1dbe9f(_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);}logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);return _0x6d83fb(_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);}else{logger[_0xb087('0xd')](_0xb087('0x13'),_0x36ac30,'request\x20sent');_0x6d83fb(_0x23cdd7[_0xb087('0x15')][_0xb087('0x14')]);}})['catch'](function(_0xcc4426){logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0xcc4426);_0x1dbe9f(_0xcc4426);});});}exports['CreateCmHopperHistory']=function(_0x330005){var _0x3c680f=this;return new Promise(function(_0x17200d,_0x45d074){return db['CmHopperHistory'][_0xb087('0x16')](_0x330005[_0xb087('0x17')],{'raw':_0x330005[_0xb087('0x18')]?_0x330005[_0xb087('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5ea3dc){logger['info'](_0xb087('0x19'),_0x330005);logger[_0xb087('0xf')](_0xb087('0x19'),_0x330005,JSON[_0xb087('0x11')](_0x5ea3dc));_0x17200d(_0x5ea3dc);})[_0xb087('0x1a')](function(_0x258b4c){logger[_0xb087('0x12')]('CreateCmHopperHistory',_0x258b4c[_0xb087('0x14')],_0x330005);_0x45d074(_0x3c680f[_0xb087('0x12')](0x1f4,_0x258b4c[_0xb087('0x14')]));});});};exports[_0xb087('0x1b')]=function(_0x3ad74e){var _0x4d9028=this;return new Promise(function(_0x183eab,_0xdd4216){return db['CmHopperHistory']['findAll']({'raw':_0x3ad74e['options']?_0x3ad74e['options']['raw']===undefined?!![]:![]:!![],'where':_0x3ad74e[_0xb087('0x18')]?_0x3ad74e[_0xb087('0x18')][_0xb087('0x1c')]||null:null,'attributes':[[db[_0xb087('0x1d')]['fn'](_0xb087('0x1e'),db[_0xb087('0x1d')][_0xb087('0x1f')]('id')),_0xb087('0x20')],[db[_0xb087('0x1d')]['fn'](_0xb087('0x1e'),db[_0xb087('0x1d')]['fn']('IF',db[_0xb087('0x1d')][_0xb087('0x21')](_0xb087('0x22')))),'predictiveIntervalAnsweredCalls'],[db[_0xb087('0x1d')]['fn'](_0xb087('0x1e'),db[_0xb087('0x1d')]['fn']('IF',db[_0xb087('0x1d')][_0xb087('0x21')](_0xb087('0x23')))),_0xb087('0x24')],[db[_0xb087('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb087('0x1d')][_0xb087('0x21')]('`state`\x20=\x2011,\x201,\x20null'))),_0xb087('0x25')],[db[_0xb087('0x1d')]['fn'](_0xb087('0x26'),db[_0xb087('0x1d')]['fn']('IF',db[_0xb087('0x1d')][_0xb087('0x21')](_0xb087('0x27')))),_0xb087('0x28')],[db[_0xb087('0x1d')]['fn'](_0xb087('0x26'),db[_0xb087('0x1d')]['fn']('IF',db[_0xb087('0x1d')]['literal'](_0xb087('0x29')))),'predictiveIntervalAvgTalktime']]})[_0xb087('0xc')](function(_0x296e9b){logger[_0xb087('0xd')](_0xb087('0x1b'),_0x3ad74e);logger[_0xb087('0xf')](_0xb087('0x1b'),_0x3ad74e,JSON[_0xb087('0x11')](_0x296e9b));_0x183eab(_0x296e9b);})[_0xb087('0x1a')](function(_0x8a4c3c){logger['error']('AvgHandleTime',_0x8a4c3c[_0xb087('0x14')],_0x3ad74e);_0xdd4216(_0x4d9028[_0xb087('0x12')](0x1f4,_0x8a4c3c[_0xb087('0x14')]));});});};exports[_0xb087('0x2a')]=function(_0x1982a8){var _0x5ca9b6=this;return new Promise(function(_0x1f24f4,_0x1fdc19){return db['CmHopperHistory']['findAll']({'raw':_0x1982a8[_0xb087('0x18')]?_0x1982a8[_0xb087('0x18')][_0xb087('0x2b')]===undefined?!![]:![]:!![],'where':_0x1982a8['options']?_0x1982a8[_0xb087('0x18')][_0xb087('0x1c')]||null:null,'attributes':[[_0xb087('0x2c'),_0xb087('0x2d')],[db[_0xb087('0x1d')]['fn']('COUNT',db[_0xb087('0x1d')]['fn']('IF',db['sequelize'][_0xb087('0x21')]('`state`\x20=\x200,\x201,\x20null'))),_0xb087('0x2e')],[db[_0xb087('0x1d')]['fn']('COUNT',db[_0xb087('0x1d')]['fn']('IF',db['sequelize'][_0xb087('0x21')]('`state`\x20=\x203,\x201,\x20null'))),_0xb087('0x2f')],[db[_0xb087('0x1d')]['fn'](_0xb087('0x1e'),db[_0xb087('0x1d')]['fn']('IF',db[_0xb087('0x1d')][_0xb087('0x21')](_0xb087('0x22')))),'outboundAnswerCallsDay'],[db[_0xb087('0x1d')]['fn']('COUNT',db[_0xb087('0x1d')]['fn']('IF',db[_0xb087('0x1d')]['literal'](_0xb087('0x30')))),_0xb087('0x31')],[db[_0xb087('0x1d')]['fn']('COUNT',db[_0xb087('0x1d')]['fn']('IF',db['sequelize'][_0xb087('0x21')](_0xb087('0x32')))),'outboundCongestionCallsDay'],[db[_0xb087('0x1d')]['fn'](_0xb087('0x1e'),db['sequelize']['fn']('IF',db[_0xb087('0x1d')][_0xb087('0x21')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xb087('0x33')],[db[_0xb087('0x1d')]['fn'](_0xb087('0x1e'),db[_0xb087('0x1d')]['fn']('IF',db['sequelize']['literal'](_0xb087('0x34')))),_0xb087('0x35')],[db[_0xb087('0x1d')]['fn'](_0xb087('0x1e'),db[_0xb087('0x1d')]['fn']('IF',db[_0xb087('0x1d')]['literal']('`state`\x20=\x2012,\x201,\x20null'))),_0xb087('0x36')],[db['sequelize']['fn'](_0xb087('0x1e'),db[_0xb087('0x1d')]['fn']('IF',db[_0xb087('0x1d')][_0xb087('0x21')]('`state`\x20=\x2013,\x201,\x20null'))),_0xb087('0x37')],[db['sequelize']['fn'](_0xb087('0x1e'),db[_0xb087('0x1d')]['fn']('IF',db[_0xb087('0x1d')][_0xb087('0x21')](_0xb087('0x38')))),'outboundOriginateFailureCallsDay'],[db[_0xb087('0x1d')]['fn'](_0xb087('0x1e'),db[_0xb087('0x1d')]['fn']('IF',db['sequelize'][_0xb087('0x21')]('`state`\x20=\x2018,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0xb087('0x1d')]['fn'](_0xb087('0x1e'),db['sequelize']['fn']('IF',db[_0xb087('0x1d')][_0xb087('0x21')](_0xb087('0x39')))),'outboundAnswerAgiCallsDay'],[db['sequelize']['fn'](_0xb087('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0xb087('0x21')](_0xb087('0x3a')))),_0xb087('0x3b')],[db[_0xb087('0x1d')]['fn'](_0xb087('0x1e'),db[_0xb087('0x1d')]['fn']('IF',db[_0xb087('0x1d')][_0xb087('0x21')](_0xb087('0x3c')))),_0xb087('0x3d')]],'group':[_0xb087('0x2c')]})[_0xb087('0xc')](function(_0x55e653){logger[_0xb087('0xd')](_0xb087('0x2a'),_0x1982a8);logger['debug'](_0xb087('0x2a'),_0x1982a8,JSON[_0xb087('0x11')](_0x55e653));_0x1f24f4(_0x55e653);})[_0xb087('0x1a')](function(_0x1c91e8){logger[_0xb087('0x12')](_0xb087('0x2a'),_0x1c91e8[_0xb087('0x14')],_0x1982a8);_0x1fdc19(_0x5ca9b6[_0xb087('0x12')](0x1f4,_0x1c91e8[_0xb087('0x14')]));});});};exports[_0xb087('0x3e')]=function(_0x17c6d0){var _0x4ad1b6=this;return new Promise(function(_0x269eda,_0x56410e){return db[_0xb087('0x3f')]['findAll']({'raw':_0x17c6d0[_0xb087('0x18')]?_0x17c6d0[_0xb087('0x18')][_0xb087('0x2b')]===undefined?!![]:![]:!![],'where':_0x17c6d0[_0xb087('0x18')]?_0x17c6d0[_0xb087('0x18')][_0xb087('0x1c')]||null:null,'attributes':[[_0xb087('0x2c'),_0xb087('0x2d')],[db[_0xb087('0x1d')]['fn'](_0xb087('0x1e'),db[_0xb087('0x1d')][_0xb087('0x1f')]('id')),_0xb087('0x40')],[db[_0xb087('0x1d')]['fn'](_0xb087('0x1e'),db[_0xb087('0x1d')]['fn']('IF',db[_0xb087('0x1d')][_0xb087('0x21')](_0xb087('0x22')))),_0xb087('0x41')]],'group':[_0xb087('0x2c')]})[_0xb087('0xc')](function(_0x551274){logger[_0xb087('0xd')](_0xb087('0x3e'),_0x17c6d0);logger[_0xb087('0xf')]('GetCampaignHopperHistory',_0x17c6d0,JSON[_0xb087('0x11')](_0x551274));_0x269eda(_0x551274);})[_0xb087('0x1a')](function(_0x5685b1){logger[_0xb087('0x12')](_0xb087('0x3e'),_0x5685b1[_0xb087('0x14')],_0x17c6d0);_0x56410e(_0x4ad1b6['error'](0x1f4,_0x5685b1[_0xb087('0x14')]));});});}; \ No newline at end of file +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 diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index f02b464..34b6213 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 _0xc7b3=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','post','put','update','multer','util','connect-timeout','express','Router'];(function(_0x29d9d5,_0x5a1bd8){var _0x1be395=function(_0x54e84f){while(--_0x54e84f){_0x29d9d5['push'](_0x29d9d5['shift']());}};_0x1be395(++_0x5a1bd8);}(_0xc7b3,0x1c6));var _0x3c7b=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xc7b3[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require(_0x3c7b('0x0'));var util=require(_0x3c7b('0x1'));var path=require('path');var timeout=require(_0x3c7b('0x2'));var express=require(_0x3c7b('0x3'));var router=express[_0x3c7b('0x4')]();var auth=require(_0x3c7b('0x5'));var interaction=require(_0x3c7b('0x6'));var config=require(_0x3c7b('0x7'));var controller=require('./cmHopperHistory.controller');router[_0x3c7b('0x8')]('/',auth[_0x3c7b('0x9')](),controller[_0x3c7b('0xa')]);router['get'](_0x3c7b('0xb'),auth[_0x3c7b('0x9')](),controller['describe']);router[_0x3c7b('0x8')](_0x3c7b('0xc'),auth['isAuthenticated'](),controller[_0x3c7b('0xd')]);router[_0x3c7b('0xe')]('/',auth[_0x3c7b('0x9')](),controller['create']);router[_0x3c7b('0xf')]('/:id',auth[_0x3c7b('0x9')](),controller[_0x3c7b('0x10')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index f7be375..b77e468 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 _0x0e89=['STRING','sequelize','exports'];(function(_0x53c479,_0x5342ad){var _0xddc438=function(_0x41743e){while(--_0x41743e){_0x53c479['push'](_0x53c479['shift']());}};_0xddc438(++_0x5342ad);}(_0x0e89,0xa0));var _0x90e8=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x0e89[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0x90e8('0x0'));module[_0x90e8('0x1')]={'name':{'type':Sequelize[_0x90e8('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x90e8('0x2')]},'dialPrefix':{'type':Sequelize[_0x90e8('0x2')]}}; \ No newline at end of file +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 diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 63ec17e..3b55a49 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 _0xedd9=['end','json','count','offset','Content-Range','apply','save','update','then','destroy','get','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','include','rows','catch','show','params','length','includeAll','find','create','body','user','role','Lists','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','getDispositions','Disposition','findAll','removeDispositions','addContacts','CmContact','tags','isArray','join','push','omit','ids','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','cf_%d','raw','getContactsCsv','CustomFields','format','isEmpty','now','writeFileSync','setHeader','Content-disposition','list_%d_%s.csv','Content-type','download','/tmp/list_%d_%s.csv','addCustomField','addCustomFields','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','findOne','findAndCountAll','addAgents','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','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','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status'];(function(_0x2b845e,_0x314c6e){var _0x1d26df=function(_0x41d314){while(--_0x41d314){_0x2b845e['push'](_0x2b845e['shift']());}};_0x1d26df(++_0x314c6e);}(_0xedd9,0xfc));var _0x9edd=function(_0x1a239c,_0x286efb){_0x1a239c=_0x1a239c-0x0;var _0x5bebd4=_0xedd9[_0x1a239c];return _0x5bebd4;};'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'];config[_0x9edd('0x17')]=_[_0x9edd('0x18')](config[_0x9edd('0x17')],{'host':_0x9edd('0x19'),'port':0x18eb});var socket=require(_0x9edd('0x1a'))(new Redis(config[_0x9edd('0x17')]));require('./cmList.socket')[_0x9edd('0x1b')](socket);function respondWithStatusCode(_0x44fc7c,_0x891832){_0x891832=_0x891832||0xcc;return function(_0x4d9a7){if(_0x4d9a7){return _0x44fc7c[_0x9edd('0x1c')](_0x891832);}return _0x44fc7c[_0x9edd('0x1d')](_0x891832)[_0x9edd('0x1e')]();};}function respondWithResult(_0x75a4ab,_0x4ea60f){_0x4ea60f=_0x4ea60f||0xc8;return function(_0x5f5bf4){if(_0x5f5bf4){return _0x75a4ab[_0x9edd('0x1d')](_0x4ea60f)[_0x9edd('0x1f')](_0x5f5bf4);}};}function respondWithFilteredResult(_0x5acf65,_0x1b54c0){return function(_0x35f454){if(_0x35f454){var _0x40ba32=_0x35f454[_0x9edd('0x20')],_0x4d8f33=_0x1b54c0[_0x9edd('0x21')],_0x43dc70=_0x1b54c0['offset']+_0x1b54c0['limit'],_0x5d879c;if(_0x43dc70>=_0x40ba32){_0x43dc70=_0x40ba32;_0x5d879c=0xc8;}else{_0x5d879c=0xce;}_0x5acf65[_0x9edd('0x1d')](_0x5d879c);return _0x5acf65['set'](_0x9edd('0x22'),_0x4d8f33+'-'+_0x43dc70+'/'+_0x40ba32)['json'](_0x35f454);}return null;};}function patchUpdates(_0x535f37){return function(_0x356751){try{jsonpatch[_0x9edd('0x23')](_0x356751,_0x535f37,!![]);}catch(_0x4fb7bf){return BPromise['reject'](_0x4fb7bf);}return _0x356751[_0x9edd('0x24')]();};}function saveUpdates(_0x186186,_0x477878){return function(_0x542172){if(_0x542172){return _0x542172[_0x9edd('0x25')](_0x186186)[_0x9edd('0x26')](function(_0x44a6c1){return _0x44a6c1;});}return null;};}function removeEntity(_0x2ca65f,_0x339a0d){return function(_0x4c75d2){if(_0x4c75d2){return _0x4c75d2[_0x9edd('0x27')]()[_0x9edd('0x26')](function(){var _0x3a1ea5=_0x4c75d2[_0x9edd('0x28')]({'plain':!![]});var _0x310a4d='Lists';return db['UserProfileResource'][_0x9edd('0x27')]({'where':{'type':_0x310a4d,'resourceId':_0x3a1ea5['id']}})[_0x9edd('0x26')](function(){return _0x4c75d2;});})[_0x9edd('0x26')](function(){_0x2ca65f[_0x9edd('0x1d')](0xcc)[_0x9edd('0x1e')]();});}};}function handleEntityNotFound(_0x4fe471,_0x57a2cc){return function(_0x214d0a){if(!_0x214d0a){_0x4fe471[_0x9edd('0x1c')](0x194);}return _0x214d0a;};}function handleError(_0x1c762c,_0x52746a){_0x52746a=_0x52746a||0x1f4;return function(_0x238b22){logger[_0x9edd('0x29')](_0x238b22[_0x9edd('0x2a')]);if(_0x238b22[_0x9edd('0x2b')]){delete _0x238b22['name'];}_0x1c762c[_0x9edd('0x1d')](_0x52746a)[_0x9edd('0x2c')](_0x238b22);};}exports[_0x9edd('0x2d')]=function(_0x12c1bc,_0xbbf08f){var _0x42e664={},_0x209aba={},_0x1fba7b={'count':0x0,'rows':[]};var _0x19b6c1=_[_0x9edd('0x2e')](db[_0x9edd('0x2f')][_0x9edd('0x30')],function(_0x6907a5){return{'name':_0x6907a5[_0x9edd('0x31')],'type':_0x6907a5[_0x9edd('0x32')]['key']};});_0x209aba[_0x9edd('0x33')]=_[_0x9edd('0x2e')](_0x19b6c1,_0x9edd('0x2b'));_0x209aba['query']=_[_0x9edd('0x34')](_0x12c1bc[_0x9edd('0x35')]);_0x209aba[_0x9edd('0x36')]=_[_0x9edd('0x37')](_0x209aba[_0x9edd('0x33')],_0x209aba[_0x9edd('0x35')]);_0x42e664[_0x9edd('0x38')]=_[_0x9edd('0x37')](_0x209aba[_0x9edd('0x33')],qs[_0x9edd('0x39')](_0x12c1bc[_0x9edd('0x35')][_0x9edd('0x39')]));_0x42e664[_0x9edd('0x38')]=_0x42e664[_0x9edd('0x38')]['length']?_0x42e664[_0x9edd('0x38')]:_0x209aba['model'];if(!_0x12c1bc[_0x9edd('0x35')][_0x9edd('0x3a')](_0x9edd('0x3b'))){_0x42e664[_0x9edd('0x3c')]=qs[_0x9edd('0x3c')](_0x12c1bc['query'][_0x9edd('0x3c')]);_0x42e664[_0x9edd('0x21')]=qs[_0x9edd('0x21')](_0x12c1bc[_0x9edd('0x35')][_0x9edd('0x21')]);}_0x42e664[_0x9edd('0x3d')]=qs[_0x9edd('0x3e')](_0x12c1bc[_0x9edd('0x35')][_0x9edd('0x3e')]);_0x42e664[_0x9edd('0x3f')]=qs['filters'](_[_0x9edd('0x40')](_0x12c1bc['query'],_0x209aba[_0x9edd('0x36')]));if(_0x12c1bc['query'][_0x9edd('0x41')]){_0x42e664[_0x9edd('0x3f')]=_[_0x9edd('0x42')](_0x42e664['where'],{'$or':_[_0x9edd('0x2e')](_0x19b6c1,function(_0xcbd0ef){if(_0xcbd0ef[_0x9edd('0x32')]!=='VIRTUAL'){var _0x1b5a43={};_0x1b5a43[_0xcbd0ef['name']]={'$like':'%'+_0x12c1bc[_0x9edd('0x35')][_0x9edd('0x41')]+'%'};return _0x1b5a43;}})});}_0x42e664=_['merge']({},_0x42e664,_0x12c1bc[_0x9edd('0x43')]);var _0x40fdfb={'where':_0x42e664[_0x9edd('0x3f')]};return db[_0x9edd('0x2f')]['count'](_0x40fdfb)[_0x9edd('0x26')](function(_0x5bbdf8){_0x1fba7b[_0x9edd('0x20')]=_0x5bbdf8;if(_0x12c1bc[_0x9edd('0x35')]['includeAll']){_0x42e664[_0x9edd('0x44')]=[{'all':!![]}];}return db['CmList']['findAll'](_0x42e664);})[_0x9edd('0x26')](function(_0x9cab86){_0x1fba7b[_0x9edd('0x45')]=_0x9cab86;return _0x1fba7b;})[_0x9edd('0x26')](respondWithFilteredResult(_0xbbf08f,_0x42e664))[_0x9edd('0x46')](handleError(_0xbbf08f,null));};exports[_0x9edd('0x47')]=function(_0x3ff512,_0x75efbe){var _0x18c149={'raw':![],'where':{'id':_0x3ff512[_0x9edd('0x48')]['id']}},_0x2b081a={};_0x2b081a[_0x9edd('0x33')]=_[_0x9edd('0x34')](db[_0x9edd('0x2f')][_0x9edd('0x30')]);_0x2b081a['query']=_[_0x9edd('0x34')](_0x3ff512[_0x9edd('0x35')]);_0x2b081a[_0x9edd('0x36')]=_[_0x9edd('0x37')](_0x2b081a[_0x9edd('0x33')],_0x2b081a[_0x9edd('0x35')]);_0x18c149[_0x9edd('0x38')]=_['intersection'](_0x2b081a['model'],qs['fields'](_0x3ff512[_0x9edd('0x35')]['fields']));_0x18c149[_0x9edd('0x38')]=_0x18c149[_0x9edd('0x38')][_0x9edd('0x49')]?_0x18c149[_0x9edd('0x38')]:_0x2b081a[_0x9edd('0x33')];if(_0x3ff512['query'][_0x9edd('0x4a')]){_0x18c149[_0x9edd('0x44')]=[{'all':!![]}];}_0x18c149=_[_0x9edd('0x42')]({},_0x18c149,_0x3ff512['options']);return db[_0x9edd('0x2f')][_0x9edd('0x4b')](_0x18c149)[_0x9edd('0x26')](handleEntityNotFound(_0x75efbe,null))[_0x9edd('0x26')](respondWithResult(_0x75efbe,null))[_0x9edd('0x46')](handleError(_0x75efbe,null));};exports[_0x9edd('0x4c')]=function(_0x4d4f33,_0x441e4a){return db[_0x9edd('0x2f')]['create'](_0x4d4f33[_0x9edd('0x4d')],{})[_0x9edd('0x26')](function(_0x4bb324){var _0x2bd089=_0x4d4f33[_0x9edd('0x4e')][_0x9edd('0x28')]({'plain':!![]});if(!_0x2bd089)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2bd089[_0x9edd('0x4f')]===_0x9edd('0x4e')){var _0x317a60=_0x4bb324[_0x9edd('0x28')]({'plain':!![]});var _0x53f6e3=_0x9edd('0x50');return db[_0x9edd('0x51')][_0x9edd('0x4b')]({'where':{'name':_0x53f6e3,'userProfileId':_0x2bd089['userProfileId']},'raw':!![]})[_0x9edd('0x26')](function(_0x21f6ce){if(_0x21f6ce&&_0x21f6ce['autoAssociation']===0x0){return db[_0x9edd('0x52')]['create']({'name':_0x317a60[_0x9edd('0x2b')],'resourceId':_0x317a60['id'],'type':_0x21f6ce[_0x9edd('0x2b')],'sectionId':_0x21f6ce['id']},{})[_0x9edd('0x26')](function(){return _0x4bb324;});}else{return _0x4bb324;}})[_0x9edd('0x46')](function(_0x1e3c19){logger[_0x9edd('0x29')](_0x9edd('0x53'),_0x1e3c19);throw _0x1e3c19;});}return _0x4bb324;})[_0x9edd('0x26')](respondWithResult(_0x441e4a,0xc9))[_0x9edd('0x46')](handleError(_0x441e4a,null));};exports[_0x9edd('0x25')]=function(_0x31272d,_0x5a3b1d){if(_0x31272d[_0x9edd('0x4d')]['id']){delete _0x31272d[_0x9edd('0x4d')]['id'];}return db[_0x9edd('0x2f')]['find']({'where':{'id':_0x31272d[_0x9edd('0x48')]['id']}})['then'](handleEntityNotFound(_0x5a3b1d,null))['then'](saveUpdates(_0x31272d['body'],null))[_0x9edd('0x26')](respondWithResult(_0x5a3b1d,null))[_0x9edd('0x46')](handleError(_0x5a3b1d,null));};exports[_0x9edd('0x27')]=function(_0x35ddb3,_0x48a900){return db['CmList']['find']({'where':{'id':_0x35ddb3[_0x9edd('0x48')]['id']}})[_0x9edd('0x26')](handleEntityNotFound(_0x48a900,null))[_0x9edd('0x26')](removeEntity(_0x48a900,null))[_0x9edd('0x46')](handleError(_0x48a900,null));};exports[_0x9edd('0x54')]=function(_0x41ec97,_0x25906c){return db[_0x9edd('0x2f')]['describe']()[_0x9edd('0x26')](respondWithResult(_0x25906c,null))['catch'](handleError(_0x25906c,null));};exports[_0x9edd('0x55')]=function(_0x6a1cfc,_0x4b7e68,_0x22b91a){if(_0x6a1cfc[_0x9edd('0x4d')]['id']){delete _0x6a1cfc[_0x9edd('0x4d')]['id'];}return db['CmList'][_0x9edd('0x4b')]({'where':{'id':_0x6a1cfc[_0x9edd('0x48')]['id']}})[_0x9edd('0x26')](handleEntityNotFound(_0x4b7e68,null))[_0x9edd('0x26')](function(_0x1720b1){if(_0x1720b1){_0x6a1cfc[_0x9edd('0x4d')]['ListId']=_0x1720b1['id'];return db['Disposition'][_0x9edd('0x4c')](_0x6a1cfc['body']);}})[_0x9edd('0x26')](respondWithResult(_0x4b7e68,null))[_0x9edd('0x46')](handleError(_0x4b7e68,null));};exports[_0x9edd('0x56')]=function(_0x17d2f2,_0x5df1d7,_0x21ead2){var _0x507cce={'raw':![],'where':{}};var _0x3e5dca={};var _0x344692={'count':0x0,'rows':[]};return db[_0x9edd('0x2f')]['findOne']({'where':{'id':_0x17d2f2[_0x9edd('0x48')]['id']}})['then'](handleEntityNotFound(_0x5df1d7,null))[_0x9edd('0x26')](function(_0x4e1eda){if(_0x4e1eda){_0x3e5dca['model']=_[_0x9edd('0x34')](db['Disposition'][_0x9edd('0x30')]);_0x3e5dca[_0x9edd('0x35')]=_[_0x9edd('0x34')](_0x17d2f2['query']);_0x3e5dca[_0x9edd('0x36')]=_[_0x9edd('0x37')](_0x3e5dca[_0x9edd('0x33')],_0x3e5dca[_0x9edd('0x35')]);_0x507cce[_0x9edd('0x38')]=_['intersection'](_0x3e5dca['model'],qs[_0x9edd('0x39')](_0x17d2f2[_0x9edd('0x35')]['fields']));_0x507cce['attributes']=_0x507cce['attributes'][_0x9edd('0x49')]?_0x507cce['attributes']:_0x3e5dca['model'];if(!_0x17d2f2[_0x9edd('0x35')][_0x9edd('0x3a')]('nolimit')){_0x507cce[_0x9edd('0x3c')]=qs[_0x9edd('0x3c')](_0x17d2f2[_0x9edd('0x35')]['limit']);_0x507cce[_0x9edd('0x21')]=qs['offset'](_0x17d2f2[_0x9edd('0x35')][_0x9edd('0x21')]);}_0x507cce['order']=qs[_0x9edd('0x3e')](_0x17d2f2[_0x9edd('0x35')]['sort']);_0x507cce[_0x9edd('0x3f')]=qs[_0x9edd('0x36')](_[_0x9edd('0x40')](_0x17d2f2[_0x9edd('0x35')],_0x3e5dca['filters']));_0x507cce[_0x9edd('0x3f')]['ListId']=_0x4e1eda['id'];if(_0x17d2f2[_0x9edd('0x35')][_0x9edd('0x41')]){_0x507cce[_0x9edd('0x3f')]=_['merge'](_0x507cce[_0x9edd('0x3f')],{'$or':_[_0x9edd('0x2e')](_0x507cce[_0x9edd('0x38')],function(_0x383cb9){var _0x25626a={};_0x25626a[_0x383cb9]={'$like':'%'+_0x17d2f2[_0x9edd('0x35')][_0x9edd('0x41')]+'%'};return _0x25626a;})});}_0x507cce=_['merge']({},_0x507cce,_0x17d2f2['options']);return db[_0x9edd('0x57')][_0x9edd('0x20')]({'where':_0x507cce[_0x9edd('0x3f')]})[_0x9edd('0x26')](function(_0x1e2126){_0x344692['count']=_0x1e2126;if(_0x17d2f2[_0x9edd('0x35')][_0x9edd('0x4a')]){_0x507cce[_0x9edd('0x44')]=[{'all':!![]}];}return db['Disposition'][_0x9edd('0x58')](_0x507cce);})[_0x9edd('0x26')](function(_0x4b1c12){_0x344692[_0x9edd('0x45')]=_0x4b1c12;return _0x344692;});}})[_0x9edd('0x26')](respondWithFilteredResult(_0x5df1d7,_0x507cce))['catch'](handleError(_0x5df1d7,null));};exports[_0x9edd('0x59')]=function(_0x1e2de6,_0x566be7,_0x3f08ac){return db['CmList']['find']({'where':{'id':_0x1e2de6[_0x9edd('0x48')]['id']}})[_0x9edd('0x26')](handleEntityNotFound(_0x566be7,null))[_0x9edd('0x26')](function(_0x5b56c7){if(_0x5b56c7){return _0x5b56c7[_0x9edd('0x59')](_0x1e2de6[_0x9edd('0x35')]['ids']);}})[_0x9edd('0x26')](respondWithStatusCode(_0x566be7,null))[_0x9edd('0x46')](handleError(_0x566be7,null));};exports[_0x9edd('0x5a')]=function(_0x1ad198,_0x54ac71,_0x5e68db){return db[_0x9edd('0x2f')]['find']({'where':{'id':_0x1ad198[_0x9edd('0x48')]['id']}})[_0x9edd('0x26')](handleEntityNotFound(_0x54ac71,null))[_0x9edd('0x26')](function(_0x3cfd35){if(_0x3cfd35){var _0x195921=[];var _0x4786f8={'success':[],'errors':[]};return db[_0x9edd('0x5b')][_0x9edd('0x54')]()[_0x9edd('0x26')](function(_0x554241){if(_0x1ad198[_0x9edd('0x4d')][_0x9edd('0x5c')]&&_[_0x9edd('0x5d')](_0x1ad198[_0x9edd('0x4d')][_0x9edd('0x5c')])){if(_0x1ad198[_0x9edd('0x4d')][_0x9edd('0x5c')]['length']){_0x1ad198[_0x9edd('0x4d')][_0x9edd('0x5c')]=_0x1ad198['body'][_0x9edd('0x5c')][_0x9edd('0x5e')](';')+';';}else{_0x1ad198['body'][_0x9edd('0x5c')]=null;}}else{_0x1ad198[_0x9edd('0x4d')][_0x9edd('0x5c')]=null;}if(_0x1ad198['body']&&_[_0x9edd('0x5d')](_0x1ad198[_0x9edd('0x4d')])){for(var _0x3f04d3=0x0;_0x3f04d3<_0x1ad198['body']['length'];_0x3f04d3+=0x1){_0x1ad198['body'][_0x3f04d3]['ListId']=_0x1ad198[_0x9edd('0x48')]['id'];_0x195921[_0x9edd('0x5f')](_0x1ad198[_0x9edd('0x4d')][_0x3f04d3]);}return BPromise['each'](_0x195921,function(_0x53e141){return db['CmContact'][_0x9edd('0x4c')](_[_0x9edd('0x60')](_0x53e141,[_0x9edd('0x61'),'id'])||{},{'fields':_[_0x9edd('0x34')](_0x554241),'raw':!![]})[_0x9edd('0x26')](function(_0x18b25e){_0x4786f8[_0x9edd('0x62')][_0x9edd('0x5f')](_0x18b25e[_0x9edd('0x63')]);})[_0x9edd('0x46')](function(_0x2523b5){_0x4786f8[_0x9edd('0x64')]['push']({'data':_0x53e141,'error':_0x2523b5[_0x9edd('0x65')]});});})[_0x9edd('0x26')](function(_0x33b5dc){return _0x4786f8;})[_0x9edd('0x46')](function(_0x104afc){return _0x104afc;});}else{_0x54ac71[_0x9edd('0x1d')](0x190)[_0x9edd('0x1f')]({'message':_0x9edd('0x66')});}});}})['then'](respondWithResult(_0x54ac71,null))['catch'](handleError(_0x54ac71,null));};exports[_0x9edd('0x67')]=function(_0x4ec836,_0x35950b,_0x4a685e){var _0x21c35f;return db[_0x9edd('0x2f')]['find']({'where':{'id':_0x4ec836[_0x9edd('0x48')]['id']},'include':[{'model':db[_0x9edd('0x68')],'as':'CustomFields'}]})[_0x9edd('0x26')](handleEntityNotFound(_0x35950b,null))[_0x9edd('0x26')](function(_0x42d546){if(_0x42d546){_0x21c35f=_0x42d546;return db[_0x9edd('0x5b')][_0x9edd('0x30')];}})['then'](function(_0x33a077){if(_0x33a077){var _0x3ff07e={};var _0x3ec531={};_0x3ec531[_0x9edd('0x33')]=_[_0x9edd('0x69')](_['keys'](_0x33a077),_['map'](_0x21c35f['CustomFields'],function(_0x50316a){return util['format'](_0x9edd('0x6a'),_0x50316a['id']);}));_0x3ec531['query']=_['keys'](_0x4ec836[_0x9edd('0x35')]);_0x3ec531[_0x9edd('0x36')]=_[_0x9edd('0x37')](_0x3ec531[_0x9edd('0x33')],_0x3ec531[_0x9edd('0x35')]);_0x3ff07e[_0x9edd('0x38')]=_[_0x9edd('0x37')](_0x3ec531[_0x9edd('0x33')],qs[_0x9edd('0x39')](_0x4ec836[_0x9edd('0x35')]['fields']));_0x3ff07e[_0x9edd('0x38')]=_0x3ff07e[_0x9edd('0x38')][_0x9edd('0x49')]?_0x3ff07e[_0x9edd('0x38')]:_0x3ec531[_0x9edd('0x33')];if(!_0x4ec836[_0x9edd('0x35')][_0x9edd('0x3a')](_0x9edd('0x3b'))){_0x3ff07e['limit']=qs['limit'](_0x4ec836[_0x9edd('0x35')][_0x9edd('0x3c')]);_0x3ff07e[_0x9edd('0x21')]=qs[_0x9edd('0x21')](_0x4ec836[_0x9edd('0x35')][_0x9edd('0x21')]);}_0x3ff07e[_0x9edd('0x3d')]=qs[_0x9edd('0x3e')](_0x4ec836[_0x9edd('0x35')][_0x9edd('0x3e')]);_0x3ff07e[_0x9edd('0x3f')]=qs[_0x9edd('0x36')](_[_0x9edd('0x40')](_0x4ec836[_0x9edd('0x35')],_0x3ec531['filters']));_0x3ff07e[_0x9edd('0x6b')]=!![];if(_0x4ec836[_0x9edd('0x35')]['filter']){_0x3ff07e[_0x9edd('0x3f')]=_[_0x9edd('0x42')](_0x3ff07e[_0x9edd('0x3f')],{'$or':_[_0x9edd('0x2e')](_0x3ff07e['attributes'],function(_0x3429b6){var _0x398c34={};_0x398c34[_0x3429b6]={'$like':'%'+_0x4ec836[_0x9edd('0x35')][_0x9edd('0x41')]+'%'};return _0x398c34;})});}_0x3ff07e=_[_0x9edd('0x42')]({},_0x3ff07e,_0x4ec836['options']);return _0x21c35f[_0x9edd('0x67')](_0x3ff07e);}})[_0x9edd('0x26')](respondWithResult(_0x35950b,null))[_0x9edd('0x46')](handleError(_0x35950b,null));};exports[_0x9edd('0x6c')]=function(_0xa8d944,_0x59927d,_0x4d0734){var _0x2f8ce1;return db['CmList'][_0x9edd('0x4b')]({'where':{'id':_0xa8d944['params']['id']},'include':[{'model':db[_0x9edd('0x68')],'as':_0x9edd('0x6d')}]})[_0x9edd('0x26')](handleEntityNotFound(_0x59927d,null))[_0x9edd('0x26')](function(_0x2c7245){if(_0x2c7245){_0x2f8ce1=_0x2c7245;return db[_0x9edd('0x5b')]['rawAttributes'];}})[_0x9edd('0x26')](function(_0x33beb7){if(_0x33beb7){var _0x3aae72={};var _0x39d6dd={};_0x39d6dd[_0x9edd('0x33')]=_[_0x9edd('0x69')](_[_0x9edd('0x34')](_0x33beb7),_[_0x9edd('0x2e')](_0x2f8ce1['CustomFields'],function(_0x195088){return util[_0x9edd('0x6e')](_0x9edd('0x6a'),_0x195088['id']);}));_0x39d6dd[_0x9edd('0x35')]=_[_0x9edd('0x34')](_0xa8d944[_0x9edd('0x35')]);_0x39d6dd[_0x9edd('0x36')]=_[_0x9edd('0x37')](_0x39d6dd[_0x9edd('0x33')],_0x39d6dd[_0x9edd('0x35')]);_0x3aae72[_0x9edd('0x38')]=_[_0x9edd('0x37')](_0x39d6dd[_0x9edd('0x33')],qs[_0x9edd('0x39')](_0xa8d944[_0x9edd('0x35')][_0x9edd('0x39')]));_0x3aae72[_0x9edd('0x38')]=_0x3aae72[_0x9edd('0x38')][_0x9edd('0x49')]?_0x3aae72[_0x9edd('0x38')]:_0x39d6dd[_0x9edd('0x33')];if(!_0xa8d944['query'][_0x9edd('0x3a')]('nolimit')){_0x3aae72['limit']=qs[_0x9edd('0x3c')](_0xa8d944[_0x9edd('0x35')][_0x9edd('0x3c')]);_0x3aae72[_0x9edd('0x21')]=qs[_0x9edd('0x21')](_0xa8d944[_0x9edd('0x35')][_0x9edd('0x21')]);}_0x3aae72[_0x9edd('0x3d')]=qs[_0x9edd('0x3e')](_0xa8d944[_0x9edd('0x35')]['sort']);_0x3aae72[_0x9edd('0x3f')]=qs[_0x9edd('0x36')](_['pick'](_0xa8d944['query'],_0x39d6dd[_0x9edd('0x36')]));_0x3aae72[_0x9edd('0x6b')]=!![];if(_0xa8d944[_0x9edd('0x35')][_0x9edd('0x41')]){_0x3aae72['where']=_['merge'](_0x3aae72[_0x9edd('0x3f')],{'$or':_['map'](_0x3aae72[_0x9edd('0x38')],function(_0x24a9d1){var _0x3e2404={};_0x3e2404[_0x24a9d1]={'$like':'%'+_0xa8d944['query']['filter']+'%'};return _0x3e2404;})});}_0x3aae72=_['merge']({},_0x3aae72,_0xa8d944[_0x9edd('0x43')]);return _0x2f8ce1[_0x9edd('0x67')](_0x3aae72);}})[_0x9edd('0x26')](function(_0x5bfbfd){if(!_[_0x9edd('0x6f')](_0x5bfbfd)){var _0x402574=toCsv(_0x5bfbfd);var _0x4f12b9=Date[_0x9edd('0x70')]();fs[_0x9edd('0x71')](util['format']('/tmp/list_%d_%s.csv',_0x2f8ce1['id'],_0x4f12b9),_0x402574);_0x59927d[_0x9edd('0x72')](_0x9edd('0x73'),'attachment;\x20filename='+util[_0x9edd('0x6e')](_0x9edd('0x74'),_0x2f8ce1['id'],_0x4f12b9));_0x59927d['setHeader'](_0x9edd('0x75'),'text/csv');return _0x59927d[_0x9edd('0x76')](util[_0x9edd('0x6e')](_0x9edd('0x77'),_0x2f8ce1['id'],_0x4f12b9));}else{return _0x59927d[_0x9edd('0x1c')](0xcc);}})[_0x9edd('0x46')](handleError(_0x59927d,null));};exports[_0x9edd('0x78')]=function(_0x58bc3c,_0x2fe810,_0x22aa2b){var _0x68047e;delete _0x58bc3c['body']['id'];return db[_0x9edd('0x2f')]['findOne']({'where':{'id':_0x58bc3c[_0x9edd('0x48')]['id']}})[_0x9edd('0x26')](handleEntityNotFound(_0x2fe810,null))[_0x9edd('0x26')](function(_0x41b0ea){if(_0x41b0ea){return db['sequelize']['transaction'](function(_0x4e9242){return db[_0x9edd('0x68')][_0x9edd('0x4c')](_0x58bc3c[_0x9edd('0x4d')],{'transaction':_0x4e9242})['then'](function(_0x41a761){_0x68047e=_0x41a761;return _0x41b0ea[_0x9edd('0x79')](_0x41a761,{'transaction':_0x4e9242});})[_0x9edd('0x26')](function(){var _0xb66eaf={'type':db[_0x9edd('0x7a')][_0x9edd('0x7b')],'transaction':_0x4e9242};switch(_0x58bc3c['body']['type']){case _0x9edd('0x7c'):_0xb66eaf[_0x9edd('0x32')]=db[_0x9edd('0x7a')]['TEXT'];break;case _0x9edd('0x7d'):_0xb66eaf[_0x9edd('0x32')]=db[_0x9edd('0x7a')][_0x9edd('0x7e')];break;case'switch':_0xb66eaf[_0x9edd('0x32')]=db['Sequelize'][_0x9edd('0x7f')];_0xb66eaf[_0x9edd('0x80')]=![];break;default:}return db[_0x9edd('0x81')][_0x9edd('0x82')][_0x9edd('0x83')]('cm_contacts',util[_0x9edd('0x6e')]('cf_%s',_0x68047e['id']),_0xb66eaf);})[_0x9edd('0x26')](function(){return _0x68047e;});});}})['then'](respondWithResult(_0x2fe810,null))[_0x9edd('0x46')](handleError(_0x2fe810,null));};exports['getCustomFields']=function(_0x363c5c,_0x96e3d7,_0x3bc495){var _0x575377={};var _0x244dce={};var _0x7512ea;var _0x1c5038;return db[_0x9edd('0x2f')][_0x9edd('0x84')]({'where':{'id':_0x363c5c[_0x9edd('0x48')]['id']}})[_0x9edd('0x26')](handleEntityNotFound(_0x96e3d7,null))[_0x9edd('0x26')](function(_0x365b27){if(_0x365b27){_0x7512ea=_0x365b27;_0x244dce[_0x9edd('0x33')]=_[_0x9edd('0x34')](db[_0x9edd('0x68')][_0x9edd('0x30')]);_0x244dce[_0x9edd('0x35')]=_[_0x9edd('0x34')](_0x363c5c[_0x9edd('0x35')]);_0x244dce[_0x9edd('0x36')]=_[_0x9edd('0x37')](_0x244dce[_0x9edd('0x33')],_0x244dce[_0x9edd('0x35')]);_0x575377[_0x9edd('0x38')]=_[_0x9edd('0x37')](_0x244dce['model'],qs[_0x9edd('0x39')](_0x363c5c['query'][_0x9edd('0x39')]));_0x575377[_0x9edd('0x38')]=_0x575377[_0x9edd('0x38')][_0x9edd('0x49')]?_0x575377[_0x9edd('0x38')]:_0x244dce['model'];_0x575377[_0x9edd('0x3d')]=qs['sort'](_0x363c5c[_0x9edd('0x35')][_0x9edd('0x3e')]);_0x575377[_0x9edd('0x3f')]=qs[_0x9edd('0x36')](_[_0x9edd('0x40')](_0x363c5c[_0x9edd('0x35')],_0x244dce['filters']));_0x575377[_0x9edd('0x3f')]=_[_0x9edd('0x42')](_0x575377['where'],{'$or':[{'ListId':_0x365b27['id']},{'ListId':null}]});if(_0x363c5c['query']['filter']){_0x575377['where']=_[_0x9edd('0x42')](_0x575377[_0x9edd('0x3f')],{'$or':_[_0x9edd('0x2e')](_0x575377[_0x9edd('0x38')],function(_0x239774){var _0x229a92={};_0x229a92[_0x239774]={'$like':'%'+_0x363c5c[_0x9edd('0x35')][_0x9edd('0x41')]+'%'};return _0x229a92;})});}_0x575377=_[_0x9edd('0x42')]({},_0x575377,_0x363c5c[_0x9edd('0x43')]);return db['CmCustomField'][_0x9edd('0x85')](_0x575377);}})['then'](respondWithResult(_0x96e3d7,null))['catch'](handleError(_0x96e3d7,null));};exports[_0x9edd('0x86')]=function(_0x2dafd2,_0x35e9b9,_0x42a142){return db[_0x9edd('0x2f')]['find']({'where':{'id':_0x2dafd2[_0x9edd('0x48')]['id']}})[_0x9edd('0x26')](handleEntityNotFound(_0x35e9b9,null))[_0x9edd('0x26')](function(_0x181469){if(_0x181469){return _0x181469['addAgents'](_0x2dafd2[_0x9edd('0x4d')][_0x9edd('0x61')],_[_0x9edd('0x60')](_0x2dafd2[_0x9edd('0x4d')],[_0x9edd('0x61'),'id'])||{})[_0x9edd('0x87')](function(_0x55052b){for(var _0x9ff2d3=0x0;_0x9ff2d3<_0x2dafd2[_0x9edd('0x4d')][_0x9edd('0x61')][_0x9edd('0x49')];_0x9ff2d3+=0x1){socket['emit'](_0x9edd('0x88'),{'UserId':_0x2dafd2[_0x9edd('0x4d')][_0x9edd('0x61')][_0x9ff2d3],'CmListId':_0x2dafd2[_0x9edd('0x48')]['id']});}return _0x55052b;});}})[_0x9edd('0x26')](respondWithResult(_0x35e9b9,null))[_0x9edd('0x46')](handleError(_0x35e9b9,null));};exports[_0x9edd('0x89')]=function(_0x39e3b3,_0x4a3955,_0x4a19a0){return db['CmList'][_0x9edd('0x4b')]({'where':{'id':_0x39e3b3[_0x9edd('0x48')]['id']}})[_0x9edd('0x26')](handleEntityNotFound(_0x4a3955,null))[_0x9edd('0x26')](function(_0x223c42){if(_0x223c42){return _0x223c42[_0x9edd('0x89')](_0x39e3b3[_0x9edd('0x35')][_0x9edd('0x61')])[_0x9edd('0x26')](function(){if(_[_0x9edd('0x5d')](_0x39e3b3['query'][_0x9edd('0x61')])){for(var _0x56dc7e=0x0;_0x56dc7e<_0x39e3b3['query'][_0x9edd('0x61')][_0x9edd('0x49')];_0x56dc7e+=0x1){socket[_0x9edd('0x8a')]('userCmList:remove',{'UserId':Number(_0x39e3b3['query']['ids'][_0x56dc7e]),'CmListId':Number(_0x39e3b3['params']['id'])});}}else{socket['emit'](_0x9edd('0x8b'),{'UserId':Number(_0x39e3b3[_0x9edd('0x35')][_0x9edd('0x61')]),'CmListId':Number(_0x39e3b3['params']['id'])});}});}})[_0x9edd('0x26')](respondWithStatusCode(_0x4a3955,null))[_0x9edd('0x46')](handleError(_0x4a3955,null));};exports[_0x9edd('0x8c')]=function(_0x557156,_0x2c2f00,_0x4afe0b){var _0x16a1c8={};var _0x1a2376={};var _0xc84fb7;var _0x259d33;return db['CmList'][_0x9edd('0x84')]({'where':{'id':_0x557156[_0x9edd('0x48')]['id']}})['then'](handleEntityNotFound(_0x2c2f00,null))[_0x9edd('0x26')](function(_0x36e825){if(_0x36e825){_0xc84fb7=_0x36e825;_0x1a2376[_0x9edd('0x33')]=_[_0x9edd('0x34')](db['User'][_0x9edd('0x30')]);_0x1a2376[_0x9edd('0x35')]=_[_0x9edd('0x34')](_0x557156[_0x9edd('0x35')]);_0x1a2376[_0x9edd('0x36')]=_[_0x9edd('0x37')](_0x1a2376[_0x9edd('0x33')],_0x1a2376['query']);_0x16a1c8[_0x9edd('0x38')]=_['intersection'](_0x1a2376[_0x9edd('0x33')],qs[_0x9edd('0x39')](_0x557156['query'][_0x9edd('0x39')]));_0x16a1c8[_0x9edd('0x38')]=_0x16a1c8[_0x9edd('0x38')]['length']?_0x16a1c8[_0x9edd('0x38')]:_0x1a2376[_0x9edd('0x33')];_0x16a1c8[_0x9edd('0x3d')]=qs['sort'](_0x557156[_0x9edd('0x35')]['sort']);_0x16a1c8[_0x9edd('0x3f')]=qs[_0x9edd('0x36')](_[_0x9edd('0x40')](_0x557156[_0x9edd('0x35')],_0x1a2376['filters']));if(_0x557156['query'][_0x9edd('0x41')]){_0x16a1c8[_0x9edd('0x3f')]=_[_0x9edd('0x42')](_0x16a1c8[_0x9edd('0x3f')],{'$or':_[_0x9edd('0x2e')](_0x16a1c8['attributes'],function(_0x1a1938){var _0x235762={};_0x235762[_0x1a1938]={'$like':'%'+_0x557156[_0x9edd('0x35')][_0x9edd('0x41')]+'%'};return _0x235762;})});}_0x16a1c8=_[_0x9edd('0x42')]({},_0x16a1c8,_0x557156[_0x9edd('0x43')]);return _0xc84fb7[_0x9edd('0x8c')](_0x16a1c8);}})[_0x9edd('0x26')](function(_0x3173fa){if(_0x3173fa){_0x259d33=_0x3173fa[_0x9edd('0x49')];if(!_0x557156[_0x9edd('0x35')][_0x9edd('0x3a')](_0x9edd('0x3b'))){_0x16a1c8['limit']=qs[_0x9edd('0x3c')](_0x557156[_0x9edd('0x35')][_0x9edd('0x3c')]);_0x16a1c8[_0x9edd('0x21')]=qs['offset'](_0x557156[_0x9edd('0x35')][_0x9edd('0x21')]);}return _0xc84fb7[_0x9edd('0x8c')](_0x16a1c8);}})['then'](function(_0x910adf){if(_0x910adf){return _0x910adf?{'count':_0x259d33,'rows':_0x910adf}:null;}})['then'](respondWithResult(_0x2c2f00,null))['catch'](handleError(_0x2c2f00,null));}; \ No newline at end of file +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 diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 6884e4a..a2b66b5 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 _0x096a=['hook','exports','events','../../mysqldb','CmList','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x467410,_0x298552){var _0x39fd58=function(_0x100fe4){while(--_0x100fe4){_0x467410['push'](_0x467410['shift']());}};_0x39fd58(++_0x298552);}(_0x096a,0x18e));var _0xa096=function(_0x372c7f,_0xa064de){_0x372c7f=_0x372c7f-0x0;var _0x3b7370=_0x096a[_0x372c7f];return _0x3b7370;};'use strict';var EventEmitter=require(_0xa096('0x0'));var CmList=require(_0xa096('0x1'))['db'][_0xa096('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xa096('0x3')](0x0);var events={'afterCreate':_0xa096('0x4'),'afterUpdate':_0xa096('0x5'),'afterDestroy':_0xa096('0x6')};function emitEvent(_0x423bcb){return function(_0x590251,_0x633059,_0x2e3a47){CmListEvents[_0xa096('0x7')](_0x423bcb+':'+_0x590251['id'],_0x590251);CmListEvents[_0xa096('0x7')](_0x423bcb,_0x590251);_0x2e3a47(null);};}for(var e in events){if(events[_0xa096('0x8')](e)){var event=events[e];CmList[_0xa096('0x9')](e,emitEvent(event));}}module[_0xa096('0xa')]=CmListEvents; \ No newline at end of file +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 diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 98ff8d4..d2d1d7e 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 _0xfbaf=['CmList','cm_lists','lodash','../../config/logger','api','moment','path','rimraf','./cmList.attributes','exports'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xfbaf,0x11a));var _0xffba=function(_0x13d14f,_0x39dcc5){_0x13d14f=_0x13d14f-0x0;var _0x35bdf5=_0xfbaf[_0x13d14f];return _0x35bdf5;};'use strict';var _=require(_0xffba('0x0'));var util=require('util');var logger=require(_0xffba('0x1'))(_0xffba('0x2'));var moment=require(_0xffba('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xffba('0x4'));var rimraf=require(_0xffba('0x5'));var config=require('../../config/environment');var attributes=require(_0xffba('0x6'));module[_0xffba('0x7')]=function(_0xcac8e6,_0x31e996){return _0xcac8e6['define'](_0xffba('0x8'),attributes,{'tableName':_0xffba('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 2a4f65f..ea38cd6 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 _0x1cbe=['CmList,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','redis','localhost','socket.io-emitter','register','request','then','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x5a488c,_0x4cc470){var _0x53a7d6=function(_0x43a0d8){while(--_0x43a0d8){_0x5a488c['push'](_0x5a488c['shift']());}};_0x53a7d6(++_0x4cc470);}(_0x1cbe,0x109));var _0xe1cb=function(_0x1ab54f,_0xc90b70){_0x1ab54f=_0x1ab54f-0x0;var _0x96405c=_0x1cbe[_0x1ab54f];return _0x96405c;};'use strict';var _=require(_0xe1cb('0x0'));var util=require(_0xe1cb('0x1'));var moment=require(_0xe1cb('0x2'));var BPromise=require(_0xe1cb('0x3'));var rs=require(_0xe1cb('0x4'));var fs=require('fs');var Redis=require(_0xe1cb('0x5'));var db=require(_0xe1cb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe1cb('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe1cb('0x8')]['http']({'port':0x232a});config[_0xe1cb('0x9')]=_['defaults'](config[_0xe1cb('0x9')],{'host':_0xe1cb('0xa'),'port':0x18eb});var socket=require(_0xe1cb('0xb'))(new Redis(config[_0xe1cb('0x9')]));require('./cmList.socket')[_0xe1cb('0xc')](socket);function respondWithRpcPromise(_0x243a8d,_0x34bcb8,_0x5b7f26){return new BPromise(function(_0x6d3141,_0x372803){return client[_0xe1cb('0xd')](_0x243a8d,_0x5b7f26)[_0xe1cb('0xe')](function(_0x46dd2a){logger['info']('CmList,\x20%s,\x20%s',_0x34bcb8,'request\x20sent');logger[_0xe1cb('0xf')](_0xe1cb('0x10'),_0x34bcb8,_0xe1cb('0x11'),JSON[_0xe1cb('0x12')](_0x46dd2a));if(_0x46dd2a['error']){if(_0x46dd2a[_0xe1cb('0x13')][_0xe1cb('0x14')]===0x1f4){logger['error'](_0xe1cb('0x15'),_0x34bcb8,_0x46dd2a[_0xe1cb('0x13')]['message']);return _0x372803(_0x46dd2a['error'][_0xe1cb('0x16')]);}logger[_0xe1cb('0x13')](_0xe1cb('0x15'),_0x34bcb8,_0x46dd2a[_0xe1cb('0x13')][_0xe1cb('0x16')]);return _0x6d3141(_0x46dd2a[_0xe1cb('0x13')]['message']);}else{logger[_0xe1cb('0x17')](_0xe1cb('0x15'),_0x34bcb8,_0xe1cb('0x11'));_0x6d3141(_0x46dd2a[_0xe1cb('0x18')][_0xe1cb('0x16')]);}})[_0xe1cb('0x19')](function(_0x5f3a18){logger['error'](_0xe1cb('0x15'),_0x34bcb8,_0x5f3a18);_0x372803(_0x5f3a18);});});} \ No newline at end of file +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 diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index a799bb3..094dcf4 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 _0x70e9=['removeListener','register','length','cmList:','save','remove','emit'];(function(_0x383d46,_0x21a277){var _0xa53c2a=function(_0x18fbd9){while(--_0x18fbd9){_0x383d46['push'](_0x383d46['shift']());}};_0xa53c2a(++_0x21a277);}(_0x70e9,0x193));var _0x970e=function(_0x3853aa,_0x5c5d52){_0x3853aa=_0x3853aa-0x0;var _0x4cb1fa=_0x70e9[_0x3853aa];return _0x4cb1fa;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x970e('0x0'),_0x970e('0x1'),'update'];function createListener(_0x3af8fd,_0x39c55a){return function(_0x50eebd){_0x39c55a[_0x970e('0x2')](_0x3af8fd,_0x50eebd);};}function removeListener(_0x50df5a,_0x94a135){return function(){CmListEvents[_0x970e('0x3')](_0x50df5a,_0x94a135);};}exports[_0x970e('0x4')]=function(_0x2263b4){for(var _0x2fb58d=0x0,_0x303190=events[_0x970e('0x5')];_0x2fb58d<_0x303190;_0x2fb58d++){var _0x508324=events[_0x2fb58d];var _0x50cab9=createListener(_0x970e('0x6')+_0x508324,_0x2263b4);CmListEvents['on'](_0x508324,_0x50cab9);}}; \ No newline at end of file +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 diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 91d2db6..281b53d 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 _0xbfea=['destroy','delete','removeDispositions','removeAgents','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./cmList.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','getAgents','post','addCustomField','/:id/users','addAgents','put','update'];(function(_0x4702ff,_0x22a958){var _0x3a6ff3=function(_0x912848){while(--_0x912848){_0x4702ff['push'](_0x4702ff['shift']());}};_0x3a6ff3(++_0x22a958);}(_0xbfea,0x1f4));var _0xabfe=function(_0x43b501,_0x51fbaf){_0x43b501=_0x43b501-0x0;var _0xc836c=_0xbfea[_0x43b501];return _0xc836c;};'use strict';var multer=require('multer');var util=require(_0xabfe('0x0'));var path=require(_0xabfe('0x1'));var timeout=require(_0xabfe('0x2'));var express=require('express');var router=express[_0xabfe('0x3')]();var auth=require(_0xabfe('0x4'));var interaction=require(_0xabfe('0x5'));var config=require('../../config/environment');var controller=require(_0xabfe('0x6'));router['get']('/',auth[_0xabfe('0x7')](),controller['index']);router[_0xabfe('0x8')](_0xabfe('0x9'),auth[_0xabfe('0x7')](),controller[_0xabfe('0xa')]);router[_0xabfe('0x8')](_0xabfe('0xb'),auth[_0xabfe('0x7')](),controller[_0xabfe('0xc')]);router[_0xabfe('0x8')](_0xabfe('0xd'),auth[_0xabfe('0x7')](),controller[_0xabfe('0xe')]);router['get'](_0xabfe('0xf'),auth[_0xabfe('0x7')](),controller[_0xabfe('0x10')]);router[_0xabfe('0x8')](_0xabfe('0x11'),auth[_0xabfe('0x7')](),controller[_0xabfe('0x12')]);router[_0xabfe('0x8')](_0xabfe('0x13'),auth['isAuthenticated'](),controller[_0xabfe('0x14')]);router[_0xabfe('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0xabfe('0x15')]);router[_0xabfe('0x16')]('/',auth[_0xabfe('0x7')](),controller['create']);router[_0xabfe('0x16')]('/:id/dispositions',auth[_0xabfe('0x7')](),controller['addDisposition']);router[_0xabfe('0x16')](_0xabfe('0xf'),auth[_0xabfe('0x7')](),controller['addContacts']);router[_0xabfe('0x16')](_0xabfe('0x13'),auth[_0xabfe('0x7')](),controller[_0xabfe('0x17')]);router[_0xabfe('0x16')](_0xabfe('0x18'),auth[_0xabfe('0x7')](),controller[_0xabfe('0x19')]);router[_0xabfe('0x1a')](_0xabfe('0xb'),auth['isAuthenticated'](),controller[_0xabfe('0x1b')]);router['delete'](_0xabfe('0xb'),auth[_0xabfe('0x7')](),controller[_0xabfe('0x1c')]);router[_0xabfe('0x1d')](_0xabfe('0xd'),auth['isAuthenticated'](),controller[_0xabfe('0x1e')]);router[_0xabfe('0x1d')](_0xabfe('0x18'),auth[_0xabfe('0x7')](),controller[_0xabfe('0x1f')]);module[_0xabfe('0x20')]=router; \ No newline at end of file +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 diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 4ebe286..5812276 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(_0x493926,_0x5717d8){var _0x20e78c=function(_0x13d058){while(--_0x13d058){_0x493926['push'](_0x493926['shift']());}};_0x20e78c(++_0x5717d8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_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 diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 4d8e918..cfc2507 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 _0xd6dc=['catch','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','set','apply','reject','update','then','destroy','error','stack','name','send','body','Condition','find'];(function(_0x2dfb31,_0x48f35b){var _0x1e951=function(_0x1fa598){while(--_0x1fa598){_0x2dfb31['push'](_0x2dfb31['shift']());}};_0x1e951(++_0x48f35b);}(_0xd6dc,0x184));var _0xcd6d=function(_0x52c538,_0x48f45a){_0x52c538=_0x52c538-0x0;var _0x33cb72=_0xd6dc[_0x52c538];return _0x33cb72;};'use strict';var pdf=require(_0xcd6d('0x0'));var emlformat=require(_0xcd6d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xcd6d('0x2'));var jsonpatch=require(_0xcd6d('0x3'));var rp=require(_0xcd6d('0x4'));var moment=require('moment');var BPromise=require(_0xcd6d('0x5'));var Mustache=require(_0xcd6d('0x6'));var util=require('util');var path=require(_0xcd6d('0x7'));var sox=require(_0xcd6d('0x8'));var csv=require('to-csv');var ejs=require(_0xcd6d('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcd6d('0xa'));var crypto=require(_0xcd6d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xcd6d('0xc'));var toCsv=require('to-csv');var querystring=require(_0xcd6d('0xd'));var Papa=require(_0xcd6d('0xe'));var Redis=require(_0xcd6d('0xf'));var authService=require(_0xcd6d('0x10'));var qs=require(_0xcd6d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcd6d('0x12'));var logger=require(_0xcd6d('0x13'))(_0xcd6d('0x14'));var utils=require(_0xcd6d('0x15'));var config=require(_0xcd6d('0x16'));var db=require(_0xcd6d('0x17'))['db'];function respondWithStatusCode(_0x1ed05b,_0xc3e988){_0xc3e988=_0xc3e988||0xcc;return function(_0x5cb133){if(_0x5cb133){return _0x1ed05b[_0xcd6d('0x18')](_0xc3e988);}return _0x1ed05b[_0xcd6d('0x19')](_0xc3e988)[_0xcd6d('0x1a')]();};}function respondWithResult(_0x35a2a1,_0x47cc9c){_0x47cc9c=_0x47cc9c||0xc8;return function(_0x3dc674){if(_0x3dc674){return _0x35a2a1[_0xcd6d('0x19')](_0x47cc9c)[_0xcd6d('0x1b')](_0x3dc674);}};}function respondWithFilteredResult(_0x2442a8,_0x373cb4){return function(_0x8dc38c){if(_0x8dc38c){var _0x3d3683=_0x8dc38c['count'],_0x26dcf0=_0x373cb4['offset'],_0x6a3798=_0x373cb4['offset']+_0x373cb4[_0xcd6d('0x1c')],_0xe32dad;if(_0x6a3798>=_0x3d3683){_0x6a3798=_0x3d3683;_0xe32dad=0xc8;}else{_0xe32dad=0xce;}_0x2442a8[_0xcd6d('0x19')](_0xe32dad);return _0x2442a8[_0xcd6d('0x1d')]('Content-Range',_0x26dcf0+'-'+_0x6a3798+'/'+_0x3d3683)[_0xcd6d('0x1b')](_0x8dc38c);}return null;};}function patchUpdates(_0x7d6cd8){return function(_0x217d65){try{jsonpatch[_0xcd6d('0x1e')](_0x217d65,_0x7d6cd8,!![]);}catch(_0x59d5d9){return BPromise[_0xcd6d('0x1f')](_0x59d5d9);}return _0x217d65['save']();};}function saveUpdates(_0x18428d,_0x9c21d){return function(_0x2b9fc0){if(_0x2b9fc0){return _0x2b9fc0[_0xcd6d('0x20')](_0x18428d)[_0xcd6d('0x21')](function(_0xa31115){return _0xa31115;});}return null;};}function removeEntity(_0xe44b7c,_0x3dc94d){return function(_0xd8a8be){if(_0xd8a8be){return _0xd8a8be[_0xcd6d('0x22')]()[_0xcd6d('0x21')](function(){_0xe44b7c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c14e9,_0x3ee0ea){return function(_0x21dbe7){if(!_0x21dbe7){_0x1c14e9[_0xcd6d('0x18')](0x194);}return _0x21dbe7;};}function handleError(_0x55e02d,_0x23ab59){_0x23ab59=_0x23ab59||0x1f4;return function(_0x1ddffb){logger[_0xcd6d('0x23')](_0x1ddffb[_0xcd6d('0x24')]);if(_0x1ddffb[_0xcd6d('0x25')]){delete _0x1ddffb[_0xcd6d('0x25')];}_0x55e02d['status'](_0x23ab59)[_0xcd6d('0x26')](_0x1ddffb);};}exports[_0xcd6d('0x20')]=function(_0x361c68,_0x2db17e){if(_0x361c68[_0xcd6d('0x27')]['id']){delete _0x361c68[_0xcd6d('0x27')]['id'];}return db[_0xcd6d('0x28')][_0xcd6d('0x29')]({'where':{'id':_0x361c68['params']['id']}})['then'](handleEntityNotFound(_0x2db17e,null))[_0xcd6d('0x21')](saveUpdates(_0x361c68[_0xcd6d('0x27')],null))[_0xcd6d('0x21')](respondWithResult(_0x2db17e,null))['catch'](handleError(_0x2db17e,null));};exports[_0xcd6d('0x22')]=function(_0x33c1f7,_0x47c5f3){return db[_0xcd6d('0x28')][_0xcd6d('0x29')]({'where':{'id':_0x33c1f7['params']['id']}})[_0xcd6d('0x21')](handleEntityNotFound(_0x47c5f3,null))[_0xcd6d('0x21')](removeEntity(_0x47c5f3,null))[_0xcd6d('0x2a')](handleError(_0x47c5f3,null));}; \ No newline at end of file +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 diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 5ef23fe..8c564ef 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 _0x6871=['exports','define','Condition','tools_conditions','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./condition.attributes'];(function(_0xb4ad13,_0x8c6b8c){var _0x5029c8=function(_0x343dd3){while(--_0x343dd3){_0xb4ad13['push'](_0xb4ad13['shift']());}};_0x5029c8(++_0x8c6b8c);}(_0x6871,0x100));var _0x1687=function(_0x30b4fe,_0x323ce6){_0x30b4fe=_0x30b4fe-0x0;var _0x365d3b=_0x6871[_0x30b4fe];return _0x365d3b;};'use strict';var _=require(_0x1687('0x0'));var util=require(_0x1687('0x1'));var logger=require(_0x1687('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1687('0x3'));var rp=require(_0x1687('0x4'));var fs=require('fs');var path=require(_0x1687('0x5'));var rimraf=require('rimraf');var config=require(_0x1687('0x6'));var attributes=require(_0x1687('0x7'));module[_0x1687('0x8')]=function(_0x6ba56d,_0x365812){return _0x6ba56d[_0x1687('0x9')](_0x1687('0xa'),attributes,{'tableName':_0x1687('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index b9388a9..0ec6ecf 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 _0x5a7b=['then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','util','moment','randomstring','../../config/utils','rpc','jayson/promise','client','http','request'];(function(_0x44c37d,_0x19119f){var _0x29e087=function(_0x327fca){while(--_0x327fca){_0x44c37d['push'](_0x44c37d['shift']());}};_0x29e087(++_0x19119f);}(_0x5a7b,0x1eb));var _0xb5a7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5a7b[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xb5a7('0x0'));var moment=require(_0xb5a7('0x1'));var BPromise=require('bluebird');var rs=require(_0xb5a7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb5a7('0x3'));var logger=require('../../config/logger')(_0xb5a7('0x4'));var config=require('../../config/environment');var jayson=require(_0xb5a7('0x5'));var client=jayson[_0xb5a7('0x6')][_0xb5a7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x252982,_0x353fdc,_0xb73aac){return new BPromise(function(_0x4b54eb,_0x1127f0){return client[_0xb5a7('0x8')](_0x252982,_0xb73aac)[_0xb5a7('0x9')](function(_0x19f4fd){logger[_0xb5a7('0xa')](_0xb5a7('0xb'),_0x353fdc,_0xb5a7('0xc'));logger[_0xb5a7('0xd')](_0xb5a7('0xe'),_0x353fdc,_0xb5a7('0xc'),JSON[_0xb5a7('0xf')](_0x19f4fd));if(_0x19f4fd['error']){if(_0x19f4fd['error'][_0xb5a7('0x10')]===0x1f4){logger[_0xb5a7('0x11')](_0xb5a7('0xb'),_0x353fdc,_0x19f4fd[_0xb5a7('0x11')][_0xb5a7('0x12')]);return _0x1127f0(_0x19f4fd[_0xb5a7('0x11')]['message']);}logger['error'](_0xb5a7('0xb'),_0x353fdc,_0x19f4fd['error'][_0xb5a7('0x12')]);return _0x4b54eb(_0x19f4fd[_0xb5a7('0x11')][_0xb5a7('0x12')]);}else{logger[_0xb5a7('0xa')]('Condition,\x20%s,\x20%s',_0x353fdc,_0xb5a7('0xc'));_0x4b54eb(_0x19f4fd[_0xb5a7('0x13')][_0xb5a7('0x12')]);}})['catch'](function(_0x52b247){logger[_0xb5a7('0x11')](_0xb5a7('0xb'),_0x353fdc,_0x52b247);_0x1127f0(_0x52b247);});});} \ No newline at end of file +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 diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 9f89e63..2a5d4ae 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 _0x759f=['Router','../../components/auth/service','../../components/interaction/service','./condition.controller','put','/:id','update','exports','multer','util'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x759f,0x152));var _0xf759=function(_0x43c597,_0x561770){_0x43c597=_0x43c597-0x0;var _0x208341=_0x759f[_0x43c597];return _0x208341;};'use strict';var multer=require(_0xf759('0x0'));var util=require(_0xf759('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf759('0x2')]();var auth=require(_0xf759('0x3'));var interaction=require(_0xf759('0x4'));var config=require('../../config/environment');var controller=require(_0xf759('0x5'));router[_0xf759('0x6')](_0xf759('0x7'),auth['isAuthenticated'](),controller[_0xf759('0x8')]);router['delete'](_0xf759('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0xf759('0x9')]=router; \ No newline at end of file +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 diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index d89c756..e64fb4b 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 _0xf5a7=['exports','name','STRING','sequelize'];(function(_0x454a2d,_0x22e314){var _0x4e8eef=function(_0x163655){while(--_0x163655){_0x454a2d['push'](_0x454a2d['shift']());}};_0x4e8eef(++_0x22e314);}(_0xf5a7,0x133));var _0x7f5a=function(_0x521c7f,_0x1f5483){_0x521c7f=_0x521c7f-0x0;var _0x51500d=_0xf5a7[_0x521c7f];return _0x51500d;};'use strict';var Sequelize=require(_0x7f5a('0x0'));module[_0x7f5a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7f5a('0x2')},'description':{'type':Sequelize[_0x7f5a('0x3')]}}; \ No newline at end of file +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 diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index c494e20..b08ac59 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 _0xadec=['redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','set','Content-Range','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','Dashboard','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','getItems','findOne','DashboardItem','order','sort','limit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x31b2f5,_0x467e5d){var _0x53b389=function(_0x2302f7){while(--_0x2302f7){_0x31b2f5['push'](_0x31b2f5['shift']());}};_0x53b389(++_0x467e5d);}(_0xadec,0x156));var _0xcade=function(_0x163491,_0x43dd26){_0x163491=_0x163491-0x0;var _0x566667=_0xadec[_0x163491];return _0x566667;};'use strict';var pdf=require(_0xcade('0x0'));var emlformat=require(_0xcade('0x1'));var rimraf=require(_0xcade('0x2'));var zipdir=require(_0xcade('0x3'));var jsonpatch=require(_0xcade('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcade('0x5'));var util=require(_0xcade('0x6'));var path=require(_0xcade('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xcade('0x8'));var crypto=require('crypto');var jsforce=require(_0xcade('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcade('0xa'));var Papa=require(_0xcade('0xb'));var Redis=require(_0xcade('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xcade('0xd'));var as=require(_0xcade('0xe'));var hardwareService=require(_0xcade('0xf'));var logger=require(_0xcade('0x10'))(_0xcade('0x11'));var utils=require(_0xcade('0x12'));var config=require(_0xcade('0x13'));var db=require(_0xcade('0x14'))['db'];config[_0xcade('0x15')]=_[_0xcade('0x16')](config[_0xcade('0x15')],{'host':_0xcade('0x17'),'port':0x18eb});var socket=require(_0xcade('0x18'))(new Redis(config[_0xcade('0x15')]));require('./dashboard.socket')[_0xcade('0x19')](socket);function respondWithStatusCode(_0x33d794,_0x2c5976){_0x2c5976=_0x2c5976||0xcc;return function(_0x53dfb8){if(_0x53dfb8){return _0x33d794[_0xcade('0x1a')](_0x2c5976);}return _0x33d794[_0xcade('0x1b')](_0x2c5976)['end']();};}function respondWithResult(_0x135fb7,_0xa74f99){_0xa74f99=_0xa74f99||0xc8;return function(_0x2ce4e2){if(_0x2ce4e2){return _0x135fb7['status'](_0xa74f99)[_0xcade('0x1c')](_0x2ce4e2);}};}function respondWithFilteredResult(_0x329322,_0x28a720){return function(_0x50efed){if(_0x50efed){var _0x126272=_0x50efed[_0xcade('0x1d')],_0x124e64=_0x28a720[_0xcade('0x1e')],_0x1c7be1=_0x28a720[_0xcade('0x1e')]+_0x28a720['limit'],_0x1c54a0;if(_0x1c7be1>=_0x126272){_0x1c7be1=_0x126272;_0x1c54a0=0xc8;}else{_0x1c54a0=0xce;}_0x329322[_0xcade('0x1b')](_0x1c54a0);return _0x329322[_0xcade('0x1f')](_0xcade('0x20'),_0x124e64+'-'+_0x1c7be1+'/'+_0x126272)[_0xcade('0x1c')](_0x50efed);}return null;};}function patchUpdates(_0x13c11f){return function(_0x4ef960){try{jsonpatch['apply'](_0x4ef960,_0x13c11f,!![]);}catch(_0x3c63c0){return BPromise['reject'](_0x3c63c0);}return _0x4ef960[_0xcade('0x21')]();};}function saveUpdates(_0x3d09c7,_0x1f705c){return function(_0x2a0e07){if(_0x2a0e07){return _0x2a0e07[_0xcade('0x22')](_0x3d09c7)[_0xcade('0x23')](function(_0x102e12){return _0x102e12;});}return null;};}function removeEntity(_0x264df7,_0x356c91){return function(_0x571129){if(_0x571129){return _0x571129[_0xcade('0x24')]()[_0xcade('0x23')](function(){var _0x598a20=_0x571129[_0xcade('0x25')]({'plain':!![]});var _0x37e1dc='CustomDashboards';return db[_0xcade('0x26')][_0xcade('0x24')]({'where':{'type':_0x37e1dc,'resourceId':_0x598a20['id']}})[_0xcade('0x23')](function(){return _0x571129;});})[_0xcade('0x23')](function(){_0x264df7[_0xcade('0x1b')](0xcc)[_0xcade('0x27')]();});}};}function handleEntityNotFound(_0xf8e810,_0x4bbe2a){return function(_0x39dcf0){if(!_0x39dcf0){_0xf8e810[_0xcade('0x1a')](0x194);}return _0x39dcf0;};}function handleError(_0x18fe12,_0x1874c6){_0x1874c6=_0x1874c6||0x1f4;return function(_0x22b9ee){logger[_0xcade('0x28')](_0x22b9ee[_0xcade('0x29')]);if(_0x22b9ee[_0xcade('0x2a')]){delete _0x22b9ee['name'];}_0x18fe12[_0xcade('0x1b')](_0x1874c6)[_0xcade('0x2b')](_0x22b9ee);};}exports[_0xcade('0x2c')]=function(_0x28d9da,_0x5c96e3){var _0x4d2884={},_0xe83cc3={},_0x223622={'count':0x0,'rows':[]};var _0x4276f3=_[_0xcade('0x2d')](db[_0xcade('0x2e')]['rawAttributes'],function(_0x217f3d){return{'name':_0x217f3d[_0xcade('0x2f')],'type':_0x217f3d[_0xcade('0x30')][_0xcade('0x31')]};});_0xe83cc3['model']=_[_0xcade('0x2d')](_0x4276f3,_0xcade('0x2a'));_0xe83cc3[_0xcade('0x32')]=_[_0xcade('0x33')](_0x28d9da[_0xcade('0x32')]);_0xe83cc3[_0xcade('0x34')]=_['intersection'](_0xe83cc3['model'],_0xe83cc3[_0xcade('0x32')]);_0x4d2884['attributes']=_[_0xcade('0x35')](_0xe83cc3[_0xcade('0x36')],qs[_0xcade('0x37')](_0x28d9da[_0xcade('0x32')][_0xcade('0x37')]));_0x4d2884[_0xcade('0x38')]=_0x4d2884[_0xcade('0x38')][_0xcade('0x39')]?_0x4d2884[_0xcade('0x38')]:_0xe83cc3[_0xcade('0x36')];if(!_0x28d9da[_0xcade('0x32')][_0xcade('0x3a')]('nolimit')){_0x4d2884['limit']=qs['limit'](_0x28d9da[_0xcade('0x32')]['limit']);_0x4d2884[_0xcade('0x1e')]=qs['offset'](_0x28d9da['query']['offset']);}_0x4d2884['order']=qs['sort'](_0x28d9da[_0xcade('0x32')]['sort']);_0x4d2884[_0xcade('0x3b')]=qs['filters'](_[_0xcade('0x3c')](_0x28d9da[_0xcade('0x32')],_0xe83cc3[_0xcade('0x34')]));if(_0x28d9da[_0xcade('0x32')][_0xcade('0x3d')]){_0x4d2884[_0xcade('0x3b')]=_['merge'](_0x4d2884[_0xcade('0x3b')],{'$or':_[_0xcade('0x2d')](_0x4276f3,function(_0x1ced10){if(_0x1ced10['type']!==_0xcade('0x3e')){var _0x45d870={};_0x45d870[_0x1ced10['name']]={'$like':'%'+_0x28d9da[_0xcade('0x32')][_0xcade('0x3d')]+'%'};return _0x45d870;}})});}_0x4d2884=_['merge']({},_0x4d2884,_0x28d9da[_0xcade('0x3f')]);var _0x440c64={'where':_0x4d2884['where']};return db[_0xcade('0x2e')][_0xcade('0x1d')](_0x440c64)['then'](function(_0xcfd42){_0x223622[_0xcade('0x1d')]=_0xcfd42;if(_0x28d9da[_0xcade('0x32')][_0xcade('0x40')]){_0x4d2884[_0xcade('0x41')]=[{'all':!![]}];}return db[_0xcade('0x2e')][_0xcade('0x42')](_0x4d2884);})[_0xcade('0x23')](function(_0x1bdbd7){_0x223622[_0xcade('0x43')]=_0x1bdbd7;return _0x223622;})[_0xcade('0x23')](respondWithFilteredResult(_0x5c96e3,_0x4d2884))['catch'](handleError(_0x5c96e3,null));};exports[_0xcade('0x44')]=function(_0x4ad05f,_0x1963c8){var _0x2efd65={'raw':![],'where':{'id':_0x4ad05f['params']['id']}},_0xa73b76={};_0xa73b76[_0xcade('0x36')]=_[_0xcade('0x33')](db[_0xcade('0x2e')][_0xcade('0x45')]);_0xa73b76[_0xcade('0x32')]=_[_0xcade('0x33')](_0x4ad05f['query']);_0xa73b76['filters']=_['intersection'](_0xa73b76[_0xcade('0x36')],_0xa73b76[_0xcade('0x32')]);_0x2efd65[_0xcade('0x38')]=_[_0xcade('0x35')](_0xa73b76['model'],qs[_0xcade('0x37')](_0x4ad05f[_0xcade('0x32')][_0xcade('0x37')]));_0x2efd65['attributes']=_0x2efd65['attributes'][_0xcade('0x39')]?_0x2efd65[_0xcade('0x38')]:_0xa73b76[_0xcade('0x36')];if(_0x4ad05f[_0xcade('0x32')]['includeAll']){_0x2efd65[_0xcade('0x41')]=[{'all':!![]}];}_0x2efd65=_[_0xcade('0x46')]({},_0x2efd65,_0x4ad05f[_0xcade('0x3f')]);return db[_0xcade('0x2e')][_0xcade('0x47')](_0x2efd65)[_0xcade('0x23')](handleEntityNotFound(_0x1963c8,null))[_0xcade('0x23')](respondWithResult(_0x1963c8,null))['catch'](handleError(_0x1963c8,null));};exports[_0xcade('0x48')]=function(_0x28e618,_0x446a25){return db[_0xcade('0x2e')]['create'](_0x28e618[_0xcade('0x49')],{})[_0xcade('0x23')](function(_0x25dd04){var _0x2b3fc9=_0x28e618[_0xcade('0x4a')][_0xcade('0x25')]({'plain':!![]});if(!_0x2b3fc9)throw new Error(_0xcade('0x4b'));if(_0x2b3fc9[_0xcade('0x4c')]===_0xcade('0x4a')){var _0x33c388=_0x25dd04[_0xcade('0x25')]({'plain':!![]});var _0x5e61c3=_0xcade('0x4d');return db[_0xcade('0x4e')]['find']({'where':{'name':_0x5e61c3,'userProfileId':_0x2b3fc9[_0xcade('0x4f')]},'raw':!![]})['then'](function(_0x33a0ff){if(_0x33a0ff&&_0x33a0ff[_0xcade('0x50')]===0x0){return db['UserProfileResource'][_0xcade('0x48')]({'name':_0x33c388[_0xcade('0x2a')],'resourceId':_0x33c388['id'],'type':_0x33a0ff['name'],'sectionId':_0x33a0ff['id']},{})[_0xcade('0x23')](function(){return _0x25dd04;});}else{return _0x25dd04;}})[_0xcade('0x51')](function(_0x380832){logger['error'](_0xcade('0x52'),_0x380832);throw _0x380832;});}return _0x25dd04;})[_0xcade('0x23')](respondWithResult(_0x446a25,0xc9))[_0xcade('0x51')](handleError(_0x446a25,null));};exports[_0xcade('0x53')]=function(_0x246ab1,_0xc3d5ff){var _0x11b6c5={'where':{'id':_0x246ab1[_0xcade('0x54')]['id']}},_0x584f70={};_0x584f70['model']=_['keys'](db[_0xcade('0x2e')][_0xcade('0x45')]);_0x11b6c5[_0xcade('0x38')]=_['intersection'](_0x584f70[_0xcade('0x36')],qs[_0xcade('0x37')](_0x246ab1['query'][_0xcade('0x37')]));_0x11b6c5[_0xcade('0x38')]=_0x11b6c5[_0xcade('0x38')]['length']?_0x11b6c5[_0xcade('0x38')]:_0x584f70[_0xcade('0x36')];if(_0x246ab1[_0xcade('0x32')][_0xcade('0x40')]){_0x11b6c5['include']=[{'all':!![]}];}_0x11b6c5=_[_0xcade('0x46')]({},_0x11b6c5,_0x246ab1['options']);return db[_0xcade('0x2e')][_0xcade('0x47')](_0x11b6c5)[_0xcade('0x23')](handleEntityNotFound(_0xc3d5ff,null))[_0xcade('0x23')](function(_0x77aea3){if(_0x77aea3){var _0x2aa914=_0x77aea3[_0xcade('0x25')]({'plain':!![]});_0x2aa914=qs[_0xcade('0x55')](_0x2aa914,['id',_0xcade('0x56'),_0xcade('0x57')]);_0x246ab1['body']=_[_0xcade('0x55')](_0x246ab1[_0xcade('0x49')],['id',_0xcade('0x56'),_0xcade('0x57')]);return db[_0xcade('0x2e')]['create'](_['merge'](_0x2aa914,_0x246ab1[_0xcade('0x49')]),{'include':_0x246ab1[_0xcade('0x32')]['includeAll']?[{'all':!![]}]:undefined})[_0xcade('0x23')](function(_0x5584f8){var _0x2de861=_0x246ab1[_0xcade('0x4a')][_0xcade('0x25')]({'plain':!![]});if(!_0x2de861)throw new Error(_0xcade('0x4b'));if(_0x2de861[_0xcade('0x4c')]===_0xcade('0x4a')){var _0x24193e=_0x5584f8[_0xcade('0x25')]({'plain':!![]});var _0x1fcc83=_0xcade('0x4d');return db[_0xcade('0x4e')][_0xcade('0x47')]({'where':{'name':_0x1fcc83,'userProfileId':_0x2de861[_0xcade('0x4f')]},'raw':!![]})[_0xcade('0x23')](function(_0x23116a){if(_0x23116a&&_0x23116a['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x24193e[_0xcade('0x2a')],'resourceId':_0x24193e['id'],'type':_0x23116a['name'],'sectionId':_0x23116a['id']},{})['then'](function(){return _0x5584f8;});}else{return _0x5584f8;}})[_0xcade('0x51')](function(_0x369c79){logger[_0xcade('0x28')](_0xcade('0x52'),_0x369c79);throw _0x369c79;});}return _0x5584f8;});}})[_0xcade('0x23')](respondWithResult(_0xc3d5ff,0xc9))[_0xcade('0x51')](handleError(_0xc3d5ff,null));};exports[_0xcade('0x22')]=function(_0x3c4af6,_0xf09377){if(_0x3c4af6[_0xcade('0x49')]['id']){delete _0x3c4af6['body']['id'];}return db[_0xcade('0x2e')][_0xcade('0x47')]({'where':{'id':_0x3c4af6['params']['id']}})['then'](handleEntityNotFound(_0xf09377,null))[_0xcade('0x23')](saveUpdates(_0x3c4af6[_0xcade('0x49')],null))[_0xcade('0x23')](respondWithResult(_0xf09377,null))['catch'](handleError(_0xf09377,null));};exports[_0xcade('0x24')]=function(_0x30d77d,_0x1c9679){return db[_0xcade('0x2e')]['find']({'where':{'id':_0x30d77d[_0xcade('0x54')]['id']}})[_0xcade('0x23')](handleEntityNotFound(_0x1c9679,null))[_0xcade('0x23')](removeEntity(_0x1c9679,null))['catch'](handleError(_0x1c9679,null));};function widgetAttributes(_0x243706){try{switch(_0x243706[_0xcade('0x30')]){case'iframe':return[{'name':_0xcade('0x58'),'value':_0x243706['attrUrl']||(_0x243706[_0xcade('0x59')]&&_0x243706[_0xcade('0x59')][0x0]?_0x243706[_0xcade('0x59')][0x0]['value']:undefined)||_0xcade('0x5a')}];case _0xcade('0x5b'):return[{'name':_0xcade('0x5c'),'value':_0x243706[_0xcade('0x5c')]||(_0x243706[_0xcade('0x59')]&&_0x243706[_0xcade('0x59')][0x0]?_0x243706[_0xcade('0x59')][0x0][_0xcade('0x5d')]:undefined)||''}];case _0xcade('0x5e'):return[{'name':_0xcade('0x5f'),'value':_0x243706['attrHourFormat']||(_0x243706[_0xcade('0x59')]&&_0x243706['attrs'][0x0]?_0x243706[_0xcade('0x59')][0x0][_0xcade('0x5d')]:undefined)||_0xcade('0x60')},{'name':_0xcade('0x61'),'value':_0x243706[_0xcade('0x61')]||(_0x243706[_0xcade('0x59')]&&_0x243706[_0xcade('0x59')][0x1]?_0x243706['attrs'][0x1][_0xcade('0x5d')]:undefined)||'0.00'},{'name':_0xcade('0x62'),'value':_0x243706['attrFontSize']||(_0x243706['attrs']&&_0x243706[_0xcade('0x59')][0x2]?_0x243706[_0xcade('0x59')][0x2][_0xcade('0x5d')]:undefined)||0xc}];case _0xcade('0x63'):return[{'name':_0xcade('0x64'),'value':_0x243706[_0xcade('0x64')]||(_0x243706[_0xcade('0x59')]&&_0x243706[_0xcade('0x59')][0x0]?_0x243706['attrs'][0x0][_0xcade('0x5d')]:undefined)||_0xcade('0x65')},{'name':_0xcade('0x66'),'value':_0x243706[_0xcade('0x66')]||(_0x243706[_0xcade('0x59')]&&_0x243706[_0xcade('0x59')][0x1]?_0x243706['attrs'][0x1][_0xcade('0x5d')]:undefined)||[]},{'name':'attrFontSize','value':_0x243706[_0xcade('0x62')]||(_0x243706[_0xcade('0x59')]&&_0x243706[_0xcade('0x59')][0x2]?_0x243706[_0xcade('0x59')][0x2][_0xcade('0x5d')]:undefined)||0x14}];case _0xcade('0x67'):case _0xcade('0x68'):return[{'name':_0xcade('0x69'),'value':_0x243706[_0xcade('0x69')]||(_0x243706[_0xcade('0x59')]&&_0x243706[_0xcade('0x59')][0x0]?_0x243706[_0xcade('0x59')][0x0][_0xcade('0x5d')]:undefined)||_0xcade('0x65')},{'name':_0xcade('0x6a'),'value':_0x243706['attrSerie2']||(_0x243706[_0xcade('0x59')]&&_0x243706[_0xcade('0x59')][0x1]?_0x243706[_0xcade('0x59')][0x1][_0xcade('0x5d')]:undefined)||null},{'name':'attrSerie3','value':_0x243706[_0xcade('0x6b')]||(_0x243706['attrs']&&_0x243706[_0xcade('0x59')][0x2]?_0x243706[_0xcade('0x59')][0x2][_0xcade('0x5d')]:undefined)||null},{'name':_0xcade('0x66'),'value':_0x243706['attrVoiceQueues']||(_0x243706['attrs']&&_0x243706[_0xcade('0x59')][0x3]?_0x243706[_0xcade('0x59')][0x3][_0xcade('0x5d')]:undefined)||[]}];case'web-report':return[{'name':_0xcade('0x6c'),'type':_0x243706[_0xcade('0x6d')]||(_0x243706[_0xcade('0x59')]&&_0x243706[_0xcade('0x59')][0x0]?_0x243706['attrs'][0x0][_0xcade('0x30')]:undefined)||null,'value':_0x243706[_0xcade('0x6c')]||(_0x243706[_0xcade('0x59')]&&_0x243706[_0xcade('0x59')][0x0]?_0x243706[_0xcade('0x59')][0x0][_0xcade('0x5d')]:undefined)||null},{'name':_0xcade('0x6e'),'value':_0x243706[_0xcade('0x6e')]||(_0x243706[_0xcade('0x59')]&&_0x243706[_0xcade('0x59')][0x1]?_0x243706[_0xcade('0x59')][0x1][_0xcade('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x15bd14){logger[_0xcade('0x28')](_0xcade('0x6f'),JSON[_0xcade('0x70')](_0x15bd14));return[];}}exports[_0xcade('0x71')]=function(_0x506950,_0x1ab6e8,_0x5454dd){if(_0x506950['body']['id']){delete _0x506950['body']['id'];}return db[_0xcade('0x2e')][_0xcade('0x47')]({'where':{'id':_0x506950[_0xcade('0x54')]['id']}})[_0xcade('0x23')](handleEntityNotFound(_0x1ab6e8,null))[_0xcade('0x23')](function(_0x2afaed){if(_0x2afaed){_0x506950['body'][_0xcade('0x72')]=_0x2afaed['id'];_0x506950['body'][_0xcade('0x59')]=widgetAttributes(_0x506950[_0xcade('0x49')]);return db['DashboardItem'][_0xcade('0x48')](_0x506950[_0xcade('0x49')]);}})[_0xcade('0x23')](respondWithResult(_0x1ab6e8,null))[_0xcade('0x51')](handleError(_0x1ab6e8,null));};exports[_0xcade('0x73')]=function(_0x185ae9,_0x2cf6a2,_0x163e39){var _0x4732e9={};var _0x3b290c={};var _0x216324;var _0x4d4ade;return db[_0xcade('0x2e')][_0xcade('0x74')]({'where':{'id':_0x185ae9['params']['id']}})[_0xcade('0x23')](handleEntityNotFound(_0x2cf6a2,null))[_0xcade('0x23')](function(_0x19f928){if(_0x19f928){_0x216324=_0x19f928;_0x3b290c[_0xcade('0x36')]=_[_0xcade('0x33')](db[_0xcade('0x75')][_0xcade('0x45')]);_0x3b290c[_0xcade('0x32')]=_[_0xcade('0x33')](_0x185ae9[_0xcade('0x32')]);_0x3b290c[_0xcade('0x34')]=_[_0xcade('0x35')](_0x3b290c[_0xcade('0x36')],_0x3b290c['query']);_0x4732e9['attributes']=_[_0xcade('0x35')](_0x3b290c[_0xcade('0x36')],qs['fields'](_0x185ae9[_0xcade('0x32')][_0xcade('0x37')]));_0x4732e9[_0xcade('0x38')]=_0x4732e9['attributes'][_0xcade('0x39')]?_0x4732e9[_0xcade('0x38')]:_0x3b290c['model'];_0x4732e9[_0xcade('0x76')]=qs[_0xcade('0x77')](_0x185ae9[_0xcade('0x32')][_0xcade('0x77')]);_0x4732e9[_0xcade('0x3b')]=qs[_0xcade('0x34')](_[_0xcade('0x3c')](_0x185ae9[_0xcade('0x32')],_0x3b290c['filters']));if(_0x185ae9[_0xcade('0x32')]['filter']){_0x4732e9[_0xcade('0x3b')]=_['merge'](_0x4732e9[_0xcade('0x3b')],{'$or':_[_0xcade('0x2d')](_0x4732e9[_0xcade('0x38')],function(_0x1a4b9e){var _0x2f7612={};_0x2f7612[_0x1a4b9e]={'$like':'%'+_0x185ae9[_0xcade('0x32')][_0xcade('0x3d')]+'%'};return _0x2f7612;})});}_0x4732e9=_[_0xcade('0x46')]({},_0x4732e9,_0x185ae9['options']);return _0x216324[_0xcade('0x73')](_0x4732e9);}})[_0xcade('0x23')](function(_0x2897f9){if(_0x2897f9){_0x4d4ade=_0x2897f9[_0xcade('0x39')];if(!_0x185ae9['query'][_0xcade('0x3a')]('nolimit')){_0x4732e9[_0xcade('0x78')]=qs[_0xcade('0x78')](_0x185ae9[_0xcade('0x32')][_0xcade('0x78')]);_0x4732e9[_0xcade('0x1e')]=qs[_0xcade('0x1e')](_0x185ae9[_0xcade('0x32')][_0xcade('0x1e')]);}return _0x216324['getItems'](_0x4732e9);}})[_0xcade('0x23')](function(_0x5c1a45){if(_0x5c1a45){return _0x5c1a45?{'count':_0x4d4ade,'rows':_0x5c1a45}:null;}})[_0xcade('0x23')](respondWithResult(_0x2cf6a2,null))[_0xcade('0x51')](handleError(_0x2cf6a2,null));}; \ No newline at end of file +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 diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 1c88916..6cc2c70 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 _0x9842=['../../mysqldb','setMaxListeners','save','emit','exports'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x9842,0x1ae));var _0x2984=function(_0x4480b9,_0x5c2949){_0x4480b9=_0x4480b9-0x0;var _0x3f0f02=_0x9842[_0x4480b9];return _0x3f0f02;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x2984('0x0'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x2984('0x1')](0x0);var events={'afterCreate':_0x2984('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x29ea1d){return function(_0x5aa911,_0x283455,_0x4718ad){DashboardEvents[_0x2984('0x3')](_0x29ea1d+':'+_0x5aa911['id'],_0x5aa911);DashboardEvents[_0x2984('0x3')](_0x29ea1d,_0x5aa911);_0x4718ad(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x2984('0x4')]=DashboardEvents; \ No newline at end of file +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 diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 87374aa..551c158 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 _0x1749=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','Dashboard','dashboards','lodash'];(function(_0x5adf05,_0x44ab10){var _0x485f6b=function(_0xdac01e){while(--_0xdac01e){_0x5adf05['push'](_0x5adf05['shift']());}};_0x485f6b(++_0x44ab10);}(_0x1749,0xcb));var _0x9174=function(_0x1c6c5f,_0x50d6a2){_0x1c6c5f=_0x1c6c5f-0x0;var _0x45d3dc=_0x1749[_0x1c6c5f];return _0x45d3dc;};'use strict';var _=require(_0x9174('0x0'));var util=require(_0x9174('0x1'));var logger=require(_0x9174('0x2'))('api');var moment=require(_0x9174('0x3'));var BPromise=require(_0x9174('0x4'));var rp=require(_0x9174('0x5'));var fs=require('fs');var path=require(_0x9174('0x6'));var rimraf=require(_0x9174('0x7'));var config=require(_0x9174('0x8'));var attributes=require(_0x9174('0x9'));module['exports']=function(_0x4b68b0,_0x3d143c){return _0x4b68b0['define'](_0x9174('0xa'),attributes,{'tableName':_0x9174('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index dc11280..fc005ad 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 _0x4020=['socket.io-emitter','register','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost'];(function(_0x2f167e,_0x38473d){var _0x30ba5f=function(_0x348744){while(--_0x348744){_0x2f167e['push'](_0x2f167e['shift']());}};_0x30ba5f(++_0x38473d);}(_0x4020,0x137));var _0x0402=function(_0x2cce0b,_0x70c69){_0x2cce0b=_0x2cce0b-0x0;var _0x21a144=_0x4020[_0x2cce0b];return _0x21a144;};'use strict';var _=require(_0x0402('0x0'));var util=require(_0x0402('0x1'));var moment=require(_0x0402('0x2'));var BPromise=require(_0x0402('0x3'));var rs=require(_0x0402('0x4'));var fs=require('fs');var Redis=require(_0x0402('0x5'));var db=require(_0x0402('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0402('0x7'));var config=require(_0x0402('0x8'));var jayson=require(_0x0402('0x9'));var client=jayson[_0x0402('0xa')]['http']({'port':0x232a});config['redis']=_[_0x0402('0xb')](config[_0x0402('0xc')],{'host':_0x0402('0xd'),'port':0x18eb});var socket=require(_0x0402('0xe'))(new Redis(config[_0x0402('0xc')]));require('./dashboard.socket')[_0x0402('0xf')](socket);function respondWithRpcPromise(_0x3e2eb9,_0x384c57,_0x53a004){return new BPromise(function(_0x11f1c1,_0xda8ce6){return client[_0x0402('0x10')](_0x3e2eb9,_0x53a004)[_0x0402('0x11')](function(_0x377b22){logger['info'](_0x0402('0x12'),_0x384c57,_0x0402('0x13'));logger['debug'](_0x0402('0x14'),_0x384c57,'request\x20sent',JSON['stringify'](_0x377b22));if(_0x377b22['error']){if(_0x377b22[_0x0402('0x15')][_0x0402('0x16')]===0x1f4){logger[_0x0402('0x15')](_0x0402('0x12'),_0x384c57,_0x377b22['error'][_0x0402('0x17')]);return _0xda8ce6(_0x377b22[_0x0402('0x15')][_0x0402('0x17')]);}logger[_0x0402('0x15')](_0x0402('0x12'),_0x384c57,_0x377b22[_0x0402('0x15')][_0x0402('0x17')]);return _0x11f1c1(_0x377b22[_0x0402('0x15')][_0x0402('0x17')]);}else{logger['info'](_0x0402('0x12'),_0x384c57,_0x0402('0x13'));_0x11f1c1(_0x377b22[_0x0402('0x18')][_0x0402('0x17')]);}})['catch'](function(_0x475c36){logger[_0x0402('0x15')]('Dashboard,\x20%s,\x20%s',_0x384c57,_0x475c36);_0xda8ce6(_0x475c36);});});} \ No newline at end of file +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 diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 1af606c..5439cee 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 _0x045d=['update','emit','removeListener','length','dashboard:','./dashboard.events','save','remove'];(function(_0x5b1ab1,_0x9bbe2b){var _0x357b2f=function(_0x3741dc){while(--_0x3741dc){_0x5b1ab1['push'](_0x5b1ab1['shift']());}};_0x357b2f(++_0x9bbe2b);}(_0x045d,0x95));var _0xd045=function(_0x312dc6,_0x21d825){_0x312dc6=_0x312dc6-0x0;var _0x53faa=_0x045d[_0x312dc6];return _0x53faa;};'use strict';var DashboardEvents=require(_0xd045('0x0'));var events=[_0xd045('0x1'),_0xd045('0x2'),_0xd045('0x3')];function createListener(_0x5bec9d,_0x552b75){return function(_0x1fd8f6){_0x552b75[_0xd045('0x4')](_0x5bec9d,_0x1fd8f6);};}function removeListener(_0x1000f8,_0x3d168c){return function(){DashboardEvents[_0xd045('0x5')](_0x1000f8,_0x3d168c);};}exports['register']=function(_0x2f6fa0){for(var _0x16bc5d=0x0,_0x3d8f2c=events[_0xd045('0x6')];_0x16bc5d<_0x3d8f2c;_0x16bc5d++){var _0x5dfd11=events[_0x16bc5d];var _0x210428=createListener(_0xd045('0x7')+_0x5dfd11,_0x2f6fa0);DashboardEvents['on'](_0x5dfd11,_0x210428);}}; \ No newline at end of file +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 diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 5219a11..18bd84e 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 _0x70e0=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','/:id/items','isAuthenticated','getItems','post','/:id/clone','clone','addItem','put','/:id','update','multer'];(function(_0x2f212d,_0x5ef2b1){var _0x1cf75=function(_0x45bc57){while(--_0x45bc57){_0x2f212d['push'](_0x2f212d['shift']());}};_0x1cf75(++_0x5ef2b1);}(_0x70e0,0x17b));var _0x070e=function(_0x154528,_0x100729){_0x154528=_0x154528-0x0;var _0x445d68=_0x70e0[_0x154528];return _0x445d68;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var auth=require(_0x070e('0x4'));var interaction=require(_0x070e('0x5'));var config=require(_0x070e('0x6'));var controller=require('./dashboard.controller');router[_0x070e('0x7')]('/',auth['isAuthenticated'](),controller[_0x070e('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x070e('0x9')]);router[_0x070e('0x7')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth[_0x070e('0xb')](),controller['create']);router['post'](_0x070e('0xe'),auth[_0x070e('0xb')](),controller[_0x070e('0xf')]);router[_0x070e('0xd')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0x12'),auth[_0x070e('0xb')](),controller[_0x070e('0x13')]);router['delete']('/:id',auth[_0x070e('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 0481544..7e4b596 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 _0x7afb=['#2196f3','lodash','exports','STRING','TEXT','long','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7afb,0x1e1));var _0xb7af=function(_0x4aef74,_0x3f249b){_0x4aef74=_0x4aef74-0x0;var _0xfc401=_0x7afb[_0x4aef74];return _0xfc401;};'use strict';var Sequelize=require('sequelize');var squel=require('squel');var _=require(_0xb7af('0x0'));module[_0xb7af('0x1')]={'title':{'type':Sequelize[_0xb7af('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb7af('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xb7af('0x3')](_0xb7af('0x4')),'get':function(){try{return JSON['parse'](this[_0xb7af('0x5')](_0xb7af('0x6')));}catch(_0x483ea0){return[];}},'set':function(_0x184e19){try{this[_0xb7af('0x7')](_0xb7af('0x6'),JSON[_0xb7af('0x8')](_0x184e19));}catch(_0x688c71){this[_0xb7af('0x7')](_0xb7af('0x6'),JSON[_0xb7af('0x8')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xb7af('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xb7af('0x9')]},'col':{'type':Sequelize[_0xb7af('0x9')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb7af('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xb7af('0x2')],'allowNull':![],'defaultValue':_0xb7af('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xb7af('0x2')]}}; \ No newline at end of file +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 diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 5b829ac..5ce2875 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 _0xbd1f=['create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','update','then','destroy','error','stack','name','send','DashboardItem','rawAttributes','query','keys','filters','model','attributes','intersection','fields','length','include','merge','options','find','catch','params','iframe','attrUrl','value','https://','custom','attrPath','attrs','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','type','attrRefresh','widgetAttributes:\x20%s','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbd1f,0xc0));var _0xfbd1=function(_0x279614,_0x4cce43){_0x279614=_0x279614-0x0;var _0x2a331c=_0xbd1f[_0x279614];return _0x2a331c;};'use strict';var pdf=require(_0xfbd1('0x0'));var emlformat=require(_0xfbd1('0x1'));var rimraf=require(_0xfbd1('0x2'));var zipdir=require(_0xfbd1('0x3'));var jsonpatch=require(_0xfbd1('0x4'));var rp=require(_0xfbd1('0x5'));var moment=require('moment');var BPromise=require(_0xfbd1('0x6'));var Mustache=require(_0xfbd1('0x7'));var util=require(_0xfbd1('0x8'));var path=require(_0xfbd1('0x9'));var sox=require(_0xfbd1('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xfbd1('0xb'));var squel=require(_0xfbd1('0xc'));var crypto=require(_0xfbd1('0xd'));var jsforce=require(_0xfbd1('0xe'));var deskjs=require(_0xfbd1('0xf'));var toCsv=require(_0xfbd1('0x10'));var querystring=require(_0xfbd1('0x11'));var Papa=require(_0xfbd1('0x12'));var Redis=require(_0xfbd1('0x13'));var authService=require(_0xfbd1('0x14'));var qs=require(_0xfbd1('0x15'));var as=require(_0xfbd1('0x16'));var hardwareService=require(_0xfbd1('0x17'));var logger=require(_0xfbd1('0x18'))(_0xfbd1('0x19'));var utils=require(_0xfbd1('0x1a'));var config=require(_0xfbd1('0x1b'));var db=require(_0xfbd1('0x1c'))['db'];config['redis']=_['defaults'](config[_0xfbd1('0x1d')],{'host':_0xfbd1('0x1e'),'port':0x18eb});var socket=require(_0xfbd1('0x1f'))(new Redis(config['redis']));require(_0xfbd1('0x20'))[_0xfbd1('0x21')](socket);function respondWithStatusCode(_0x48dcb4,_0x27842b){_0x27842b=_0x27842b||0xcc;return function(_0x1a5237){if(_0x1a5237){return _0x48dcb4[_0xfbd1('0x22')](_0x27842b);}return _0x48dcb4[_0xfbd1('0x23')](_0x27842b)[_0xfbd1('0x24')]();};}function respondWithResult(_0x4868a1,_0x1519b7){_0x1519b7=_0x1519b7||0xc8;return function(_0xa986b8){if(_0xa986b8){return _0x4868a1[_0xfbd1('0x23')](_0x1519b7)[_0xfbd1('0x25')](_0xa986b8);}};}function respondWithFilteredResult(_0x44dea1,_0x1aa17e){return function(_0x2987fa){if(_0x2987fa){var _0x4fa2d9=_0x2987fa[_0xfbd1('0x26')],_0x270f50=_0x1aa17e[_0xfbd1('0x27')],_0x90b91e=_0x1aa17e[_0xfbd1('0x27')]+_0x1aa17e[_0xfbd1('0x28')],_0x2d3b47;if(_0x90b91e>=_0x4fa2d9){_0x90b91e=_0x4fa2d9;_0x2d3b47=0xc8;}else{_0x2d3b47=0xce;}_0x44dea1[_0xfbd1('0x23')](_0x2d3b47);return _0x44dea1['set'](_0xfbd1('0x29'),_0x270f50+'-'+_0x90b91e+'/'+_0x4fa2d9)[_0xfbd1('0x25')](_0x2987fa);}return null;};}function patchUpdates(_0x4b78dc){return function(_0xb9e77b){try{jsonpatch[_0xfbd1('0x2a')](_0xb9e77b,_0x4b78dc,!![]);}catch(_0x4dd92e){return BPromise['reject'](_0x4dd92e);}return _0xb9e77b['save']();};}function saveUpdates(_0x47b9c3,_0xc47423){return function(_0x1bbf3b){if(_0x1bbf3b){return _0x1bbf3b[_0xfbd1('0x2b')](_0x47b9c3)[_0xfbd1('0x2c')](function(_0x44da4e){return _0x44da4e;});}return null;};}function removeEntity(_0xf9a680,_0x1edc57){return function(_0x2425c3){if(_0x2425c3){return _0x2425c3[_0xfbd1('0x2d')]()['then'](function(){_0xf9a680[_0xfbd1('0x23')](0xcc)[_0xfbd1('0x24')]();});}};}function handleEntityNotFound(_0x4ba823,_0x4378d6){return function(_0x32bd21){if(!_0x32bd21){_0x4ba823[_0xfbd1('0x22')](0x194);}return _0x32bd21;};}function handleError(_0x69d339,_0x3e2c93){_0x3e2c93=_0x3e2c93||0x1f4;return function(_0x7f033c){logger[_0xfbd1('0x2e')](_0x7f033c[_0xfbd1('0x2f')]);if(_0x7f033c[_0xfbd1('0x30')]){delete _0x7f033c[_0xfbd1('0x30')];}_0x69d339[_0xfbd1('0x23')](_0x3e2c93)[_0xfbd1('0x31')](_0x7f033c);};}exports['show']=function(_0xd8064e,_0x3ec7f6){var _0x1b30eb={'raw':![],'where':{'id':_0xd8064e['params']['id']}},_0x36001e={};_0x36001e['model']=_['keys'](db[_0xfbd1('0x32')][_0xfbd1('0x33')]);_0x36001e[_0xfbd1('0x34')]=_[_0xfbd1('0x35')](_0xd8064e[_0xfbd1('0x34')]);_0x36001e[_0xfbd1('0x36')]=_['intersection'](_0x36001e[_0xfbd1('0x37')],_0x36001e['query']);_0x1b30eb[_0xfbd1('0x38')]=_[_0xfbd1('0x39')](_0x36001e[_0xfbd1('0x37')],qs['fields'](_0xd8064e[_0xfbd1('0x34')][_0xfbd1('0x3a')]));_0x1b30eb['attributes']=_0x1b30eb['attributes'][_0xfbd1('0x3b')]?_0x1b30eb[_0xfbd1('0x38')]:_0x36001e[_0xfbd1('0x37')];if(_0xd8064e[_0xfbd1('0x34')]['includeAll']){_0x1b30eb[_0xfbd1('0x3c')]=[{'all':!![]}];}_0x1b30eb=_[_0xfbd1('0x3d')]({},_0x1b30eb,_0xd8064e[_0xfbd1('0x3e')]);return db[_0xfbd1('0x32')][_0xfbd1('0x3f')](_0x1b30eb)['then'](handleEntityNotFound(_0x3ec7f6,null))[_0xfbd1('0x2c')](respondWithResult(_0x3ec7f6,null))[_0xfbd1('0x40')](handleError(_0x3ec7f6,null));};exports[_0xfbd1('0x2d')]=function(_0x32cd37,_0x41cf68){return db['DashboardItem']['find']({'where':{'id':_0x32cd37[_0xfbd1('0x41')]['id']}})[_0xfbd1('0x2c')](handleEntityNotFound(_0x41cf68,null))['then'](removeEntity(_0x41cf68,null))[_0xfbd1('0x40')](handleError(_0x41cf68,null));};function widgetAttributes(_0x2a1716){try{switch(_0x2a1716['type']){case _0xfbd1('0x42'):return[{'name':_0xfbd1('0x43'),'value':_0x2a1716['attrUrl']||(_0x2a1716['attrs']&&_0x2a1716['attrs'][0x0]?_0x2a1716['attrs'][0x0][_0xfbd1('0x44')]:undefined)||_0xfbd1('0x45')}];case _0xfbd1('0x46'):return[{'name':_0xfbd1('0x47'),'value':_0x2a1716['attrPath']||(_0x2a1716['attrs']&&_0x2a1716[_0xfbd1('0x48')][0x0]?_0x2a1716[_0xfbd1('0x48')][0x0][_0xfbd1('0x44')]:undefined)||''}];case _0xfbd1('0x49'):return[{'name':_0xfbd1('0x4a'),'value':_0x2a1716[_0xfbd1('0x4a')]||(_0x2a1716['attrs']&&_0x2a1716[_0xfbd1('0x48')][0x0]?_0x2a1716['attrs'][0x0][_0xfbd1('0x44')]:undefined)||_0xfbd1('0x4b')},{'name':'attrTimezone','value':_0x2a1716[_0xfbd1('0x4c')]||(_0x2a1716[_0xfbd1('0x48')]&&_0x2a1716[_0xfbd1('0x48')][0x1]?_0x2a1716['attrs'][0x1]['value']:undefined)||_0xfbd1('0x4d')},{'name':_0xfbd1('0x4e'),'value':_0x2a1716[_0xfbd1('0x4e')]||(_0x2a1716['attrs']&&_0x2a1716[_0xfbd1('0x48')][0x2]?_0x2a1716[_0xfbd1('0x48')][0x2][_0xfbd1('0x44')]:undefined)||0xc}];case'counter':return[{'name':_0xfbd1('0x4f'),'value':_0x2a1716[_0xfbd1('0x4f')]||(_0x2a1716['attrs']&&_0x2a1716[_0xfbd1('0x48')][0x0]?_0x2a1716[_0xfbd1('0x48')][0x0][_0xfbd1('0x44')]:undefined)||_0xfbd1('0x50')},{'name':_0xfbd1('0x51'),'value':_0x2a1716[_0xfbd1('0x51')]||(_0x2a1716['attrs']&&_0x2a1716[_0xfbd1('0x48')][0x1]?_0x2a1716[_0xfbd1('0x48')][0x1][_0xfbd1('0x44')]:undefined)||[]},{'name':_0xfbd1('0x4e'),'value':_0x2a1716[_0xfbd1('0x4e')]||(_0x2a1716['attrs']&&_0x2a1716[_0xfbd1('0x48')][0x2]?_0x2a1716[_0xfbd1('0x48')][0x2][_0xfbd1('0x44')]:undefined)||0x14}];case _0xfbd1('0x52'):case _0xfbd1('0x53'):return[{'name':_0xfbd1('0x54'),'value':_0x2a1716[_0xfbd1('0x54')]||(_0x2a1716[_0xfbd1('0x48')]&&_0x2a1716[_0xfbd1('0x48')][0x0]?_0x2a1716[_0xfbd1('0x48')][0x0]['value']:undefined)||_0xfbd1('0x50')},{'name':_0xfbd1('0x55'),'value':_0x2a1716[_0xfbd1('0x55')]||(_0x2a1716['attrs']&&_0x2a1716['attrs'][0x1]?_0x2a1716[_0xfbd1('0x48')][0x1][_0xfbd1('0x44')]:undefined)||null},{'name':_0xfbd1('0x56'),'value':_0x2a1716[_0xfbd1('0x56')]||(_0x2a1716[_0xfbd1('0x48')]&&_0x2a1716[_0xfbd1('0x48')][0x2]?_0x2a1716[_0xfbd1('0x48')][0x2]['value']:undefined)||null},{'name':_0xfbd1('0x51'),'value':_0x2a1716['attrVoiceQueues']||(_0x2a1716[_0xfbd1('0x48')]&&_0x2a1716[_0xfbd1('0x48')][0x3]?_0x2a1716[_0xfbd1('0x48')][0x3]['value']:undefined)||[]}];case'web-report':return[{'name':_0xfbd1('0x57'),'type':_0x2a1716[_0xfbd1('0x58')]||(_0x2a1716[_0xfbd1('0x48')]&&_0x2a1716['attrs'][0x0]?_0x2a1716[_0xfbd1('0x48')][0x0][_0xfbd1('0x59')]:undefined)||null,'value':_0x2a1716['attrReport']||(_0x2a1716[_0xfbd1('0x48')]&&_0x2a1716[_0xfbd1('0x48')][0x0]?_0x2a1716['attrs'][0x0][_0xfbd1('0x44')]:undefined)||null},{'name':_0xfbd1('0x5a'),'value':_0x2a1716['attrRefresh']||(_0x2a1716[_0xfbd1('0x48')]&&_0x2a1716[_0xfbd1('0x48')][0x1]?_0x2a1716['attrs'][0x1][_0xfbd1('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x5b5519){logger['error'](_0xfbd1('0x5b'),JSON[_0xfbd1('0x5c')](_0x5b5519));return[];}}exports[_0xfbd1('0x5d')]=function(_0x115890,_0x4e2461){if(_0x115890['body']){_0x115890[_0xfbd1('0x5e')][_0xfbd1('0x48')]=widgetAttributes(_0x115890['body']);}return db[_0xfbd1('0x32')][_0xfbd1('0x5d')](_0x115890[_0xfbd1('0x5e')],{})[_0xfbd1('0x2c')](respondWithResult(_0x4e2461,0xc9))[_0xfbd1('0x40')](handleError(_0x4e2461,null));};exports[_0xfbd1('0x2b')]=function(_0x1b8f8d,_0x3958e1){if(_0x1b8f8d[_0xfbd1('0x5e')]['id']){delete _0x1b8f8d[_0xfbd1('0x5e')]['id'];}_0x1b8f8d[_0xfbd1('0x5e')][_0xfbd1('0x48')]=widgetAttributes(_0x1b8f8d[_0xfbd1('0x5e')]);return db[_0xfbd1('0x32')][_0xfbd1('0x3f')]({'where':{'id':_0x1b8f8d['params']['id']}})[_0xfbd1('0x2c')](handleEntityNotFound(_0x3958e1,null))[_0xfbd1('0x2c')](saveUpdates(_0x1b8f8d[_0xfbd1('0x5e')],null))[_0xfbd1('0x2c')](respondWithResult(_0x3958e1,null))['catch'](handleError(_0x3958e1,null));}; \ No newline at end of file +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 diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index fb85a29..8e70f14 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 _0xf0cc=['events','../../mysqldb','DashboardItem','setMaxListeners','update','remove','emit','hasOwnProperty','exports'];(function(_0x4b47b4,_0x45a8de){var _0x19b47f=function(_0x158d9f){while(--_0x158d9f){_0x4b47b4['push'](_0x4b47b4['shift']());}};_0x19b47f(++_0x45a8de);}(_0xf0cc,0xf3));var _0xcf0c=function(_0x4b4ba8,_0x1cd03d){_0x4b4ba8=_0x4b4ba8-0x0;var _0x3fcccc=_0xf0cc[_0x4b4ba8];return _0x3fcccc;};'use strict';var EventEmitter=require(_0xcf0c('0x0'));var DashboardItem=require(_0xcf0c('0x1'))['db'][_0xcf0c('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xcf0c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcf0c('0x4'),'afterDestroy':_0xcf0c('0x5')};function emitEvent(_0x2afedd){return function(_0x4f7b54,_0x1bfa54,_0x6beb95){DashboardItemEvents[_0xcf0c('0x6')](_0x2afedd+':'+_0x4f7b54['id'],_0x4f7b54);DashboardItemEvents[_0xcf0c('0x6')](_0x2afedd,_0x4f7b54);_0x6beb95(null);};}for(var e in events){if(events[_0xcf0c('0x7')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xcf0c('0x8')]=DashboardItemEvents; \ No newline at end of file +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 diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 0c775fa..97b047e 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 _0x9ba8=['DashboardItem','dashboard_items','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./dashboardItem.attributes','define'];(function(_0x4be8df,_0x2e39a7){var _0x4d3d75=function(_0x3e16d3){while(--_0x3e16d3){_0x4be8df['push'](_0x4be8df['shift']());}};_0x4d3d75(++_0x2e39a7);}(_0x9ba8,0x18e));var _0x89ba=function(_0x2a3746,_0x4a8a46){_0x2a3746=_0x2a3746-0x0;var _0x1d7e9a=_0x9ba8[_0x2a3746];return _0x1d7e9a;};'use strict';var _=require(_0x89ba('0x0'));var util=require(_0x89ba('0x1'));var logger=require(_0x89ba('0x2'))(_0x89ba('0x3'));var moment=require(_0x89ba('0x4'));var BPromise=require(_0x89ba('0x5'));var rp=require(_0x89ba('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x89ba('0x7'));var config=require('../../config/environment');var attributes=require(_0x89ba('0x8'));module['exports']=function(_0xcdb46c,_0x129d48){return _0xcdb46c[_0x89ba('0x9')](_0x89ba('0xa'),attributes,{'tableName':_0x89ba('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 443e204..1fbe3a8 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 _0xea07=['DashboardItem,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x16d4b6,_0x527555){var _0xeeaf29=function(_0x272d27){while(--_0x272d27){_0x16d4b6['push'](_0x16d4b6['shift']());}};_0xeeaf29(++_0x527555);}(_0xea07,0x74));var _0x7ea0=function(_0x2f9e1a,_0x4904dc){_0x2f9e1a=_0x2f9e1a-0x0;var _0x24bfe6=_0xea07[_0x2f9e1a];return _0x24bfe6;};'use strict';var _=require(_0x7ea0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7ea0('0x1'));var rs=require(_0x7ea0('0x2'));var fs=require('fs');var Redis=require(_0x7ea0('0x3'));var db=require(_0x7ea0('0x4'))['db'];var utils=require(_0x7ea0('0x5'));var logger=require(_0x7ea0('0x6'))(_0x7ea0('0x7'));var config=require(_0x7ea0('0x8'));var jayson=require(_0x7ea0('0x9'));var client=jayson[_0x7ea0('0xa')][_0x7ea0('0xb')]({'port':0x232a});config[_0x7ea0('0xc')]=_['defaults'](config[_0x7ea0('0xc')],{'host':_0x7ea0('0xd'),'port':0x18eb});var socket=require(_0x7ea0('0xe'))(new Redis(config[_0x7ea0('0xc')]));require(_0x7ea0('0xf'))[_0x7ea0('0x10')](socket);function respondWithRpcPromise(_0x4df0da,_0x40a439,_0x54cb43){return new BPromise(function(_0x1df9e5,_0x56a7a5){return client[_0x7ea0('0x11')](_0x4df0da,_0x54cb43)[_0x7ea0('0x12')](function(_0x261074){logger[_0x7ea0('0x13')]('DashboardItem,\x20%s,\x20%s',_0x40a439,_0x7ea0('0x14'));logger['debug'](_0x7ea0('0x15'),_0x40a439,_0x7ea0('0x14'),JSON[_0x7ea0('0x16')](_0x261074));if(_0x261074['error']){if(_0x261074['error']['code']===0x1f4){logger[_0x7ea0('0x17')](_0x7ea0('0x18'),_0x40a439,_0x261074['error']['message']);return _0x56a7a5(_0x261074[_0x7ea0('0x17')]['message']);}logger[_0x7ea0('0x17')]('DashboardItem,\x20%s,\x20%s',_0x40a439,_0x261074[_0x7ea0('0x17')][_0x7ea0('0x19')]);return _0x1df9e5(_0x261074[_0x7ea0('0x17')][_0x7ea0('0x19')]);}else{logger['info'](_0x7ea0('0x18'),_0x40a439,'request\x20sent');_0x1df9e5(_0x261074[_0x7ea0('0x1a')][_0x7ea0('0x19')]);}})[_0x7ea0('0x1b')](function(_0x44e7b6){logger['error']('DashboardItem,\x20%s,\x20%s',_0x40a439,_0x44e7b6);_0x56a7a5(_0x44e7b6);});});} \ No newline at end of file +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 diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 07320d7..66a569e 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 _0xf430=['register','length','dashboardItem:','remove','update','emit','removeListener'];(function(_0x3e415e,_0x3696a5){var _0x4d722c=function(_0x473ed7){while(--_0x473ed7){_0x3e415e['push'](_0x3e415e['shift']());}};_0x4d722c(++_0x3696a5);}(_0xf430,0xd5));var _0x0f43=function(_0x489b87,_0xd51c93){_0x489b87=_0x489b87-0x0;var _0x1823b6=_0xf430[_0x489b87];return _0x1823b6;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=['save',_0x0f43('0x0'),_0x0f43('0x1')];function createListener(_0x49602b,_0x38d6cb){return function(_0x3dc8c2){_0x38d6cb[_0x0f43('0x2')](_0x49602b,_0x3dc8c2);};}function removeListener(_0x46925c,_0x5f2776){return function(){DashboardItemEvents[_0x0f43('0x3')](_0x46925c,_0x5f2776);};}exports[_0x0f43('0x4')]=function(_0x311b7f){for(var _0x6e98cb=0x0,_0xa03df9=events[_0x0f43('0x5')];_0x6e98cb<_0xa03df9;_0x6e98cb++){var _0x35aa01=events[_0x6e98cb];var _0x1dab48=createListener(_0x0f43('0x6')+_0x35aa01,_0x311b7f);DashboardItemEvents['on'](_0x35aa01,_0x1dab48);}}; \ No newline at end of file +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 diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 76c95af..bfe592c 100644 --- a/server/api/dashboardItem/index.js +++ b/server/api/dashboardItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7da7=['put','update','destroy','multer','util','path','Router','../../components/auth/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','post','create'];(function(_0x5c9b27,_0x134312){var _0x4b3cb8=function(_0x3c59ac){while(--_0x3c59ac){_0x5c9b27['push'](_0x5c9b27['shift']());}};_0x4b3cb8(++_0x134312);}(_0x7da7,0x10d));var _0x77da=function(_0x479160,_0x3ab560){_0x479160=_0x479160-0x0;var _0x47ac6d=_0x7da7[_0x479160];return _0x47ac6d;};'use strict';var multer=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var path=require(_0x77da('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x77da('0x3')]();var auth=require(_0x77da('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x77da('0x5'));var controller=require(_0x77da('0x6'));router['get'](_0x77da('0x7'),auth[_0x77da('0x8')](),controller['show']);router[_0x77da('0x9')]('/',auth['isAuthenticated'](),controller[_0x77da('0xa')]);router[_0x77da('0xb')](_0x77da('0x7'),auth[_0x77da('0x8')](),controller[_0x77da('0xc')]);router['delete'](_0x77da('0x7'),auth[_0x77da('0x8')](),controller[_0x77da('0xd')]);module['exports']=router; \ No newline at end of file +var _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 diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 9d1bfba..7cf5532 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 _0xf548=['STRING','sequelize','exports'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xf548,0x85));var _0x8f54=function(_0x8b8564,_0x162976){_0x8b8564=_0x8b8564-0x0;var _0x360c61=_0xf548[_0x8b8564];return _0x360c61;};'use strict';var Sequelize=require(_0x8f54('0x0'));module[_0x8f54('0x1')]={'name':{'type':Sequelize[_0x8f54('0x2')],'allowNull':![]}}; \ No newline at end of file +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 diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 9ed608b..29000d9 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 _0x3937=['fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','where','filters','pick','merge','filter','options','includeAll','include','findAll','rows','show','params','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','then','Dispositions','destroy','error','name','send','index','map','Disposition','rawAttributes'];(function(_0xa8f776,_0x420cbf){var _0x435961=function(_0x241c69){while(--_0x241c69){_0xa8f776['push'](_0xa8f776['shift']());}};_0x435961(++_0x420cbf);}(_0x3937,0xbf));var _0x7393=function(_0x3982fa,_0x47f50c){_0x3982fa=_0x3982fa-0x0;var _0x46ada8=_0x3937[_0x3982fa];return _0x46ada8;};'use strict';var pdf=require(_0x7393('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7393('0x1'));var zipdir=require(_0x7393('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7393('0x3'));var moment=require('moment');var BPromise=require(_0x7393('0x4'));var Mustache=require('mustache');var util=require(_0x7393('0x5'));var path=require(_0x7393('0x6'));var sox=require(_0x7393('0x7'));var csv=require(_0x7393('0x8'));var ejs=require(_0x7393('0x9'));var fs=require('fs');var _=require(_0x7393('0xa'));var squel=require(_0x7393('0xb'));var crypto=require(_0x7393('0xc'));var jsforce=require(_0x7393('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7393('0xe'));var Papa=require(_0x7393('0xf'));var Redis=require(_0x7393('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7393('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x7393('0x12'));var config=require(_0x7393('0x13'));var db=require(_0x7393('0x14'))['db'];function respondWithStatusCode(_0x4fb764,_0x79fc4e){_0x79fc4e=_0x79fc4e||0xcc;return function(_0x470f09){if(_0x470f09){return _0x4fb764[_0x7393('0x15')](_0x79fc4e);}return _0x4fb764[_0x7393('0x16')](_0x79fc4e)[_0x7393('0x17')]();};}function respondWithResult(_0x1fe171,_0x38eaad){_0x38eaad=_0x38eaad||0xc8;return function(_0x212f44){if(_0x212f44){return _0x1fe171[_0x7393('0x16')](_0x38eaad)['json'](_0x212f44);}};}function respondWithFilteredResult(_0x47b152,_0x414c37){return function(_0x5d0d2b){if(_0x5d0d2b){var _0x5b91a9=_0x5d0d2b[_0x7393('0x18')],_0x4e7ec6=_0x414c37[_0x7393('0x19')],_0x82f5fa=_0x414c37['offset']+_0x414c37[_0x7393('0x1a')],_0x54dc47;if(_0x82f5fa>=_0x5b91a9){_0x82f5fa=_0x5b91a9;_0x54dc47=0xc8;}else{_0x54dc47=0xce;}_0x47b152['status'](_0x54dc47);return _0x47b152['set'](_0x7393('0x1b'),_0x4e7ec6+'-'+_0x82f5fa+'/'+_0x5b91a9)[_0x7393('0x1c')](_0x5d0d2b);}return null;};}function patchUpdates(_0x1b032c){return function(_0x1dc3e3){try{jsonpatch[_0x7393('0x1d')](_0x1dc3e3,_0x1b032c,!![]);}catch(_0x3e2453){return BPromise[_0x7393('0x1e')](_0x3e2453);}return _0x1dc3e3[_0x7393('0x1f')]();};}function saveUpdates(_0x546642,_0x52cd6a){return function(_0x30eae3){if(_0x30eae3){return _0x30eae3[_0x7393('0x20')](_0x546642)[_0x7393('0x21')](function(_0x7fc0ef){return _0x7fc0ef;});}return null;};}function removeEntity(_0x131667,_0x52f716){return function(_0x4d7870){if(_0x4d7870){return _0x4d7870['destroy']()[_0x7393('0x21')](function(){var _0x5b5ca9=_0x4d7870['get']({'plain':!![]});var _0x2bf7a9=_0x7393('0x22');return db['UserProfileResource'][_0x7393('0x23')]({'where':{'type':_0x2bf7a9,'resourceId':_0x5b5ca9['id']}})[_0x7393('0x21')](function(){return _0x4d7870;});})[_0x7393('0x21')](function(){_0x131667[_0x7393('0x16')](0xcc)[_0x7393('0x17')]();});}};}function handleEntityNotFound(_0x2c025f,_0x1b31b8){return function(_0x39ddd3){if(!_0x39ddd3){_0x2c025f[_0x7393('0x15')](0x194);}return _0x39ddd3;};}function handleError(_0x3d8773,_0x1d7188){_0x1d7188=_0x1d7188||0x1f4;return function(_0x123ab4){logger[_0x7393('0x24')](_0x123ab4['stack']);if(_0x123ab4[_0x7393('0x25')]){delete _0x123ab4[_0x7393('0x25')];}_0x3d8773[_0x7393('0x16')](_0x1d7188)[_0x7393('0x26')](_0x123ab4);};}exports[_0x7393('0x27')]=function(_0xd8dfae,_0x4a865e){var _0x850b37={},_0x4befa4={},_0xc3c5c0={'count':0x0,'rows':[]};var _0x53c524=_[_0x7393('0x28')](db[_0x7393('0x29')][_0x7393('0x2a')],function(_0x2df555){return{'name':_0x2df555[_0x7393('0x2b')],'type':_0x2df555[_0x7393('0x2c')][_0x7393('0x2d')]};});_0x4befa4[_0x7393('0x2e')]=_[_0x7393('0x28')](_0x53c524,_0x7393('0x25'));_0x4befa4[_0x7393('0x2f')]=_[_0x7393('0x30')](_0xd8dfae['query']);_0x4befa4['filters']=_[_0x7393('0x31')](_0x4befa4['model'],_0x4befa4[_0x7393('0x2f')]);_0x850b37['attributes']=_[_0x7393('0x31')](_0x4befa4['model'],qs[_0x7393('0x32')](_0xd8dfae[_0x7393('0x2f')][_0x7393('0x32')]));_0x850b37[_0x7393('0x33')]=_0x850b37[_0x7393('0x33')][_0x7393('0x34')]?_0x850b37[_0x7393('0x33')]:_0x4befa4[_0x7393('0x2e')];if(!_0xd8dfae[_0x7393('0x2f')][_0x7393('0x35')]('nolimit')){_0x850b37[_0x7393('0x1a')]=qs['limit'](_0xd8dfae[_0x7393('0x2f')]['limit']);_0x850b37[_0x7393('0x19')]=qs[_0x7393('0x19')](_0xd8dfae[_0x7393('0x2f')][_0x7393('0x19')]);}_0x850b37[_0x7393('0x36')]=qs['sort'](_0xd8dfae[_0x7393('0x2f')]['sort']);_0x850b37[_0x7393('0x37')]=qs[_0x7393('0x38')](_[_0x7393('0x39')](_0xd8dfae[_0x7393('0x2f')],_0x4befa4[_0x7393('0x38')]));if(_0xd8dfae['query']['filter']){_0x850b37[_0x7393('0x37')]=_[_0x7393('0x3a')](_0x850b37[_0x7393('0x37')],{'$or':_[_0x7393('0x28')](_0x53c524,function(_0x54872c){if(_0x54872c['type']!=='VIRTUAL'){var _0x264393={};_0x264393[_0x54872c[_0x7393('0x25')]]={'$like':'%'+_0xd8dfae[_0x7393('0x2f')][_0x7393('0x3b')]+'%'};return _0x264393;}})});}_0x850b37=_[_0x7393('0x3a')]({},_0x850b37,_0xd8dfae[_0x7393('0x3c')]);var _0x146afb={'where':_0x850b37[_0x7393('0x37')]};return db[_0x7393('0x29')][_0x7393('0x18')](_0x146afb)[_0x7393('0x21')](function(_0x2241c8){_0xc3c5c0[_0x7393('0x18')]=_0x2241c8;if(_0xd8dfae[_0x7393('0x2f')][_0x7393('0x3d')]){_0x850b37[_0x7393('0x3e')]=[{'all':!![]}];}return db[_0x7393('0x29')][_0x7393('0x3f')](_0x850b37);})[_0x7393('0x21')](function(_0x13c476){_0xc3c5c0[_0x7393('0x40')]=_0x13c476;return _0xc3c5c0;})[_0x7393('0x21')](respondWithFilteredResult(_0x4a865e,_0x850b37))['catch'](handleError(_0x4a865e,null));};exports[_0x7393('0x41')]=function(_0x16bcbf,_0x25a2a6){var _0x40ab6d={'raw':!![],'where':{'id':_0x16bcbf[_0x7393('0x42')]['id']}},_0x1517c2={};_0x1517c2[_0x7393('0x2e')]=_[_0x7393('0x30')](db['Disposition']['rawAttributes']);_0x1517c2[_0x7393('0x2f')]=_['keys'](_0x16bcbf[_0x7393('0x2f')]);_0x1517c2[_0x7393('0x38')]=_[_0x7393('0x31')](_0x1517c2[_0x7393('0x2e')],_0x1517c2[_0x7393('0x2f')]);_0x40ab6d[_0x7393('0x33')]=_['intersection'](_0x1517c2[_0x7393('0x2e')],qs[_0x7393('0x32')](_0x16bcbf[_0x7393('0x2f')][_0x7393('0x32')]));_0x40ab6d[_0x7393('0x33')]=_0x40ab6d['attributes']['length']?_0x40ab6d[_0x7393('0x33')]:_0x1517c2['model'];if(_0x16bcbf[_0x7393('0x2f')][_0x7393('0x3d')]){_0x40ab6d[_0x7393('0x3e')]=[{'all':!![]}];}_0x40ab6d=_[_0x7393('0x3a')]({},_0x40ab6d,_0x16bcbf[_0x7393('0x3c')]);return db[_0x7393('0x29')][_0x7393('0x43')](_0x40ab6d)[_0x7393('0x21')](handleEntityNotFound(_0x25a2a6,null))[_0x7393('0x21')](respondWithResult(_0x25a2a6,null))[_0x7393('0x44')](handleError(_0x25a2a6,null));};exports[_0x7393('0x45')]=function(_0x26c327,_0x3fdbe2){return db[_0x7393('0x29')][_0x7393('0x45')](_0x26c327['body'],{})[_0x7393('0x21')](function(_0x3ed121){var _0x27b796=_0x26c327[_0x7393('0x46')]['get']({'plain':!![]});if(!_0x27b796)throw new Error(_0x7393('0x47'));if(_0x27b796[_0x7393('0x48')]===_0x7393('0x46')){var _0x275192=_0x3ed121[_0x7393('0x49')]({'plain':!![]});var _0x2bf8bd=_0x7393('0x22');return db[_0x7393('0x4a')][_0x7393('0x43')]({'where':{'name':_0x2bf8bd,'userProfileId':_0x27b796['userProfileId']},'raw':!![]})[_0x7393('0x21')](function(_0x1f66cb){if(_0x1f66cb&&_0x1f66cb[_0x7393('0x4b')]===0x0){return db['UserProfileResource'][_0x7393('0x45')]({'name':_0x275192[_0x7393('0x25')],'resourceId':_0x275192['id'],'type':_0x1f66cb['name'],'sectionId':_0x1f66cb['id']},{})[_0x7393('0x21')](function(){return _0x3ed121;});}else{return _0x3ed121;}})['catch'](function(_0x396992){logger['error'](_0x7393('0x4c'),_0x396992);throw _0x396992;});}return _0x3ed121;})[_0x7393('0x21')](respondWithResult(_0x3fdbe2,0xc9))['catch'](handleError(_0x3fdbe2,null));};exports[_0x7393('0x20')]=function(_0x695d5e,_0x24e9d1){if(_0x695d5e[_0x7393('0x4d')]['id']){delete _0x695d5e['body']['id'];}return db['Disposition']['find']({'where':{'id':_0x695d5e[_0x7393('0x42')]['id']}})[_0x7393('0x21')](handleEntityNotFound(_0x24e9d1,null))[_0x7393('0x21')](saveUpdates(_0x695d5e[_0x7393('0x4d')],null))[_0x7393('0x21')](respondWithResult(_0x24e9d1,null))[_0x7393('0x44')](handleError(_0x24e9d1,null));};exports[_0x7393('0x23')]=function(_0x90a71f,_0x44584a){return db[_0x7393('0x29')][_0x7393('0x43')]({'where':{'id':_0x90a71f[_0x7393('0x42')]['id']}})[_0x7393('0x21')](handleEntityNotFound(_0x44584a,null))[_0x7393('0x21')](removeEntity(_0x44584a,null))[_0x7393('0x44')](handleError(_0x44584a,null));}; \ No newline at end of file +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 diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 4001a41..ed5ed9e 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 _0x3e5a=['request-promise','path','../../config/environment','./disposition.attributes','exports','define','Disposition','name_voice','name','ListId','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','OpenchannelAccountId','lodash','util','../../config/logger','api','bluebird'];(function(_0x13c12b,_0x4baa0d){var _0x4fcf37=function(_0xcd644e){while(--_0xcd644e){_0x13c12b['push'](_0x13c12b['shift']());}};_0x4fcf37(++_0x4baa0d);}(_0x3e5a,0x182));var _0xa3e5=function(_0x2e9344,_0x459c45){_0x2e9344=_0x2e9344-0x0;var _0x4eccbc=_0x3e5a[_0x2e9344];return _0x4eccbc;};'use strict';var _=require(_0xa3e5('0x0'));var util=require(_0xa3e5('0x1'));var logger=require(_0xa3e5('0x2'))(_0xa3e5('0x3'));var moment=require('moment');var BPromise=require(_0xa3e5('0x4'));var rp=require(_0xa3e5('0x5'));var fs=require('fs');var path=require(_0xa3e5('0x6'));var rimraf=require('rimraf');var config=require(_0xa3e5('0x7'));var attributes=require(_0xa3e5('0x8'));module[_0xa3e5('0x9')]=function(_0x22452e,_0x149cc4){return _0x22452e[_0xa3e5('0xa')](_0xa3e5('0xb'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xa3e5('0xc'),'fields':[_0xa3e5('0xd'),_0xa3e5('0xe')]},{'unique':!![],'name':'name_chat','fields':['name',_0xa3e5('0xf')]},{'unique':!![],'name':_0xa3e5('0x10'),'fields':[_0xa3e5('0xd'),_0xa3e5('0x11')]},{'unique':!![],'name':_0xa3e5('0x12'),'fields':['name',_0xa3e5('0x13')]},{'unique':!![],'name':_0xa3e5('0x14'),'fields':[_0xa3e5('0xd'),_0xa3e5('0x15')]},{'unique':!![],'name':'name_openchannel','fields':[_0xa3e5('0xd'),_0xa3e5('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index f91e176..2226dec 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 _0x7e38=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','debug','Disposition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','Disposition,\x20%s,\x20%s','result','catch','lodash','util'];(function(_0x17eab3,_0x184514){var _0x7a037f=function(_0x531e7a){while(--_0x531e7a){_0x17eab3['push'](_0x17eab3['shift']());}};_0x7a037f(++_0x184514);}(_0x7e38,0xee));var _0x87e3=function(_0x3adf3d,_0x169586){_0x3adf3d=_0x3adf3d-0x0;var _0xdc603a=_0x7e38[_0x3adf3d];return _0xdc603a;};'use strict';var _=require(_0x87e3('0x0'));var util=require(_0x87e3('0x1'));var moment=require(_0x87e3('0x2'));var BPromise=require('bluebird');var rs=require(_0x87e3('0x3'));var fs=require('fs');var Redis=require(_0x87e3('0x4'));var db=require(_0x87e3('0x5'))['db'];var utils=require(_0x87e3('0x6'));var logger=require(_0x87e3('0x7'))('rpc');var config=require(_0x87e3('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x87e3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x244813,_0x3b4c8a,_0x95407b){return new BPromise(function(_0x42a1f8,_0x5769cb){return client['request'](_0x244813,_0x95407b)['then'](function(_0x2af74a){logger[_0x87e3('0xa')]('Disposition,\x20%s,\x20%s',_0x3b4c8a,'request\x20sent');logger[_0x87e3('0xb')](_0x87e3('0xc'),_0x3b4c8a,_0x87e3('0xd'),JSON[_0x87e3('0xe')](_0x2af74a));if(_0x2af74a[_0x87e3('0xf')]){if(_0x2af74a[_0x87e3('0xf')]['code']===0x1f4){logger['error']('Disposition,\x20%s,\x20%s',_0x3b4c8a,_0x2af74a[_0x87e3('0xf')][_0x87e3('0x10')]);return _0x5769cb(_0x2af74a[_0x87e3('0xf')][_0x87e3('0x10')]);}logger[_0x87e3('0xf')]('Disposition,\x20%s,\x20%s',_0x3b4c8a,_0x2af74a[_0x87e3('0xf')][_0x87e3('0x10')]);return _0x42a1f8(_0x2af74a['error'][_0x87e3('0x10')]);}else{logger[_0x87e3('0xa')](_0x87e3('0x11'),_0x3b4c8a,_0x87e3('0xd'));_0x42a1f8(_0x2af74a[_0x87e3('0x12')][_0x87e3('0x10')]);}})[_0x87e3('0x13')](function(_0x4fbcbb){logger['error'](_0x87e3('0x11'),_0x3b4c8a,_0x4fbcbb);_0x5769cb(_0x4fbcbb);});});} \ No newline at end of file +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 diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 6daf508..00799b7 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 _0xb1fa=['isAuthenticated','update','delete','exports','path','express','get','/:id','show','post','create'];(function(_0xdce1f4,_0x17930b){var _0x5a7db0=function(_0x4c1da2){while(--_0x4c1da2){_0xdce1f4['push'](_0xdce1f4['shift']());}};_0x5a7db0(++_0x17930b);}(_0xb1fa,0x9e));var _0xab1f=function(_0x19e98f,_0x4d3e66){_0x19e98f=_0x19e98f-0x0;var _0x55f176=_0xb1fa[_0x19e98f];return _0x55f176;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xab1f('0x0'));var timeout=require('connect-timeout');var express=require(_0xab1f('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0xab1f('0x2')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xab1f('0x3'),auth['isAuthenticated'](),controller[_0xab1f('0x4')]);router[_0xab1f('0x5')]('/',auth['isAuthenticated'](),controller[_0xab1f('0x6')]);router['put']('/:id',auth[_0xab1f('0x7')](),controller[_0xab1f('0x8')]);router[_0xab1f('0x9')](_0xab1f('0x3'),auth[_0xab1f('0x7')](),controller['destroy']);module[_0xab1f('0xa')]=router; \ No newline at end of file +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 diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 37062f1..55c2a29 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 _0xfd10=['9600','12000','14400','2400','IAX','DADHI','KHOMP','SIP','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','localstationid','4800','7200'];(function(_0x134edc,_0x174749){var _0x31e8ec=function(_0x5a7d56){while(--_0x5a7d56){_0x134edc['push'](_0x134edc['shift']());}};_0x31e8ec(++_0x174749);}(_0xfd10,0x178));var _0x0fd1=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xfd10[_0x1ccdf7];return _0x52a0ae;};'use strict';var Sequelize=require(_0x0fd1('0x0'));module[_0x0fd1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0fd1('0x2')]},'ecm':{'type':Sequelize[_0x0fd1('0x3')](_0x0fd1('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize['STRING'],'unique':_0x0fd1('0x5')},'minrate':{'type':Sequelize[_0x0fd1('0x3')]('2400',_0x0fd1('0x6'),_0x0fd1('0x7'),_0x0fd1('0x8'),_0x0fd1('0x9'),_0x0fd1('0xa')),'defaultValue':'4800'},'maxrate':{'type':Sequelize['ENUM'](_0x0fd1('0xb'),_0x0fd1('0x6'),_0x0fd1('0x7'),_0x0fd1('0x8'),_0x0fd1('0x9'),_0x0fd1('0xa')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x0fd1('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x0fd1('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x0fd1('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x0fd1('0x3')]('SIP',_0x0fd1('0xc'),_0x0fd1('0xd'),_0x0fd1('0xe')),'defaultValue':_0x0fd1('0xf')},'key':{'type':Sequelize[_0x0fd1('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x0fd1('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x0fd1('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0fd1('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0fd1('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0fd1('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0fd1('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0fd1('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0fd1('0x12')],'allowNull':!![],'defaultValue':null,'comment':_0x0fd1('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x0fd1('0x14'),'set':function(_0x2681b9){if(!_0x2681b9)this[_0x0fd1('0x15')](_0x0fd1('0x16'),null);this['setDataValue'](_0x0fd1('0x17'),_0x2681b9);}}}; \ No newline at end of file +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 diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 153dcb2..2ba7a03 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 _0xef2c=['eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxAccount.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','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','rawAttributes','include','find','create','body','user','role','userProfileId','autoAssociation','describe','FaxAccountId','getDispositions','findOne','Disposition','length','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','User','fullname','internal','Tag','color','tag','addApplications','sequelize','transaction','bulkCreate','FaxApplication','priority','getApplications','context','from-voip-provider','localstationid','app','system','description','Fax\x20Extension','push','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','minrate','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','VoiceExtension','updateAccountApplications','tech','updatedAt','ListId','findById','FaxMessage','$gte','split','format','CmList','CmContact','Contacts','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','List','Send\x20Fax\x20failed','filename','Messages','Contact\x20not\x20found','out','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','html-pdf'];(function(_0x1e1a2e,_0x236067){var _0x5e1e35=function(_0xd791ec){while(--_0xd791ec){_0x1e1a2e['push'](_0x1e1a2e['shift']());}};_0x5e1e35(++_0x236067);}(_0xef2c,0x177));var _0xcef2=function(_0x1559a5,_0x41924e){_0x1559a5=_0x1559a5-0x0;var _0x17a783=_0xef2c[_0x1559a5];return _0x17a783;};'use strict';var pdf=require(_0xcef2('0x0'));var emlformat=require(_0xcef2('0x1'));var rimraf=require(_0xcef2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcef2('0x3'));var moment=require(_0xcef2('0x4'));var BPromise=require(_0xcef2('0x5'));var Mustache=require(_0xcef2('0x6'));var util=require(_0xcef2('0x7'));var path=require(_0xcef2('0x8'));var sox=require(_0xcef2('0x9'));var csv=require(_0xcef2('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xcef2('0xb'));var squel=require(_0xcef2('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcef2('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcef2('0xe'));var authService=require(_0xcef2('0xf'));var qs=require(_0xcef2('0x10'));var as=require(_0xcef2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcef2('0x12'));var utils=require(_0xcef2('0x13'));var config=require('../../config/environment');var db=require(_0xcef2('0x14'))['db'];config['redis']=_[_0xcef2('0x15')](config[_0xcef2('0x16')],{'host':_0xcef2('0x17'),'port':0x18eb});var socket=require(_0xcef2('0x18'))(new Redis(config[_0xcef2('0x16')]));require(_0xcef2('0x19'))[_0xcef2('0x1a')](socket);var jayson=require(_0xcef2('0x1b'));var client=jayson[_0xcef2('0x1c')][_0xcef2('0x1d')]({'port':0x232c});var client9002=jayson[_0xcef2('0x1c')][_0xcef2('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x54963c,_0x1e6c7a,_0x3c42a6){if(_0x3c42a6){var _0x4be893=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4be893[_0xcef2('0x1e')](_0x1e6c7a)){return _0x54963c;}else{throw new db[(_0xcef2('0x1f'))][(_0xcef2('0x20'))](_0xcef2('0x21'));}}else{return _0x54963c;}}function respondWithRpcPromise(_0x1d7152,_0x466f14,_0x4998d7,_0x34eec9){return new BPromise(function(_0x41b399,_0x3044cd){var _0x1e2bfb=_0x34eec9||client;return _0x1e2bfb[_0xcef2('0x22')](_0x1d7152,_0x4998d7)[_0xcef2('0x23')](function(_0x4daed6){logger['info'](_0xcef2('0x24'),_0x466f14,_0xcef2('0x25'));logger['debug'](_0xcef2('0x26'),_0x466f14,_0xcef2('0x25'),JSON[_0xcef2('0x27')](_0x4daed6));if(_0x4daed6[_0xcef2('0x28')]){if(_0x4daed6[_0xcef2('0x28')][_0xcef2('0x29')]===0x1f4){logger['error'](_0xcef2('0x24'),_0x466f14,_0x4daed6[_0xcef2('0x28')][_0xcef2('0x2a')]);return _0x3044cd(_0x4daed6[_0xcef2('0x28')][_0xcef2('0x2a')]);}logger[_0xcef2('0x28')](_0xcef2('0x24'),_0x466f14,_0x4daed6[_0xcef2('0x28')][_0xcef2('0x2a')]);return _0x41b399(_0x4daed6[_0xcef2('0x28')][_0xcef2('0x2a')]);}else{logger[_0xcef2('0x2b')]('FaxAccount,\x20%s,\x20%s',_0x466f14,'request\x20sent');_0x41b399(_0x4daed6['result'][_0xcef2('0x2a')]);}})[_0xcef2('0x2c')](function(_0x10fa16){logger['error'](_0xcef2('0x24'),_0x466f14,_0x10fa16);_0x3044cd(_0x10fa16);});});}function respondWithStatusCode(_0x38342e,_0x24a5ea){_0x24a5ea=_0x24a5ea||0xcc;return function(_0x578693){if(_0x578693){return _0x38342e[_0xcef2('0x2d')](_0x24a5ea);}return _0x38342e[_0xcef2('0x2e')](_0x24a5ea)[_0xcef2('0x2f')]();};}function respondWithResult(_0x1e36cb,_0x225cc6){_0x225cc6=_0x225cc6||0xc8;return function(_0xd85e75){if(_0xd85e75){return _0x1e36cb[_0xcef2('0x2e')](_0x225cc6)[_0xcef2('0x30')](_0xd85e75);}};}function respondWithFilteredResult(_0x8eeb03,_0x3724ee){return function(_0x2f5253){if(_0x2f5253){var _0x8b71fd=_0x2f5253[_0xcef2('0x31')],_0x29448b=_0x3724ee[_0xcef2('0x32')],_0x35442a=_0x3724ee[_0xcef2('0x32')]+_0x3724ee[_0xcef2('0x33')],_0x95ae7c;if(_0x35442a>=_0x8b71fd){_0x35442a=_0x8b71fd;_0x95ae7c=0xc8;}else{_0x95ae7c=0xce;}_0x8eeb03[_0xcef2('0x2e')](_0x95ae7c);return _0x8eeb03[_0xcef2('0x34')](_0xcef2('0x35'),_0x29448b+'-'+_0x35442a+'/'+_0x8b71fd)[_0xcef2('0x30')](_0x2f5253);}return null;};}function patchUpdates(_0x1fe1ed){return function(_0x57f91a){try{jsonpatch[_0xcef2('0x36')](_0x57f91a,_0x1fe1ed,!![]);}catch(_0x4dfffa){return BPromise[_0xcef2('0x37')](_0x4dfffa);}return _0x57f91a[_0xcef2('0x38')]();};}function saveUpdates(_0x3c5b91,_0x41166e){return function(_0x449e1e){if(_0x449e1e){return _0x449e1e[_0xcef2('0x39')](_0x3c5b91)[_0xcef2('0x23')](function(_0x5193c0){return _0x5193c0;});}return null;};}function removeEntity(_0x44608e,_0x3d9207){return function(_0x41575e){if(_0x41575e){return _0x41575e[_0xcef2('0x3a')]()[_0xcef2('0x23')](function(){var _0x3db15a=_0x41575e[_0xcef2('0x3b')]({'plain':!![]});var _0x5dead8=_0xcef2('0x3c');return db[_0xcef2('0x3d')][_0xcef2('0x3a')]({'where':{'type':_0x5dead8,'resourceId':_0x3db15a['id']}})[_0xcef2('0x23')](function(){return _0x41575e;});})[_0xcef2('0x23')](function(){_0x44608e[_0xcef2('0x2e')](0xcc)[_0xcef2('0x2f')]();});}};}function handleEntityNotFound(_0x28d5dc,_0xf26e1){return function(_0x5e66da){if(!_0x5e66da){_0x28d5dc['sendStatus'](0x194);}return _0x5e66da;};}function handleError(_0x46a2cf,_0x21fba8){_0x21fba8=_0x21fba8||0x1f4;return function(_0x312fb5){logger[_0xcef2('0x28')](_0x312fb5['stack']);if(_0x312fb5[_0xcef2('0x3e')]){delete _0x312fb5[_0xcef2('0x3e')];}_0x46a2cf[_0xcef2('0x2e')](_0x21fba8)[_0xcef2('0x3f')](_0x312fb5);};}exports[_0xcef2('0x40')]=function(_0x467d72,_0x3a895d){var _0x4e558e={'include':[{'model':db[_0xcef2('0x41')],'as':_0xcef2('0x42')}]},_0x5efddd={},_0x5effc1={'count':0x0,'rows':[]};var _0x2d7aae=_[_0xcef2('0x43')](db[_0xcef2('0x44')]['rawAttributes'],function(_0x5d4003){return{'name':_0x5d4003['fieldName'],'type':_0x5d4003[_0xcef2('0x45')][_0xcef2('0x46')]};});_0x5efddd[_0xcef2('0x47')]=_[_0xcef2('0x43')](_0x2d7aae,_0xcef2('0x3e'));_0x5efddd['query']=_[_0xcef2('0x48')](_0x467d72['query']);_0x5efddd[_0xcef2('0x49')]=_[_0xcef2('0x4a')](_0x5efddd[_0xcef2('0x47')],_0x5efddd[_0xcef2('0x4b')]);_0x4e558e[_0xcef2('0x4c')]=_[_0xcef2('0x4a')](_0x5efddd[_0xcef2('0x47')],qs[_0xcef2('0x4d')](_0x467d72[_0xcef2('0x4b')][_0xcef2('0x4d')]));_0x4e558e[_0xcef2('0x4c')]=_0x4e558e[_0xcef2('0x4c')]['length']?_0x4e558e[_0xcef2('0x4c')]:_0x5efddd[_0xcef2('0x47')];if(!_0x467d72[_0xcef2('0x4b')][_0xcef2('0x4e')](_0xcef2('0x4f'))){_0x4e558e[_0xcef2('0x33')]=qs['limit'](_0x467d72['query'][_0xcef2('0x33')]);_0x4e558e[_0xcef2('0x32')]=qs[_0xcef2('0x32')](_0x467d72[_0xcef2('0x4b')][_0xcef2('0x32')]);}_0x4e558e[_0xcef2('0x50')]=qs[_0xcef2('0x51')](_0x467d72[_0xcef2('0x4b')][_0xcef2('0x51')]);_0x4e558e[_0xcef2('0x52')]=qs['filters'](_[_0xcef2('0x53')](_0x467d72[_0xcef2('0x4b')],_0x5efddd['filters']));if(_0x467d72[_0xcef2('0x4b')][_0xcef2('0x54')]){_0x4e558e['where']=_['merge'](_0x4e558e[_0xcef2('0x52')],{'$or':_[_0xcef2('0x43')](_0x2d7aae,function(_0x1098fa){if(_0x1098fa[_0xcef2('0x45')]!==_0xcef2('0x55')){var _0x719a83={};_0x719a83[_0x1098fa[_0xcef2('0x3e')]]={'$like':'%'+_0x467d72[_0xcef2('0x4b')][_0xcef2('0x54')]+'%'};return _0x719a83;}})});}_0x4e558e=_[_0xcef2('0x56')]({},_0x4e558e,_0x467d72[_0xcef2('0x57')]);var _0x92bf59={'where':_0x4e558e[_0xcef2('0x52')]};return db[_0xcef2('0x44')][_0xcef2('0x31')](_0x92bf59)['then'](function(_0x1b0838){_0x5effc1[_0xcef2('0x31')]=_0x1b0838;if(_0x467d72[_0xcef2('0x4b')][_0xcef2('0x58')]){_0x4e558e['include']=[{'all':!![]}];}return db[_0xcef2('0x44')][_0xcef2('0x59')](_0x4e558e);})[_0xcef2('0x23')](function(_0x2ac09c){_0x5effc1[_0xcef2('0x5a')]=_0x2ac09c;return _0x5effc1;})['then'](respondWithFilteredResult(_0x3a895d,_0x4e558e))['catch'](handleError(_0x3a895d,null));};exports[_0xcef2('0x5b')]=function(_0x53d85c,_0x18c9c7){var _0x185ea8={'raw':![],'where':{'id':_0x53d85c[_0xcef2('0x5c')]['id']},'include':[{'model':db[_0xcef2('0x41')],'as':_0xcef2('0x42')}]},_0x328245={};_0x328245[_0xcef2('0x47')]=_[_0xcef2('0x48')](db['FaxAccount'][_0xcef2('0x5d')]);_0x328245[_0xcef2('0x4b')]=_['keys'](_0x53d85c['query']);_0x328245[_0xcef2('0x49')]=_[_0xcef2('0x4a')](_0x328245['model'],_0x328245['query']);_0x185ea8[_0xcef2('0x4c')]=_[_0xcef2('0x4a')](_0x328245[_0xcef2('0x47')],qs[_0xcef2('0x4d')](_0x53d85c['query'][_0xcef2('0x4d')]));_0x185ea8[_0xcef2('0x4c')]=_0x185ea8['attributes']['length']?_0x185ea8['attributes']:_0x328245['model'];if(_0x53d85c['query'][_0xcef2('0x58')]){_0x185ea8[_0xcef2('0x5e')]=[{'all':!![]}];}_0x185ea8=_[_0xcef2('0x56')]({},_0x185ea8,_0x53d85c[_0xcef2('0x57')]);return db[_0xcef2('0x44')][_0xcef2('0x5f')](_0x185ea8)[_0xcef2('0x23')](handleEntityNotFound(_0x18c9c7,null))[_0xcef2('0x23')](respondWithResult(_0x18c9c7,null))[_0xcef2('0x2c')](handleError(_0x18c9c7,null));};exports[_0xcef2('0x60')]=function(_0x4d4db3,_0x24029f){return db['FaxAccount'][_0xcef2('0x60')](_0x4d4db3[_0xcef2('0x61')],{})['then'](function(_0x43b9b2){var _0x1ea0c4=_0x4d4db3[_0xcef2('0x62')][_0xcef2('0x3b')]({'plain':!![]});if(!_0x1ea0c4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ea0c4[_0xcef2('0x63')]===_0xcef2('0x62')){var _0x1f4a0e=_0x43b9b2['get']({'plain':!![]});var _0x3396a=_0xcef2('0x3c');return db['UserProfileSection'][_0xcef2('0x5f')]({'where':{'name':_0x3396a,'userProfileId':_0x1ea0c4[_0xcef2('0x64')]},'raw':!![]})[_0xcef2('0x23')](function(_0x961988){if(_0x961988&&_0x961988[_0xcef2('0x65')]===0x0){return db[_0xcef2('0x3d')][_0xcef2('0x60')]({'name':_0x1f4a0e[_0xcef2('0x3e')],'resourceId':_0x1f4a0e['id'],'type':_0x961988[_0xcef2('0x3e')],'sectionId':_0x961988['id']},{})[_0xcef2('0x23')](function(){return _0x43b9b2;});}else{return _0x43b9b2;}})[_0xcef2('0x2c')](function(_0x607a1b){logger[_0xcef2('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x607a1b);throw _0x607a1b;});}return _0x43b9b2;})[_0xcef2('0x23')](respondWithResult(_0x24029f,0xc9))['catch'](handleError(_0x24029f,null));};exports[_0xcef2('0x39')]=function(_0x4d4a91,_0x18050a){if(_0x4d4a91[_0xcef2('0x61')]['id']){delete _0x4d4a91[_0xcef2('0x61')]['id'];}return db[_0xcef2('0x44')]['find']({'where':{'id':_0x4d4a91['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xcef2('0x23')](handleEntityNotFound(_0x18050a,null))[_0xcef2('0x23')](saveUpdates(_0x4d4a91[_0xcef2('0x61')],null))[_0xcef2('0x23')](respondWithResult(_0x18050a,null))[_0xcef2('0x2c')](handleError(_0x18050a,null));};exports[_0xcef2('0x3a')]=function(_0x510b71,_0x27e374){return db['FaxAccount'][_0xcef2('0x5f')]({'where':{'id':_0x510b71['params']['id']}})[_0xcef2('0x23')](handleEntityNotFound(_0x27e374,null))[_0xcef2('0x23')](removeEntity(_0x27e374,null))['catch'](handleError(_0x27e374,null));};exports[_0xcef2('0x66')]=function(_0x458a47,_0x4bb4cf){return db['FaxAccount'][_0xcef2('0x66')]()[_0xcef2('0x23')](respondWithResult(_0x4bb4cf,null))[_0xcef2('0x2c')](handleError(_0x4bb4cf,null));};exports['addDisposition']=function(_0x326779,_0x314b62,_0x3ef179){if(_0x326779[_0xcef2('0x61')]['id']){delete _0x326779['body']['id'];}return db[_0xcef2('0x44')][_0xcef2('0x5f')]({'where':{'id':_0x326779['params']['id']}})['then'](handleEntityNotFound(_0x314b62,null))[_0xcef2('0x23')](function(_0x581a02){if(_0x581a02){_0x326779[_0xcef2('0x61')][_0xcef2('0x67')]=_0x581a02['id'];return db['Disposition'][_0xcef2('0x60')](_0x326779[_0xcef2('0x61')]);}})['then'](respondWithResult(_0x314b62,null))[_0xcef2('0x2c')](handleError(_0x314b62,null));};exports[_0xcef2('0x68')]=function(_0x421fe6,_0x373c31,_0x4bdd11){var _0x1a9385={'raw':![],'where':{}};var _0x581dae={};var _0x2ef8e8={'count':0x0,'rows':[]};return db[_0xcef2('0x44')][_0xcef2('0x69')]({'where':{'id':_0x421fe6[_0xcef2('0x5c')]['id']}})[_0xcef2('0x23')](handleEntityNotFound(_0x373c31,null))['then'](function(_0x540e32){if(_0x540e32){_0x581dae[_0xcef2('0x47')]=_['keys'](db[_0xcef2('0x6a')][_0xcef2('0x5d')]);_0x581dae[_0xcef2('0x4b')]=_['keys'](_0x421fe6[_0xcef2('0x4b')]);_0x581dae['filters']=_[_0xcef2('0x4a')](_0x581dae[_0xcef2('0x47')],_0x581dae[_0xcef2('0x4b')]);_0x1a9385[_0xcef2('0x4c')]=_[_0xcef2('0x4a')](_0x581dae[_0xcef2('0x47')],qs[_0xcef2('0x4d')](_0x421fe6[_0xcef2('0x4b')][_0xcef2('0x4d')]));_0x1a9385['attributes']=_0x1a9385[_0xcef2('0x4c')][_0xcef2('0x6b')]?_0x1a9385[_0xcef2('0x4c')]:_0x581dae[_0xcef2('0x47')];if(!_0x421fe6[_0xcef2('0x4b')][_0xcef2('0x4e')](_0xcef2('0x4f'))){_0x1a9385['limit']=qs[_0xcef2('0x33')](_0x421fe6[_0xcef2('0x4b')]['limit']);_0x1a9385['offset']=qs['offset'](_0x421fe6['query'][_0xcef2('0x32')]);}_0x1a9385['order']=qs['sort'](_0x421fe6[_0xcef2('0x4b')][_0xcef2('0x51')]);_0x1a9385['where']=qs['filters'](_[_0xcef2('0x53')](_0x421fe6[_0xcef2('0x4b')],_0x581dae[_0xcef2('0x49')]));_0x1a9385[_0xcef2('0x52')][_0xcef2('0x67')]=_0x540e32['id'];if(_0x421fe6[_0xcef2('0x4b')][_0xcef2('0x54')]){_0x1a9385['where']=_['merge'](_0x1a9385[_0xcef2('0x52')],{'$or':_['map'](_0x1a9385[_0xcef2('0x4c')],function(_0x552c52){var _0x587378={};_0x587378[_0x552c52]={'$like':'%'+_0x421fe6[_0xcef2('0x4b')][_0xcef2('0x54')]+'%'};return _0x587378;})});}_0x1a9385=_[_0xcef2('0x56')]({},_0x1a9385,_0x421fe6[_0xcef2('0x57')]);return db[_0xcef2('0x6a')]['count']({'where':_0x1a9385[_0xcef2('0x52')]})[_0xcef2('0x23')](function(_0x39b67c){_0x2ef8e8[_0xcef2('0x31')]=_0x39b67c;if(_0x421fe6[_0xcef2('0x4b')][_0xcef2('0x58')]){_0x1a9385['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x1a9385);})['then'](function(_0x330e30){_0x2ef8e8[_0xcef2('0x5a')]=_0x330e30;return _0x2ef8e8;});}})[_0xcef2('0x23')](respondWithFilteredResult(_0x373c31,_0x1a9385))['catch'](handleError(_0x373c31,null));};exports[_0xcef2('0x6c')]=function(_0x2bc964,_0xa95834,_0x225261){return db[_0xcef2('0x44')][_0xcef2('0x5f')]({'where':{'id':_0x2bc964['params']['id']}})[_0xcef2('0x23')](handleEntityNotFound(_0xa95834,null))[_0xcef2('0x23')](function(_0x2361ec){if(_0x2361ec){return _0x2361ec['removeDispositions'](_0x2bc964[_0xcef2('0x4b')][_0xcef2('0x6d')]);}})[_0xcef2('0x23')](respondWithStatusCode(_0xa95834,null))[_0xcef2('0x2c')](handleError(_0xa95834,null));};exports[_0xcef2('0x6e')]=function(_0xbfdb71,_0x427140,_0x2566a6){if(_0xbfdb71[_0xcef2('0x61')]['id']){delete _0xbfdb71[_0xcef2('0x61')]['id'];}return db[_0xcef2('0x44')][_0xcef2('0x5f')]({'where':{'id':_0xbfdb71[_0xcef2('0x5c')]['id']}})[_0xcef2('0x23')](handleEntityNotFound(_0x427140,null))[_0xcef2('0x23')](function(_0xa8dcf5){if(_0xa8dcf5){_0xbfdb71[_0xcef2('0x61')][_0xcef2('0x67')]=_0xa8dcf5['id'];return db[_0xcef2('0x6f')][_0xcef2('0x60')](_0xbfdb71['body']);}})[_0xcef2('0x23')](respondWithResult(_0x427140,null))[_0xcef2('0x2c')](handleError(_0x427140,null));};exports[_0xcef2('0x70')]=function(_0x2a2544,_0x2f2021,_0x445e82){var _0x5528ac={'raw':![],'where':{}};var _0x565846={};var _0x3e90ca={'count':0x0,'rows':[]};return db[_0xcef2('0x44')][_0xcef2('0x69')]({'where':{'id':_0x2a2544[_0xcef2('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2f2021,null))['then'](function(_0x4d186d){if(_0x4d186d){_0x565846[_0xcef2('0x47')]=_[_0xcef2('0x48')](db[_0xcef2('0x6f')][_0xcef2('0x5d')]);_0x565846[_0xcef2('0x4b')]=_[_0xcef2('0x48')](_0x2a2544[_0xcef2('0x4b')]);_0x565846[_0xcef2('0x49')]=_[_0xcef2('0x4a')](_0x565846[_0xcef2('0x47')],_0x565846[_0xcef2('0x4b')]);_0x5528ac[_0xcef2('0x4c')]=_['intersection'](_0x565846[_0xcef2('0x47')],qs[_0xcef2('0x4d')](_0x2a2544[_0xcef2('0x4b')][_0xcef2('0x4d')]));_0x5528ac[_0xcef2('0x4c')]=_0x5528ac[_0xcef2('0x4c')][_0xcef2('0x6b')]?_0x5528ac[_0xcef2('0x4c')]:_0x565846['model'];if(!_0x2a2544[_0xcef2('0x4b')][_0xcef2('0x4e')](_0xcef2('0x4f'))){_0x5528ac[_0xcef2('0x33')]=qs[_0xcef2('0x33')](_0x2a2544[_0xcef2('0x4b')][_0xcef2('0x33')]);_0x5528ac['offset']=qs[_0xcef2('0x32')](_0x2a2544[_0xcef2('0x4b')][_0xcef2('0x32')]);}_0x5528ac['order']=qs[_0xcef2('0x51')](_0x2a2544[_0xcef2('0x4b')]['sort']);_0x5528ac[_0xcef2('0x52')]=qs[_0xcef2('0x49')](_[_0xcef2('0x53')](_0x2a2544['query'],_0x565846[_0xcef2('0x49')]));_0x5528ac['where']['FaxAccountId']=_0x4d186d['id'];if(_0x2a2544[_0xcef2('0x4b')][_0xcef2('0x54')]){_0x5528ac[_0xcef2('0x52')]=_[_0xcef2('0x56')](_0x5528ac[_0xcef2('0x52')],{'$or':_[_0xcef2('0x43')](_0x5528ac[_0xcef2('0x4c')],function(_0xf50b48){var _0xa9c54={};_0xa9c54[_0xf50b48]={'$like':'%'+_0x2a2544[_0xcef2('0x4b')][_0xcef2('0x54')]+'%'};return _0xa9c54;})});}_0x5528ac=_[_0xcef2('0x56')]({},_0x5528ac,_0x2a2544[_0xcef2('0x57')]);return db[_0xcef2('0x6f')][_0xcef2('0x31')]({'where':_0x5528ac[_0xcef2('0x52')]})[_0xcef2('0x23')](function(_0x2ac50b){_0x3e90ca[_0xcef2('0x31')]=_0x2ac50b;if(_0x2a2544[_0xcef2('0x4b')][_0xcef2('0x58')]){_0x5528ac[_0xcef2('0x5e')]=[{'all':!![]}];}return db[_0xcef2('0x6f')]['findAll'](_0x5528ac);})[_0xcef2('0x23')](function(_0x16b963){_0x3e90ca['rows']=_0x16b963;return _0x3e90ca;});}})['then'](respondWithFilteredResult(_0x2f2021,_0x5528ac))[_0xcef2('0x2c')](handleError(_0x2f2021,null));};exports['removeAnswers']=function(_0x18d438,_0x510e16,_0x28c0bc){return db['FaxAccount'][_0xcef2('0x5f')]({'where':{'id':_0x18d438[_0xcef2('0x5c')]['id']}})[_0xcef2('0x23')](handleEntityNotFound(_0x510e16,null))[_0xcef2('0x23')](function(_0x5284ed){if(_0x5284ed){return _0x5284ed[_0xcef2('0x71')](_0x18d438[_0xcef2('0x4b')][_0xcef2('0x6d')]);}})[_0xcef2('0x23')](respondWithStatusCode(_0x510e16,null))['catch'](handleError(_0x510e16,null));};exports[_0xcef2('0x72')]=function(_0x39ceec,_0x3fb4d5,_0x206db6){return db['FaxInteraction']['find']({'where':{'id':_0x39ceec[_0xcef2('0x5c')]['id']}})[_0xcef2('0x23')](handleEntityNotFound(_0x3fb4d5,null))[_0xcef2('0x23')](function(_0x425206){if(_0x425206){return _0x425206['addInteraction'](_0x39ceec[_0xcef2('0x61')][_0xcef2('0x6d')],_[_0xcef2('0x73')](_0x39ceec[_0xcef2('0x61')],[_0xcef2('0x6d'),'id'])||{});}})['then'](respondWithResult(_0x3fb4d5,null))[_0xcef2('0x2c')](handleError(_0x3fb4d5,null));};exports[_0xcef2('0x74')]=function(_0x4022c8,_0x94a1e1,_0x24df54){var _0x53ba24={'raw':![],'where':{}};var _0xbe00c9={};var _0x2116c2={'count':0x0,'rows':[]};return db[_0xcef2('0x44')][_0xcef2('0x69')]({'where':{'id':_0x4022c8['params']['id']}})['then'](handleEntityNotFound(_0x94a1e1,null))[_0xcef2('0x23')](function(_0x86c5c9){if(_0x86c5c9){_0xbe00c9[_0xcef2('0x47')]=_[_0xcef2('0x48')](db[_0xcef2('0x75')][_0xcef2('0x5d')]);_0xbe00c9['query']=_[_0xcef2('0x48')](_0x4022c8[_0xcef2('0x4b')]);_0xbe00c9['filters']=_[_0xcef2('0x4a')](_0xbe00c9[_0xcef2('0x47')],_0xbe00c9[_0xcef2('0x4b')]);_0x53ba24[_0xcef2('0x4c')]=_[_0xcef2('0x4a')](_0xbe00c9[_0xcef2('0x47')],qs[_0xcef2('0x4d')](_0x4022c8[_0xcef2('0x4b')][_0xcef2('0x4d')]));_0x53ba24[_0xcef2('0x4c')]=_0x53ba24['attributes'][_0xcef2('0x6b')]?_0x53ba24['attributes']:_0xbe00c9[_0xcef2('0x47')];if(!_0x4022c8[_0xcef2('0x4b')][_0xcef2('0x4e')](_0xcef2('0x4f'))){_0x53ba24['limit']=qs[_0xcef2('0x33')](_0x4022c8['query'][_0xcef2('0x33')]);_0x53ba24['offset']=qs[_0xcef2('0x32')](_0x4022c8[_0xcef2('0x4b')][_0xcef2('0x32')]);}_0x53ba24[_0xcef2('0x50')]=qs['sort'](_0x4022c8[_0xcef2('0x4b')]['sort']);_0x53ba24['where']=qs['filters'](_[_0xcef2('0x53')](_0x4022c8['query'],_0xbe00c9[_0xcef2('0x49')]));_0x53ba24[_0xcef2('0x52')][_0xcef2('0x67')]=_0x86c5c9['id'];if(_0x4022c8[_0xcef2('0x4b')][_0xcef2('0x54')]){_0x53ba24[_0xcef2('0x52')]=_[_0xcef2('0x56')](_0x53ba24['where'],{'$or':_['map'](_0x53ba24['attributes'],function(_0x5136d4){var _0x3c4a90={};_0x3c4a90[_0x5136d4]={'$like':'%'+_0x4022c8[_0xcef2('0x4b')][_0xcef2('0x54')]+'%'};return _0x3c4a90;})});}_0x53ba24=_[_0xcef2('0x56')]({},_0x53ba24,_0x4022c8[_0xcef2('0x57')]);return db[_0xcef2('0x75')]['count']({'where':_0x53ba24[_0xcef2('0x52')]})[_0xcef2('0x23')](function(_0x6b320b){_0x2116c2[_0xcef2('0x31')]=_0x6b320b;if(_0x4022c8['query']['includeAll']){_0x53ba24[_0xcef2('0x5e')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xcef2('0x76')],'as':'Owner','attributes':['name',_0xcef2('0x77'),_0xcef2('0x78')],'required':![]},{'model':db[_0xcef2('0x79')],'as':'Tags','attributes':['id',_0xcef2('0x3e'),_0xcef2('0x7a')],'where':_0x4022c8[_0xcef2('0x4b')][_0xcef2('0x7b')]?{'id':_0x4022c8[_0xcef2('0x4b')][_0xcef2('0x7b')]}:undefined,'required':_0x4022c8['query'][_0xcef2('0x7b')]?!![]:![]}];}return db[_0xcef2('0x75')][_0xcef2('0x59')](_0x53ba24);})[_0xcef2('0x23')](function(_0x17cf38){_0x2116c2['rows']=_0x17cf38;return _0x2116c2;});}})[_0xcef2('0x23')](respondWithFilteredResult(_0x94a1e1,_0x53ba24))[_0xcef2('0x2c')](handleError(_0x94a1e1,null));};exports[_0xcef2('0x7c')]=function(_0x5972d0,_0x262805,_0x4ea3b3){return db['FaxAccount']['findOne']({'where':{'id':_0x5972d0[_0xcef2('0x5c')]['id']}})[_0xcef2('0x23')](handleEntityNotFound(_0x262805,null))[_0xcef2('0x23')](function(_0x28e2e5){if(_0x28e2e5){return db[_0xcef2('0x7d')][_0xcef2('0x7e')](function(_0xadac0a){return db['FaxApplication']['destroy']({'where':{'FaxAccountId':_0x5972d0[_0xcef2('0x5c')]['id']},'transaction':_0xadac0a})['then'](function(_0x450866){var _0x5ac62e=_[_0xcef2('0x43')](_0x5972d0[_0xcef2('0x61')],function(_0x2735a5){_0x2735a5['FaxAccountId']=_0x5972d0[_0xcef2('0x5c')]['id'];return _0x2735a5;});return db['FaxApplication'][_0xcef2('0x7f')](_0x5ac62e,{'transaction':_0xadac0a});});})[_0xcef2('0x23')](function(){return db[_0xcef2('0x80')]['findAndCountAll']({'where':{'FaxAccountId':_0x5972d0['params']['id']},'order':_0xcef2('0x81')});});}})['then'](respondWithResult(_0x262805,null))[_0xcef2('0x2c')](handleError(_0x262805,null));};exports[_0xcef2('0x82')]=function(_0x417721,_0x3f0d36,_0xbe7119){var _0x10c4ed={};var _0x300de1={};var _0x1ac92a;var _0x394496;return db['FaxAccount'][_0xcef2('0x69')]({'where':{'id':_0x417721[_0xcef2('0x5c')]['id']}})[_0xcef2('0x23')](handleEntityNotFound(_0x3f0d36,null))[_0xcef2('0x23')](function(_0x611bf8){if(_0x611bf8){_0x1ac92a=_0x611bf8;_0x300de1[_0xcef2('0x47')]=_['keys'](db[_0xcef2('0x80')][_0xcef2('0x5d')]);_0x300de1['query']=_[_0xcef2('0x48')](_0x417721[_0xcef2('0x4b')]);_0x300de1[_0xcef2('0x49')]=_[_0xcef2('0x4a')](_0x300de1['model'],_0x300de1['query']);_0x10c4ed[_0xcef2('0x4c')]=_[_0xcef2('0x4a')](_0x300de1[_0xcef2('0x47')],qs[_0xcef2('0x4d')](_0x417721[_0xcef2('0x4b')][_0xcef2('0x4d')]));_0x10c4ed[_0xcef2('0x4c')]=_0x10c4ed[_0xcef2('0x4c')][_0xcef2('0x6b')]?_0x10c4ed[_0xcef2('0x4c')]:_0x300de1[_0xcef2('0x47')];_0x10c4ed[_0xcef2('0x50')]=qs[_0xcef2('0x51')](_0x417721[_0xcef2('0x4b')][_0xcef2('0x51')]);_0x10c4ed[_0xcef2('0x52')]=qs['filters'](_['pick'](_0x417721['query'],_0x300de1[_0xcef2('0x49')]));if(_0x417721[_0xcef2('0x4b')][_0xcef2('0x54')]){_0x10c4ed[_0xcef2('0x52')]=_['merge'](_0x10c4ed['where'],{'$or':_['map'](_0x10c4ed[_0xcef2('0x4c')],function(_0xf86aed){var _0x404ff8={};_0x404ff8[_0xf86aed]={'$like':'%'+_0x417721['query'][_0xcef2('0x54')]+'%'};return _0x404ff8;})});}_0x10c4ed=_['merge']({},_0x10c4ed,_0x417721['options']);return _0x1ac92a[_0xcef2('0x82')](_0x10c4ed);}})['then'](function(_0x122c5b){if(_0x122c5b){_0x394496=_0x122c5b[_0xcef2('0x6b')];if(!_0x417721[_0xcef2('0x4b')]['hasOwnProperty']('nolimit')){_0x10c4ed[_0xcef2('0x33')]=qs[_0xcef2('0x33')](_0x417721[_0xcef2('0x4b')][_0xcef2('0x33')]);_0x10c4ed[_0xcef2('0x32')]=qs[_0xcef2('0x32')](_0x417721['query'][_0xcef2('0x32')]);}return _0x1ac92a['getApplications'](_0x10c4ed);}})['then'](function(_0x4d9dcb){if(_0x4d9dcb){return _0x4d9dcb?{'count':_0x394496,'rows':_0x4d9dcb}:null;}})[_0xcef2('0x23')](respondWithResult(_0x3f0d36,null))[_0xcef2('0x2c')](handleError(_0x3f0d36,null));};function Extension(_0x4d0b53,_0x50a09f,_0x3d6cf5,_0x338dc6){this[_0xcef2('0x83')]=_0xcef2('0x84');this['exten']=_0x4d0b53[_0xcef2('0x85')];this[_0xcef2('0x86')]=_0x338dc6;this['type']=_0xcef2('0x87');this[_0xcef2('0x88')]=_0xcef2('0x89');this[_0xcef2('0x67')]=_0x4d0b53['id'];this[_0xcef2('0x81')]=_0x50a09f;this['appdata']=_0x3d6cf5;}function createExtensionsReciveFax(_0x30833c){var _0x3cfd58=0x1;var _0x5772c2=[];_0x5772c2[_0xcef2('0x8a')](new Extension(_0x30833c,_0x3cfd58,'','Answer'));_0x3cfd58+=0x1;_0x5772c2['push'](new Extension(_0x30833c,_0x3cfd58,_0xcef2('0x8b'),_0xcef2('0x8c')));_0x3cfd58+=0x1;for(var _0x2b9c91 in _0x30833c){if(_0x30833c[_0xcef2('0x4e')](_0x2b9c91)&&(_0x2b9c91===_0xcef2('0x8d')||_0x2b9c91==='localstationid'||_0x2b9c91===_0xcef2('0x8e')||_0x2b9c91===_0xcef2('0x8f')||_0x2b9c91===_0xcef2('0x90')||_0x2b9c91==='maxrate'||_0x2b9c91===_0xcef2('0x91')||_0x2b9c91==='modem'||_0x2b9c91===_0xcef2('0x92'))){_0x5772c2[_0xcef2('0x8a')](new Extension(_0x30833c,_0x3cfd58,_0xcef2('0x93')+_0x2b9c91+')='+_0x30833c[_0x2b9c91],_0xcef2('0x8c')));_0x3cfd58+=0x1;}}_0x5772c2[_0xcef2('0x8a')](new Extension(_0x30833c,_0x3cfd58,'6',_0xcef2('0x94')));_0x3cfd58+=0x1;_0x5772c2['push'](new Extension(_0x30833c,_0x3cfd58,_0xcef2('0x95'),'ReceiveFax'));_0x3cfd58=0x0;return _0x5772c2;}exports[_0xcef2('0x96')]=function(_0x7dc9cc,_0x3c7c27,_0x14f120){var _0x97aa0;return db['sequelize'][_0xcef2('0x7e')](function(_0x31d457){return db[_0xcef2('0x44')]['create'](_0x7dc9cc[_0xcef2('0x61')],{'transaction':_0x31d457})[_0xcef2('0x23')](function(_0x4a3c11){_0x97aa0=_0x4a3c11['get']({'plain':!![]});return db[_0xcef2('0x97')]['bulkCreate'](createExtensionsReciveFax(_0x97aa0),{'transaction':_0x31d457});});})['then'](function(){return _0x97aa0;})[_0xcef2('0x23')](respondWithResult(_0x3c7c27,null))[_0xcef2('0x2c')](handleError(_0x3c7c27,null));};exports[_0xcef2('0x98')]=function(_0x463229,_0x149cd5,_0x78ae6a){var _0x28310b;return db[_0xcef2('0x7d')][_0xcef2('0x7e')](function(_0x59a069){return db['FaxAccount']['update'](_0x463229[_0xcef2('0x61')],{'where':{'id':_0x463229[_0xcef2('0x61')]['id']},'transaction':_0x59a069})[_0xcef2('0x23')](function(_0xd8893b){return db['VoiceExtension'][_0xcef2('0x3a')]({'where':{'FaxAccountId':_0x463229[_0xcef2('0x61')]['id']},'transaction':_0x59a069})[_0xcef2('0x23')](function(_0x26526f){return db[_0xcef2('0x97')][_0xcef2('0x7f')](createExtensionsReciveFax(_[_0xcef2('0x73')](_0x463229['body'],[_0xcef2('0x99'),_0xcef2('0x46'),'createdAt',_0xcef2('0x9a'),'TrunkId',_0xcef2('0x9b')])),{'transaction':_0x59a069});});});})[_0xcef2('0x23')](function(){return db[_0xcef2('0x44')][_0xcef2('0x9c')](_0x463229[_0xcef2('0x61')]['id']);})[_0xcef2('0x23')](respondWithResult(_0x149cd5,null))[_0xcef2('0x2c')](handleError(_0x149cd5,null));};exports['getMessages']=function(_0x4eb63f,_0x38d357,_0x5763df){var _0x3e5499={'raw':!![],'where':{}};var _0x500b80={};var _0x144e3d={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x4eb63f['params']['id']}})['then'](handleEntityNotFound(_0x38d357,null))[_0xcef2('0x23')](function(_0x34a34b){if(_0x34a34b){_0x500b80[_0xcef2('0x47')]=_[_0xcef2('0x48')](db[_0xcef2('0x9d')][_0xcef2('0x5d')]);_0x500b80['query']=_[_0xcef2('0x48')](_0x4eb63f[_0xcef2('0x4b')]);_0x500b80[_0xcef2('0x49')]=_[_0xcef2('0x4a')](_0x500b80[_0xcef2('0x47')],_0x500b80['query']);_0x3e5499[_0xcef2('0x4c')]=_[_0xcef2('0x4a')](_0x500b80['model'],qs[_0xcef2('0x4d')](_0x4eb63f[_0xcef2('0x4b')]['fields']));_0x3e5499[_0xcef2('0x4c')]=_0x3e5499['attributes'][_0xcef2('0x6b')]?_0x3e5499['attributes']:_0x500b80[_0xcef2('0x47')];if(!_0x4eb63f[_0xcef2('0x4b')][_0xcef2('0x4e')]('nolimit')){_0x3e5499[_0xcef2('0x33')]=qs['limit'](_0x4eb63f['query']['limit']);_0x3e5499[_0xcef2('0x32')]=qs[_0xcef2('0x32')](_0x4eb63f['query'][_0xcef2('0x32')]);}_0x3e5499[_0xcef2('0x50')]=qs[_0xcef2('0x51')](_0x4eb63f['query'][_0xcef2('0x51')]);_0x3e5499[_0xcef2('0x52')]=qs[_0xcef2('0x49')](_[_0xcef2('0x53')](_0x4eb63f[_0xcef2('0x4b')],_0x500b80[_0xcef2('0x49')]));_0x3e5499['where'][_0xcef2('0x67')]=_0x34a34b['id'];if(_0x4eb63f['query'][_0xcef2('0x54')]){_0x3e5499[_0xcef2('0x52')]=_[_0xcef2('0x56')](_0x3e5499[_0xcef2('0x52')],{'$or':_['map'](_0x3e5499[_0xcef2('0x4c')],function(_0x369378){var _0x46547b={};_0x46547b[_0x369378]={'$like':'%'+_0x4eb63f[_0xcef2('0x4b')][_0xcef2('0x54')]+'%'};return _0x46547b;})});}if(_0x4eb63f['query'][_0xcef2('0x9e')]){var _0x318988=_0x4eb63f[_0xcef2('0x4b')][_0xcef2('0x9e')][_0xcef2('0x9f')](',');var _0x5d5c00={};_0x5d5c00[_0x318988[0x0]]={'$gte':moment(_0x318988[0x1])[_0xcef2('0xa0')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3e5499[_0xcef2('0x52')]=_[_0xcef2('0x56')](_0x3e5499[_0xcef2('0x52')],_0x5d5c00);}_0x3e5499=_[_0xcef2('0x56')]({},_0x3e5499,_0x4eb63f['options']);return db['FaxMessage']['count']({'where':_0x3e5499[_0xcef2('0x52')]})[_0xcef2('0x23')](function(_0x3f9bce){_0x144e3d['count']=_0x3f9bce;if(_0x4eb63f['query']['includeAll']){_0x3e5499[_0xcef2('0x5e')]=[{'all':!![]}];}return db[_0xcef2('0x9d')][_0xcef2('0x59')](_0x3e5499);})[_0xcef2('0x23')](function(_0x1d0b9b){_0x144e3d[_0xcef2('0x5a')]=_0x1d0b9b;return _0x144e3d;});}})[_0xcef2('0x23')](respondWithFilteredResult(_0x38d357,_0x3e5499))[_0xcef2('0x2c')](handleError(_0x38d357,null));};exports['send']=function(_0x416c10,_0xbe45a5,_0x56c1f2){var _0x772843,_0x3bd508={},_0xd0e044;if(_0x416c10[_0xcef2('0x61')]['to']){_0xd0e044=_0x416c10[_0xcef2('0x61')]['to'][0x0];}return db[_0xcef2('0x44')]['find']({'where':{'id':_0x416c10[_0xcef2('0x5c')]['id']},'include':[{'model':db[_0xcef2('0xa1')],'as':'List','include':[{'model':db[_0xcef2('0xa2')],'as':_0xcef2('0xa3'),'where':{'fax':_0xd0e044},'limit':0x1,'order':[[_0xcef2('0x9a'),_0xcef2('0xa4')]]}]}]})[_0xcef2('0x23')](handleEntityNotFound(_0xbe45a5,null))[_0xcef2('0x23')](function(_0x49a2e0){_0x772843=_0x49a2e0;if(_0x416c10[_0xcef2('0x61')][_0xcef2('0xa5')]&&_0x416c10['body'][_0xcef2('0xa5')][_0xcef2('0x6b')]){for(var _0x4cc683=0x0;_0x4cc683<_0x416c10[_0xcef2('0x61')][_0xcef2('0xa5')][_0xcef2('0x6b')];_0x4cc683+=0x1){_0x416c10[_0xcef2('0x61')][_0xcef2('0xa5')][_0x4cc683]={'filename':_0x416c10[_0xcef2('0x61')][_0xcef2('0xa5')][_0x4cc683]['name'],'id':_0x416c10['body'][_0xcef2('0xa5')][_0x4cc683]['id'],'path':path['join'](config[_0xcef2('0xa6')],_0xcef2('0xa7'),_0x416c10[_0xcef2('0x61')][_0xcef2('0xa5')][_0x4cc683][_0xcef2('0xa8')])};}}return respondWithRpcPromise(_0xcef2('0xa9'),_0xcef2('0xa9'),{'FaxAccountId':_[_0xcef2('0xaa')](_0x416c10[_0xcef2('0x5c')]['id'])?undefined:_0x416c10[_0xcef2('0x5c')]['id'],'path':_[_0xcef2('0xaa')](_0x416c10[_0xcef2('0x61')][_0xcef2('0xa5')][0x0][_0xcef2('0x8')])?undefined:_0x416c10['body'][_0xcef2('0xa5')][0x0]['path'],'fax':_[_0xcef2('0xaa')](_0x416c10['body']['to'][0x0])?undefined:_0x416c10[_0xcef2('0x61')]['to'][0x0]},client9002);})[_0xcef2('0x23')](function(){if(_0x772843){if(_[_0xcef2('0xaa')](_0x416c10[_0xcef2('0x61')][_0xcef2('0xab')])){_0x416c10[_0xcef2('0x61')][_0xcef2('0xab')]=util[_0xcef2('0xa0')](_0xcef2('0xac'),_0x772843[_0xcef2('0x3e')],_0x772843['fax']);}if(_0x772843[_0xcef2('0xad')]){if(_0x772843[_0xcef2('0xad')][_0xcef2('0xa3')][_0xcef2('0x6b')]){return _0x772843[_0xcef2('0xad')][_0xcef2('0xa3')][0x0];}else{return db[_0xcef2('0xa2')][_0xcef2('0x60')](_[_0xcef2('0x15')](_0x416c10[_0xcef2('0x61')],{'firstName':_0x416c10['body']['to'][0x0],'phone':_0x416c10['body']['to'][0x0],'fax':_0x416c10[_0xcef2('0x61')]['to'][0x0],'ListId':_0x772843['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0xcef2('0xae'));}})[_0xcef2('0x23')](function(_0x521b24){if(_0x521b24){return db[_0xcef2('0x75')][_0xcef2('0x5f')]({'where':{'ContactId':_0x521b24['id'],'closed':![],'FaxAccountId':_0x772843['id']}})[_0xcef2('0x23')](function(_0x54cdef){if(_0x54cdef){return[_0x54cdef,![]];}return db['FaxInteraction'][_0xcef2('0x60')]({'UserId':_0x416c10[_0xcef2('0x62')]['id'],'ContactId':_0x521b24['id'],'FaxAccountId':_0x772843['id'],'fax':_0x416c10['body']['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xcef2('0x56')](_0x416c10[_0xcef2('0x61')],{'read':![],'body':_0x416c10['body'][_0xcef2('0xa5')][0x0][_0xcef2('0xaf')],'FaxAccountId':_0x772843['id'],'UserId':_0x416c10[_0xcef2('0x62')]['id'],'ContactId':_0x521b24['id'],'AttachmentId':_0x416c10['body'][_0xcef2('0xa5')][0x0]['id']})]},{'include':[{'model':db[_0xcef2('0x9d')],'as':_0xcef2('0xb0')}]})['then'](function(_0x509db5){return[_0x509db5,!![]];});});}else{throw new Error(_0xcef2('0xb1'));}})['spread'](function(_0x29a7ed,_0x28efd3){if(_0x28efd3){return _0x29a7ed;}return db[_0xcef2('0x9d')][_0xcef2('0x60')]({'direction':_0xcef2('0xb2'),'read':![],'body':_0x416c10[_0xcef2('0x61')][_0xcef2('0xa5')][0x0]['filename'],'FaxAccountId':_0x772843['id'],'FaxInteractionId':_0x29a7ed['id'],'UserId':_0x416c10[_0xcef2('0x62')]['id'],'ContactId':_0x29a7ed['ContactId'],'AttachmentId':_0x416c10['body']['attachments'][0x0]['id']})['then'](function(_0x4d47d5){_0x29a7ed['dataValues'][_0xcef2('0xb0')]=[];_0x29a7ed[_0xcef2('0xb3')][_0xcef2('0xb0')][_0xcef2('0x8a')](_0x4d47d5[_0xcef2('0xb3')]);return _0x29a7ed;});})['then'](function(_0xc6cfd1){respondWithRpcPromise('SendFax',_0xcef2('0xb4'),{'FaxAccountId':_[_0xcef2('0xaa')](_0x416c10['params']['id'])?undefined:_0x416c10[_0xcef2('0x5c')]['id'],'path':_[_0xcef2('0xaa')](_0x416c10[_0xcef2('0x61')][_0xcef2('0xa5')][0x0][_0xcef2('0x8')])?undefined:_0x416c10[_0xcef2('0x61')][_0xcef2('0xa5')][0x0][_0xcef2('0x8')],'fax':_[_0xcef2('0xaa')](_0x416c10['body']['to'][0x0])?undefined:_0x416c10[_0xcef2('0x61')]['to'][0x0],'AttachmentId':_0x416c10[_0xcef2('0x61')]['attachments'][0x0]['id']},client9002)[_0xcef2('0x23')](function(_0x34af50){logger[_0xcef2('0x2b')](_0xcef2('0xb5'),_0x34af50);})[_0xcef2('0x2c')](function(_0x42b523){logger['info']('SendFaxRpc,\x20%s',_0x42b523);});return _0xc6cfd1;})[_0xcef2('0x23')](respondWithResult(_0xbe45a5,null))[_0xcef2('0x2c')](handleError(_0xbe45a5,null));};exports[_0xcef2('0xb6')]=function(_0xcf3c58,_0x450c3c,_0x3a99d5){return db[_0xcef2('0x44')][_0xcef2('0x5f')]({'where':{'id':_0xcf3c58['params']['id']}})['then'](handleEntityNotFound(_0x450c3c,null))[_0xcef2('0x23')](function(_0x52d2b5){if(_0x52d2b5){return _0x52d2b5['addAgents'](_0xcf3c58[_0xcef2('0x61')]['ids'],_[_0xcef2('0x73')](_0xcf3c58['body'],[_0xcef2('0x6d'),'id'])||{})['spread'](function(_0x5a42e9){for(var _0x125831=0x0;_0x125831<_0xcf3c58[_0xcef2('0x61')]['ids'][_0xcef2('0x6b')];_0x125831+=0x1){socket[_0xcef2('0xb7')]('userFaxAccount:save',{'UserId':_0xcf3c58[_0xcef2('0x61')][_0xcef2('0x6d')][_0x125831],'FaxAccountId':_0xcf3c58[_0xcef2('0x5c')]['id']});}return _0x5a42e9;});}})[_0xcef2('0x23')](respondWithResult(_0x450c3c,null))[_0xcef2('0x2c')](handleError(_0x450c3c,null));};exports['removeAgents']=function(_0x3c9f15,_0x33841f,_0x31d5cc){return db[_0xcef2('0x44')]['find']({'where':{'id':_0x3c9f15[_0xcef2('0x5c')]['id']}})['then'](handleEntityNotFound(_0x33841f,null))[_0xcef2('0x23')](function(_0x3a3ce7){if(_0x3a3ce7){return _0x3a3ce7[_0xcef2('0xb8')](_0x3c9f15['query']['ids'])[_0xcef2('0x23')](function(){if(_[_0xcef2('0xb9')](_0x3c9f15[_0xcef2('0x4b')]['ids'])){for(var _0xc32df4=0x0;_0xc32df4<_0x3c9f15[_0xcef2('0x4b')][_0xcef2('0x6d')][_0xcef2('0x6b')];_0xc32df4+=0x1){socket[_0xcef2('0xb7')](_0xcef2('0xba'),{'UserId':Number(_0x3c9f15[_0xcef2('0x4b')]['ids'][_0xc32df4]),'FaxAccountId':Number(_0x3c9f15[_0xcef2('0x5c')]['id'])});}}else{socket[_0xcef2('0xb7')](_0xcef2('0xba'),{'UserId':Number(_0x3c9f15['query']['ids']),'FaxAccountId':Number(_0x3c9f15[_0xcef2('0x5c')]['id'])});}});}})[_0xcef2('0x23')](respondWithStatusCode(_0x33841f,null))['catch'](handleError(_0x33841f,null));};exports['getAgents']=function(_0x3ff70f,_0x1cfb03,_0x251724){var _0x1847d3={};var _0x4302e1={};var _0x5473ae;var _0x31b690;return db['FaxAccount'][_0xcef2('0x69')]({'where':{'id':_0x3ff70f[_0xcef2('0x5c')]['id']}})[_0xcef2('0x23')](handleEntityNotFound(_0x1cfb03,null))['then'](function(_0x4111f1){if(_0x4111f1){_0x5473ae=_0x4111f1;_0x4302e1['model']=_[_0xcef2('0x48')](db['User'][_0xcef2('0x5d')]);_0x4302e1[_0xcef2('0x4b')]=_['keys'](_0x3ff70f[_0xcef2('0x4b')]);_0x4302e1[_0xcef2('0x49')]=_['intersection'](_0x4302e1['model'],_0x4302e1[_0xcef2('0x4b')]);_0x1847d3[_0xcef2('0x4c')]=_[_0xcef2('0x4a')](_0x4302e1[_0xcef2('0x47')],qs[_0xcef2('0x4d')](_0x3ff70f[_0xcef2('0x4b')][_0xcef2('0x4d')]));_0x1847d3[_0xcef2('0x4c')]=_0x1847d3[_0xcef2('0x4c')][_0xcef2('0x6b')]?_0x1847d3[_0xcef2('0x4c')]:_0x4302e1[_0xcef2('0x47')];_0x1847d3['order']=qs[_0xcef2('0x51')](_0x3ff70f['query'][_0xcef2('0x51')]);_0x1847d3[_0xcef2('0x52')]=qs['filters'](_['pick'](_0x3ff70f[_0xcef2('0x4b')],_0x4302e1['filters']));if(_0x3ff70f[_0xcef2('0x4b')][_0xcef2('0x54')]){_0x1847d3[_0xcef2('0x52')]=_[_0xcef2('0x56')](_0x1847d3[_0xcef2('0x52')],{'$or':_[_0xcef2('0x43')](_0x1847d3[_0xcef2('0x4c')],function(_0x3ca3d2){var _0x171b02={};_0x171b02[_0x3ca3d2]={'$like':'%'+_0x3ff70f[_0xcef2('0x4b')][_0xcef2('0x54')]+'%'};return _0x171b02;})});}_0x1847d3=_['merge']({},_0x1847d3,_0x3ff70f[_0xcef2('0x57')]);return _0x5473ae[_0xcef2('0xbb')](_0x1847d3);}})[_0xcef2('0x23')](function(_0x9679b8){if(_0x9679b8){_0x31b690=_0x9679b8['length'];if(!_0x3ff70f[_0xcef2('0x4b')][_0xcef2('0x4e')]('nolimit')){_0x1847d3['limit']=qs['limit'](_0x3ff70f['query'][_0xcef2('0x33')]);_0x1847d3[_0xcef2('0x32')]=qs[_0xcef2('0x32')](_0x3ff70f[_0xcef2('0x4b')][_0xcef2('0x32')]);}return _0x5473ae['getAgents'](_0x1847d3);}})[_0xcef2('0x23')](function(_0xde8bac){if(_0xde8bac){return _0xde8bac?{'count':_0x31b690,'rows':_0xde8bac}:null;}})[_0xcef2('0x23')](respondWithResult(_0x1cfb03,null))[_0xcef2('0x2c')](handleError(_0x1cfb03,null));}; \ No newline at end of file +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 diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index e5646d3..3618a31 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 _0x5fdc=['setMaxListeners','update','remove','emit','exports','events','FaxAccount'];(function(_0xa218ce,_0x14f482){var _0x481521=function(_0x2a51a0){while(--_0x2a51a0){_0xa218ce['push'](_0xa218ce['shift']());}};_0x481521(++_0x14f482);}(_0x5fdc,0x1c5));var _0xc5fd=function(_0x123024,_0x249635){_0x123024=_0x123024-0x0;var _0x36d624=_0x5fdc[_0x123024];return _0x36d624;};'use strict';var EventEmitter=require(_0xc5fd('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xc5fd('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xc5fd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc5fd('0x3'),'afterDestroy':_0xc5fd('0x4')};function emitEvent(_0x279d6c){return function(_0x258639,_0x19ef5e,_0xfe63ec){FaxAccountEvents['emit'](_0x279d6c+':'+_0x258639['id'],_0x258639);FaxAccountEvents[_0xc5fd('0x5')](_0x279d6c,_0x258639);_0xfe63ec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0xc5fd('0x6')]=FaxAccountEvents; \ No newline at end of file +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 diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 09f04dd..20abaee 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 _0x75e0=['moment','path','rimraf','../../config/environment','./faxAccount.attributes','exports','../../config/logger','api'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x75e0,0x176));var _0x075e=function(_0x45846f,_0x51908e){_0x45846f=_0x45846f-0x0;var _0x3834c7=_0x75e0[_0x45846f];return _0x3834c7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x075e('0x0'))(_0x075e('0x1'));var moment=require(_0x075e('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x075e('0x3'));var rimraf=require(_0x075e('0x4'));var config=require(_0x075e('0x5'));var attributes=require(_0x075e('0x6'));module[_0x075e('0x7')]=function(_0x17f25d,_0x4551e9){return _0x17f25d['define']('FaxAccount',attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 99d9406..12110f9 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 _0xcdb2=['createdAt','keys','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','CmContact','Contacts','FaxApplication','Applications','applications','list','orderBy','priority','asc','length','create','contact','fax','FaxInteraction','Contact\x20not\x20found','spread','get','autoclose','push','close','*,*,*,*','created','interaction','FaxMessage','ContactId','User','name','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','request','then','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','FaxAccount,\x20%s,\x20%s','message','info','catch','GetFaxAccount','FaxAccount','options','where','limit','map','include','attributes','model','NotifyFaxAccount','body','describe','Sequelize','ValidationError','difference'];(function(_0x346d45,_0x6db175){var _0x548330=function(_0x41e453){while(--_0x41e453){_0x346d45['push'](_0x346d45['shift']());}};_0x548330(++_0x6db175);}(_0xcdb2,0x1aa));var _0x2cdb=function(_0x34af0b,_0x18a117){_0x34af0b=_0x34af0b-0x0;var _0x2c945f=_0xcdb2[_0x34af0b];return _0x2c945f;};'use strict';var _=require(_0x2cdb('0x0'));var util=require(_0x2cdb('0x1'));var moment=require(_0x2cdb('0x2'));var BPromise=require('bluebird');var rs=require(_0x2cdb('0x3'));var fs=require('fs');var Redis=require(_0x2cdb('0x4'));var db=require(_0x2cdb('0x5'))['db'];var utils=require(_0x2cdb('0x6'));var logger=require(_0x2cdb('0x7'))(_0x2cdb('0x8'));var config=require(_0x2cdb('0x9'));var jayson=require(_0x2cdb('0xa'));var client=jayson[_0x2cdb('0xb')][_0x2cdb('0xc')]({'port':0x232c});config[_0x2cdb('0xd')]=_[_0x2cdb('0xe')](config[_0x2cdb('0xd')],{'host':_0x2cdb('0xf'),'port':0x18eb});var socket=require(_0x2cdb('0x10'))(new Redis(config[_0x2cdb('0xd')]));require(_0x2cdb('0x11'))['register'](socket);function respondWithRpcPromise(_0x4d7896,_0x45c56b,_0x58f595){return new BPromise(function(_0x5e55c2,_0x2c450a){return client[_0x2cdb('0x12')](_0x4d7896,_0x58f595)[_0x2cdb('0x13')](function(_0x3cab80){logger['info']('FaxAccount,\x20%s,\x20%s',_0x45c56b,_0x2cdb('0x14'));logger[_0x2cdb('0x15')](_0x2cdb('0x16'),_0x45c56b,'request\x20sent',JSON[_0x2cdb('0x17')](_0x3cab80));if(_0x3cab80[_0x2cdb('0x18')]){if(_0x3cab80['error']['code']===0x1f4){logger['error'](_0x2cdb('0x19'),_0x45c56b,_0x3cab80[_0x2cdb('0x18')][_0x2cdb('0x1a')]);return _0x2c450a(_0x3cab80[_0x2cdb('0x18')][_0x2cdb('0x1a')]);}logger[_0x2cdb('0x18')](_0x2cdb('0x19'),_0x45c56b,_0x3cab80[_0x2cdb('0x18')][_0x2cdb('0x1a')]);return _0x5e55c2(_0x3cab80[_0x2cdb('0x18')][_0x2cdb('0x1a')]);}else{logger[_0x2cdb('0x1b')](_0x2cdb('0x19'),_0x45c56b,'request\x20sent');_0x5e55c2(_0x3cab80['result']['message']);}})[_0x2cdb('0x1c')](function(_0x34b342){logger[_0x2cdb('0x18')](_0x2cdb('0x19'),_0x45c56b,_0x34b342);_0x2c450a(_0x34b342);});});}exports[_0x2cdb('0x1d')]=function(_0x165065){var _0x2ba684=this;return new Promise(function(_0x5d552f,_0x489034){return db[_0x2cdb('0x1e')]['findAll']({'raw':_0x165065['options']?_0x165065[_0x2cdb('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x165065[_0x2cdb('0x1f')]?_0x165065[_0x2cdb('0x1f')][_0x2cdb('0x20')]||null:null,'attributes':_0x165065[_0x2cdb('0x1f')]?_0x165065[_0x2cdb('0x1f')]['attributes']||null:null,'limit':_0x165065['options']?_0x165065['options'][_0x2cdb('0x21')]||null:null,'include':_0x165065[_0x2cdb('0x1f')]?_0x165065[_0x2cdb('0x1f')]['include']?_[_0x2cdb('0x22')](_0x165065[_0x2cdb('0x1f')][_0x2cdb('0x23')],function(_0x965c31){return{'model':db[_0x965c31['model']],'as':_0x965c31['as'],'attributes':_0x965c31[_0x2cdb('0x24')],'include':_0x965c31[_0x2cdb('0x23')]?_[_0x2cdb('0x22')](_0x965c31[_0x2cdb('0x23')],function(_0x4e7347){return{'model':db[_0x4e7347[_0x2cdb('0x25')]],'as':_0x4e7347['as'],'attributes':_0x4e7347[_0x2cdb('0x24')],'include':_0x4e7347[_0x2cdb('0x23')]?_['map'](_0x4e7347[_0x2cdb('0x23')],function(_0x38d544){return{'model':db[_0x38d544[_0x2cdb('0x25')]],'as':_0x38d544['as'],'attributes':_0x38d544['attributes']};}):[]};}):[]};}):[]:[]})[_0x2cdb('0x13')](function(_0x3dac15){logger[_0x2cdb('0x1b')](_0x2cdb('0x1d'),_0x165065);logger[_0x2cdb('0x15')](_0x2cdb('0x1d'),_0x165065,JSON[_0x2cdb('0x17')](_0x3dac15));_0x5d552f(_0x3dac15);})[_0x2cdb('0x1c')](function(_0x11f3e5){logger[_0x2cdb('0x18')](_0x2cdb('0x1d'),_0x11f3e5[_0x2cdb('0x1a')],_0x165065);_0x489034(_0x2ba684[_0x2cdb('0x18')](0x1f4,_0x11f3e5[_0x2cdb('0x1a')]));});});};exports[_0x2cdb('0x26')]=function(_0x4b7bac,_0x1fc46c,_0x336e08){var _0x168988=this;return new Promise(function(_0x443745,_0x58a6de){var _0x388af3={'body':_0x4b7bac[_0x2cdb('0x27')],'channel':'fax'};var _0x57ff65=[];var _0xafbf73=[];var _0x4da244={};return db['CmContact'][_0x2cdb('0x28')]()['then'](function(_0xfcebc9){if(!_0xfcebc9){throw new db[(_0x2cdb('0x29'))][(_0x2cdb('0x2a'))]('no\x20available\x20attributes');}_0x57ff65=_[_0x2cdb('0x2b')](_['keys'](_0xfcebc9),[_0x2cdb('0x2c'),'updatedAt']);_0xafbf73=_[_0x2cdb('0x2b')](_[_0x2cdb('0x2d')](_0xfcebc9),[_0x2cdb('0x2c'),_0x2cdb('0x2e'),_0x2cdb('0x2f'),_0x2cdb('0x30')]);if(_0x4b7bac['body']['id']){delete _0x4b7bac[_0x2cdb('0x27')]['id'];}if(_[_0x2cdb('0x31')](_0x4b7bac[_0x2cdb('0x27')][_0x2cdb('0x32')])){throw new db[(_0x2cdb('0x29'))][(_0x2cdb('0x2a'))](_0x2cdb('0x33'));}if(_['isNil'](_0x4b7bac[_0x2cdb('0x27')][_0x2cdb('0x27')])||_0x4b7bac[_0x2cdb('0x27')][_0x2cdb('0x27')]===''){throw new db[(_0x2cdb('0x29'))][(_0x2cdb('0x2a'))](_0x2cdb('0x34'));}if(_[_0x2cdb('0x31')](_0x4b7bac[_0x2cdb('0x27')][_0x2cdb('0x35')])){throw new db[(_0x2cdb('0x29'))][(_0x2cdb('0x2a'))](_0x2cdb('0x36')+_0xafbf73);}if(!_[_0x2cdb('0x37')](_0xafbf73,_0x4b7bac[_0x2cdb('0x27')]['mapKey'])){throw new db['Sequelize'][(_0x2cdb('0x2a'))](_0x2cdb('0x38')+_0xafbf73);}_0x4da244[_0x4b7bac[_0x2cdb('0x27')][_0x2cdb('0x35')]]=_0x4b7bac[_0x2cdb('0x27')][_0x2cdb('0x32')];})[_0x2cdb('0x13')](function(){return db[_0x2cdb('0x1e')][_0x2cdb('0x39')]({'where':{'id':_0x4b7bac[_0x2cdb('0x3a')]['id']},'include':[{'model':db[_0x2cdb('0x3b')],'as':_0x2cdb('0x3c'),'include':[{'model':db[_0x2cdb('0x3d')],'as':_0x2cdb('0x3e'),'where':_0x4da244,'limit':0x1,'order':[[_0x2cdb('0x2e'),'DESC']]}]},{'model':db[_0x2cdb('0x3f')],'as':_0x2cdb('0x40')}]});})[_0x2cdb('0x13')](function(_0x4515ec){if(_0x4515ec&&_0x4515ec['List']){var _0x40606d=_0x4515ec['get']({'plain':!![]});_0x388af3[_0x2cdb('0x3a')]=_0x40606d;_0x388af3[_0x2cdb('0x41')]=_0x40606d[_0x2cdb('0x40')];_0x388af3[_0x2cdb('0x42')]=_0x40606d['List'];_0x388af3[_0x2cdb('0x41')]=_[_0x2cdb('0x43')](_0x388af3[_0x2cdb('0x41')],[_0x2cdb('0x44')],[_0x2cdb('0x45')]);if(_0x388af3['account']['Applications']){delete _0x388af3[_0x2cdb('0x3a')][_0x2cdb('0x40')];}if(_0x388af3['account'][_0x2cdb('0x3c')]&&_0x388af3[_0x2cdb('0x3a')]['List'][_0x2cdb('0x3e')][_0x2cdb('0x46')]){return _0x388af3[_0x2cdb('0x3a')][_0x2cdb('0x3c')][_0x2cdb('0x3e')][0x0];}var _0x98c876=_[_0x2cdb('0xe')](_0x4b7bac[_0x2cdb('0x27')],{'firstName':_0x4b7bac[_0x2cdb('0x27')][_0x2cdb('0x32')],'ListId':_0x40606d[_0x2cdb('0x30')]});_0x98c876[_0x4b7bac[_0x2cdb('0x27')]['mapKey']]=_0x4b7bac['body'][_0x2cdb('0x32')];return db[_0x2cdb('0x3d')][_0x2cdb('0x47')](_0x98c876,{'fields':_0x57ff65,'raw':!![]});}})[_0x2cdb('0x13')](function(_0x144793){_0x388af3[_0x2cdb('0x48')]=_0x144793;if(_0x144793){var _0x335e17={'ContactId':_0x144793['id'],'FaxAccountId':_0x4b7bac[_0x2cdb('0x3a')]['id'],'fax':_0x144793[_0x2cdb('0x49')]};return db[_0x2cdb('0x4a')][_0x2cdb('0x39')]({'where':{'ContactId':_0x144793['id'],'closed':![],'FaxAccountId':_0x4b7bac[_0x2cdb('0x3a')]['id']}})[_0x2cdb('0x13')](function(_0xda2530){if(_0xda2530){return[_0xda2530,![]];}return db[_0x2cdb('0x4a')]['create'](_0x335e17)[_0x2cdb('0x13')](function(_0x743372){return[_0x743372,!![]];});});}else{throw new Error(_0x2cdb('0x4b'));}})[_0x2cdb('0x4c')](function(_0x42e7b0,_0x57785a){var _0x595207=_0x42e7b0[_0x2cdb('0x4d')]({'plain':!![]});if(_0x57785a){if(_0x388af3[_0x2cdb('0x3a')][_0x2cdb('0x4e')]){_0x388af3[_0x2cdb('0x41')][_0x2cdb('0x4f')]({'id':0x0,'priority':_0x388af3[_0x2cdb('0x41')]['length']+0x1,'app':_0x2cdb('0x50'),'appdata':'unmanaged','interval':_0x2cdb('0x51')});}_0x595207[_0x2cdb('0x52')]=!![];}else{_0x595207[_0x2cdb('0x52')]=![];}_0x388af3[_0x2cdb('0x53')]=_0x595207;return db[_0x2cdb('0x54')][_0x2cdb('0x47')]({'body':_0x4b7bac[_0x2cdb('0x27')][_0x2cdb('0x27')],'FaxAccountId':_0x4b7bac[_0x2cdb('0x3a')]['id'],'FaxInteractionId':_0x42e7b0['id'],'direction':'in','ContactId':_0x42e7b0[_0x2cdb('0x55')],'AttachmentId':_0x4b7bac[_0x2cdb('0x27')]['AttachmentId']});})[_0x2cdb('0x13')](function(_0x4fcb44){_0x388af3[_0x2cdb('0x1a')]=_0x4fcb44;if(_0x388af3['interaction']['UserId']){return db[_0x2cdb('0x56')]['find']({'attributes':['id',_0x2cdb('0x57')],'where':{'id':_0x388af3[_0x2cdb('0x53')][_0x2cdb('0x58')]}})['then'](function(_0x42da1f){if(_0x42da1f){_0x388af3[_0x2cdb('0x41')][_0x2cdb('0x59')]({'id':0x0,'priority':0x0,'app':_0x2cdb('0x5a'),'appdata':_0x42da1f['name']+','+(_0x388af3['account'][_0x2cdb('0x5b')]||0xa),'interval':_0x2cdb('0x51')});}return respondWithRpcPromise(_0x2cdb('0x5c'),_0x2cdb('0x5d'),_0x388af3);});}return respondWithRpcPromise(_0x2cdb('0x5c'),_0x2cdb('0x5d'),_0x388af3);})[_0x2cdb('0x13')](function(_0x26cd48){_0x443745(_0x26cd48);})[_0x2cdb('0x1c')](function(_0x1cdefb){_0x58a6de(_0x168988['error'](0x1f4,_0x1cdefb[_0x2cdb('0x1a')]));});});}; \ No newline at end of file +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 diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 3009f18..11d8dd5 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 _0x6050=['remove','update','emit','faxAccount:','./faxAccount.events','save'];(function(_0x3a0ebd,_0x47f368){var _0x51a660=function(_0x4023e6){while(--_0x4023e6){_0x3a0ebd['push'](_0x3a0ebd['shift']());}};_0x51a660(++_0x47f368);}(_0x6050,0x196));var _0x0605=function(_0x119e07,_0xfd3d21){_0x119e07=_0x119e07-0x0;var _0x5750ae=_0x6050[_0x119e07];return _0x5750ae;};'use strict';var FaxAccountEvents=require(_0x0605('0x0'));var events=[_0x0605('0x1'),_0x0605('0x2'),_0x0605('0x3')];function createListener(_0x1b0075,_0x19c419){return function(_0x523a28){_0x19c419[_0x0605('0x4')](_0x1b0075,_0x523a28);};}function removeListener(_0x4576f4,_0x43403d){return function(){FaxAccountEvents['removeListener'](_0x4576f4,_0x43403d);};}exports['register']=function(_0x4aca21){for(var _0xd78d96=0x0,_0x578623=events['length'];_0xd78d96<_0x578623;_0xd78d96++){var _0x5660ad=events[_0xd78d96];var _0x1629bf=createListener(_0x0605('0x5')+_0x5660ad,_0x4aca21);FaxAccountEvents['on'](_0x5660ad,_0x1629bf);}}; \ No newline at end of file +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 diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 679a196..61b54b3 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 _0x4c42=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/users','getAgents','post','create','addAnswer','addInteraction','addApplications','/addaccountapplications','/updateaccountapplications','updateAccountApplications','send','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','connect-timeout','express','Router','../../components/auth/service','./faxAccount.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4c42,0x162));var _0x24c4=function(_0x30cdb1,_0x3a7b80){_0x30cdb1=_0x30cdb1-0x0;var _0x4ad635=_0x4c42[_0x30cdb1];return _0x4ad635;};'use strict';var multer=require(_0x24c4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x24c4('0x1'));var express=require(_0x24c4('0x2'));var router=express[_0x24c4('0x3')]();var auth=require(_0x24c4('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x24c4('0x5'));router[_0x24c4('0x6')]('/',auth[_0x24c4('0x7')](),controller[_0x24c4('0x8')]);router[_0x24c4('0x6')](_0x24c4('0x9'),auth[_0x24c4('0x7')](),controller[_0x24c4('0xa')]);router[_0x24c4('0x6')](_0x24c4('0xb'),auth[_0x24c4('0x7')](),controller[_0x24c4('0xc')]);router[_0x24c4('0x6')](_0x24c4('0xd'),auth[_0x24c4('0x7')](),controller[_0x24c4('0xe')]);router['get'](_0x24c4('0xf'),auth[_0x24c4('0x7')](),controller[_0x24c4('0x10')]);router[_0x24c4('0x6')](_0x24c4('0x11'),auth[_0x24c4('0x7')](),controller[_0x24c4('0x12')]);router[_0x24c4('0x6')](_0x24c4('0x13'),auth[_0x24c4('0x7')](),controller[_0x24c4('0x14')]);router[_0x24c4('0x6')](_0x24c4('0x15'),auth[_0x24c4('0x7')](),controller['getMessages']);router['get'](_0x24c4('0x16'),auth[_0x24c4('0x7')](),controller[_0x24c4('0x17')]);router[_0x24c4('0x18')]('/',auth[_0x24c4('0x7')](),controller[_0x24c4('0x19')]);router[_0x24c4('0x18')]('/:id/dispositions',auth[_0x24c4('0x7')](),controller['addDisposition']);router[_0x24c4('0x18')]('/:id/canned_answers',auth[_0x24c4('0x7')](),controller[_0x24c4('0x1a')]);router[_0x24c4('0x18')](_0x24c4('0x11'),auth[_0x24c4('0x7')](),controller[_0x24c4('0x1b')]);router[_0x24c4('0x18')](_0x24c4('0x13'),auth[_0x24c4('0x7')](),controller[_0x24c4('0x1c')]);router['post'](_0x24c4('0x1d'),auth[_0x24c4('0x7')](),controller['addAccountApplications']);router[_0x24c4('0x18')](_0x24c4('0x1e'),auth[_0x24c4('0x7')](),controller[_0x24c4('0x1f')]);router['post']('/:id/send',auth[_0x24c4('0x7')](),controller[_0x24c4('0x20')]);router[_0x24c4('0x18')](_0x24c4('0x16'),auth['isAuthenticated'](),controller['addAgents']);router[_0x24c4('0x21')](_0x24c4('0xb'),auth[_0x24c4('0x7')](),controller['update']);router[_0x24c4('0x22')](_0x24c4('0xb'),auth[_0x24c4('0x7')](),controller[_0x24c4('0x23')]);router[_0x24c4('0x22')](_0x24c4('0xd'),auth[_0x24c4('0x7')](),controller[_0x24c4('0x24')]);router[_0x24c4('0x22')](_0x24c4('0xf'),auth[_0x24c4('0x7')](),controller[_0x24c4('0x25')]);router[_0x24c4('0x22')]('/:id/users',auth[_0x24c4('0x7')](),controller[_0x24c4('0x26')]);module[_0x24c4('0x27')]=router; \ No newline at end of file +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 diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index f5b916b..3a4a86f 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 _0xc74c=['*,*,*,*','sequelize','exports','noop','TEXT','STRING'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xc74c,0x163));var _0xcc74=function(_0x5b6cb9,_0xd538b0){_0x5b6cb9=_0x5b6cb9-0x0;var _0x330151=_0xc74c[_0x5b6cb9];return _0x330151;};'use strict';var Sequelize=require(_0xcc74('0x0'));module[_0xcc74('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xcc74('0x2')},'appdata':{'type':Sequelize[_0xcc74('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xcc74('0x4')],'defaultValue':_0xcc74('0x5')}}; \ No newline at end of file +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 diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 5ba6864..da5b725 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 _0x9de3=['sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','catch','show','params','keys','includeAll','find','create','body','update','html-pdf','rimraf','zip-dir','fast-json-patch','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','api','../../config/environment','sendStatus','end','status','json','count','offset','Content-Range','reject','then','destroy','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit'];(function(_0x197185,_0x251145){var _0x2c8af1=function(_0x1dbcfd){while(--_0x1dbcfd){_0x197185['push'](_0x197185['shift']());}};_0x2c8af1(++_0x251145);}(_0x9de3,0xea));var _0x39de=function(_0x5ae554,_0x13f929){_0x5ae554=_0x5ae554-0x0;var _0x5e6e43=_0x9de3[_0x5ae554];return _0x5e6e43;};'use strict';var pdf=require(_0x39de('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x39de('0x1'));var zipdir=require(_0x39de('0x2'));var jsonpatch=require(_0x39de('0x3'));var rp=require('request-promise');var moment=require(_0x39de('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x39de('0x5'));var util=require(_0x39de('0x6'));var path=require(_0x39de('0x7'));var sox=require(_0x39de('0x8'));var csv=require('to-csv');var ejs=require(_0x39de('0x9'));var fs=require('fs');var _=require(_0x39de('0xa'));var squel=require(_0x39de('0xb'));var crypto=require(_0x39de('0xc'));var jsforce=require(_0x39de('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x39de('0xe'));var Redis=require(_0x39de('0xf'));var authService=require(_0x39de('0x10'));var qs=require(_0x39de('0x11'));var as=require(_0x39de('0x12'));var hardwareService=require(_0x39de('0x13'));var logger=require(_0x39de('0x14'))(_0x39de('0x15'));var utils=require('../../config/utils');var config=require(_0x39de('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5671c1,_0x2bd0f0){_0x2bd0f0=_0x2bd0f0||0xcc;return function(_0x35061b){if(_0x35061b){return _0x5671c1[_0x39de('0x17')](_0x2bd0f0);}return _0x5671c1['status'](_0x2bd0f0)[_0x39de('0x18')]();};}function respondWithResult(_0x236b14,_0x1318d8){_0x1318d8=_0x1318d8||0xc8;return function(_0x905132){if(_0x905132){return _0x236b14[_0x39de('0x19')](_0x1318d8)[_0x39de('0x1a')](_0x905132);}};}function respondWithFilteredResult(_0x229ecc,_0x25ca17){return function(_0xaff589){if(_0xaff589){var _0x316fdb=_0xaff589[_0x39de('0x1b')],_0x4c56df=_0x25ca17[_0x39de('0x1c')],_0x1f36e0=_0x25ca17['offset']+_0x25ca17['limit'],_0x1b5daa;if(_0x1f36e0>=_0x316fdb){_0x1f36e0=_0x316fdb;_0x1b5daa=0xc8;}else{_0x1b5daa=0xce;}_0x229ecc[_0x39de('0x19')](_0x1b5daa);return _0x229ecc['set'](_0x39de('0x1d'),_0x4c56df+'-'+_0x1f36e0+'/'+_0x316fdb)[_0x39de('0x1a')](_0xaff589);}return null;};}function patchUpdates(_0x534059){return function(_0x410995){try{jsonpatch['apply'](_0x410995,_0x534059,!![]);}catch(_0x440201){return BPromise[_0x39de('0x1e')](_0x440201);}return _0x410995['save']();};}function saveUpdates(_0x5d34dd,_0xab6f89){return function(_0x5e4ab2){if(_0x5e4ab2){return _0x5e4ab2['update'](_0x5d34dd)[_0x39de('0x1f')](function(_0x423fe2){return _0x423fe2;});}return null;};}function removeEntity(_0xbcf67c,_0x292dda){return function(_0x400d62){if(_0x400d62){return _0x400d62[_0x39de('0x20')]()['then'](function(){_0xbcf67c[_0x39de('0x19')](0xcc)[_0x39de('0x18')]();});}};}function handleEntityNotFound(_0x45abce,_0x578eaa){return function(_0x372564){if(!_0x372564){_0x45abce['sendStatus'](0x194);}return _0x372564;};}function handleError(_0x40232f,_0x102c5b){_0x102c5b=_0x102c5b||0x1f4;return function(_0x30c3e3){logger[_0x39de('0x21')](_0x30c3e3[_0x39de('0x22')]);if(_0x30c3e3['name']){delete _0x30c3e3[_0x39de('0x23')];}_0x40232f[_0x39de('0x19')](_0x102c5b)[_0x39de('0x24')](_0x30c3e3);};}exports[_0x39de('0x25')]=function(_0x4c7cab,_0x3fd91a){var _0x59e64f={},_0x4c11b3={},_0x17d876={'count':0x0,'rows':[]};var _0x1d3b79=_[_0x39de('0x26')](db[_0x39de('0x27')][_0x39de('0x28')],function(_0x4e9711){return{'name':_0x4e9711[_0x39de('0x29')],'type':_0x4e9711[_0x39de('0x2a')][_0x39de('0x2b')]};});_0x4c11b3[_0x39de('0x2c')]=_[_0x39de('0x26')](_0x1d3b79,_0x39de('0x23'));_0x4c11b3[_0x39de('0x2d')]=_['keys'](_0x4c7cab[_0x39de('0x2d')]);_0x4c11b3[_0x39de('0x2e')]=_[_0x39de('0x2f')](_0x4c11b3[_0x39de('0x2c')],_0x4c11b3['query']);_0x59e64f[_0x39de('0x30')]=_[_0x39de('0x2f')](_0x4c11b3[_0x39de('0x2c')],qs[_0x39de('0x31')](_0x4c7cab['query'][_0x39de('0x31')]));_0x59e64f[_0x39de('0x30')]=_0x59e64f[_0x39de('0x30')][_0x39de('0x32')]?_0x59e64f[_0x39de('0x30')]:_0x4c11b3['model'];if(!_0x4c7cab['query'][_0x39de('0x33')](_0x39de('0x34'))){_0x59e64f[_0x39de('0x35')]=qs[_0x39de('0x35')](_0x4c7cab['query'][_0x39de('0x35')]);_0x59e64f['offset']=qs[_0x39de('0x1c')](_0x4c7cab[_0x39de('0x2d')][_0x39de('0x1c')]);}_0x59e64f['order']=qs[_0x39de('0x36')](_0x4c7cab[_0x39de('0x2d')][_0x39de('0x36')]);_0x59e64f[_0x39de('0x37')]=qs[_0x39de('0x2e')](_[_0x39de('0x38')](_0x4c7cab[_0x39de('0x2d')],_0x4c11b3[_0x39de('0x2e')]));if(_0x4c7cab[_0x39de('0x2d')]['filter']){_0x59e64f[_0x39de('0x37')]=_[_0x39de('0x39')](_0x59e64f[_0x39de('0x37')],{'$or':_[_0x39de('0x26')](_0x1d3b79,function(_0x29cf4a){if(_0x29cf4a['type']!==_0x39de('0x3a')){var _0x543bc4={};_0x543bc4[_0x29cf4a[_0x39de('0x23')]]={'$like':'%'+_0x4c7cab[_0x39de('0x2d')][_0x39de('0x3b')]+'%'};return _0x543bc4;}})});}_0x59e64f=_[_0x39de('0x39')]({},_0x59e64f,_0x4c7cab[_0x39de('0x3c')]);var _0x124bdb={'where':_0x59e64f[_0x39de('0x37')]};return db[_0x39de('0x27')][_0x39de('0x1b')](_0x124bdb)['then'](function(_0x155451){_0x17d876[_0x39de('0x1b')]=_0x155451;if(_0x4c7cab[_0x39de('0x2d')]['includeAll']){_0x59e64f[_0x39de('0x3d')]=[{'all':!![]}];}return db[_0x39de('0x27')][_0x39de('0x3e')](_0x59e64f);})[_0x39de('0x1f')](function(_0x497226){_0x17d876['rows']=_0x497226;return _0x17d876;})[_0x39de('0x1f')](respondWithFilteredResult(_0x3fd91a,_0x59e64f))[_0x39de('0x3f')](handleError(_0x3fd91a,null));};exports[_0x39de('0x40')]=function(_0x41b76e,_0x482084){var _0x71c4b6={'raw':!![],'where':{'id':_0x41b76e[_0x39de('0x41')]['id']}},_0x2565aa={};_0x2565aa[_0x39de('0x2c')]=_[_0x39de('0x42')](db[_0x39de('0x27')][_0x39de('0x28')]);_0x2565aa[_0x39de('0x2d')]=_['keys'](_0x41b76e[_0x39de('0x2d')]);_0x2565aa[_0x39de('0x2e')]=_[_0x39de('0x2f')](_0x2565aa['model'],_0x2565aa[_0x39de('0x2d')]);_0x71c4b6[_0x39de('0x30')]=_[_0x39de('0x2f')](_0x2565aa['model'],qs[_0x39de('0x31')](_0x41b76e[_0x39de('0x2d')][_0x39de('0x31')]));_0x71c4b6['attributes']=_0x71c4b6[_0x39de('0x30')][_0x39de('0x32')]?_0x71c4b6[_0x39de('0x30')]:_0x2565aa[_0x39de('0x2c')];if(_0x41b76e['query'][_0x39de('0x43')]){_0x71c4b6[_0x39de('0x3d')]=[{'all':!![]}];}_0x71c4b6=_['merge']({},_0x71c4b6,_0x41b76e['options']);return db['FaxApplication'][_0x39de('0x44')](_0x71c4b6)[_0x39de('0x1f')](handleEntityNotFound(_0x482084,null))[_0x39de('0x1f')](respondWithResult(_0x482084,null))[_0x39de('0x3f')](handleError(_0x482084,null));};exports[_0x39de('0x45')]=function(_0x312363,_0x53c640){return db[_0x39de('0x27')][_0x39de('0x45')](_0x312363[_0x39de('0x46')],{})['then'](respondWithResult(_0x53c640,0xc9))[_0x39de('0x3f')](handleError(_0x53c640,null));};exports[_0x39de('0x47')]=function(_0x4c4136,_0x5ee1a6){if(_0x4c4136[_0x39de('0x46')]['id']){delete _0x4c4136[_0x39de('0x46')]['id'];}return db['FaxApplication'][_0x39de('0x44')]({'where':{'id':_0x4c4136[_0x39de('0x41')]['id']}})['then'](handleEntityNotFound(_0x5ee1a6,null))[_0x39de('0x1f')](saveUpdates(_0x4c4136[_0x39de('0x46')],null))[_0x39de('0x1f')](respondWithResult(_0x5ee1a6,null))[_0x39de('0x3f')](handleError(_0x5ee1a6,null));};exports[_0x39de('0x20')]=function(_0x4caace,_0x18abca){return db[_0x39de('0x27')]['find']({'where':{'id':_0x4caace[_0x39de('0x41')]['id']}})[_0x39de('0x1f')](handleEntityNotFound(_0x18abca,null))['then'](removeEntity(_0x18abca,null))['catch'](handleError(_0x18abca,null));}; \ No newline at end of file +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 diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 185f9ba..ab7f7ff 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 _0x6118=['../../config/logger','api','moment','bluebird','../../config/environment','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x5bd406,_0x5c2473){var _0x2f621b=function(_0x548b8c){while(--_0x548b8c){_0x5bd406['push'](_0x5bd406['shift']());}};_0x2f621b(++_0x5c2473);}(_0x6118,0x12b));var _0x8611=function(_0x6dd5c,_0x4bfc19){_0x6dd5c=_0x6dd5c-0x0;var _0x5a87fa=_0x6118[_0x6dd5c];return _0x5a87fa;};'use strict';var _=require(_0x8611('0x0'));var util=require('util');var logger=require(_0x8611('0x1'))(_0x8611('0x2'));var moment=require(_0x8611('0x3'));var BPromise=require(_0x8611('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8611('0x5'));var attributes=require('./faxApplication.attributes');module[_0x8611('0x6')]=function(_0xe7b4d3,_0x47ab7c){return _0xe7b4d3[_0x8611('0x7')](_0x8611('0x8'),attributes,{'tableName':_0x8611('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8611('0xa'),'collate':_0x8611('0xb')});}; \ No newline at end of file +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 diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index f80582b..78ccb52 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 _0x1431=['then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','result','message','catch','UpdateFaxApplication','FaxApplication','body','options','raw','limit','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1431,0x16e));var _0x1143=function(_0x14cd58,_0x5e5730){_0x14cd58=_0x14cd58-0x0;var _0x281984=_0x1431[_0x14cd58];return _0x281984;};'use strict';var _=require(_0x1143('0x0'));var util=require('util');var moment=require(_0x1143('0x1'));var BPromise=require(_0x1143('0x2'));var rs=require(_0x1143('0x3'));var fs=require('fs');var Redis=require(_0x1143('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1143('0x5'));var logger=require(_0x1143('0x6'))('rpc');var config=require(_0x1143('0x7'));var jayson=require(_0x1143('0x8'));var client=jayson[_0x1143('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a4656,_0x1e9b9a,_0x26131c){return new BPromise(function(_0x2fb960,_0x37ea8d){return client[_0x1143('0xa')](_0x1a4656,_0x26131c)[_0x1143('0xb')](function(_0x14f61c){logger[_0x1143('0xc')](_0x1143('0xd'),_0x1e9b9a,_0x1143('0xe'));logger[_0x1143('0xf')](_0x1143('0x10'),_0x1e9b9a,_0x1143('0xe'),JSON[_0x1143('0x11')](_0x14f61c));if(_0x14f61c[_0x1143('0x12')]){if(_0x14f61c[_0x1143('0x12')][_0x1143('0x13')]===0x1f4){logger[_0x1143('0x12')](_0x1143('0xd'),_0x1e9b9a,_0x14f61c['error']['message']);return _0x37ea8d(_0x14f61c[_0x1143('0x12')]['message']);}logger[_0x1143('0x12')](_0x1143('0xd'),_0x1e9b9a,_0x14f61c['error']['message']);return _0x2fb960(_0x14f61c[_0x1143('0x12')]['message']);}else{logger[_0x1143('0xc')](_0x1143('0xd'),_0x1e9b9a,_0x1143('0xe'));_0x2fb960(_0x14f61c[_0x1143('0x14')][_0x1143('0x15')]);}})[_0x1143('0x16')](function(_0xe170ec){logger[_0x1143('0x12')](_0x1143('0xd'),_0x1e9b9a,_0xe170ec);_0x37ea8d(_0xe170ec);});});}exports[_0x1143('0x17')]=function(_0x5c6e17){var _0x260f81=this;return new Promise(function(_0x264add,_0x584c04){return db[_0x1143('0x18')]['update'](_0x5c6e17[_0x1143('0x19')],{'raw':_0x5c6e17[_0x1143('0x1a')]?_0x5c6e17[_0x1143('0x1a')][_0x1143('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c6e17[_0x1143('0x1a')]?_0x5c6e17[_0x1143('0x1a')]['where']||null:null,'attributes':_0x5c6e17[_0x1143('0x1a')]?_0x5c6e17[_0x1143('0x1a')]['attributes']||null:null,'limit':_0x5c6e17[_0x1143('0x1a')]?_0x5c6e17[_0x1143('0x1a')][_0x1143('0x1c')]||null:null})['then'](function(_0x4b8233){logger[_0x1143('0xc')](_0x1143('0x17'),_0x5c6e17);logger['debug'](_0x1143('0x17'),_0x5c6e17,JSON['stringify'](_0x4b8233));_0x264add(_0x4b8233);})[_0x1143('0x16')](function(_0x36f855){logger['error'](_0x1143('0x17'),_0x36f855[_0x1143('0x15')],_0x5c6e17);_0x584c04(_0x260f81[_0x1143('0x12')](0x1f4,_0x36f855[_0x1143('0x15')]));});});}; \ No newline at end of file +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 diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index f3fc635..0bbf121 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 _0x71ab=['isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get'];(function(_0x2250da,_0xdb9fe6){var _0x573dc5=function(_0x3f397a){while(--_0x3f397a){_0x2250da['push'](_0x2250da['shift']());}};_0x573dc5(++_0xdb9fe6);}(_0x71ab,0x64));var _0xb71a=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x71ab[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0xb71a('0x0'));var path=require('path');var timeout=require(_0xb71a('0x1'));var express=require('express');var router=express[_0xb71a('0x2')]();var auth=require(_0xb71a('0x3'));var interaction=require(_0xb71a('0x4'));var config=require(_0xb71a('0x5'));var controller=require(_0xb71a('0x6'));router[_0xb71a('0x7')]('/',auth[_0xb71a('0x8')](),controller[_0xb71a('0x9')]);router[_0xb71a('0x7')](_0xb71a('0xa'),auth[_0xb71a('0x8')](),controller[_0xb71a('0xb')]);router[_0xb71a('0xc')]('/',auth[_0xb71a('0x8')](),controller[_0xb71a('0xd')]);router[_0xb71a('0xe')](_0xb71a('0xa'),auth[_0xb71a('0x8')](),controller['update']);router[_0xb71a('0xf')]('/:id',auth[_0xb71a('0x8')](),controller[_0xb71a('0x10')]);module[_0xb71a('0x11')]=router; \ No newline at end of file +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 diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index bc36294..4967a2c 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 _0x8319=['STRING','ENUM','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x4778e0,_0x2dd451){var _0x4f7ada=function(_0x49c81a){while(--_0x49c81a){_0x4778e0['push'](_0x4778e0['shift']());}};_0x4f7ada(++_0x2dd451);}(_0x8319,0x18b));var _0x9831=function(_0x537d07,_0x32b617){_0x537d07=_0x537d07-0x0;var _0x3772dd=_0x8319[_0x537d07];return _0x3772dd;};'use strict';var Sequelize=require(_0x9831('0x0'));module[_0x9831('0x1')]={'closed':{'type':Sequelize[_0x9831('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9831('0x3')]},'disposition':{'type':Sequelize[_0x9831('0x4')]},'note':{'type':Sequelize[_0x9831('0x4')]},'read1stAt':{'type':Sequelize[_0x9831('0x3')]},'fax':{'type':Sequelize[_0x9831('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x9831('0x5')]('in',_0x9831('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9831('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x9831('0x5')]('in',_0x9831('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +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 diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 9eed860..c714807 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 _0xe51a=['rawAttributes','type','model','name','keys','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','select','field','color','u.fullname','ui.FaxInteractionId','from','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','length','conditions','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)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','isEmpty','FaxAccountId','where','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','t.id\x20IN\x20?','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','i.FaxAccountId\x20IS\x20NULL','sequelize','keyBy','merge','FaxInteraction','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','show','params','includeAll','options','catch','create','update','describe','addMessage','FaxMessage','omit','ids','getMessages','findOne','format','findAll','setTags','faxInteractionTags:save','removeTags','download','unix','join','root','files','server','attachments','Attachment','Messages','get','mkdirSync','existsSync','pipe','createWriteStream','basename','log','err','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','sendStatus','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','status','end','stack','send','map','fullname','TagIds','Tags','split','forEach','push','index'];(function(_0x4a8fea,_0x4603f4){var _0x5e23a4=function(_0x25dcb0){while(--_0x25dcb0){_0x4a8fea['push'](_0x4a8fea['shift']());}};_0x5e23a4(++_0x4603f4);}(_0xe51a,0x9f));var _0xae51=function(_0x4c6720,_0x4f940a){_0x4c6720=_0x4c6720-0x0;var _0x1e4d45=_0xe51a[_0x4c6720];return _0x1e4d45;};'use strict';var pdf=require(_0xae51('0x0'));var emlformat=require(_0xae51('0x1'));var rimraf=require(_0xae51('0x2'));var zipdir=require(_0xae51('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xae51('0x4'));var moment=require(_0xae51('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xae51('0x6'));var util=require(_0xae51('0x7'));var path=require('path');var sox=require(_0xae51('0x8'));var csv=require('to-csv');var ejs=require(_0xae51('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xae51('0xa'));var crypto=require(_0xae51('0xb'));var jsforce=require(_0xae51('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xae51('0xd'));var querystring=require(_0xae51('0xe'));var Papa=require(_0xae51('0xf'));var Redis=require(_0xae51('0x10'));var authService=require(_0xae51('0x11'));var qs=require(_0xae51('0x12'));var as=require(_0xae51('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xae51('0x14'))(_0xae51('0x15'));var utils=require(_0xae51('0x16'));var config=require('../../config/environment');var db=require(_0xae51('0x17'))['db'];config[_0xae51('0x18')]=_[_0xae51('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xae51('0x1a'))(new Redis(config[_0xae51('0x18')]));require(_0xae51('0x1b'))[_0xae51('0x1c')](socket);function respondWithStatusCode(_0x4bd3d2,_0x2b9094){_0x2b9094=_0x2b9094||0xcc;return function(_0x10e9c8){if(_0x10e9c8){return _0x4bd3d2[_0xae51('0x1d')](_0x2b9094);}return _0x4bd3d2['status'](_0x2b9094)['end']();};}function respondWithResult(_0x57749a,_0x2c6465){_0x2c6465=_0x2c6465||0xc8;return function(_0xb4c876){if(_0xb4c876){return _0x57749a['status'](_0x2c6465)['json'](_0xb4c876);}};}function respondWithFilteredResult(_0x405702,_0x55d95e){return function(_0x2e77c8){if(_0x2e77c8){var _0x4997e2=_0x2e77c8[_0xae51('0x1e')],_0x41bd5c=_0x55d95e[_0xae51('0x1f')],_0x136ed9=_0x55d95e['offset']+_0x55d95e[_0xae51('0x20')],_0x48e170;if(_0x136ed9>=_0x4997e2){_0x136ed9=_0x4997e2;_0x48e170=0xc8;}else{_0x48e170=0xce;}_0x405702['status'](_0x48e170);return _0x405702[_0xae51('0x21')](_0xae51('0x22'),_0x41bd5c+'-'+_0x136ed9+'/'+_0x4997e2)[_0xae51('0x23')](_0x2e77c8);}return null;};}function patchUpdates(_0x1bc98b){return function(_0x1a2675){try{jsonpatch[_0xae51('0x24')](_0x1a2675,_0x1bc98b,!![]);}catch(_0x42db8a){return BPromise[_0xae51('0x25')](_0x42db8a);}return _0x1a2675[_0xae51('0x26')]();};}function saveUpdates(_0x15259b,_0x3d8db1){return function(_0x4cce1c){if(_0x4cce1c){return _0x4cce1c['update'](_0x15259b)[_0xae51('0x27')](function(_0x2a5224){return _0x2a5224;});}return null;};}function removeEntity(_0x4dafa8,_0x542742){return function(_0xb52dd8){if(_0xb52dd8){return _0xb52dd8[_0xae51('0x28')]()[_0xae51('0x27')](function(){_0x4dafa8[_0xae51('0x29')](0xcc)[_0xae51('0x2a')]();});}};}function handleEntityNotFound(_0x19c7ce,_0x52bfe9){return function(_0x3afb3f){if(!_0x3afb3f){_0x19c7ce[_0xae51('0x1d')](0x194);}return _0x3afb3f;};}function handleError(_0x3846a3,_0x142cf8){_0x142cf8=_0x142cf8||0x1f4;return function(_0x38a387){logger['error'](_0x38a387[_0xae51('0x2b')]);if(_0x38a387['name']){delete _0x38a387['name'];}_0x3846a3[_0xae51('0x29')](_0x142cf8)[_0xae51('0x2c')](_0x38a387);};}function getInteractionUsers(_0x486644,_0x59d27c){return new BPromise(function(_0x26887d,_0x502476){try{if(_0x59d27c[_0x486644['id']]){_0x486644['Users']=_[_0xae51('0x2d')](_0x59d27c[_0x486644['id']],function(_0x502370){return{'id':_0x502370['id'],'fullname':_0x502370[_0xae51('0x2e')]};});}}catch(_0x1a06b5){_0x502476(_0x1a06b5);}_0x26887d(_0x486644);});}function getInteractionTags(_0x59d22f,_0x2e472c){return new BPromise(function(_0x244bb7,_0x2b010d){try{if(_0x59d22f[_0xae51('0x2f')]){_0x59d22f[_0xae51('0x30')]=[];_0x59d22f[_0xae51('0x2f')][_0xae51('0x31')](',')[_0xae51('0x32')](function(_0x4656f2){_0x59d22f[_0xae51('0x30')][_0xae51('0x33')](_0x2e472c[_0x4656f2]);});}delete _0x59d22f[_0xae51('0x2f')];}catch(_0x3a3938){_0x2b010d(_0x3a3938);}_0x244bb7(_0x59d22f);});}function updateFaxInteraction(_0x4a46dc,_0xa37e73,_0x4374ee){return new BPromise(function(_0x264269,_0x21b299){return getInteractionUsers(_0x4a46dc,_0x4374ee)[_0xae51('0x27')](function(_0x1de6cc){return getInteractionTags(_0x1de6cc,_0xa37e73);})[_0xae51('0x27')](function(_0x3a9d38){_0x264269(_0x3a9d38);})['catch'](function(_0x56df53){_0x21b299(_0x56df53);});});}exports[_0xae51('0x34')]=function(_0xc341f7,_0xdd2020){var _0x3917fb={},_0x475985={},_0x1d79a6={'count':0x0,'rows':[]};var _0x50516d=_['map'](db['FaxInteraction'][_0xae51('0x35')],function(_0x376f6f){return{'name':_0x376f6f['fieldName'],'type':_0x376f6f[_0xae51('0x36')]['key']};});_0x475985[_0xae51('0x37')]=_[_0xae51('0x2d')](_0x50516d,_0xae51('0x38'));_0x475985['query']=_[_0xae51('0x39')](_0xc341f7['query']);_0x475985[_0xae51('0x3a')]=_[_0xae51('0x3b')](_0x475985[_0xae51('0x37')],_0x475985[_0xae51('0x3c')]);_0x3917fb['attributes']=_[_0xae51('0x3b')](_0x475985['model'],qs[_0xae51('0x3d')](_0xc341f7[_0xae51('0x3c')][_0xae51('0x3d')]));_0x3917fb['attributes']=_0x3917fb[_0xae51('0x3e')]['length']?_0x3917fb[_0xae51('0x3e')]:_0x475985[_0xae51('0x37')];if(!_0xc341f7['query'][_0xae51('0x3f')](_0xae51('0x40'))){_0x3917fb[_0xae51('0x20')]=qs[_0xae51('0x20')](_0xc341f7[_0xae51('0x3c')][_0xae51('0x20')]);_0x3917fb[_0xae51('0x1f')]=qs[_0xae51('0x1f')](_0xc341f7[_0xae51('0x3c')][_0xae51('0x1f')]);}_0x3917fb[_0xae51('0x41')]=qs[_0xae51('0x42')](_0xc341f7[_0xae51('0x3c')][_0xae51('0x42')]);_0x3917fb['where']=qs[_0xae51('0x3a')](_[_0xae51('0x43')](_0xc341f7[_0xae51('0x3c')],_0x475985['filters']));var _0x5f4484=[];var _0x43f59f=squel[_0xae51('0x44')]()[_0xae51('0x45')]('id')['field'](_0xae51('0x38'))['field'](_0xae51('0x46'))['from']('tools_tags');var _0x215ed9=squel[_0xae51('0x44')]()[_0xae51('0x45')]('u.id')[_0xae51('0x45')](_0xae51('0x47'))[_0xae51('0x45')](_0xae51('0x48'))[_0xae51('0x49')](_0xae51('0x4a'),'ui')[_0xae51('0x4b')](_0xae51('0x4c'),'u',_0xae51('0x4d'));var _0x5637ad=squel['select']()['from'](_0xae51('0x4e'),'i')[_0xae51('0x4b')](_0xae51('0x4f'),'c',_0xae51('0x50'))[_0xae51('0x4b')]('users','o','o.id\x20=\x20i.UserId')[_0xae51('0x4b')](_0xae51('0x51'),'a',_0xae51('0x52'))['left_join'](_0xae51('0x53'),'me',_0xae51('0x54'))['left_join'](_0xae51('0x55'),'it',_0xae51('0x56'))[_0xae51('0x4b')](_0xae51('0x57'),'t',_0xae51('0x58'));var _0x21b946=squel[_0xae51('0x59')]();var _0x2d7a74=[];var _0x145a23=squel['expr']();var _0x149d51;if(_0xc341f7['query'][_0xae51('0x5a')]){_0x149d51=as[_0xae51('0x5b')](_0xc341f7['query']['search']);var _0x41846e=_0x149d51[_0xae51('0x5c')];for(var _0x46cc95=0x0;_0x46cc95<_0x149d51['conditions'][_0xae51('0x5d')];_0x46cc95++){var _0x33754f=_0x149d51[_0xae51('0x5e')][_0x46cc95];var _0x51daa8='i';var _0x1be3f3=_['find'](_0x50516d,[_0xae51('0x38'),_0x33754f[_0xae51('0x45')]]);if(!_0x1be3f3){switch(_0x33754f[_0xae51('0x45')]){case'unreadMessages':if(_0x33754f[_0xae51('0x5f')]==0x1){_0x5637ad[_0xae51('0x60')]('`'+_0x33754f[_0xae51('0x45')]+_0xae51('0x61'));}else{_0x5637ad['having']('`'+_0x33754f[_0xae51('0x45')]+_0xae51('0x62'));}break;case _0xae51('0x63'):if(_0x33754f['operator']===_0xae51('0x64')){if(_0x33754f[_0xae51('0x5f')][_0xae51('0x31')]('\x20')[_0xae51('0x5d')]>0x1){_0x21b946[_0x41846e](_0xae51('0x65'),qs['getFullTextValue'](_0x33754f[_0xae51('0x5f')]),null);}else{var _0x5c20ea='%'+_0x33754f['value']+'%';_0x21b946[_0x41846e](_0xae51('0x66'),_0x5c20ea,_0x5c20ea,_0x5c20ea);}}else{_0x1be3f3=_[_0xae51('0x67')](_0x50516d,['name','ContactId']);_0x33754f['field']=_0xae51('0x68');_0x5cd8ea=as[_0xae51('0x69')](_0x51daa8,_0x1be3f3[_0xae51('0x36')],_0x33754f);_0x21b946[_0x41846e](_0x5cd8ea[_0xae51('0x6a')],_0x5cd8ea['value'][_0xae51('0x6b')],_0x5cd8ea[_0xae51('0x5f')][_0xae51('0x2a')]);}break;case _0xae51('0x6c'):var _0x44e962=_0x33754f[_0xae51('0x5f')][_0xae51('0x31')](',')[_0xae51('0x2d')](function(_0x140c62){return Number(_0x140c62);});_0x44e962[_0xae51('0x32')](function(_0x451525){_0x145a23['or'](_0xae51('0x6d'),'%,'+_0x451525+',%');});_0x2d7a74=_[_0xae51('0x6e')](_0x2d7a74,_0x44e962);break;case'User':if(_0x33754f[_0xae51('0x6f')]===_0xae51('0x64')){_0x21b946[_0x41846e](_0xae51('0x70'),'%'+_0x33754f[_0xae51('0x5f')]+'%',null);}else{_0x1be3f3=_[_0xae51('0x67')](_0x50516d,[_0xae51('0x38'),_0xae51('0x71')]);_0x33754f[_0xae51('0x45')]='UserId';_0x5cd8ea=as[_0xae51('0x69')](_0x51daa8,_0x1be3f3[_0xae51('0x36')],_0x33754f);_0x21b946[_0x41846e](_0x5cd8ea['text'],_0x5cd8ea[_0xae51('0x5f')]['start'],_0x5cd8ea[_0xae51('0x5f')]['end']);}break;case _0xae51('0x72'):_0x5cd8ea=as[_0xae51('0x69')]('me',null,_0x33754f);_0x21b946[_0x41846e](_0x5cd8ea[_0xae51('0x6a')],_0x5cd8ea[_0xae51('0x5f')][_0xae51('0x6b')],_0x5cd8ea[_0xae51('0x5f')][_0xae51('0x2a')]);break;}}else{var _0x5cd8ea=as[_0xae51('0x69')](_0x51daa8,_0x1be3f3[_0xae51('0x36')],_0x33754f);_0x21b946[_0x41846e](_0x5cd8ea['text'],_0x5cd8ea[_0xae51('0x5f')][_0xae51('0x6b')],_0x5cd8ea[_0xae51('0x5f')]['end']);}}}else{var _0x45c80e=_(_0xc341f7[_0xae51('0x3c')])[_0xae51('0x39')]()[_0xae51('0x2d')](function(_0x1b19f3){return _[_0xae51('0x73')](_0x50516d,[_0xae51('0x38'),_0x1b19f3])?_0x1b19f3:undefined;})['compact']()[_0xae51('0x5f')]();if(!_[_0xae51('0x74')](_0x45c80e)){_0x45c80e[_0xae51('0x32')](function(_0x350607){if(_0x350607===_0xae51('0x75')){_0x5637ad[_0xae51('0x76')](_0xae51('0x77'),[][_0xae51('0x78')](_0xc341f7[_0xae51('0x3c')][_0x350607]));}else if(_0x350607===_0xae51('0x79')){var _0x2ea472=JSON[_0xae51('0x7a')](_0xc341f7[_0xae51('0x3c')][_0x350607])[_0xae51('0x7b')];var _0x18875a=JSON[_0xae51('0x7a')](_0xc341f7[_0xae51('0x3c')][_0x350607])['$lte'];_0x5637ad['where'](_0xae51('0x7c'),_0x2ea472,_0x18875a);}else{if(_0xc341f7[_0xae51('0x3c')][_0x350607]===_0xae51('0x7d')){_0x5637ad[_0xae51('0x76')]('i.'+_0x350607+_0xae51('0x7e'));}else{_0x5637ad[_0xae51('0x76')]('i.'+_0x350607+_0xae51('0x7f'),_0xc341f7[_0xae51('0x3c')][_0x350607]);}}});}if(_0xc341f7[_0xae51('0x3c')][_0xae51('0x80')]){if(_0xc341f7[_0xae51('0x3c')][_0xae51('0x80')]==0x1){_0x5637ad[_0xae51('0x60')](_0xae51('0x81'));}else{_0x5637ad[_0xae51('0x60')](_0xae51('0x82'));}}if(_0xc341f7[_0xae51('0x3c')][_0xae51('0x83')]){_0x2d7a74=_[_0xae51('0x84')](_0xc341f7[_0xae51('0x3c')][_0xae51('0x83')])?_0xc341f7['query']['tag']:new Array(_0xc341f7['query'][_0xae51('0x83')]);_0x2d7a74[_0xae51('0x32')](function(_0x5473b5){_0x145a23['or'](_0xae51('0x6d'),'%,'+_0x5473b5+',%');});}if(_0xc341f7[_0xae51('0x3c')]['filter']){var _0x1b97ad=_0xc341f7[_0xae51('0x3c')][_0xae51('0x85')][_0xae51('0x86')]('\x5c','\x5c\x5c')[_0xae51('0x86')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0xae51('0x87')](_0x1b97ad)){_0x21b946['or']('i.id\x20LIKE\x20?',_0x1b97ad+'%')['or'](_0xae51('0x88'),_0x1b97ad+'%');}_0x21b946['or'](_0xae51('0x89'),_0x1b97ad+'%');}}_0x5637ad[_0xae51('0x76')](_0x21b946);_0x5637ad[_0xae51('0x8a')]('i.id');var _0x3eca57={'type':db[_0xae51('0x8b')]['QueryTypes'][_0xae51('0x8c')],'raw':!![]};var _0x4b9525=_0x5637ad[_0xae51('0x8d')]();_0x4b9525[_0xae51('0x45')](_0xae51('0x8e'));_0x4b9525['field'](_0xae51('0x8f'),_0xae51('0x90'));if(_0x3917fb[_0xae51('0x41')]){_0x3917fb['order'][_0xae51('0x32')](function(_0x14c3c6){_0x5637ad[_0xae51('0x41')]('i.'+_0x14c3c6[0x0],_0x14c3c6[0x1]==='DESC'?![]:!![]);});}if(!_[_0xae51('0x74')](_0x2d7a74)){_0x5637ad[_0xae51('0x60')](_0x145a23);_0x4b9525[_0xae51('0x76')](_0xae51('0x91'),_0x2d7a74);}BPromise[_0xae51('0x92')]()[_0xae51('0x27')](function(){if(!_0x149d51){if(_0xc341f7['query'][_0xae51('0x75')]||_0xc341f7[_0xae51('0x3c')][_0xae51('0x93')])return;_0x4b9525[_0xae51('0x76')](_0xae51('0x94'));_0x5637ad[_0xae51('0x76')](_0xae51('0x94'));return;}return _0xc341f7[_0xae51('0x95')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0xae51('0x27')](function(_0x399a06){if(_[_0xae51('0x74')](_0x399a06)){_0x4b9525['where'](_0xae51('0x96'));_0x5637ad[_0xae51('0x76')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x4b9525[_0xae51('0x76')](_0xae51('0x77'),_[_0xae51('0x2d')](_0x399a06,'id'));_0x5637ad['where'](_0xae51('0x77'),_[_0xae51('0x2d')](_0x399a06,'id'));}});})[_0xae51('0x27')](function(){db[_0xae51('0x97')][_0xae51('0x3c')](_0x4b9525['toString'](),_0x3eca57)[_0xae51('0x27')](function(_0x2ae263){_0x1d79a6[_0xae51('0x1e')]=_0x2ae263[_0xae51('0x5d')];if(_0x1d79a6[_0xae51('0x1e')]===0x0)return[];return db['sequelize'][_0xae51('0x3c')](_0x43f59f['toString'](),_0x3eca57)[_0xae51('0x27')](function(_0x30ba69){_0x5f4484=_[_0xae51('0x98')](_0x30ba69,'id');_0x3eca57=_[_0xae51('0x99')](_0x3eca57,{'model':db[_0xae51('0x9a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xc341f7['query'][_0xae51('0x3d')]){_0x3917fb[_0xae51('0x3e')][_0xae51('0x32')](function(_0x8a7038){_0x5637ad[_0xae51('0x45')]('i.'+_0x8a7038);});}else{_0x5637ad['field'](_0xae51('0x8f'),_0xae51('0x90'));_0x5637ad['field'](_0xae51('0x9b'),'Account.key');_0x5637ad['field'](_0xae51('0x9c'),_0xae51('0x9d'));_0x5637ad[_0xae51('0x45')]('i.*');_0x5637ad['field'](_0xae51('0x9e'),'Contact.firstName');_0x5637ad['field'](_0xae51('0x9f'),_0xae51('0xa0'));_0x5637ad[_0xae51('0x45')](_0xae51('0xa1'),_0xae51('0xa2'));_0x5637ad[_0xae51('0x45')](_0xae51('0xa3'),_0xae51('0xa4'));_0x5637ad[_0xae51('0x45')]('c.mobile',_0xae51('0xa5'));_0x5637ad[_0xae51('0x45')](_0xae51('0xa6'),'Contact.fax');_0x5637ad[_0xae51('0x45')]('o.fullname',_0xae51('0xa7'));_0x5637ad['field']('o.internal',_0xae51('0xa8'));_0x5637ad[_0xae51('0x45')](_0xae51('0xa9'),_0xae51('0x2f'));}_0x5637ad['limit'](_0x3917fb[_0xae51('0x20')]);_0x5637ad[_0xae51('0x1f')](_0x3917fb[_0xae51('0x1f')]);return db[_0xae51('0x97')][_0xae51('0x3c')](_0x5637ad[_0xae51('0xaa')](),_0x3eca57);})[_0xae51('0x27')](function(_0x334ac0){_0x215ed9[_0xae51('0x76')](_0xae51('0xab'),_['map'](_0x334ac0,'id'));return db[_0xae51('0x97')][_0xae51('0x3c')](_0x215ed9['toString'](),_0x3eca57)[_0xae51('0x27')](function(_0x10bcd2){var _0x2f37e5=_[_0xae51('0xac')](_0x10bcd2,_0xae51('0xad'));var _0x4d7d6e=[];_0x334ac0[_0xae51('0x32')](function(_0x2fc719){_0x4d7d6e[_0xae51('0x33')](updateFaxInteraction(_0x2fc719,_0x5f4484,_0x2f37e5));});return BPromise[_0xae51('0xae')](_0x4d7d6e);});});})[_0xae51('0x27')](function(_0x416932){_0x1d79a6[_0xae51('0xaf')]=_0x416932;return _0x1d79a6;})[_0xae51('0x27')](respondWithFilteredResult(_0xdd2020,_0x3917fb));})['catch'](handleError(_0xdd2020,null));};exports[_0xae51('0xb0')]=function(_0x4856ff,_0x5a5105){var _0x273c84={'raw':![],'where':{'id':_0x4856ff[_0xae51('0xb1')]['id']}},_0x2987bb={};_0x2987bb[_0xae51('0x37')]=_[_0xae51('0x39')](db[_0xae51('0x9a')][_0xae51('0x35')]);_0x2987bb[_0xae51('0x3c')]=_[_0xae51('0x39')](_0x4856ff['query']);_0x2987bb[_0xae51('0x3a')]=_[_0xae51('0x3b')](_0x2987bb[_0xae51('0x37')],_0x2987bb[_0xae51('0x3c')]);_0x273c84[_0xae51('0x3e')]=_[_0xae51('0x3b')](_0x2987bb['model'],qs['fields'](_0x4856ff[_0xae51('0x3c')][_0xae51('0x3d')]));_0x273c84[_0xae51('0x3e')]=_0x273c84[_0xae51('0x3e')]['length']?_0x273c84[_0xae51('0x3e')]:_0x2987bb[_0xae51('0x37')];if(_0x4856ff[_0xae51('0x3c')][_0xae51('0xb2')]){_0x273c84['include']=[{'all':!![]}];}_0x273c84=_[_0xae51('0x99')]({},_0x273c84,_0x4856ff[_0xae51('0xb3')]);return db[_0xae51('0x9a')][_0xae51('0x67')](_0x273c84)[_0xae51('0x27')](handleEntityNotFound(_0x5a5105,null))[_0xae51('0x27')](respondWithResult(_0x5a5105,null))[_0xae51('0xb4')](handleError(_0x5a5105,null));};exports[_0xae51('0xb5')]=function(_0x372806,_0xe0efd9){return db['FaxInteraction'][_0xae51('0xb5')](_0x372806[_0xae51('0x72')],{})[_0xae51('0x27')](respondWithResult(_0xe0efd9,0xc9))['catch'](handleError(_0xe0efd9,null));};exports[_0xae51('0xb6')]=function(_0x4cbf5b,_0x5a49d4){if(_0x4cbf5b['body']['id']){delete _0x4cbf5b[_0xae51('0x72')]['id'];}return db['FaxInteraction'][_0xae51('0x67')]({'where':{'id':_0x4cbf5b[_0xae51('0xb1')]['id']}})[_0xae51('0x27')](handleEntityNotFound(_0x5a49d4,null))['then'](saveUpdates(_0x4cbf5b[_0xae51('0x72')],null))[_0xae51('0x27')](respondWithResult(_0x5a49d4,null))[_0xae51('0xb4')](handleError(_0x5a49d4,null));};exports[_0xae51('0x28')]=function(_0x12b79e,_0x52362f){return db[_0xae51('0x9a')][_0xae51('0x67')]({'where':{'id':_0x12b79e[_0xae51('0xb1')]['id']}})[_0xae51('0x27')](handleEntityNotFound(_0x52362f,null))[_0xae51('0x27')](removeEntity(_0x52362f,null))['catch'](handleError(_0x52362f,null));};exports[_0xae51('0xb7')]=function(_0x20c952,_0x54d276){return db[_0xae51('0x9a')][_0xae51('0xb7')]()['then'](respondWithResult(_0x54d276,null))['catch'](handleError(_0x54d276,null));};exports[_0xae51('0xb8')]=function(_0x1f130d,_0x16d9a4,_0x474572){return db[_0xae51('0xb9')][_0xae51('0x67')]({'where':{'id':_0x1f130d[_0xae51('0xb1')]['id']}})[_0xae51('0x27')](handleEntityNotFound(_0x16d9a4,null))['then'](function(_0x2d297a){if(_0x2d297a){return _0x2d297a['addMessage'](_0x1f130d[_0xae51('0x72')]['ids'],_[_0xae51('0xba')](_0x1f130d[_0xae51('0x72')],[_0xae51('0xbb'),'id'])||{});}})[_0xae51('0x27')](respondWithResult(_0x16d9a4,null))[_0xae51('0xb4')](handleError(_0x16d9a4,null));};exports[_0xae51('0xbc')]=function(_0x550c50,_0xc53206,_0x21a55c){var _0x1021bf={'raw':![],'where':{}};var _0x2a7d40={};var _0x48d35a={'count':0x0,'rows':[]};return db[_0xae51('0x9a')][_0xae51('0xbd')]({'where':{'id':_0x550c50['params']['id']}})[_0xae51('0x27')](handleEntityNotFound(_0xc53206,null))[_0xae51('0x27')](function(_0x55fc25){if(_0x55fc25){_0x2a7d40[_0xae51('0x37')]=_[_0xae51('0x39')](db[_0xae51('0xb9')][_0xae51('0x35')]);_0x2a7d40[_0xae51('0x3c')]=_[_0xae51('0x39')](_0x550c50[_0xae51('0x3c')]);_0x2a7d40[_0xae51('0x3a')]=_[_0xae51('0x3b')](_0x2a7d40[_0xae51('0x37')],_0x2a7d40['query']);_0x1021bf[_0xae51('0x3e')]=_[_0xae51('0x3b')](_0x2a7d40[_0xae51('0x37')],qs[_0xae51('0x3d')](_0x550c50[_0xae51('0x3c')][_0xae51('0x3d')]));_0x1021bf['attributes']=_0x1021bf['attributes'][_0xae51('0x5d')]?_0x1021bf[_0xae51('0x3e')]:_0x2a7d40[_0xae51('0x37')];if(!_0x550c50[_0xae51('0x3c')][_0xae51('0x3f')](_0xae51('0x40'))){_0x1021bf[_0xae51('0x20')]=qs[_0xae51('0x20')](_0x550c50['query'][_0xae51('0x20')]);_0x1021bf['offset']=qs[_0xae51('0x1f')](_0x550c50[_0xae51('0x3c')][_0xae51('0x1f')]);}_0x1021bf['order']=qs[_0xae51('0x42')](_0x550c50['query']['sort']);_0x1021bf[_0xae51('0x76')]=qs[_0xae51('0x3a')](_[_0xae51('0x43')](_0x550c50[_0xae51('0x3c')],_0x2a7d40[_0xae51('0x3a')]));_0x1021bf[_0xae51('0x76')][_0xae51('0xad')]=_0x55fc25['id'];if(_0x550c50[_0xae51('0x3c')]['filter']){_0x1021bf[_0xae51('0x76')]=_['merge'](_0x1021bf[_0xae51('0x76')],{'$or':_['map'](_0x1021bf[_0xae51('0x3e')],function(_0x115c50){var _0x4cb185={};_0x4cb185[_0x115c50]={'$like':'%'+_0x550c50[_0xae51('0x3c')]['filter']+'%'};return _0x4cb185;})});}if(_0x550c50[_0xae51('0x3c')][_0xae51('0x7b')]){var _0x2bc072=_0x550c50['query'][_0xae51('0x7b')][_0xae51('0x31')](',');var _0x2c3175={};_0x2c3175[_0x2bc072[0x0]]={'$gte':moment(_0x2bc072[0x1])[_0xae51('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1021bf[_0xae51('0x76')]=_[_0xae51('0x99')](_0x1021bf[_0xae51('0x76')],_0x2c3175);}_0x1021bf=_[_0xae51('0x99')]({},_0x1021bf,_0x550c50['options']);return db['FaxMessage'][_0xae51('0x1e')]({'where':_0x1021bf['where']})['then'](function(_0x3305dd){_0x48d35a[_0xae51('0x1e')]=_0x3305dd;if(_0x550c50[_0xae51('0x3c')][_0xae51('0xb2')]){_0x1021bf['include']=[{'all':!![]}];}return db['FaxMessage'][_0xae51('0xbf')](_0x1021bf);})['then'](function(_0x46b438){_0x48d35a[_0xae51('0xaf')]=_0x46b438;return _0x48d35a;});}})[_0xae51('0x27')](respondWithFilteredResult(_0xc53206,_0x1021bf))[_0xae51('0xb4')](handleError(_0xc53206,null));};exports['addTags']=function(_0x50dbf8,_0x3067ac,_0x9eab33){return db[_0xae51('0x9a')]['find']({'where':{'id':_0x50dbf8[_0xae51('0xb1')]['id']}})[_0xae51('0x27')](handleEntityNotFound(_0x3067ac,null))['then'](function(_0x270b59){if(_0x270b59){return _0x270b59[_0xae51('0xc0')](_0x50dbf8[_0xae51('0x72')][_0xae51('0xbb')],_[_0xae51('0xba')](_0x50dbf8['body'],[_0xae51('0xbb'),'id'])||{})['spread'](function(){return db['Tag'][_0xae51('0xbf')]({'attributes':['id',_0xae51('0x38'),_0xae51('0x46')],'where':{'id':_0x50dbf8[_0xae51('0x72')]['ids']}});})[_0xae51('0x27')](function(_0x53df04){socket['emit'](_0xae51('0xc1'),{'id':Number(_0x50dbf8[_0xae51('0xb1')]['id']),'tags':_0x53df04||[]});return{'id':Number(_0x50dbf8[_0xae51('0xb1')]['id']),'tags':_0x53df04||[]};});}})[_0xae51('0x27')](respondWithResult(_0x3067ac,null))[_0xae51('0xb4')](handleError(_0x3067ac,null));};exports[_0xae51('0xc2')]=function(_0x423a74,_0x1f7e31,_0x1a9276){return db[_0xae51('0x9a')][_0xae51('0x67')]({'where':{'id':_0x423a74['params']['id']}})[_0xae51('0x27')](handleEntityNotFound(_0x1f7e31,null))['then'](function(_0x5274ae){if(_0x5274ae){return _0x5274ae[_0xae51('0xc2')](_0x423a74[_0xae51('0x3c')][_0xae51('0xbb')]);}})[_0xae51('0x27')](respondWithStatusCode(_0x1f7e31,null))['catch'](handleError(_0x1f7e31,null));};exports[_0xae51('0xc3')]=function(_0x2734a6,_0x4aeea1){var _0x1a9cae=moment()[_0xae51('0xc4')]()[_0xae51('0xaa')]();var _0x2b61d1=path[_0xae51('0xc5')](config[_0xae51('0xc6')],'server',_0xae51('0xc7'),'tmp');var _0x14a8ce=path[_0xae51('0xc5')](config[_0xae51('0xc6')],_0xae51('0xc8'),_0xae51('0xc7'),_0xae51('0xc9'));var _0x5e3ee7=path[_0xae51('0xc5')](_0x2b61d1,_0x1a9cae);var _0x1098e1=util[_0xae51('0xbe')]('transcript-%d-%s.zip',_0x2734a6[_0xae51('0xb1')]['id'],_0x1a9cae);var _0x38d58e=path[_0xae51('0xc5')](_0x2b61d1,_0x1098e1);var _0x4325c9=[];_0x4325c9[_0xae51('0x33')]({'model':db[_0xae51('0xca')],'as':'Attachment','raw':!![]});var _0x383d2d=[{'model':db[_0xae51('0xb9')],'as':'Messages','attributes':['id','body',_0xae51('0x79')],'include':_0x4325c9}];return db['FaxInteraction'][_0xae51('0x67')]({'where':{'id':_0x2734a6[_0xae51('0xb1')]['id']},'include':_0x383d2d})[_0xae51('0x27')](handleEntityNotFound(_0x4aeea1,null))[_0xae51('0x27')](function(_0x519a88){if(_0x519a88&&_0x519a88[_0xae51('0xcb')]){var _0x1f812f=_0x519a88[_0xae51('0xcc')]({'plain':!![]});fs[_0xae51('0xcd')](_0x5e3ee7);for(var _0x4fd603=0x0;_0x4fd603<_0x1f812f[_0xae51('0xcb')][_0xae51('0x5d')];_0x4fd603++){var _0x1cab9e=_0x1f812f[_0xae51('0xcb')][_0x4fd603][_0xae51('0xca')];if(_0x1cab9e){var _0x5292db=path[_0xae51('0xc5')](_0x14a8ce,_0x1cab9e['basename']);if(fs[_0xae51('0xce')](_0x5292db)){fs['createReadStream'](_0x5292db)[_0xae51('0xcf')](fs[_0xae51('0xd0')](path[_0xae51('0xc5')](_0x5e3ee7,_0x1cab9e[_0xae51('0xd1')])));}}}return BPromise['resolve']()[_0xae51('0x27')](function(){return new BPromise(function(_0x437926,_0xb5aa55){zipdir(_0x5e3ee7,{'saveTo':_0x38d58e},function(_0x4d2cf2,_0x1dcacd){if(_0x4d2cf2)return _0xb5aa55(_0x4d2cf2);return _0x437926(_0x1dcacd);});})[_0xae51('0x27')](function(){return new BPromise(function(_0x107760,_0x585ce5){rimraf(_0x5e3ee7,function(_0x22c8b6){if(_0x22c8b6)_0x585ce5(_0x22c8b6);return _0x107760();});});})['then'](function(){return _0x4aeea1['download'](_0x38d58e,_0x1098e1,function(_0x14c813){if(_0x14c813){console[_0xae51('0xd2')](_0xae51('0xd3'),_0x14c813);}else{fs['unlinkSync'](_0x38d58e);}});});});}else{return _0x4aeea1['sendStatus'](0xc8);}})[_0xae51('0xb4')](handleError(_0x4aeea1,null));}; \ No newline at end of file +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 diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 23199a7..4b06859 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 _0x814b=['then','Users','map','findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove'];(function(_0x2c887d,_0x469d38){var _0x3e4cc3=function(_0x588130){while(--_0x588130){_0x2c887d['push'](_0x2c887d['shift']());}};_0x3e4cc3(++_0x469d38);}(_0x814b,0x1a2));var _0xb814=function(_0x390a19,_0x5dd137){_0x390a19=_0x390a19-0x0;var _0x5d8230=_0x814b[_0x390a19];return _0x5d8230;};'use strict';var EventEmitter=require(_0xb814('0x0'));var FaxInteraction=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var FaxMessage=require(_0xb814('0x1'))['db'][_0xb814('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xb814('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb814('0x5'),'afterDestroy':_0xb814('0x6')};function emitEvent(_0x258866){return function(_0x4237bc,_0x44931c,_0x322a70){_0x4237bc['getUsers']({'attributes':['id'],'raw':!![]})[_0xb814('0x7')](function(_0x2e6272){_0x4237bc['setDataValue'](_0xb814('0x8'),_0x2e6272[_0xb814('0x9')](function(_0x186d5a){return{'id':_0x186d5a['id']};}));return FaxMessage[_0xb814('0xa')]({'where':{'FaxInteractionId':_0x4237bc['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb814('0x7')](function(_0x21d4a5){_0x4237bc[_0xb814('0xb')](_0xb814('0xc'),_0x21d4a5[_0xb814('0xd')]);FaxInteractionEvents[_0xb814('0xe')](_0x258866+':'+_0x4237bc['id'],_0x4237bc);FaxInteractionEvents[_0xb814('0xe')](_0x258866,_0x4237bc);_0x322a70(null);})['catch'](_0x322a70(null));};}for(var e in events){if(events[_0xb814('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xb814('0x10')]=FaxInteractionEvents; \ No newline at end of file +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 diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 96f3dfe..bb8676b 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 _0x2006=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x820843,_0x4b6f7e){var _0x2077c2=function(_0x26e103){while(--_0x26e103){_0x820843['push'](_0x820843['shift']());}};_0x2077c2(++_0x4b6f7e);}(_0x2006,0x1b2));var _0x6200=function(_0x4d215e,_0x440b14){_0x4d215e=_0x4d215e-0x0;var _0x49432c=_0x2006[_0x4d215e];return _0x49432c;};'use strict';var _=require(_0x6200('0x0'));var util=require('util');var logger=require(_0x6200('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6200('0x2'));var rp=require(_0x6200('0x3'));var fs=require('fs');var path=require(_0x6200('0x4'));var rimraf=require(_0x6200('0x5'));var config=require(_0x6200('0x6'));var attributes=require(_0x6200('0x7'));module[_0x6200('0x8')]=function(_0x582733,_0x411086){return _0x582733[_0x6200('0x9')](_0x6200('0xa'),attributes,{'tableName':_0x6200('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x26b1e1,_0x576924,_0x56559f){if(_0x26b1e1['changed'](_0x6200('0xc'))){_0x26b1e1[_0x6200('0xd')]=moment()['format'](_0x6200('0xe'));}_0x56559f(null,_0x26b1e1);}}});}; \ No newline at end of file +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 diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 636c4c9..cf68ff9 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 _0x99cd=['register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FaxInteraction','body','options','raw','UpdateFaxInteraction','AddTagsToFaxInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxInteraction.socket'];(function(_0x367af8,_0x250c8e){var _0x47a4ca=function(_0x293df4){while(--_0x293df4){_0x367af8['push'](_0x367af8['shift']());}};_0x47a4ca(++_0x250c8e);}(_0x99cd,0x139));var _0xd99c=function(_0x5612bd,_0x449e96){_0x5612bd=_0x5612bd-0x0;var _0x3e9337=_0x99cd[_0x5612bd];return _0x3e9337;};'use strict';var _=require(_0xd99c('0x0'));var util=require('util');var moment=require(_0xd99c('0x1'));var BPromise=require(_0xd99c('0x2'));var rs=require(_0xd99c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd99c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd99c('0x5'))(_0xd99c('0x6'));var config=require(_0xd99c('0x7'));var jayson=require(_0xd99c('0x8'));var client=jayson[_0xd99c('0x9')][_0xd99c('0xa')]({'port':0x232a});config[_0xd99c('0xb')]=_[_0xd99c('0xc')](config[_0xd99c('0xb')],{'host':_0xd99c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd99c('0xb')]));require(_0xd99c('0xe'))[_0xd99c('0xf')](socket);function respondWithRpcPromise(_0x434963,_0x275739,_0x30ff86){return new BPromise(function(_0x541fa9,_0x2ce01b){return client[_0xd99c('0x10')](_0x434963,_0x30ff86)[_0xd99c('0x11')](function(_0x4ad344){logger[_0xd99c('0x12')](_0xd99c('0x13'),_0x275739,_0xd99c('0x14'));logger[_0xd99c('0x15')](_0xd99c('0x16'),_0x275739,_0xd99c('0x14'),JSON[_0xd99c('0x17')](_0x4ad344));if(_0x4ad344['error']){if(_0x4ad344[_0xd99c('0x18')][_0xd99c('0x19')]===0x1f4){logger[_0xd99c('0x18')](_0xd99c('0x13'),_0x275739,_0x4ad344[_0xd99c('0x18')]['message']);return _0x2ce01b(_0x4ad344[_0xd99c('0x18')][_0xd99c('0x1a')]);}logger[_0xd99c('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x275739,_0x4ad344[_0xd99c('0x18')][_0xd99c('0x1a')]);return _0x541fa9(_0x4ad344[_0xd99c('0x18')][_0xd99c('0x1a')]);}else{logger[_0xd99c('0x12')](_0xd99c('0x13'),_0x275739,_0xd99c('0x14'));_0x541fa9(_0x4ad344[_0xd99c('0x1b')][_0xd99c('0x1a')]);}})[_0xd99c('0x1c')](function(_0x1317cb){logger[_0xd99c('0x18')](_0xd99c('0x13'),_0x275739,_0x1317cb);_0x2ce01b(_0x1317cb);});});}exports['UpdateFaxInteraction']=function(_0x21e78a){var _0x198713=this;return new Promise(function(_0x1876e0,_0x3e091b){return db[_0xd99c('0x1d')]['update'](_0x21e78a[_0xd99c('0x1e')],{'raw':_0x21e78a[_0xd99c('0x1f')]?_0x21e78a[_0xd99c('0x1f')][_0xd99c('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21e78a[_0xd99c('0x1f')]?_0x21e78a['options']['where']||null:null,'attributes':_0x21e78a[_0xd99c('0x1f')]?_0x21e78a[_0xd99c('0x1f')]['attributes']||null:null,'limit':_0x21e78a['options']?_0x21e78a[_0xd99c('0x1f')]['limit']||null:null})['then'](function(_0x1563ff){logger[_0xd99c('0x12')]('UpdateFaxInteraction',_0x21e78a);logger[_0xd99c('0x15')](_0xd99c('0x21'),_0x21e78a,JSON[_0xd99c('0x17')](_0x1563ff));_0x1876e0(_0x1563ff);})[_0xd99c('0x1c')](function(_0xec3ef6){logger[_0xd99c('0x18')]('UpdateFaxInteraction',_0xec3ef6[_0xd99c('0x1a')],_0x21e78a);_0x3e091b(_0x198713[_0xd99c('0x18')](0x1f4,_0xec3ef6[_0xd99c('0x1a')]));});});};exports[_0xd99c('0x22')]=function(_0x119953){return new Promise(function(_0xc0591b,_0x1856d4){return db[_0xd99c('0x1d')][_0xd99c('0x23')]({'where':_0x119953[_0xd99c('0x1f')]?_0x119953['options']['where']||null:null})[_0xd99c('0x11')](function(_0x3a037f){if(_0x3a037f){return _0x3a037f[_0xd99c('0x24')](_0x119953[_0xd99c('0x1e')][_0xd99c('0x25')],_[_0xd99c('0x26')](_0x119953['body'],[_0xd99c('0x25'),'id'])||{});}})[_0xd99c('0x27')](function(_0x424eb6){logger[_0xd99c('0x12')]('AddTags',_0x119953);logger[_0xd99c('0x15')](_0xd99c('0x28'),_0x119953,JSON[_0xd99c('0x17')](_0x424eb6));_0xc0591b(_0x424eb6);})['catch'](function(_0x2bc15a){logger[_0xd99c('0x18')](_0xd99c('0x28'),_0x2bc15a[_0xd99c('0x1a')],_0x119953);_0x1856d4(_this[_0xd99c('0x18')](0x1f4,_0x2bc15a[_0xd99c('0x1a')]));});});}; \ No newline at end of file +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 diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index d3f30b0..3be46a1 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 _0xa7ac=['update','emit','removeListener','register','length','faxInteraction:','./faxInteraction.events'];(function(_0x1a67b1,_0x5f2342){var _0x2939a6=function(_0x5c2a7d){while(--_0x5c2a7d){_0x1a67b1['push'](_0x1a67b1['shift']());}};_0x2939a6(++_0x5f2342);}(_0xa7ac,0x1aa));var _0xca7a=function(_0x392115,_0x5323fb){_0x392115=_0x392115-0x0;var _0x3120a7=_0xa7ac[_0x392115];return _0x3120a7;};'use strict';var FaxInteractionEvents=require(_0xca7a('0x0'));var events=['save','remove',_0xca7a('0x1')];function createListener(_0x4b3fad,_0x3bb4c1){return function(_0xc0a043){_0x3bb4c1[_0xca7a('0x2')](_0x4b3fad,_0xc0a043);};}function removeListener(_0x51bee9,_0x3e53eb){return function(){FaxInteractionEvents[_0xca7a('0x3')](_0x51bee9,_0x3e53eb);};}exports[_0xca7a('0x4')]=function(_0x7e116a){for(var _0x711218=0x0,_0x8269ff=events[_0xca7a('0x5')];_0x711218<_0x8269ff;_0x711218++){var _0xcf8844=events[_0x711218];var _0x33d0e0=createListener(_0xca7a('0x6')+_0xcf8844,_0x7e116a);FaxInteractionEvents['on'](_0xcf8844,_0x33d0e0);}}; \ No newline at end of file +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 diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 94deea5..a876dc1 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 _0xf6a7=['delete','faxinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update'];(function(_0x3744cb,_0x38ac7b){var _0x5759ce=function(_0x5eb1e0){while(--_0x5eb1e0){_0x3744cb['push'](_0x3744cb['shift']());}};_0x5759ce(++_0x38ac7b);}(_0xf6a7,0xa1));var _0x7f6a=function(_0x2735d3,_0xcad490){_0x2735d3=_0x2735d3-0x0;var _0x2f3277=_0xf6a7[_0x2735d3];return _0x2f3277;};'use strict';var multer=require(_0x7f6a('0x0'));var util=require('util');var path=require(_0x7f6a('0x1'));var timeout=require(_0x7f6a('0x2'));var express=require(_0x7f6a('0x3'));var router=express[_0x7f6a('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x7f6a('0x5'));var config=require('../../config/environment');var controller=require(_0x7f6a('0x6'));router[_0x7f6a('0x7')]('/',auth[_0x7f6a('0x8')](),controller[_0x7f6a('0x9')]);router['get'](_0x7f6a('0xa'),auth[_0x7f6a('0x8')](),controller[_0x7f6a('0xb')]);router[_0x7f6a('0x7')](_0x7f6a('0xc'),auth[_0x7f6a('0x8')](),controller[_0x7f6a('0xd')]);router[_0x7f6a('0x7')](_0x7f6a('0xe'),auth[_0x7f6a('0x8')](),controller[_0x7f6a('0xf')]);router[_0x7f6a('0x7')](_0x7f6a('0x10'),auth['isAuthenticated'](),controller[_0x7f6a('0x11')]);router['post']('/',auth[_0x7f6a('0x8')](),controller['create']);router['post']('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router['post']('/:id/tags',auth['isAuthenticated'](),interaction[_0x7f6a('0x12')](_0x7f6a('0x13'),_0x7f6a('0x14')),controller[_0x7f6a('0x15')]);router[_0x7f6a('0x16')]('/:id',auth[_0x7f6a('0x8')](),interaction['tracked'](_0x7f6a('0x13'),_0x7f6a('0x17')),controller[_0x7f6a('0x18')]);router[_0x7f6a('0x19')]('/:id',auth[_0x7f6a('0x8')](),interaction[_0x7f6a('0x12')](_0x7f6a('0x13'),_0x7f6a('0x1a')),controller[_0x7f6a('0x1b')]);router[_0x7f6a('0x19')](_0x7f6a('0x1c'),auth['isAuthenticated'](),controller[_0x7f6a('0x1d')]);module[_0x7f6a('0x1e')]=router; \ No newline at end of file +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 diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index bff915c..a249241 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 _0x3e56=['ENUM','out','sequelize','exports','TEXT','BOOLEAN'];(function(_0xd3731e,_0x585f12){var _0x3befaa=function(_0x5b9901){while(--_0x5b9901){_0xd3731e['push'](_0xd3731e['shift']());}};_0x3befaa(++_0x585f12);}(_0x3e56,0x1a6));var _0x63e5=function(_0x44dba1,_0x270ad5){_0x44dba1=_0x44dba1-0x0;var _0x2fbd3f=_0x3e56[_0x44dba1];return _0x2fbd3f;};'use strict';var Sequelize=require(_0x63e5('0x0'));module[_0x63e5('0x1')]={'body':{'type':Sequelize[_0x63e5('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x63e5('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x63e5('0x4')]('in',_0x63e5('0x5')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x63e5('0x2')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +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 diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 210f5b4..09b7fc2 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(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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(_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 diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 3bc3f04..71826d2 100644 --- a/server/api/faxMessage/faxMessage.events.js +++ b/server/api/faxMessage/faxMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['emit','hasOwnProperty','hook','exports','events','FaxMessage','setMaxListeners','save','update','remove'];(function(_0x48cb1f,_0x5ca68d){var _0x172c4d=function(_0x85040){while(--_0x85040){_0x48cb1f['push'](_0x48cb1f['shift']());}};_0x172c4d(++_0x5ca68d);}(_0x7217,0x19e));var _0x7721=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x7217[_0x25bea7];return _0x175952;};'use strict';var EventEmitter=require(_0x7721('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x7721('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){FaxMessageEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);FaxMessageEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];FaxMessage[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=FaxMessageEvents; \ No newline at end of file +var _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 diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 7676079..0c6fa6a 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 _0xad81=['./faxMessage.attributes','exports','define','body','FULLTEXT','get','direction','toLowerCase','secret','isNil','findOne','FaxInteractionId','then','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x125168,_0x447216){var _0x275df1=function(_0x46a0c2){while(--_0x46a0c2){_0x125168['push'](_0x125168['shift']());}};_0x275df1(++_0x447216);}(_0xad81,0x1dc));var _0x1ad8=function(_0x4114dd,_0x2ad862){_0x4114dd=_0x4114dd-0x0;var _0x26f44c=_0xad81[_0x4114dd];return _0x26f44c;};'use strict';var _=require(_0x1ad8('0x0'));var util=require('util');var logger=require(_0x1ad8('0x1'))(_0x1ad8('0x2'));var moment=require('moment');var BPromise=require(_0x1ad8('0x3'));var rp=require(_0x1ad8('0x4'));var fs=require('fs');var path=require(_0x1ad8('0x5'));var rimraf=require(_0x1ad8('0x6'));var config=require('../../config/environment');var attributes=require(_0x1ad8('0x7'));module[_0x1ad8('0x8')]=function(_0x342b88,_0x4d388f){return _0x342b88[_0x1ad8('0x9')]('FaxMessage',attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x1ad8('0xa')],'type':_0x1ad8('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x40b529,_0x37c4cb,_0xfbb668){var _0x31b256=_0x342b88['models'];var _0x21ded4=_0x40b529[_0x1ad8('0xc')]({'plain':!![]});if(_0x21ded4[_0x1ad8('0xd')][_0x1ad8('0xe')]()==='in'||_0x21ded4[_0x1ad8('0xd')][_0x1ad8('0xe')]()==='out'&&!_0x21ded4[_0x1ad8('0xf')]&&!_[_0x1ad8('0x10')](_0x21ded4['UserId'])){_0x31b256['FaxInteraction'][_0x1ad8('0x11')]({'where':{'id':_0x21ded4[_0x1ad8('0x12')]}})[_0x1ad8('0x13')](function(_0x1fc353){if(_0x1fc353){_0x1fc353['update']({'lastMsgAt':_0x21ded4['createdAt'],'lastMsgDirection':_0x21ded4[_0x1ad8('0xd')][_0x1ad8('0xe')]()});}})['catch'](function(_0x1e8b9b){console[_0x1ad8('0x14')](_0x1e8b9b);});}_0xfbb668();}},'charset':_0x1ad8('0x15'),'collate':_0x1ad8('0x16')});}; \ No newline at end of file +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 diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 64186bf..e47a1aa 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 _0x9d29=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','FaxMessage','create','body','options','CreateFaxMessage','UpdateFaxMessage','update','raw','where','attributes','stringify','lodash','util','moment'];(function(_0x15f234,_0x51af00){var _0x15e30f=function(_0x3484ca){while(--_0x3484ca){_0x15f234['push'](_0x15f234['shift']());}};_0x15e30f(++_0x51af00);}(_0x9d29,0xa1));var _0x99d2=function(_0x420c44,_0x11af5b){_0x420c44=_0x420c44-0x0;var _0x138afb=_0x9d29[_0x420c44];return _0x138afb;};'use strict';var _=require(_0x99d2('0x0'));var util=require(_0x99d2('0x1'));var moment=require(_0x99d2('0x2'));var BPromise=require(_0x99d2('0x3'));var rs=require(_0x99d2('0x4'));var fs=require('fs');var Redis=require(_0x99d2('0x5'));var db=require(_0x99d2('0x6'))['db'];var utils=require(_0x99d2('0x7'));var logger=require(_0x99d2('0x8'))('rpc');var config=require(_0x99d2('0x9'));var jayson=require(_0x99d2('0xa'));var client=jayson[_0x99d2('0xb')][_0x99d2('0xc')]({'port':0x232a});config[_0x99d2('0xd')]=_[_0x99d2('0xe')](config[_0x99d2('0xd')],{'host':_0x99d2('0xf'),'port':0x18eb});var socket=require(_0x99d2('0x10'))(new Redis(config[_0x99d2('0xd')]));require(_0x99d2('0x11'))[_0x99d2('0x12')](socket);function respondWithRpcPromise(_0x706f36,_0x1bef70,_0x526377){return new BPromise(function(_0x1e351b,_0x2ddbf1){return client['request'](_0x706f36,_0x526377)[_0x99d2('0x13')](function(_0x470251){logger[_0x99d2('0x14')]('FaxMessage,\x20%s,\x20%s',_0x1bef70,_0x99d2('0x15'));logger[_0x99d2('0x16')](_0x99d2('0x17'),_0x1bef70,_0x99d2('0x15'),JSON['stringify'](_0x470251));if(_0x470251[_0x99d2('0x18')]){if(_0x470251[_0x99d2('0x18')][_0x99d2('0x19')]===0x1f4){logger[_0x99d2('0x18')](_0x99d2('0x1a'),_0x1bef70,_0x470251[_0x99d2('0x18')][_0x99d2('0x1b')]);return _0x2ddbf1(_0x470251[_0x99d2('0x18')][_0x99d2('0x1b')]);}logger[_0x99d2('0x18')](_0x99d2('0x1a'),_0x1bef70,_0x470251[_0x99d2('0x18')][_0x99d2('0x1b')]);return _0x1e351b(_0x470251[_0x99d2('0x18')]['message']);}else{logger['info'](_0x99d2('0x1a'),_0x1bef70,'request\x20sent');_0x1e351b(_0x470251[_0x99d2('0x1c')][_0x99d2('0x1b')]);}})[_0x99d2('0x1d')](function(_0x21f3e6){logger[_0x99d2('0x18')]('FaxMessage,\x20%s,\x20%s',_0x1bef70,_0x21f3e6);_0x2ddbf1(_0x21f3e6);});});}exports['CreateFaxMessage']=function(_0x5b5e7f){var _0x38cd29=this;return new Promise(function(_0x4ae814,_0x5c97d5){return db[_0x99d2('0x1e')][_0x99d2('0x1f')](_0x5b5e7f[_0x99d2('0x20')],{'raw':_0x5b5e7f[_0x99d2('0x21')]?_0x5b5e7f[_0x99d2('0x21')]['raw']===undefined?!![]:![]:!![]})[_0x99d2('0x13')](function(_0x57c814){logger['info'](_0x99d2('0x22'),_0x5b5e7f);logger[_0x99d2('0x16')]('CreateFaxMessage',_0x5b5e7f,JSON['stringify'](_0x57c814));_0x4ae814(_0x57c814);})[_0x99d2('0x1d')](function(_0x3efb07){logger['error'](_0x99d2('0x22'),_0x3efb07[_0x99d2('0x1b')],_0x5b5e7f);_0x5c97d5(_0x38cd29[_0x99d2('0x18')](0x1f4,_0x3efb07['message']));});});};exports[_0x99d2('0x23')]=function(_0x2d7329){var _0x253cd0=this;return new Promise(function(_0x4894ab,_0x130ca8){return db['FaxMessage'][_0x99d2('0x24')](_0x2d7329[_0x99d2('0x20')],{'raw':_0x2d7329['options']?_0x2d7329['options'][_0x99d2('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d7329[_0x99d2('0x21')]?_0x2d7329[_0x99d2('0x21')][_0x99d2('0x26')]||null:null,'attributes':_0x2d7329[_0x99d2('0x21')]?_0x2d7329[_0x99d2('0x21')][_0x99d2('0x27')]||null:null,'limit':_0x2d7329['options']?_0x2d7329[_0x99d2('0x21')]['limit']||null:null})[_0x99d2('0x13')](function(_0x50211e){logger[_0x99d2('0x14')](_0x99d2('0x23'),_0x2d7329);logger[_0x99d2('0x16')](_0x99d2('0x23'),_0x2d7329,JSON[_0x99d2('0x28')](_0x50211e));_0x4894ab(_0x50211e);})[_0x99d2('0x1d')](function(_0x4838cd){logger['error']('UpdateFaxMessage',_0x4838cd[_0x99d2('0x1b')],_0x2d7329);_0x130ca8(_0x253cd0[_0x99d2('0x18')](0x1f4,_0x4838cd['message']));});});}; \ No newline at end of file +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 diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 5e68b7d..794834a 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var FaxMessageEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){FaxMessageEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);FaxMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_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 diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index a7739a6..c4afba8 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 _0x4210=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','index','describe','/:id','isAuthenticated','download','tracked','fax','faxmessage:create','create','update','accept','put','reject','delete','destroy','multer','util','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4210,0x7a));var _0x0421=function(_0x4c6ca4,_0x1584df){_0x4c6ca4=_0x4c6ca4-0x0;var _0x266e65=_0x4210[_0x4c6ca4];return _0x266e65;};'use strict';var multer=require(_0x0421('0x0'));var util=require(_0x0421('0x1'));var path=require(_0x0421('0x2'));var timeout=require(_0x0421('0x3'));var express=require(_0x0421('0x4'));var router=express[_0x0421('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x0421('0x6'));var config=require(_0x0421('0x7'));var controller=require(_0x0421('0x8'));router[_0x0421('0x9')]('/',auth['isAuthenticated'](),controller[_0x0421('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x0421('0xb')]);router['get'](_0x0421('0xc'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/download',auth[_0x0421('0xd')](),controller[_0x0421('0xe')]);router['post']('/',auth[_0x0421('0xd')](),interaction[_0x0421('0xf')](_0x0421('0x10'),_0x0421('0x11')),controller[_0x0421('0x12')]);router['put'](_0x0421('0xc'),auth[_0x0421('0xd')](),controller[_0x0421('0x13')]);router['put']('/:id/accept',auth[_0x0421('0xd')](),controller[_0x0421('0x14')]);router[_0x0421('0x15')]('/:id/reject',auth['isAuthenticated'](),controller[_0x0421('0x16')]);router[_0x0421('0x17')](_0x0421('0xc'),auth['isAuthenticated'](),controller[_0x0421('0x18')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index a6c373c..a000374 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 _0x8a2a=['beepall','exports','name','STRING','INTEGER','ENUM','rrmemory'];(function(_0x7ab1fb,_0x39b5de){var _0x7de024=function(_0x28fe4f){while(--_0x28fe4f){_0x7ab1fb['push'](_0x7ab1fb['shift']());}};_0x7de024(++_0x39b5de);}(_0x8a2a,0x8d));var _0xa8a2=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0x8a2a[_0x163040];return _0x364667;};'use strict';var Sequelize=require('sequelize');module[_0xa8a2('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xa8a2('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa8a2('0x2')]},'timeout':{'type':Sequelize[_0xa8a2('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa8a2('0x4')](_0xa8a2('0x5'),_0xa8a2('0x6'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xa8a2('0x3')],'defaultValue':0x0}}; \ No newline at end of file +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 diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 224dbf3..41f3c4b 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 _0xcae2=['Team','Agents','online','voicePause','flatMap','transaction','each','findOrCreate','removeTeams','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','includes','all','compact','isEmpty','removeAgents','forEach','emit','userFaxQueue:remove','addAgents','omit','spread','userFaxQueue:save','isArray','getAgents','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','sendStatus','status','end','count','limit','set','Content-Range','json','reject','save','update','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','send','index','map','FaxQueue','fieldName','type','key','model','keys','query','attributes','fields','length','nolimit','offset','sort','where','filters','merge','VIRTUAL','filter','options','rows','catch','show','rawAttributes','intersection','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','params','describe','getMembers','UserFaxQueue','order','pick','FaxQueueId','findAll','User','UserId','agent','faxPause','updatedAt','createdAt','SIP','getTeams','hasOwnProperty','addTeams','ids'];(function(_0x5ed74a,_0x1f22fa){var _0x2bbc2b=function(_0x3e434f){while(--_0x3e434f){_0x5ed74a['push'](_0x5ed74a['shift']());}};_0x2bbc2b(++_0x1f22fa);}(_0xcae2,0x143));var _0x2cae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcae2[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x2cae('0x0'));var emlformat=require(_0x2cae('0x1'));var rimraf=require(_0x2cae('0x2'));var zipdir=require(_0x2cae('0x3'));var jsonpatch=require(_0x2cae('0x4'));var rp=require(_0x2cae('0x5'));var moment=require(_0x2cae('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x2cae('0x7'));var util=require(_0x2cae('0x8'));var path=require(_0x2cae('0x9'));var sox=require(_0x2cae('0xa'));var csv=require('to-csv');var ejs=require(_0x2cae('0xb'));var fs=require('fs');var _=require(_0x2cae('0xc'));var squel=require(_0x2cae('0xd'));var crypto=require(_0x2cae('0xe'));var jsforce=require(_0x2cae('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2cae('0x10'));var authService=require(_0x2cae('0x11'));var qs=require(_0x2cae('0x12'));var as=require(_0x2cae('0x13'));var hardwareService=require(_0x2cae('0x14'));var logger=require(_0x2cae('0x15'))('api');var utils=require(_0x2cae('0x16'));var config=require('../../config/environment');var db=require(_0x2cae('0x17'))['db'];config[_0x2cae('0x18')]=_[_0x2cae('0x19')](config[_0x2cae('0x18')],{'host':_0x2cae('0x1a'),'port':0x18eb});var socket=require(_0x2cae('0x1b'))(new Redis(config['redis']));require(_0x2cae('0x1c'))['register'](socket);function respondWithStatusCode(_0x42f393,_0x13c76f){_0x13c76f=_0x13c76f||0xcc;return function(_0x51d416){if(_0x51d416){return _0x42f393[_0x2cae('0x1d')](_0x13c76f);}return _0x42f393[_0x2cae('0x1e')](_0x13c76f)[_0x2cae('0x1f')]();};}function respondWithResult(_0x7e2228,_0x5ede26){_0x5ede26=_0x5ede26||0xc8;return function(_0x3fda2f){if(_0x3fda2f){return _0x7e2228[_0x2cae('0x1e')](_0x5ede26)['json'](_0x3fda2f);}};}function respondWithFilteredResult(_0x5a6184,_0x235286){return function(_0x1788a3){if(_0x1788a3){var _0xe6314f=_0x1788a3[_0x2cae('0x20')],_0x2813b1=_0x235286['offset'],_0x164aee=_0x235286['offset']+_0x235286[_0x2cae('0x21')],_0x398290;if(_0x164aee>=_0xe6314f){_0x164aee=_0xe6314f;_0x398290=0xc8;}else{_0x398290=0xce;}_0x5a6184[_0x2cae('0x1e')](_0x398290);return _0x5a6184[_0x2cae('0x22')](_0x2cae('0x23'),_0x2813b1+'-'+_0x164aee+'/'+_0xe6314f)[_0x2cae('0x24')](_0x1788a3);}return null;};}function patchUpdates(_0x420159){return function(_0x40872e){try{jsonpatch['apply'](_0x40872e,_0x420159,!![]);}catch(_0x4bc93c){return BPromise[_0x2cae('0x25')](_0x4bc93c);}return _0x40872e[_0x2cae('0x26')]();};}function saveUpdates(_0x5d800e,_0x4b2f85){return function(_0x48f0f5){if(_0x48f0f5){return _0x48f0f5[_0x2cae('0x27')](_0x5d800e)[_0x2cae('0x28')](function(_0x4ced40){return _0x4ced40;});}return null;};}function removeEntity(_0x555914,_0x309ae3){return function(_0x1c8063){if(_0x1c8063){return _0x1c8063[_0x2cae('0x29')]()[_0x2cae('0x28')](function(){var _0x4049d5=_0x1c8063[_0x2cae('0x2a')]({'plain':!![]});var _0x11413f=_0x2cae('0x2b');return db[_0x2cae('0x2c')][_0x2cae('0x29')]({'where':{'type':_0x11413f,'resourceId':_0x4049d5['id']}})[_0x2cae('0x28')](function(){return _0x1c8063;});})[_0x2cae('0x28')](function(){_0x555914[_0x2cae('0x1e')](0xcc)[_0x2cae('0x1f')]();});}};}function handleEntityNotFound(_0x3422bb,_0x2d8e66){return function(_0x564892){if(!_0x564892){_0x3422bb['sendStatus'](0x194);}return _0x564892;};}function handleError(_0x56bedb,_0x5afca5){_0x5afca5=_0x5afca5||0x1f4;return function(_0x7d5421){logger[_0x2cae('0x2d')](_0x7d5421[_0x2cae('0x2e')]);if(_0x7d5421[_0x2cae('0x2f')]){delete _0x7d5421['name'];}_0x56bedb[_0x2cae('0x1e')](_0x5afca5)[_0x2cae('0x30')](_0x7d5421);};}exports[_0x2cae('0x31')]=function(_0x5d1fc8,_0x2db662){var _0x5cdbac={},_0x3dfde5={},_0x594c4f={'count':0x0,'rows':[]};var _0x47a256=_[_0x2cae('0x32')](db[_0x2cae('0x33')]['rawAttributes'],function(_0x335345){return{'name':_0x335345[_0x2cae('0x34')],'type':_0x335345[_0x2cae('0x35')][_0x2cae('0x36')]};});_0x3dfde5[_0x2cae('0x37')]=_[_0x2cae('0x32')](_0x47a256,'name');_0x3dfde5['query']=_[_0x2cae('0x38')](_0x5d1fc8[_0x2cae('0x39')]);_0x3dfde5['filters']=_['intersection'](_0x3dfde5['model'],_0x3dfde5[_0x2cae('0x39')]);_0x5cdbac[_0x2cae('0x3a')]=_['intersection'](_0x3dfde5['model'],qs['fields'](_0x5d1fc8[_0x2cae('0x39')][_0x2cae('0x3b')]));_0x5cdbac[_0x2cae('0x3a')]=_0x5cdbac[_0x2cae('0x3a')][_0x2cae('0x3c')]?_0x5cdbac['attributes']:_0x3dfde5[_0x2cae('0x37')];if(!_0x5d1fc8[_0x2cae('0x39')]['hasOwnProperty'](_0x2cae('0x3d'))){_0x5cdbac[_0x2cae('0x21')]=qs[_0x2cae('0x21')](_0x5d1fc8[_0x2cae('0x39')][_0x2cae('0x21')]);_0x5cdbac[_0x2cae('0x3e')]=qs['offset'](_0x5d1fc8[_0x2cae('0x39')][_0x2cae('0x3e')]);}_0x5cdbac['order']=qs[_0x2cae('0x3f')](_0x5d1fc8[_0x2cae('0x39')][_0x2cae('0x3f')]);_0x5cdbac[_0x2cae('0x40')]=qs[_0x2cae('0x41')](_['pick'](_0x5d1fc8['query'],_0x3dfde5[_0x2cae('0x41')]));if(_0x5d1fc8[_0x2cae('0x39')]['filter']){_0x5cdbac[_0x2cae('0x40')]=_[_0x2cae('0x42')](_0x5cdbac[_0x2cae('0x40')],{'$or':_[_0x2cae('0x32')](_0x47a256,function(_0x436ce5){if(_0x436ce5[_0x2cae('0x35')]!==_0x2cae('0x43')){var _0x504b47={};_0x504b47[_0x436ce5[_0x2cae('0x2f')]]={'$like':'%'+_0x5d1fc8[_0x2cae('0x39')][_0x2cae('0x44')]+'%'};return _0x504b47;}})});}_0x5cdbac=_[_0x2cae('0x42')]({},_0x5cdbac,_0x5d1fc8[_0x2cae('0x45')]);var _0x4c05ed={'where':_0x5cdbac['where']};return db[_0x2cae('0x33')][_0x2cae('0x20')](_0x4c05ed)[_0x2cae('0x28')](function(_0x45e00c){_0x594c4f['count']=_0x45e00c;if(_0x5d1fc8[_0x2cae('0x39')]['includeAll']){_0x5cdbac['include']=[{'all':!![]}];}return db[_0x2cae('0x33')]['findAll'](_0x5cdbac);})['then'](function(_0x261ee8){_0x594c4f[_0x2cae('0x46')]=_0x261ee8;return _0x594c4f;})[_0x2cae('0x28')](respondWithFilteredResult(_0x2db662,_0x5cdbac))[_0x2cae('0x47')](handleError(_0x2db662,null));};exports[_0x2cae('0x48')]=function(_0x3f1e74,_0x2a61b7){var _0x61e001={'raw':!![],'where':{'id':_0x3f1e74['params']['id']}},_0x4a21d4={};_0x4a21d4['model']=_[_0x2cae('0x38')](db['FaxQueue'][_0x2cae('0x49')]);_0x4a21d4['query']=_[_0x2cae('0x38')](_0x3f1e74['query']);_0x4a21d4[_0x2cae('0x41')]=_[_0x2cae('0x4a')](_0x4a21d4[_0x2cae('0x37')],_0x4a21d4[_0x2cae('0x39')]);_0x61e001[_0x2cae('0x3a')]=_[_0x2cae('0x4a')](_0x4a21d4[_0x2cae('0x37')],qs[_0x2cae('0x3b')](_0x3f1e74[_0x2cae('0x39')]['fields']));_0x61e001[_0x2cae('0x3a')]=_0x61e001['attributes']['length']?_0x61e001[_0x2cae('0x3a')]:_0x4a21d4[_0x2cae('0x37')];if(_0x3f1e74[_0x2cae('0x39')]['includeAll']){_0x61e001['include']=[{'all':!![]}];}_0x61e001=_[_0x2cae('0x42')]({},_0x61e001,_0x3f1e74[_0x2cae('0x45')]);return db[_0x2cae('0x33')][_0x2cae('0x4b')](_0x61e001)[_0x2cae('0x28')](handleEntityNotFound(_0x2a61b7,null))[_0x2cae('0x28')](respondWithResult(_0x2a61b7,null))[_0x2cae('0x47')](handleError(_0x2a61b7,null));};exports[_0x2cae('0x4c')]=function(_0x2cc6e4,_0x40e0ff){return db['FaxQueue'][_0x2cae('0x4c')](_0x2cc6e4[_0x2cae('0x4d')],{})['then'](function(_0x2e3761){var _0x48143d=_0x2cc6e4['user'][_0x2cae('0x2a')]({'plain':!![]});if(!_0x48143d)throw new Error(_0x2cae('0x4e'));if(_0x48143d[_0x2cae('0x4f')]===_0x2cae('0x50')){var _0x56777c=_0x2e3761[_0x2cae('0x2a')]({'plain':!![]});var _0x3ab2aa=_0x2cae('0x2b');return db[_0x2cae('0x51')][_0x2cae('0x4b')]({'where':{'name':_0x3ab2aa,'userProfileId':_0x48143d[_0x2cae('0x52')]},'raw':!![]})[_0x2cae('0x28')](function(_0x10bc21){if(_0x10bc21&&_0x10bc21[_0x2cae('0x53')]===0x0){return db[_0x2cae('0x2c')][_0x2cae('0x4c')]({'name':_0x56777c[_0x2cae('0x2f')],'resourceId':_0x56777c['id'],'type':_0x10bc21['name'],'sectionId':_0x10bc21['id']},{})[_0x2cae('0x28')](function(){return _0x2e3761;});}else{return _0x2e3761;}})[_0x2cae('0x47')](function(_0x2a607b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a607b);throw _0x2a607b;});}return _0x2e3761;})[_0x2cae('0x28')](respondWithResult(_0x40e0ff,0xc9))[_0x2cae('0x47')](handleError(_0x40e0ff,null));};exports['update']=function(_0x5cd9f7,_0x440608){if(_0x5cd9f7[_0x2cae('0x4d')]['id']){delete _0x5cd9f7[_0x2cae('0x4d')]['id'];}return db[_0x2cae('0x33')][_0x2cae('0x4b')]({'where':{'id':_0x5cd9f7['params']['id']}})[_0x2cae('0x28')](handleEntityNotFound(_0x440608,null))[_0x2cae('0x28')](saveUpdates(_0x5cd9f7[_0x2cae('0x4d')],null))[_0x2cae('0x28')](respondWithResult(_0x440608,null))[_0x2cae('0x47')](handleError(_0x440608,null));};exports[_0x2cae('0x29')]=function(_0x5da670,_0x4bbf22){return db[_0x2cae('0x33')][_0x2cae('0x4b')]({'where':{'id':_0x5da670[_0x2cae('0x54')]['id']}})[_0x2cae('0x28')](handleEntityNotFound(_0x4bbf22,null))[_0x2cae('0x28')](removeEntity(_0x4bbf22,null))[_0x2cae('0x47')](handleError(_0x4bbf22,null));};exports[_0x2cae('0x55')]=function(_0x2502f8,_0x500c0f){return db[_0x2cae('0x33')][_0x2cae('0x55')]()[_0x2cae('0x28')](respondWithResult(_0x500c0f,null))[_0x2cae('0x47')](handleError(_0x500c0f,null));};exports[_0x2cae('0x56')]=function(_0x46f0a5,_0x291d7b,_0x57bef1){var _0x4d06b5={'raw':!![],'where':{}},_0x138a9f={},_0x35474d;return db[_0x2cae('0x33')]['findOne']({'where':{'id':_0x46f0a5[_0x2cae('0x54')]['id']}})[_0x2cae('0x28')](handleEntityNotFound(_0x291d7b,null))[_0x2cae('0x28')](function(_0xad85ba){if(_0xad85ba){_0x35474d=_0xad85ba[_0x2cae('0x2a')]({'plain':!![]});_0x138a9f[_0x2cae('0x37')]=_[_0x2cae('0x38')](db[_0x2cae('0x57')][_0x2cae('0x49')]);_0x138a9f['query']=_[_0x2cae('0x38')](_0x46f0a5['query']);_0x138a9f[_0x2cae('0x41')]=_['intersection'](_0x138a9f[_0x2cae('0x37')],_0x138a9f[_0x2cae('0x39')]);_0x4d06b5[_0x2cae('0x3a')]=_[_0x2cae('0x4a')](_0x138a9f[_0x2cae('0x37')],qs[_0x2cae('0x3b')](_0x46f0a5[_0x2cae('0x39')][_0x2cae('0x3b')]));_0x4d06b5[_0x2cae('0x3a')]=_0x4d06b5[_0x2cae('0x3a')][_0x2cae('0x3c')]?_0x4d06b5['attributes']:_0x138a9f['model'];if(!_0x46f0a5['query']['hasOwnProperty'](_0x2cae('0x3d'))){_0x4d06b5[_0x2cae('0x21')]=qs['limit'](_0x46f0a5['query'][_0x2cae('0x21')]);_0x4d06b5[_0x2cae('0x3e')]=qs[_0x2cae('0x3e')](_0x46f0a5[_0x2cae('0x39')][_0x2cae('0x3e')]);}_0x4d06b5[_0x2cae('0x58')]=qs[_0x2cae('0x3f')](_0x46f0a5[_0x2cae('0x39')][_0x2cae('0x3f')]);_0x4d06b5[_0x2cae('0x40')]=qs[_0x2cae('0x41')](_[_0x2cae('0x59')](_0x46f0a5['query'],_0x138a9f[_0x2cae('0x41')]));_0x4d06b5[_0x2cae('0x40')][_0x2cae('0x5a')]=_0xad85ba['id'];if(_0x46f0a5[_0x2cae('0x39')][_0x2cae('0x44')]){_0x4d06b5[_0x2cae('0x40')]=_[_0x2cae('0x42')](_0x4d06b5[_0x2cae('0x40')],{'$or':_[_0x2cae('0x32')](_0x4d06b5[_0x2cae('0x3a')],function(_0x4c1a2f){var _0x4536d3={};_0x4536d3[_0x4c1a2f]={'$like':'%'+_0x46f0a5[_0x2cae('0x39')][_0x2cae('0x44')]+'%'};return _0x4536d3;})});}_0x4d06b5=_[_0x2cae('0x42')]({},_0x4d06b5,_0x46f0a5[_0x2cae('0x45')]);return db[_0x2cae('0x57')][_0x2cae('0x5b')](_0x4d06b5);}})[_0x2cae('0x28')](function(_0x2d4c21){if(_0x2d4c21){return db[_0x2cae('0x5c')]['findAndCountAll']({'where':{'id':_['map'](_0x2d4c21,_0x2cae('0x5d')),'role':_0x2cae('0x5e')},'attributes':['id',_0x2cae('0x2f'),_0x2cae('0x5f'),_0x2cae('0x60'),_0x2cae('0x61')]});}})[_0x2cae('0x28')](function(_0x33b03c){if(_0x33b03c){return{'count':_0x33b03c[_0x2cae('0x20')],'rows':_['map'](_0x33b03c[_0x2cae('0x46')],function(_0x12588b){return{'membername':_0x12588b[_0x2cae('0x2f')],'UserId':_0x12588b['id'],'queue_name':_0x35474d[_0x2cae('0x2f')],'FaxQueueId':_0x35474d['id'],'interface':util['format']('%s/%s',_0x2cae('0x62'),_0x12588b[_0x2cae('0x2f')]),'penalty':0x0,'paused':_0x12588b[_0x2cae('0x5f')],'createdAt':_0x12588b[_0x2cae('0x61')],'updatedAt':_0x12588b[_0x2cae('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x291d7b,_0x4d06b5))[_0x2cae('0x47')](handleError(_0x291d7b,null));};exports[_0x2cae('0x63')]=function(_0x4dbb80,_0x2c3ac4,_0x595394){var _0x22afa3={};var _0x5ed531={};var _0x4e626c;var _0x10ef04;return db[_0x2cae('0x33')]['findOne']({'where':{'id':_0x4dbb80[_0x2cae('0x54')]['id']}})[_0x2cae('0x28')](handleEntityNotFound(_0x2c3ac4,null))[_0x2cae('0x28')](function(_0x3b35e2){if(_0x3b35e2){_0x4e626c=_0x3b35e2;_0x5ed531['model']=_[_0x2cae('0x38')](db['Team'][_0x2cae('0x49')]);_0x5ed531[_0x2cae('0x39')]=_[_0x2cae('0x38')](_0x4dbb80[_0x2cae('0x39')]);_0x5ed531[_0x2cae('0x41')]=_[_0x2cae('0x4a')](_0x5ed531[_0x2cae('0x37')],_0x5ed531[_0x2cae('0x39')]);_0x22afa3[_0x2cae('0x3a')]=_[_0x2cae('0x4a')](_0x5ed531['model'],qs['fields'](_0x4dbb80[_0x2cae('0x39')]['fields']));_0x22afa3[_0x2cae('0x3a')]=_0x22afa3['attributes']['length']?_0x22afa3[_0x2cae('0x3a')]:_0x5ed531[_0x2cae('0x37')];_0x22afa3[_0x2cae('0x58')]=qs[_0x2cae('0x3f')](_0x4dbb80['query'][_0x2cae('0x3f')]);_0x22afa3[_0x2cae('0x40')]=qs[_0x2cae('0x41')](_[_0x2cae('0x59')](_0x4dbb80[_0x2cae('0x39')],_0x5ed531[_0x2cae('0x41')]));if(_0x4dbb80[_0x2cae('0x39')][_0x2cae('0x44')]){_0x22afa3[_0x2cae('0x40')]=_[_0x2cae('0x42')](_0x22afa3[_0x2cae('0x40')],{'$or':_['map'](_0x22afa3['attributes'],function(_0x4dc4c3){var _0xd661ba={};_0xd661ba[_0x4dc4c3]={'$like':'%'+_0x4dbb80['query'][_0x2cae('0x44')]+'%'};return _0xd661ba;})});}_0x22afa3=_['merge']({},_0x22afa3,_0x4dbb80[_0x2cae('0x45')]);return _0x4e626c[_0x2cae('0x63')](_0x22afa3);}})[_0x2cae('0x28')](function(_0x530bc5){if(_0x530bc5){_0x10ef04=_0x530bc5[_0x2cae('0x3c')];if(!_0x4dbb80['query'][_0x2cae('0x64')](_0x2cae('0x3d'))){_0x22afa3[_0x2cae('0x21')]=qs['limit'](_0x4dbb80[_0x2cae('0x39')][_0x2cae('0x21')]);_0x22afa3[_0x2cae('0x3e')]=qs[_0x2cae('0x3e')](_0x4dbb80[_0x2cae('0x39')][_0x2cae('0x3e')]);}return _0x4e626c[_0x2cae('0x63')](_0x22afa3);}})[_0x2cae('0x28')](function(_0x8e23f4){if(_0x8e23f4){return _0x8e23f4?{'count':_0x10ef04,'rows':_0x8e23f4}:null;}})[_0x2cae('0x28')](respondWithResult(_0x2c3ac4,null))[_0x2cae('0x47')](handleError(_0x2c3ac4,null));};exports[_0x2cae('0x65')]=function(_0x2000fa,_0xd4acff,_0x430067){var _0xf9be34=_0x2000fa[_0x2cae('0x4d')][_0x2cae('0x66')];return db[_0x2cae('0x67')][_0x2cae('0x5b')]({'where':{'id':_0xf9be34},'attributes':['id'],'include':[{'model':db[_0x2cae('0x5c')],'as':_0x2cae('0x68'),'attributes':['id',_0x2cae('0x2f'),_0x2cae('0x69'),_0x2cae('0x6a'),'interface'],'raw':!![]}]})[_0x2cae('0x28')](function(_0x16ba9f){if(_0x16ba9f){var _0xaffd1c=_[_0x2cae('0x6b')](_0x16ba9f,function(_0x2cb60c){var _0x34a3ed=_0x2cb60c[_0x2cae('0x2a')]({'plain':!![]});return _0x34a3ed['Agents'];});return db[_0x2cae('0x33')][_0x2cae('0x4b')]({'where':{'id':_0x2000fa[_0x2cae('0x54')]['id']}})[_0x2cae('0x28')](function(_0x177b6f){return db['sequelize'][_0x2cae('0x6c')](function(_0x43fef4){return _0x177b6f[_0x2cae('0x65')](_0xf9be34,{'transaction':_0x43fef4})[_0x2cae('0x28')](function(){return BPromise[_0x2cae('0x6d')](_0xaffd1c,function(_0x4d93de){return db['UserFaxQueue'][_0x2cae('0x6e')]({'where':{'UserId':_0x4d93de['id'],'FaxQueueId':_0x2000fa[_0x2cae('0x54')]['id']},'transaction':_0x43fef4});});})[_0x2cae('0x28')](function(){_0xaffd1c['forEach'](function(_0x4fc1ee){socket['emit']('userFaxQueue:save',{'UserId':_0x4fc1ee['id'],'FaxQueueId':_0x177b6f['id']});});});});});}})['then'](respondWithStatusCode(_0xd4acff,null))[_0x2cae('0x47')](handleError(_0xd4acff,null));};exports[_0x2cae('0x6f')]=function(_0x2aabff,_0x30f006,_0x3b6088){return db[_0x2cae('0x67')]['findAll']({'where':{'id':_0x2aabff[_0x2cae('0x39')][_0x2cae('0x66')]},'attributes':['id'],'include':[{'model':db[_0x2cae('0x5c')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x30f006,null))[_0x2cae('0x28')](function(_0x9afd59){var _0x27f1c0=_[_0x2cae('0x32')](_0x9afd59,'id');var _0x1fcc57=[];var _0x3e292b=[];var _0xa86b8b=squel['select']();_0xa86b8b[_0x2cae('0x70')](_0x2cae('0x71'))[_0x2cae('0x72')]('team_has_fax_queues','tq')[_0x2cae('0x73')](_0x2cae('0x74'),'ut',_0x2cae('0x75'))[_0x2cae('0x40')](_0x2cae('0x76'),_0x2aabff[_0x2cae('0x54')]['id']);for(var _0x495402=0x0;_0x495402<_0x9afd59[_0x2cae('0x3c')];_0x495402+=0x1){let _0x1d8da4=_0x9afd59[_0x495402];for(var _0x57743e=0x0;_0x57743e<_0x1d8da4[_0x2cae('0x68')][_0x2cae('0x3c')];_0x57743e+=0x1){let _0x490a70=_0x1d8da4[_0x2cae('0x68')][_0x57743e];var _0x27aca6=_0xa86b8b[_0x2cae('0x77')]();_0x27aca6[_0x2cae('0x40')](_0x2cae('0x78'),_0x490a70['id']);_0x3e292b[_0x2cae('0x79')](db[_0x2cae('0x7a')][_0x2cae('0x39')](_0x27aca6[_0x2cae('0x7b')](),{'type':db[_0x2cae('0x7a')]['QueryTypes'][_0x2cae('0x7c')]})[_0x2cae('0x28')](function(_0x3f2cf7){if(_0x3f2cf7[_0x2cae('0x3c')]===0x1){return _0x490a70['id'];}else{var _0x2c466f=_[_0x2cae('0x7d')](_[_0x2cae('0x32')](_0x3f2cf7,_0x2cae('0x7e')),function(_0x34e72d){return _[_0x2cae('0x7f')](_0x27f1c0,_0x34e72d);});if(_0x2c466f){return _0x490a70['id'];}}}));}}return BPromise[_0x2cae('0x80')](_0x3e292b)[_0x2cae('0x28')](function(_0x37861f){_0x1fcc57=_(_0x1fcc57)['union'](_0x37861f)[_0x2cae('0x81')]()['value']();return db[_0x2cae('0x33')]['find']({'where':{'id':_0x2aabff[_0x2cae('0x54')]['id']}})[_0x2cae('0x28')](function(_0x273bae){return db['sequelize'][_0x2cae('0x6c')](function(_0x5db58d){return _0x273bae[_0x2cae('0x6f')](_0x2aabff[_0x2cae('0x39')][_0x2cae('0x66')],{'transaction':_0x5db58d})[_0x2cae('0x28')](function(){if(!_[_0x2cae('0x82')](_0x1fcc57)){return _0x273bae[_0x2cae('0x83')](_0x1fcc57,{'transaction':_0x5db58d});}})[_0x2cae('0x28')](function(){_0x1fcc57[_0x2cae('0x84')](function(_0x4192d6){socket[_0x2cae('0x85')](_0x2cae('0x86'),{'UserId':_0x4192d6,'FaxQueueId':_0x273bae['id']});});});});});});})[_0x2cae('0x28')](respondWithStatusCode(_0x30f006,null))[_0x2cae('0x47')](handleError(_0x30f006,null));};exports[_0x2cae('0x87')]=function(_0x3ec017,_0x45b3b2,_0x1dad79){return db[_0x2cae('0x33')]['find']({'where':{'id':_0x3ec017[_0x2cae('0x54')]['id']}})[_0x2cae('0x28')](handleEntityNotFound(_0x45b3b2,null))[_0x2cae('0x28')](function(_0x4f5e84){if(_0x4f5e84){return _0x4f5e84[_0x2cae('0x87')](_0x3ec017[_0x2cae('0x4d')][_0x2cae('0x66')],_[_0x2cae('0x88')](_0x3ec017[_0x2cae('0x4d')],['ids','id'])||{})[_0x2cae('0x89')](function(_0x447bb6){for(var _0x354d2a=0x0;_0x354d2a<_0x3ec017[_0x2cae('0x4d')]['ids'][_0x2cae('0x3c')];_0x354d2a+=0x1){socket['emit'](_0x2cae('0x8a'),{'UserId':_0x3ec017[_0x2cae('0x4d')]['ids'][_0x354d2a],'FaxQueueId':_0x3ec017['params']['id']});}return _0x447bb6;});}})[_0x2cae('0x28')](respondWithResult(_0x45b3b2,null))[_0x2cae('0x47')](handleError(_0x45b3b2,null));};exports[_0x2cae('0x83')]=function(_0x58692e,_0x8c6fc5,_0x46d3fc){return db[_0x2cae('0x33')][_0x2cae('0x4b')]({'where':{'id':_0x58692e['params']['id']}})[_0x2cae('0x28')](handleEntityNotFound(_0x8c6fc5,null))[_0x2cae('0x28')](function(_0x9d3149){if(_0x9d3149){return _0x9d3149[_0x2cae('0x83')](_0x58692e[_0x2cae('0x39')][_0x2cae('0x66')])[_0x2cae('0x28')](function(){if(_[_0x2cae('0x8b')](_0x58692e[_0x2cae('0x39')][_0x2cae('0x66')])){for(var _0x52526a=0x0;_0x52526a<_0x58692e[_0x2cae('0x39')][_0x2cae('0x66')][_0x2cae('0x3c')];_0x52526a+=0x1){socket['emit'](_0x2cae('0x86'),{'UserId':Number(_0x58692e[_0x2cae('0x39')][_0x2cae('0x66')][_0x52526a]),'FaxQueueId':Number(_0x58692e[_0x2cae('0x54')]['id'])});}}else{socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x58692e[_0x2cae('0x39')][_0x2cae('0x66')]),'FaxQueueId':Number(_0x58692e[_0x2cae('0x54')]['id'])});}});}})[_0x2cae('0x28')](respondWithStatusCode(_0x8c6fc5,null))[_0x2cae('0x47')](handleError(_0x8c6fc5,null));};exports[_0x2cae('0x8c')]=function(_0x3e13b7,_0x1f0531,_0xcad4dd){var _0x2f62ba={};var _0x30ca8b={};var _0x2051c3;var _0x288834;return db['FaxQueue'][_0x2cae('0x8d')]({'where':{'id':_0x3e13b7['params']['id']}})[_0x2cae('0x28')](handleEntityNotFound(_0x1f0531,null))[_0x2cae('0x28')](function(_0x430812){if(_0x430812){_0x2051c3=_0x430812;_0x30ca8b[_0x2cae('0x37')]=_[_0x2cae('0x38')](db['User'][_0x2cae('0x49')]);_0x30ca8b[_0x2cae('0x39')]=_['keys'](_0x3e13b7[_0x2cae('0x39')]);_0x30ca8b[_0x2cae('0x41')]=_[_0x2cae('0x4a')](_0x30ca8b[_0x2cae('0x37')],_0x30ca8b['query']);_0x2f62ba[_0x2cae('0x3a')]=_[_0x2cae('0x4a')](_0x30ca8b['model'],qs['fields'](_0x3e13b7[_0x2cae('0x39')][_0x2cae('0x3b')]));_0x2f62ba['attributes']=_0x2f62ba[_0x2cae('0x3a')][_0x2cae('0x3c')]?_0x2f62ba[_0x2cae('0x3a')]:_0x30ca8b[_0x2cae('0x37')];_0x2f62ba[_0x2cae('0x58')]=qs[_0x2cae('0x3f')](_0x3e13b7[_0x2cae('0x39')][_0x2cae('0x3f')]);_0x2f62ba[_0x2cae('0x40')]=qs[_0x2cae('0x41')](_[_0x2cae('0x59')](_0x3e13b7[_0x2cae('0x39')],_0x30ca8b[_0x2cae('0x41')]));if(_0x3e13b7[_0x2cae('0x39')]['filter']){_0x2f62ba[_0x2cae('0x40')]=_[_0x2cae('0x42')](_0x2f62ba[_0x2cae('0x40')],{'$or':_[_0x2cae('0x32')](_0x2f62ba['attributes'],function(_0x54ea64){var _0x43c098={};_0x43c098[_0x54ea64]={'$like':'%'+_0x3e13b7[_0x2cae('0x39')][_0x2cae('0x44')]+'%'};return _0x43c098;})});}_0x2f62ba=_[_0x2cae('0x42')]({},_0x2f62ba,_0x3e13b7['options']);return _0x2051c3['getAgents'](_0x2f62ba);}})[_0x2cae('0x28')](function(_0x1a0b64){if(_0x1a0b64){_0x288834=_0x1a0b64[_0x2cae('0x3c')];if(!_0x3e13b7[_0x2cae('0x39')][_0x2cae('0x64')]('nolimit')){_0x2f62ba[_0x2cae('0x21')]=qs[_0x2cae('0x21')](_0x3e13b7[_0x2cae('0x39')][_0x2cae('0x21')]);_0x2f62ba[_0x2cae('0x3e')]=qs[_0x2cae('0x3e')](_0x3e13b7[_0x2cae('0x39')][_0x2cae('0x3e')]);}return _0x2051c3[_0x2cae('0x8c')](_0x2f62ba);}})['then'](function(_0x34c08d){if(_0x34c08d){return _0x34c08d?{'count':_0x288834,'rows':_0x34c08d}:null;}})['then'](respondWithResult(_0x1f0531,null))['catch'](handleError(_0x1f0531,null));}; \ No newline at end of file +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 diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index ba9ac3d..9f14be7 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 _0x0f1f=['update','remove','emit','hook','exports','events','FaxQueue','setMaxListeners','save'];(function(_0x555e19,_0xbfa39d){var _0x4471b7=function(_0x44b296){while(--_0x44b296){_0x555e19['push'](_0x555e19['shift']());}};_0x4471b7(++_0xbfa39d);}(_0x0f1f,0x176));var _0xf0f1=function(_0x2627cd,_0x45884d){_0x2627cd=_0x2627cd-0x0;var _0x5c2351=_0x0f1f[_0x2627cd];return _0x5c2351;};'use strict';var EventEmitter=require(_0xf0f1('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0xf0f1('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xf0f1('0x2')](0x0);var events={'afterCreate':_0xf0f1('0x3'),'afterUpdate':_0xf0f1('0x4'),'afterDestroy':_0xf0f1('0x5')};function emitEvent(_0x3d4468){return function(_0x317f88,_0x234123,_0x3a0870){FaxQueueEvents[_0xf0f1('0x6')](_0x3d4468+':'+_0x317f88['id'],_0x317f88);FaxQueueEvents[_0xf0f1('0x6')](_0x3d4468,_0x317f88);_0x3a0870(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0xf0f1('0x7')](e,emitEvent(event));}}module[_0xf0f1('0x8')]=FaxQueueEvents; \ No newline at end of file +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 diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 537778e..6cd6b87 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 _0x8d97=['bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','fax_queues','lodash','util','api','moment'];(function(_0x3a3b9e,_0xc59037){var _0x148103=function(_0x406731){while(--_0x406731){_0x3a3b9e['push'](_0x3a3b9e['shift']());}};_0x148103(++_0xc59037);}(_0x8d97,0x100));var _0x78d9=function(_0x3d41be,_0x1f3920){_0x3d41be=_0x3d41be-0x0;var _0x224664=_0x8d97[_0x3d41be];return _0x224664;};'use strict';var _=require(_0x78d9('0x0'));var util=require(_0x78d9('0x1'));var logger=require('../../config/logger')(_0x78d9('0x2'));var moment=require(_0x78d9('0x3'));var BPromise=require(_0x78d9('0x4'));var rp=require(_0x78d9('0x5'));var fs=require('fs');var path=require(_0x78d9('0x6'));var rimraf=require(_0x78d9('0x7'));var config=require(_0x78d9('0x8'));var attributes=require(_0x78d9('0x9'));module[_0x78d9('0xa')]=function(_0x22be76,_0x3d2034){return _0x22be76[_0x78d9('0xb')]('FaxQueue',attributes,{'tableName':_0x78d9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 7c7d5a5..47adad0 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 _0x9abf=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','GetFaxQueue','FaxQueue','options','raw','where','attributes','include','map','model','ShowFaxQueue','find','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4b43c0,_0x3a8091){var _0x574c13=function(_0x39eaf4){while(--_0x39eaf4){_0x4b43c0['push'](_0x4b43c0['shift']());}};_0x574c13(++_0x3a8091);}(_0x9abf,0x147));var _0xf9ab=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x9abf[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0xf9ab('0x0'));var moment=require(_0xf9ab('0x1'));var BPromise=require('bluebird');var rs=require(_0xf9ab('0x2'));var fs=require('fs');var Redis=require(_0xf9ab('0x3'));var db=require(_0xf9ab('0x4'))['db'];var utils=require(_0xf9ab('0x5'));var logger=require(_0xf9ab('0x6'))(_0xf9ab('0x7'));var config=require(_0xf9ab('0x8'));var jayson=require(_0xf9ab('0x9'));var client=jayson[_0xf9ab('0xa')][_0xf9ab('0xb')]({'port':0x232a});config[_0xf9ab('0xc')]=_[_0xf9ab('0xd')](config[_0xf9ab('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xf9ab('0xe'))(new Redis(config[_0xf9ab('0xc')]));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x4908dd,_0x183ae7,_0x3791c8){return new BPromise(function(_0x3083ea,_0x3d727c){return client['request'](_0x4908dd,_0x3791c8)[_0xf9ab('0xf')](function(_0x2bcf5d){logger[_0xf9ab('0x10')](_0xf9ab('0x11'),_0x183ae7,_0xf9ab('0x12'));logger[_0xf9ab('0x13')](_0xf9ab('0x14'),_0x183ae7,_0xf9ab('0x12'),JSON[_0xf9ab('0x15')](_0x2bcf5d));if(_0x2bcf5d['error']){if(_0x2bcf5d['error'][_0xf9ab('0x16')]===0x1f4){logger[_0xf9ab('0x17')]('FaxQueue,\x20%s,\x20%s',_0x183ae7,_0x2bcf5d['error'][_0xf9ab('0x18')]);return _0x3d727c(_0x2bcf5d[_0xf9ab('0x17')]['message']);}logger[_0xf9ab('0x17')]('FaxQueue,\x20%s,\x20%s',_0x183ae7,_0x2bcf5d[_0xf9ab('0x17')][_0xf9ab('0x18')]);return _0x3083ea(_0x2bcf5d[_0xf9ab('0x17')][_0xf9ab('0x18')]);}else{logger['info']('FaxQueue,\x20%s,\x20%s',_0x183ae7,_0xf9ab('0x12'));_0x3083ea(_0x2bcf5d['result'][_0xf9ab('0x18')]);}})['catch'](function(_0xc83ee){logger['error'](_0xf9ab('0x11'),_0x183ae7,_0xc83ee);_0x3d727c(_0xc83ee);});});}exports[_0xf9ab('0x19')]=function(_0x5255fa){var _0x5ea78f=this;return new Promise(function(_0x556473,_0x378654){return db[_0xf9ab('0x1a')]['findAll']({'raw':_0x5255fa[_0xf9ab('0x1b')]?_0x5255fa[_0xf9ab('0x1b')][_0xf9ab('0x1c')]===undefined?!![]:![]:!![],'where':_0x5255fa['options']?_0x5255fa[_0xf9ab('0x1b')][_0xf9ab('0x1d')]||null:null,'attributes':_0x5255fa[_0xf9ab('0x1b')]?_0x5255fa[_0xf9ab('0x1b')][_0xf9ab('0x1e')]||null:null,'limit':_0x5255fa['options']?_0x5255fa['options']['limit']||null:null,'include':_0x5255fa['options']?_0x5255fa[_0xf9ab('0x1b')][_0xf9ab('0x1f')]?_[_0xf9ab('0x20')](_0x5255fa['options'][_0xf9ab('0x1f')],function(_0x40b3b3){return{'model':db[_0x40b3b3[_0xf9ab('0x21')]],'as':_0x40b3b3['as'],'attributes':_0x40b3b3[_0xf9ab('0x1e')],'include':_0x40b3b3['include']?_[_0xf9ab('0x20')](_0x40b3b3[_0xf9ab('0x1f')],function(_0x49487a){return{'model':db[_0x49487a['model']],'as':_0x49487a['as'],'attributes':_0x49487a[_0xf9ab('0x1e')],'include':_0x49487a[_0xf9ab('0x1f')]?_[_0xf9ab('0x20')](_0x49487a[_0xf9ab('0x1f')],function(_0x43cc57){return{'model':db[_0x43cc57[_0xf9ab('0x21')]],'as':_0x43cc57['as'],'attributes':_0x43cc57['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xd3387d){logger[_0xf9ab('0x10')](_0xf9ab('0x19'),_0x5255fa);logger[_0xf9ab('0x13')](_0xf9ab('0x19'),_0x5255fa,JSON['stringify'](_0xd3387d));_0x556473(_0xd3387d);})['catch'](function(_0x38926f){logger[_0xf9ab('0x17')](_0xf9ab('0x19'),_0x38926f['message'],_0x5255fa);_0x378654(_0x5ea78f[_0xf9ab('0x17')](0x1f4,_0x38926f[_0xf9ab('0x18')]));});});};exports[_0xf9ab('0x22')]=function(_0x5bb429){var _0x1a4e77=this;return new Promise(function(_0x15fead,_0x1d1488){return db['FaxQueue'][_0xf9ab('0x23')]({'raw':_0x5bb429[_0xf9ab('0x1b')]?_0x5bb429[_0xf9ab('0x1b')][_0xf9ab('0x1c')]===undefined?!![]:![]:!![],'where':_0x5bb429[_0xf9ab('0x1b')]?_0x5bb429[_0xf9ab('0x1b')][_0xf9ab('0x1d')]||null:null,'attributes':_0x5bb429['options']?_0x5bb429['options'][_0xf9ab('0x1e')]||null:null,'include':_0x5bb429['options']?_0x5bb429['options'][_0xf9ab('0x1f')]?_[_0xf9ab('0x20')](_0x5bb429['options'][_0xf9ab('0x1f')],function(_0x2195f6){return{'model':db[_0x2195f6['model']],'as':_0x2195f6['as'],'attributes':_0x2195f6[_0xf9ab('0x1e')],'include':_0x2195f6[_0xf9ab('0x1f')]?_[_0xf9ab('0x20')](_0x2195f6['include'],function(_0x171778){return{'model':db[_0x171778[_0xf9ab('0x21')]],'as':_0x171778['as'],'attributes':_0x171778[_0xf9ab('0x1e')],'include':_0x171778[_0xf9ab('0x1f')]?_['map'](_0x171778[_0xf9ab('0x1f')],function(_0x4abd20){return{'model':db[_0x4abd20[_0xf9ab('0x21')]],'as':_0x4abd20['as'],'attributes':_0x4abd20[_0xf9ab('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf9ab('0xf')](function(_0x5e193a){logger['info'](_0xf9ab('0x22'),_0x5bb429);logger[_0xf9ab('0x13')](_0xf9ab('0x22'),_0x5bb429,JSON['stringify'](_0x5e193a));_0x15fead(_0x5e193a);})[_0xf9ab('0x24')](function(_0xa2d57){logger[_0xf9ab('0x17')](_0xf9ab('0x22'),_0xa2d57[_0xf9ab('0x18')],_0x5bb429);_0x1d1488(_0x1a4e77[_0xf9ab('0x17')](0x1f4,_0xa2d57['message']));});});}; \ No newline at end of file +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 diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 51787b6..b555840 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 _0x1833=['remove','update','emit','register','length'];(function(_0x3e21f4,_0x43d310){var _0x40fc49=function(_0x54a8f6){while(--_0x54a8f6){_0x3e21f4['push'](_0x3e21f4['shift']());}};_0x40fc49(++_0x43d310);}(_0x1833,0x1db));var _0x3183=function(_0x54bb5e,_0xc9513a){_0x54bb5e=_0x54bb5e-0x0;var _0x2cfe75=_0x1833[_0x54bb5e];return _0x2cfe75;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=['save',_0x3183('0x0'),_0x3183('0x1')];function createListener(_0x518025,_0x2b5208){return function(_0x4f1bfa){_0x2b5208[_0x3183('0x2')](_0x518025,_0x4f1bfa);};}function removeListener(_0x338a68,_0x493c46){return function(){FaxQueueEvents['removeListener'](_0x338a68,_0x493c46);};}exports[_0x3183('0x3')]=function(_0x1c0b46){for(var _0x5bfe3d=0x0,_0x1b8d0a=events[_0x3183('0x4')];_0x5bfe3d<_0x1b8d0a;_0x5bfe3d++){var _0x10a333=events[_0x5bfe3d];var _0x268904=createListener('faxQueue:'+_0x10a333,_0x1c0b46);FaxQueueEvents['on'](_0x10a333,_0x268904);}}; \ No newline at end of file +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 diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 9dbb3ee..8c0bdb3 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 _0xb10b=['addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xb10b,0x12a));var _0xbb10=function(_0x1265fa,_0x1a1fed){_0x1265fa=_0x1265fa-0x0;var _0x1fe35e=_0xb10b[_0x1265fa];return _0x1fe35e;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getMembers']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['get'](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x13')](_0xbb10('0xf'),auth['isAuthenticated'](),controller[_0xbb10('0x15')]);router[_0xbb10('0x13')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x16')]);router[_0xbb10('0x17')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x18')]);router[_0xbb10('0x19')]('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x19')](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1b')]);router[_0xbb10('0x19')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1c')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index b19bce6..29071c8 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 _0xdda3=['exports','STRING','DATE','moment','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdda3,0x10c));var _0x3dda=function(_0x1fb9d2,_0x57a208){_0x1fb9d2=_0x1fb9d2-0x0;var _0x4a8916=_0xdda3[_0x1fb9d2];return _0x4a8916;};'use strict';var moment=require(_0x3dda('0x0'));var Sequelize=require(_0x3dda('0x1'));module[_0x3dda('0x2')]={'uniqueid':{'type':Sequelize[_0x3dda('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x3dda('0x3')]},'joinAt':{'type':Sequelize[_0x3dda('0x4')]},'leaveAt':{'type':Sequelize[_0x3dda('0x4')]},'acceptAt':{'type':Sequelize[_0x3dda('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x3dda('0x3')]}}; \ No newline at end of file +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 diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 81752b5..4f1226c 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 _0xc153=['util','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','save','update','then','destroy','error','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','VIRTUAL','options','FaxQueueReport','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x14fc0f,_0x248bd3){var _0x2cdbc1=function(_0x3096bf){while(--_0x3096bf){_0x14fc0f['push'](_0x14fc0f['shift']());}};_0x2cdbc1(++_0x248bd3);}(_0xc153,0x11d));var _0x3c15=function(_0x1197b0,_0x3c3573){_0x1197b0=_0x1197b0-0x0;var _0x1f8126=_0xc153[_0x1197b0];return _0x1f8126;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3c15('0x0'));var rimraf=require(_0x3c15('0x1'));var zipdir=require(_0x3c15('0x2'));var jsonpatch=require(_0x3c15('0x3'));var rp=require(_0x3c15('0x4'));var moment=require(_0x3c15('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3c15('0x6'));var util=require(_0x3c15('0x7'));var path=require('path');var sox=require(_0x3c15('0x8'));var csv=require(_0x3c15('0x9'));var ejs=require(_0x3c15('0xa'));var fs=require('fs');var _=require(_0x3c15('0xb'));var squel=require(_0x3c15('0xc'));var crypto=require('crypto');var jsforce=require(_0x3c15('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3c15('0xe'));var Redis=require(_0x3c15('0xf'));var authService=require(_0x3c15('0x10'));var qs=require(_0x3c15('0x11'));var as=require(_0x3c15('0x12'));var hardwareService=require(_0x3c15('0x13'));var logger=require('../../config/logger')(_0x3c15('0x14'));var utils=require('../../config/utils');var config=require(_0x3c15('0x15'));var db=require(_0x3c15('0x16'))['db'];function respondWithStatusCode(_0x596cc7,_0x4697af){_0x4697af=_0x4697af||0xcc;return function(_0x3f41b0){if(_0x3f41b0){return _0x596cc7[_0x3c15('0x17')](_0x4697af);}return _0x596cc7[_0x3c15('0x18')](_0x4697af)[_0x3c15('0x19')]();};}function respondWithResult(_0x3d7f4f,_0x503be9){_0x503be9=_0x503be9||0xc8;return function(_0x31f53d){if(_0x31f53d){return _0x3d7f4f[_0x3c15('0x18')](_0x503be9)[_0x3c15('0x1a')](_0x31f53d);}};}function respondWithFilteredResult(_0xccfd2b,_0x4f80b1){return function(_0x65089){if(_0x65089){var _0x1c6101=_0x65089[_0x3c15('0x1b')],_0x558f50=_0x4f80b1[_0x3c15('0x1c')],_0x4cad86=_0x4f80b1[_0x3c15('0x1c')]+_0x4f80b1[_0x3c15('0x1d')],_0x548324;if(_0x4cad86>=_0x1c6101){_0x4cad86=_0x1c6101;_0x548324=0xc8;}else{_0x548324=0xce;}_0xccfd2b[_0x3c15('0x18')](_0x548324);return _0xccfd2b['set']('Content-Range',_0x558f50+'-'+_0x4cad86+'/'+_0x1c6101)[_0x3c15('0x1a')](_0x65089);}return null;};}function patchUpdates(_0x4d6639){return function(_0x2d7da0){try{jsonpatch[_0x3c15('0x1e')](_0x2d7da0,_0x4d6639,!![]);}catch(_0x161930){return BPromise['reject'](_0x161930);}return _0x2d7da0[_0x3c15('0x1f')]();};}function saveUpdates(_0x56758e,_0x35ed38){return function(_0x20859a){if(_0x20859a){return _0x20859a[_0x3c15('0x20')](_0x56758e)[_0x3c15('0x21')](function(_0x368f68){return _0x368f68;});}return null;};}function removeEntity(_0x2f8012,_0x20e453){return function(_0x4f77c4){if(_0x4f77c4){return _0x4f77c4[_0x3c15('0x22')]()[_0x3c15('0x21')](function(){_0x2f8012['status'](0xcc)[_0x3c15('0x19')]();});}};}function handleEntityNotFound(_0x241749,_0x219b6c){return function(_0xf63e4e){if(!_0xf63e4e){_0x241749['sendStatus'](0x194);}return _0xf63e4e;};}function handleError(_0x2d9c46,_0x4b0786){_0x4b0786=_0x4b0786||0x1f4;return function(_0xe6e7f5){logger[_0x3c15('0x23')](_0xe6e7f5[_0x3c15('0x24')]);if(_0xe6e7f5['name']){delete _0xe6e7f5['name'];}_0x2d9c46[_0x3c15('0x18')](_0x4b0786)[_0x3c15('0x25')](_0xe6e7f5);};}exports[_0x3c15('0x26')]=function(_0x17cd9c,_0x8566ed){var _0x54fcc7={},_0x43a644={},_0x433ad7={'count':0x0,'rows':[]};var _0x3e71a4=_[_0x3c15('0x27')](db['FaxQueueReport'][_0x3c15('0x28')],function(_0x1717d0){return{'name':_0x1717d0[_0x3c15('0x29')],'type':_0x1717d0[_0x3c15('0x2a')][_0x3c15('0x2b')]};});_0x43a644[_0x3c15('0x2c')]=_[_0x3c15('0x27')](_0x3e71a4,_0x3c15('0x2d'));_0x43a644[_0x3c15('0x2e')]=_[_0x3c15('0x2f')](_0x17cd9c[_0x3c15('0x2e')]);_0x43a644[_0x3c15('0x30')]=_[_0x3c15('0x31')](_0x43a644[_0x3c15('0x2c')],_0x43a644[_0x3c15('0x2e')]);_0x54fcc7[_0x3c15('0x32')]=_[_0x3c15('0x31')](_0x43a644[_0x3c15('0x2c')],qs[_0x3c15('0x33')](_0x17cd9c[_0x3c15('0x2e')]['fields']));_0x54fcc7[_0x3c15('0x32')]=_0x54fcc7['attributes'][_0x3c15('0x34')]?_0x54fcc7['attributes']:_0x43a644['model'];if(!_0x17cd9c[_0x3c15('0x2e')]['hasOwnProperty']('nolimit')){_0x54fcc7[_0x3c15('0x1d')]=qs['limit'](_0x17cd9c[_0x3c15('0x2e')][_0x3c15('0x1d')]);_0x54fcc7[_0x3c15('0x1c')]=qs['offset'](_0x17cd9c[_0x3c15('0x2e')][_0x3c15('0x1c')]);}_0x54fcc7[_0x3c15('0x35')]=qs[_0x3c15('0x36')](_0x17cd9c['query']['sort']);_0x54fcc7['where']=qs[_0x3c15('0x30')](_[_0x3c15('0x37')](_0x17cd9c[_0x3c15('0x2e')],_0x43a644[_0x3c15('0x30')]));if(_0x17cd9c['query'][_0x3c15('0x38')]){_0x54fcc7[_0x3c15('0x39')]=_[_0x3c15('0x3a')](_0x54fcc7[_0x3c15('0x39')],{'$or':_[_0x3c15('0x27')](_0x3e71a4,function(_0x4a54e2){if(_0x4a54e2['type']!==_0x3c15('0x3b')){var _0x33e352={};_0x33e352[_0x4a54e2[_0x3c15('0x2d')]]={'$like':'%'+_0x17cd9c['query']['filter']+'%'};return _0x33e352;}})});}_0x54fcc7=_[_0x3c15('0x3a')]({},_0x54fcc7,_0x17cd9c[_0x3c15('0x3c')]);var _0x74281e={'where':_0x54fcc7[_0x3c15('0x39')]};return db[_0x3c15('0x3d')][_0x3c15('0x1b')](_0x74281e)['then'](function(_0xf69c77){_0x433ad7['count']=_0xf69c77;if(_0x17cd9c[_0x3c15('0x2e')][_0x3c15('0x3e')]){_0x54fcc7[_0x3c15('0x3f')]=[{'all':!![]}];}return db['FaxQueueReport'][_0x3c15('0x40')](_0x54fcc7);})[_0x3c15('0x21')](function(_0x1c1e2b){_0x433ad7[_0x3c15('0x41')]=_0x1c1e2b;return _0x433ad7;})[_0x3c15('0x21')](respondWithFilteredResult(_0x8566ed,_0x54fcc7))['catch'](handleError(_0x8566ed,null));};exports[_0x3c15('0x42')]=function(_0x5c0dfd,_0x4a0143){var _0x4a28ea={'raw':!![],'where':{'id':_0x5c0dfd[_0x3c15('0x43')]['id']}},_0x4352e0={};_0x4352e0['model']=_[_0x3c15('0x2f')](db[_0x3c15('0x3d')][_0x3c15('0x28')]);_0x4352e0['query']=_[_0x3c15('0x2f')](_0x5c0dfd[_0x3c15('0x2e')]);_0x4352e0[_0x3c15('0x30')]=_[_0x3c15('0x31')](_0x4352e0[_0x3c15('0x2c')],_0x4352e0[_0x3c15('0x2e')]);_0x4a28ea['attributes']=_['intersection'](_0x4352e0[_0x3c15('0x2c')],qs[_0x3c15('0x33')](_0x5c0dfd[_0x3c15('0x2e')]['fields']));_0x4a28ea[_0x3c15('0x32')]=_0x4a28ea[_0x3c15('0x32')][_0x3c15('0x34')]?_0x4a28ea['attributes']:_0x4352e0['model'];if(_0x5c0dfd['query'][_0x3c15('0x3e')]){_0x4a28ea['include']=[{'all':!![]}];}_0x4a28ea=_[_0x3c15('0x3a')]({},_0x4a28ea,_0x5c0dfd[_0x3c15('0x3c')]);return db[_0x3c15('0x3d')][_0x3c15('0x44')](_0x4a28ea)[_0x3c15('0x21')](handleEntityNotFound(_0x4a0143,null))['then'](respondWithResult(_0x4a0143,null))[_0x3c15('0x45')](handleError(_0x4a0143,null));};exports['create']=function(_0x2d0d79,_0x3564b0){return db[_0x3c15('0x3d')][_0x3c15('0x46')](_0x2d0d79[_0x3c15('0x47')],{})['then'](respondWithResult(_0x3564b0,0xc9))[_0x3c15('0x45')](handleError(_0x3564b0,null));};exports['update']=function(_0xc454a0,_0x107ca2){if(_0xc454a0[_0x3c15('0x47')]['id']){delete _0xc454a0['body']['id'];}return db[_0x3c15('0x3d')][_0x3c15('0x44')]({'where':{'id':_0xc454a0[_0x3c15('0x43')]['id']}})['then'](handleEntityNotFound(_0x107ca2,null))[_0x3c15('0x21')](saveUpdates(_0xc454a0[_0x3c15('0x47')],null))[_0x3c15('0x21')](respondWithResult(_0x107ca2,null))[_0x3c15('0x45')](handleError(_0x107ca2,null));};exports[_0x3c15('0x22')]=function(_0x3fbd1d,_0x464757){return db[_0x3c15('0x3d')][_0x3c15('0x44')]({'where':{'id':_0x3fbd1d['params']['id']}})[_0x3c15('0x21')](handleEntityNotFound(_0x464757,null))[_0x3c15('0x21')](removeEntity(_0x464757,null))[_0x3c15('0x45')](handleError(_0x464757,null));};exports[_0x3c15('0x48')]=function(_0x530b34,_0x4643d4){return db[_0x3c15('0x3d')]['describe']()[_0x3c15('0x21')](respondWithResult(_0x4643d4,null))[_0x3c15('0x45')](handleError(_0x4643d4,null));}; \ No newline at end of file +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 diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index df2590f..6744228 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 _0x8af3=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash','util'];(function(_0x1c3429,_0x11d159){var _0x1609bd=function(_0x5ce42c){while(--_0x5ce42c){_0x1c3429['push'](_0x1c3429['shift']());}};_0x1609bd(++_0x11d159);}(_0x8af3,0x194));var _0x38af=function(_0x4b4a85,_0x25967c){_0x4b4a85=_0x4b4a85-0x0;var _0x12a903=_0x8af3[_0x4b4a85];return _0x12a903;};'use strict';var _=require(_0x38af('0x0'));var util=require(_0x38af('0x1'));var logger=require(_0x38af('0x2'))('api');var moment=require('moment');var BPromise=require(_0x38af('0x3'));var rp=require(_0x38af('0x4'));var fs=require('fs');var path=require(_0x38af('0x5'));var rimraf=require(_0x38af('0x6'));var config=require(_0x38af('0x7'));var attributes=require(_0x38af('0x8'));module[_0x38af('0x9')]=function(_0x188c90,_0x7fc52){return _0x188c90[_0x38af('0xa')](_0x38af('0xb'),attributes,{'tableName':_0x38af('0xc'),'paranoid':![],'indexes':[{'name':_0x38af('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index b792a1f..094708b 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 _0x3e33=['limit','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','FaxQueueReport,\x20%s,\x20%s','result','catch','CreateFaxQueueReport','create','body','options','raw','stringify','message','UpdateFaxQueueReport','FaxQueueReport','update','where'];(function(_0x365d9b,_0x49cd31){var _0xe4cc72=function(_0x24b8be){while(--_0x24b8be){_0x365d9b['push'](_0x365d9b['shift']());}};_0xe4cc72(++_0x49cd31);}(_0x3e33,0xc8));var _0x33e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e33[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x33e3('0x0'));var util=require('util');var moment=require(_0x33e3('0x1'));var BPromise=require(_0x33e3('0x2'));var rs=require(_0x33e3('0x3'));var fs=require('fs');var Redis=require(_0x33e3('0x4'));var db=require(_0x33e3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x33e3('0x6'))(_0x33e3('0x7'));var config=require('../../config/environment');var jayson=require(_0x33e3('0x8'));var client=jayson[_0x33e3('0x9')][_0x33e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17bd0a,_0x299684,_0x5a5f07){return new BPromise(function(_0x43322e,_0x1e49f5){return client['request'](_0x17bd0a,_0x5a5f07)[_0x33e3('0xb')](function(_0x46ecb2){logger[_0x33e3('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x299684,_0x33e3('0xd'));logger['debug'](_0x33e3('0xe'),_0x299684,'request\x20sent',JSON['stringify'](_0x46ecb2));if(_0x46ecb2[_0x33e3('0xf')]){if(_0x46ecb2[_0x33e3('0xf')][_0x33e3('0x10')]===0x1f4){logger[_0x33e3('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x299684,_0x46ecb2[_0x33e3('0xf')]['message']);return _0x1e49f5(_0x46ecb2[_0x33e3('0xf')]['message']);}logger[_0x33e3('0xf')](_0x33e3('0x11'),_0x299684,_0x46ecb2[_0x33e3('0xf')]['message']);return _0x43322e(_0x46ecb2['error']['message']);}else{logger['info'](_0x33e3('0x11'),_0x299684,_0x33e3('0xd'));_0x43322e(_0x46ecb2[_0x33e3('0x12')]['message']);}})[_0x33e3('0x13')](function(_0x5b1d52){logger[_0x33e3('0xf')](_0x33e3('0x11'),_0x299684,_0x5b1d52);_0x1e49f5(_0x5b1d52);});});}exports[_0x33e3('0x14')]=function(_0x411ca3){var _0x18e9bb=this;return new Promise(function(_0xfa027a,_0x248e1e){return db['FaxQueueReport'][_0x33e3('0x15')](_0x411ca3[_0x33e3('0x16')],{'raw':_0x411ca3['options']?_0x411ca3[_0x33e3('0x17')][_0x33e3('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x57f543){logger[_0x33e3('0xc')](_0x33e3('0x14'),_0x411ca3);logger['debug'](_0x33e3('0x14'),_0x411ca3,JSON[_0x33e3('0x19')](_0x57f543));_0xfa027a(_0x57f543);})[_0x33e3('0x13')](function(_0x413661){logger[_0x33e3('0xf')](_0x33e3('0x14'),_0x413661[_0x33e3('0x1a')],_0x411ca3);_0x248e1e(_0x18e9bb['error'](0x1f4,_0x413661['message']));});});};exports[_0x33e3('0x1b')]=function(_0x5e542d){var _0x37e74=this;return new Promise(function(_0x950f0c,_0x53a179){return db[_0x33e3('0x1c')][_0x33e3('0x1d')](_0x5e542d[_0x33e3('0x16')],{'raw':_0x5e542d[_0x33e3('0x17')]?_0x5e542d['options'][_0x33e3('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e542d['options']?_0x5e542d[_0x33e3('0x17')][_0x33e3('0x1e')]||null:null,'attributes':_0x5e542d[_0x33e3('0x17')]?_0x5e542d[_0x33e3('0x17')]['attributes']||null:null,'limit':_0x5e542d[_0x33e3('0x17')]?_0x5e542d[_0x33e3('0x17')][_0x33e3('0x1f')]||null:null})['then'](function(_0x53e83e){logger[_0x33e3('0xc')](_0x33e3('0x1b'),_0x5e542d);logger[_0x33e3('0x20')](_0x33e3('0x1b'),_0x5e542d,JSON['stringify'](_0x53e83e));_0x950f0c(_0x53e83e);})[_0x33e3('0x13')](function(_0x598964){logger['error'](_0x33e3('0x1b'),_0x598964['message'],_0x5e542d);_0x53a179(_0x37e74[_0x33e3('0xf')](0x1f4,_0x598964[_0x33e3('0x1a')]));});});}; \ No newline at end of file +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 diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 0bd6f47..bed5666 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 _0x5008=['put','/:id','delete','destroy','exports','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','index','/describe','isAuthenticated','describe','show','post','create'];(function(_0x4ab3fb,_0x776775){var _0x34fe1e=function(_0x1c94c5){while(--_0x1c94c5){_0x4ab3fb['push'](_0x4ab3fb['shift']());}};_0x34fe1e(++_0x776775);}(_0x5008,0xb0));var _0x8500=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x5008[_0x1b349a];return _0x5d1f7c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8500('0x0'));var router=express[_0x8500('0x1')]();var auth=require(_0x8500('0x2'));var interaction=require(_0x8500('0x3'));var config=require(_0x8500('0x4'));var controller=require(_0x8500('0x5'));router[_0x8500('0x6')]('/',auth['isAuthenticated'](),controller[_0x8500('0x7')]);router['get'](_0x8500('0x8'),auth[_0x8500('0x9')](),controller[_0x8500('0xa')]);router[_0x8500('0x6')]('/:id',auth[_0x8500('0x9')](),controller[_0x8500('0xb')]);router[_0x8500('0xc')]('/',auth[_0x8500('0x9')](),controller[_0x8500('0xd')]);router[_0x8500('0xe')](_0x8500('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x8500('0x10')](_0x8500('0xf'),auth[_0x8500('0x9')](),controller[_0x8500('0x11')]);module[_0x8500('0x12')]=router; \ No newline at end of file +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 diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 476b255..c28756b 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 _0xc827=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING','ENUM'];(function(_0x1220dc,_0x448145){var _0x264ada=function(_0x171972){while(--_0x171972){_0x1220dc['push'](_0x1220dc['shift']());}};_0x264ada(++_0x448145);}(_0xc827,0x159));var _0x7c82=function(_0xcc62e,_0x440045){_0xcc62e=_0xcc62e-0x0;var _0x2917ab=_0xc827[_0xcc62e];return _0x2917ab;};'use strict';var moment=require(_0x7c82('0x0'));var Sequelize=require(_0x7c82('0x1'));module[_0x7c82('0x2')]={'uniqueid':{'type':Sequelize[_0x7c82('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x7c82('0x4')](_0x7c82('0x5'),_0x7c82('0x6'),_0x7c82('0x7')),'allowNull':![],'defaultValue':_0x7c82('0x7')},'transferredAt':{'type':Sequelize[_0x7c82('0x8')],'allowNull':![],'defaultValue':Sequelize[_0x7c82('0x9')]}}; \ No newline at end of file +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 diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 81ae65c..d15cf3b 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 _0x7b8f=['moment','mustache','path','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','key','model','keys','query','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','options','count','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x4bf56f,_0x5980db){var _0x404dca=function(_0x4caada){while(--_0x4caada){_0x4bf56f['push'](_0x4bf56f['shift']());}};_0x404dca(++_0x5980db);}(_0x7b8f,0x167));var _0xf7b8=function(_0x326ef2,_0x19f21d){_0x326ef2=_0x326ef2-0x0;var _0x16e0d7=_0x7b8f[_0x326ef2];return _0x16e0d7;};'use strict';var pdf=require(_0xf7b8('0x0'));var emlformat=require(_0xf7b8('0x1'));var rimraf=require(_0xf7b8('0x2'));var zipdir=require(_0xf7b8('0x3'));var jsonpatch=require(_0xf7b8('0x4'));var rp=require(_0xf7b8('0x5'));var moment=require(_0xf7b8('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xf7b8('0x7'));var util=require('util');var path=require(_0xf7b8('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xf7b8('0x9'));var squel=require(_0xf7b8('0xa'));var crypto=require(_0xf7b8('0xb'));var jsforce=require(_0xf7b8('0xc'));var deskjs=require(_0xf7b8('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf7b8('0xe'));var Redis=require(_0xf7b8('0xf'));var authService=require(_0xf7b8('0x10'));var qs=require(_0xf7b8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf7b8('0x12'));var logger=require('../../config/logger')(_0xf7b8('0x13'));var utils=require(_0xf7b8('0x14'));var config=require('../../config/environment');var db=require(_0xf7b8('0x15'))['db'];function respondWithStatusCode(_0x361838,_0x194560){_0x194560=_0x194560||0xcc;return function(_0x5474cd){if(_0x5474cd){return _0x361838[_0xf7b8('0x16')](_0x194560);}return _0x361838[_0xf7b8('0x17')](_0x194560)[_0xf7b8('0x18')]();};}function respondWithResult(_0x2cae6e,_0xee9834){_0xee9834=_0xee9834||0xc8;return function(_0x3b42ff){if(_0x3b42ff){return _0x2cae6e[_0xf7b8('0x17')](_0xee9834)[_0xf7b8('0x19')](_0x3b42ff);}};}function respondWithFilteredResult(_0x23bb18,_0x535651){return function(_0x23358e){if(_0x23358e){var _0x2d305e=_0x23358e['count'],_0x33ae96=_0x535651[_0xf7b8('0x1a')],_0x26a28f=_0x535651['offset']+_0x535651[_0xf7b8('0x1b')],_0x102298;if(_0x26a28f>=_0x2d305e){_0x26a28f=_0x2d305e;_0x102298=0xc8;}else{_0x102298=0xce;}_0x23bb18[_0xf7b8('0x17')](_0x102298);return _0x23bb18['set'](_0xf7b8('0x1c'),_0x33ae96+'-'+_0x26a28f+'/'+_0x2d305e)['json'](_0x23358e);}return null;};}function patchUpdates(_0x482371){return function(_0x248b52){try{jsonpatch['apply'](_0x248b52,_0x482371,!![]);}catch(_0x651272){return BPromise[_0xf7b8('0x1d')](_0x651272);}return _0x248b52[_0xf7b8('0x1e')]();};}function saveUpdates(_0x239953,_0x48d7ee){return function(_0x58893a){if(_0x58893a){return _0x58893a[_0xf7b8('0x1f')](_0x239953)[_0xf7b8('0x20')](function(_0x363991){return _0x363991;});}return null;};}function removeEntity(_0x413021,_0x27b5b3){return function(_0x3f9f9b){if(_0x3f9f9b){return _0x3f9f9b[_0xf7b8('0x21')]()[_0xf7b8('0x20')](function(){_0x413021[_0xf7b8('0x17')](0xcc)[_0xf7b8('0x18')]();});}};}function handleEntityNotFound(_0x1004d6,_0x2efc0a){return function(_0x1d92fd){if(!_0x1d92fd){_0x1004d6[_0xf7b8('0x16')](0x194);}return _0x1d92fd;};}function handleError(_0x469bcb,_0x3e46f5){_0x3e46f5=_0x3e46f5||0x1f4;return function(_0x3d6d6f){logger['error'](_0x3d6d6f[_0xf7b8('0x22')]);if(_0x3d6d6f[_0xf7b8('0x23')]){delete _0x3d6d6f[_0xf7b8('0x23')];}_0x469bcb['status'](_0x3e46f5)[_0xf7b8('0x24')](_0x3d6d6f);};}exports[_0xf7b8('0x25')]=function(_0x1a4057,_0x13ea71){var _0x1a7d69={},_0x532261={},_0x24de43={'count':0x0,'rows':[]};var _0x3511c0=_[_0xf7b8('0x26')](db[_0xf7b8('0x27')][_0xf7b8('0x28')],function(_0x4c7290){return{'name':_0x4c7290[_0xf7b8('0x29')],'type':_0x4c7290['type'][_0xf7b8('0x2a')]};});_0x532261[_0xf7b8('0x2b')]=_['map'](_0x3511c0,_0xf7b8('0x23'));_0x532261['query']=_[_0xf7b8('0x2c')](_0x1a4057[_0xf7b8('0x2d')]);_0x532261['filters']=_[_0xf7b8('0x2e')](_0x532261['model'],_0x532261[_0xf7b8('0x2d')]);_0x1a7d69['attributes']=_[_0xf7b8('0x2e')](_0x532261[_0xf7b8('0x2b')],qs[_0xf7b8('0x2f')](_0x1a4057['query']['fields']));_0x1a7d69['attributes']=_0x1a7d69['attributes'][_0xf7b8('0x30')]?_0x1a7d69[_0xf7b8('0x31')]:_0x532261[_0xf7b8('0x2b')];if(!_0x1a4057[_0xf7b8('0x2d')][_0xf7b8('0x32')](_0xf7b8('0x33'))){_0x1a7d69['limit']=qs[_0xf7b8('0x1b')](_0x1a4057[_0xf7b8('0x2d')]['limit']);_0x1a7d69[_0xf7b8('0x1a')]=qs[_0xf7b8('0x1a')](_0x1a4057[_0xf7b8('0x2d')][_0xf7b8('0x1a')]);}_0x1a7d69[_0xf7b8('0x34')]=qs[_0xf7b8('0x35')](_0x1a4057[_0xf7b8('0x2d')]['sort']);_0x1a7d69[_0xf7b8('0x36')]=qs['filters'](_[_0xf7b8('0x37')](_0x1a4057['query'],_0x532261[_0xf7b8('0x38')]));if(_0x1a4057['query'][_0xf7b8('0x39')]){_0x1a7d69[_0xf7b8('0x36')]=_[_0xf7b8('0x3a')](_0x1a7d69['where'],{'$or':_[_0xf7b8('0x26')](_0x3511c0,function(_0x46662b){if(_0x46662b[_0xf7b8('0x3b')]!=='VIRTUAL'){var _0x383f79={};_0x383f79[_0x46662b[_0xf7b8('0x23')]]={'$like':'%'+_0x1a4057[_0xf7b8('0x2d')][_0xf7b8('0x39')]+'%'};return _0x383f79;}})});}_0x1a7d69=_['merge']({},_0x1a7d69,_0x1a4057[_0xf7b8('0x3c')]);var _0x232610={'where':_0x1a7d69['where']};return db['FaxTransferReport'][_0xf7b8('0x3d')](_0x232610)['then'](function(_0x18906d){_0x24de43[_0xf7b8('0x3d')]=_0x18906d;if(_0x1a4057[_0xf7b8('0x2d')][_0xf7b8('0x3e')]){_0x1a7d69[_0xf7b8('0x3f')]=[{'all':!![]}];}return db[_0xf7b8('0x27')][_0xf7b8('0x40')](_0x1a7d69);})[_0xf7b8('0x20')](function(_0x414d4b){_0x24de43[_0xf7b8('0x41')]=_0x414d4b;return _0x24de43;})[_0xf7b8('0x20')](respondWithFilteredResult(_0x13ea71,_0x1a7d69))[_0xf7b8('0x42')](handleError(_0x13ea71,null));};exports[_0xf7b8('0x43')]=function(_0x1f2b6d,_0x42be00){var _0x12d5db={'raw':!![],'where':{'id':_0x1f2b6d['params']['id']}},_0x5ee07d={};_0x5ee07d[_0xf7b8('0x2b')]=_[_0xf7b8('0x2c')](db['FaxTransferReport'][_0xf7b8('0x28')]);_0x5ee07d['query']=_[_0xf7b8('0x2c')](_0x1f2b6d['query']);_0x5ee07d[_0xf7b8('0x38')]=_[_0xf7b8('0x2e')](_0x5ee07d['model'],_0x5ee07d['query']);_0x12d5db['attributes']=_[_0xf7b8('0x2e')](_0x5ee07d['model'],qs[_0xf7b8('0x2f')](_0x1f2b6d['query']['fields']));_0x12d5db[_0xf7b8('0x31')]=_0x12d5db[_0xf7b8('0x31')]['length']?_0x12d5db[_0xf7b8('0x31')]:_0x5ee07d[_0xf7b8('0x2b')];if(_0x1f2b6d[_0xf7b8('0x2d')]['includeAll']){_0x12d5db[_0xf7b8('0x3f')]=[{'all':!![]}];}_0x12d5db=_[_0xf7b8('0x3a')]({},_0x12d5db,_0x1f2b6d[_0xf7b8('0x3c')]);return db[_0xf7b8('0x27')][_0xf7b8('0x44')](_0x12d5db)[_0xf7b8('0x20')](handleEntityNotFound(_0x42be00,null))['then'](respondWithResult(_0x42be00,null))[_0xf7b8('0x42')](handleError(_0x42be00,null));};exports[_0xf7b8('0x45')]=function(_0xad316a,_0xfb3991){return db['FaxTransferReport']['create'](_0xad316a['body'],{})[_0xf7b8('0x20')](respondWithResult(_0xfb3991,0xc9))[_0xf7b8('0x42')](handleError(_0xfb3991,null));};exports[_0xf7b8('0x1f')]=function(_0x45fa8b,_0x40e5c3){if(_0x45fa8b['body']['id']){delete _0x45fa8b['body']['id'];}return db[_0xf7b8('0x27')][_0xf7b8('0x44')]({'where':{'id':_0x45fa8b['params']['id']}})[_0xf7b8('0x20')](handleEntityNotFound(_0x40e5c3,null))[_0xf7b8('0x20')](saveUpdates(_0x45fa8b[_0xf7b8('0x46')],null))[_0xf7b8('0x20')](respondWithResult(_0x40e5c3,null))[_0xf7b8('0x42')](handleError(_0x40e5c3,null));};exports[_0xf7b8('0x21')]=function(_0x5b602d,_0x14089b){return db[_0xf7b8('0x27')][_0xf7b8('0x44')]({'where':{'id':_0x5b602d[_0xf7b8('0x47')]['id']}})[_0xf7b8('0x20')](handleEntityNotFound(_0x14089b,null))['then'](removeEntity(_0x14089b,null))[_0xf7b8('0x42')](handleError(_0x14089b,null));};exports[_0xf7b8('0x48')]=function(_0x5a48ae,_0x48491c){return db[_0xf7b8('0x27')][_0xf7b8('0x48')]()[_0xf7b8('0x20')](respondWithResult(_0x48491c,null))[_0xf7b8('0x42')](handleError(_0x48491c,null));}; \ No newline at end of file +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 diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 8d62cf0..1fe599c 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 _0xe041=['../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','lodash','util','api','bluebird','request-promise','path'];(function(_0x7b6c4b,_0x355fcd){var _0x32e4be=function(_0x5a5bbb){while(--_0x5a5bbb){_0x7b6c4b['push'](_0x7b6c4b['shift']());}};_0x32e4be(++_0x355fcd);}(_0xe041,0x17b));var _0x1e04=function(_0x3e51e9,_0x3fb767){_0x3e51e9=_0x3e51e9-0x0;var _0x316eb1=_0xe041[_0x3e51e9];return _0x316eb1;};'use strict';var _=require(_0x1e04('0x0'));var util=require(_0x1e04('0x1'));var logger=require('../../config/logger')(_0x1e04('0x2'));var moment=require('moment');var BPromise=require(_0x1e04('0x3'));var rp=require(_0x1e04('0x4'));var fs=require('fs');var path=require(_0x1e04('0x5'));var rimraf=require('rimraf');var config=require(_0x1e04('0x6'));var attributes=require(_0x1e04('0x7'));module[_0x1e04('0x8')]=function(_0xbb179e,_0x1f8b6c){return _0xbb179e[_0x1e04('0x9')](_0x1e04('0xa'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 139576b..ca07280 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 _0x3ce7=['info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','request','then'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x3ce7,0x19b));var _0x73ce=function(_0x1e58cf,_0x30af86){_0x1e58cf=_0x1e58cf-0x0;var _0x3e4bf1=_0x3ce7[_0x1e58cf];return _0x3e4bf1;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x73ce('0x0'));var rs=require(_0x73ce('0x1'));var fs=require('fs');var Redis=require(_0x73ce('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x73ce('0x3'));var logger=require(_0x73ce('0x4'))('rpc');var config=require(_0x73ce('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x73ce('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14438c,_0x5605d9,_0x57a566){return new BPromise(function(_0x1c8c8b,_0x47aa37){return client[_0x73ce('0x7')](_0x14438c,_0x57a566)[_0x73ce('0x8')](function(_0x142cf0){logger[_0x73ce('0x9')](_0x73ce('0xa'),_0x5605d9,_0x73ce('0xb'));logger[_0x73ce('0xc')](_0x73ce('0xd'),_0x5605d9,_0x73ce('0xb'),JSON[_0x73ce('0xe')](_0x142cf0));if(_0x142cf0[_0x73ce('0xf')]){if(_0x142cf0[_0x73ce('0xf')][_0x73ce('0x10')]===0x1f4){logger[_0x73ce('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x5605d9,_0x142cf0[_0x73ce('0xf')][_0x73ce('0x11')]);return _0x47aa37(_0x142cf0[_0x73ce('0xf')][_0x73ce('0x11')]);}logger[_0x73ce('0xf')](_0x73ce('0xa'),_0x5605d9,_0x142cf0[_0x73ce('0xf')][_0x73ce('0x11')]);return _0x1c8c8b(_0x142cf0['error'][_0x73ce('0x11')]);}else{logger[_0x73ce('0x9')](_0x73ce('0xa'),_0x5605d9,_0x73ce('0xb'));_0x1c8c8b(_0x142cf0[_0x73ce('0x12')][_0x73ce('0x11')]);}})[_0x73ce('0x13')](function(_0x2e9aa7){logger['error'](_0x73ce('0xa'),_0x5605d9,_0x2e9aa7);_0x47aa37(_0x2e9aa7);});});} \ No newline at end of file +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 diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 71a03fd..d63aee6 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 _0x3013=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index','/describe','describe','isAuthenticated','post','create','/:id'];(function(_0x210f2d,_0x56734b){var _0xab3da6=function(_0x1bed8b){while(--_0x1bed8b){_0x210f2d['push'](_0x210f2d['shift']());}};_0xab3da6(++_0x56734b);}(_0x3013,0xc1));var _0x3301=function(_0xcc2445,_0x3b9c15){_0xcc2445=_0xcc2445-0x0;var _0x495b14=_0x3013[_0xcc2445];return _0x495b14;};'use strict';var multer=require('multer');var util=require(_0x3301('0x0'));var path=require(_0x3301('0x1'));var timeout=require(_0x3301('0x2'));var express=require(_0x3301('0x3'));var router=express[_0x3301('0x4')]();var auth=require(_0x3301('0x5'));var interaction=require(_0x3301('0x6'));var config=require(_0x3301('0x7'));var controller=require(_0x3301('0x8'));router[_0x3301('0x9')]('/',auth['isAuthenticated'](),controller[_0x3301('0xa')]);router[_0x3301('0x9')](_0x3301('0xb'),auth['isAuthenticated'](),controller[_0x3301('0xc')]);router[_0x3301('0x9')]('/:id',auth[_0x3301('0xd')](),controller['show']);router[_0x3301('0xe')]('/',auth[_0x3301('0xd')](),controller[_0x3301('0xf')]);router['put'](_0x3301('0x10'),auth[_0x3301('0xd')](),controller[_0x3301('0x11')]);router[_0x3301('0x12')](_0x3301('0x10'),auth['isAuthenticated'](),controller[_0x3301('0x13')]);module[_0x3301('0x14')]=router; \ No newline at end of file +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 diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index c6b545a..802c3cf 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 _0x2fed=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put'];(function(_0xc676a2,_0x356fbc){var _0x3d464c=function(_0x15ec64){while(--_0x15ec64){_0xc676a2['push'](_0xc676a2['shift']());}};_0x3d464c(++_0x356fbc);}(_0x2fed,0x7c));var _0xd2fe=function(_0x14ea78,_0x237bfd){_0x14ea78=_0x14ea78-0x0;var _0x2bf0b0=_0x2fed[_0x14ea78];return _0x2bf0b0;};'use strict';var multer=require(_0xd2fe('0x0'));var util=require(_0xd2fe('0x1'));var path=require(_0xd2fe('0x2'));var timeout=require(_0xd2fe('0x3'));var express=require(_0xd2fe('0x4'));var router=express['Router']();var auth=require(_0xd2fe('0x5'));var interaction=require(_0xd2fe('0x6'));var config=require('../../config/environment');var controller=require('./intDeskAccount.controller');router[_0xd2fe('0x7')]('/',auth[_0xd2fe('0x8')](),controller[_0xd2fe('0x9')]);router['get'](_0xd2fe('0xa'),auth[_0xd2fe('0x8')](),controller[_0xd2fe('0xb')]);router[_0xd2fe('0x7')]('/:id/configurations',auth[_0xd2fe('0x8')](),controller[_0xd2fe('0xc')]);router[_0xd2fe('0x7')](_0xd2fe('0xd'),auth[_0xd2fe('0x8')](),controller[_0xd2fe('0xe')]);router[_0xd2fe('0xf')]('/',auth[_0xd2fe('0x8')](),controller[_0xd2fe('0x10')]);router[_0xd2fe('0xf')](_0xd2fe('0x11'),auth[_0xd2fe('0x8')](),controller[_0xd2fe('0x12')]);router[_0xd2fe('0x13')](_0xd2fe('0xa'),auth[_0xd2fe('0x8')](),controller[_0xd2fe('0x14')]);router[_0xd2fe('0x15')]('/:id',auth[_0xd2fe('0x8')](),controller[_0xd2fe('0x16')]);module[_0xd2fe('0x17')]=router; \ No newline at end of file +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 diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index df91b02..5c240d7 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 _0x75cd=['exports','STRING','ENUM','basic','integrationTab','newTab','sequelize'];(function(_0x4358cb,_0x1f1c23){var _0x59a7e4=function(_0x5a1e15){while(--_0x5a1e15){_0x4358cb['push'](_0x4358cb['shift']());}};_0x59a7e4(++_0x1f1c23);}(_0x75cd,0x1bf));var _0xd75c=function(_0x322f4e,_0x48c0a4){_0x322f4e=_0x322f4e-0x0;var _0xc14d3=_0x75cd[_0x322f4e];return _0xc14d3;};'use strict';var Sequelize=require(_0xd75c('0x0'));module[_0xd75c('0x1')]={'name':{'type':Sequelize[_0xd75c('0x2')]},'description':{'type':Sequelize[_0xd75c('0x2')]},'username':{'type':Sequelize[_0xd75c('0x2')]},'remoteUri':{'type':Sequelize[_0xd75c('0x2')]},'authType':{'type':Sequelize[_0xd75c('0x3')](_0xd75c('0x4')),'defaultValue':_0xd75c('0x4')},'password':{'type':Sequelize[_0xd75c('0x2')]},'consumerKey':{'type':Sequelize[_0xd75c('0x2')]},'consumerSecret':{'type':Sequelize[_0xd75c('0x2')]},'token':{'type':Sequelize[_0xd75c('0x2')]},'tokenSecret':{'type':Sequelize[_0xd75c('0x2')]},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0xd75c('0x5'),_0xd75c('0x6')),'defaultValue':_0xd75c('0x5')}}; \ No newline at end of file +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 diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 6d64d0b..7c38f78 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 _0x72f0=['zip-dir','fast-json-patch','request-promise','util','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','save','update','then','end','stack','name','send','map','DeskAccount','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','length','merge','find','create','body','destroy','getConfigurations','order','filter','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskConfiguration','DeskField','getFields','priority','remoteUri','authType','consumerSecret','tokenSecret','substring','lastIndexOf','GET','%s/custom_fields','application/json','basic','Authorization','format','Basic\x20%s','%s:%s','username','password','toString','base64','concat','_embedded','entries','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf'];(function(_0x1906f5,_0x2bb6bd){var _0x4c7f21=function(_0x291960){while(--_0x291960){_0x1906f5['push'](_0x1906f5['shift']());}};_0x4c7f21(++_0x2bb6bd);}(_0x72f0,0x76));var _0x072f=function(_0x225f50,_0x48a77d){_0x225f50=_0x225f50-0x0;var _0x19d003=_0x72f0[_0x225f50];return _0x19d003;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x072f('0x0'));var rimraf=require(_0x072f('0x1'));var zipdir=require(_0x072f('0x2'));var jsonpatch=require(_0x072f('0x3'));var rp=require(_0x072f('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x072f('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x072f('0x6'));var ejs=require(_0x072f('0x7'));var fs=require('fs');var _=require(_0x072f('0x8'));var squel=require(_0x072f('0x9'));var crypto=require(_0x072f('0xa'));var jsforce=require(_0x072f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x072f('0x6'));var querystring=require(_0x072f('0xc'));var Papa=require(_0x072f('0xd'));var Redis=require('ioredis');var authService=require(_0x072f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x072f('0xf'));var logger=require('../../config/logger')(_0x072f('0x10'));var utils=require('../../config/utils');var config=require(_0x072f('0x11'));var db=require(_0x072f('0x12'))['db'];var integrations=require(_0x072f('0x13'));var jayson=require(_0x072f('0x14'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0xad0787,_0x25ea36,_0x4d0e1c){if(_0x4d0e1c){var _0x37bb61=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x37bb61['test'](_0x25ea36)){return _0xad0787;}else{throw new db[(_0x072f('0x15'))]['ValidationError'](_0x072f('0x16'));}}else{return _0xad0787;}}function respondWithRpcPromise(_0x28d28b,_0x3fac68,_0x350f4f,_0x1ed1ca){return new BPromise(function(_0x4a81a2,_0x22b39a){var _0x546afd=_0x1ed1ca||client;return _0x546afd[_0x072f('0x17')](_0x28d28b,_0x350f4f)['then'](function(_0x24118a){logger[_0x072f('0x18')](_0x072f('0x19'),_0x3fac68,_0x072f('0x1a'));logger[_0x072f('0x1b')](_0x072f('0x1c'),_0x3fac68,_0x072f('0x1a'),JSON[_0x072f('0x1d')](_0x24118a));if(_0x24118a[_0x072f('0x1e')]){if(_0x24118a[_0x072f('0x1e')][_0x072f('0x1f')]===0x1f4){logger[_0x072f('0x1e')](_0x072f('0x19'),_0x3fac68,_0x24118a['error'][_0x072f('0x20')]);return _0x22b39a(_0x24118a[_0x072f('0x1e')][_0x072f('0x20')]);}logger[_0x072f('0x1e')](_0x072f('0x19'),_0x3fac68,_0x24118a['error'][_0x072f('0x20')]);return _0x4a81a2(_0x24118a['error']['message']);}else{logger[_0x072f('0x18')]('DeskAccount,\x20%s,\x20%s',_0x3fac68,_0x072f('0x1a'));_0x4a81a2(_0x24118a['result'][_0x072f('0x20')]);}})[_0x072f('0x21')](function(_0x476926){logger['error'](_0x072f('0x19'),_0x3fac68,_0x476926);_0x22b39a(_0x476926);});});}function respondWithStatusCode(_0x15b756,_0x4fb445){_0x4fb445=_0x4fb445||0xcc;return function(_0x5057dd){if(_0x5057dd){return _0x15b756[_0x072f('0x22')](_0x4fb445);}return _0x15b756[_0x072f('0x23')](_0x4fb445)['end']();};}function respondWithResult(_0x28612c,_0x483f21){_0x483f21=_0x483f21||0xc8;return function(_0x58241b){if(_0x58241b){return _0x28612c[_0x072f('0x23')](_0x483f21)['json'](_0x58241b);}};}function respondWithFilteredResult(_0x3d186f,_0x267b70){return function(_0x3e5dbc){if(_0x3e5dbc){var _0x3bf25f=_0x3e5dbc[_0x072f('0x24')],_0x437a40=_0x267b70[_0x072f('0x25')],_0x147916=_0x267b70[_0x072f('0x25')]+_0x267b70[_0x072f('0x26')],_0x4b7a40;if(_0x147916>=_0x3bf25f){_0x147916=_0x3bf25f;_0x4b7a40=0xc8;}else{_0x4b7a40=0xce;}_0x3d186f[_0x072f('0x23')](_0x4b7a40);return _0x3d186f[_0x072f('0x27')](_0x072f('0x28'),_0x437a40+'-'+_0x147916+'/'+_0x3bf25f)[_0x072f('0x29')](_0x3e5dbc);}return null;};}function patchUpdates(_0x3fe96e){return function(_0x228723){try{jsonpatch[_0x072f('0x2a')](_0x228723,_0x3fe96e,!![]);}catch(_0x91af4f){return BPromise['reject'](_0x91af4f);}return _0x228723[_0x072f('0x2b')]();};}function saveUpdates(_0x1b60bc,_0x3cabf9){return function(_0x2df375){if(_0x2df375){return _0x2df375[_0x072f('0x2c')](_0x1b60bc)[_0x072f('0x2d')](function(_0xb7d77c){return _0xb7d77c;});}return null;};}function removeEntity(_0x59aee8,_0x59576a){return function(_0x488ee0){if(_0x488ee0){return _0x488ee0['destroy']()[_0x072f('0x2d')](function(){_0x59aee8['status'](0xcc)[_0x072f('0x2e')]();});}};}function handleEntityNotFound(_0x3eac01,_0x468c6b){return function(_0x29c881){if(!_0x29c881){_0x3eac01[_0x072f('0x22')](0x194);}return _0x29c881;};}function handleError(_0x2544b6,_0x1d0128){_0x1d0128=_0x1d0128||0x1f4;return function(_0x5abc74){logger['error'](_0x5abc74[_0x072f('0x2f')]);if(_0x5abc74[_0x072f('0x30')]){delete _0x5abc74[_0x072f('0x30')];}_0x2544b6[_0x072f('0x23')](_0x1d0128)[_0x072f('0x31')](_0x5abc74);};}exports['index']=function(_0x5c0ae2,_0x491138){var _0x2e41fc={},_0x2a99f4={},_0xffd52e={'count':0x0,'rows':[]};var _0x536957=_[_0x072f('0x32')](db[_0x072f('0x33')][_0x072f('0x34')],function(_0x14bae3){return{'name':_0x14bae3['fieldName'],'type':_0x14bae3[_0x072f('0x35')][_0x072f('0x36')]};});_0x2a99f4[_0x072f('0x37')]=_['map'](_0x536957,_0x072f('0x30'));_0x2a99f4[_0x072f('0x38')]=_['keys'](_0x5c0ae2[_0x072f('0x38')]);_0x2a99f4['filters']=_[_0x072f('0x39')](_0x2a99f4[_0x072f('0x37')],_0x2a99f4[_0x072f('0x38')]);_0x2e41fc[_0x072f('0x3a')]=_[_0x072f('0x39')](_0x2a99f4[_0x072f('0x37')],qs[_0x072f('0x3b')](_0x5c0ae2[_0x072f('0x38')][_0x072f('0x3b')]));_0x2e41fc[_0x072f('0x3a')]=_0x2e41fc['attributes']['length']?_0x2e41fc[_0x072f('0x3a')]:_0x2a99f4[_0x072f('0x37')];if(!_0x5c0ae2[_0x072f('0x38')][_0x072f('0x3c')](_0x072f('0x3d'))){_0x2e41fc[_0x072f('0x26')]=qs[_0x072f('0x26')](_0x5c0ae2['query'][_0x072f('0x26')]);_0x2e41fc[_0x072f('0x25')]=qs[_0x072f('0x25')](_0x5c0ae2['query'][_0x072f('0x25')]);}_0x2e41fc['order']=qs['sort'](_0x5c0ae2[_0x072f('0x38')][_0x072f('0x3e')]);_0x2e41fc[_0x072f('0x3f')]=qs[_0x072f('0x40')](_[_0x072f('0x41')](_0x5c0ae2[_0x072f('0x38')],_0x2a99f4[_0x072f('0x40')]));if(_0x5c0ae2[_0x072f('0x38')]['filter']){_0x2e41fc[_0x072f('0x3f')]=_['merge'](_0x2e41fc[_0x072f('0x3f')],{'$or':_[_0x072f('0x32')](_0x536957,function(_0x14381a){if(_0x14381a[_0x072f('0x35')]!==_0x072f('0x42')){var _0x1ff87f={};_0x1ff87f[_0x14381a[_0x072f('0x30')]]={'$like':'%'+_0x5c0ae2[_0x072f('0x38')]['filter']+'%'};return _0x1ff87f;}})});}_0x2e41fc=_['merge']({},_0x2e41fc,_0x5c0ae2[_0x072f('0x43')]);var _0xadd457={'where':_0x2e41fc[_0x072f('0x3f')]};return db[_0x072f('0x33')][_0x072f('0x24')](_0xadd457)[_0x072f('0x2d')](function(_0x1600da){_0xffd52e[_0x072f('0x24')]=_0x1600da;if(_0x5c0ae2[_0x072f('0x38')][_0x072f('0x44')]){_0x2e41fc[_0x072f('0x45')]=[{'all':!![]}];}return db['DeskAccount'][_0x072f('0x46')](_0x2e41fc);})[_0x072f('0x2d')](function(_0x21cb86){_0xffd52e[_0x072f('0x47')]=_0x21cb86;return _0xffd52e;})[_0x072f('0x2d')](respondWithFilteredResult(_0x491138,_0x2e41fc))['catch'](handleError(_0x491138,null));};exports[_0x072f('0x48')]=function(_0x2f7ee0,_0x352fe6){var _0x3cc298={'raw':![],'where':{'id':_0x2f7ee0[_0x072f('0x49')]['id']}},_0x32c8a8={};_0x32c8a8[_0x072f('0x37')]=_[_0x072f('0x4a')](db[_0x072f('0x33')][_0x072f('0x34')]);_0x32c8a8[_0x072f('0x38')]=_['keys'](_0x2f7ee0['query']);_0x32c8a8[_0x072f('0x40')]=_[_0x072f('0x39')](_0x32c8a8['model'],_0x32c8a8['query']);_0x3cc298[_0x072f('0x3a')]=_['intersection'](_0x32c8a8[_0x072f('0x37')],qs[_0x072f('0x3b')](_0x2f7ee0[_0x072f('0x38')][_0x072f('0x3b')]));_0x3cc298[_0x072f('0x3a')]=_0x3cc298[_0x072f('0x3a')][_0x072f('0x4b')]?_0x3cc298[_0x072f('0x3a')]:_0x32c8a8[_0x072f('0x37')];if(_0x2f7ee0[_0x072f('0x38')][_0x072f('0x44')]){_0x3cc298[_0x072f('0x45')]=[{'all':!![]}];}_0x3cc298=_[_0x072f('0x4c')]({},_0x3cc298,_0x2f7ee0[_0x072f('0x43')]);return db[_0x072f('0x33')][_0x072f('0x4d')](_0x3cc298)[_0x072f('0x2d')](handleEntityNotFound(_0x352fe6,null))[_0x072f('0x2d')](respondWithResult(_0x352fe6,null))[_0x072f('0x21')](handleError(_0x352fe6,null));};exports[_0x072f('0x4e')]=function(_0x547af3,_0x8bf9f8){return db[_0x072f('0x33')][_0x072f('0x4e')](_0x547af3['body'],{})['then'](respondWithResult(_0x8bf9f8,0xc9))[_0x072f('0x21')](handleError(_0x8bf9f8,null));};exports[_0x072f('0x2c')]=function(_0x40f4e0,_0x533b61){if(_0x40f4e0[_0x072f('0x4f')]['id']){delete _0x40f4e0['body']['id'];}return db[_0x072f('0x33')][_0x072f('0x4d')]({'where':{'id':_0x40f4e0[_0x072f('0x49')]['id']}})['then'](handleEntityNotFound(_0x533b61,null))[_0x072f('0x2d')](saveUpdates(_0x40f4e0[_0x072f('0x4f')],null))[_0x072f('0x2d')](respondWithResult(_0x533b61,null))[_0x072f('0x21')](handleError(_0x533b61,null));};exports[_0x072f('0x50')]=function(_0x5e30c3,_0x58bea1){return db[_0x072f('0x33')][_0x072f('0x4d')]({'where':{'id':_0x5e30c3['params']['id']}})[_0x072f('0x2d')](handleEntityNotFound(_0x58bea1,null))[_0x072f('0x2d')](removeEntity(_0x58bea1,null))[_0x072f('0x21')](handleError(_0x58bea1,null));};exports[_0x072f('0x51')]=function(_0x2431fa,_0x5487ff,_0x6192f4){var _0xbb0c85={};var _0x384dca={};var _0x45178a;var _0xc4fc0c;return db[_0x072f('0x33')]['findOne']({'where':{'id':_0x2431fa[_0x072f('0x49')]['id']}})[_0x072f('0x2d')](handleEntityNotFound(_0x5487ff,null))[_0x072f('0x2d')](function(_0x3c1162){if(_0x3c1162){_0x45178a=_0x3c1162;_0x384dca['model']=_[_0x072f('0x4a')](db['DeskConfiguration'][_0x072f('0x34')]);_0x384dca['query']=_[_0x072f('0x4a')](_0x2431fa['query']);_0x384dca[_0x072f('0x40')]=_[_0x072f('0x39')](_0x384dca[_0x072f('0x37')],_0x384dca[_0x072f('0x38')]);_0xbb0c85[_0x072f('0x3a')]=_[_0x072f('0x39')](_0x384dca[_0x072f('0x37')],qs[_0x072f('0x3b')](_0x2431fa['query'][_0x072f('0x3b')]));_0xbb0c85[_0x072f('0x3a')]=_0xbb0c85[_0x072f('0x3a')]['length']?_0xbb0c85[_0x072f('0x3a')]:_0x384dca[_0x072f('0x37')];_0xbb0c85[_0x072f('0x52')]=qs['sort'](_0x2431fa['query'][_0x072f('0x3e')]);_0xbb0c85[_0x072f('0x3f')]=qs[_0x072f('0x40')](_[_0x072f('0x41')](_0x2431fa[_0x072f('0x38')],_0x384dca[_0x072f('0x40')]));if(_0x2431fa[_0x072f('0x38')][_0x072f('0x53')]){_0xbb0c85[_0x072f('0x3f')]=_[_0x072f('0x4c')](_0xbb0c85[_0x072f('0x3f')],{'$or':_[_0x072f('0x32')](_0xbb0c85['attributes'],function(_0x53fe4c){var _0x69f118={};_0x69f118[_0x53fe4c]={'$like':'%'+_0x2431fa[_0x072f('0x38')][_0x072f('0x53')]+'%'};return _0x69f118;})});}_0xbb0c85=_[_0x072f('0x4c')]({},_0xbb0c85,_0x2431fa['options']);return _0x45178a['getConfigurations'](_0xbb0c85);}})[_0x072f('0x2d')](function(_0x41ab8d){if(_0x41ab8d){_0xc4fc0c=_0x41ab8d['length'];if(!_0x2431fa[_0x072f('0x38')][_0x072f('0x3c')]('nolimit')){_0xbb0c85[_0x072f('0x26')]=qs[_0x072f('0x26')](_0x2431fa[_0x072f('0x38')][_0x072f('0x26')]);_0xbb0c85[_0x072f('0x25')]=qs[_0x072f('0x25')](_0x2431fa['query'][_0x072f('0x25')]);}return _0x45178a[_0x072f('0x51')](_0xbb0c85);}})[_0x072f('0x2d')](function(_0x26af65){if(_0x26af65){return _0x26af65?{'count':_0xc4fc0c,'rows':_0x26af65}:null;}})['then'](respondWithResult(_0x5487ff,null))[_0x072f('0x21')](handleError(_0x5487ff,null));};exports[_0x072f('0x54')]=function(_0x4381fc,_0x292e9f,_0x260759){if(_0x4381fc['body']['id']){delete _0x4381fc['body']['id'];}return db[_0x072f('0x33')]['findOne']({'where':{'id':_0x4381fc[_0x072f('0x49')]['id']}})[_0x072f('0x2d')](handleEntityNotFound(_0x292e9f,null))[_0x072f('0x2d')](function(_0x51f84f){if(_0x51f84f){_0x4381fc[_0x072f('0x4f')]['AccountId']=_0x51f84f['id'];_0x4381fc[_0x072f('0x4f')][_0x072f('0x55')]=integrations[_0x072f('0x56')](_0x4381fc[_0x072f('0x4f')][_0x072f('0x57')],_0x4381fc[_0x072f('0x4f')][_0x072f('0x35')]);_0x4381fc[_0x072f('0x4f')][_0x072f('0x58')]=integrations[_0x072f('0x59')](_0x4381fc['body'][_0x072f('0x57')],_0x4381fc[_0x072f('0x4f')][_0x072f('0x35')]);return db[_0x072f('0x5a')]['create'](_0x4381fc['body'],{'include':[{'model':db[_0x072f('0x5b')],'as':_0x072f('0x55')},{'model':db[_0x072f('0x5b')],'as':_0x072f('0x58')}]});}return null;})['then'](respondWithResult(_0x292e9f,null))[_0x072f('0x21')](handleError(_0x292e9f,null));};exports[_0x072f('0x5c')]=function(_0x477205,_0x34479b,_0x5a014d){var _0x8d5715=[{'name':_0x072f('0x5d'),'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 _0x7f167a='';return db[_0x072f('0x33')]['findOne']({'where':{'id':_0x477205['params']['id']},'attributes':['id',_0x072f('0x5e'),_0x072f('0x5f'),'username','password','consumerKey',_0x072f('0x60'),'token',_0x072f('0x61')]})[_0x072f('0x2d')](handleEntityNotFound(_0x34479b,null))[_0x072f('0x2d')](function(_0x286e2d){if(_0x286e2d){_0x7f167a=_0x286e2d[_0x072f('0x5e')];var _0x2474f5=_0x7f167a['slice'](-0x1);if(_0x2474f5==='/'){_0x7f167a=_0x7f167a[_0x072f('0x62')](0x0,_0x7f167a[_0x072f('0x63')](_0x2474f5));}var _0x86de60={'method':_0x072f('0x64'),'uri':util['format'](_0x072f('0x65'),_0x7f167a),'headers':{'Content-Type':'application/json','Accept':_0x072f('0x66')},'json':!![]};if(_0x286e2d[_0x072f('0x5f')]===_0x072f('0x67')){_0x86de60['headers'][_0x072f('0x68')]=util[_0x072f('0x69')](_0x072f('0x6a'),new Buffer(util[_0x072f('0x69')](_0x072f('0x6b'),_0x286e2d[_0x072f('0x6c')],_0x286e2d[_0x072f('0x6d')]))[_0x072f('0x6e')](_0x072f('0x6f')));}return rp(_0x86de60)[_0x072f('0x2d')](function(_0x4e2e27){return _0x8d5715[_0x072f('0x70')](_[_0x072f('0x32')](_0x4e2e27[_0x072f('0x71')][_0x072f('0x72')],function(_0x5945f2){return{'id':_0x5945f2[_0x072f('0x30')],'name':_0x5945f2[_0x072f('0x30')],'type':_0x5945f2[_0x072f('0x35')],'active':_0x5945f2['active'],'label':_0x5945f2[_0x072f('0x73')],'custom':!![]};}));});}})[_0x072f('0x2d')](function(_0x5105bc){return{'count':_0x5105bc['length'],'rows':_0x5105bc};})[_0x072f('0x2d')](respondWithResult(_0x34479b,null))[_0x072f('0x21')](function(_0x28ab52){var _0x1fffdd=_0x477205[_0x072f('0x38')][_0x072f('0x74')]?0x1f4:_0x28ab52[_0x072f('0x75')]||0x1f4;logger[_0x072f('0x1e')](_0x072f('0x76'),_0x072f('0x5c'),_0x1fffdd,JSON['stringify'](_0x28ab52));delete _0x28ab52[_0x072f('0x30')];if(_0x1fffdd===0x191){_0x1fffdd=0x190;}_0x34479b['status'](_0x1fffdd)[_0x072f('0x31')](_0x477205[_0x072f('0x38')][_0x072f('0x74')]?{'message':_0x072f('0x77'),'statusCode':_0x28ab52[_0x072f('0x75')]}:_0x28ab52);});}; \ No newline at end of file +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 diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 5b4d267..2c9ae47 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 _0xc96b=['../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes'];(function(_0x5992b5,_0x21fcc0){var _0x3015da=function(_0x48ff4e){while(--_0x48ff4e){_0x5992b5['push'](_0x5992b5['shift']());}};_0x3015da(++_0x21fcc0);}(_0xc96b,0x185));var _0xbc96=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc96b[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xbc96('0x0'));var util=require(_0xbc96('0x1'));var logger=require(_0xbc96('0x2'))(_0xbc96('0x3'));var moment=require(_0xbc96('0x4'));var BPromise=require(_0xbc96('0x5'));var rp=require(_0xbc96('0x6'));var fs=require('fs');var path=require(_0xbc96('0x7'));var rimraf=require(_0xbc96('0x8'));var config=require(_0xbc96('0x9'));var attributes=require(_0xbc96('0xa'));var integrations=require(_0xbc96('0xb'));module[_0xbc96('0xc')]=function(_0x480d04,_0x30b83f){return _0x480d04[_0xbc96('0xd')](_0xbc96('0xe'),attributes,{'tableName':_0xbc96('0xf'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index f9cca8b..b992410 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 _0xcfba=['bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetDeskAccount','DeskAccount','options','raw','where','attributes','limit','include','map','model','then','ShowDeskAccount','find','lodash','util','moment'];(function(_0x5586f7,_0x252482){var _0x530fbb=function(_0x35f563){while(--_0x35f563){_0x5586f7['push'](_0x5586f7['shift']());}};_0x530fbb(++_0x252482);}(_0xcfba,0xf2));var _0xacfb=function(_0x4be3ef,_0x190a9c){_0x4be3ef=_0x4be3ef-0x0;var _0x48c5eb=_0xcfba[_0x4be3ef];return _0x48c5eb;};'use strict';var _=require(_0xacfb('0x0'));var util=require(_0xacfb('0x1'));var moment=require(_0xacfb('0x2'));var BPromise=require(_0xacfb('0x3'));var rs=require(_0xacfb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xacfb('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xacfb('0x6'));var config=require(_0xacfb('0x7'));var jayson=require(_0xacfb('0x8'));var client=jayson[_0xacfb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c585c,_0xc933a,_0xa46ed6){return new BPromise(function(_0x5dfca3,_0x5a6e95){return client[_0xacfb('0xa')](_0x2c585c,_0xa46ed6)['then'](function(_0x4e8ca4){logger['info'](_0xacfb('0xb'),_0xc933a,_0xacfb('0xc'));logger[_0xacfb('0xd')](_0xacfb('0xe'),_0xc933a,_0xacfb('0xc'),JSON[_0xacfb('0xf')](_0x4e8ca4));if(_0x4e8ca4[_0xacfb('0x10')]){if(_0x4e8ca4['error'][_0xacfb('0x11')]===0x1f4){logger[_0xacfb('0x10')](_0xacfb('0xb'),_0xc933a,_0x4e8ca4[_0xacfb('0x10')][_0xacfb('0x12')]);return _0x5a6e95(_0x4e8ca4[_0xacfb('0x10')][_0xacfb('0x12')]);}logger[_0xacfb('0x10')](_0xacfb('0xb'),_0xc933a,_0x4e8ca4[_0xacfb('0x10')]['message']);return _0x5dfca3(_0x4e8ca4[_0xacfb('0x10')][_0xacfb('0x12')]);}else{logger[_0xacfb('0x13')](_0xacfb('0xb'),_0xc933a,_0xacfb('0xc'));_0x5dfca3(_0x4e8ca4[_0xacfb('0x14')][_0xacfb('0x12')]);}})[_0xacfb('0x15')](function(_0x274b56){logger[_0xacfb('0x10')](_0xacfb('0xb'),_0xc933a,_0x274b56);_0x5a6e95(_0x274b56);});});}exports[_0xacfb('0x16')]=function(_0xf464e1){var _0x2c3c7d=this;return new Promise(function(_0x4acd8b,_0x5b9c85){return db[_0xacfb('0x17')]['findAll']({'raw':_0xf464e1[_0xacfb('0x18')]?_0xf464e1[_0xacfb('0x18')][_0xacfb('0x19')]===undefined?!![]:![]:!![],'where':_0xf464e1[_0xacfb('0x18')]?_0xf464e1[_0xacfb('0x18')][_0xacfb('0x1a')]||null:null,'attributes':_0xf464e1[_0xacfb('0x18')]?_0xf464e1['options'][_0xacfb('0x1b')]||null:null,'limit':_0xf464e1['options']?_0xf464e1['options'][_0xacfb('0x1c')]||null:null,'include':_0xf464e1[_0xacfb('0x18')]?_0xf464e1[_0xacfb('0x18')][_0xacfb('0x1d')]?_[_0xacfb('0x1e')](_0xf464e1[_0xacfb('0x18')][_0xacfb('0x1d')],function(_0x31b286){return{'model':db[_0x31b286['model']],'as':_0x31b286['as'],'attributes':_0x31b286[_0xacfb('0x1b')],'include':_0x31b286['include']?_['map'](_0x31b286[_0xacfb('0x1d')],function(_0xfb4c6e){return{'model':db[_0xfb4c6e[_0xacfb('0x1f')]],'as':_0xfb4c6e['as'],'attributes':_0xfb4c6e[_0xacfb('0x1b')],'include':_0xfb4c6e[_0xacfb('0x1d')]?_['map'](_0xfb4c6e[_0xacfb('0x1d')],function(_0x28da96){return{'model':db[_0x28da96['model']],'as':_0x28da96['as'],'attributes':_0x28da96[_0xacfb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xacfb('0x20')](function(_0x5c43c4){logger[_0xacfb('0x13')](_0xacfb('0x16'),_0xf464e1);logger[_0xacfb('0xd')](_0xacfb('0x16'),_0xf464e1,JSON[_0xacfb('0xf')](_0x5c43c4));_0x4acd8b(_0x5c43c4);})['catch'](function(_0x39ef9a){logger[_0xacfb('0x10')](_0xacfb('0x16'),_0x39ef9a[_0xacfb('0x12')],_0xf464e1);_0x5b9c85(_0x2c3c7d[_0xacfb('0x10')](0x1f4,_0x39ef9a[_0xacfb('0x12')]));});});};exports[_0xacfb('0x21')]=function(_0x2ab6bb){var _0x1c89f5=this;return new Promise(function(_0x1cb5f0,_0x603a00){return db[_0xacfb('0x17')][_0xacfb('0x22')]({'raw':_0x2ab6bb[_0xacfb('0x18')]?_0x2ab6bb[_0xacfb('0x18')][_0xacfb('0x19')]===undefined?!![]:![]:!![],'where':_0x2ab6bb[_0xacfb('0x18')]?_0x2ab6bb[_0xacfb('0x18')][_0xacfb('0x1a')]||null:null,'attributes':_0x2ab6bb['options']?_0x2ab6bb[_0xacfb('0x18')][_0xacfb('0x1b')]||null:null,'include':_0x2ab6bb[_0xacfb('0x18')]?_0x2ab6bb['options']['include']?_['map'](_0x2ab6bb[_0xacfb('0x18')][_0xacfb('0x1d')],function(_0x2ab7d0){return{'model':db[_0x2ab7d0[_0xacfb('0x1f')]],'as':_0x2ab7d0['as'],'attributes':_0x2ab7d0[_0xacfb('0x1b')],'include':_0x2ab7d0[_0xacfb('0x1d')]?_['map'](_0x2ab7d0[_0xacfb('0x1d')],function(_0x23340c){return{'model':db[_0x23340c['model']],'as':_0x23340c['as'],'attributes':_0x23340c[_0xacfb('0x1b')],'include':_0x23340c['include']?_['map'](_0x23340c[_0xacfb('0x1d')],function(_0x52b2bf){return{'model':db[_0x52b2bf[_0xacfb('0x1f')]],'as':_0x52b2bf['as'],'attributes':_0x52b2bf[_0xacfb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xacfb('0x20')](function(_0x174048){logger['info']('ShowDeskAccount',_0x2ab6bb);logger['debug'](_0xacfb('0x21'),_0x2ab6bb,JSON[_0xacfb('0xf')](_0x174048));_0x1cb5f0(_0x174048);})['catch'](function(_0x4f2b4f){logger['error'](_0xacfb('0x21'),_0x4f2b4f['message'],_0x2ab6bb);_0x603a00(_0x1c89f5['error'](0x1f4,_0x4f2b4f[_0xacfb('0x12')]));});});}; \ No newline at end of file +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 diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index dc49cb0..714b68f 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 _0x8aad=['create','put','delete','destroy','multer','util','connect-timeout','Router','../../components/auth/service','./intDeskConfiguration.controller','index','get','/:id','show','/:id/fields','isAuthenticated','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post'];(function(_0x25fefc,_0x44e4b1){var _0x3b95e0=function(_0x5b74ea){while(--_0x5b74ea){_0x25fefc['push'](_0x25fefc['shift']());}};_0x3b95e0(++_0x44e4b1);}(_0x8aad,0x146));var _0xd8aa=function(_0xc879d8,_0x14541f){_0xc879d8=_0xc879d8-0x0;var _0x1582b9=_0x8aad[_0xc879d8];return _0x1582b9;};'use strict';var multer=require(_0xd8aa('0x0'));var util=require(_0xd8aa('0x1'));var path=require('path');var timeout=require(_0xd8aa('0x2'));var express=require('express');var router=express[_0xd8aa('0x3')]();var auth=require(_0xd8aa('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd8aa('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xd8aa('0x6')]);router[_0xd8aa('0x7')](_0xd8aa('0x8'),auth['isAuthenticated'](),controller[_0xd8aa('0x9')]);router[_0xd8aa('0x7')](_0xd8aa('0xa'),auth[_0xd8aa('0xb')](),controller['getFields']);router['get'](_0xd8aa('0xc'),auth[_0xd8aa('0xb')](),controller[_0xd8aa('0xd')]);router[_0xd8aa('0x7')](_0xd8aa('0xe'),auth['isAuthenticated'](),controller[_0xd8aa('0xf')]);router[_0xd8aa('0x7')](_0xd8aa('0x10'),auth[_0xd8aa('0xb')](),controller[_0xd8aa('0x11')]);router[_0xd8aa('0x12')]('/',auth[_0xd8aa('0xb')](),controller[_0xd8aa('0x13')]);router[_0xd8aa('0x12')](_0xd8aa('0x10'),auth['isAuthenticated'](),controller['setTags']);router[_0xd8aa('0x14')](_0xd8aa('0x8'),auth[_0xd8aa('0xb')](),controller['update']);router[_0xd8aa('0x15')](_0xd8aa('0x8'),auth[_0xd8aa('0xb')](),controller[_0xd8aa('0x16')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index ddd4b9a..dc5b098 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 _0xacb2=['STRING','sequelize','exports'];(function(_0x51a4f2,_0x216022){var _0x2026d6=function(_0x20fa5a){while(--_0x20fa5a){_0x51a4f2['push'](_0x51a4f2['shift']());}};_0x2026d6(++_0x216022);}(_0xacb2,0x181));var _0x2acb=function(_0x59d52d,_0x43630c){_0x59d52d=_0x59d52d-0x0;var _0x87b4ed=_0xacb2[_0x59d52d];return _0x87b4ed;};'use strict';var Sequelize=require(_0x2acb('0x0'));module[_0x2acb('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2acb('0x2')]}}; \ No newline at end of file +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 diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index bb15b9b..676a2ba 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 _0x6f55=['keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','where','include','show','params','fields','includeAll','create','body','find','destroy','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','ValidationError','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\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','map','DeskConfiguration','rawAttributes','fieldName','type','model','query'];(function(_0x1068e3,_0x393d9a){var _0x5d01d9=function(_0x11d9b6){while(--_0x11d9b6){_0x1068e3['push'](_0x1068e3['shift']());}};_0x5d01d9(++_0x393d9a);}(_0x6f55,0x1ed));var _0x56f5=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x6f55[_0x50aa2e];return _0x5e07f0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x56f5('0x0'));var zipdir=require(_0x56f5('0x1'));var jsonpatch=require(_0x56f5('0x2'));var rp=require(_0x56f5('0x3'));var moment=require('moment');var BPromise=require(_0x56f5('0x4'));var Mustache=require('mustache');var util=require(_0x56f5('0x5'));var path=require(_0x56f5('0x6'));var sox=require(_0x56f5('0x7'));var csv=require('to-csv');var ejs=require(_0x56f5('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x56f5('0x9'));var jsforce=require(_0x56f5('0xa'));var deskjs=require(_0x56f5('0xb'));var toCsv=require(_0x56f5('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x56f5('0xd'));var qs=require(_0x56f5('0xe'));var as=require(_0x56f5('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x56f5('0x10'));var utils=require(_0x56f5('0x11'));var config=require(_0x56f5('0x12'));var db=require(_0x56f5('0x13'))['db'];var jayson=require(_0x56f5('0x14'));var client=jayson[_0x56f5('0x15')][_0x56f5('0x16')]({'port':0x232a});function checkPasswordPattern(_0x2ec54e,_0x48ea62,_0x393bff){if(_0x393bff){var _0x4b4ea4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4b4ea4[_0x56f5('0x17')](_0x48ea62)){return _0x2ec54e;}else{throw new db['Sequelize'][(_0x56f5('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 _0x2ec54e;}}function respondWithRpcPromise(_0x528df0,_0x11baf1,_0x50c867,_0x402556){return new BPromise(function(_0x3c0f42,_0x35d76d){var _0x415de7=_0x402556||client;return _0x415de7[_0x56f5('0x19')](_0x528df0,_0x50c867)['then'](function(_0x431cc7){logger[_0x56f5('0x1a')](_0x56f5('0x1b'),_0x11baf1,_0x56f5('0x1c'));logger['debug'](_0x56f5('0x1d'),_0x11baf1,_0x56f5('0x1c'),JSON[_0x56f5('0x1e')](_0x431cc7));if(_0x431cc7[_0x56f5('0x1f')]){if(_0x431cc7[_0x56f5('0x1f')]['code']===0x1f4){logger[_0x56f5('0x1f')](_0x56f5('0x1b'),_0x11baf1,_0x431cc7[_0x56f5('0x1f')][_0x56f5('0x20')]);return _0x35d76d(_0x431cc7[_0x56f5('0x1f')][_0x56f5('0x20')]);}logger[_0x56f5('0x1f')](_0x56f5('0x1b'),_0x11baf1,_0x431cc7['error'][_0x56f5('0x20')]);return _0x3c0f42(_0x431cc7['error'][_0x56f5('0x20')]);}else{logger[_0x56f5('0x1a')](_0x56f5('0x1b'),_0x11baf1,_0x56f5('0x1c'));_0x3c0f42(_0x431cc7[_0x56f5('0x21')][_0x56f5('0x20')]);}})[_0x56f5('0x22')](function(_0x301157){logger[_0x56f5('0x1f')](_0x56f5('0x1b'),_0x11baf1,_0x301157);_0x35d76d(_0x301157);});});}function respondWithStatusCode(_0x18460e,_0x2bcb37){_0x2bcb37=_0x2bcb37||0xcc;return function(_0x351a42){if(_0x351a42){return _0x18460e[_0x56f5('0x23')](_0x2bcb37);}return _0x18460e[_0x56f5('0x24')](_0x2bcb37)[_0x56f5('0x25')]();};}function respondWithResult(_0x4b7646,_0x4bb6b7){_0x4bb6b7=_0x4bb6b7||0xc8;return function(_0x218cc1){if(_0x218cc1){return _0x4b7646['status'](_0x4bb6b7)[_0x56f5('0x26')](_0x218cc1);}};}function respondWithFilteredResult(_0x4a054,_0x4fdd71){return function(_0x30f167){if(_0x30f167){var _0x5b0654=_0x30f167[_0x56f5('0x27')],_0x3f6716=_0x4fdd71[_0x56f5('0x28')],_0x14f7cf=_0x4fdd71['offset']+_0x4fdd71[_0x56f5('0x29')],_0x1ef4b2;if(_0x14f7cf>=_0x5b0654){_0x14f7cf=_0x5b0654;_0x1ef4b2=0xc8;}else{_0x1ef4b2=0xce;}_0x4a054[_0x56f5('0x24')](_0x1ef4b2);return _0x4a054[_0x56f5('0x2a')]('Content-Range',_0x3f6716+'-'+_0x14f7cf+'/'+_0x5b0654)[_0x56f5('0x26')](_0x30f167);}return null;};}function patchUpdates(_0x2e0dd0){return function(_0x3ce95c){try{jsonpatch[_0x56f5('0x2b')](_0x3ce95c,_0x2e0dd0,!![]);}catch(_0x5da34b){return BPromise[_0x56f5('0x2c')](_0x5da34b);}return _0x3ce95c[_0x56f5('0x2d')]();};}function saveUpdates(_0x335976,_0x21244d){return function(_0x227a2f){if(_0x227a2f){return _0x227a2f[_0x56f5('0x2e')](_0x335976)[_0x56f5('0x2f')](function(_0x3c2d69){return _0x3c2d69;});}return null;};}function removeEntity(_0x28f732,_0x533bda){return function(_0x4aa1fc){if(_0x4aa1fc){return _0x4aa1fc['destroy']()[_0x56f5('0x2f')](function(){_0x28f732['status'](0xcc)[_0x56f5('0x25')]();});}};}function handleEntityNotFound(_0x514fca,_0x3363ef){return function(_0x32d78e){if(!_0x32d78e){_0x514fca[_0x56f5('0x23')](0x194);}return _0x32d78e;};}function handleError(_0x46be40,_0x2a63e9){_0x2a63e9=_0x2a63e9||0x1f4;return function(_0x810ae9){logger[_0x56f5('0x1f')](_0x810ae9[_0x56f5('0x30')]);if(_0x810ae9[_0x56f5('0x31')]){delete _0x810ae9['name'];}_0x46be40[_0x56f5('0x24')](_0x2a63e9)[_0x56f5('0x32')](_0x810ae9);};}exports[_0x56f5('0x33')]=function(_0x59e782,_0x3771d1){var _0x43e17d={},_0x1aa8cb={},_0x26710d={'count':0x0,'rows':[]};var _0x1f5bed=_[_0x56f5('0x34')](db[_0x56f5('0x35')][_0x56f5('0x36')],function(_0x52eb0d){return{'name':_0x52eb0d[_0x56f5('0x37')],'type':_0x52eb0d[_0x56f5('0x38')]['key']};});_0x1aa8cb[_0x56f5('0x39')]=_[_0x56f5('0x34')](_0x1f5bed,_0x56f5('0x31'));_0x1aa8cb[_0x56f5('0x3a')]=_[_0x56f5('0x3b')](_0x59e782[_0x56f5('0x3a')]);_0x1aa8cb[_0x56f5('0x3c')]=_[_0x56f5('0x3d')](_0x1aa8cb['model'],_0x1aa8cb['query']);_0x43e17d[_0x56f5('0x3e')]=_[_0x56f5('0x3d')](_0x1aa8cb['model'],qs['fields'](_0x59e782[_0x56f5('0x3a')]['fields']));_0x43e17d[_0x56f5('0x3e')]=_0x43e17d[_0x56f5('0x3e')][_0x56f5('0x3f')]?_0x43e17d[_0x56f5('0x3e')]:_0x1aa8cb['model'];if(!_0x59e782[_0x56f5('0x3a')][_0x56f5('0x40')](_0x56f5('0x41'))){_0x43e17d['limit']=qs[_0x56f5('0x29')](_0x59e782[_0x56f5('0x3a')][_0x56f5('0x29')]);_0x43e17d[_0x56f5('0x28')]=qs['offset'](_0x59e782[_0x56f5('0x3a')]['offset']);}_0x43e17d[_0x56f5('0x42')]=qs[_0x56f5('0x43')](_0x59e782['query'][_0x56f5('0x43')]);_0x43e17d['where']=qs['filters'](_[_0x56f5('0x44')](_0x59e782[_0x56f5('0x3a')],_0x1aa8cb[_0x56f5('0x3c')]));if(_0x59e782[_0x56f5('0x3a')][_0x56f5('0x45')]){_0x43e17d['where']=_[_0x56f5('0x46')](_0x43e17d['where'],{'$or':_[_0x56f5('0x34')](_0x1f5bed,function(_0x2d8ab3){if(_0x2d8ab3[_0x56f5('0x38')]!==_0x56f5('0x47')){var _0xbe57dc={};_0xbe57dc[_0x2d8ab3['name']]={'$like':'%'+_0x59e782['query'][_0x56f5('0x45')]+'%'};return _0xbe57dc;}})});}_0x43e17d=_[_0x56f5('0x46')]({},_0x43e17d,_0x59e782[_0x56f5('0x48')]);var _0x4af018={'where':_0x43e17d[_0x56f5('0x49')]};return db[_0x56f5('0x35')]['count'](_0x4af018)[_0x56f5('0x2f')](function(_0xf051b0){_0x26710d[_0x56f5('0x27')]=_0xf051b0;if(_0x59e782['query']['includeAll']){_0x43e17d[_0x56f5('0x4a')]=[{'all':!![]}];}return db[_0x56f5('0x35')]['findAll'](_0x43e17d);})[_0x56f5('0x2f')](function(_0x4d3ce1){_0x26710d['rows']=_0x4d3ce1;return _0x26710d;})[_0x56f5('0x2f')](respondWithFilteredResult(_0x3771d1,_0x43e17d))['catch'](handleError(_0x3771d1,null));};exports[_0x56f5('0x4b')]=function(_0x5a0ad5,_0x528102){var _0x4e099a={'raw':![],'where':{'id':_0x5a0ad5[_0x56f5('0x4c')]['id']}},_0x401d14={};_0x401d14['model']=_['keys'](db['DeskConfiguration'][_0x56f5('0x36')]);_0x401d14[_0x56f5('0x3a')]=_[_0x56f5('0x3b')](_0x5a0ad5[_0x56f5('0x3a')]);_0x401d14['filters']=_[_0x56f5('0x3d')](_0x401d14[_0x56f5('0x39')],_0x401d14[_0x56f5('0x3a')]);_0x4e099a[_0x56f5('0x3e')]=_[_0x56f5('0x3d')](_0x401d14[_0x56f5('0x39')],qs[_0x56f5('0x4d')](_0x5a0ad5['query'][_0x56f5('0x4d')]));_0x4e099a[_0x56f5('0x3e')]=_0x4e099a[_0x56f5('0x3e')]['length']?_0x4e099a['attributes']:_0x401d14[_0x56f5('0x39')];if(_0x5a0ad5[_0x56f5('0x3a')][_0x56f5('0x4e')]){_0x4e099a[_0x56f5('0x4a')]=[{'all':!![]}];}_0x4e099a=_[_0x56f5('0x46')]({},_0x4e099a,_0x5a0ad5[_0x56f5('0x48')]);return db['DeskConfiguration']['find'](_0x4e099a)[_0x56f5('0x2f')](handleEntityNotFound(_0x528102,null))[_0x56f5('0x2f')](respondWithResult(_0x528102,null))[_0x56f5('0x22')](handleError(_0x528102,null));};exports[_0x56f5('0x4f')]=function(_0x5cd5d3,_0x32376d){return db[_0x56f5('0x35')][_0x56f5('0x4f')](_0x5cd5d3['body'],{})[_0x56f5('0x2f')](respondWithResult(_0x32376d,0xc9))['catch'](handleError(_0x32376d,null));};exports[_0x56f5('0x2e')]=function(_0x1e9725,_0x38bf65){if(_0x1e9725[_0x56f5('0x50')]['id']){delete _0x1e9725[_0x56f5('0x50')]['id'];}return db[_0x56f5('0x35')][_0x56f5('0x51')]({'where':{'id':_0x1e9725[_0x56f5('0x4c')]['id']}})[_0x56f5('0x2f')](handleEntityNotFound(_0x38bf65,null))[_0x56f5('0x2f')](saveUpdates(_0x1e9725['body'],null))[_0x56f5('0x2f')](respondWithResult(_0x38bf65,null))[_0x56f5('0x22')](handleError(_0x38bf65,null));};exports[_0x56f5('0x52')]=function(_0x195fc3,_0x3cd73c){return db[_0x56f5('0x35')][_0x56f5('0x51')]({'where':{'id':_0x195fc3[_0x56f5('0x4c')]['id']}})[_0x56f5('0x2f')](handleEntityNotFound(_0x3cd73c,null))[_0x56f5('0x2f')](removeEntity(_0x3cd73c,null))[_0x56f5('0x22')](handleError(_0x3cd73c,null));};exports[_0x56f5('0x53')]=function(_0x9618df,_0x45d006,_0x22a9ff){var _0x143174={};var _0x1f666f={};var _0x21c3a8;var _0x2dc28b;return db['DeskConfiguration'][_0x56f5('0x54')]({'where':{'id':_0x9618df[_0x56f5('0x4c')]['id']}})[_0x56f5('0x2f')](handleEntityNotFound(_0x45d006,null))[_0x56f5('0x2f')](function(_0x29d7ea){if(_0x29d7ea){_0x21c3a8=_0x29d7ea;_0x1f666f[_0x56f5('0x39')]=_[_0x56f5('0x3b')](db[_0x56f5('0x55')][_0x56f5('0x36')]);_0x1f666f[_0x56f5('0x3a')]=_[_0x56f5('0x3b')](_0x9618df[_0x56f5('0x3a')]);_0x1f666f['filters']=_['intersection'](_0x1f666f[_0x56f5('0x39')],_0x1f666f[_0x56f5('0x3a')]);_0x143174[_0x56f5('0x3e')]=_['intersection'](_0x1f666f[_0x56f5('0x39')],qs[_0x56f5('0x4d')](_0x9618df[_0x56f5('0x3a')]['fields']));_0x143174[_0x56f5('0x3e')]=_0x143174['attributes']['length']?_0x143174[_0x56f5('0x3e')]:_0x1f666f[_0x56f5('0x39')];_0x143174['order']=qs[_0x56f5('0x43')](_0x9618df['query'][_0x56f5('0x43')]);_0x143174[_0x56f5('0x49')]=qs[_0x56f5('0x3c')](_['pick'](_0x9618df[_0x56f5('0x3a')],_0x1f666f[_0x56f5('0x3c')]));if(_0x9618df[_0x56f5('0x3a')][_0x56f5('0x45')]){_0x143174['where']=_[_0x56f5('0x46')](_0x143174['where'],{'$or':_[_0x56f5('0x34')](_0x143174[_0x56f5('0x3e')],function(_0x5af977){var _0x26a76b={};_0x26a76b[_0x5af977]={'$like':'%'+_0x9618df[_0x56f5('0x3a')][_0x56f5('0x45')]+'%'};return _0x26a76b;})});}_0x143174=_['merge']({},_0x143174,_0x9618df[_0x56f5('0x48')]);return _0x21c3a8[_0x56f5('0x53')](_0x143174);}})[_0x56f5('0x2f')](function(_0x239ac5){if(_0x239ac5){_0x2dc28b=_0x239ac5[_0x56f5('0x3f')];if(!_0x9618df['query'][_0x56f5('0x40')](_0x56f5('0x41'))){_0x143174[_0x56f5('0x29')]=qs[_0x56f5('0x29')](_0x9618df[_0x56f5('0x3a')][_0x56f5('0x29')]);_0x143174[_0x56f5('0x28')]=qs[_0x56f5('0x28')](_0x9618df['query'][_0x56f5('0x28')]);}return _0x21c3a8['getFields'](_0x143174);}})['then'](function(_0x15a241){if(_0x15a241){return _0x15a241?{'count':_0x2dc28b,'rows':_0x15a241}:null;}})[_0x56f5('0x2f')](respondWithResult(_0x45d006,null))[_0x56f5('0x22')](handleError(_0x45d006,null));};exports['getSubjects']=function(_0xa637a1,_0xb66b77,_0x58f65e){var _0x59d638={};var _0x32c2a4={};var _0x527b55;var _0x3b82bb;return db[_0x56f5('0x35')][_0x56f5('0x54')]({'where':{'id':_0xa637a1[_0x56f5('0x4c')]['id']}})['then'](handleEntityNotFound(_0xb66b77,null))[_0x56f5('0x2f')](function(_0x5c5a9d){if(_0x5c5a9d){_0x527b55=_0x5c5a9d;_0x32c2a4[_0x56f5('0x39')]=_[_0x56f5('0x3b')](db[_0x56f5('0x55')][_0x56f5('0x36')]);_0x32c2a4[_0x56f5('0x3a')]=_['keys'](_0xa637a1[_0x56f5('0x3a')]);_0x32c2a4['filters']=_[_0x56f5('0x3d')](_0x32c2a4[_0x56f5('0x39')],_0x32c2a4['query']);_0x59d638['attributes']=_[_0x56f5('0x3d')](_0x32c2a4['model'],qs[_0x56f5('0x4d')](_0xa637a1[_0x56f5('0x3a')]['fields']));_0x59d638[_0x56f5('0x3e')]=_0x59d638[_0x56f5('0x3e')]['length']?_0x59d638[_0x56f5('0x3e')]:_0x32c2a4['model'];_0x59d638[_0x56f5('0x42')]=qs[_0x56f5('0x43')](_0xa637a1[_0x56f5('0x3a')]['sort']);_0x59d638['where']=qs[_0x56f5('0x3c')](_[_0x56f5('0x44')](_0xa637a1['query'],_0x32c2a4[_0x56f5('0x3c')]));if(_0xa637a1['query']['filter']){_0x59d638[_0x56f5('0x49')]=_['merge'](_0x59d638['where'],{'$or':_[_0x56f5('0x34')](_0x59d638[_0x56f5('0x3e')],function(_0x20b855){var _0x50e442={};_0x50e442[_0x20b855]={'$like':'%'+_0xa637a1[_0x56f5('0x3a')][_0x56f5('0x45')]+'%'};return _0x50e442;})});}_0x59d638=_[_0x56f5('0x46')]({},_0x59d638,_0xa637a1[_0x56f5('0x48')]);return _0x527b55['getSubjects'](_0x59d638);}})[_0x56f5('0x2f')](function(_0x2d0265){if(_0x2d0265){_0x3b82bb=_0x2d0265[_0x56f5('0x3f')];if(!_0xa637a1['query']['hasOwnProperty'](_0x56f5('0x41'))){_0x59d638[_0x56f5('0x29')]=qs['limit'](_0xa637a1['query'][_0x56f5('0x29')]);_0x59d638[_0x56f5('0x28')]=qs[_0x56f5('0x28')](_0xa637a1[_0x56f5('0x3a')][_0x56f5('0x28')]);}return _0x527b55[_0x56f5('0x56')](_0x59d638);}})['then'](function(_0x3841ec){if(_0x3841ec){return _0x3841ec?{'count':_0x3b82bb,'rows':_0x3841ec}:null;}})[_0x56f5('0x2f')](respondWithResult(_0xb66b77,null))[_0x56f5('0x22')](handleError(_0xb66b77,null));};exports[_0x56f5('0x57')]=function(_0x45401c,_0x2aeaaf,_0x11b62f){var _0x2c051e={};var _0x24023a={};var _0x5d9f2b;var _0x5c70b3;return db[_0x56f5('0x35')][_0x56f5('0x54')]({'where':{'id':_0x45401c['params']['id']}})['then'](handleEntityNotFound(_0x2aeaaf,null))[_0x56f5('0x2f')](function(_0xc19a68){if(_0xc19a68){_0x5d9f2b=_0xc19a68;_0x24023a['model']=_[_0x56f5('0x3b')](db[_0x56f5('0x55')][_0x56f5('0x36')]);_0x24023a[_0x56f5('0x3a')]=_['keys'](_0x45401c[_0x56f5('0x3a')]);_0x24023a[_0x56f5('0x3c')]=_[_0x56f5('0x3d')](_0x24023a[_0x56f5('0x39')],_0x24023a[_0x56f5('0x3a')]);_0x2c051e[_0x56f5('0x3e')]=_[_0x56f5('0x3d')](_0x24023a[_0x56f5('0x39')],qs[_0x56f5('0x4d')](_0x45401c['query'][_0x56f5('0x4d')]));_0x2c051e[_0x56f5('0x3e')]=_0x2c051e[_0x56f5('0x3e')][_0x56f5('0x3f')]?_0x2c051e['attributes']:_0x24023a[_0x56f5('0x39')];_0x2c051e[_0x56f5('0x42')]=qs[_0x56f5('0x43')](_0x45401c[_0x56f5('0x3a')][_0x56f5('0x43')]);_0x2c051e[_0x56f5('0x49')]=qs[_0x56f5('0x3c')](_['pick'](_0x45401c[_0x56f5('0x3a')],_0x24023a[_0x56f5('0x3c')]));if(_0x45401c[_0x56f5('0x3a')]['filter']){_0x2c051e['where']=_[_0x56f5('0x46')](_0x2c051e[_0x56f5('0x49')],{'$or':_[_0x56f5('0x34')](_0x2c051e[_0x56f5('0x3e')],function(_0xcd2734){var _0x3d44ad={};_0x3d44ad[_0xcd2734]={'$like':'%'+_0x45401c[_0x56f5('0x3a')][_0x56f5('0x45')]+'%'};return _0x3d44ad;})});}_0x2c051e=_['merge']({},_0x2c051e,_0x45401c[_0x56f5('0x48')]);return _0x5d9f2b['getDescriptions'](_0x2c051e);}})[_0x56f5('0x2f')](function(_0x1f9a24){if(_0x1f9a24){_0x5c70b3=_0x1f9a24[_0x56f5('0x3f')];if(!_0x45401c[_0x56f5('0x3a')][_0x56f5('0x40')](_0x56f5('0x41'))){_0x2c051e['limit']=qs[_0x56f5('0x29')](_0x45401c['query'][_0x56f5('0x29')]);_0x2c051e[_0x56f5('0x28')]=qs[_0x56f5('0x28')](_0x45401c[_0x56f5('0x3a')]['offset']);}return _0x5d9f2b['getDescriptions'](_0x2c051e);}})[_0x56f5('0x2f')](function(_0x4935b9){if(_0x4935b9){return _0x4935b9?{'count':_0x5c70b3,'rows':_0x4935b9}:null;}})['then'](respondWithResult(_0x2aeaaf,null))[_0x56f5('0x22')](handleError(_0x2aeaaf,null));};exports[_0x56f5('0x58')]=function(_0x5ee836,_0xb0d610,_0x3914de){var _0x407e86={};var _0x2e8bf8={};var _0x181fe9;var _0xed0eb5;return db[_0x56f5('0x35')][_0x56f5('0x54')]({'where':{'id':_0x5ee836[_0x56f5('0x4c')]['id']}})['then'](handleEntityNotFound(_0xb0d610,null))[_0x56f5('0x2f')](function(_0x221a4b){if(_0x221a4b){_0x181fe9=_0x221a4b;_0x2e8bf8['model']=_['keys'](db[_0x56f5('0x59')]['rawAttributes']);_0x2e8bf8['query']=_['keys'](_0x5ee836[_0x56f5('0x3a')]);_0x2e8bf8[_0x56f5('0x3c')]=_[_0x56f5('0x3d')](_0x2e8bf8[_0x56f5('0x39')],_0x2e8bf8[_0x56f5('0x3a')]);_0x407e86[_0x56f5('0x3e')]=_[_0x56f5('0x3d')](_0x2e8bf8[_0x56f5('0x39')],qs[_0x56f5('0x4d')](_0x5ee836[_0x56f5('0x3a')][_0x56f5('0x4d')]));_0x407e86[_0x56f5('0x3e')]=_0x407e86[_0x56f5('0x3e')][_0x56f5('0x3f')]?_0x407e86[_0x56f5('0x3e')]:_0x2e8bf8['model'];_0x407e86[_0x56f5('0x42')]=qs[_0x56f5('0x43')](_0x5ee836[_0x56f5('0x3a')][_0x56f5('0x43')]);_0x407e86[_0x56f5('0x49')]=qs['filters'](_['pick'](_0x5ee836[_0x56f5('0x3a')],_0x2e8bf8[_0x56f5('0x3c')]));if(_0x5ee836[_0x56f5('0x3a')][_0x56f5('0x45')]){_0x407e86[_0x56f5('0x49')]=_[_0x56f5('0x46')](_0x407e86[_0x56f5('0x49')],{'$or':_[_0x56f5('0x34')](_0x407e86['attributes'],function(_0x325849){var _0xe46b65={};_0xe46b65[_0x325849]={'$like':'%'+_0x5ee836['query'][_0x56f5('0x45')]+'%'};return _0xe46b65;})});}_0x407e86=_['merge']({},_0x407e86,_0x5ee836[_0x56f5('0x48')]);return _0x181fe9['getTags'](_0x407e86);}})['then'](function(_0x5ea6ed){if(_0x5ea6ed){_0xed0eb5=_0x5ea6ed[_0x56f5('0x3f')];if(!_0x5ee836[_0x56f5('0x3a')][_0x56f5('0x40')]('nolimit')){_0x407e86[_0x56f5('0x29')]=qs[_0x56f5('0x29')](_0x5ee836[_0x56f5('0x3a')][_0x56f5('0x29')]);_0x407e86[_0x56f5('0x28')]=qs[_0x56f5('0x28')](_0x5ee836[_0x56f5('0x3a')][_0x56f5('0x28')]);}return _0x181fe9['getTags'](_0x407e86);}})[_0x56f5('0x2f')](function(_0x1b8b43){if(_0x1b8b43){return _0x1b8b43?{'count':_0xed0eb5,'rows':_0x1b8b43}:null;}})[_0x56f5('0x2f')](respondWithResult(_0xb0d610,null))[_0x56f5('0x22')](handleError(_0xb0d610,null));};exports['setTags']=function(_0x219bcd,_0x465716,_0x2b6e3b){if(_0x219bcd[_0x56f5('0x50')]['id']){delete _0x219bcd[_0x56f5('0x50')]['id'];}return db[_0x56f5('0x35')]['findOne']({'where':{'id':_0x219bcd[_0x56f5('0x4c')]['id']}})[_0x56f5('0x2f')](handleEntityNotFound(_0x465716,null))['then'](function(_0x4461e2){if(_0x4461e2){return _0x4461e2[_0x56f5('0x5a')](_0x219bcd['body'][_0x56f5('0x5b')]||[]);}return null;})['then'](respondWithResult(_0x465716,null))[_0x56f5('0x22')](handleError(_0x465716,null));}; \ No newline at end of file +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 diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 5b4d540..f73433a 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 _0xeb78=['api','moment','bluebird','request-promise','path','exports','int_desk_configurations','lodash','util','../../config/logger'];(function(_0x9fb2bc,_0xbab349){var _0x159de0=function(_0x47ff79){while(--_0x47ff79){_0x9fb2bc['push'](_0x9fb2bc['shift']());}};_0x159de0(++_0xbab349);}(_0xeb78,0x179));var _0x8eb7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xeb78[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8eb7('0x0'));var util=require(_0x8eb7('0x1'));var logger=require(_0x8eb7('0x2'))(_0x8eb7('0x3'));var moment=require(_0x8eb7('0x4'));var BPromise=require(_0x8eb7('0x5'));var rp=require(_0x8eb7('0x6'));var fs=require('fs');var path=require(_0x8eb7('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDeskConfiguration.attributes');module[_0x8eb7('0x8')]=function(_0x199271,_0x33d77e){return _0x199271['define']('DeskConfiguration',attributes,{'tableName':_0x8eb7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 4050f14..8ac79be 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 _0x8ec7=['error','message','result','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x725a4c,_0x102507){var _0x37b2cc=function(_0x505fc9){while(--_0x505fc9){_0x725a4c['push'](_0x725a4c['shift']());}};_0x37b2cc(++_0x102507);}(_0x8ec7,0x1f1));var _0x78ec=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0x8ec7[_0x42f009];return _0x22a1e0;};'use strict';var _=require(_0x78ec('0x0'));var util=require(_0x78ec('0x1'));var moment=require('moment');var BPromise=require(_0x78ec('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78ec('0x3'))['db'];var utils=require(_0x78ec('0x4'));var logger=require('../../config/logger')(_0x78ec('0x5'));var config=require(_0x78ec('0x6'));var jayson=require(_0x78ec('0x7'));var client=jayson[_0x78ec('0x8')][_0x78ec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d2780,_0x21e3f7,_0x4ca55e){return new BPromise(function(_0x372108,_0x268c50){return client[_0x78ec('0xa')](_0x5d2780,_0x4ca55e)['then'](function(_0x367c80){logger[_0x78ec('0xb')](_0x78ec('0xc'),_0x21e3f7,_0x78ec('0xd'));logger[_0x78ec('0xe')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x21e3f7,'request\x20sent',JSON[_0x78ec('0xf')](_0x367c80));if(_0x367c80[_0x78ec('0x10')]){if(_0x367c80[_0x78ec('0x10')]['code']===0x1f4){logger[_0x78ec('0x10')](_0x78ec('0xc'),_0x21e3f7,_0x367c80[_0x78ec('0x10')][_0x78ec('0x11')]);return _0x268c50(_0x367c80[_0x78ec('0x10')][_0x78ec('0x11')]);}logger[_0x78ec('0x10')](_0x78ec('0xc'),_0x21e3f7,_0x367c80[_0x78ec('0x10')][_0x78ec('0x11')]);return _0x372108(_0x367c80[_0x78ec('0x10')]['message']);}else{logger[_0x78ec('0xb')](_0x78ec('0xc'),_0x21e3f7,_0x78ec('0xd'));_0x372108(_0x367c80[_0x78ec('0x12')][_0x78ec('0x11')]);}})['catch'](function(_0x4f9ffd){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x21e3f7,_0x4f9ffd);_0x268c50(_0x4f9ffd);});});} \ No newline at end of file +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 diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index e2a30d1..ce32027 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 _0x3df2=['../../components/auth/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','/:id','show','post','update','delete','destroy','exports','path','connect-timeout','express'];(function(_0x50213a,_0x4577c6){var _0x8d1119=function(_0x4ee2d7){while(--_0x4ee2d7){_0x50213a['push'](_0x50213a['shift']());}};_0x8d1119(++_0x4577c6);}(_0x3df2,0xcf));var _0x23df=function(_0x1e275b,_0x555df0){_0x1e275b=_0x1e275b-0x0;var _0x463fbb=_0x3df2[_0x1e275b];return _0x463fbb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x23df('0x0'));var timeout=require(_0x23df('0x1'));var express=require(_0x23df('0x2'));var router=express['Router']();var auth=require(_0x23df('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x23df('0x4'));var controller=require(_0x23df('0x5'));router[_0x23df('0x6')]('/',auth[_0x23df('0x7')](),controller['index']);router['get'](_0x23df('0x8'),auth[_0x23df('0x7')](),controller[_0x23df('0x9')]);router[_0x23df('0xa')]('/',auth[_0x23df('0x7')](),controller['create']);router['put'](_0x23df('0x8'),auth[_0x23df('0x7')](),controller[_0x23df('0xb')]);router[_0x23df('0xc')](_0x23df('0x8'),auth[_0x23df('0x7')](),controller[_0x23df('0xd')]);module[_0x23df('0xe')]=router; \ No newline at end of file +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 diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 7709cd2..4b7db8b 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 _0x68cd=['keyValue','STRING','BOOLEAN','sequelize','exports','string','variable','customVariable'];(function(_0xf5a82e,_0x2f6582){var _0x1a7797=function(_0x36715d){while(--_0x36715d){_0xf5a82e['push'](_0xf5a82e['shift']());}};_0x1a7797(++_0x2f6582);}(_0x68cd,0xfb));var _0xd68c=function(_0x4ae459,_0x3bf329){_0x4ae459=_0x4ae459-0x0;var _0x51d0c9=_0x68cd[_0x4ae459];return _0x51d0c9;};'use strict';var Sequelize=require(_0xd68c('0x0'));module[_0xd68c('0x1')]={'type':{'type':Sequelize['ENUM'](_0xd68c('0x2'),_0xd68c('0x3'),_0xd68c('0x4'),_0xd68c('0x5')),'defaultValue':_0xd68c('0x2')},'content':{'type':Sequelize[_0xd68c('0x6')]},'key':{'type':Sequelize[_0xd68c('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0xd68c('0x3'),_0xd68c('0x4'))},'keyContent':{'type':Sequelize[_0xd68c('0x6')]},'idField':{'type':Sequelize[_0xd68c('0x6')]},'nameField':{'type':Sequelize[_0xd68c('0x6')]},'customField':{'type':Sequelize[_0xd68c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd68c('0x6')]}}; \ No newline at end of file +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 diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 9e57e2b..d07301c 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 _0x4ea3=['count','offset','limit','set','apply','reject','save','then','destroy','name','send','index','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','length','nolimit','order','where','filter','merge','map','VIRTUAL','options','DeskField','includeAll','include','findAll','rows','catch','show','params','attributes','find','create','update','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json'];(function(_0x54a455,_0x4cc295){var _0x18bcaf=function(_0x4276dc){while(--_0x4276dc){_0x54a455['push'](_0x54a455['shift']());}};_0x18bcaf(++_0x4cc295);}(_0x4ea3,0x70));var _0x34ea=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x4ea3[_0xbca1b1];return _0x4e1686;};'use strict';var pdf=require(_0x34ea('0x0'));var emlformat=require(_0x34ea('0x1'));var rimraf=require(_0x34ea('0x2'));var zipdir=require(_0x34ea('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x34ea('0x4'));var moment=require('moment');var BPromise=require(_0x34ea('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x34ea('0x6'));var sox=require(_0x34ea('0x7'));var csv=require(_0x34ea('0x8'));var ejs=require(_0x34ea('0x9'));var fs=require('fs');var _=require(_0x34ea('0xa'));var squel=require(_0x34ea('0xb'));var crypto=require(_0x34ea('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x34ea('0xd'));var toCsv=require(_0x34ea('0x8'));var querystring=require(_0x34ea('0xe'));var Papa=require('papaparse');var Redis=require(_0x34ea('0xf'));var authService=require(_0x34ea('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x34ea('0x11'));var logger=require(_0x34ea('0x12'))(_0x34ea('0x13'));var utils=require('../../config/utils');var config=require(_0x34ea('0x14'));var db=require(_0x34ea('0x15'))['db'];function respondWithStatusCode(_0x10135f,_0x233b11){_0x233b11=_0x233b11||0xcc;return function(_0x60725f){if(_0x60725f){return _0x10135f[_0x34ea('0x16')](_0x233b11);}return _0x10135f[_0x34ea('0x17')](_0x233b11)[_0x34ea('0x18')]();};}function respondWithResult(_0x1ff760,_0x2a19c6){_0x2a19c6=_0x2a19c6||0xc8;return function(_0x36a4c6){if(_0x36a4c6){return _0x1ff760['status'](_0x2a19c6)[_0x34ea('0x19')](_0x36a4c6);}};}function respondWithFilteredResult(_0x89e3f2,_0x14ebb9){return function(_0x3f9ffe){if(_0x3f9ffe){var _0x44e44e=_0x3f9ffe[_0x34ea('0x1a')],_0x56b2d7=_0x14ebb9[_0x34ea('0x1b')],_0x6a84a7=_0x14ebb9['offset']+_0x14ebb9[_0x34ea('0x1c')],_0x18c013;if(_0x6a84a7>=_0x44e44e){_0x6a84a7=_0x44e44e;_0x18c013=0xc8;}else{_0x18c013=0xce;}_0x89e3f2[_0x34ea('0x17')](_0x18c013);return _0x89e3f2[_0x34ea('0x1d')]('Content-Range',_0x56b2d7+'-'+_0x6a84a7+'/'+_0x44e44e)[_0x34ea('0x19')](_0x3f9ffe);}return null;};}function patchUpdates(_0x1353de){return function(_0x33afb2){try{jsonpatch[_0x34ea('0x1e')](_0x33afb2,_0x1353de,!![]);}catch(_0x52af16){return BPromise[_0x34ea('0x1f')](_0x52af16);}return _0x33afb2[_0x34ea('0x20')]();};}function saveUpdates(_0x287aaa,_0x247ee7){return function(_0x4fc1a2){if(_0x4fc1a2){return _0x4fc1a2['update'](_0x287aaa)[_0x34ea('0x21')](function(_0x26ae3a){return _0x26ae3a;});}return null;};}function removeEntity(_0x151fae,_0x51022f){return function(_0x5197a2){if(_0x5197a2){return _0x5197a2[_0x34ea('0x22')]()[_0x34ea('0x21')](function(){_0x151fae[_0x34ea('0x17')](0xcc)[_0x34ea('0x18')]();});}};}function handleEntityNotFound(_0x12e7e9,_0x697475){return function(_0x5ade46){if(!_0x5ade46){_0x12e7e9[_0x34ea('0x16')](0x194);}return _0x5ade46;};}function handleError(_0x46671f,_0x3c0983){_0x3c0983=_0x3c0983||0x1f4;return function(_0x332f75){logger['error'](_0x332f75['stack']);if(_0x332f75['name']){delete _0x332f75[_0x34ea('0x23')];}_0x46671f[_0x34ea('0x17')](_0x3c0983)[_0x34ea('0x24')](_0x332f75);};}exports[_0x34ea('0x25')]=function(_0x5b8b3e,_0x26c80b){var _0x267083={},_0x27c6f7={},_0x4fd4fd={'count':0x0,'rows':[]};var _0x4cded8=_['map'](db['DeskField'][_0x34ea('0x26')],function(_0x6227db){return{'name':_0x6227db[_0x34ea('0x27')],'type':_0x6227db[_0x34ea('0x28')]['key']};});_0x27c6f7[_0x34ea('0x29')]=_['map'](_0x4cded8,_0x34ea('0x23'));_0x27c6f7['query']=_[_0x34ea('0x2a')](_0x5b8b3e[_0x34ea('0x2b')]);_0x27c6f7[_0x34ea('0x2c')]=_['intersection'](_0x27c6f7[_0x34ea('0x29')],_0x27c6f7[_0x34ea('0x2b')]);_0x267083['attributes']=_[_0x34ea('0x2d')](_0x27c6f7['model'],qs[_0x34ea('0x2e')](_0x5b8b3e[_0x34ea('0x2b')][_0x34ea('0x2e')]));_0x267083['attributes']=_0x267083['attributes'][_0x34ea('0x2f')]?_0x267083['attributes']:_0x27c6f7[_0x34ea('0x29')];if(!_0x5b8b3e[_0x34ea('0x2b')]['hasOwnProperty'](_0x34ea('0x30'))){_0x267083[_0x34ea('0x1c')]=qs[_0x34ea('0x1c')](_0x5b8b3e[_0x34ea('0x2b')]['limit']);_0x267083['offset']=qs['offset'](_0x5b8b3e[_0x34ea('0x2b')][_0x34ea('0x1b')]);}_0x267083[_0x34ea('0x31')]=qs['sort'](_0x5b8b3e['query']['sort']);_0x267083[_0x34ea('0x32')]=qs[_0x34ea('0x2c')](_['pick'](_0x5b8b3e[_0x34ea('0x2b')],_0x27c6f7[_0x34ea('0x2c')]));if(_0x5b8b3e[_0x34ea('0x2b')][_0x34ea('0x33')]){_0x267083[_0x34ea('0x32')]=_[_0x34ea('0x34')](_0x267083['where'],{'$or':_[_0x34ea('0x35')](_0x4cded8,function(_0x22729a){if(_0x22729a[_0x34ea('0x28')]!==_0x34ea('0x36')){var _0x4f05fc={};_0x4f05fc[_0x22729a['name']]={'$like':'%'+_0x5b8b3e[_0x34ea('0x2b')][_0x34ea('0x33')]+'%'};return _0x4f05fc;}})});}_0x267083=_[_0x34ea('0x34')]({},_0x267083,_0x5b8b3e[_0x34ea('0x37')]);var _0x29260c={'where':_0x267083['where']};return db[_0x34ea('0x38')][_0x34ea('0x1a')](_0x29260c)[_0x34ea('0x21')](function(_0x3a6a90){_0x4fd4fd[_0x34ea('0x1a')]=_0x3a6a90;if(_0x5b8b3e[_0x34ea('0x2b')][_0x34ea('0x39')]){_0x267083[_0x34ea('0x3a')]=[{'all':!![]}];}return db[_0x34ea('0x38')][_0x34ea('0x3b')](_0x267083);})[_0x34ea('0x21')](function(_0x109cff){_0x4fd4fd[_0x34ea('0x3c')]=_0x109cff;return _0x4fd4fd;})[_0x34ea('0x21')](respondWithFilteredResult(_0x26c80b,_0x267083))[_0x34ea('0x3d')](handleError(_0x26c80b,null));};exports[_0x34ea('0x3e')]=function(_0x58dc60,_0x25065d){var _0x4ae353={'raw':!![],'where':{'id':_0x58dc60[_0x34ea('0x3f')]['id']}},_0x344b95={};_0x344b95[_0x34ea('0x29')]=_[_0x34ea('0x2a')](db[_0x34ea('0x38')][_0x34ea('0x26')]);_0x344b95[_0x34ea('0x2b')]=_[_0x34ea('0x2a')](_0x58dc60[_0x34ea('0x2b')]);_0x344b95['filters']=_[_0x34ea('0x2d')](_0x344b95['model'],_0x344b95[_0x34ea('0x2b')]);_0x4ae353[_0x34ea('0x40')]=_[_0x34ea('0x2d')](_0x344b95[_0x34ea('0x29')],qs[_0x34ea('0x2e')](_0x58dc60[_0x34ea('0x2b')]['fields']));_0x4ae353[_0x34ea('0x40')]=_0x4ae353[_0x34ea('0x40')]['length']?_0x4ae353[_0x34ea('0x40')]:_0x344b95[_0x34ea('0x29')];if(_0x58dc60[_0x34ea('0x2b')][_0x34ea('0x39')]){_0x4ae353[_0x34ea('0x3a')]=[{'all':!![]}];}_0x4ae353=_['merge']({},_0x4ae353,_0x58dc60[_0x34ea('0x37')]);return db[_0x34ea('0x38')][_0x34ea('0x41')](_0x4ae353)[_0x34ea('0x21')](handleEntityNotFound(_0x25065d,null))[_0x34ea('0x21')](respondWithResult(_0x25065d,null))[_0x34ea('0x3d')](handleError(_0x25065d,null));};exports['create']=function(_0x5c65ec,_0x331e4d){return db[_0x34ea('0x38')][_0x34ea('0x42')](_0x5c65ec['body'],{})[_0x34ea('0x21')](respondWithResult(_0x331e4d,0xc9))['catch'](handleError(_0x331e4d,null));};exports[_0x34ea('0x43')]=function(_0x4cc586,_0x2e7e4c){if(_0x4cc586[_0x34ea('0x44')]['id']){delete _0x4cc586[_0x34ea('0x44')]['id'];}return db['DeskField'][_0x34ea('0x41')]({'where':{'id':_0x4cc586['params']['id']}})[_0x34ea('0x21')](handleEntityNotFound(_0x2e7e4c,null))[_0x34ea('0x21')](saveUpdates(_0x4cc586[_0x34ea('0x44')],null))[_0x34ea('0x21')](respondWithResult(_0x2e7e4c,null))['catch'](handleError(_0x2e7e4c,null));};exports[_0x34ea('0x22')]=function(_0x2d07cf,_0x312ff8){return db[_0x34ea('0x38')][_0x34ea('0x41')]({'where':{'id':_0x2d07cf[_0x34ea('0x3f')]['id']}})[_0x34ea('0x21')](handleEntityNotFound(_0x312ff8,null))['then'](removeEntity(_0x312ff8,null))[_0x34ea('0x3d')](handleError(_0x312ff8,null));}; \ No newline at end of file +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 diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index c72b3ae..0bc7cce 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 _0x8fbe=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','DeskField','idField','lodash'];(function(_0x6183c0,_0x28ab89){var _0x3e3fcc=function(_0x36d308){while(--_0x36d308){_0x6183c0['push'](_0x6183c0['shift']());}};_0x3e3fcc(++_0x28ab89);}(_0x8fbe,0x81));var _0xe8fb=function(_0xd87870,_0x4eaf50){_0xd87870=_0xd87870-0x0;var _0x3ef937=_0x8fbe[_0xd87870];return _0x3ef937;};'use strict';var _=require(_0xe8fb('0x0'));var util=require(_0xe8fb('0x1'));var logger=require('../../config/logger')(_0xe8fb('0x2'));var moment=require(_0xe8fb('0x3'));var BPromise=require(_0xe8fb('0x4'));var rp=require(_0xe8fb('0x5'));var fs=require('fs');var path=require(_0xe8fb('0x6'));var rimraf=require(_0xe8fb('0x7'));var config=require(_0xe8fb('0x8'));var attributes=require(_0xe8fb('0x9'));module[_0xe8fb('0xa')]=function(_0x178f55,_0x34b850){return _0x178f55['define'](_0xe8fb('0xb'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0xe8fb('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 21e9109..e84cb63 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 _0x0709=['http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x2edd38,_0x54a8d7){var _0x320200=function(_0x4f30e5){while(--_0x4f30e5){_0x2edd38['push'](_0x2edd38['shift']());}};_0x320200(++_0x54a8d7);}(_0x0709,0x16c));var _0x9070=function(_0x42ebba,_0x4cbf87){_0x42ebba=_0x42ebba-0x0;var _0x3fd2af=_0x0709[_0x42ebba];return _0x3fd2af;};'use strict';var _=require(_0x9070('0x0'));var util=require('util');var moment=require(_0x9070('0x1'));var BPromise=require(_0x9070('0x2'));var rs=require(_0x9070('0x3'));var fs=require('fs');var Redis=require(_0x9070('0x4'));var db=require(_0x9070('0x5'))['db'];var utils=require(_0x9070('0x6'));var logger=require(_0x9070('0x7'))('rpc');var config=require(_0x9070('0x8'));var jayson=require(_0x9070('0x9'));var client=jayson['client'][_0x9070('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x229021,_0x3603f4,_0x120648){return new BPromise(function(_0x34f97d,_0x1b26ad){return client[_0x9070('0xb')](_0x229021,_0x120648)[_0x9070('0xc')](function(_0x3f1322){logger[_0x9070('0xd')](_0x9070('0xe'),_0x3603f4,_0x9070('0xf'));logger['debug'](_0x9070('0x10'),_0x3603f4,_0x9070('0xf'),JSON[_0x9070('0x11')](_0x3f1322));if(_0x3f1322[_0x9070('0x12')]){if(_0x3f1322[_0x9070('0x12')][_0x9070('0x13')]===0x1f4){logger['error'](_0x9070('0xe'),_0x3603f4,_0x3f1322[_0x9070('0x12')][_0x9070('0x14')]);return _0x1b26ad(_0x3f1322[_0x9070('0x12')]['message']);}logger[_0x9070('0x12')](_0x9070('0xe'),_0x3603f4,_0x3f1322[_0x9070('0x12')][_0x9070('0x14')]);return _0x34f97d(_0x3f1322[_0x9070('0x12')][_0x9070('0x14')]);}else{logger[_0x9070('0xd')](_0x9070('0xe'),_0x3603f4,'request\x20sent');_0x34f97d(_0x3f1322[_0x9070('0x15')][_0x9070('0x14')]);}})['catch'](function(_0x406ea6){logger['error'](_0x9070('0xe'),_0x3603f4,_0x406ea6);_0x1b26ad(_0x406ea6);});});} \ No newline at end of file +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 diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index f76a075..239f13d 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 _0xa4e8=['delete','destroy','multer','util','path','connect-timeout','express','Router','./intDynamics365Account.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','getFields','create','addConfiguration','put'];(function(_0x50b383,_0x544efa){var _0x1d719d=function(_0xe2dba7){while(--_0xe2dba7){_0x50b383['push'](_0x50b383['shift']());}};_0x1d719d(++_0x544efa);}(_0xa4e8,0xf9));var _0x8a4e=function(_0x277a23,_0x586f6e){_0x277a23=_0x277a23-0x0;var _0x4a4d65=_0xa4e8[_0x277a23];return _0x4a4d65;};'use strict';var multer=require(_0x8a4e('0x0'));var util=require(_0x8a4e('0x1'));var path=require(_0x8a4e('0x2'));var timeout=require(_0x8a4e('0x3'));var express=require(_0x8a4e('0x4'));var router=express[_0x8a4e('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8a4e('0x6'));router[_0x8a4e('0x7')]('/',auth[_0x8a4e('0x8')](),controller[_0x8a4e('0x9')]);router[_0x8a4e('0x7')]('/:id',auth[_0x8a4e('0x8')](),controller[_0x8a4e('0xa')]);router[_0x8a4e('0x7')](_0x8a4e('0xb'),auth[_0x8a4e('0x8')](),controller[_0x8a4e('0xc')]);router[_0x8a4e('0x7')]('/:id/fields',auth[_0x8a4e('0x8')](),controller[_0x8a4e('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8a4e('0xe')]);router['post'](_0x8a4e('0xb'),auth[_0x8a4e('0x8')](),controller[_0x8a4e('0xf')]);router[_0x8a4e('0x10')]('/:id',auth[_0x8a4e('0x8')](),controller['update']);router[_0x8a4e('0x11')]('/:id',auth[_0x8a4e('0x8')](),controller[_0x8a4e('0x12')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 989ba2a..bc0ad5d 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 _0xa3b3=['sequelize','exports','STRING'];(function(_0x2cce0f,_0x452d59){var _0x6a2a26=function(_0x1db634){while(--_0x1db634){_0x2cce0f['push'](_0x2cce0f['shift']());}};_0x6a2a26(++_0x452d59);}(_0xa3b3,0x1a4));var _0x3a3b=function(_0x42eaf2,_0x922ef2){_0x42eaf2=_0x42eaf2-0x0;var _0x254877=_0xa3b3[_0x42eaf2];return _0x254877;};'use strict';var Sequelize=require(_0x3a3b('0x0'));module[_0x3a3b('0x1')]={'name':{'type':Sequelize[_0x3a3b('0x2')]},'username':{'type':Sequelize[_0x3a3b('0x2')]},'password':{'type':Sequelize[_0x3a3b('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x3a3b('0x2')]},'serverUrl':{'type':Sequelize[_0x3a3b('0x2')]},'description':{'type':Sequelize[_0x3a3b('0x2')]}}; \ No newline at end of file +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 diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index b6b3270..41cc3a2 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 _0x345e=['order','sort','where','filters','merge','filter','includeAll','findAll','catch','show','find','body','update','params','getConfigurations','findOne','Dynamics365Configuration','length','pick','map','options','nolimit','AccountId','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','accountidname','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridtype','parentcaseidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','slainvokedidname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientSecret','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','clientId','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','EntityDefinitions(','Bearer\x20','Attributes','includes','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','forEach','IntegerAttributeMetadata','DateTimeAttributeMetadata','StateAttributeMetadata','send','test','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','Options','Label','UserLocalizedLabel','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','OptionSet','FalseOption','LogicalName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','DisplayName','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','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','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','status','json','count','offset','limit','set','Content-Range','reject','destroy','then','end','sendStatus','stack','name','Dynamics365Account','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty'];(function(_0x46369a,_0x339e16){var _0x1682ad=function(_0x4fa2c5){while(--_0x4fa2c5){_0x46369a['push'](_0x46369a['shift']());}};_0x1682ad(++_0x339e16);}(_0x345e,0x168));var _0xe345=function(_0x61711c,_0x5b2962){_0x61711c=_0x61711c-0x0;var _0x4cf0e9=_0x345e[_0x61711c];return _0x4cf0e9;};'use strict';var pdf=require(_0xe345('0x0'));var emlformat=require(_0xe345('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe345('0x2'));var jsonpatch=require(_0xe345('0x3'));var rp=require(_0xe345('0x4'));var moment=require(_0xe345('0x5'));var BPromise=require(_0xe345('0x6'));var Mustache=require(_0xe345('0x7'));var util=require(_0xe345('0x8'));var path=require(_0xe345('0x9'));var sox=require(_0xe345('0xa'));var csv=require('to-csv');var ejs=require(_0xe345('0xb'));var fs=require('fs');var _=require(_0xe345('0xc'));var squel=require(_0xe345('0xd'));var crypto=require(_0xe345('0xe'));var jsforce=require(_0xe345('0xf'));var deskjs=require(_0xe345('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe345('0x11'));var Redis=require(_0xe345('0x12'));var authService=require(_0xe345('0x13'));var qs=require(_0xe345('0x14'));var as=require(_0xe345('0x15'));var hardwareService=require(_0xe345('0x16'));var logger=require(_0xe345('0x17'))(_0xe345('0x18'));var utils=require(_0xe345('0x19'));var config=require(_0xe345('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0xe345('0x1b'));var jayson=require(_0xe345('0x1c'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x2be002,_0x5bd8d6,_0x2230b7){if(_0x2230b7){var _0x4ee2e9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4ee2e9['test'](_0x5bd8d6)){return _0x2be002;}else{throw new db[(_0xe345('0x1d'))][(_0xe345('0x1e'))](_0xe345('0x1f'));}}else{return _0x2be002;}}function respondWithRpcPromise(_0x60ee31,_0x263ee0,_0x1ce318,_0x1d3717){return new BPromise(function(_0x52e7b0,_0x3a3f32){var _0x1f983c=_0x1d3717||client;return _0x1f983c['request'](_0x60ee31,_0x1ce318)['then'](function(_0x2979a6){logger[_0xe345('0x20')](_0xe345('0x21'),_0x263ee0,_0xe345('0x22'));logger[_0xe345('0x23')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x263ee0,_0xe345('0x22'),JSON[_0xe345('0x24')](_0x2979a6));if(_0x2979a6['error']){if(_0x2979a6[_0xe345('0x25')][_0xe345('0x26')]===0x1f4){logger[_0xe345('0x25')](_0xe345('0x21'),_0x263ee0,_0x2979a6[_0xe345('0x25')][_0xe345('0x27')]);return _0x3a3f32(_0x2979a6['error'][_0xe345('0x27')]);}logger['error'](_0xe345('0x21'),_0x263ee0,_0x2979a6['error'][_0xe345('0x27')]);return _0x52e7b0(_0x2979a6[_0xe345('0x25')][_0xe345('0x27')]);}else{logger[_0xe345('0x20')]('Dynamics365Account,\x20%s,\x20%s',_0x263ee0,'request\x20sent');_0x52e7b0(_0x2979a6[_0xe345('0x28')][_0xe345('0x27')]);}})['catch'](function(_0x575c9a){logger['error'](_0xe345('0x21'),_0x263ee0,_0x575c9a);_0x3a3f32(_0x575c9a);});});}function respondWithStatusCode(_0x146b95,_0x305439){_0x305439=_0x305439||0xcc;return function(_0x58cddd){if(_0x58cddd){return _0x146b95['sendStatus'](_0x305439);}return _0x146b95[_0xe345('0x29')](_0x305439)['end']();};}function respondWithResult(_0x22b1bc,_0x76b74c){_0x76b74c=_0x76b74c||0xc8;return function(_0x4cd00e){if(_0x4cd00e){return _0x22b1bc['status'](_0x76b74c)[_0xe345('0x2a')](_0x4cd00e);}};}function respondWithFilteredResult(_0x5b527a,_0xa1c821){return function(_0x4aee1f){if(_0x4aee1f){var _0x148f8f=_0x4aee1f[_0xe345('0x2b')],_0x5915e8=_0xa1c821[_0xe345('0x2c')],_0x536c3a=_0xa1c821[_0xe345('0x2c')]+_0xa1c821[_0xe345('0x2d')],_0x2a8cc7;if(_0x536c3a>=_0x148f8f){_0x536c3a=_0x148f8f;_0x2a8cc7=0xc8;}else{_0x2a8cc7=0xce;}_0x5b527a['status'](_0x2a8cc7);return _0x5b527a[_0xe345('0x2e')](_0xe345('0x2f'),_0x5915e8+'-'+_0x536c3a+'/'+_0x148f8f)[_0xe345('0x2a')](_0x4aee1f);}return null;};}function patchUpdates(_0x1bb9f7){return function(_0xd714a8){try{jsonpatch['apply'](_0xd714a8,_0x1bb9f7,!![]);}catch(_0x163abd){return BPromise[_0xe345('0x30')](_0x163abd);}return _0xd714a8['save']();};}function saveUpdates(_0x150df8,_0x43d4af){return function(_0x2acfff){if(_0x2acfff){return _0x2acfff['update'](_0x150df8)['then'](function(_0x230ab7){return _0x230ab7;});}return null;};}function removeEntity(_0x5c94f7,_0x581aec){return function(_0x1d5283){if(_0x1d5283){return _0x1d5283[_0xe345('0x31')]()[_0xe345('0x32')](function(){_0x5c94f7[_0xe345('0x29')](0xcc)[_0xe345('0x33')]();});}};}function handleEntityNotFound(_0x3361eb,_0x15d8f2){return function(_0x3ae902){if(!_0x3ae902){_0x3361eb[_0xe345('0x34')](0x194);}return _0x3ae902;};}function handleError(_0x528cd5,_0xf39f6d){_0xf39f6d=_0xf39f6d||0x1f4;return function(_0xd29db8){logger[_0xe345('0x25')](_0xd29db8[_0xe345('0x35')]);if(_0xd29db8[_0xe345('0x36')]){delete _0xd29db8[_0xe345('0x36')];}_0x528cd5['status'](_0xf39f6d)['send'](_0xd29db8);};}exports['index']=function(_0x2ca35b,_0x5d938f){var _0x46e5b4={},_0x38a7d9={},_0x39b293={'count':0x0,'rows':[]};var _0x2b719c=_['map'](db[_0xe345('0x37')][_0xe345('0x38')],function(_0x1661f1){return{'name':_0x1661f1['fieldName'],'type':_0x1661f1[_0xe345('0x39')][_0xe345('0x3a')]};});_0x38a7d9[_0xe345('0x3b')]=_['map'](_0x2b719c,'name');_0x38a7d9[_0xe345('0x3c')]=_[_0xe345('0x3d')](_0x2ca35b[_0xe345('0x3c')]);_0x38a7d9['filters']=_['intersection'](_0x38a7d9[_0xe345('0x3b')],_0x38a7d9[_0xe345('0x3c')]);_0x46e5b4[_0xe345('0x3e')]=_[_0xe345('0x3f')](_0x38a7d9[_0xe345('0x3b')],qs[_0xe345('0x40')](_0x2ca35b[_0xe345('0x3c')][_0xe345('0x40')]));_0x46e5b4[_0xe345('0x3e')]=_0x46e5b4[_0xe345('0x3e')]['length']?_0x46e5b4[_0xe345('0x3e')]:_0x38a7d9[_0xe345('0x3b')];if(!_0x2ca35b[_0xe345('0x3c')][_0xe345('0x41')]('nolimit')){_0x46e5b4['limit']=qs['limit'](_0x2ca35b[_0xe345('0x3c')][_0xe345('0x2d')]);_0x46e5b4[_0xe345('0x2c')]=qs[_0xe345('0x2c')](_0x2ca35b[_0xe345('0x3c')][_0xe345('0x2c')]);}_0x46e5b4[_0xe345('0x42')]=qs[_0xe345('0x43')](_0x2ca35b['query'][_0xe345('0x43')]);_0x46e5b4[_0xe345('0x44')]=qs['filters'](_['pick'](_0x2ca35b[_0xe345('0x3c')],_0x38a7d9[_0xe345('0x45')]));if(_0x2ca35b[_0xe345('0x3c')]['filter']){_0x46e5b4[_0xe345('0x44')]=_[_0xe345('0x46')](_0x46e5b4['where'],{'$or':_['map'](_0x2b719c,function(_0x24cf42){if(_0x24cf42[_0xe345('0x39')]!=='VIRTUAL'){var _0x4cfb30={};_0x4cfb30[_0x24cf42[_0xe345('0x36')]]={'$like':'%'+_0x2ca35b['query'][_0xe345('0x47')]+'%'};return _0x4cfb30;}})});}_0x46e5b4=_['merge']({},_0x46e5b4,_0x2ca35b['options']);var _0xa67d={'where':_0x46e5b4[_0xe345('0x44')]};return db[_0xe345('0x37')][_0xe345('0x2b')](_0xa67d)[_0xe345('0x32')](function(_0xdf2b73){_0x39b293[_0xe345('0x2b')]=_0xdf2b73;if(_0x2ca35b[_0xe345('0x3c')][_0xe345('0x48')]){_0x46e5b4['include']=[{'all':!![]}];}return db['Dynamics365Account'][_0xe345('0x49')](_0x46e5b4);})[_0xe345('0x32')](function(_0x211a12){_0x39b293['rows']=_0x211a12;return _0x39b293;})[_0xe345('0x32')](respondWithFilteredResult(_0x5d938f,_0x46e5b4))[_0xe345('0x4a')](handleError(_0x5d938f,null));};exports[_0xe345('0x4b')]=function(_0x22d1fe,_0x45ef35){var _0x4b495b={'raw':![],'where':{'id':_0x22d1fe['params']['id']}},_0x5c32e5={};_0x5c32e5[_0xe345('0x3b')]=_[_0xe345('0x3d')](db[_0xe345('0x37')][_0xe345('0x38')]);_0x5c32e5[_0xe345('0x3c')]=_[_0xe345('0x3d')](_0x22d1fe['query']);_0x5c32e5[_0xe345('0x45')]=_['intersection'](_0x5c32e5[_0xe345('0x3b')],_0x5c32e5[_0xe345('0x3c')]);_0x4b495b[_0xe345('0x3e')]=_['intersection'](_0x5c32e5[_0xe345('0x3b')],qs[_0xe345('0x40')](_0x22d1fe['query'][_0xe345('0x40')]));_0x4b495b[_0xe345('0x3e')]=_0x4b495b[_0xe345('0x3e')]['length']?_0x4b495b[_0xe345('0x3e')]:_0x5c32e5['model'];if(_0x22d1fe[_0xe345('0x3c')][_0xe345('0x48')]){_0x4b495b['include']=[{'all':!![]}];}_0x4b495b=_[_0xe345('0x46')]({},_0x4b495b,_0x22d1fe['options']);return db['Dynamics365Account'][_0xe345('0x4c')](_0x4b495b)[_0xe345('0x32')](handleEntityNotFound(_0x45ef35,null))[_0xe345('0x32')](respondWithResult(_0x45ef35,null))['catch'](handleError(_0x45ef35,null));};exports['create']=function(_0x50e159,_0xab40b9){return db[_0xe345('0x37')]['create'](_0x50e159[_0xe345('0x4d')],{})[_0xe345('0x32')](respondWithResult(_0xab40b9,0xc9))[_0xe345('0x4a')](handleError(_0xab40b9,null));};exports[_0xe345('0x4e')]=function(_0x5ebe3f,_0x2fce94){if(_0x5ebe3f[_0xe345('0x4d')]['id']){delete _0x5ebe3f[_0xe345('0x4d')]['id'];}return db['Dynamics365Account'][_0xe345('0x4c')]({'where':{'id':_0x5ebe3f[_0xe345('0x4f')]['id']}})[_0xe345('0x32')](handleEntityNotFound(_0x2fce94,null))[_0xe345('0x32')](saveUpdates(_0x5ebe3f[_0xe345('0x4d')],null))[_0xe345('0x32')](respondWithResult(_0x2fce94,null))[_0xe345('0x4a')](handleError(_0x2fce94,null));};exports['destroy']=function(_0x1d7cd3,_0x5c6485){return db[_0xe345('0x37')]['find']({'where':{'id':_0x1d7cd3['params']['id']}})['then'](handleEntityNotFound(_0x5c6485,null))[_0xe345('0x32')](removeEntity(_0x5c6485,null))[_0xe345('0x4a')](handleError(_0x5c6485,null));};exports[_0xe345('0x50')]=function(_0x51d7ca,_0x29c37d,_0xed459b){var _0x16d491={};var _0x282031={};var _0x2eba02;var _0x490f9f;return db[_0xe345('0x37')][_0xe345('0x51')]({'where':{'id':_0x51d7ca[_0xe345('0x4f')]['id']}})[_0xe345('0x32')](handleEntityNotFound(_0x29c37d,null))[_0xe345('0x32')](function(_0x2f974a){if(_0x2f974a){_0x2eba02=_0x2f974a;_0x282031[_0xe345('0x3b')]=_[_0xe345('0x3d')](db[_0xe345('0x52')][_0xe345('0x38')]);_0x282031[_0xe345('0x3c')]=_[_0xe345('0x3d')](_0x51d7ca['query']);_0x282031[_0xe345('0x45')]=_[_0xe345('0x3f')](_0x282031[_0xe345('0x3b')],_0x282031[_0xe345('0x3c')]);_0x16d491[_0xe345('0x3e')]=_[_0xe345('0x3f')](_0x282031[_0xe345('0x3b')],qs[_0xe345('0x40')](_0x51d7ca[_0xe345('0x3c')][_0xe345('0x40')]));_0x16d491['attributes']=_0x16d491[_0xe345('0x3e')][_0xe345('0x53')]?_0x16d491[_0xe345('0x3e')]:_0x282031[_0xe345('0x3b')];_0x16d491['order']=qs[_0xe345('0x43')](_0x51d7ca[_0xe345('0x3c')][_0xe345('0x43')]);_0x16d491[_0xe345('0x44')]=qs['filters'](_[_0xe345('0x54')](_0x51d7ca[_0xe345('0x3c')],_0x282031[_0xe345('0x45')]));if(_0x51d7ca[_0xe345('0x3c')]['filter']){_0x16d491['where']=_['merge'](_0x16d491[_0xe345('0x44')],{'$or':_[_0xe345('0x55')](_0x16d491[_0xe345('0x3e')],function(_0x468d5a){var _0x3ac4ad={};_0x3ac4ad[_0x468d5a]={'$like':'%'+_0x51d7ca[_0xe345('0x3c')]['filter']+'%'};return _0x3ac4ad;})});}_0x16d491=_[_0xe345('0x46')]({},_0x16d491,_0x51d7ca[_0xe345('0x56')]);return _0x2eba02[_0xe345('0x50')](_0x16d491);}})[_0xe345('0x32')](function(_0x498091){if(_0x498091){_0x490f9f=_0x498091[_0xe345('0x53')];if(!_0x51d7ca['query'][_0xe345('0x41')](_0xe345('0x57'))){_0x16d491[_0xe345('0x2d')]=qs[_0xe345('0x2d')](_0x51d7ca['query'][_0xe345('0x2d')]);_0x16d491[_0xe345('0x2c')]=qs[_0xe345('0x2c')](_0x51d7ca['query']['offset']);}return _0x2eba02['getConfigurations'](_0x16d491);}})[_0xe345('0x32')](function(_0x17c44d){if(_0x17c44d){return _0x17c44d?{'count':_0x490f9f,'rows':_0x17c44d}:null;}})[_0xe345('0x32')](respondWithResult(_0x29c37d,null))[_0xe345('0x4a')](handleError(_0x29c37d,null));};exports['addConfiguration']=function(_0x2dc1a7,_0x476e58,_0x452051){if(_0x2dc1a7[_0xe345('0x4d')]['id']){delete _0x2dc1a7[_0xe345('0x4d')]['id'];}return db[_0xe345('0x37')][_0xe345('0x51')]({'where':{'id':_0x2dc1a7['params']['id']}})[_0xe345('0x32')](handleEntityNotFound(_0x476e58,null))[_0xe345('0x32')](function(_0x235e4b){if(_0x235e4b){_0x2dc1a7['body'][_0xe345('0x58')]=_0x235e4b['id'];_0x2dc1a7[_0xe345('0x4d')]['Subjects']=integrations[_0xe345('0x59')](_0x2dc1a7[_0xe345('0x4d')][_0xe345('0x5a')],_0x2dc1a7[_0xe345('0x4d')][_0xe345('0x39')]);_0x2dc1a7[_0xe345('0x4d')][_0xe345('0x5b')]=integrations[_0xe345('0x5c')](_0x2dc1a7[_0xe345('0x4d')][_0xe345('0x5a')],_0x2dc1a7['body'][_0xe345('0x39')]);return db['Dynamics365Configuration']['create'](_0x2dc1a7[_0xe345('0x4d')],{'include':[{'model':db['Dynamics365Field'],'as':'Subjects'},{'model':db[_0xe345('0x5d')],'as':'Descriptions'}]});}return null;})[_0xe345('0x32')](respondWithResult(_0x476e58,null))[_0xe345('0x4a')](handleError(_0x476e58,null));};exports[_0xe345('0x5e')]=function(_0x658b51,_0x18d4b2,_0x198b02){var _0x46ddcb=_0x658b51[_0xe345('0x3c')][_0xe345('0x5f')];var _0x48ddd5=_0x46ddcb===_0xe345('0x60')?_0xe345('0x61'):_0xe345('0x62');var _0x28bed2='';var _0x52a178='';var _0xafb74d='';var _0x281774='';var _0x2d2681='';var _0x46d22c='';var _0x53aa92='';var _0x3cfeb2='';var _0x16f894=[_0xe345('0x63'),_0xe345('0x64'),_0xe345('0x65'),_0xe345('0x66'),_0xe345('0x67'),'subject',_0xe345('0x68'),_0xe345('0x69'),'directioncode','phonecall_activity_parties'];var _0x2d17da=[_0xe345('0x6a'),'accountidyominame',_0xe345('0x6b'),_0xe345('0x6c'),_0xe345('0x6d'),_0xe345('0x6e'),_0xe345('0x6f'),'contractidname',_0xe345('0x70'),_0xe345('0x71'),_0xe345('0x72'),_0xe345('0x73'),_0xe345('0x74'),_0xe345('0x75'),_0xe345('0x76'),_0xe345('0x77'),_0xe345('0x78'),_0xe345('0x79'),_0xe345('0x7a'),'entitlementidname','entityimage_timestamp','entityimage_url','escalatedon',_0xe345('0x7b'),_0xe345('0x7c'),_0xe345('0x7d'),_0xe345('0x7e'),_0xe345('0x7f'),_0xe345('0x80'),'lastonholdtime',_0xe345('0x81'),_0xe345('0x82'),_0xe345('0x83'),_0xe345('0x84'),_0xe345('0x85'),_0xe345('0x86'),_0xe345('0x87'),'modifiedonbehalfbyyominame',_0xe345('0x88'),_0xe345('0x89'),_0xe345('0x8a'),_0xe345('0x8b'),_0xe345('0x8c'),'owneridname',_0xe345('0x8d'),'owneridyominame',_0xe345('0x8e'),'primarycontactidname',_0xe345('0x8f'),_0xe345('0x90'),_0xe345('0x91'),_0xe345('0x92'),_0xe345('0x93'),_0xe345('0x94'),_0xe345('0x95'),'responsiblecontactidname',_0xe345('0x96'),'sentimentvalue',_0xe345('0x97'),'slaname',_0xe345('0x98'),_0xe345('0x99'),_0xe345('0x9a'),_0xe345('0x9b'),_0xe345('0x9c'),_0xe345('0x9d'),'transactioncurrencyidname','traversedpath',_0xe345('0x9e'),_0xe345('0x9f')];var _0x2e107e=_0x16f894[_0xe345('0xa0')](_0x2d17da);return db[_0xe345('0x37')][_0xe345('0x51')]({'where':{'id':_0x658b51[_0xe345('0x4f')]['id']},'attributes':['id',_0xe345('0xa1'),_0xe345('0xa2'),_0xe345('0xa3'),_0xe345('0xa4'),'clientId',_0xe345('0xa5')]})[_0xe345('0x32')](handleEntityNotFound(_0x18d4b2,null))[_0xe345('0x32')](function(_0x1b691f){if(_0x1b691f){_0x3cfeb2=_0x1b691f[_0xe345('0xa3')];var _0x5afc25=_0x3cfeb2[_0xe345('0xa6')](-0x1);if(_0x5afc25==='/'){_0x3cfeb2=_0x3cfeb2[_0xe345('0xa7')](0x0,_0x3cfeb2[_0xe345('0xa8')](_0x5afc25));}_0x53aa92=util[_0xe345('0xa9')](_0xe345('0xaa'),_0x3cfeb2);var _0x9a3ba={'method':_0xe345('0xab'),'uri':_0xe345('0xac')+_0x1b691f[_0xe345('0xa4')]+_0xe345('0xad'),'form':{'client_id':_0x1b691f[_0xe345('0xae')],'resource':_0x3cfeb2,'username':_0x1b691f[_0xe345('0xa1')],'password':_0x1b691f['password'],'grant_type':_0xe345('0xa2'),'client_secret':_0x1b691f['clientSecret']},'json':!![]};return rp(_0x9a3ba);}})[_0xe345('0x32')](function(_0x5a8793){_0x46d22c=_0x5a8793[_0xe345('0xaf')];var _0x28466d={'method':_0xe345('0xb0'),'uri':encodeURI(_0x53aa92+_0xe345('0xb1')+_0x48ddd5+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x46d22c,'If-None-Match':null,'OData-Version':_0xe345('0xb2')},'json':!![]};return rp(_0x28466d);})[_0xe345('0x32')](function(_0x5884f5){var _0xffa7c=_0x5884f5[_0xe345('0xb3')][0x0];var _0x18aa6f=_0xffa7c[_0xe345('0xb4')];var _0x17d644={'method':'GET','uri':_0x53aa92+_0xe345('0xb5')+_0x18aa6f+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xe345('0xb6')+_0x46d22c,'If-None-Match':null,'OData-Version':_0xe345('0xb2')},'json':!![]};return rp(_0x17d644);})['then'](function(_0x438618){_0x28bed2=_0x438618;_0x52a178=_0x28bed2[_0xe345('0xb7')];_0x52a178=_['remove'](_0x52a178,function(_0x4b1f6c){return!_0x2e107e[_0xe345('0xb8')](_0x4b1f6c['LogicalName']);});var _0x437538=[];var _0x26bb5c=[];_0x52a178['forEach'](function(_0xc5a0e3){if(_0xc5a0e3['@odata.type']){var _0x997d74=_0xc5a0e3[_0xe345('0xb9')][_0xe345('0xa7')](_0xc5a0e3[_0xe345('0xb9')]['lastIndexOf']('.')+0x1);if(_0x997d74===_0xe345('0xba')){_0x437538[_0xe345('0xbb')](getSelectList(_0x53aa92,_0x46ddcb,_0x26bb5c,_0x28bed2[_0xe345('0xb4')],_0xc5a0e3[_0xe345('0xb4')],_0x46d22c));}}});return Promise[_0xe345('0xbc')](_0x437538);})[_0xe345('0x32')](function(_0x4c1488){_0xafb74d=_0x4c1488[0x0];var _0x53743f=[];var _0x275949=[];_0x52a178['forEach'](function(_0x1f9445){if(!_[_0xe345('0xbd')](_0x1f9445[_0xe345('0xb9')])){var _0x11dd3d=_0x1f9445[_0xe345('0xb9')][_0xe345('0xa7')](_0x1f9445['@odata.type']['lastIndexOf']('.')+0x1);if(_0x11dd3d===_0xe345('0xbe')){_0x53743f[_0xe345('0xbb')](getBooleanList(_0x53aa92,_0x46ddcb,_0x275949,_0x28bed2['MetadataId'],_0x1f9445['MetadataId'],_0x46d22c));}}});return Promise['all'](_0x53743f);})[_0xe345('0x32')](function(_0x1d3e6a){_0x281774=_0x1d3e6a[0x0];var _0x2fb6f4=[];var _0x7c1b2=[];_0x52a178[_0xe345('0xbf')](function(_0xf72bc1){if(_0xf72bc1[_0xe345('0xb9')]){var _0x2ba0a8=_0xf72bc1[_0xe345('0xb9')][_0xe345('0xa7')](_0xf72bc1[_0xe345('0xb9')][_0xe345('0xa8')]('.')+0x1);if(_0x2ba0a8==='StringAttributeMetadata'||_0x2ba0a8==='DoubleAttributeMetadata'||_0x2ba0a8==='BigIntAttributeMetadata'||_0x2ba0a8===_0xe345('0xc0')||_0x2ba0a8==='MemoAttributeMetadata'||_0x2ba0a8===_0xe345('0xc1')||_0x2ba0a8==='StatusAttributeMetadata'||_0x2ba0a8==='EntityNameAttributeMetadata'||_0x2ba0a8===_0xe345('0xc2')||_0x2ba0a8==='DecimalAttributeMetadata'){_0x2fb6f4[_0xe345('0xbb')](getInputList(_0x53aa92,_0x46ddcb,_0x2ba0a8,_0x7c1b2,_0x28bed2[_0xe345('0xb4')],_0xf72bc1['MetadataId'],_0x46d22c));}}});return Promise['all'](_0x2fb6f4);})[_0xe345('0x32')](function(_0x2a9817){_0x2d2681=_0x2a9817[0x0];var _0x335d65=_0xafb74d[_0xe345('0xa0')](_0x281774)[_0xe345('0xa0')](_0x2d2681);var _0x4332b3={'count':_0x335d65[_0xe345('0x53')],'rows':_0x335d65};return _0x4332b3;})[_0xe345('0x32')](respondWithResult(_0x18d4b2,null))[_0xe345('0x4a')](function(_0x4a6851){var _0x1d7b54=_0x658b51[_0xe345('0x3c')]['test']?0x1f4:_0x4a6851['statusCode']||0x1f4;logger[_0xe345('0x25')](_0x4a6851['stack']);delete _0x4a6851['name'];if(_0x1d7b54===0x191){_0x1d7b54=0x190;}_0x18d4b2[_0xe345('0x29')](_0x1d7b54)[_0xe345('0xc3')](_0x658b51[_0xe345('0x3c')][_0xe345('0xc4')]?{'message':'Wrong\x20credentials','statusCode':_0x4a6851[_0xe345('0xc5')]}:_0x4a6851);});};function getSelectList(_0x4b8ce1,_0x1e10b6,_0x38dda9,_0x4c5cfe,_0x12cc73,_0x11db40){var _0x69948f={'method':_0xe345('0xb0'),'uri':_0x4b8ce1+_0xe345('0xb5')+_0x4c5cfe+_0xe345('0xc6')+_0x12cc73+_0xe345('0xc7')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0xe345('0xb6')+_0x11db40,'If-None-Match':null,'OData-Version':_0xe345('0xb2')},'json':!![]};return rp(_0x69948f)[_0xe345('0x32')](function(_0x41d450){var _0x382e54=[];var _0x161d61=_0x41d450['OptionSet'][_0xe345('0xc8')];_0x161d61[_0xe345('0xbf')](function(_0x4e4339){_0x382e54[_0xe345('0xbb')]({'name':_0x4e4339[_0xe345('0xc9')][_0xe345('0xca')][_0xe345('0xc9')],'value':String(_0x4e4339[_0xe345('0xcb')])});});var _0x148ad5={'id':_0x1e10b6+'_'+_0x41d450['LogicalName'],'name':_0x41d450['DisplayName'][_0xe345('0xca')][_0xe345('0xc9')],'custom':![],'options':_0x382e54};_0x38dda9[_0xe345('0xbb')](_0x148ad5);return _0x38dda9;});}function getBooleanList(_0x259030,_0x183f31,_0x4eafe0,_0x1f4c7c,_0x3f5d6d,_0x3b99aa){var _0x4738ce={'method':_0xe345('0xb0'),'uri':_0x259030+_0xe345('0xb5')+_0x1f4c7c+_0xe345('0xc6')+_0x3f5d6d+_0xe345('0xcc'),'headers':{'Authorization':_0xe345('0xb6')+_0x3b99aa,'If-None-Match':null,'OData-Version':_0xe345('0xb2')},'json':!![]};return rp(_0x4738ce)['then'](function(_0x2ac8b8){var _0x178e63=[];_0x178e63[_0xe345('0xbb')]({'name':_0x2ac8b8['OptionSet'][_0xe345('0xcd')][_0xe345('0xc9')]['UserLocalizedLabel'][_0xe345('0xc9')],'value':_0xe345('0xce')},{'name':_0x2ac8b8[_0xe345('0xcf')][_0xe345('0xd0')]['Label'][_0xe345('0xca')]['Label'],'value':'false'});var _0x76bd9a={'id':_0x183f31+'_'+_0x2ac8b8[_0xe345('0xd1')],'name':_0x2ac8b8['DisplayName'][_0xe345('0xca')][_0xe345('0xc9')],'custom':![],'options':_0x178e63};_0x4eafe0[_0xe345('0xbb')](_0x76bd9a);return _0x4eafe0;});}function getInputList(_0x22dccc,_0x5cb4ef,_0x2562dc,_0x3c36c6,_0x34098f,_0x3251f8,_0x23418e){var _0x2801fe={'method':'GET','uri':_0x22dccc+_0xe345('0xb5')+_0x34098f+_0xe345('0xc6')+_0x3251f8+_0xe345('0xd2')+_0x2562dc+_0xe345('0xd3'),'headers':{'Authorization':_0xe345('0xb6')+_0x23418e,'If-None-Match':null,'OData-Version':_0xe345('0xb2')},'json':!![]};return rp(_0x2801fe)[_0xe345('0x32')](function(_0x303c3c){var _0x420184={'id':_0x5cb4ef+'_'+_0x303c3c['LogicalName'],'name':_0x303c3c['DisplayName'][_0xe345('0xca')]?_0x303c3c[_0xe345('0xd4')][_0xe345('0xca')][_0xe345('0xc9')]:_0x303c3c['LogicalName'],'custom':![],'options':[]};_0x3c36c6['push'](_0x420184);return _0x3c36c6;});} \ No newline at end of file +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 diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index eba87a9..793b8cd 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 _0x2178=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','exports','define','Dynamics365Account','lodash'];(function(_0x4945cd,_0x2422a2){var _0x58bda1=function(_0x5ddb2d){while(--_0x5ddb2d){_0x4945cd['push'](_0x4945cd['shift']());}};_0x58bda1(++_0x2422a2);}(_0x2178,0x12b));var _0x8217=function(_0x7c13ed,_0x4d9dd5){_0x7c13ed=_0x7c13ed-0x0;var _0x4cad66=_0x2178[_0x7c13ed];return _0x4cad66;};'use strict';var _=require(_0x8217('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8217('0x1'));var moment=require(_0x8217('0x2'));var BPromise=require(_0x8217('0x3'));var rp=require(_0x8217('0x4'));var fs=require('fs');var path=require(_0x8217('0x5'));var rimraf=require(_0x8217('0x6'));var config=require(_0x8217('0x7'));var attributes=require(_0x8217('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x8217('0x9')]=function(_0x16ca1b,_0x3939de){return _0x16ca1b[_0x8217('0xa')](_0x8217('0xb'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 0a5fb73..9fb4a1b 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 _0x444e=['ShowDynamics365Account','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','error','Dynamics365Account,\x20%s,\x20%s','message','info','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','stringify'];(function(_0x67442c,_0x291a4b){var _0x294d01=function(_0x40e158){while(--_0x40e158){_0x67442c['push'](_0x67442c['shift']());}};_0x294d01(++_0x291a4b);}(_0x444e,0xe8));var _0xe444=function(_0x5fc25e,_0x57f13c){_0x5fc25e=_0x5fc25e-0x0;var _0x3ca7c1=_0x444e[_0x5fc25e];return _0x3ca7c1;};'use strict';var _=require(_0xe444('0x0'));var util=require('util');var moment=require(_0xe444('0x1'));var BPromise=require('bluebird');var rs=require(_0xe444('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe444('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xe444('0x4'))(_0xe444('0x5'));var config=require(_0xe444('0x6'));var jayson=require(_0xe444('0x7'));var client=jayson[_0xe444('0x8')][_0xe444('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4834c7,_0xfbd88b,_0x4b5b7d){return new BPromise(function(_0x29a2b7,_0x482b98){return client[_0xe444('0xa')](_0x4834c7,_0x4b5b7d)[_0xe444('0xb')](function(_0x40a368){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0xfbd88b,_0xe444('0xc'));logger[_0xe444('0xd')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0xfbd88b,_0xe444('0xc'),JSON['stringify'](_0x40a368));if(_0x40a368['error']){if(_0x40a368[_0xe444('0xe')]['code']===0x1f4){logger[_0xe444('0xe')](_0xe444('0xf'),_0xfbd88b,_0x40a368['error'][_0xe444('0x10')]);return _0x482b98(_0x40a368['error']['message']);}logger[_0xe444('0xe')](_0xe444('0xf'),_0xfbd88b,_0x40a368['error'][_0xe444('0x10')]);return _0x29a2b7(_0x40a368['error'][_0xe444('0x10')]);}else{logger[_0xe444('0x11')](_0xe444('0xf'),_0xfbd88b,_0xe444('0xc'));_0x29a2b7(_0x40a368[_0xe444('0x12')][_0xe444('0x10')]);}})[_0xe444('0x13')](function(_0x3e1b57){logger[_0xe444('0xe')](_0xe444('0xf'),_0xfbd88b,_0x3e1b57);_0x482b98(_0x3e1b57);});});}exports[_0xe444('0x14')]=function(_0x3d9066){var _0x38879b=this;return new Promise(function(_0x4e2711,_0x3407a2){return db[_0xe444('0x15')][_0xe444('0x16')]({'raw':_0x3d9066[_0xe444('0x17')]?_0x3d9066['options'][_0xe444('0x18')]===undefined?!![]:![]:!![],'where':_0x3d9066[_0xe444('0x17')]?_0x3d9066[_0xe444('0x17')][_0xe444('0x19')]||null:null,'attributes':_0x3d9066[_0xe444('0x17')]?_0x3d9066['options'][_0xe444('0x1a')]||null:null,'limit':_0x3d9066[_0xe444('0x17')]?_0x3d9066['options'][_0xe444('0x1b')]||null:null,'include':_0x3d9066['options']?_0x3d9066[_0xe444('0x17')][_0xe444('0x1c')]?_[_0xe444('0x1d')](_0x3d9066[_0xe444('0x17')][_0xe444('0x1c')],function(_0x481762){return{'model':db[_0x481762['model']],'as':_0x481762['as'],'attributes':_0x481762[_0xe444('0x1a')],'include':_0x481762[_0xe444('0x1c')]?_[_0xe444('0x1d')](_0x481762[_0xe444('0x1c')],function(_0x2a03a2){return{'model':db[_0x2a03a2['model']],'as':_0x2a03a2['as'],'attributes':_0x2a03a2[_0xe444('0x1a')],'include':_0x2a03a2[_0xe444('0x1c')]?_['map'](_0x2a03a2[_0xe444('0x1c')],function(_0x4f4412){return{'model':db[_0x4f4412[_0xe444('0x1e')]],'as':_0x4f4412['as'],'attributes':_0x4f4412[_0xe444('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe444('0xb')](function(_0x23072c){logger[_0xe444('0x11')]('GetDynamics365Account',_0x3d9066);logger[_0xe444('0xd')](_0xe444('0x14'),_0x3d9066,JSON[_0xe444('0x1f')](_0x23072c));_0x4e2711(_0x23072c);})[_0xe444('0x13')](function(_0x5bc063){logger['error'](_0xe444('0x14'),_0x5bc063[_0xe444('0x10')],_0x3d9066);_0x3407a2(_0x38879b[_0xe444('0xe')](0x1f4,_0x5bc063[_0xe444('0x10')]));});});};exports['ShowDynamics365Account']=function(_0x26e233){var _0x224785=this;return new Promise(function(_0x41eac0,_0x922e16){return db['Dynamics365Account']['find']({'raw':_0x26e233['options']?_0x26e233[_0xe444('0x17')][_0xe444('0x18')]===undefined?!![]:![]:!![],'where':_0x26e233[_0xe444('0x17')]?_0x26e233[_0xe444('0x17')][_0xe444('0x19')]||null:null,'attributes':_0x26e233['options']?_0x26e233[_0xe444('0x17')][_0xe444('0x1a')]||null:null,'include':_0x26e233[_0xe444('0x17')]?_0x26e233['options'][_0xe444('0x1c')]?_['map'](_0x26e233['options'][_0xe444('0x1c')],function(_0x471a11){return{'model':db[_0x471a11['model']],'as':_0x471a11['as'],'attributes':_0x471a11[_0xe444('0x1a')],'include':_0x471a11['include']?_[_0xe444('0x1d')](_0x471a11['include'],function(_0x4b01b9){return{'model':db[_0x4b01b9[_0xe444('0x1e')]],'as':_0x4b01b9['as'],'attributes':_0x4b01b9['attributes'],'include':_0x4b01b9[_0xe444('0x1c')]?_[_0xe444('0x1d')](_0x4b01b9[_0xe444('0x1c')],function(_0x265882){return{'model':db[_0x265882['model']],'as':_0x265882['as'],'attributes':_0x265882[_0xe444('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe444('0xb')](function(_0x231b81){logger['info'](_0xe444('0x20'),_0x26e233);logger['debug'](_0xe444('0x20'),_0x26e233,JSON[_0xe444('0x1f')](_0x231b81));_0x41eac0(_0x231b81);})[_0xe444('0x13')](function(_0x4dc4c9){logger['error'](_0xe444('0x20'),_0x4dc4c9[_0xe444('0x10')],_0x26e233);_0x922e16(_0x224785[_0xe444('0xe')](0x1f4,_0x4dc4c9[_0xe444('0x10')]));});});}; \ No newline at end of file +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 diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index e692803..396d5db 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 _0x3077=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put'];(function(_0x5c468f,_0x2e5c25){var _0x2136b0=function(_0x56b8a4){while(--_0x56b8a4){_0x5c468f['push'](_0x5c468f['shift']());}};_0x2136b0(++_0x2e5c25);}(_0x3077,0xa7));var _0x7307=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x3077[_0x110c3d];return _0x226d67;};'use strict';var multer=require(_0x7307('0x0'));var util=require(_0x7307('0x1'));var path=require(_0x7307('0x2'));var timeout=require(_0x7307('0x3'));var express=require(_0x7307('0x4'));var router=express[_0x7307('0x5')]();var auth=require(_0x7307('0x6'));var interaction=require(_0x7307('0x7'));var config=require(_0x7307('0x8'));var controller=require(_0x7307('0x9'));router[_0x7307('0xa')]('/',auth[_0x7307('0xb')](),controller[_0x7307('0xc')]);router[_0x7307('0xa')]('/:id',auth[_0x7307('0xb')](),controller[_0x7307('0xd')]);router[_0x7307('0xa')](_0x7307('0xe'),auth[_0x7307('0xb')](),controller[_0x7307('0xf')]);router[_0x7307('0xa')](_0x7307('0x10'),auth[_0x7307('0xb')](),controller[_0x7307('0x11')]);router[_0x7307('0xa')](_0x7307('0x12'),auth[_0x7307('0xb')](),controller['getDescriptions']);router[_0x7307('0x13')]('/',auth[_0x7307('0xb')](),controller[_0x7307('0x14')]);router[_0x7307('0x15')](_0x7307('0x16'),auth['isAuthenticated'](),controller[_0x7307('0x17')]);router[_0x7307('0x18')]('/:id',auth[_0x7307('0xb')](),controller[_0x7307('0x19')]);module[_0x7307('0x1a')]=router; \ No newline at end of file +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 diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index eb4a4dd..0b11f27 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 _0xba0c=['incident','exports','STRING','ENUM'];(function(_0xf5d71c,_0x2613a6){var _0x5af672=function(_0x191f52){while(--_0x191f52){_0xf5d71c['push'](_0xf5d71c['shift']());}};_0x5af672(++_0x2613a6);}(_0xba0c,0x12d));var _0xcba0=function(_0x174a0e,_0x519134){_0x174a0e=_0x174a0e-0x0;var _0x45e1b5=_0xba0c[_0x174a0e];return _0x45e1b5;};'use strict';var Sequelize=require('sequelize');module[_0xcba0('0x0')]={'name':{'type':Sequelize[_0xcba0('0x1')]},'description':{'type':Sequelize[_0xcba0('0x1')]},'ticketType':{'type':Sequelize[_0xcba0('0x2')](_0xcba0('0x3'),'phonecall'),'defaultValue':_0xcba0('0x3')}}; \ No newline at end of file +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 diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 7c3a434..9da6587 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 _0x6f19=['catch','show','params','keys','fields','find','create','body','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','limit','json','reject','save','update','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','type','model','query','filters','intersection','length','attributes','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','VIRTUAL','merge','options','count','includeAll','include','findAll','rows'];(function(_0x3ab39d,_0x113f7c){var _0x2a42c5=function(_0x376c12){while(--_0x376c12){_0x3ab39d['push'](_0x3ab39d['shift']());}};_0x2a42c5(++_0x113f7c);}(_0x6f19,0xc7));var _0x96f1=function(_0x33734b,_0xd1ee17){_0x33734b=_0x33734b-0x0;var _0x2360a0=_0x6f19[_0x33734b];return _0x2360a0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x96f1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x96f1('0x1'));var jsonpatch=require(_0x96f1('0x2'));var rp=require(_0x96f1('0x3'));var moment=require(_0x96f1('0x4'));var BPromise=require(_0x96f1('0x5'));var Mustache=require('mustache');var util=require(_0x96f1('0x6'));var path=require(_0x96f1('0x7'));var sox=require(_0x96f1('0x8'));var csv=require(_0x96f1('0x9'));var ejs=require(_0x96f1('0xa'));var fs=require('fs');var _=require(_0x96f1('0xb'));var squel=require('squel');var crypto=require(_0x96f1('0xc'));var jsforce=require(_0x96f1('0xd'));var deskjs=require(_0x96f1('0xe'));var toCsv=require('to-csv');var querystring=require(_0x96f1('0xf'));var Papa=require(_0x96f1('0x10'));var Redis=require('ioredis');var authService=require(_0x96f1('0x11'));var qs=require(_0x96f1('0x12'));var as=require(_0x96f1('0x13'));var hardwareService=require(_0x96f1('0x14'));var logger=require(_0x96f1('0x15'))(_0x96f1('0x16'));var utils=require(_0x96f1('0x17'));var config=require(_0x96f1('0x18'));var db=require(_0x96f1('0x19'))['db'];var jayson=require(_0x96f1('0x1a'));var client=jayson[_0x96f1('0x1b')][_0x96f1('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x4157df,_0x153cc6,_0x2f12e9){if(_0x2f12e9){var _0x2a4260=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2a4260['test'](_0x153cc6)){return _0x4157df;}else{throw new db[(_0x96f1('0x1d'))]['ValidationError'](_0x96f1('0x1e'));}}else{return _0x4157df;}}function respondWithRpcPromise(_0x4347ab,_0x31d3ad,_0x136cf9,_0x36e382){return new BPromise(function(_0x5b3890,_0x3993dc){var _0x129c5e=_0x36e382||client;return _0x129c5e[_0x96f1('0x1f')](_0x4347ab,_0x136cf9)[_0x96f1('0x20')](function(_0x38a313){logger[_0x96f1('0x21')](_0x96f1('0x22'),_0x31d3ad,_0x96f1('0x23'));logger[_0x96f1('0x24')](_0x96f1('0x25'),_0x31d3ad,_0x96f1('0x23'),JSON[_0x96f1('0x26')](_0x38a313));if(_0x38a313['error']){if(_0x38a313[_0x96f1('0x27')][_0x96f1('0x28')]===0x1f4){logger[_0x96f1('0x27')](_0x96f1('0x22'),_0x31d3ad,_0x38a313[_0x96f1('0x27')][_0x96f1('0x29')]);return _0x3993dc(_0x38a313['error'][_0x96f1('0x29')]);}logger['error'](_0x96f1('0x22'),_0x31d3ad,_0x38a313['error']['message']);return _0x5b3890(_0x38a313[_0x96f1('0x27')][_0x96f1('0x29')]);}else{logger[_0x96f1('0x21')](_0x96f1('0x22'),_0x31d3ad,_0x96f1('0x23'));_0x5b3890(_0x38a313['result'][_0x96f1('0x29')]);}})['catch'](function(_0xfae5af){logger[_0x96f1('0x27')]('Dynamics365Configuration,\x20%s,\x20%s',_0x31d3ad,_0xfae5af);_0x3993dc(_0xfae5af);});});}function respondWithStatusCode(_0x5ecdfe,_0x28857b){_0x28857b=_0x28857b||0xcc;return function(_0x708317){if(_0x708317){return _0x5ecdfe[_0x96f1('0x2a')](_0x28857b);}return _0x5ecdfe[_0x96f1('0x2b')](_0x28857b)[_0x96f1('0x2c')]();};}function respondWithResult(_0x6a793,_0x29b9cb){_0x29b9cb=_0x29b9cb||0xc8;return function(_0x5bb141){if(_0x5bb141){return _0x6a793['status'](_0x29b9cb)['json'](_0x5bb141);}};}function respondWithFilteredResult(_0x193433,_0x42cc2a){return function(_0xc9f3f){if(_0xc9f3f){var _0x30b7f5=_0xc9f3f['count'],_0x52cfe5=_0x42cc2a['offset'],_0x44a236=_0x42cc2a['offset']+_0x42cc2a[_0x96f1('0x2d')],_0x2bdf4c;if(_0x44a236>=_0x30b7f5){_0x44a236=_0x30b7f5;_0x2bdf4c=0xc8;}else{_0x2bdf4c=0xce;}_0x193433['status'](_0x2bdf4c);return _0x193433['set']('Content-Range',_0x52cfe5+'-'+_0x44a236+'/'+_0x30b7f5)[_0x96f1('0x2e')](_0xc9f3f);}return null;};}function patchUpdates(_0x51baf9){return function(_0x194aa4){try{jsonpatch['apply'](_0x194aa4,_0x51baf9,!![]);}catch(_0x360d10){return BPromise[_0x96f1('0x2f')](_0x360d10);}return _0x194aa4[_0x96f1('0x30')]();};}function saveUpdates(_0x4c00f5,_0x145458){return function(_0x347f81){if(_0x347f81){return _0x347f81[_0x96f1('0x31')](_0x4c00f5)['then'](function(_0x237499){return _0x237499;});}return null;};}function removeEntity(_0x365382,_0x1a1f38){return function(_0x4fabbf){if(_0x4fabbf){return _0x4fabbf['destroy']()[_0x96f1('0x20')](function(){_0x365382[_0x96f1('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ed019,_0x13a69b){return function(_0x13ec3a){if(!_0x13ec3a){_0x2ed019[_0x96f1('0x2a')](0x194);}return _0x13ec3a;};}function handleError(_0x5b2048,_0x15602a){_0x15602a=_0x15602a||0x1f4;return function(_0x41d50b){logger[_0x96f1('0x27')](_0x41d50b[_0x96f1('0x32')]);if(_0x41d50b[_0x96f1('0x33')]){delete _0x41d50b[_0x96f1('0x33')];}_0x5b2048['status'](_0x15602a)[_0x96f1('0x34')](_0x41d50b);};}exports[_0x96f1('0x35')]=function(_0x137377,_0x38b5fb){var _0x24149e={},_0x807db3={},_0x53e4af={'count':0x0,'rows':[]};var _0x3c6fe3=_[_0x96f1('0x36')](db[_0x96f1('0x37')][_0x96f1('0x38')],function(_0x56fe5b){return{'name':_0x56fe5b['fieldName'],'type':_0x56fe5b[_0x96f1('0x39')]['key']};});_0x807db3[_0x96f1('0x3a')]=_[_0x96f1('0x36')](_0x3c6fe3,_0x96f1('0x33'));_0x807db3[_0x96f1('0x3b')]=_['keys'](_0x137377[_0x96f1('0x3b')]);_0x807db3[_0x96f1('0x3c')]=_[_0x96f1('0x3d')](_0x807db3['model'],_0x807db3[_0x96f1('0x3b')]);_0x24149e['attributes']=_[_0x96f1('0x3d')](_0x807db3[_0x96f1('0x3a')],qs['fields'](_0x137377[_0x96f1('0x3b')]['fields']));_0x24149e['attributes']=_0x24149e['attributes'][_0x96f1('0x3e')]?_0x24149e[_0x96f1('0x3f')]:_0x807db3[_0x96f1('0x3a')];if(!_0x137377[_0x96f1('0x3b')][_0x96f1('0x40')](_0x96f1('0x41'))){_0x24149e[_0x96f1('0x2d')]=qs[_0x96f1('0x2d')](_0x137377[_0x96f1('0x3b')][_0x96f1('0x2d')]);_0x24149e[_0x96f1('0x42')]=qs[_0x96f1('0x42')](_0x137377['query'][_0x96f1('0x42')]);}_0x24149e[_0x96f1('0x43')]=qs[_0x96f1('0x44')](_0x137377[_0x96f1('0x3b')][_0x96f1('0x44')]);_0x24149e['where']=qs[_0x96f1('0x3c')](_[_0x96f1('0x45')](_0x137377[_0x96f1('0x3b')],_0x807db3[_0x96f1('0x3c')]));if(_0x137377['query'][_0x96f1('0x46')]){_0x24149e[_0x96f1('0x47')]=_['merge'](_0x24149e[_0x96f1('0x47')],{'$or':_[_0x96f1('0x36')](_0x3c6fe3,function(_0xeac5d9){if(_0xeac5d9['type']!==_0x96f1('0x48')){var _0x409378={};_0x409378[_0xeac5d9[_0x96f1('0x33')]]={'$like':'%'+_0x137377[_0x96f1('0x3b')][_0x96f1('0x46')]+'%'};return _0x409378;}})});}_0x24149e=_[_0x96f1('0x49')]({},_0x24149e,_0x137377[_0x96f1('0x4a')]);var _0x41f32c={'where':_0x24149e[_0x96f1('0x47')]};return db['Dynamics365Configuration'][_0x96f1('0x4b')](_0x41f32c)[_0x96f1('0x20')](function(_0x29ed54){_0x53e4af[_0x96f1('0x4b')]=_0x29ed54;if(_0x137377['query'][_0x96f1('0x4c')]){_0x24149e[_0x96f1('0x4d')]=[{'all':!![]}];}return db[_0x96f1('0x37')][_0x96f1('0x4e')](_0x24149e);})[_0x96f1('0x20')](function(_0x5eb238){_0x53e4af[_0x96f1('0x4f')]=_0x5eb238;return _0x53e4af;})[_0x96f1('0x20')](respondWithFilteredResult(_0x38b5fb,_0x24149e))[_0x96f1('0x50')](handleError(_0x38b5fb,null));};exports[_0x96f1('0x51')]=function(_0x3ef37e,_0x524dc5){var _0x21e5ad={'raw':![],'where':{'id':_0x3ef37e[_0x96f1('0x52')]['id']}},_0x467767={};_0x467767['model']=_[_0x96f1('0x53')](db['Dynamics365Configuration'][_0x96f1('0x38')]);_0x467767['query']=_[_0x96f1('0x53')](_0x3ef37e['query']);_0x467767['filters']=_[_0x96f1('0x3d')](_0x467767[_0x96f1('0x3a')],_0x467767[_0x96f1('0x3b')]);_0x21e5ad[_0x96f1('0x3f')]=_[_0x96f1('0x3d')](_0x467767['model'],qs[_0x96f1('0x54')](_0x3ef37e['query'][_0x96f1('0x54')]));_0x21e5ad['attributes']=_0x21e5ad['attributes'][_0x96f1('0x3e')]?_0x21e5ad['attributes']:_0x467767['model'];if(_0x3ef37e[_0x96f1('0x3b')]['includeAll']){_0x21e5ad[_0x96f1('0x4d')]=[{'all':!![]}];}_0x21e5ad=_['merge']({},_0x21e5ad,_0x3ef37e['options']);return db[_0x96f1('0x37')][_0x96f1('0x55')](_0x21e5ad)[_0x96f1('0x20')](handleEntityNotFound(_0x524dc5,null))[_0x96f1('0x20')](respondWithResult(_0x524dc5,null))['catch'](handleError(_0x524dc5,null));};exports[_0x96f1('0x56')]=function(_0x4b2e34,_0x4e3c9e){return db[_0x96f1('0x37')]['create'](_0x4b2e34[_0x96f1('0x57')],{})[_0x96f1('0x20')](respondWithResult(_0x4e3c9e,0xc9))[_0x96f1('0x50')](handleError(_0x4e3c9e,null));};exports[_0x96f1('0x31')]=function(_0x38b3e0,_0x525106){if(_0x38b3e0[_0x96f1('0x57')]['id']){delete _0x38b3e0[_0x96f1('0x57')]['id'];}return db[_0x96f1('0x37')][_0x96f1('0x55')]({'where':{'id':_0x38b3e0[_0x96f1('0x52')]['id']}})[_0x96f1('0x20')](handleEntityNotFound(_0x525106,null))[_0x96f1('0x20')](saveUpdates(_0x38b3e0[_0x96f1('0x57')],null))[_0x96f1('0x20')](respondWithResult(_0x525106,null))[_0x96f1('0x50')](handleError(_0x525106,null));};exports['destroy']=function(_0x359730,_0x3f9d29){return db[_0x96f1('0x37')][_0x96f1('0x55')]({'where':{'id':_0x359730[_0x96f1('0x52')]['id']}})['then'](handleEntityNotFound(_0x3f9d29,null))['then'](removeEntity(_0x3f9d29,null))[_0x96f1('0x50')](handleError(_0x3f9d29,null));};exports[_0x96f1('0x58')]=function(_0x641a9e,_0xe741b0,_0x1dbcd1){var _0x196cb2={};var _0x5aa62c={};var _0x5c1f9d;var _0x3d67ea;return db[_0x96f1('0x37')][_0x96f1('0x59')]({'where':{'id':_0x641a9e[_0x96f1('0x52')]['id']}})['then'](handleEntityNotFound(_0xe741b0,null))['then'](function(_0x1f6616){if(_0x1f6616){_0x5c1f9d=_0x1f6616;_0x5aa62c[_0x96f1('0x3a')]=_[_0x96f1('0x53')](db[_0x96f1('0x5a')]['rawAttributes']);_0x5aa62c[_0x96f1('0x3b')]=_[_0x96f1('0x53')](_0x641a9e[_0x96f1('0x3b')]);_0x5aa62c['filters']=_[_0x96f1('0x3d')](_0x5aa62c[_0x96f1('0x3a')],_0x5aa62c[_0x96f1('0x3b')]);_0x196cb2[_0x96f1('0x3f')]=_['intersection'](_0x5aa62c[_0x96f1('0x3a')],qs[_0x96f1('0x54')](_0x641a9e['query'][_0x96f1('0x54')]));_0x196cb2[_0x96f1('0x3f')]=_0x196cb2[_0x96f1('0x3f')][_0x96f1('0x3e')]?_0x196cb2[_0x96f1('0x3f')]:_0x5aa62c[_0x96f1('0x3a')];_0x196cb2[_0x96f1('0x43')]=qs[_0x96f1('0x44')](_0x641a9e[_0x96f1('0x3b')][_0x96f1('0x44')]);_0x196cb2[_0x96f1('0x47')]=qs[_0x96f1('0x3c')](_[_0x96f1('0x45')](_0x641a9e[_0x96f1('0x3b')],_0x5aa62c[_0x96f1('0x3c')]));if(_0x641a9e['query']['filter']){_0x196cb2[_0x96f1('0x47')]=_['merge'](_0x196cb2[_0x96f1('0x47')],{'$or':_['map'](_0x196cb2['attributes'],function(_0x58e1e8){var _0x353d4c={};_0x353d4c[_0x58e1e8]={'$like':'%'+_0x641a9e[_0x96f1('0x3b')][_0x96f1('0x46')]+'%'};return _0x353d4c;})});}_0x196cb2=_[_0x96f1('0x49')]({},_0x196cb2,_0x641a9e['options']);return _0x5c1f9d[_0x96f1('0x58')](_0x196cb2);}})[_0x96f1('0x20')](function(_0x3c2d1e){if(_0x3c2d1e){_0x3d67ea=_0x3c2d1e['length'];if(!_0x641a9e['query'][_0x96f1('0x40')](_0x96f1('0x41'))){_0x196cb2[_0x96f1('0x2d')]=qs['limit'](_0x641a9e[_0x96f1('0x3b')][_0x96f1('0x2d')]);_0x196cb2[_0x96f1('0x42')]=qs[_0x96f1('0x42')](_0x641a9e[_0x96f1('0x3b')][_0x96f1('0x42')]);}return _0x5c1f9d['getFields'](_0x196cb2);}})[_0x96f1('0x20')](function(_0x5d94cb){if(_0x5d94cb){return _0x5d94cb?{'count':_0x3d67ea,'rows':_0x5d94cb}:null;}})[_0x96f1('0x20')](respondWithResult(_0xe741b0,null))[_0x96f1('0x50')](handleError(_0xe741b0,null));};exports['getSubjects']=function(_0x9f75ed,_0x5a11d9,_0x2e521a){var _0x2a27fb={};var _0x332152={};var _0x7fc0cc;var _0x3d3a0a;return db[_0x96f1('0x37')][_0x96f1('0x59')]({'where':{'id':_0x9f75ed[_0x96f1('0x52')]['id']}})[_0x96f1('0x20')](handleEntityNotFound(_0x5a11d9,null))[_0x96f1('0x20')](function(_0x9f5bc8){if(_0x9f5bc8){_0x7fc0cc=_0x9f5bc8;_0x332152[_0x96f1('0x3a')]=_['keys'](db[_0x96f1('0x5a')][_0x96f1('0x38')]);_0x332152[_0x96f1('0x3b')]=_[_0x96f1('0x53')](_0x9f75ed[_0x96f1('0x3b')]);_0x332152[_0x96f1('0x3c')]=_[_0x96f1('0x3d')](_0x332152['model'],_0x332152['query']);_0x2a27fb['attributes']=_[_0x96f1('0x3d')](_0x332152[_0x96f1('0x3a')],qs['fields'](_0x9f75ed['query'][_0x96f1('0x54')]));_0x2a27fb[_0x96f1('0x3f')]=_0x2a27fb[_0x96f1('0x3f')]['length']?_0x2a27fb[_0x96f1('0x3f')]:_0x332152['model'];_0x2a27fb['order']=qs[_0x96f1('0x44')](_0x9f75ed['query'][_0x96f1('0x44')]);_0x2a27fb[_0x96f1('0x47')]=qs[_0x96f1('0x3c')](_[_0x96f1('0x45')](_0x9f75ed[_0x96f1('0x3b')],_0x332152['filters']));if(_0x9f75ed[_0x96f1('0x3b')][_0x96f1('0x46')]){_0x2a27fb[_0x96f1('0x47')]=_[_0x96f1('0x49')](_0x2a27fb[_0x96f1('0x47')],{'$or':_[_0x96f1('0x36')](_0x2a27fb[_0x96f1('0x3f')],function(_0x5f3cff){var _0x5e908c={};_0x5e908c[_0x5f3cff]={'$like':'%'+_0x9f75ed[_0x96f1('0x3b')][_0x96f1('0x46')]+'%'};return _0x5e908c;})});}_0x2a27fb=_['merge']({},_0x2a27fb,_0x9f75ed[_0x96f1('0x4a')]);return _0x7fc0cc[_0x96f1('0x5b')](_0x2a27fb);}})[_0x96f1('0x20')](function(_0x420d9a){if(_0x420d9a){_0x3d3a0a=_0x420d9a['length'];if(!_0x9f75ed['query'][_0x96f1('0x40')]('nolimit')){_0x2a27fb[_0x96f1('0x2d')]=qs[_0x96f1('0x2d')](_0x9f75ed['query'][_0x96f1('0x2d')]);_0x2a27fb[_0x96f1('0x42')]=qs[_0x96f1('0x42')](_0x9f75ed['query'][_0x96f1('0x42')]);}return _0x7fc0cc['getSubjects'](_0x2a27fb);}})[_0x96f1('0x20')](function(_0x43775a){if(_0x43775a){return _0x43775a?{'count':_0x3d3a0a,'rows':_0x43775a}:null;}})[_0x96f1('0x20')](respondWithResult(_0x5a11d9,null))[_0x96f1('0x50')](handleError(_0x5a11d9,null));};exports['getDescriptions']=function(_0x27d174,_0x4d116d,_0x5db10d){var _0x3bde55={};var _0x117509={};var _0x5ed2ce;var _0x177903;return db[_0x96f1('0x37')]['findOne']({'where':{'id':_0x27d174[_0x96f1('0x52')]['id']}})[_0x96f1('0x20')](handleEntityNotFound(_0x4d116d,null))['then'](function(_0x32353b){if(_0x32353b){_0x5ed2ce=_0x32353b;_0x117509[_0x96f1('0x3a')]=_[_0x96f1('0x53')](db[_0x96f1('0x5a')][_0x96f1('0x38')]);_0x117509[_0x96f1('0x3b')]=_[_0x96f1('0x53')](_0x27d174['query']);_0x117509[_0x96f1('0x3c')]=_['intersection'](_0x117509[_0x96f1('0x3a')],_0x117509['query']);_0x3bde55[_0x96f1('0x3f')]=_[_0x96f1('0x3d')](_0x117509['model'],qs[_0x96f1('0x54')](_0x27d174[_0x96f1('0x3b')][_0x96f1('0x54')]));_0x3bde55[_0x96f1('0x3f')]=_0x3bde55[_0x96f1('0x3f')][_0x96f1('0x3e')]?_0x3bde55[_0x96f1('0x3f')]:_0x117509['model'];_0x3bde55['order']=qs[_0x96f1('0x44')](_0x27d174[_0x96f1('0x3b')]['sort']);_0x3bde55['where']=qs[_0x96f1('0x3c')](_[_0x96f1('0x45')](_0x27d174['query'],_0x117509[_0x96f1('0x3c')]));if(_0x27d174[_0x96f1('0x3b')][_0x96f1('0x46')]){_0x3bde55[_0x96f1('0x47')]=_['merge'](_0x3bde55[_0x96f1('0x47')],{'$or':_[_0x96f1('0x36')](_0x3bde55[_0x96f1('0x3f')],function(_0x40603c){var _0x319419={};_0x319419[_0x40603c]={'$like':'%'+_0x27d174[_0x96f1('0x3b')][_0x96f1('0x46')]+'%'};return _0x319419;})});}_0x3bde55=_[_0x96f1('0x49')]({},_0x3bde55,_0x27d174[_0x96f1('0x4a')]);return _0x5ed2ce[_0x96f1('0x5c')](_0x3bde55);}})[_0x96f1('0x20')](function(_0x1c82a4){if(_0x1c82a4){_0x177903=_0x1c82a4[_0x96f1('0x3e')];if(!_0x27d174[_0x96f1('0x3b')]['hasOwnProperty']('nolimit')){_0x3bde55['limit']=qs['limit'](_0x27d174['query'][_0x96f1('0x2d')]);_0x3bde55[_0x96f1('0x42')]=qs[_0x96f1('0x42')](_0x27d174[_0x96f1('0x3b')][_0x96f1('0x42')]);}return _0x5ed2ce[_0x96f1('0x5c')](_0x3bde55);}})[_0x96f1('0x20')](function(_0x3abf64){if(_0x3abf64){return _0x3abf64?{'count':_0x177903,'rows':_0x3abf64}:null;}})[_0x96f1('0x20')](respondWithResult(_0x4d116d,null))[_0x96f1('0x50')](handleError(_0x4d116d,null));}; \ No newline at end of file +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 diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 0830e01..017cf06 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 _0x3a6b=['bluebird','path','rimraf','./intDynamics365Configuration.attributes','exports','define','int_dynamics365_configurations','../../config/logger','api'];(function(_0x4eb318,_0xd54ec8){var _0x559349=function(_0x6fe012){while(--_0x6fe012){_0x4eb318['push'](_0x4eb318['shift']());}};_0x559349(++_0xd54ec8);}(_0x3a6b,0x11e));var _0xb3a6=function(_0x5b7d1a,_0x438c7b){_0x5b7d1a=_0x5b7d1a-0x0;var _0x591c3d=_0x3a6b[_0x5b7d1a];return _0x591c3d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb3a6('0x0'))(_0xb3a6('0x1'));var moment=require('moment');var BPromise=require(_0xb3a6('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb3a6('0x3'));var rimraf=require(_0xb3a6('0x4'));var config=require('../../config/environment');var attributes=require(_0xb3a6('0x5'));module[_0xb3a6('0x6')]=function(_0x29d5cf,_0x586021){return _0x29d5cf[_0xb3a6('0x7')]('Dynamics365Configuration',attributes,{'tableName':_0xb3a6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 10e9b4b..ccbdbc4 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 _0x9f3f=['Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','http','request','then','info'];(function(_0x1c128c,_0x688319){var _0x4397f5=function(_0x1e6277){while(--_0x1e6277){_0x1c128c['push'](_0x1c128c['shift']());}};_0x4397f5(++_0x688319);}(_0x9f3f,0xce));var _0xf9f3=function(_0x59684c,_0x4f23bd){_0x59684c=_0x59684c-0x0;var _0x6e9beb=_0x9f3f[_0x59684c];return _0x6e9beb;};'use strict';var _=require(_0xf9f3('0x0'));var util=require(_0xf9f3('0x1'));var moment=require(_0xf9f3('0x2'));var BPromise=require(_0xf9f3('0x3'));var rs=require(_0xf9f3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf9f3('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xf9f3('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x41ac29,_0x492211,_0x3d228f){return new BPromise(function(_0x6b021f,_0x9b8470){return client[_0xf9f3('0x7')](_0x41ac29,_0x3d228f)[_0xf9f3('0x8')](function(_0x56db16){logger[_0xf9f3('0x9')](_0xf9f3('0xa'),_0x492211,_0xf9f3('0xb'));logger[_0xf9f3('0xc')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x492211,_0xf9f3('0xb'),JSON[_0xf9f3('0xd')](_0x56db16));if(_0x56db16['error']){if(_0x56db16[_0xf9f3('0xe')][_0xf9f3('0xf')]===0x1f4){logger[_0xf9f3('0xe')](_0xf9f3('0xa'),_0x492211,_0x56db16[_0xf9f3('0xe')][_0xf9f3('0x10')]);return _0x9b8470(_0x56db16[_0xf9f3('0xe')][_0xf9f3('0x10')]);}logger[_0xf9f3('0xe')]('Dynamics365Configuration,\x20%s,\x20%s',_0x492211,_0x56db16['error']['message']);return _0x6b021f(_0x56db16['error'][_0xf9f3('0x10')]);}else{logger['info'](_0xf9f3('0xa'),_0x492211,'request\x20sent');_0x6b021f(_0x56db16[_0xf9f3('0x11')][_0xf9f3('0x10')]);}})['catch'](function(_0x5434d1){logger['error'](_0xf9f3('0xa'),_0x492211,_0x5434d1);_0x9b8470(_0x5434d1);});});} \ No newline at end of file +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 diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 9d1cb38..aa7fe3d 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 _0x4c6d=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','post','create','update','destroy','exports'];(function(_0x128fbc,_0xfe1dc6){var _0x549f30=function(_0x50b02e){while(--_0x50b02e){_0x128fbc['push'](_0x128fbc['shift']());}};_0x549f30(++_0xfe1dc6);}(_0x4c6d,0x1d0));var _0xd4c6=function(_0x4381ca,_0x57672e){_0x4381ca=_0x4381ca-0x0;var _0x40c459=_0x4c6d[_0x4381ca];return _0x40c459;};'use strict';var multer=require(_0xd4c6('0x0'));var util=require(_0xd4c6('0x1'));var path=require(_0xd4c6('0x2'));var timeout=require(_0xd4c6('0x3'));var express=require(_0xd4c6('0x4'));var router=express['Router']();var auth=require(_0xd4c6('0x5'));var interaction=require(_0xd4c6('0x6'));var config=require(_0xd4c6('0x7'));var controller=require('./intDynamics365Field.controller');router[_0xd4c6('0x8')]('/',auth[_0xd4c6('0x9')](),controller['index']);router[_0xd4c6('0x8')](_0xd4c6('0xa'),auth[_0xd4c6('0x9')](),controller['show']);router[_0xd4c6('0xb')]('/',auth[_0xd4c6('0x9')](),controller[_0xd4c6('0xc')]);router['put'](_0xd4c6('0xa'),auth[_0xd4c6('0x9')](),controller[_0xd4c6('0xd')]);router['delete'](_0xd4c6('0xa'),auth[_0xd4c6('0x9')](),controller[_0xd4c6('0xe')]);module[_0xd4c6('0xf')]=router; \ No newline at end of file +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 diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 2d86266..5281043 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 _0xd93c=['string','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x3438cf,_0x73b174){var _0x278698=function(_0xbba932){while(--_0xbba932){_0x3438cf['push'](_0x3438cf['shift']());}};_0x278698(++_0x73b174);}(_0xd93c,0x1bd));var _0xcd93=function(_0x170799,_0x476634){_0x170799=_0x170799-0x0;var _0xf4d7b2=_0xd93c[_0x170799];return _0xf4d7b2;};'use strict';var Sequelize=require(_0xcd93('0x0'));module[_0xcd93('0x1')]={'type':{'type':Sequelize[_0xcd93('0x2')](_0xcd93('0x3'),'variable',_0xcd93('0x4'),_0xcd93('0x5')),'defaultValue':_0xcd93('0x3')},'content':{'type':Sequelize[_0xcd93('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xcd93('0x2')]('string','variable',_0xcd93('0x4'))},'keyContent':{'type':Sequelize[_0xcd93('0x6')]},'idField':{'type':Sequelize[_0xcd93('0x6')]},'nameField':{'type':Sequelize[_0xcd93('0x6')]},'customField':{'type':Sequelize[_0xcd93('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcd93('0x6')]}}; \ No newline at end of file +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 diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index feb9247..8b26ef6 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 _0x7a54=['end','json','offset','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','send','map','Dynamics365Field','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','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'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x7a54,0x106));var _0x47a5=function(_0xbfc5d6,_0xf8c8f9){_0xbfc5d6=_0xbfc5d6-0x0;var _0x58dc08=_0x7a54[_0xbfc5d6];return _0x58dc08;};'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['Dynamics365Field'][_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['Dynamics365Field'][_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));}; \ No newline at end of file +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 diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 1b69b0f..1a71f1c 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 _0xfc20=['rimraf','../../config/environment','./intDynamics365Field.attributes','exports','int_dynamics365_fields','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x303131,_0x35a7da){var _0x52a74b=function(_0xac270b){while(--_0xac270b){_0x303131['push'](_0x303131['shift']());}};_0x52a74b(++_0x35a7da);}(_0xfc20,0x161));var _0x0fc2=function(_0xa9b7a4,_0x204062){_0xa9b7a4=_0xa9b7a4-0x0;var _0x4b191b=_0xfc20[_0xa9b7a4];return _0x4b191b;};'use strict';var _=require(_0x0fc2('0x0'));var util=require(_0x0fc2('0x1'));var logger=require(_0x0fc2('0x2'))(_0x0fc2('0x3'));var moment=require(_0x0fc2('0x4'));var BPromise=require('bluebird');var rp=require(_0x0fc2('0x5'));var fs=require('fs');var path=require(_0x0fc2('0x6'));var rimraf=require(_0x0fc2('0x7'));var config=require(_0x0fc2('0x8'));var attributes=require(_0x0fc2('0x9'));module[_0x0fc2('0xa')]=function(_0x53189e,_0x3ca04c){return _0x53189e['define']('Dynamics365Field',attributes,{'tableName':_0x0fc2('0xb'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 23c35f4..badc49e 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 _0x1561=['request\x20sent','debug','error','code','message','result','catch','Dynamics365Field,\x20%s,\x20%s','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x11bfa5,_0x3b8bea){var _0x434cb6=function(_0x5b7801){while(--_0x5b7801){_0x11bfa5['push'](_0x11bfa5['shift']());}};_0x434cb6(++_0x3b8bea);}(_0x1561,0x1bd));var _0x1156=function(_0x4fa3c9,_0x12368d){_0x4fa3c9=_0x4fa3c9-0x0;var _0x45a8e1=_0x1561[_0x4fa3c9];return _0x45a8e1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1156('0x0'));var BPromise=require(_0x1156('0x1'));var rs=require(_0x1156('0x2'));var fs=require('fs');var Redis=require(_0x1156('0x3'));var db=require(_0x1156('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1156('0x5'))(_0x1156('0x6'));var config=require(_0x1156('0x7'));var jayson=require(_0x1156('0x8'));var client=jayson['client'][_0x1156('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a7048,_0x372fe0,_0x6c3476){return new BPromise(function(_0x273b53,_0x2a7693){return client[_0x1156('0xa')](_0x4a7048,_0x6c3476)['then'](function(_0x2a5914){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x372fe0,_0x1156('0xb'));logger[_0x1156('0xc')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x372fe0,_0x1156('0xb'),JSON['stringify'](_0x2a5914));if(_0x2a5914[_0x1156('0xd')]){if(_0x2a5914['error'][_0x1156('0xe')]===0x1f4){logger[_0x1156('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x372fe0,_0x2a5914['error'][_0x1156('0xf')]);return _0x2a7693(_0x2a5914['error'][_0x1156('0xf')]);}logger[_0x1156('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x372fe0,_0x2a5914['error'][_0x1156('0xf')]);return _0x273b53(_0x2a5914[_0x1156('0xd')][_0x1156('0xf')]);}else{logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x372fe0,_0x1156('0xb'));_0x273b53(_0x2a5914[_0x1156('0x10')][_0x1156('0xf')]);}})[_0x1156('0x11')](function(_0x6889c9){logger[_0x1156('0xd')](_0x1156('0x12'),_0x372fe0,_0x6889c9);_0x2a7693(_0x6889c9);});});} \ No newline at end of file +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 diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 1196e09..91a156b 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 _0x27bf=['destroy','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getFields','post','create','addConfiguration','put','update','delete'];(function(_0x3d5351,_0x27bc80){var _0x1db4db=function(_0x3f572b){while(--_0x3f572b){_0x3d5351['push'](_0x3d5351['shift']());}};_0x1db4db(++_0x27bc80);}(_0x27bf,0x190));var _0xf27b=function(_0x42adad,_0x3b938f){_0x42adad=_0x42adad-0x0;var _0x441353=_0x27bf[_0x42adad];return _0x441353;};'use strict';var multer=require(_0xf27b('0x0'));var util=require(_0xf27b('0x1'));var path=require('path');var timeout=require(_0xf27b('0x2'));var express=require(_0xf27b('0x3'));var router=express['Router']();var auth=require(_0xf27b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf27b('0x5'));var controller=require(_0xf27b('0x6'));router['get']('/',auth[_0xf27b('0x7')](),controller[_0xf27b('0x8')]);router[_0xf27b('0x9')](_0xf27b('0xa'),auth['isAuthenticated'](),controller[_0xf27b('0xb')]);router[_0xf27b('0x9')](_0xf27b('0xc'),auth[_0xf27b('0x7')](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0xf27b('0x7')](),controller[_0xf27b('0xd')]);router[_0xf27b('0xe')]('/',auth[_0xf27b('0x7')](),controller[_0xf27b('0xf')]);router['post'](_0xf27b('0xc'),auth[_0xf27b('0x7')](),controller[_0xf27b('0x10')]);router[_0xf27b('0x11')](_0xf27b('0xa'),auth[_0xf27b('0x7')](),controller[_0xf27b('0x12')]);router[_0xf27b('0x13')]('/:id',auth[_0xf27b('0x7')](),controller[_0xf27b('0x14')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 4cf5f8e..ab3390c 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 _0x3c66=['remoteUri','STRING','username'];(function(_0xa75d70,_0x3b7fc3){var _0xd5d47f=function(_0x50f18a){while(--_0x50f18a){_0xa75d70['push'](_0xa75d70['shift']());}};_0xd5d47f(++_0x3b7fc3);}(_0x3c66,0x8b));var _0x63c6=function(_0x33aee8,_0x4f2b0a){_0x33aee8=_0x33aee8-0x0;var _0x33dd59=_0x3c66[_0x33aee8];return _0x33dd59;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x63c6('0x0')]},'username':{'type':Sequelize[_0x63c6('0x0')],'unique':_0x63c6('0x1')},'apiKey':{'type':Sequelize[_0x63c6('0x0')]},'remoteUri':{'type':Sequelize[_0x63c6('0x0')],'unique':_0x63c6('0x2')},'serverUrl':{'type':Sequelize[_0x63c6('0x0')]}}; \ No newline at end of file +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 diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 5b00c80..5e19830 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 _0x41cd=['AccountId','Descriptions','FreshdeskField','Subjects','apiKey','slice','substring','GET','format','%s/%s','api/v2/ticket_fields','%s:X','toString','base64','requester','subject','agent','description','priority','group','source','ticket_type','includes','default','custom_text','custom_dropdown','label','choices','capitalize','statusCode','getFields','stringify','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','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','../../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','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','length','include','create','body','find','getConfigurations','FreshdeskConfiguration','findOne'];(function(_0x5bd1a9,_0x313714){var _0x2ba345=function(_0x21b4af){while(--_0x21b4af){_0x5bd1a9['push'](_0x5bd1a9['shift']());}};_0x2ba345(++_0x313714);}(_0x41cd,0x123));var _0xd41c=function(_0x41eb8b,_0x8e630f){_0x41eb8b=_0x41eb8b-0x0;var _0x57f6be=_0x41cd[_0x41eb8b];return _0x57f6be;};'use strict';var pdf=require(_0xd41c('0x0'));var emlformat=require(_0xd41c('0x1'));var rimraf=require(_0xd41c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd41c('0x3'));var rp=require(_0xd41c('0x4'));var moment=require(_0xd41c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd41c('0x6'));var util=require(_0xd41c('0x7'));var path=require(_0xd41c('0x8'));var sox=require('sox');var csv=require(_0xd41c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd41c('0xa'));var squel=require('squel');var crypto=require(_0xd41c('0xb'));var jsforce=require(_0xd41c('0xc'));var deskjs=require(_0xd41c('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd41c('0xe'));var Papa=require('papaparse');var Redis=require(_0xd41c('0xf'));var authService=require(_0xd41c('0x10'));var qs=require(_0xd41c('0x11'));var as=require(_0xd41c('0x12'));var hardwareService=require(_0xd41c('0x13'));var logger=require(_0xd41c('0x14'))(_0xd41c('0x15'));var utils=require(_0xd41c('0x16'));var config=require(_0xd41c('0x17'));var db=require(_0xd41c('0x18'))['db'];var integrations=require(_0xd41c('0x19'));var jayson=require(_0xd41c('0x1a'));var client=jayson[_0xd41c('0x1b')][_0xd41c('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x1597c5,_0x546670,_0x2d74b6){if(_0x2d74b6){var _0x55d3bb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x55d3bb[_0xd41c('0x1d')](_0x546670)){return _0x1597c5;}else{throw new db[(_0xd41c('0x1e'))][(_0xd41c('0x1f'))](_0xd41c('0x20'));}}else{return _0x1597c5;}}function respondWithRpcPromise(_0x18b28f,_0x5ecb53,_0x46dfb6,_0x31b3b3){return new BPromise(function(_0x1eb3b0,_0x2fcb68){var _0xfc7bd5=_0x31b3b3||client;return _0xfc7bd5[_0xd41c('0x21')](_0x18b28f,_0x46dfb6)['then'](function(_0xc1af5c){logger[_0xd41c('0x22')](_0xd41c('0x23'),_0x5ecb53,_0xd41c('0x24'));logger[_0xd41c('0x25')](_0xd41c('0x26'),_0x5ecb53,'request\x20sent',JSON['stringify'](_0xc1af5c));if(_0xc1af5c['error']){if(_0xc1af5c[_0xd41c('0x27')][_0xd41c('0x28')]===0x1f4){logger[_0xd41c('0x27')](_0xd41c('0x23'),_0x5ecb53,_0xc1af5c[_0xd41c('0x27')]['message']);return _0x2fcb68(_0xc1af5c[_0xd41c('0x27')][_0xd41c('0x29')]);}logger[_0xd41c('0x27')](_0xd41c('0x23'),_0x5ecb53,_0xc1af5c[_0xd41c('0x27')][_0xd41c('0x29')]);return _0x1eb3b0(_0xc1af5c[_0xd41c('0x27')]['message']);}else{logger[_0xd41c('0x22')](_0xd41c('0x23'),_0x5ecb53,'request\x20sent');_0x1eb3b0(_0xc1af5c[_0xd41c('0x2a')]['message']);}})[_0xd41c('0x2b')](function(_0x3c270b){logger[_0xd41c('0x27')](_0xd41c('0x23'),_0x5ecb53,_0x3c270b);_0x2fcb68(_0x3c270b);});});}function respondWithStatusCode(_0x299604,_0x2a014e){_0x2a014e=_0x2a014e||0xcc;return function(_0xe86625){if(_0xe86625){return _0x299604[_0xd41c('0x2c')](_0x2a014e);}return _0x299604[_0xd41c('0x2d')](_0x2a014e)[_0xd41c('0x2e')]();};}function respondWithResult(_0x2214fd,_0x5e424b){_0x5e424b=_0x5e424b||0xc8;return function(_0x3d2a17){if(_0x3d2a17){return _0x2214fd[_0xd41c('0x2d')](_0x5e424b)[_0xd41c('0x2f')](_0x3d2a17);}};}function respondWithFilteredResult(_0xbd7cb4,_0x21004f){return function(_0x3e568c){if(_0x3e568c){var _0x243b05=_0x3e568c[_0xd41c('0x30')],_0x1e74f8=_0x21004f[_0xd41c('0x31')],_0x21c55e=_0x21004f[_0xd41c('0x31')]+_0x21004f[_0xd41c('0x32')],_0x319ba5;if(_0x21c55e>=_0x243b05){_0x21c55e=_0x243b05;_0x319ba5=0xc8;}else{_0x319ba5=0xce;}_0xbd7cb4['status'](_0x319ba5);return _0xbd7cb4[_0xd41c('0x33')](_0xd41c('0x34'),_0x1e74f8+'-'+_0x21c55e+'/'+_0x243b05)['json'](_0x3e568c);}return null;};}function patchUpdates(_0x404749){return function(_0x30afed){try{jsonpatch['apply'](_0x30afed,_0x404749,!![]);}catch(_0x46a3b6){return BPromise['reject'](_0x46a3b6);}return _0x30afed[_0xd41c('0x35')]();};}function saveUpdates(_0x2a4bc3,_0x382f74){return function(_0x15ae79){if(_0x15ae79){return _0x15ae79[_0xd41c('0x36')](_0x2a4bc3)[_0xd41c('0x37')](function(_0x41e045){return _0x41e045;});}return null;};}function removeEntity(_0xddaa03,_0x1ff443){return function(_0x34b9d0){if(_0x34b9d0){return _0x34b9d0['destroy']()[_0xd41c('0x37')](function(){_0xddaa03[_0xd41c('0x2d')](0xcc)[_0xd41c('0x2e')]();});}};}function handleEntityNotFound(_0x3d1451,_0x2096f1){return function(_0x4edd90){if(!_0x4edd90){_0x3d1451[_0xd41c('0x2c')](0x194);}return _0x4edd90;};}function handleError(_0x32cd7d,_0x34fb51){_0x34fb51=_0x34fb51||0x1f4;return function(_0x50f7be){logger[_0xd41c('0x27')](_0x50f7be[_0xd41c('0x38')]);if(_0x50f7be[_0xd41c('0x39')]){delete _0x50f7be[_0xd41c('0x39')];}_0x32cd7d[_0xd41c('0x2d')](_0x34fb51)[_0xd41c('0x3a')](_0x50f7be);};}exports[_0xd41c('0x3b')]=function(_0x275652,_0x2c2901){var _0x227099={},_0x210106={},_0x535aa7={'count':0x0,'rows':[]};var _0x1d80f0=_[_0xd41c('0x3c')](db[_0xd41c('0x3d')][_0xd41c('0x3e')],function(_0x4d2384){return{'name':_0x4d2384[_0xd41c('0x3f')],'type':_0x4d2384[_0xd41c('0x40')][_0xd41c('0x41')]};});_0x210106[_0xd41c('0x42')]=_[_0xd41c('0x3c')](_0x1d80f0,_0xd41c('0x39'));_0x210106[_0xd41c('0x43')]=_[_0xd41c('0x44')](_0x275652[_0xd41c('0x43')]);_0x210106[_0xd41c('0x45')]=_[_0xd41c('0x46')](_0x210106[_0xd41c('0x42')],_0x210106[_0xd41c('0x43')]);_0x227099['attributes']=_[_0xd41c('0x46')](_0x210106[_0xd41c('0x42')],qs['fields'](_0x275652[_0xd41c('0x43')][_0xd41c('0x47')]));_0x227099[_0xd41c('0x48')]=_0x227099[_0xd41c('0x48')]['length']?_0x227099['attributes']:_0x210106[_0xd41c('0x42')];if(!_0x275652[_0xd41c('0x43')][_0xd41c('0x49')](_0xd41c('0x4a'))){_0x227099[_0xd41c('0x32')]=qs[_0xd41c('0x32')](_0x275652[_0xd41c('0x43')][_0xd41c('0x32')]);_0x227099[_0xd41c('0x31')]=qs[_0xd41c('0x31')](_0x275652[_0xd41c('0x43')][_0xd41c('0x31')]);}_0x227099[_0xd41c('0x4b')]=qs[_0xd41c('0x4c')](_0x275652['query'][_0xd41c('0x4c')]);_0x227099[_0xd41c('0x4d')]=qs[_0xd41c('0x45')](_[_0xd41c('0x4e')](_0x275652[_0xd41c('0x43')],_0x210106[_0xd41c('0x45')]));if(_0x275652[_0xd41c('0x43')][_0xd41c('0x4f')]){_0x227099[_0xd41c('0x4d')]=_[_0xd41c('0x50')](_0x227099[_0xd41c('0x4d')],{'$or':_[_0xd41c('0x3c')](_0x1d80f0,function(_0x521497){if(_0x521497['type']!==_0xd41c('0x51')){var _0x5d0aeb={};_0x5d0aeb[_0x521497[_0xd41c('0x39')]]={'$like':'%'+_0x275652[_0xd41c('0x43')]['filter']+'%'};return _0x5d0aeb;}})});}_0x227099=_[_0xd41c('0x50')]({},_0x227099,_0x275652[_0xd41c('0x52')]);var _0x22d68e={'where':_0x227099[_0xd41c('0x4d')]};return db['FreshdeskAccount'][_0xd41c('0x30')](_0x22d68e)['then'](function(_0x4b56f4){_0x535aa7['count']=_0x4b56f4;if(_0x275652[_0xd41c('0x43')][_0xd41c('0x53')]){_0x227099['include']=[{'all':!![]}];}return db[_0xd41c('0x3d')][_0xd41c('0x54')](_0x227099);})[_0xd41c('0x37')](function(_0x171139){_0x535aa7[_0xd41c('0x55')]=_0x171139;return _0x535aa7;})['then'](respondWithFilteredResult(_0x2c2901,_0x227099))[_0xd41c('0x2b')](handleError(_0x2c2901,null));};exports[_0xd41c('0x56')]=function(_0x3988d5,_0x385600){var _0xcc21cc={'raw':![],'where':{'id':_0x3988d5[_0xd41c('0x57')]['id']}},_0x20671a={};_0x20671a[_0xd41c('0x42')]=_['keys'](db[_0xd41c('0x3d')]['rawAttributes']);_0x20671a[_0xd41c('0x43')]=_[_0xd41c('0x44')](_0x3988d5[_0xd41c('0x43')]);_0x20671a[_0xd41c('0x45')]=_[_0xd41c('0x46')](_0x20671a[_0xd41c('0x42')],_0x20671a[_0xd41c('0x43')]);_0xcc21cc[_0xd41c('0x48')]=_['intersection'](_0x20671a[_0xd41c('0x42')],qs[_0xd41c('0x47')](_0x3988d5[_0xd41c('0x43')][_0xd41c('0x47')]));_0xcc21cc['attributes']=_0xcc21cc['attributes'][_0xd41c('0x58')]?_0xcc21cc['attributes']:_0x20671a[_0xd41c('0x42')];if(_0x3988d5[_0xd41c('0x43')][_0xd41c('0x53')]){_0xcc21cc[_0xd41c('0x59')]=[{'all':!![]}];}_0xcc21cc=_['merge']({},_0xcc21cc,_0x3988d5['options']);return db[_0xd41c('0x3d')]['find'](_0xcc21cc)[_0xd41c('0x37')](handleEntityNotFound(_0x385600,null))[_0xd41c('0x37')](respondWithResult(_0x385600,null))[_0xd41c('0x2b')](handleError(_0x385600,null));};exports[_0xd41c('0x5a')]=function(_0x210e8b,_0x23ae2a){return db[_0xd41c('0x3d')]['create'](_0x210e8b[_0xd41c('0x5b')],{})[_0xd41c('0x37')](respondWithResult(_0x23ae2a,0xc9))['catch'](handleError(_0x23ae2a,null));};exports[_0xd41c('0x36')]=function(_0x2e496d,_0x4064b7){if(_0x2e496d[_0xd41c('0x5b')]['id']){delete _0x2e496d[_0xd41c('0x5b')]['id'];}return db['FreshdeskAccount'][_0xd41c('0x5c')]({'where':{'id':_0x2e496d[_0xd41c('0x57')]['id']}})['then'](handleEntityNotFound(_0x4064b7,null))[_0xd41c('0x37')](saveUpdates(_0x2e496d[_0xd41c('0x5b')],null))['then'](respondWithResult(_0x4064b7,null))['catch'](handleError(_0x4064b7,null));};exports['destroy']=function(_0x9a9258,_0x18b577){return db['FreshdeskAccount'][_0xd41c('0x5c')]({'where':{'id':_0x9a9258[_0xd41c('0x57')]['id']}})[_0xd41c('0x37')](handleEntityNotFound(_0x18b577,null))[_0xd41c('0x37')](removeEntity(_0x18b577,null))[_0xd41c('0x2b')](handleError(_0x18b577,null));};exports[_0xd41c('0x5d')]=function(_0x436d0c,_0x4f1392,_0x902405){var _0x79a254={};var _0x50b30b={};var _0x57337e;var _0x5939c4;return db[_0xd41c('0x3d')]['findOne']({'where':{'id':_0x436d0c[_0xd41c('0x57')]['id']}})['then'](handleEntityNotFound(_0x4f1392,null))['then'](function(_0x10dde9){if(_0x10dde9){_0x57337e=_0x10dde9;_0x50b30b['model']=_[_0xd41c('0x44')](db[_0xd41c('0x5e')][_0xd41c('0x3e')]);_0x50b30b[_0xd41c('0x43')]=_['keys'](_0x436d0c[_0xd41c('0x43')]);_0x50b30b['filters']=_[_0xd41c('0x46')](_0x50b30b[_0xd41c('0x42')],_0x50b30b['query']);_0x79a254[_0xd41c('0x48')]=_[_0xd41c('0x46')](_0x50b30b[_0xd41c('0x42')],qs[_0xd41c('0x47')](_0x436d0c[_0xd41c('0x43')]['fields']));_0x79a254[_0xd41c('0x48')]=_0x79a254[_0xd41c('0x48')][_0xd41c('0x58')]?_0x79a254[_0xd41c('0x48')]:_0x50b30b['model'];_0x79a254[_0xd41c('0x4b')]=qs[_0xd41c('0x4c')](_0x436d0c['query'][_0xd41c('0x4c')]);_0x79a254[_0xd41c('0x4d')]=qs['filters'](_[_0xd41c('0x4e')](_0x436d0c[_0xd41c('0x43')],_0x50b30b[_0xd41c('0x45')]));if(_0x436d0c[_0xd41c('0x43')][_0xd41c('0x4f')]){_0x79a254[_0xd41c('0x4d')]=_[_0xd41c('0x50')](_0x79a254['where'],{'$or':_['map'](_0x79a254[_0xd41c('0x48')],function(_0x2ba4a1){var _0x24ab7e={};_0x24ab7e[_0x2ba4a1]={'$like':'%'+_0x436d0c[_0xd41c('0x43')]['filter']+'%'};return _0x24ab7e;})});}_0x79a254=_[_0xd41c('0x50')]({},_0x79a254,_0x436d0c['options']);return _0x57337e[_0xd41c('0x5d')](_0x79a254);}})[_0xd41c('0x37')](function(_0x53b4e4){if(_0x53b4e4){_0x5939c4=_0x53b4e4['length'];if(!_0x436d0c[_0xd41c('0x43')]['hasOwnProperty'](_0xd41c('0x4a'))){_0x79a254[_0xd41c('0x32')]=qs[_0xd41c('0x32')](_0x436d0c[_0xd41c('0x43')][_0xd41c('0x32')]);_0x79a254[_0xd41c('0x31')]=qs[_0xd41c('0x31')](_0x436d0c[_0xd41c('0x43')][_0xd41c('0x31')]);}return _0x57337e[_0xd41c('0x5d')](_0x79a254);}})[_0xd41c('0x37')](function(_0x2a0a8d){if(_0x2a0a8d){return _0x2a0a8d?{'count':_0x5939c4,'rows':_0x2a0a8d}:null;}})[_0xd41c('0x37')](respondWithResult(_0x4f1392,null))['catch'](handleError(_0x4f1392,null));};exports['addConfiguration']=function(_0x283ecd,_0x437adf,_0x569153){if(_0x283ecd[_0xd41c('0x5b')]['id']){delete _0x283ecd[_0xd41c('0x5b')]['id'];}return db[_0xd41c('0x3d')][_0xd41c('0x5f')]({'where':{'id':_0x283ecd['params']['id']}})[_0xd41c('0x37')](handleEntityNotFound(_0x437adf,null))[_0xd41c('0x37')](function(_0x164d9c){if(_0x164d9c){_0x283ecd['body'][_0xd41c('0x60')]=_0x164d9c['id'];_0x283ecd[_0xd41c('0x5b')]['Subjects']=integrations['getSubjects'](_0x283ecd[_0xd41c('0x5b')]['channel'],_0x283ecd['body']['type']);_0x283ecd[_0xd41c('0x5b')][_0xd41c('0x61')]=integrations['getDescriptions'](_0x283ecd['body']['channel'],_0x283ecd[_0xd41c('0x5b')][_0xd41c('0x40')]);return db['FreshdeskConfiguration']['create'](_0x283ecd[_0xd41c('0x5b')],{'include':[{'model':db[_0xd41c('0x62')],'as':_0xd41c('0x63')},{'model':db[_0xd41c('0x62')],'as':'Descriptions'}]});}return null;})[_0xd41c('0x37')](respondWithResult(_0x437adf,null))['catch'](handleError(_0x437adf,null));};exports['getFields']=function(_0x5a68f4,_0x271086,_0x4a6d88){var _0x4d9bc1='';return db['FreshdeskAccount'][_0xd41c('0x5f')]({'where':{'id':_0x5a68f4['params']['id']},'attributes':['id','remoteUri',_0xd41c('0x64')]})[_0xd41c('0x37')](handleEntityNotFound(_0x271086,null))[_0xd41c('0x37')](function(_0x497f1f){if(_0x497f1f){_0x4d9bc1=_0x497f1f['remoteUri'];var _0x30d9ed=_0x4d9bc1[_0xd41c('0x65')](-0x1);if(_0x30d9ed==='/'){_0x4d9bc1=_0x4d9bc1[_0xd41c('0x66')](0x0,_0x4d9bc1['lastIndexOf'](_0x30d9ed));}return rp({'method':_0xd41c('0x67'),'uri':util[_0xd41c('0x68')](_0xd41c('0x69'),_0x4d9bc1,_0xd41c('0x6a')),'headers':{'Authorization':util[_0xd41c('0x68')]('Basic\x20%s',new Buffer(util[_0xd41c('0x68')](_0xd41c('0x6b'),_0x497f1f[_0xd41c('0x64')]))[_0xd41c('0x6c')](_0xd41c('0x6d')))},'json':!![]});}})[_0xd41c('0x37')](function(_0x4c5040){if(_0x4c5040){var _0x27c086=[_0xd41c('0x6e'),_0xd41c('0x6f'),_0xd41c('0x70'),_0xd41c('0x71'),'status',_0xd41c('0x72'),_0xd41c('0x73'),_0xd41c('0x74'),_0xd41c('0x75'),'group','company'];_['remove'](_0x4c5040,function(_0x2b920b){return _0x27c086[_0xd41c('0x76')](_0x2b920b['name'])||!_0x2b920b[_0xd41c('0x77')]&&_0x2b920b[_0xd41c('0x40')]!==_0xd41c('0x78')&&_0x2b920b[_0xd41c('0x40')]!==_0xd41c('0x79');});return{'count':_0x4c5040[_0xd41c('0x58')],'rows':_[_0xd41c('0x3c')](_0x4c5040,function(_0x1c8db2){return{'id':_0x1c8db2['name'],'name':_0x1c8db2[_0xd41c('0x7a')],'custom':!_0x1c8db2[_0xd41c('0x77')],'options':_0x1c8db2[_0xd41c('0x7b')]?_[_0xd41c('0x3c')](_0x1c8db2[_0xd41c('0x7b')],function(_0x5326d5){return{'name':_[_0xd41c('0x7c')](_0x5326d5),'value':_0x5326d5};}):[]};})};}})[_0xd41c('0x37')](respondWithResult(_0x271086,null))[_0xd41c('0x2b')](function(_0x57079f){var _0x20d917=_0x5a68f4[_0xd41c('0x43')][_0xd41c('0x1d')]?0x1f4:_0x57079f[_0xd41c('0x7d')]||0x1f4;logger[_0xd41c('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0xd41c('0x7e'),_0x20d917,JSON[_0xd41c('0x7f')](_0x57079f));delete _0x57079f['name'];if(_0x20d917===0x191){_0x20d917=0x190;}_0x271086[_0xd41c('0x2d')](_0x20d917)['send'](_0x5a68f4[_0xd41c('0x43')][_0xd41c('0x1d')]?{'message':_0xd41c('0x80'),'statusCode':_0x57079f[_0xd41c('0x7d')]}:_0x57079f);});}; \ No newline at end of file +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 diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 5dd3cd2..ac46dc4 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 _0x3f87=['FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration'];(function(_0x38eba2,_0x2e3207){var _0x9bf5be=function(_0x3a671d){while(--_0x3a671d){_0x38eba2['push'](_0x38eba2['shift']());}};_0x9bf5be(++_0x2e3207);}(_0x3f87,0x176));var _0x73f8=function(_0x44cc89,_0x15152c){_0x44cc89=_0x44cc89-0x0;var _0x4f0b57=_0x3f87[_0x44cc89];return _0x4f0b57;};'use strict';var _=require(_0x73f8('0x0'));var util=require(_0x73f8('0x1'));var logger=require(_0x73f8('0x2'))(_0x73f8('0x3'));var moment=require(_0x73f8('0x4'));var BPromise=require(_0x73f8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x73f8('0x6'));var rimraf=require(_0x73f8('0x7'));var config=require('../../config/environment');var attributes=require(_0x73f8('0x8'));var integrations=require(_0x73f8('0x9'));module['exports']=function(_0x173522,_0x500d9c){return _0x173522['define'](_0x73f8('0xa'),attributes,{'tableName':_0x73f8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 009d4ee..119be0f 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 _0x69c1=['options','where','attributes','limit','include','map','model','ShowFreshdeskAccount','raw','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','request\x20sent','debug','stringify','error','message','FreshdeskAccount,\x20%s,\x20%s','catch','GetFreshdeskAccount','findAll'];(function(_0x88dc7e,_0x1cb137){var _0x86aca4=function(_0x54fe6d){while(--_0x54fe6d){_0x88dc7e['push'](_0x88dc7e['shift']());}};_0x86aca4(++_0x1cb137);}(_0x69c1,0xdb));var _0x169c=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x69c1[_0x2aea9e];return _0x430b92;};'use strict';var _=require(_0x169c('0x0'));var util=require('util');var moment=require(_0x169c('0x1'));var BPromise=require(_0x169c('0x2'));var rs=require(_0x169c('0x3'));var fs=require('fs');var Redis=require(_0x169c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x169c('0x5'));var logger=require(_0x169c('0x6'))(_0x169c('0x7'));var config=require('../../config/environment');var jayson=require(_0x169c('0x8'));var client=jayson['client'][_0x169c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5dd801,_0x2ffb91,_0x3af794){return new BPromise(function(_0xe48a20,_0x1249fc){return client['request'](_0x5dd801,_0x3af794)[_0x169c('0xa')](function(_0x58b335){logger[_0x169c('0xb')]('FreshdeskAccount,\x20%s,\x20%s',_0x2ffb91,_0x169c('0xc'));logger[_0x169c('0xd')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x2ffb91,'request\x20sent',JSON[_0x169c('0xe')](_0x58b335));if(_0x58b335[_0x169c('0xf')]){if(_0x58b335[_0x169c('0xf')]['code']===0x1f4){logger[_0x169c('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x2ffb91,_0x58b335[_0x169c('0xf')][_0x169c('0x10')]);return _0x1249fc(_0x58b335[_0x169c('0xf')][_0x169c('0x10')]);}logger[_0x169c('0xf')](_0x169c('0x11'),_0x2ffb91,_0x58b335[_0x169c('0xf')][_0x169c('0x10')]);return _0xe48a20(_0x58b335['error']['message']);}else{logger[_0x169c('0xb')](_0x169c('0x11'),_0x2ffb91,_0x169c('0xc'));_0xe48a20(_0x58b335['result'][_0x169c('0x10')]);}})[_0x169c('0x12')](function(_0x135397){logger[_0x169c('0xf')](_0x169c('0x11'),_0x2ffb91,_0x135397);_0x1249fc(_0x135397);});});}exports[_0x169c('0x13')]=function(_0x587e7f){var _0x158bfb=this;return new Promise(function(_0x531a25,_0x59940e){return db['FreshdeskAccount'][_0x169c('0x14')]({'raw':_0x587e7f[_0x169c('0x15')]?_0x587e7f['options']['raw']===undefined?!![]:![]:!![],'where':_0x587e7f[_0x169c('0x15')]?_0x587e7f[_0x169c('0x15')][_0x169c('0x16')]||null:null,'attributes':_0x587e7f[_0x169c('0x15')]?_0x587e7f[_0x169c('0x15')][_0x169c('0x17')]||null:null,'limit':_0x587e7f['options']?_0x587e7f[_0x169c('0x15')][_0x169c('0x18')]||null:null,'include':_0x587e7f['options']?_0x587e7f[_0x169c('0x15')][_0x169c('0x19')]?_[_0x169c('0x1a')](_0x587e7f[_0x169c('0x15')][_0x169c('0x19')],function(_0x4d8fda){return{'model':db[_0x4d8fda[_0x169c('0x1b')]],'as':_0x4d8fda['as'],'attributes':_0x4d8fda['attributes'],'include':_0x4d8fda[_0x169c('0x19')]?_[_0x169c('0x1a')](_0x4d8fda[_0x169c('0x19')],function(_0x195c52){return{'model':db[_0x195c52['model']],'as':_0x195c52['as'],'attributes':_0x195c52[_0x169c('0x17')],'include':_0x195c52[_0x169c('0x19')]?_[_0x169c('0x1a')](_0x195c52[_0x169c('0x19')],function(_0x3f9d9a){return{'model':db[_0x3f9d9a['model']],'as':_0x3f9d9a['as'],'attributes':_0x3f9d9a[_0x169c('0x17')]};}):[]};}):[]};}):[]:[]})[_0x169c('0xa')](function(_0x3aea75){logger[_0x169c('0xb')](_0x169c('0x13'),_0x587e7f);logger[_0x169c('0xd')]('GetFreshdeskAccount',_0x587e7f,JSON[_0x169c('0xe')](_0x3aea75));_0x531a25(_0x3aea75);})[_0x169c('0x12')](function(_0x47b648){logger['error']('GetFreshdeskAccount',_0x47b648[_0x169c('0x10')],_0x587e7f);_0x59940e(_0x158bfb['error'](0x1f4,_0x47b648['message']));});});};exports[_0x169c('0x1c')]=function(_0x2b8b1f){var _0x55d072=this;return new Promise(function(_0x272cc4,_0x83a2db){return db['FreshdeskAccount']['find']({'raw':_0x2b8b1f['options']?_0x2b8b1f[_0x169c('0x15')][_0x169c('0x1d')]===undefined?!![]:![]:!![],'where':_0x2b8b1f['options']?_0x2b8b1f[_0x169c('0x15')][_0x169c('0x16')]||null:null,'attributes':_0x2b8b1f[_0x169c('0x15')]?_0x2b8b1f[_0x169c('0x15')][_0x169c('0x17')]||null:null,'include':_0x2b8b1f['options']?_0x2b8b1f[_0x169c('0x15')][_0x169c('0x19')]?_[_0x169c('0x1a')](_0x2b8b1f['options'][_0x169c('0x19')],function(_0x435657){return{'model':db[_0x435657[_0x169c('0x1b')]],'as':_0x435657['as'],'attributes':_0x435657[_0x169c('0x17')],'include':_0x435657['include']?_[_0x169c('0x1a')](_0x435657[_0x169c('0x19')],function(_0x3ffe8b){return{'model':db[_0x3ffe8b[_0x169c('0x1b')]],'as':_0x3ffe8b['as'],'attributes':_0x3ffe8b[_0x169c('0x17')],'include':_0x3ffe8b[_0x169c('0x19')]?_['map'](_0x3ffe8b[_0x169c('0x19')],function(_0x3364f2){return{'model':db[_0x3364f2[_0x169c('0x1b')]],'as':_0x3364f2['as'],'attributes':_0x3364f2['attributes']};}):[]};}):[]};}):[]:[]})[_0x169c('0xa')](function(_0x1e6f05){logger['info'](_0x169c('0x1c'),_0x2b8b1f);logger[_0x169c('0xd')](_0x169c('0x1c'),_0x2b8b1f,JSON[_0x169c('0xe')](_0x1e6f05));_0x272cc4(_0x1e6f05);})[_0x169c('0x12')](function(_0x13c2fc){logger[_0x169c('0xf')](_0x169c('0x1c'),_0x13c2fc[_0x169c('0x10')],_0x2b8b1f);_0x83a2db(_0x55d072[_0x169c('0xf')](0x1f4,_0x13c2fc[_0x169c('0x10')]));});});}; \ No newline at end of file +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 diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 0b46bb3..090839a 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 _0xdafc=['getSubjects','/:id/tags','getTags','create','post','setTags','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects'];(function(_0x87aa7d,_0x3e7c60){var _0x4a2fcb=function(_0x20e307){while(--_0x20e307){_0x87aa7d['push'](_0x87aa7d['shift']());}};_0x4a2fcb(++_0x3e7c60);}(_0xdafc,0xad));var _0xcdaf=function(_0x4055dd,_0x7e9aa8){_0x4055dd=_0x4055dd-0x0;var _0x5eeab9=_0xdafc[_0x4055dd];return _0x5eeab9;};'use strict';var multer=require(_0xcdaf('0x0'));var util=require(_0xcdaf('0x1'));var path=require(_0xcdaf('0x2'));var timeout=require(_0xcdaf('0x3'));var express=require('express');var router=express[_0xcdaf('0x4')]();var auth=require(_0xcdaf('0x5'));var interaction=require(_0xcdaf('0x6'));var config=require(_0xcdaf('0x7'));var controller=require(_0xcdaf('0x8'));router[_0xcdaf('0x9')]('/',auth[_0xcdaf('0xa')](),controller[_0xcdaf('0xb')]);router[_0xcdaf('0x9')](_0xcdaf('0xc'),auth[_0xcdaf('0xa')](),controller[_0xcdaf('0xd')]);router[_0xcdaf('0x9')]('/:id/fields',auth[_0xcdaf('0xa')](),controller[_0xcdaf('0xe')]);router[_0xcdaf('0x9')](_0xcdaf('0xf'),auth[_0xcdaf('0xa')](),controller[_0xcdaf('0x10')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0xcdaf('0x9')](_0xcdaf('0x11'),auth[_0xcdaf('0xa')](),controller[_0xcdaf('0x12')]);router['post']('/',auth[_0xcdaf('0xa')](),controller[_0xcdaf('0x13')]);router[_0xcdaf('0x14')](_0xcdaf('0x11'),auth[_0xcdaf('0xa')](),controller[_0xcdaf('0x15')]);router[_0xcdaf('0x16')](_0xcdaf('0xc'),auth['isAuthenticated'](),controller[_0xcdaf('0x17')]);router[_0xcdaf('0x18')]('/:id',auth[_0xcdaf('0xa')](),controller[_0xcdaf('0x19')]);module[_0xcdaf('0x1a')]=router; \ No newline at end of file +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 diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 62e260a..7d6df0a 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 _0xc063=['sequelize','exports','STRING'];(function(_0x52085a,_0x3717ca){var _0x5afc1a=function(_0x2aa175){while(--_0x2aa175){_0x52085a['push'](_0x52085a['shift']());}};_0x5afc1a(++_0x3717ca);}(_0xc063,0xed));var _0x3c06=function(_0x1c0a06,_0x53b821){_0x1c0a06=_0x1c0a06-0x0;var _0x43e800=_0xc063[_0x1c0a06];return _0x43e800;};'use strict';var Sequelize=require(_0x3c06('0x0'));module[_0x3c06('0x1')]={'name':{'type':Sequelize[_0x3c06('0x2')]},'description':{'type':Sequelize[_0x3c06('0x2')]}}; \ No newline at end of file +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 diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 0dec06a..36ad7c1 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 _0xa660=['FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','json','offset','set','apply','reject','update','destroy','sendStatus','stack','name','send','map','FreshdeskConfiguration','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','count','include','findAll','catch','show','params','keys','rawAttributes','includeAll','find','create','body','findOne','FreshdeskField','filter','getFields','getSubjects','getDescriptions','Tag','getTags','setTags','ids','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info'];(function(_0x19d610,_0x1bc8c9){var _0xd25be0=function(_0x334779){while(--_0x334779){_0x19d610['push'](_0x19d610['shift']());}};_0xd25be0(++_0x1bc8c9);}(_0xa660,0x1c6));var _0x0a66=function(_0xaaaa70,_0x5e5037){_0xaaaa70=_0xaaaa70-0x0;var _0x2cc574=_0xa660[_0xaaaa70];return _0x2cc574;};'use strict';var pdf=require(_0x0a66('0x0'));var emlformat=require(_0x0a66('0x1'));var rimraf=require(_0x0a66('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0a66('0x3'));var rp=require(_0x0a66('0x4'));var moment=require(_0x0a66('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0a66('0x6'));var path=require('path');var sox=require(_0x0a66('0x7'));var csv=require(_0x0a66('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0a66('0x9'));var squel=require(_0x0a66('0xa'));var crypto=require(_0x0a66('0xb'));var jsforce=require(_0x0a66('0xc'));var deskjs=require(_0x0a66('0xd'));var toCsv=require(_0x0a66('0x8'));var querystring=require(_0x0a66('0xe'));var Papa=require(_0x0a66('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0a66('0x10'));var as=require(_0x0a66('0x11'));var hardwareService=require(_0x0a66('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x0a66('0x13'));var config=require(_0x0a66('0x14'));var db=require(_0x0a66('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x0a66('0x16')][_0x0a66('0x17')]({'port':0x232a});function checkPasswordPattern(_0x3d478a,_0x317088,_0x1932e1){if(_0x1932e1){var _0x2cc6b5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2cc6b5[_0x0a66('0x18')](_0x317088)){return _0x3d478a;}else{throw new db[(_0x0a66('0x19'))][(_0x0a66('0x1a'))](_0x0a66('0x1b'));}}else{return _0x3d478a;}}function respondWithRpcPromise(_0x42acf9,_0x5c628e,_0x13cbdf,_0x5019ce){return new BPromise(function(_0x875bea,_0x2933da){var _0x452273=_0x5019ce||client;return _0x452273[_0x0a66('0x1c')](_0x42acf9,_0x13cbdf)[_0x0a66('0x1d')](function(_0x428683){logger[_0x0a66('0x1e')](_0x0a66('0x1f'),_0x5c628e,_0x0a66('0x20'));logger[_0x0a66('0x21')](_0x0a66('0x22'),_0x5c628e,'request\x20sent',JSON[_0x0a66('0x23')](_0x428683));if(_0x428683[_0x0a66('0x24')]){if(_0x428683[_0x0a66('0x24')][_0x0a66('0x25')]===0x1f4){logger[_0x0a66('0x24')](_0x0a66('0x1f'),_0x5c628e,_0x428683[_0x0a66('0x24')][_0x0a66('0x26')]);return _0x2933da(_0x428683[_0x0a66('0x24')][_0x0a66('0x26')]);}logger['error'](_0x0a66('0x1f'),_0x5c628e,_0x428683[_0x0a66('0x24')][_0x0a66('0x26')]);return _0x875bea(_0x428683[_0x0a66('0x24')][_0x0a66('0x26')]);}else{logger[_0x0a66('0x1e')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5c628e,_0x0a66('0x20'));_0x875bea(_0x428683[_0x0a66('0x27')][_0x0a66('0x26')]);}})['catch'](function(_0x554a23){logger[_0x0a66('0x24')](_0x0a66('0x1f'),_0x5c628e,_0x554a23);_0x2933da(_0x554a23);});});}function respondWithStatusCode(_0x2820f4,_0x58068f){_0x58068f=_0x58068f||0xcc;return function(_0x3a1676){if(_0x3a1676){return _0x2820f4['sendStatus'](_0x58068f);}return _0x2820f4[_0x0a66('0x28')](_0x58068f)[_0x0a66('0x29')]();};}function respondWithResult(_0x208b6e,_0x357edd){_0x357edd=_0x357edd||0xc8;return function(_0x876d6b){if(_0x876d6b){return _0x208b6e['status'](_0x357edd)[_0x0a66('0x2a')](_0x876d6b);}};}function respondWithFilteredResult(_0x5deee3,_0x14e07d){return function(_0x3f690f){if(_0x3f690f){var _0x2476b5=_0x3f690f['count'],_0x188674=_0x14e07d['offset'],_0x2f41ca=_0x14e07d[_0x0a66('0x2b')]+_0x14e07d['limit'],_0xefb7a3;if(_0x2f41ca>=_0x2476b5){_0x2f41ca=_0x2476b5;_0xefb7a3=0xc8;}else{_0xefb7a3=0xce;}_0x5deee3[_0x0a66('0x28')](_0xefb7a3);return _0x5deee3[_0x0a66('0x2c')]('Content-Range',_0x188674+'-'+_0x2f41ca+'/'+_0x2476b5)[_0x0a66('0x2a')](_0x3f690f);}return null;};}function patchUpdates(_0x56bb7b){return function(_0x56ad42){try{jsonpatch[_0x0a66('0x2d')](_0x56ad42,_0x56bb7b,!![]);}catch(_0x59e241){return BPromise[_0x0a66('0x2e')](_0x59e241);}return _0x56ad42['save']();};}function saveUpdates(_0x2dbe78,_0x400fce){return function(_0x59ab82){if(_0x59ab82){return _0x59ab82[_0x0a66('0x2f')](_0x2dbe78)['then'](function(_0x5e4032){return _0x5e4032;});}return null;};}function removeEntity(_0x450a4e,_0xdb1503){return function(_0x1fa9a2){if(_0x1fa9a2){return _0x1fa9a2[_0x0a66('0x30')]()['then'](function(){_0x450a4e['status'](0xcc)[_0x0a66('0x29')]();});}};}function handleEntityNotFound(_0x46df79,_0x81f0f5){return function(_0x11a982){if(!_0x11a982){_0x46df79[_0x0a66('0x31')](0x194);}return _0x11a982;};}function handleError(_0x43ea73,_0x34a57b){_0x34a57b=_0x34a57b||0x1f4;return function(_0xc21720){logger['error'](_0xc21720[_0x0a66('0x32')]);if(_0xc21720[_0x0a66('0x33')]){delete _0xc21720[_0x0a66('0x33')];}_0x43ea73[_0x0a66('0x28')](_0x34a57b)[_0x0a66('0x34')](_0xc21720);};}exports['index']=function(_0xdf96f4,_0x28cf05){var _0x186de5={},_0x5db324={},_0x27ac3f={'count':0x0,'rows':[]};var _0x53b9da=_[_0x0a66('0x35')](db[_0x0a66('0x36')]['rawAttributes'],function(_0x4e7b64){return{'name':_0x4e7b64[_0x0a66('0x37')],'type':_0x4e7b64[_0x0a66('0x38')][_0x0a66('0x39')]};});_0x5db324[_0x0a66('0x3a')]=_[_0x0a66('0x35')](_0x53b9da,_0x0a66('0x33'));_0x5db324['query']=_['keys'](_0xdf96f4[_0x0a66('0x3b')]);_0x5db324[_0x0a66('0x3c')]=_[_0x0a66('0x3d')](_0x5db324[_0x0a66('0x3a')],_0x5db324[_0x0a66('0x3b')]);_0x186de5[_0x0a66('0x3e')]=_[_0x0a66('0x3d')](_0x5db324[_0x0a66('0x3a')],qs[_0x0a66('0x3f')](_0xdf96f4[_0x0a66('0x3b')]['fields']));_0x186de5[_0x0a66('0x3e')]=_0x186de5[_0x0a66('0x3e')][_0x0a66('0x40')]?_0x186de5['attributes']:_0x5db324['model'];if(!_0xdf96f4[_0x0a66('0x3b')][_0x0a66('0x41')](_0x0a66('0x42'))){_0x186de5['limit']=qs[_0x0a66('0x43')](_0xdf96f4[_0x0a66('0x3b')][_0x0a66('0x43')]);_0x186de5[_0x0a66('0x2b')]=qs[_0x0a66('0x2b')](_0xdf96f4[_0x0a66('0x3b')][_0x0a66('0x2b')]);}_0x186de5[_0x0a66('0x44')]=qs[_0x0a66('0x45')](_0xdf96f4[_0x0a66('0x3b')][_0x0a66('0x45')]);_0x186de5[_0x0a66('0x46')]=qs[_0x0a66('0x3c')](_[_0x0a66('0x47')](_0xdf96f4[_0x0a66('0x3b')],_0x5db324['filters']));if(_0xdf96f4[_0x0a66('0x3b')]['filter']){_0x186de5[_0x0a66('0x46')]=_[_0x0a66('0x48')](_0x186de5[_0x0a66('0x46')],{'$or':_[_0x0a66('0x35')](_0x53b9da,function(_0x1ffb5f){if(_0x1ffb5f['type']!==_0x0a66('0x49')){var _0x2891da={};_0x2891da[_0x1ffb5f[_0x0a66('0x33')]]={'$like':'%'+_0xdf96f4[_0x0a66('0x3b')]['filter']+'%'};return _0x2891da;}})});}_0x186de5=_[_0x0a66('0x48')]({},_0x186de5,_0xdf96f4[_0x0a66('0x4a')]);var _0x1116b2={'where':_0x186de5[_0x0a66('0x46')]};return db['FreshdeskConfiguration']['count'](_0x1116b2)[_0x0a66('0x1d')](function(_0x5b4a64){_0x27ac3f[_0x0a66('0x4b')]=_0x5b4a64;if(_0xdf96f4[_0x0a66('0x3b')]['includeAll']){_0x186de5[_0x0a66('0x4c')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x0a66('0x4d')](_0x186de5);})[_0x0a66('0x1d')](function(_0x33b674){_0x27ac3f['rows']=_0x33b674;return _0x27ac3f;})['then'](respondWithFilteredResult(_0x28cf05,_0x186de5))[_0x0a66('0x4e')](handleError(_0x28cf05,null));};exports[_0x0a66('0x4f')]=function(_0x332486,_0x2bfd74){var _0x4f9209={'raw':![],'where':{'id':_0x332486[_0x0a66('0x50')]['id']}},_0x25a8f8={};_0x25a8f8[_0x0a66('0x3a')]=_[_0x0a66('0x51')](db[_0x0a66('0x36')][_0x0a66('0x52')]);_0x25a8f8[_0x0a66('0x3b')]=_[_0x0a66('0x51')](_0x332486[_0x0a66('0x3b')]);_0x25a8f8['filters']=_[_0x0a66('0x3d')](_0x25a8f8[_0x0a66('0x3a')],_0x25a8f8[_0x0a66('0x3b')]);_0x4f9209['attributes']=_[_0x0a66('0x3d')](_0x25a8f8[_0x0a66('0x3a')],qs['fields'](_0x332486[_0x0a66('0x3b')][_0x0a66('0x3f')]));_0x4f9209[_0x0a66('0x3e')]=_0x4f9209['attributes'][_0x0a66('0x40')]?_0x4f9209['attributes']:_0x25a8f8[_0x0a66('0x3a')];if(_0x332486[_0x0a66('0x3b')][_0x0a66('0x53')]){_0x4f9209[_0x0a66('0x4c')]=[{'all':!![]}];}_0x4f9209=_[_0x0a66('0x48')]({},_0x4f9209,_0x332486['options']);return db['FreshdeskConfiguration'][_0x0a66('0x54')](_0x4f9209)['then'](handleEntityNotFound(_0x2bfd74,null))['then'](respondWithResult(_0x2bfd74,null))[_0x0a66('0x4e')](handleError(_0x2bfd74,null));};exports[_0x0a66('0x55')]=function(_0x531dff,_0x109359){return db[_0x0a66('0x36')]['create'](_0x531dff['body'],{})[_0x0a66('0x1d')](respondWithResult(_0x109359,0xc9))[_0x0a66('0x4e')](handleError(_0x109359,null));};exports['update']=function(_0x2c2dbd,_0x5920ea){if(_0x2c2dbd['body']['id']){delete _0x2c2dbd[_0x0a66('0x56')]['id'];}return db[_0x0a66('0x36')]['find']({'where':{'id':_0x2c2dbd[_0x0a66('0x50')]['id']}})['then'](handleEntityNotFound(_0x5920ea,null))[_0x0a66('0x1d')](saveUpdates(_0x2c2dbd[_0x0a66('0x56')],null))[_0x0a66('0x1d')](respondWithResult(_0x5920ea,null))[_0x0a66('0x4e')](handleError(_0x5920ea,null));};exports[_0x0a66('0x30')]=function(_0x521870,_0x2527f1){return db[_0x0a66('0x36')][_0x0a66('0x54')]({'where':{'id':_0x521870[_0x0a66('0x50')]['id']}})[_0x0a66('0x1d')](handleEntityNotFound(_0x2527f1,null))[_0x0a66('0x1d')](removeEntity(_0x2527f1,null))[_0x0a66('0x4e')](handleError(_0x2527f1,null));};exports['getFields']=function(_0x316184,_0xbeba94,_0x24f65b){var _0x115a44={};var _0x5d3e25={};var _0x16cce2;var _0x20fa67;return db[_0x0a66('0x36')][_0x0a66('0x57')]({'where':{'id':_0x316184[_0x0a66('0x50')]['id']}})[_0x0a66('0x1d')](handleEntityNotFound(_0xbeba94,null))[_0x0a66('0x1d')](function(_0x473585){if(_0x473585){_0x16cce2=_0x473585;_0x5d3e25[_0x0a66('0x3a')]=_[_0x0a66('0x51')](db[_0x0a66('0x58')][_0x0a66('0x52')]);_0x5d3e25['query']=_[_0x0a66('0x51')](_0x316184[_0x0a66('0x3b')]);_0x5d3e25['filters']=_['intersection'](_0x5d3e25[_0x0a66('0x3a')],_0x5d3e25['query']);_0x115a44[_0x0a66('0x3e')]=_[_0x0a66('0x3d')](_0x5d3e25[_0x0a66('0x3a')],qs[_0x0a66('0x3f')](_0x316184[_0x0a66('0x3b')][_0x0a66('0x3f')]));_0x115a44[_0x0a66('0x3e')]=_0x115a44[_0x0a66('0x3e')][_0x0a66('0x40')]?_0x115a44['attributes']:_0x5d3e25[_0x0a66('0x3a')];_0x115a44[_0x0a66('0x44')]=qs[_0x0a66('0x45')](_0x316184[_0x0a66('0x3b')][_0x0a66('0x45')]);_0x115a44['where']=qs['filters'](_[_0x0a66('0x47')](_0x316184[_0x0a66('0x3b')],_0x5d3e25[_0x0a66('0x3c')]));if(_0x316184['query'][_0x0a66('0x59')]){_0x115a44[_0x0a66('0x46')]=_[_0x0a66('0x48')](_0x115a44[_0x0a66('0x46')],{'$or':_[_0x0a66('0x35')](_0x115a44[_0x0a66('0x3e')],function(_0x1d112f){var _0x352311={};_0x352311[_0x1d112f]={'$like':'%'+_0x316184[_0x0a66('0x3b')][_0x0a66('0x59')]+'%'};return _0x352311;})});}_0x115a44=_[_0x0a66('0x48')]({},_0x115a44,_0x316184[_0x0a66('0x4a')]);return _0x16cce2[_0x0a66('0x5a')](_0x115a44);}})[_0x0a66('0x1d')](function(_0x431bb6){if(_0x431bb6){_0x20fa67=_0x431bb6[_0x0a66('0x40')];if(!_0x316184['query'][_0x0a66('0x41')](_0x0a66('0x42'))){_0x115a44[_0x0a66('0x43')]=qs[_0x0a66('0x43')](_0x316184[_0x0a66('0x3b')][_0x0a66('0x43')]);_0x115a44[_0x0a66('0x2b')]=qs['offset'](_0x316184[_0x0a66('0x3b')][_0x0a66('0x2b')]);}return _0x16cce2['getFields'](_0x115a44);}})['then'](function(_0x260067){if(_0x260067){return _0x260067?{'count':_0x20fa67,'rows':_0x260067}:null;}})['then'](respondWithResult(_0xbeba94,null))['catch'](handleError(_0xbeba94,null));};exports[_0x0a66('0x5b')]=function(_0x5413b8,_0x3a0bcb,_0x36f8f1){var _0x460467={};var _0x901b93={};var _0x3efbe1;var _0x3d4b0e;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x5413b8[_0x0a66('0x50')]['id']}})[_0x0a66('0x1d')](handleEntityNotFound(_0x3a0bcb,null))[_0x0a66('0x1d')](function(_0x180950){if(_0x180950){_0x3efbe1=_0x180950;_0x901b93[_0x0a66('0x3a')]=_[_0x0a66('0x51')](db[_0x0a66('0x58')][_0x0a66('0x52')]);_0x901b93[_0x0a66('0x3b')]=_[_0x0a66('0x51')](_0x5413b8[_0x0a66('0x3b')]);_0x901b93[_0x0a66('0x3c')]=_[_0x0a66('0x3d')](_0x901b93[_0x0a66('0x3a')],_0x901b93[_0x0a66('0x3b')]);_0x460467[_0x0a66('0x3e')]=_[_0x0a66('0x3d')](_0x901b93[_0x0a66('0x3a')],qs[_0x0a66('0x3f')](_0x5413b8[_0x0a66('0x3b')][_0x0a66('0x3f')]));_0x460467[_0x0a66('0x3e')]=_0x460467[_0x0a66('0x3e')]['length']?_0x460467[_0x0a66('0x3e')]:_0x901b93[_0x0a66('0x3a')];_0x460467[_0x0a66('0x44')]=qs[_0x0a66('0x45')](_0x5413b8['query'][_0x0a66('0x45')]);_0x460467[_0x0a66('0x46')]=qs[_0x0a66('0x3c')](_[_0x0a66('0x47')](_0x5413b8[_0x0a66('0x3b')],_0x901b93['filters']));if(_0x5413b8['query'][_0x0a66('0x59')]){_0x460467['where']=_[_0x0a66('0x48')](_0x460467[_0x0a66('0x46')],{'$or':_[_0x0a66('0x35')](_0x460467[_0x0a66('0x3e')],function(_0xcafb4f){var _0x1fdd91={};_0x1fdd91[_0xcafb4f]={'$like':'%'+_0x5413b8['query']['filter']+'%'};return _0x1fdd91;})});}_0x460467=_[_0x0a66('0x48')]({},_0x460467,_0x5413b8[_0x0a66('0x4a')]);return _0x3efbe1[_0x0a66('0x5b')](_0x460467);}})[_0x0a66('0x1d')](function(_0x2efede){if(_0x2efede){_0x3d4b0e=_0x2efede[_0x0a66('0x40')];if(!_0x5413b8[_0x0a66('0x3b')][_0x0a66('0x41')]('nolimit')){_0x460467[_0x0a66('0x43')]=qs[_0x0a66('0x43')](_0x5413b8[_0x0a66('0x3b')]['limit']);_0x460467[_0x0a66('0x2b')]=qs[_0x0a66('0x2b')](_0x5413b8['query'][_0x0a66('0x2b')]);}return _0x3efbe1['getSubjects'](_0x460467);}})[_0x0a66('0x1d')](function(_0x187250){if(_0x187250){return _0x187250?{'count':_0x3d4b0e,'rows':_0x187250}:null;}})[_0x0a66('0x1d')](respondWithResult(_0x3a0bcb,null))[_0x0a66('0x4e')](handleError(_0x3a0bcb,null));};exports['getDescriptions']=function(_0x52663e,_0x11ad4c,_0x270a25){var _0xcacd58={};var _0x1bb239={};var _0x5d2d55;var _0x40da96;return db['FreshdeskConfiguration'][_0x0a66('0x57')]({'where':{'id':_0x52663e[_0x0a66('0x50')]['id']}})[_0x0a66('0x1d')](handleEntityNotFound(_0x11ad4c,null))['then'](function(_0x49d085){if(_0x49d085){_0x5d2d55=_0x49d085;_0x1bb239[_0x0a66('0x3a')]=_[_0x0a66('0x51')](db[_0x0a66('0x58')]['rawAttributes']);_0x1bb239['query']=_['keys'](_0x52663e['query']);_0x1bb239[_0x0a66('0x3c')]=_[_0x0a66('0x3d')](_0x1bb239['model'],_0x1bb239[_0x0a66('0x3b')]);_0xcacd58[_0x0a66('0x3e')]=_[_0x0a66('0x3d')](_0x1bb239[_0x0a66('0x3a')],qs['fields'](_0x52663e[_0x0a66('0x3b')]['fields']));_0xcacd58['attributes']=_0xcacd58[_0x0a66('0x3e')][_0x0a66('0x40')]?_0xcacd58[_0x0a66('0x3e')]:_0x1bb239['model'];_0xcacd58['order']=qs[_0x0a66('0x45')](_0x52663e[_0x0a66('0x3b')][_0x0a66('0x45')]);_0xcacd58[_0x0a66('0x46')]=qs[_0x0a66('0x3c')](_[_0x0a66('0x47')](_0x52663e[_0x0a66('0x3b')],_0x1bb239[_0x0a66('0x3c')]));if(_0x52663e['query'][_0x0a66('0x59')]){_0xcacd58[_0x0a66('0x46')]=_[_0x0a66('0x48')](_0xcacd58['where'],{'$or':_[_0x0a66('0x35')](_0xcacd58['attributes'],function(_0x148320){var _0x3970ee={};_0x3970ee[_0x148320]={'$like':'%'+_0x52663e['query'][_0x0a66('0x59')]+'%'};return _0x3970ee;})});}_0xcacd58=_['merge']({},_0xcacd58,_0x52663e['options']);return _0x5d2d55[_0x0a66('0x5c')](_0xcacd58);}})['then'](function(_0x523310){if(_0x523310){_0x40da96=_0x523310['length'];if(!_0x52663e[_0x0a66('0x3b')]['hasOwnProperty']('nolimit')){_0xcacd58[_0x0a66('0x43')]=qs[_0x0a66('0x43')](_0x52663e[_0x0a66('0x3b')][_0x0a66('0x43')]);_0xcacd58[_0x0a66('0x2b')]=qs['offset'](_0x52663e[_0x0a66('0x3b')][_0x0a66('0x2b')]);}return _0x5d2d55[_0x0a66('0x5c')](_0xcacd58);}})[_0x0a66('0x1d')](function(_0x383ca3){if(_0x383ca3){return _0x383ca3?{'count':_0x40da96,'rows':_0x383ca3}:null;}})[_0x0a66('0x1d')](respondWithResult(_0x11ad4c,null))[_0x0a66('0x4e')](handleError(_0x11ad4c,null));};exports['getTags']=function(_0x404360,_0xe1c1ce,_0x17ac77){var _0x265605={};var _0x2a37c8={};var _0x1869a8;var _0x1711d7;return db[_0x0a66('0x36')]['findOne']({'where':{'id':_0x404360[_0x0a66('0x50')]['id']}})[_0x0a66('0x1d')](handleEntityNotFound(_0xe1c1ce,null))[_0x0a66('0x1d')](function(_0x281545){if(_0x281545){_0x1869a8=_0x281545;_0x2a37c8['model']=_[_0x0a66('0x51')](db[_0x0a66('0x5d')][_0x0a66('0x52')]);_0x2a37c8[_0x0a66('0x3b')]=_[_0x0a66('0x51')](_0x404360[_0x0a66('0x3b')]);_0x2a37c8['filters']=_[_0x0a66('0x3d')](_0x2a37c8['model'],_0x2a37c8[_0x0a66('0x3b')]);_0x265605[_0x0a66('0x3e')]=_[_0x0a66('0x3d')](_0x2a37c8[_0x0a66('0x3a')],qs[_0x0a66('0x3f')](_0x404360['query']['fields']));_0x265605['attributes']=_0x265605[_0x0a66('0x3e')][_0x0a66('0x40')]?_0x265605['attributes']:_0x2a37c8[_0x0a66('0x3a')];_0x265605['order']=qs[_0x0a66('0x45')](_0x404360['query'][_0x0a66('0x45')]);_0x265605[_0x0a66('0x46')]=qs['filters'](_[_0x0a66('0x47')](_0x404360[_0x0a66('0x3b')],_0x2a37c8[_0x0a66('0x3c')]));if(_0x404360[_0x0a66('0x3b')]['filter']){_0x265605[_0x0a66('0x46')]=_[_0x0a66('0x48')](_0x265605[_0x0a66('0x46')],{'$or':_[_0x0a66('0x35')](_0x265605[_0x0a66('0x3e')],function(_0x4dd251){var _0x47006e={};_0x47006e[_0x4dd251]={'$like':'%'+_0x404360['query'][_0x0a66('0x59')]+'%'};return _0x47006e;})});}_0x265605=_[_0x0a66('0x48')]({},_0x265605,_0x404360[_0x0a66('0x4a')]);return _0x1869a8[_0x0a66('0x5e')](_0x265605);}})[_0x0a66('0x1d')](function(_0x545b5e){if(_0x545b5e){_0x1711d7=_0x545b5e[_0x0a66('0x40')];if(!_0x404360['query']['hasOwnProperty'](_0x0a66('0x42'))){_0x265605[_0x0a66('0x43')]=qs[_0x0a66('0x43')](_0x404360['query'][_0x0a66('0x43')]);_0x265605[_0x0a66('0x2b')]=qs[_0x0a66('0x2b')](_0x404360[_0x0a66('0x3b')][_0x0a66('0x2b')]);}return _0x1869a8[_0x0a66('0x5e')](_0x265605);}})[_0x0a66('0x1d')](function(_0x3632c4){if(_0x3632c4){return _0x3632c4?{'count':_0x1711d7,'rows':_0x3632c4}:null;}})[_0x0a66('0x1d')](respondWithResult(_0xe1c1ce,null))[_0x0a66('0x4e')](handleError(_0xe1c1ce,null));};exports[_0x0a66('0x5f')]=function(_0x3b8e8b,_0x36d927,_0xbd8ac6){if(_0x3b8e8b['body']['id']){delete _0x3b8e8b[_0x0a66('0x56')]['id'];}return db[_0x0a66('0x36')][_0x0a66('0x57')]({'where':{'id':_0x3b8e8b[_0x0a66('0x50')]['id']}})[_0x0a66('0x1d')](handleEntityNotFound(_0x36d927,null))[_0x0a66('0x1d')](function(_0xb06f66){if(_0xb06f66){return _0xb06f66[_0x0a66('0x5f')](_0x3b8e8b['body'][_0x0a66('0x60')]||[]);}return null;})['then'](respondWithResult(_0x36d927,null))[_0x0a66('0x4e')](handleError(_0x36d927,null));}; \ No newline at end of file +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 diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 92ac91a..f174f9a 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 _0x8faf=['exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x8faf,0xd6));var _0xf8fa=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x8faf[_0x45783c];return _0x1161da;};'use strict';var _=require(_0xf8fa('0x0'));var util=require(_0xf8fa('0x1'));var logger=require(_0xf8fa('0x2'))(_0xf8fa('0x3'));var moment=require(_0xf8fa('0x4'));var BPromise=require(_0xf8fa('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf8fa('0x6'));var rimraf=require(_0xf8fa('0x7'));var config=require(_0xf8fa('0x8'));var attributes=require(_0xf8fa('0x9'));module[_0xf8fa('0xa')]=function(_0x33a62a,_0xbeabea){return _0x33a62a[_0xf8fa('0xb')](_0xf8fa('0xc'),attributes,{'tableName':_0xf8fa('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 08c99b6..2fdef71 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 _0xb8ec=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x32c2cf,_0x2d8462){var _0x1f3f04=function(_0x1ec6fc){while(--_0x1ec6fc){_0x32c2cf['push'](_0x32c2cf['shift']());}};_0x1f3f04(++_0x2d8462);}(_0xb8ec,0x1ca));var _0xcb8e=function(_0x35fb43,_0x2ed757){_0x35fb43=_0x35fb43-0x0;var _0x379bda=_0xb8ec[_0x35fb43];return _0x379bda;};'use strict';var _=require('lodash');var util=require(_0xcb8e('0x0'));var moment=require(_0xcb8e('0x1'));var BPromise=require(_0xcb8e('0x2'));var rs=require(_0xcb8e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcb8e('0x4'))['db'];var utils=require(_0xcb8e('0x5'));var logger=require(_0xcb8e('0x6'))('rpc');var config=require(_0xcb8e('0x7'));var jayson=require(_0xcb8e('0x8'));var client=jayson[_0xcb8e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ccede,_0xbfe794,_0x5baea8){return new BPromise(function(_0x4ec52d,_0x52b967){return client[_0xcb8e('0xa')](_0x3ccede,_0x5baea8)[_0xcb8e('0xb')](function(_0x3c9ed3){logger[_0xcb8e('0xc')](_0xcb8e('0xd'),_0xbfe794,'request\x20sent');logger[_0xcb8e('0xe')](_0xcb8e('0xf'),_0xbfe794,'request\x20sent',JSON['stringify'](_0x3c9ed3));if(_0x3c9ed3['error']){if(_0x3c9ed3[_0xcb8e('0x10')][_0xcb8e('0x11')]===0x1f4){logger[_0xcb8e('0x10')](_0xcb8e('0xd'),_0xbfe794,_0x3c9ed3['error'][_0xcb8e('0x12')]);return _0x52b967(_0x3c9ed3[_0xcb8e('0x10')]['message']);}logger['error'](_0xcb8e('0xd'),_0xbfe794,_0x3c9ed3[_0xcb8e('0x10')][_0xcb8e('0x12')]);return _0x4ec52d(_0x3c9ed3[_0xcb8e('0x10')][_0xcb8e('0x12')]);}else{logger[_0xcb8e('0xc')](_0xcb8e('0xd'),_0xbfe794,'request\x20sent');_0x4ec52d(_0x3c9ed3[_0xcb8e('0x13')][_0xcb8e('0x12')]);}})[_0xcb8e('0x14')](function(_0x4e57f4){logger[_0xcb8e('0x10')](_0xcb8e('0xd'),_0xbfe794,_0x4e57f4);_0x52b967(_0x4e57f4);});});} \ No newline at end of file +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 diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 9ceda2f..fde57e7 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 _0xa9e0=['/:id','update','delete','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated'];(function(_0x15341d,_0x11974b){var _0x12d658=function(_0x5165d5){while(--_0x5165d5){_0x15341d['push'](_0x15341d['shift']());}};_0x12d658(++_0x11974b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['show']);router['post']('/',auth[_0x0a9e('0x8')](),controller['create']);router['put'](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xa')]);router[_0x0a9e('0xb')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x70e0=['create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','post','isAuthenticated'];(function(_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 diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index a23abd9..dcb716b 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 _0x10c4=['ENUM','string','variable','customVariable','keyValue','STRING','sequelize'];(function(_0x8c758f,_0x2df960){var _0x14cd51=function(_0xfd408c){while(--_0xfd408c){_0x8c758f['push'](_0x8c758f['shift']());}};_0x14cd51(++_0x2df960);}(_0x10c4,0x16b));var _0x410c=function(_0x341692,_0x1af296){_0x341692=_0x341692-0x0;var _0x5f4e41=_0x10c4[_0x341692];return _0x5f4e41;};'use strict';var Sequelize=require(_0x410c('0x0'));module['exports']={'type':{'type':Sequelize[_0x410c('0x1')](_0x410c('0x2'),_0x410c('0x3'),_0x410c('0x4'),_0x410c('0x5')),'defaultValue':_0x410c('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x410c('0x6')]},'keyType':{'type':Sequelize[_0x410c('0x1')](_0x410c('0x2'),_0x410c('0x3'),_0x410c('0x4'))},'keyContent':{'type':Sequelize[_0x410c('0x6')]},'idField':{'type':Sequelize[_0x410c('0x6')]},'nameField':{'type':Sequelize[_0x410c('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x410c('0x6')]}}; \ No newline at end of file +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 diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index e26e0e9..9e28957 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 _0x776c=['fast-json-patch','moment','mustache','util','sox','ejs','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','FreshdeskField','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','params','keys','find','create','body','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x371690,_0x250e62){var _0x577106=function(_0x2c3207){while(--_0x2c3207){_0x371690['push'](_0x371690['shift']());}};_0x577106(++_0x250e62);}(_0x776c,0xd4));var _0xc776=function(_0x4f2428,_0x3c7af4){_0x4f2428=_0x4f2428-0x0;var _0x391375=_0x776c[_0x4f2428];return _0x391375;};'use strict';var pdf=require(_0xc776('0x0'));var emlformat=require(_0xc776('0x1'));var rimraf=require(_0xc776('0x2'));var zipdir=require(_0xc776('0x3'));var jsonpatch=require(_0xc776('0x4'));var rp=require('request-promise');var moment=require(_0xc776('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc776('0x6'));var util=require(_0xc776('0x7'));var path=require('path');var sox=require(_0xc776('0x8'));var csv=require('to-csv');var ejs=require(_0xc776('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc776('0xa'));var deskjs=require(_0xc776('0xb'));var toCsv=require(_0xc776('0xc'));var querystring=require(_0xc776('0xd'));var Papa=require(_0xc776('0xe'));var Redis=require(_0xc776('0xf'));var authService=require(_0xc776('0x10'));var qs=require(_0xc776('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc776('0x12'));var logger=require(_0xc776('0x13'))('api');var utils=require(_0xc776('0x14'));var config=require(_0xc776('0x15'));var db=require(_0xc776('0x16'))['db'];function respondWithStatusCode(_0x41b2cd,_0x2600a8){_0x2600a8=_0x2600a8||0xcc;return function(_0x2fae08){if(_0x2fae08){return _0x41b2cd[_0xc776('0x17')](_0x2600a8);}return _0x41b2cd['status'](_0x2600a8)[_0xc776('0x18')]();};}function respondWithResult(_0xd512e1,_0x2b968f){_0x2b968f=_0x2b968f||0xc8;return function(_0x21aa1a){if(_0x21aa1a){return _0xd512e1[_0xc776('0x19')](_0x2b968f)[_0xc776('0x1a')](_0x21aa1a);}};}function respondWithFilteredResult(_0x1ede89,_0xf2417f){return function(_0x586817){if(_0x586817){var _0x157bd8=_0x586817[_0xc776('0x1b')],_0x3d7304=_0xf2417f[_0xc776('0x1c')],_0x3547e6=_0xf2417f[_0xc776('0x1c')]+_0xf2417f[_0xc776('0x1d')],_0x1746b5;if(_0x3547e6>=_0x157bd8){_0x3547e6=_0x157bd8;_0x1746b5=0xc8;}else{_0x1746b5=0xce;}_0x1ede89['status'](_0x1746b5);return _0x1ede89['set'](_0xc776('0x1e'),_0x3d7304+'-'+_0x3547e6+'/'+_0x157bd8)[_0xc776('0x1a')](_0x586817);}return null;};}function patchUpdates(_0x3926d0){return function(_0x15a2c9){try{jsonpatch[_0xc776('0x1f')](_0x15a2c9,_0x3926d0,!![]);}catch(_0x497b6f){return BPromise[_0xc776('0x20')](_0x497b6f);}return _0x15a2c9[_0xc776('0x21')]();};}function saveUpdates(_0x3d837c,_0x829df0){return function(_0x3e707e){if(_0x3e707e){return _0x3e707e[_0xc776('0x22')](_0x3d837c)[_0xc776('0x23')](function(_0x140884){return _0x140884;});}return null;};}function removeEntity(_0x889b48,_0xeb5485){return function(_0x53a21a){if(_0x53a21a){return _0x53a21a[_0xc776('0x24')]()[_0xc776('0x23')](function(){_0x889b48[_0xc776('0x19')](0xcc)[_0xc776('0x18')]();});}};}function handleEntityNotFound(_0x50e3bd,_0x540358){return function(_0x3a897e){if(!_0x3a897e){_0x50e3bd[_0xc776('0x17')](0x194);}return _0x3a897e;};}function handleError(_0x319ed8,_0x3c5484){_0x3c5484=_0x3c5484||0x1f4;return function(_0x32b25d){logger[_0xc776('0x25')](_0x32b25d[_0xc776('0x26')]);if(_0x32b25d['name']){delete _0x32b25d[_0xc776('0x27')];}_0x319ed8[_0xc776('0x19')](_0x3c5484)[_0xc776('0x28')](_0x32b25d);};}exports['index']=function(_0x188b8b,_0x6c0cb5){var _0x59eb4f={},_0x2fa975={},_0x3be75b={'count':0x0,'rows':[]};var _0x1786d8=_[_0xc776('0x29')](db[_0xc776('0x2a')][_0xc776('0x2b')],function(_0x3280f3){return{'name':_0x3280f3[_0xc776('0x2c')],'type':_0x3280f3[_0xc776('0x2d')][_0xc776('0x2e')]};});_0x2fa975['model']=_[_0xc776('0x29')](_0x1786d8,_0xc776('0x27'));_0x2fa975[_0xc776('0x2f')]=_['keys'](_0x188b8b['query']);_0x2fa975[_0xc776('0x30')]=_[_0xc776('0x31')](_0x2fa975['model'],_0x2fa975[_0xc776('0x2f')]);_0x59eb4f[_0xc776('0x32')]=_['intersection'](_0x2fa975[_0xc776('0x33')],qs[_0xc776('0x34')](_0x188b8b[_0xc776('0x2f')][_0xc776('0x34')]));_0x59eb4f[_0xc776('0x32')]=_0x59eb4f[_0xc776('0x32')][_0xc776('0x35')]?_0x59eb4f['attributes']:_0x2fa975[_0xc776('0x33')];if(!_0x188b8b[_0xc776('0x2f')][_0xc776('0x36')](_0xc776('0x37'))){_0x59eb4f[_0xc776('0x1d')]=qs[_0xc776('0x1d')](_0x188b8b[_0xc776('0x2f')][_0xc776('0x1d')]);_0x59eb4f[_0xc776('0x1c')]=qs[_0xc776('0x1c')](_0x188b8b[_0xc776('0x2f')][_0xc776('0x1c')]);}_0x59eb4f[_0xc776('0x38')]=qs[_0xc776('0x39')](_0x188b8b[_0xc776('0x2f')][_0xc776('0x39')]);_0x59eb4f[_0xc776('0x3a')]=qs[_0xc776('0x30')](_[_0xc776('0x3b')](_0x188b8b['query'],_0x2fa975[_0xc776('0x30')]));if(_0x188b8b[_0xc776('0x2f')][_0xc776('0x3c')]){_0x59eb4f[_0xc776('0x3a')]=_[_0xc776('0x3d')](_0x59eb4f['where'],{'$or':_[_0xc776('0x29')](_0x1786d8,function(_0x1baf9e){if(_0x1baf9e[_0xc776('0x2d')]!==_0xc776('0x3e')){var _0x34fca8={};_0x34fca8[_0x1baf9e[_0xc776('0x27')]]={'$like':'%'+_0x188b8b[_0xc776('0x2f')][_0xc776('0x3c')]+'%'};return _0x34fca8;}})});}_0x59eb4f=_[_0xc776('0x3d')]({},_0x59eb4f,_0x188b8b[_0xc776('0x3f')]);var _0x153e22={'where':_0x59eb4f[_0xc776('0x3a')]};return db[_0xc776('0x2a')][_0xc776('0x1b')](_0x153e22)[_0xc776('0x23')](function(_0x27b4ae){_0x3be75b[_0xc776('0x1b')]=_0x27b4ae;if(_0x188b8b[_0xc776('0x2f')][_0xc776('0x40')]){_0x59eb4f[_0xc776('0x41')]=[{'all':!![]}];}return db[_0xc776('0x2a')]['findAll'](_0x59eb4f);})[_0xc776('0x23')](function(_0x433d60){_0x3be75b['rows']=_0x433d60;return _0x3be75b;})[_0xc776('0x23')](respondWithFilteredResult(_0x6c0cb5,_0x59eb4f))[_0xc776('0x42')](handleError(_0x6c0cb5,null));};exports['show']=function(_0x570eef,_0x59bd00){var _0x252e30={'raw':!![],'where':{'id':_0x570eef[_0xc776('0x43')]['id']}},_0x3cee6d={};_0x3cee6d[_0xc776('0x33')]=_[_0xc776('0x44')](db['FreshdeskField']['rawAttributes']);_0x3cee6d[_0xc776('0x2f')]=_[_0xc776('0x44')](_0x570eef['query']);_0x3cee6d[_0xc776('0x30')]=_[_0xc776('0x31')](_0x3cee6d['model'],_0x3cee6d[_0xc776('0x2f')]);_0x252e30['attributes']=_[_0xc776('0x31')](_0x3cee6d['model'],qs['fields'](_0x570eef[_0xc776('0x2f')][_0xc776('0x34')]));_0x252e30[_0xc776('0x32')]=_0x252e30[_0xc776('0x32')][_0xc776('0x35')]?_0x252e30['attributes']:_0x3cee6d['model'];if(_0x570eef['query'][_0xc776('0x40')]){_0x252e30[_0xc776('0x41')]=[{'all':!![]}];}_0x252e30=_[_0xc776('0x3d')]({},_0x252e30,_0x570eef[_0xc776('0x3f')]);return db[_0xc776('0x2a')][_0xc776('0x45')](_0x252e30)['then'](handleEntityNotFound(_0x59bd00,null))[_0xc776('0x23')](respondWithResult(_0x59bd00,null))[_0xc776('0x42')](handleError(_0x59bd00,null));};exports['create']=function(_0x144f0f,_0x2684bf){return db[_0xc776('0x2a')][_0xc776('0x46')](_0x144f0f['body'],{})[_0xc776('0x23')](respondWithResult(_0x2684bf,0xc9))['catch'](handleError(_0x2684bf,null));};exports['update']=function(_0x42c027,_0x49255b){if(_0x42c027[_0xc776('0x47')]['id']){delete _0x42c027[_0xc776('0x47')]['id'];}return db['FreshdeskField'][_0xc776('0x45')]({'where':{'id':_0x42c027['params']['id']}})['then'](handleEntityNotFound(_0x49255b,null))[_0xc776('0x23')](saveUpdates(_0x42c027[_0xc776('0x47')],null))[_0xc776('0x23')](respondWithResult(_0x49255b,null))['catch'](handleError(_0x49255b,null));};exports[_0xc776('0x24')]=function(_0x41b5ea,_0x4fce6c){return db[_0xc776('0x2a')][_0xc776('0x45')]({'where':{'id':_0x41b5ea[_0xc776('0x43')]['id']}})[_0xc776('0x23')](handleEntityNotFound(_0x4fce6c,null))[_0xc776('0x23')](removeEntity(_0x4fce6c,null))[_0xc776('0x42')](handleError(_0x4fce6c,null));}; \ No newline at end of file +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 diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index f26d3a4..602ec08 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 _0x6684=['./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields','idField','FieldId','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x6684,0xe6));var _0x4668=function(_0x152449,_0x49f41d){_0x152449=_0x152449-0x0;var _0x5b58b2=_0x6684[_0x152449];return _0x5b58b2;};'use strict';var _=require('lodash');var util=require(_0x4668('0x0'));var logger=require(_0x4668('0x1'))(_0x4668('0x2'));var moment=require('moment');var BPromise=require(_0x4668('0x3'));var rp=require(_0x4668('0x4'));var fs=require('fs');var path=require(_0x4668('0x5'));var rimraf=require(_0x4668('0x6'));var config=require(_0x4668('0x7'));var attributes=require(_0x4668('0x8'));module[_0x4668('0x9')]=function(_0x490d02,_0x488156){return _0x490d02['define'](_0x4668('0xa'),attributes,{'tableName':_0x4668('0xb'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x4668('0xc'),_0x4668('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 90f0020..dbaf82e 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(_0x472354,_0x4e9b1a){var _0x56ccdc=function(_0x1b48c0){while(--_0x1b48c0){_0x472354['push'](_0x472354['shift']());}};_0x56ccdc(++_0x4e9b1a);}(_0xb10b,0x12a));var _0xbb10=function(_0xf482c1,_0x32cbca){_0xf482c1=_0xf482c1-0x0;var _0x184548=_0xb10b[_0xf482c1];return _0x184548;};'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(_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 diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index f4fccc0..1a3c63b 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 _0x7928=['./intFreshsalesAccount.controller','get','index','/:id','show','isAuthenticated','getConfigurations','/:id/fields','create','post','addConfiguration','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x36bf88,_0x15c459){var _0x332914=function(_0x512adf){while(--_0x512adf){_0x36bf88['push'](_0x36bf88['shift']());}};_0x332914(++_0x15c459);}(_0x7928,0xa1));var _0x8792=function(_0x3fee84,_0x13f46d){_0x3fee84=_0x3fee84-0x0;var _0x4faac2=_0x7928[_0x3fee84];return _0x4faac2;};'use strict';var multer=require(_0x8792('0x0'));var util=require('util');var path=require(_0x8792('0x1'));var timeout=require(_0x8792('0x2'));var express=require(_0x8792('0x3'));var router=express[_0x8792('0x4')]();var auth=require(_0x8792('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8792('0x6'));var controller=require(_0x8792('0x7'));router[_0x8792('0x8')]('/',auth['isAuthenticated'](),controller[_0x8792('0x9')]);router[_0x8792('0x8')](_0x8792('0xa'),auth['isAuthenticated'](),controller[_0x8792('0xb')]);router['get']('/:id/configurations',auth[_0x8792('0xc')](),controller[_0x8792('0xd')]);router[_0x8792('0x8')](_0x8792('0xe'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0x8792('0xc')](),controller[_0x8792('0xf')]);router[_0x8792('0x10')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x8792('0x11')]);router['put'](_0x8792('0xa'),auth[_0x8792('0xc')](),controller['update']);router[_0x8792('0x12')](_0x8792('0xa'),auth[_0x8792('0xc')](),controller[_0x8792('0x13')]);module[_0x8792('0x14')]=router; \ No newline at end of file +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 diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index a4da9d8..871adcd 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 _0x49db=['remoteUri','sequelize','exports','STRING'];(function(_0x1b2023,_0x3f73ed){var _0x52f8cc=function(_0x45887a){while(--_0x45887a){_0x1b2023['push'](_0x1b2023['shift']());}};_0x52f8cc(++_0x3f73ed);}(_0x49db,0xc5));var _0xb49d=function(_0xc82c4a,_0x2de0a4){_0xc82c4a=_0xc82c4a-0x0;var _0xe122c0=_0x49db[_0xc82c4a];return _0xe122c0;};'use strict';var Sequelize=require(_0xb49d('0x0'));module[_0xb49d('0x1')]={'name':{'type':Sequelize[_0xb49d('0x2')]},'description':{'type':Sequelize[_0xb49d('0x2')]},'username':{'type':Sequelize[_0xb49d('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xb49d('0x2')]},'remoteUri':{'type':Sequelize[_0xb49d('0x2')],'unique':_0xb49d('0x3')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +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 diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 53f3bf8..85596fb 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 _0xf254=['VIRTUAL','filter','options','FreshsalesAccount','includeAll','findAll','rows','params','include','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','sort','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshsalesField','getFields','username','remoteUri','apiKey','slice','lastIndexOf','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','json','count','offset','set','apply','reject','save','update','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','where','pick','merge','type'];(function(_0x3130b5,_0x23faf7){var _0xa6d8a3=function(_0x175be7){while(--_0x175be7){_0x3130b5['push'](_0x3130b5['shift']());}};_0xa6d8a3(++_0x23faf7);}(_0xf254,0x1e6));var _0x4f25=function(_0x3b1e3f,_0xf8826b){_0x3b1e3f=_0x3b1e3f-0x0;var _0x3b1cd3=_0xf254[_0x3b1e3f];return _0x3b1cd3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4f25('0x0'));var rimraf=require(_0x4f25('0x1'));var zipdir=require(_0x4f25('0x2'));var jsonpatch=require(_0x4f25('0x3'));var rp=require(_0x4f25('0x4'));var moment=require('moment');var BPromise=require(_0x4f25('0x5'));var Mustache=require(_0x4f25('0x6'));var util=require(_0x4f25('0x7'));var path=require(_0x4f25('0x8'));var sox=require(_0x4f25('0x9'));var csv=require(_0x4f25('0xa'));var ejs=require(_0x4f25('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4f25('0xc'));var crypto=require(_0x4f25('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4f25('0xa'));var querystring=require('querystring');var Papa=require(_0x4f25('0xe'));var Redis=require(_0x4f25('0xf'));var authService=require(_0x4f25('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4f25('0x11'));var hardwareService=require(_0x4f25('0x12'));var logger=require(_0x4f25('0x13'))('api');var utils=require(_0x4f25('0x14'));var config=require('../../config/environment');var db=require(_0x4f25('0x15'))['db'];var integrations=require(_0x4f25('0x16'));var jayson=require(_0x4f25('0x17'));var client=jayson['client'][_0x4f25('0x18')]({'port':0x232a});function checkPasswordPattern(_0x33ef28,_0x2d38df,_0x4b2ede){if(_0x4b2ede){var _0x5ed904=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5ed904[_0x4f25('0x19')](_0x2d38df)){return _0x33ef28;}else{throw new db['Sequelize'][(_0x4f25('0x1a'))](_0x4f25('0x1b'));}}else{return _0x33ef28;}}function respondWithRpcPromise(_0x389691,_0x3ef410,_0x2a17ee,_0x512979){return new BPromise(function(_0x392602,_0x368215){var _0x3d6058=_0x512979||client;return _0x3d6058[_0x4f25('0x1c')](_0x389691,_0x2a17ee)[_0x4f25('0x1d')](function(_0x3bd7f5){logger[_0x4f25('0x1e')](_0x4f25('0x1f'),_0x3ef410,'request\x20sent');logger[_0x4f25('0x20')](_0x4f25('0x21'),_0x3ef410,_0x4f25('0x22'),JSON[_0x4f25('0x23')](_0x3bd7f5));if(_0x3bd7f5[_0x4f25('0x24')]){if(_0x3bd7f5[_0x4f25('0x24')][_0x4f25('0x25')]===0x1f4){logger['error'](_0x4f25('0x1f'),_0x3ef410,_0x3bd7f5['error']['message']);return _0x368215(_0x3bd7f5[_0x4f25('0x24')][_0x4f25('0x26')]);}logger[_0x4f25('0x24')](_0x4f25('0x1f'),_0x3ef410,_0x3bd7f5[_0x4f25('0x24')][_0x4f25('0x26')]);return _0x392602(_0x3bd7f5[_0x4f25('0x24')][_0x4f25('0x26')]);}else{logger[_0x4f25('0x1e')]('FreshsalesAccount,\x20%s,\x20%s',_0x3ef410,_0x4f25('0x22'));_0x392602(_0x3bd7f5['result']['message']);}})[_0x4f25('0x27')](function(_0x30314a){logger['error'](_0x4f25('0x1f'),_0x3ef410,_0x30314a);_0x368215(_0x30314a);});});}function respondWithStatusCode(_0x52c444,_0x2e7aff){_0x2e7aff=_0x2e7aff||0xcc;return function(_0x11724c){if(_0x11724c){return _0x52c444[_0x4f25('0x28')](_0x2e7aff);}return _0x52c444[_0x4f25('0x29')](_0x2e7aff)['end']();};}function respondWithResult(_0x4c2ad6,_0x2f764e){_0x2f764e=_0x2f764e||0xc8;return function(_0x33eab4){if(_0x33eab4){return _0x4c2ad6['status'](_0x2f764e)[_0x4f25('0x2a')](_0x33eab4);}};}function respondWithFilteredResult(_0x3f7a77,_0x2b28bd){return function(_0x192db8){if(_0x192db8){var _0xb996cb=_0x192db8[_0x4f25('0x2b')],_0x59c1e1=_0x2b28bd[_0x4f25('0x2c')],_0x518ec0=_0x2b28bd[_0x4f25('0x2c')]+_0x2b28bd['limit'],_0x10eea8;if(_0x518ec0>=_0xb996cb){_0x518ec0=_0xb996cb;_0x10eea8=0xc8;}else{_0x10eea8=0xce;}_0x3f7a77[_0x4f25('0x29')](_0x10eea8);return _0x3f7a77[_0x4f25('0x2d')]('Content-Range',_0x59c1e1+'-'+_0x518ec0+'/'+_0xb996cb)['json'](_0x192db8);}return null;};}function patchUpdates(_0x10e928){return function(_0x3ded3a){try{jsonpatch[_0x4f25('0x2e')](_0x3ded3a,_0x10e928,!![]);}catch(_0x11fcf6){return BPromise[_0x4f25('0x2f')](_0x11fcf6);}return _0x3ded3a[_0x4f25('0x30')]();};}function saveUpdates(_0x8dda5,_0x55b4d6){return function(_0x3b8fe5){if(_0x3b8fe5){return _0x3b8fe5[_0x4f25('0x31')](_0x8dda5)[_0x4f25('0x1d')](function(_0x154f3a){return _0x154f3a;});}return null;};}function removeEntity(_0x45d827,_0x31885c){return function(_0x6973e7){if(_0x6973e7){return _0x6973e7[_0x4f25('0x32')]()[_0x4f25('0x1d')](function(){_0x45d827[_0x4f25('0x29')](0xcc)[_0x4f25('0x33')]();});}};}function handleEntityNotFound(_0x2dd2bf,_0x487c58){return function(_0x2e276f){if(!_0x2e276f){_0x2dd2bf['sendStatus'](0x194);}return _0x2e276f;};}function handleError(_0x2f9fe7,_0x3454f9){_0x3454f9=_0x3454f9||0x1f4;return function(_0x56a108){logger[_0x4f25('0x24')](_0x56a108[_0x4f25('0x34')]);if(_0x56a108[_0x4f25('0x35')]){delete _0x56a108['name'];}_0x2f9fe7[_0x4f25('0x29')](_0x3454f9)[_0x4f25('0x36')](_0x56a108);};}exports[_0x4f25('0x37')]=function(_0x5a5ecc,_0x5e5918){var _0x5b8725={},_0xea3fa8={},_0x30e11d={'count':0x0,'rows':[]};var _0x44cb86=_[_0x4f25('0x38')](db['FreshsalesAccount'][_0x4f25('0x39')],function(_0x1b66d1){return{'name':_0x1b66d1[_0x4f25('0x3a')],'type':_0x1b66d1['type']['key']};});_0xea3fa8[_0x4f25('0x3b')]=_['map'](_0x44cb86,_0x4f25('0x35'));_0xea3fa8[_0x4f25('0x3c')]=_[_0x4f25('0x3d')](_0x5a5ecc[_0x4f25('0x3c')]);_0xea3fa8[_0x4f25('0x3e')]=_[_0x4f25('0x3f')](_0xea3fa8[_0x4f25('0x3b')],_0xea3fa8[_0x4f25('0x3c')]);_0x5b8725[_0x4f25('0x40')]=_[_0x4f25('0x3f')](_0xea3fa8['model'],qs[_0x4f25('0x41')](_0x5a5ecc[_0x4f25('0x3c')][_0x4f25('0x41')]));_0x5b8725[_0x4f25('0x40')]=_0x5b8725[_0x4f25('0x40')][_0x4f25('0x42')]?_0x5b8725['attributes']:_0xea3fa8['model'];if(!_0x5a5ecc[_0x4f25('0x3c')]['hasOwnProperty'](_0x4f25('0x43'))){_0x5b8725[_0x4f25('0x44')]=qs['limit'](_0x5a5ecc['query'][_0x4f25('0x44')]);_0x5b8725[_0x4f25('0x2c')]=qs['offset'](_0x5a5ecc['query'][_0x4f25('0x2c')]);}_0x5b8725[_0x4f25('0x45')]=qs['sort'](_0x5a5ecc[_0x4f25('0x3c')]['sort']);_0x5b8725[_0x4f25('0x46')]=qs[_0x4f25('0x3e')](_[_0x4f25('0x47')](_0x5a5ecc['query'],_0xea3fa8['filters']));if(_0x5a5ecc[_0x4f25('0x3c')]['filter']){_0x5b8725[_0x4f25('0x46')]=_[_0x4f25('0x48')](_0x5b8725['where'],{'$or':_[_0x4f25('0x38')](_0x44cb86,function(_0x57cf19){if(_0x57cf19[_0x4f25('0x49')]!==_0x4f25('0x4a')){var _0x364470={};_0x364470[_0x57cf19['name']]={'$like':'%'+_0x5a5ecc[_0x4f25('0x3c')][_0x4f25('0x4b')]+'%'};return _0x364470;}})});}_0x5b8725=_[_0x4f25('0x48')]({},_0x5b8725,_0x5a5ecc[_0x4f25('0x4c')]);var _0x141df8={'where':_0x5b8725[_0x4f25('0x46')]};return db[_0x4f25('0x4d')][_0x4f25('0x2b')](_0x141df8)[_0x4f25('0x1d')](function(_0x1972ba){_0x30e11d[_0x4f25('0x2b')]=_0x1972ba;if(_0x5a5ecc[_0x4f25('0x3c')][_0x4f25('0x4e')]){_0x5b8725['include']=[{'all':!![]}];}return db[_0x4f25('0x4d')][_0x4f25('0x4f')](_0x5b8725);})['then'](function(_0x2e331c){_0x30e11d[_0x4f25('0x50')]=_0x2e331c;return _0x30e11d;})[_0x4f25('0x1d')](respondWithFilteredResult(_0x5e5918,_0x5b8725))[_0x4f25('0x27')](handleError(_0x5e5918,null));};exports['show']=function(_0x5230ea,_0x26af48){var _0x44799c={'raw':![],'where':{'id':_0x5230ea[_0x4f25('0x51')]['id']}},_0x5eee68={};_0x5eee68['model']=_[_0x4f25('0x3d')](db[_0x4f25('0x4d')]['rawAttributes']);_0x5eee68[_0x4f25('0x3c')]=_[_0x4f25('0x3d')](_0x5230ea['query']);_0x5eee68[_0x4f25('0x3e')]=_[_0x4f25('0x3f')](_0x5eee68['model'],_0x5eee68[_0x4f25('0x3c')]);_0x44799c['attributes']=_[_0x4f25('0x3f')](_0x5eee68[_0x4f25('0x3b')],qs[_0x4f25('0x41')](_0x5230ea[_0x4f25('0x3c')]['fields']));_0x44799c[_0x4f25('0x40')]=_0x44799c[_0x4f25('0x40')][_0x4f25('0x42')]?_0x44799c[_0x4f25('0x40')]:_0x5eee68[_0x4f25('0x3b')];if(_0x5230ea['query'][_0x4f25('0x4e')]){_0x44799c[_0x4f25('0x52')]=[{'all':!![]}];}_0x44799c=_['merge']({},_0x44799c,_0x5230ea[_0x4f25('0x4c')]);return db[_0x4f25('0x4d')][_0x4f25('0x53')](_0x44799c)['then'](handleEntityNotFound(_0x26af48,null))[_0x4f25('0x1d')](respondWithResult(_0x26af48,null))[_0x4f25('0x27')](handleError(_0x26af48,null));};exports[_0x4f25('0x54')]=function(_0x491a24,_0x160c88){return db['FreshsalesAccount'][_0x4f25('0x54')](_0x491a24[_0x4f25('0x55')],{})[_0x4f25('0x1d')](respondWithResult(_0x160c88,0xc9))[_0x4f25('0x27')](handleError(_0x160c88,null));};exports['update']=function(_0x28102e,_0x6ebe5c){if(_0x28102e['body']['id']){delete _0x28102e[_0x4f25('0x55')]['id'];}return db[_0x4f25('0x4d')][_0x4f25('0x53')]({'where':{'id':_0x28102e[_0x4f25('0x51')]['id']}})['then'](handleEntityNotFound(_0x6ebe5c,null))[_0x4f25('0x1d')](saveUpdates(_0x28102e[_0x4f25('0x55')],null))[_0x4f25('0x1d')](respondWithResult(_0x6ebe5c,null))['catch'](handleError(_0x6ebe5c,null));};exports[_0x4f25('0x32')]=function(_0x788ecc,_0xc1d7a8){return db[_0x4f25('0x4d')][_0x4f25('0x53')]({'where':{'id':_0x788ecc[_0x4f25('0x51')]['id']}})[_0x4f25('0x1d')](handleEntityNotFound(_0xc1d7a8,null))['then'](removeEntity(_0xc1d7a8,null))[_0x4f25('0x27')](handleError(_0xc1d7a8,null));};exports[_0x4f25('0x56')]=function(_0x4b353f,_0x51ba1f,_0x5c35f8){var _0x38d8ca={};var _0x451e8e={};var _0x5c6ba5;var _0x3aa8a1;return db[_0x4f25('0x4d')][_0x4f25('0x57')]({'where':{'id':_0x4b353f[_0x4f25('0x51')]['id']}})[_0x4f25('0x1d')](handleEntityNotFound(_0x51ba1f,null))[_0x4f25('0x1d')](function(_0x590a28){if(_0x590a28){_0x5c6ba5=_0x590a28;_0x451e8e[_0x4f25('0x3b')]=_[_0x4f25('0x3d')](db[_0x4f25('0x58')]['rawAttributes']);_0x451e8e[_0x4f25('0x3c')]=_[_0x4f25('0x3d')](_0x4b353f[_0x4f25('0x3c')]);_0x451e8e[_0x4f25('0x3e')]=_[_0x4f25('0x3f')](_0x451e8e['model'],_0x451e8e['query']);_0x38d8ca[_0x4f25('0x40')]=_[_0x4f25('0x3f')](_0x451e8e[_0x4f25('0x3b')],qs[_0x4f25('0x41')](_0x4b353f[_0x4f25('0x3c')][_0x4f25('0x41')]));_0x38d8ca[_0x4f25('0x40')]=_0x38d8ca[_0x4f25('0x40')][_0x4f25('0x42')]?_0x38d8ca['attributes']:_0x451e8e[_0x4f25('0x3b')];_0x38d8ca[_0x4f25('0x45')]=qs[_0x4f25('0x59')](_0x4b353f[_0x4f25('0x3c')][_0x4f25('0x59')]);_0x38d8ca['where']=qs[_0x4f25('0x3e')](_[_0x4f25('0x47')](_0x4b353f[_0x4f25('0x3c')],_0x451e8e['filters']));if(_0x4b353f[_0x4f25('0x3c')]['filter']){_0x38d8ca[_0x4f25('0x46')]=_['merge'](_0x38d8ca[_0x4f25('0x46')],{'$or':_[_0x4f25('0x38')](_0x38d8ca['attributes'],function(_0x5c3f8a){var _0x2e6650={};_0x2e6650[_0x5c3f8a]={'$like':'%'+_0x4b353f[_0x4f25('0x3c')][_0x4f25('0x4b')]+'%'};return _0x2e6650;})});}_0x38d8ca=_['merge']({},_0x38d8ca,_0x4b353f[_0x4f25('0x4c')]);return _0x5c6ba5['getConfigurations'](_0x38d8ca);}})['then'](function(_0x4bfba8){if(_0x4bfba8){_0x3aa8a1=_0x4bfba8['length'];if(!_0x4b353f[_0x4f25('0x3c')]['hasOwnProperty'](_0x4f25('0x43'))){_0x38d8ca[_0x4f25('0x44')]=qs[_0x4f25('0x44')](_0x4b353f['query'][_0x4f25('0x44')]);_0x38d8ca[_0x4f25('0x2c')]=qs[_0x4f25('0x2c')](_0x4b353f[_0x4f25('0x3c')][_0x4f25('0x2c')]);}return _0x5c6ba5[_0x4f25('0x56')](_0x38d8ca);}})[_0x4f25('0x1d')](function(_0x17a8ed){if(_0x17a8ed){return _0x17a8ed?{'count':_0x3aa8a1,'rows':_0x17a8ed}:null;}})[_0x4f25('0x1d')](respondWithResult(_0x51ba1f,null))['catch'](handleError(_0x51ba1f,null));};exports[_0x4f25('0x5a')]=function(_0x512b71,_0x2367b9,_0x2a0390){if(_0x512b71[_0x4f25('0x55')]['id']){delete _0x512b71[_0x4f25('0x55')]['id'];}return db[_0x4f25('0x4d')][_0x4f25('0x57')]({'where':{'id':_0x512b71[_0x4f25('0x51')]['id']}})[_0x4f25('0x1d')](handleEntityNotFound(_0x2367b9,null))[_0x4f25('0x1d')](function(_0x4744d9){if(_0x4744d9){_0x512b71[_0x4f25('0x55')][_0x4f25('0x5b')]=_0x4744d9['id'];_0x512b71[_0x4f25('0x55')][_0x4f25('0x5c')]=integrations[_0x4f25('0x5d')](_0x512b71[_0x4f25('0x55')]['channel'],_0x512b71[_0x4f25('0x55')][_0x4f25('0x49')]);_0x512b71[_0x4f25('0x55')][_0x4f25('0x5e')]=integrations[_0x4f25('0x5f')](_0x512b71[_0x4f25('0x55')][_0x4f25('0x60')],_0x512b71['body'][_0x4f25('0x49')]);return db[_0x4f25('0x58')][_0x4f25('0x54')](_0x512b71['body'],{'include':[{'model':db[_0x4f25('0x61')],'as':'Subjects'},{'model':db[_0x4f25('0x61')],'as':_0x4f25('0x5e')}]});}return null;})[_0x4f25('0x1d')](respondWithResult(_0x2367b9,null))['catch'](handleError(_0x2367b9,null));};exports[_0x4f25('0x62')]=function(_0x15e38b,_0x225d3f,_0x1b8296){var _0x35f234='';var _0x2b468b='';return db[_0x4f25('0x4d')][_0x4f25('0x57')]({'where':{'id':_0x15e38b[_0x4f25('0x51')]['id']},'attributes':['id',_0x4f25('0x63'),_0x4f25('0x64'),_0x4f25('0x65')]})[_0x4f25('0x1d')](handleEntityNotFound(_0x225d3f,null))[_0x4f25('0x1d')](function(_0x32da9d){if(_0x32da9d){_0x2b468b=_0x32da9d['username'];_0x35f234=_0x32da9d[_0x4f25('0x64')];var _0x33cde0=_0x32da9d[_0x4f25('0x64')][_0x4f25('0x66')](-0x1);if(_0x33cde0==='/'){_0x35f234=_0x35f234['substring'](0x0,_0x35f234[_0x4f25('0x67')](_0x33cde0));}return rp({'method':'GET','uri':util[_0x4f25('0x68')](_0x4f25('0x69'),_0x35f234,_0x4f25('0x6a')),'headers':{'Authorization':_0x4f25('0x6b')+_0x32da9d['apiKey']},'json':!![]});}})['then'](function(_0x4f1458){if(_0x4f1458){var _0x4f497a=_0x4f1458[_0x4f25('0x6c')];var _0x582334=![];var _0xafc2a4=null;for(_0xafc2a4=0x0;_0xafc2a4<_0x4f497a['length'];_0xafc2a4++){if(_0x4f497a[_0xafc2a4][_0x4f25('0x6d')]===_0x2b468b){_0x582334=!![];}}if(_0x582334){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x4f25('0x6e')});}}})['then'](respondWithResult(_0x225d3f,null))['catch'](function(_0x2c189e){var _0xcb1988=_0x15e38b[_0x4f25('0x3c')][_0x4f25('0x19')]?0x1f4:_0x2c189e[_0x4f25('0x6f')]||0x1f4;logger[_0x4f25('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0x4f25('0x62'),_0xcb1988,JSON[_0x4f25('0x23')](_0x2c189e));delete _0x2c189e['name'];if(_0xcb1988===0x191){_0xcb1988=0x190;}_0x225d3f[_0x4f25('0x29')](_0xcb1988)[_0x4f25('0x36')](_0x15e38b[_0x4f25('0x3c')][_0x4f25('0x19')]?{'message':'Wrong\x20credentials','statusCode':_0x2c189e[_0x4f25('0x6f')]}:_0x2c189e);});}; \ No newline at end of file +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 diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 7490321..2a5017a 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 _0xb08b=['FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x2bd0dd,_0x167fb0){var _0x4637bb=function(_0x1bf601){while(--_0x1bf601){_0x2bd0dd['push'](_0x2bd0dd['shift']());}};_0x4637bb(++_0x167fb0);}(_0xb08b,0x116));var _0xbb08=function(_0x1ea0b4,_0x1b3d5e){_0x1ea0b4=_0x1ea0b4-0x0;var _0x383281=_0xb08b[_0x1ea0b4];return _0x383281;};'use strict';var _=require(_0xbb08('0x0'));var util=require(_0xbb08('0x1'));var logger=require(_0xbb08('0x2'))('api');var moment=require(_0xbb08('0x3'));var BPromise=require(_0xbb08('0x4'));var rp=require(_0xbb08('0x5'));var fs=require('fs');var path=require(_0xbb08('0x6'));var rimraf=require('rimraf');var config=require(_0xbb08('0x7'));var attributes=require(_0xbb08('0x8'));var integrations=require(_0xbb08('0x9'));module['exports']=function(_0x15adf0,_0x13cac0){return _0x15adf0['define'](_0xbb08('0xa'),attributes,{'tableName':_0xbb08('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 892a105..dc05d95 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 _0xa5d7=['info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','include','attributes','map','model','ShowFreshsalesAccount','find','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise','client','http','then'];(function(_0x413b4d,_0xa3459c){var _0x8b810a=function(_0x22d441){while(--_0x22d441){_0x413b4d['push'](_0x413b4d['shift']());}};_0x8b810a(++_0xa3459c);}(_0xa5d7,0x1c3));var _0x7a5d=function(_0x5e5d99,_0xbd1656){_0x5e5d99=_0x5e5d99-0x0;var _0x1b568e=_0xa5d7[_0x5e5d99];return _0x1b568e;};'use strict';var _=require(_0x7a5d('0x0'));var util=require(_0x7a5d('0x1'));var moment=require(_0x7a5d('0x2'));var BPromise=require(_0x7a5d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a5d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a5d('0x5'));var logger=require('../../config/logger')(_0x7a5d('0x6'));var config=require('../../config/environment');var jayson=require(_0x7a5d('0x7'));var client=jayson[_0x7a5d('0x8')][_0x7a5d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4cb015,_0x2092de,_0xc34a6a){return new BPromise(function(_0x5e6442,_0x33aeaa){return client['request'](_0x4cb015,_0xc34a6a)[_0x7a5d('0xa')](function(_0x1057e5){logger[_0x7a5d('0xb')]('FreshsalesAccount,\x20%s,\x20%s',_0x2092de,_0x7a5d('0xc'));logger[_0x7a5d('0xd')](_0x7a5d('0xe'),_0x2092de,_0x7a5d('0xc'),JSON[_0x7a5d('0xf')](_0x1057e5));if(_0x1057e5[_0x7a5d('0x10')]){if(_0x1057e5[_0x7a5d('0x10')][_0x7a5d('0x11')]===0x1f4){logger[_0x7a5d('0x10')](_0x7a5d('0x12'),_0x2092de,_0x1057e5[_0x7a5d('0x10')][_0x7a5d('0x13')]);return _0x33aeaa(_0x1057e5['error']['message']);}logger[_0x7a5d('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x2092de,_0x1057e5[_0x7a5d('0x10')][_0x7a5d('0x13')]);return _0x5e6442(_0x1057e5[_0x7a5d('0x10')][_0x7a5d('0x13')]);}else{logger[_0x7a5d('0xb')](_0x7a5d('0x12'),_0x2092de,'request\x20sent');_0x5e6442(_0x1057e5[_0x7a5d('0x14')][_0x7a5d('0x13')]);}})[_0x7a5d('0x15')](function(_0xc57403){logger[_0x7a5d('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x2092de,_0xc57403);_0x33aeaa(_0xc57403);});});}exports[_0x7a5d('0x16')]=function(_0x3488e9){var _0x4af635=this;return new Promise(function(_0x4ea1b5,_0x1e710c){return db[_0x7a5d('0x17')]['findAll']({'raw':_0x3488e9[_0x7a5d('0x18')]?_0x3488e9['options'][_0x7a5d('0x19')]===undefined?!![]:![]:!![],'where':_0x3488e9['options']?_0x3488e9[_0x7a5d('0x18')][_0x7a5d('0x1a')]||null:null,'attributes':_0x3488e9['options']?_0x3488e9[_0x7a5d('0x18')]['attributes']||null:null,'limit':_0x3488e9[_0x7a5d('0x18')]?_0x3488e9['options']['limit']||null:null,'include':_0x3488e9[_0x7a5d('0x18')]?_0x3488e9[_0x7a5d('0x18')][_0x7a5d('0x1b')]?_['map'](_0x3488e9[_0x7a5d('0x18')][_0x7a5d('0x1b')],function(_0x1bd069){return{'model':db[_0x1bd069['model']],'as':_0x1bd069['as'],'attributes':_0x1bd069[_0x7a5d('0x1c')],'include':_0x1bd069['include']?_[_0x7a5d('0x1d')](_0x1bd069[_0x7a5d('0x1b')],function(_0xcf8578){return{'model':db[_0xcf8578[_0x7a5d('0x1e')]],'as':_0xcf8578['as'],'attributes':_0xcf8578[_0x7a5d('0x1c')],'include':_0xcf8578[_0x7a5d('0x1b')]?_['map'](_0xcf8578[_0x7a5d('0x1b')],function(_0x6900dc){return{'model':db[_0x6900dc['model']],'as':_0x6900dc['as'],'attributes':_0x6900dc[_0x7a5d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7a5d('0xa')](function(_0x2b1f0b){logger[_0x7a5d('0xb')]('GetFreshsalesAccount',_0x3488e9);logger[_0x7a5d('0xd')](_0x7a5d('0x16'),_0x3488e9,JSON[_0x7a5d('0xf')](_0x2b1f0b));_0x4ea1b5(_0x2b1f0b);})[_0x7a5d('0x15')](function(_0x3975){logger[_0x7a5d('0x10')](_0x7a5d('0x16'),_0x3975[_0x7a5d('0x13')],_0x3488e9);_0x1e710c(_0x4af635['error'](0x1f4,_0x3975[_0x7a5d('0x13')]));});});};exports[_0x7a5d('0x1f')]=function(_0x263f61){var _0x1be64c=this;return new Promise(function(_0x46d2d7,_0xbeb99c){return db[_0x7a5d('0x17')][_0x7a5d('0x20')]({'raw':_0x263f61[_0x7a5d('0x18')]?_0x263f61[_0x7a5d('0x18')][_0x7a5d('0x19')]===undefined?!![]:![]:!![],'where':_0x263f61[_0x7a5d('0x18')]?_0x263f61[_0x7a5d('0x18')][_0x7a5d('0x1a')]||null:null,'attributes':_0x263f61['options']?_0x263f61[_0x7a5d('0x18')]['attributes']||null:null,'include':_0x263f61[_0x7a5d('0x18')]?_0x263f61[_0x7a5d('0x18')][_0x7a5d('0x1b')]?_['map'](_0x263f61[_0x7a5d('0x18')][_0x7a5d('0x1b')],function(_0x358bba){return{'model':db[_0x358bba[_0x7a5d('0x1e')]],'as':_0x358bba['as'],'attributes':_0x358bba['attributes'],'include':_0x358bba[_0x7a5d('0x1b')]?_[_0x7a5d('0x1d')](_0x358bba[_0x7a5d('0x1b')],function(_0x2cbfe3){return{'model':db[_0x2cbfe3[_0x7a5d('0x1e')]],'as':_0x2cbfe3['as'],'attributes':_0x2cbfe3[_0x7a5d('0x1c')],'include':_0x2cbfe3['include']?_[_0x7a5d('0x1d')](_0x2cbfe3[_0x7a5d('0x1b')],function(_0x2cb7a5){return{'model':db[_0x2cb7a5['model']],'as':_0x2cb7a5['as'],'attributes':_0x2cb7a5[_0x7a5d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7a5d('0xa')](function(_0x2a0204){logger[_0x7a5d('0xb')](_0x7a5d('0x1f'),_0x263f61);logger[_0x7a5d('0xd')](_0x7a5d('0x1f'),_0x263f61,JSON[_0x7a5d('0xf')](_0x2a0204));_0x46d2d7(_0x2a0204);})[_0x7a5d('0x15')](function(_0x30704a){logger[_0x7a5d('0x10')](_0x7a5d('0x1f'),_0x30704a[_0x7a5d('0x13')],_0x263f61);_0xbeb99c(_0x1be64c[_0x7a5d('0x10')](0x1f4,_0x30704a['message']));});});}; \ No newline at end of file +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 diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 6ee7bb7..093e7b2 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 _0x531c=['update','delete','/:id','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','index','get','/:id/subjects','getSubjects','/:id/descriptions','/:id/fields','getFields','post','create','put'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x531c,0x1d1));var _0xc531=function(_0x229be5,_0x9156f6){_0x229be5=_0x229be5-0x0;var _0x326189=_0x531c[_0x229be5];return _0x326189;};'use strict';var multer=require('multer');var util=require(_0xc531('0x0'));var path=require(_0xc531('0x1'));var timeout=require(_0xc531('0x2'));var express=require('express');var router=express[_0xc531('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xc531('0x4'));var config=require(_0xc531('0x5'));var controller=require(_0xc531('0x6'));router['get']('/',auth[_0xc531('0x7')](),controller[_0xc531('0x8')]);router[_0xc531('0x9')]('/:id',auth[_0xc531('0x7')](),controller['show']);router[_0xc531('0x9')](_0xc531('0xa'),auth[_0xc531('0x7')](),controller[_0xc531('0xb')]);router['get'](_0xc531('0xc'),auth[_0xc531('0x7')](),controller['getDescriptions']);router[_0xc531('0x9')](_0xc531('0xd'),auth['isAuthenticated'](),controller[_0xc531('0xe')]);router[_0xc531('0xf')]('/',auth[_0xc531('0x7')](),controller[_0xc531('0x10')]);router[_0xc531('0x11')]('/:id',auth[_0xc531('0x7')](),controller[_0xc531('0x12')]);router[_0xc531('0x13')](_0xc531('0x14'),auth['isAuthenticated'](),controller[_0xc531('0x15')]);module[_0xc531('0x16')]=router; \ No newline at end of file +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 diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index b2e0378..1e07876 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 _0xda32=['exports','STRING','sequelize'];(function(_0x55d7c2,_0x4ce6fb){var _0x1755ef=function(_0xddc25c){while(--_0xddc25c){_0x55d7c2['push'](_0x55d7c2['shift']());}};_0x1755ef(++_0x4ce6fb);}(_0xda32,0xb3));var _0x2da3=function(_0x4aeaf1,_0x1d065b){_0x4aeaf1=_0x4aeaf1-0x0;var _0x21134a=_0xda32[_0x4aeaf1];return _0x21134a;};'use strict';var Sequelize=require(_0x2da3('0x0'));module[_0x2da3('0x1')]={'name':{'type':Sequelize[_0x2da3('0x2')]},'description':{'type':Sequelize[_0x2da3('0x2')]}}; \ No newline at end of file +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 diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index ae8c4ae..9a40983 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 _0xf8b2=['info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','offset','set','Content-Range','reject','save','update','destroy','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','type','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','keys','options','find','create','body','params','getSubjects','findOne','FreshsalesField','getDescriptions','getFields','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','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then'];(function(_0x5df8dd,_0x4200e8){var _0x29ff65=function(_0x592f00){while(--_0x592f00){_0x5df8dd['push'](_0x5df8dd['shift']());}};_0x29ff65(++_0x4200e8);}(_0xf8b2,0x15e));var _0x2f8b=function(_0x1dc32f,_0x2aeadd){_0x1dc32f=_0x1dc32f-0x0;var _0x5de378=_0xf8b2[_0x1dc32f];return _0x5de378;};'use strict';var pdf=require(_0x2f8b('0x0'));var emlformat=require(_0x2f8b('0x1'));var rimraf=require(_0x2f8b('0x2'));var zipdir=require(_0x2f8b('0x3'));var jsonpatch=require(_0x2f8b('0x4'));var rp=require(_0x2f8b('0x5'));var moment=require(_0x2f8b('0x6'));var BPromise=require(_0x2f8b('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2f8b('0x8'));var sox=require(_0x2f8b('0x9'));var csv=require(_0x2f8b('0xa'));var ejs=require(_0x2f8b('0xb'));var fs=require('fs');var _=require(_0x2f8b('0xc'));var squel=require(_0x2f8b('0xd'));var crypto=require(_0x2f8b('0xe'));var jsforce=require(_0x2f8b('0xf'));var deskjs=require(_0x2f8b('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2f8b('0x11'));var Papa=require(_0x2f8b('0x12'));var Redis=require(_0x2f8b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x2f8b('0x14'));var as=require(_0x2f8b('0x15'));var hardwareService=require(_0x2f8b('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x2f8b('0x17'));var config=require(_0x2f8b('0x18'));var db=require(_0x2f8b('0x19'))['db'];var jayson=require(_0x2f8b('0x1a'));var client=jayson[_0x2f8b('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x16d5a2,_0x4d75d1,_0x40c097){if(_0x40c097){var _0x5e9eb1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5e9eb1[_0x2f8b('0x1c')](_0x4d75d1)){return _0x16d5a2;}else{throw new db[(_0x2f8b('0x1d'))][(_0x2f8b('0x1e'))](_0x2f8b('0x1f'));}}else{return _0x16d5a2;}}function respondWithRpcPromise(_0xd7dbcd,_0x2b6003,_0x532fe4,_0x14a248){return new BPromise(function(_0xdec711,_0x2daba9){var _0xcc7e2c=_0x14a248||client;return _0xcc7e2c[_0x2f8b('0x20')](_0xd7dbcd,_0x532fe4)[_0x2f8b('0x21')](function(_0x3d65ee){logger[_0x2f8b('0x22')](_0x2f8b('0x23'),_0x2b6003,'request\x20sent');logger[_0x2f8b('0x24')](_0x2f8b('0x25'),_0x2b6003,_0x2f8b('0x26'),JSON['stringify'](_0x3d65ee));if(_0x3d65ee[_0x2f8b('0x27')]){if(_0x3d65ee['error'][_0x2f8b('0x28')]===0x1f4){logger[_0x2f8b('0x27')](_0x2f8b('0x23'),_0x2b6003,_0x3d65ee[_0x2f8b('0x27')][_0x2f8b('0x29')]);return _0x2daba9(_0x3d65ee['error'][_0x2f8b('0x29')]);}logger[_0x2f8b('0x27')](_0x2f8b('0x23'),_0x2b6003,_0x3d65ee[_0x2f8b('0x27')][_0x2f8b('0x29')]);return _0xdec711(_0x3d65ee[_0x2f8b('0x27')][_0x2f8b('0x29')]);}else{logger['info'](_0x2f8b('0x23'),_0x2b6003,_0x2f8b('0x26'));_0xdec711(_0x3d65ee[_0x2f8b('0x2a')][_0x2f8b('0x29')]);}})[_0x2f8b('0x2b')](function(_0x52edde){logger[_0x2f8b('0x27')](_0x2f8b('0x23'),_0x2b6003,_0x52edde);_0x2daba9(_0x52edde);});});}function respondWithStatusCode(_0x152492,_0x46a95a){_0x46a95a=_0x46a95a||0xcc;return function(_0x183e51){if(_0x183e51){return _0x152492[_0x2f8b('0x2c')](_0x46a95a);}return _0x152492[_0x2f8b('0x2d')](_0x46a95a)[_0x2f8b('0x2e')]();};}function respondWithResult(_0x4145b3,_0x5642a2){_0x5642a2=_0x5642a2||0xc8;return function(_0x1578c2){if(_0x1578c2){return _0x4145b3['status'](_0x5642a2)[_0x2f8b('0x2f')](_0x1578c2);}};}function respondWithFilteredResult(_0x2308fc,_0x16dab9){return function(_0x38f179){if(_0x38f179){var _0x72b23b=_0x38f179['count'],_0x4adacd=_0x16dab9[_0x2f8b('0x30')],_0x2cfbea=_0x16dab9[_0x2f8b('0x30')]+_0x16dab9['limit'],_0x5cc78c;if(_0x2cfbea>=_0x72b23b){_0x2cfbea=_0x72b23b;_0x5cc78c=0xc8;}else{_0x5cc78c=0xce;}_0x2308fc[_0x2f8b('0x2d')](_0x5cc78c);return _0x2308fc[_0x2f8b('0x31')](_0x2f8b('0x32'),_0x4adacd+'-'+_0x2cfbea+'/'+_0x72b23b)[_0x2f8b('0x2f')](_0x38f179);}return null;};}function patchUpdates(_0x1fe3d0){return function(_0x3fea08){try{jsonpatch['apply'](_0x3fea08,_0x1fe3d0,!![]);}catch(_0x3ed342){return BPromise[_0x2f8b('0x33')](_0x3ed342);}return _0x3fea08[_0x2f8b('0x34')]();};}function saveUpdates(_0x3279dc,_0x1f886f){return function(_0x278edc){if(_0x278edc){return _0x278edc[_0x2f8b('0x35')](_0x3279dc)['then'](function(_0x2e5510){return _0x2e5510;});}return null;};}function removeEntity(_0x5593b0,_0x24dec6){return function(_0x3ded5a){if(_0x3ded5a){return _0x3ded5a[_0x2f8b('0x36')]()[_0x2f8b('0x21')](function(){_0x5593b0[_0x2f8b('0x2d')](0xcc)[_0x2f8b('0x2e')]();});}};}function handleEntityNotFound(_0x407c2f,_0x2e9786){return function(_0x2a27d3){if(!_0x2a27d3){_0x407c2f['sendStatus'](0x194);}return _0x2a27d3;};}function handleError(_0x5d3343,_0x404f48){_0x404f48=_0x404f48||0x1f4;return function(_0x171104){logger[_0x2f8b('0x27')](_0x171104[_0x2f8b('0x37')]);if(_0x171104['name']){delete _0x171104[_0x2f8b('0x38')];}_0x5d3343[_0x2f8b('0x2d')](_0x404f48)[_0x2f8b('0x39')](_0x171104);};}exports[_0x2f8b('0x3a')]=function(_0x23a53d,_0x523419){var _0x56c05c={},_0x179952={},_0x25c805={'count':0x0,'rows':[]};var _0x14f8f0=_[_0x2f8b('0x3b')](db[_0x2f8b('0x3c')][_0x2f8b('0x3d')],function(_0x2c554d){return{'name':_0x2c554d['fieldName'],'type':_0x2c554d[_0x2f8b('0x3e')][_0x2f8b('0x3f')]};});_0x179952['model']=_[_0x2f8b('0x3b')](_0x14f8f0,_0x2f8b('0x38'));_0x179952[_0x2f8b('0x40')]=_['keys'](_0x23a53d[_0x2f8b('0x40')]);_0x179952[_0x2f8b('0x41')]=_['intersection'](_0x179952[_0x2f8b('0x42')],_0x179952[_0x2f8b('0x40')]);_0x56c05c['attributes']=_[_0x2f8b('0x43')](_0x179952['model'],qs[_0x2f8b('0x44')](_0x23a53d[_0x2f8b('0x40')]['fields']));_0x56c05c[_0x2f8b('0x45')]=_0x56c05c[_0x2f8b('0x45')][_0x2f8b('0x46')]?_0x56c05c['attributes']:_0x179952[_0x2f8b('0x42')];if(!_0x23a53d['query'][_0x2f8b('0x47')](_0x2f8b('0x48'))){_0x56c05c[_0x2f8b('0x49')]=qs[_0x2f8b('0x49')](_0x23a53d[_0x2f8b('0x40')][_0x2f8b('0x49')]);_0x56c05c[_0x2f8b('0x30')]=qs[_0x2f8b('0x30')](_0x23a53d[_0x2f8b('0x40')][_0x2f8b('0x30')]);}_0x56c05c[_0x2f8b('0x4a')]=qs[_0x2f8b('0x4b')](_0x23a53d[_0x2f8b('0x40')][_0x2f8b('0x4b')]);_0x56c05c[_0x2f8b('0x4c')]=qs[_0x2f8b('0x41')](_[_0x2f8b('0x4d')](_0x23a53d[_0x2f8b('0x40')],_0x179952[_0x2f8b('0x41')]));if(_0x23a53d[_0x2f8b('0x40')][_0x2f8b('0x4e')]){_0x56c05c[_0x2f8b('0x4c')]=_[_0x2f8b('0x4f')](_0x56c05c[_0x2f8b('0x4c')],{'$or':_[_0x2f8b('0x3b')](_0x14f8f0,function(_0x564b81){if(_0x564b81['type']!=='VIRTUAL'){var _0x33a468={};_0x33a468[_0x564b81['name']]={'$like':'%'+_0x23a53d[_0x2f8b('0x40')][_0x2f8b('0x4e')]+'%'};return _0x33a468;}})});}_0x56c05c=_[_0x2f8b('0x4f')]({},_0x56c05c,_0x23a53d['options']);var _0x98b96={'where':_0x56c05c['where']};return db[_0x2f8b('0x3c')]['count'](_0x98b96)[_0x2f8b('0x21')](function(_0xb7ec3f){_0x25c805['count']=_0xb7ec3f;if(_0x23a53d[_0x2f8b('0x40')][_0x2f8b('0x50')]){_0x56c05c[_0x2f8b('0x51')]=[{'all':!![]}];}return db[_0x2f8b('0x3c')][_0x2f8b('0x52')](_0x56c05c);})[_0x2f8b('0x21')](function(_0xd9b1d1){_0x25c805[_0x2f8b('0x53')]=_0xd9b1d1;return _0x25c805;})[_0x2f8b('0x21')](respondWithFilteredResult(_0x523419,_0x56c05c))['catch'](handleError(_0x523419,null));};exports[_0x2f8b('0x54')]=function(_0x1fe33d,_0x2d79f9){var _0x1bb257={'raw':![],'where':{'id':_0x1fe33d['params']['id']}},_0x14e50e={};_0x14e50e[_0x2f8b('0x42')]=_[_0x2f8b('0x55')](db[_0x2f8b('0x3c')]['rawAttributes']);_0x14e50e[_0x2f8b('0x40')]=_['keys'](_0x1fe33d[_0x2f8b('0x40')]);_0x14e50e[_0x2f8b('0x41')]=_[_0x2f8b('0x43')](_0x14e50e[_0x2f8b('0x42')],_0x14e50e[_0x2f8b('0x40')]);_0x1bb257['attributes']=_['intersection'](_0x14e50e['model'],qs[_0x2f8b('0x44')](_0x1fe33d[_0x2f8b('0x40')][_0x2f8b('0x44')]));_0x1bb257[_0x2f8b('0x45')]=_0x1bb257['attributes']['length']?_0x1bb257[_0x2f8b('0x45')]:_0x14e50e[_0x2f8b('0x42')];if(_0x1fe33d[_0x2f8b('0x40')][_0x2f8b('0x50')]){_0x1bb257['include']=[{'all':!![]}];}_0x1bb257=_[_0x2f8b('0x4f')]({},_0x1bb257,_0x1fe33d[_0x2f8b('0x56')]);return db['FreshsalesConfiguration'][_0x2f8b('0x57')](_0x1bb257)['then'](handleEntityNotFound(_0x2d79f9,null))[_0x2f8b('0x21')](respondWithResult(_0x2d79f9,null))['catch'](handleError(_0x2d79f9,null));};exports[_0x2f8b('0x58')]=function(_0x1684db,_0x3036d6){return db['FreshsalesConfiguration'][_0x2f8b('0x58')](_0x1684db['body'],{})[_0x2f8b('0x21')](respondWithResult(_0x3036d6,0xc9))['catch'](handleError(_0x3036d6,null));};exports[_0x2f8b('0x35')]=function(_0x142037,_0x21fcfe){if(_0x142037[_0x2f8b('0x59')]['id']){delete _0x142037[_0x2f8b('0x59')]['id'];}return db[_0x2f8b('0x3c')][_0x2f8b('0x57')]({'where':{'id':_0x142037[_0x2f8b('0x5a')]['id']}})['then'](handleEntityNotFound(_0x21fcfe,null))[_0x2f8b('0x21')](saveUpdates(_0x142037[_0x2f8b('0x59')],null))[_0x2f8b('0x21')](respondWithResult(_0x21fcfe,null))[_0x2f8b('0x2b')](handleError(_0x21fcfe,null));};exports[_0x2f8b('0x36')]=function(_0xdd8791,_0x1dd7da){return db[_0x2f8b('0x3c')][_0x2f8b('0x57')]({'where':{'id':_0xdd8791[_0x2f8b('0x5a')]['id']}})[_0x2f8b('0x21')](handleEntityNotFound(_0x1dd7da,null))[_0x2f8b('0x21')](removeEntity(_0x1dd7da,null))['catch'](handleError(_0x1dd7da,null));};exports[_0x2f8b('0x5b')]=function(_0x52abb8,_0x2873fc,_0x390793){var _0x3673ea={};var _0x28d34a={};var _0x15774b;var _0x51accb;return db[_0x2f8b('0x3c')][_0x2f8b('0x5c')]({'where':{'id':_0x52abb8[_0x2f8b('0x5a')]['id']}})[_0x2f8b('0x21')](handleEntityNotFound(_0x2873fc,null))['then'](function(_0x5dc9c6){if(_0x5dc9c6){_0x15774b=_0x5dc9c6;_0x28d34a[_0x2f8b('0x42')]=_[_0x2f8b('0x55')](db[_0x2f8b('0x5d')][_0x2f8b('0x3d')]);_0x28d34a['query']=_[_0x2f8b('0x55')](_0x52abb8[_0x2f8b('0x40')]);_0x28d34a['filters']=_['intersection'](_0x28d34a['model'],_0x28d34a[_0x2f8b('0x40')]);_0x3673ea['attributes']=_[_0x2f8b('0x43')](_0x28d34a[_0x2f8b('0x42')],qs[_0x2f8b('0x44')](_0x52abb8[_0x2f8b('0x40')][_0x2f8b('0x44')]));_0x3673ea[_0x2f8b('0x45')]=_0x3673ea[_0x2f8b('0x45')][_0x2f8b('0x46')]?_0x3673ea['attributes']:_0x28d34a['model'];_0x3673ea[_0x2f8b('0x4a')]=qs[_0x2f8b('0x4b')](_0x52abb8[_0x2f8b('0x40')][_0x2f8b('0x4b')]);_0x3673ea[_0x2f8b('0x4c')]=qs[_0x2f8b('0x41')](_[_0x2f8b('0x4d')](_0x52abb8[_0x2f8b('0x40')],_0x28d34a[_0x2f8b('0x41')]));if(_0x52abb8[_0x2f8b('0x40')]['filter']){_0x3673ea[_0x2f8b('0x4c')]=_[_0x2f8b('0x4f')](_0x3673ea[_0x2f8b('0x4c')],{'$or':_[_0x2f8b('0x3b')](_0x3673ea[_0x2f8b('0x45')],function(_0x4bd392){var _0x1dc724={};_0x1dc724[_0x4bd392]={'$like':'%'+_0x52abb8[_0x2f8b('0x40')]['filter']+'%'};return _0x1dc724;})});}_0x3673ea=_[_0x2f8b('0x4f')]({},_0x3673ea,_0x52abb8['options']);return _0x15774b['getSubjects'](_0x3673ea);}})[_0x2f8b('0x21')](function(_0x37ffde){if(_0x37ffde){_0x51accb=_0x37ffde[_0x2f8b('0x46')];if(!_0x52abb8['query'][_0x2f8b('0x47')]('nolimit')){_0x3673ea[_0x2f8b('0x49')]=qs[_0x2f8b('0x49')](_0x52abb8[_0x2f8b('0x40')]['limit']);_0x3673ea[_0x2f8b('0x30')]=qs['offset'](_0x52abb8[_0x2f8b('0x40')][_0x2f8b('0x30')]);}return _0x15774b['getSubjects'](_0x3673ea);}})[_0x2f8b('0x21')](function(_0x2292d8){if(_0x2292d8){return _0x2292d8?{'count':_0x51accb,'rows':_0x2292d8}:null;}})[_0x2f8b('0x21')](respondWithResult(_0x2873fc,null))['catch'](handleError(_0x2873fc,null));};exports[_0x2f8b('0x5e')]=function(_0x3c61d2,_0x174b21,_0x17c7e5){var _0x53f254={};var _0x1966fb={};var _0x385e90;var _0x4b5bf0;return db[_0x2f8b('0x3c')]['findOne']({'where':{'id':_0x3c61d2[_0x2f8b('0x5a')]['id']}})[_0x2f8b('0x21')](handleEntityNotFound(_0x174b21,null))['then'](function(_0x5873b0){if(_0x5873b0){_0x385e90=_0x5873b0;_0x1966fb['model']=_[_0x2f8b('0x55')](db[_0x2f8b('0x5d')]['rawAttributes']);_0x1966fb['query']=_['keys'](_0x3c61d2['query']);_0x1966fb['filters']=_['intersection'](_0x1966fb[_0x2f8b('0x42')],_0x1966fb[_0x2f8b('0x40')]);_0x53f254[_0x2f8b('0x45')]=_[_0x2f8b('0x43')](_0x1966fb[_0x2f8b('0x42')],qs['fields'](_0x3c61d2['query'][_0x2f8b('0x44')]));_0x53f254[_0x2f8b('0x45')]=_0x53f254[_0x2f8b('0x45')]['length']?_0x53f254['attributes']:_0x1966fb['model'];_0x53f254[_0x2f8b('0x4a')]=qs[_0x2f8b('0x4b')](_0x3c61d2[_0x2f8b('0x40')]['sort']);_0x53f254[_0x2f8b('0x4c')]=qs[_0x2f8b('0x41')](_[_0x2f8b('0x4d')](_0x3c61d2[_0x2f8b('0x40')],_0x1966fb[_0x2f8b('0x41')]));if(_0x3c61d2[_0x2f8b('0x40')]['filter']){_0x53f254[_0x2f8b('0x4c')]=_[_0x2f8b('0x4f')](_0x53f254['where'],{'$or':_[_0x2f8b('0x3b')](_0x53f254[_0x2f8b('0x45')],function(_0x2d3d69){var _0x1567f9={};_0x1567f9[_0x2d3d69]={'$like':'%'+_0x3c61d2[_0x2f8b('0x40')][_0x2f8b('0x4e')]+'%'};return _0x1567f9;})});}_0x53f254=_[_0x2f8b('0x4f')]({},_0x53f254,_0x3c61d2[_0x2f8b('0x56')]);return _0x385e90['getDescriptions'](_0x53f254);}})[_0x2f8b('0x21')](function(_0x5cf060){if(_0x5cf060){_0x4b5bf0=_0x5cf060[_0x2f8b('0x46')];if(!_0x3c61d2[_0x2f8b('0x40')]['hasOwnProperty'](_0x2f8b('0x48'))){_0x53f254['limit']=qs[_0x2f8b('0x49')](_0x3c61d2[_0x2f8b('0x40')][_0x2f8b('0x49')]);_0x53f254[_0x2f8b('0x30')]=qs['offset'](_0x3c61d2[_0x2f8b('0x40')]['offset']);}return _0x385e90['getDescriptions'](_0x53f254);}})[_0x2f8b('0x21')](function(_0x3bf354){if(_0x3bf354){return _0x3bf354?{'count':_0x4b5bf0,'rows':_0x3bf354}:null;}})[_0x2f8b('0x21')](respondWithResult(_0x174b21,null))[_0x2f8b('0x2b')](handleError(_0x174b21,null));};exports[_0x2f8b('0x5f')]=function(_0x13d92f,_0x1d947d,_0x1be1f5){var _0x4cf7fd={};var _0x37d762={};var _0x2d718f;var _0x43a7ad;return db[_0x2f8b('0x3c')][_0x2f8b('0x5c')]({'where':{'id':_0x13d92f[_0x2f8b('0x5a')]['id']}})[_0x2f8b('0x21')](handleEntityNotFound(_0x1d947d,null))['then'](function(_0x292198){if(_0x292198){_0x2d718f=_0x292198;_0x37d762['model']=_[_0x2f8b('0x55')](db[_0x2f8b('0x5d')]['rawAttributes']);_0x37d762[_0x2f8b('0x40')]=_[_0x2f8b('0x55')](_0x13d92f[_0x2f8b('0x40')]);_0x37d762[_0x2f8b('0x41')]=_[_0x2f8b('0x43')](_0x37d762[_0x2f8b('0x42')],_0x37d762['query']);_0x4cf7fd[_0x2f8b('0x45')]=_['intersection'](_0x37d762[_0x2f8b('0x42')],qs['fields'](_0x13d92f['query'][_0x2f8b('0x44')]));_0x4cf7fd[_0x2f8b('0x45')]=_0x4cf7fd[_0x2f8b('0x45')][_0x2f8b('0x46')]?_0x4cf7fd[_0x2f8b('0x45')]:_0x37d762[_0x2f8b('0x42')];_0x4cf7fd[_0x2f8b('0x4a')]=qs[_0x2f8b('0x4b')](_0x13d92f[_0x2f8b('0x40')][_0x2f8b('0x4b')]);_0x4cf7fd[_0x2f8b('0x4c')]=qs[_0x2f8b('0x41')](_[_0x2f8b('0x4d')](_0x13d92f[_0x2f8b('0x40')],_0x37d762[_0x2f8b('0x41')]));if(_0x13d92f['query'][_0x2f8b('0x4e')]){_0x4cf7fd['where']=_[_0x2f8b('0x4f')](_0x4cf7fd['where'],{'$or':_[_0x2f8b('0x3b')](_0x4cf7fd[_0x2f8b('0x45')],function(_0x4eb5af){var _0x450ec5={};_0x450ec5[_0x4eb5af]={'$like':'%'+_0x13d92f[_0x2f8b('0x40')][_0x2f8b('0x4e')]+'%'};return _0x450ec5;})});}_0x4cf7fd=_[_0x2f8b('0x4f')]({},_0x4cf7fd,_0x13d92f[_0x2f8b('0x56')]);return _0x2d718f[_0x2f8b('0x5f')](_0x4cf7fd);}})[_0x2f8b('0x21')](function(_0x3403c3){if(_0x3403c3){_0x43a7ad=_0x3403c3[_0x2f8b('0x46')];if(!_0x13d92f[_0x2f8b('0x40')][_0x2f8b('0x47')]('nolimit')){_0x4cf7fd[_0x2f8b('0x49')]=qs[_0x2f8b('0x49')](_0x13d92f[_0x2f8b('0x40')]['limit']);_0x4cf7fd[_0x2f8b('0x30')]=qs[_0x2f8b('0x30')](_0x13d92f[_0x2f8b('0x40')][_0x2f8b('0x30')]);}return _0x2d718f[_0x2f8b('0x5f')](_0x4cf7fd);}})[_0x2f8b('0x21')](function(_0x84eae6){if(_0x84eae6){return _0x84eae6?{'count':_0x43a7ad,'rows':_0x84eae6}:null;}})[_0x2f8b('0x21')](respondWithResult(_0x1d947d,null))['catch'](handleError(_0x1d947d,null));}; \ No newline at end of file +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 diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index d75821d..759756a 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 _0xeec3=['./intFreshsalesConfiguration.attributes','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','path','rimraf'];(function(_0x55be3f,_0x30ee09){var _0x48693a=function(_0x465897){while(--_0x465897){_0x55be3f['push'](_0x55be3f['shift']());}};_0x48693a(++_0x30ee09);}(_0xeec3,0x1c3));var _0x3eec=function(_0x43b3f5,_0xda46e8){_0x43b3f5=_0x43b3f5-0x0;var _0x50abbe=_0xeec3[_0x43b3f5];return _0x50abbe;};'use strict';var _=require(_0x3eec('0x0'));var util=require(_0x3eec('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3eec('0x2'));var rimraf=require(_0x3eec('0x3'));var config=require('../../config/environment');var attributes=require(_0x3eec('0x4'));module['exports']=function(_0x410721,_0x115be5){return _0x410721['define'](_0x3eec('0x5'),attributes,{'tableName':_0x3eec('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 89f4b07..e370bd6 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 _0x544a=['request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x544a,0x118));var _0xa544=function(_0x57aa71,_0x182a6b){_0x57aa71=_0x57aa71-0x0;var _0xa03199=_0x544a[_0x57aa71];return _0xa03199;};'use strict';var _=require(_0xa544('0x0'));var util=require(_0xa544('0x1'));var moment=require(_0xa544('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa544('0x3'));var db=require(_0xa544('0x4'))['db'];var utils=require(_0xa544('0x5'));var logger=require(_0xa544('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa544('0x7')][_0xa544('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x9609d4,_0x5bfa0f,_0x196f1e){return new BPromise(function(_0x13ce7a,_0x35abfd){return client['request'](_0x9609d4,_0x196f1e)[_0xa544('0x9')](function(_0x3066dd){logger[_0xa544('0xa')](_0xa544('0xb'),_0x5bfa0f,'request\x20sent');logger[_0xa544('0xc')](_0xa544('0xd'),_0x5bfa0f,_0xa544('0xe'),JSON[_0xa544('0xf')](_0x3066dd));if(_0x3066dd[_0xa544('0x10')]){if(_0x3066dd['error'][_0xa544('0x11')]===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x5bfa0f,_0x3066dd['error'][_0xa544('0x12')]);return _0x35abfd(_0x3066dd[_0xa544('0x10')]['message']);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x5bfa0f,_0x3066dd[_0xa544('0x10')][_0xa544('0x12')]);return _0x13ce7a(_0x3066dd[_0xa544('0x10')]['message']);}else{logger[_0xa544('0xa')](_0xa544('0xb'),_0x5bfa0f,_0xa544('0xe'));_0x13ce7a(_0x3066dd[_0xa544('0x13')][_0xa544('0x12')]);}})[_0xa544('0x14')](function(_0x56c112){logger[_0xa544('0x10')](_0xa544('0xb'),_0x5bfa0f,_0x56c112);_0x35abfd(_0x56c112);});});} \ No newline at end of file +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 diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 3035fc9..577f4e8 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 _0x677e=['../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','connect-timeout','Router','../../components/auth/service'];(function(_0x584159,_0x41ba47){var _0x29b3e3=function(_0xd5835){while(--_0xd5835){_0x584159['push'](_0x584159['shift']());}};_0x29b3e3(++_0x41ba47);}(_0x677e,0x1a1));var _0xe677=function(_0x3f78b0,_0x3e102f){_0x3f78b0=_0x3f78b0-0x0;var _0x226432=_0x677e[_0x3f78b0];return _0x226432;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe677('0x0'));var express=require('express');var router=express[_0xe677('0x1')]();var auth=require(_0xe677('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xe677('0x3'));var controller=require(_0xe677('0x4'));router[_0xe677('0x5')]('/',auth[_0xe677('0x6')](),controller[_0xe677('0x7')]);router[_0xe677('0x5')](_0xe677('0x8'),auth[_0xe677('0x6')](),controller[_0xe677('0x9')]);router[_0xe677('0xa')]('/',auth[_0xe677('0x6')](),controller[_0xe677('0xb')]);router[_0xe677('0xc')](_0xe677('0x8'),auth[_0xe677('0x6')](),controller['update']);router[_0xe677('0xd')](_0xe677('0x8'),auth[_0xe677('0x6')](),controller[_0xe677('0xe')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index ffc55f4..77b4811 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 _0x1c4d=['ENUM','string','customVariable','keyValue','STRING','variable','BOOLEAN','exports'];(function(_0x2bc5cc,_0x1bbb3e){var _0x1da473=function(_0x29454e){while(--_0x29454e){_0x2bc5cc['push'](_0x2bc5cc['shift']());}};_0x1da473(++_0x1bbb3e);}(_0x1c4d,0x1d7));var _0xd1c4=function(_0x2dd090,_0x308103){_0x2dd090=_0x2dd090-0x0;var _0x40c9e4=_0x1c4d[_0x2dd090];return _0x40c9e4;};'use strict';var Sequelize=require('sequelize');module[_0xd1c4('0x0')]={'type':{'type':Sequelize[_0xd1c4('0x1')](_0xd1c4('0x2'),'variable',_0xd1c4('0x3'),_0xd1c4('0x4')),'defaultValue':_0xd1c4('0x2')},'content':{'type':Sequelize[_0xd1c4('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd1c4('0x1')]('string',_0xd1c4('0x6'),_0xd1c4('0x3'))},'keyContent':{'type':Sequelize[_0xd1c4('0x5')]},'idField':{'type':Sequelize[_0xd1c4('0x5')]},'nameField':{'type':Sequelize[_0xd1c4('0x5')]},'customField':{'type':Sequelize[_0xd1c4('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +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 diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index adaaf33..c5eac53 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 _0x55ea=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','keys','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','FreshsalesField','count','include','findAll','rows','catch','show','params','includeAll','create','body','find','destroy','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x18d5d7,_0x19074b){var _0x30a9ea=function(_0x514f3f){while(--_0x514f3f){_0x18d5d7['push'](_0x18d5d7['shift']());}};_0x30a9ea(++_0x19074b);}(_0x55ea,0xc9));var _0xa55e=function(_0x5b79d6,_0x4de9ca){_0x5b79d6=_0x5b79d6-0x0;var _0x31b30d=_0x55ea[_0x5b79d6];return _0x31b30d;};'use strict';var pdf=require(_0xa55e('0x0'));var emlformat=require(_0xa55e('0x1'));var rimraf=require(_0xa55e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa55e('0x3'));var rp=require(_0xa55e('0x4'));var moment=require(_0xa55e('0x5'));var BPromise=require(_0xa55e('0x6'));var Mustache=require(_0xa55e('0x7'));var util=require('util');var path=require(_0xa55e('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa55e('0x9'));var crypto=require(_0xa55e('0xa'));var jsforce=require(_0xa55e('0xb'));var deskjs=require(_0xa55e('0xc'));var toCsv=require(_0xa55e('0xd'));var querystring=require(_0xa55e('0xe'));var Papa=require(_0xa55e('0xf'));var Redis=require(_0xa55e('0x10'));var authService=require(_0xa55e('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa55e('0x12'));var logger=require(_0xa55e('0x13'))(_0xa55e('0x14'));var utils=require(_0xa55e('0x15'));var config=require(_0xa55e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c1ca3,_0x5b69cc){_0x5b69cc=_0x5b69cc||0xcc;return function(_0x3f5178){if(_0x3f5178){return _0x1c1ca3[_0xa55e('0x17')](_0x5b69cc);}return _0x1c1ca3[_0xa55e('0x18')](_0x5b69cc)[_0xa55e('0x19')]();};}function respondWithResult(_0x2fcf44,_0x20e138){_0x20e138=_0x20e138||0xc8;return function(_0x15a283){if(_0x15a283){return _0x2fcf44[_0xa55e('0x18')](_0x20e138)[_0xa55e('0x1a')](_0x15a283);}};}function respondWithFilteredResult(_0x5e3c56,_0x1fcee6){return function(_0x30738d){if(_0x30738d){var _0x25fa30=_0x30738d['count'],_0x12895e=_0x1fcee6[_0xa55e('0x1b')],_0x303698=_0x1fcee6['offset']+_0x1fcee6['limit'],_0x339f1e;if(_0x303698>=_0x25fa30){_0x303698=_0x25fa30;_0x339f1e=0xc8;}else{_0x339f1e=0xce;}_0x5e3c56[_0xa55e('0x18')](_0x339f1e);return _0x5e3c56[_0xa55e('0x1c')](_0xa55e('0x1d'),_0x12895e+'-'+_0x303698+'/'+_0x25fa30)[_0xa55e('0x1a')](_0x30738d);}return null;};}function patchUpdates(_0x3980b4){return function(_0x4ffe3a){try{jsonpatch[_0xa55e('0x1e')](_0x4ffe3a,_0x3980b4,!![]);}catch(_0x4a1ecb){return BPromise['reject'](_0x4a1ecb);}return _0x4ffe3a[_0xa55e('0x1f')]();};}function saveUpdates(_0x1bd874,_0x262f6c){return function(_0x1033c0){if(_0x1033c0){return _0x1033c0[_0xa55e('0x20')](_0x1bd874)[_0xa55e('0x21')](function(_0x475dde){return _0x475dde;});}return null;};}function removeEntity(_0x267adb,_0x9594a3){return function(_0x5b0e74){if(_0x5b0e74){return _0x5b0e74['destroy']()[_0xa55e('0x21')](function(){_0x267adb['status'](0xcc)[_0xa55e('0x19')]();});}};}function handleEntityNotFound(_0x31c4ac,_0x801fec){return function(_0x2842a6){if(!_0x2842a6){_0x31c4ac[_0xa55e('0x17')](0x194);}return _0x2842a6;};}function handleError(_0x1d2727,_0x129762){_0x129762=_0x129762||0x1f4;return function(_0x2f360b){logger[_0xa55e('0x22')](_0x2f360b[_0xa55e('0x23')]);if(_0x2f360b[_0xa55e('0x24')]){delete _0x2f360b[_0xa55e('0x24')];}_0x1d2727[_0xa55e('0x18')](_0x129762)[_0xa55e('0x25')](_0x2f360b);};}exports[_0xa55e('0x26')]=function(_0x50738b,_0x2f2579){var _0xa1917c={},_0x875010={},_0x4eebcc={'count':0x0,'rows':[]};var _0x5c218d=_[_0xa55e('0x27')](db['FreshsalesField'][_0xa55e('0x28')],function(_0x58fc30){return{'name':_0x58fc30[_0xa55e('0x29')],'type':_0x58fc30['type'][_0xa55e('0x2a')]};});_0x875010['model']=_[_0xa55e('0x27')](_0x5c218d,_0xa55e('0x24'));_0x875010['query']=_[_0xa55e('0x2b')](_0x50738b[_0xa55e('0x2c')]);_0x875010[_0xa55e('0x2d')]=_[_0xa55e('0x2e')](_0x875010['model'],_0x875010[_0xa55e('0x2c')]);_0xa1917c[_0xa55e('0x2f')]=_['intersection'](_0x875010[_0xa55e('0x30')],qs[_0xa55e('0x31')](_0x50738b[_0xa55e('0x2c')][_0xa55e('0x31')]));_0xa1917c['attributes']=_0xa1917c[_0xa55e('0x2f')]['length']?_0xa1917c[_0xa55e('0x2f')]:_0x875010['model'];if(!_0x50738b[_0xa55e('0x2c')][_0xa55e('0x32')](_0xa55e('0x33'))){_0xa1917c[_0xa55e('0x34')]=qs['limit'](_0x50738b[_0xa55e('0x2c')]['limit']);_0xa1917c[_0xa55e('0x1b')]=qs[_0xa55e('0x1b')](_0x50738b[_0xa55e('0x2c')]['offset']);}_0xa1917c[_0xa55e('0x35')]=qs[_0xa55e('0x36')](_0x50738b[_0xa55e('0x2c')][_0xa55e('0x36')]);_0xa1917c[_0xa55e('0x37')]=qs[_0xa55e('0x2d')](_['pick'](_0x50738b['query'],_0x875010[_0xa55e('0x2d')]));if(_0x50738b[_0xa55e('0x2c')][_0xa55e('0x38')]){_0xa1917c[_0xa55e('0x37')]=_[_0xa55e('0x39')](_0xa1917c[_0xa55e('0x37')],{'$or':_[_0xa55e('0x27')](_0x5c218d,function(_0x596a5d){if(_0x596a5d['type']!==_0xa55e('0x3a')){var _0x2aeb26={};_0x2aeb26[_0x596a5d[_0xa55e('0x24')]]={'$like':'%'+_0x50738b[_0xa55e('0x2c')][_0xa55e('0x38')]+'%'};return _0x2aeb26;}})});}_0xa1917c=_[_0xa55e('0x39')]({},_0xa1917c,_0x50738b[_0xa55e('0x3b')]);var _0x368e71={'where':_0xa1917c[_0xa55e('0x37')]};return db[_0xa55e('0x3c')][_0xa55e('0x3d')](_0x368e71)['then'](function(_0x1da8a9){_0x4eebcc[_0xa55e('0x3d')]=_0x1da8a9;if(_0x50738b[_0xa55e('0x2c')]['includeAll']){_0xa1917c[_0xa55e('0x3e')]=[{'all':!![]}];}return db['FreshsalesField'][_0xa55e('0x3f')](_0xa1917c);})[_0xa55e('0x21')](function(_0x1f1129){_0x4eebcc[_0xa55e('0x40')]=_0x1f1129;return _0x4eebcc;})[_0xa55e('0x21')](respondWithFilteredResult(_0x2f2579,_0xa1917c))[_0xa55e('0x41')](handleError(_0x2f2579,null));};exports[_0xa55e('0x42')]=function(_0x5443ef,_0x5c0985){var _0x3d9fe9={'raw':!![],'where':{'id':_0x5443ef[_0xa55e('0x43')]['id']}},_0x1bfc79={};_0x1bfc79['model']=_[_0xa55e('0x2b')](db[_0xa55e('0x3c')][_0xa55e('0x28')]);_0x1bfc79[_0xa55e('0x2c')]=_[_0xa55e('0x2b')](_0x5443ef[_0xa55e('0x2c')]);_0x1bfc79[_0xa55e('0x2d')]=_[_0xa55e('0x2e')](_0x1bfc79['model'],_0x1bfc79['query']);_0x3d9fe9[_0xa55e('0x2f')]=_[_0xa55e('0x2e')](_0x1bfc79[_0xa55e('0x30')],qs[_0xa55e('0x31')](_0x5443ef[_0xa55e('0x2c')][_0xa55e('0x31')]));_0x3d9fe9[_0xa55e('0x2f')]=_0x3d9fe9[_0xa55e('0x2f')]['length']?_0x3d9fe9['attributes']:_0x1bfc79[_0xa55e('0x30')];if(_0x5443ef['query'][_0xa55e('0x44')]){_0x3d9fe9['include']=[{'all':!![]}];}_0x3d9fe9=_['merge']({},_0x3d9fe9,_0x5443ef[_0xa55e('0x3b')]);return db[_0xa55e('0x3c')]['find'](_0x3d9fe9)['then'](handleEntityNotFound(_0x5c0985,null))[_0xa55e('0x21')](respondWithResult(_0x5c0985,null))[_0xa55e('0x41')](handleError(_0x5c0985,null));};exports[_0xa55e('0x45')]=function(_0x365ad0,_0x45b981){return db[_0xa55e('0x3c')]['create'](_0x365ad0['body'],{})[_0xa55e('0x21')](respondWithResult(_0x45b981,0xc9))[_0xa55e('0x41')](handleError(_0x45b981,null));};exports[_0xa55e('0x20')]=function(_0x259cb3,_0x10ba01){if(_0x259cb3[_0xa55e('0x46')]['id']){delete _0x259cb3['body']['id'];}return db[_0xa55e('0x3c')][_0xa55e('0x47')]({'where':{'id':_0x259cb3[_0xa55e('0x43')]['id']}})[_0xa55e('0x21')](handleEntityNotFound(_0x10ba01,null))[_0xa55e('0x21')](saveUpdates(_0x259cb3[_0xa55e('0x46')],null))['then'](respondWithResult(_0x10ba01,null))['catch'](handleError(_0x10ba01,null));};exports[_0xa55e('0x48')]=function(_0x52f526,_0x2f51d9){return db['FreshsalesField'][_0xa55e('0x47')]({'where':{'id':_0x52f526[_0xa55e('0x43')]['id']}})[_0xa55e('0x21')](handleEntityNotFound(_0x2f51d9,null))[_0xa55e('0x21')](removeEntity(_0x2f51d9,null))[_0xa55e('0x41')](handleError(_0x2f51d9,null));}; \ No newline at end of file +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 diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 6362036..f725cd7 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 _0x3c46=['request-promise','path','rimraf','../../config/environment','exports','define','FreshsalesField','FieldId','../../config/logger','api','bluebird'];(function(_0x3ddb22,_0x489f55){var _0x469a39=function(_0xdc4d16){while(--_0xdc4d16){_0x3ddb22['push'](_0x3ddb22['shift']());}};_0x469a39(++_0x489f55);}(_0x3c46,0x6b));var _0x63c4=function(_0x24942f,_0x475eee){_0x24942f=_0x24942f-0x0;var _0x1f0d95=_0x3c46[_0x24942f];return _0x1f0d95;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x63c4('0x0'))(_0x63c4('0x1'));var moment=require('moment');var BPromise=require(_0x63c4('0x2'));var rp=require(_0x63c4('0x3'));var fs=require('fs');var path=require(_0x63c4('0x4'));var rimraf=require(_0x63c4('0x5'));var config=require(_0x63c4('0x6'));var attributes=require('./intFreshsalesField.attributes');module[_0x63c4('0x7')]=function(_0xa6802,_0xdef793){return _0xa6802[_0x63c4('0x8')](_0x63c4('0x9'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':['idField',_0x63c4('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 3ba6531..2f29850 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 _0x3d99=['FreshsalesField,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x1d4449,_0x495153){var _0x4dcde3=function(_0x36d549){while(--_0x36d549){_0x1d4449['push'](_0x1d4449['shift']());}};_0x4dcde3(++_0x495153);}(_0x3d99,0x64));var _0x93d9=function(_0x89a6f5,_0x4171ff){_0x89a6f5=_0x89a6f5-0x0;var _0x5c32f0=_0x3d99[_0x89a6f5];return _0x5c32f0;};'use strict';var _=require('lodash');var util=require(_0x93d9('0x0'));var moment=require(_0x93d9('0x1'));var BPromise=require(_0x93d9('0x2'));var rs=require(_0x93d9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x93d9('0x4'))['db'];var utils=require(_0x93d9('0x5'));var logger=require(_0x93d9('0x6'))('rpc');var config=require(_0x93d9('0x7'));var jayson=require(_0x93d9('0x8'));var client=jayson[_0x93d9('0x9')][_0x93d9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x174476,_0x574809,_0x450443){return new BPromise(function(_0xe10679,_0xc53e5){return client[_0x93d9('0xb')](_0x174476,_0x450443)[_0x93d9('0xc')](function(_0x8ccc62){logger[_0x93d9('0xd')]('FreshsalesField,\x20%s,\x20%s',_0x574809,'request\x20sent');logger[_0x93d9('0xe')](_0x93d9('0xf'),_0x574809,_0x93d9('0x10'),JSON[_0x93d9('0x11')](_0x8ccc62));if(_0x8ccc62[_0x93d9('0x12')]){if(_0x8ccc62[_0x93d9('0x12')][_0x93d9('0x13')]===0x1f4){logger[_0x93d9('0x12')](_0x93d9('0x14'),_0x574809,_0x8ccc62[_0x93d9('0x12')]['message']);return _0xc53e5(_0x8ccc62[_0x93d9('0x12')][_0x93d9('0x15')]);}logger[_0x93d9('0x12')](_0x93d9('0x14'),_0x574809,_0x8ccc62[_0x93d9('0x12')][_0x93d9('0x15')]);return _0xe10679(_0x8ccc62[_0x93d9('0x12')][_0x93d9('0x15')]);}else{logger[_0x93d9('0xd')](_0x93d9('0x14'),_0x574809,'request\x20sent');_0xe10679(_0x8ccc62[_0x93d9('0x16')][_0x93d9('0x15')]);}})[_0x93d9('0x17')](function(_0x40253c){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x574809,_0x40253c);_0xc53e5(_0x40253c);});});} \ No newline at end of file +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 diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 04a0a3e..3a06537 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 _0x93da=['/:id/configurations','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','/:id/fields','post','create'];(function(_0x57163b,_0x41db5f){var _0x13c1ea=function(_0x8a7f7){while(--_0x8a7f7){_0x57163b['push'](_0x57163b['shift']());}};_0x13c1ea(++_0x41db5f);}(_0x93da,0x92));var _0xa93d=function(_0x5d24df,_0x44b3db){_0x5d24df=_0x5d24df-0x0;var _0x386f69=_0x93da[_0x5d24df];return _0x386f69;};'use strict';var multer=require(_0xa93d('0x0'));var util=require('util');var path=require(_0xa93d('0x1'));var timeout=require(_0xa93d('0x2'));var express=require(_0xa93d('0x3'));var router=express[_0xa93d('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa93d('0x5'));router[_0xa93d('0x6')]('/',auth[_0xa93d('0x7')](),controller[_0xa93d('0x8')]);router[_0xa93d('0x6')](_0xa93d('0x9'),auth[_0xa93d('0x7')](),controller[_0xa93d('0xa')]);router[_0xa93d('0x6')]('/:id/configurations',auth[_0xa93d('0x7')](),controller['getConfigurations']);router[_0xa93d('0x6')](_0xa93d('0xb'),auth[_0xa93d('0x7')](),controller['getFields']);router[_0xa93d('0xc')]('/',auth[_0xa93d('0x7')](),controller[_0xa93d('0xd')]);router[_0xa93d('0xc')](_0xa93d('0xe'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xa93d('0xf')]('/:id',auth[_0xa93d('0x7')](),controller[_0xa93d('0x10')]);router[_0xa93d('0x11')](_0xa93d('0x9'),auth[_0xa93d('0x7')](),controller[_0xa93d('0x12')]);module[_0xa93d('0x13')]=router; \ No newline at end of file +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 diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 373cb3e..f15caa4 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 _0x5fab=['username','ENUM','integrationTab','sequelize','exports','STRING'];(function(_0x394bf3,_0x32d759){var _0xfdac01=function(_0x306511){while(--_0x306511){_0x394bf3['push'](_0x394bf3['shift']());}};_0xfdac01(++_0x32d759);}(_0x5fab,0x177));var _0xb5fa=function(_0xf3d3d,_0x18c710){_0xf3d3d=_0xf3d3d-0x0;var _0x1e5511=_0x5fab[_0xf3d3d];return _0x1e5511;};'use strict';var Sequelize=require(_0xb5fa('0x0'));module[_0xb5fa('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb5fa('0x2')]},'username':{'type':Sequelize[_0xb5fa('0x2')],'unique':_0xb5fa('0x3')},'remoteUri':{'type':Sequelize[_0xb5fa('0x2')]},'password':{'type':Sequelize[_0xb5fa('0x2')]},'clientId':{'type':Sequelize[_0xb5fa('0x2')]},'clientSecret':{'type':Sequelize[_0xb5fa('0x2')]},'securityToken':{'type':Sequelize[_0xb5fa('0x2')]},'serverUrl':{'type':Sequelize[_0xb5fa('0x2')]},'type':{'type':Sequelize[_0xb5fa('0x4')]('integrationTab','newTab'),'defaultValue':_0xb5fa('0x5')}}; \ No newline at end of file +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 diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index c8f02d9..844f4d2 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 _0x53ec=['Priority','SuppliedName','SuppliedCompany','remove','custom','includes','label','picklistValues','value','True','true','False','false','statusCode','Wrong\x20credentials','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','../../components/integrations/configuration','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','end','status','count','offset','limit','set','json','save','update','destroy','name','send','map','SalesforceAccount','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','order','sort','filter','merge','where','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','fields','find','create','body','getConfigurations','findOne','SalesforceConfiguration','pick','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','Descriptions','channel','getFields','Task','clientId','clientSecret','username','password','securityToken','remoteUri','substring','Connection','concat','isNil','ticketType','sobject','CallDisposition','CallDurationInSeconds','IsArchived','Status','Type','Origin','Reason'];(function(_0xf3e98,_0x459de9){var _0x23535d=function(_0xfb9d56){while(--_0xfb9d56){_0xf3e98['push'](_0xf3e98['shift']());}};_0x23535d(++_0x459de9);}(_0x53ec,0x192));var _0xc53e=function(_0x5e9e3d,_0x567718){_0x5e9e3d=_0x5e9e3d-0x0;var _0x579c2c=_0x53ec[_0x5e9e3d];return _0x579c2c;};'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'];var integrations=require(_0xc53e('0x16'));var jayson=require(_0xc53e('0x17'));var client=jayson[_0xc53e('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x4e74c9,_0x1c06cd,_0x19a772){if(_0x19a772){var _0x7cd798=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x7cd798[_0xc53e('0x19')](_0x1c06cd)){return _0x4e74c9;}else{throw new db[(_0xc53e('0x1a'))][(_0xc53e('0x1b'))](_0xc53e('0x1c'));}}else{return _0x4e74c9;}}function respondWithRpcPromise(_0x19c0d1,_0x455e4d,_0x2ad6eb,_0x5b0a88){return new BPromise(function(_0x8a522e,_0x191567){var _0x535cd4=_0x5b0a88||client;return _0x535cd4[_0xc53e('0x1d')](_0x19c0d1,_0x2ad6eb)[_0xc53e('0x1e')](function(_0x270c78){logger[_0xc53e('0x1f')](_0xc53e('0x20'),_0x455e4d,_0xc53e('0x21'));logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x455e4d,_0xc53e('0x21'),JSON[_0xc53e('0x22')](_0x270c78));if(_0x270c78[_0xc53e('0x23')]){if(_0x270c78[_0xc53e('0x23')][_0xc53e('0x24')]===0x1f4){logger[_0xc53e('0x23')](_0xc53e('0x20'),_0x455e4d,_0x270c78[_0xc53e('0x23')][_0xc53e('0x25')]);return _0x191567(_0x270c78[_0xc53e('0x23')][_0xc53e('0x25')]);}logger[_0xc53e('0x23')](_0xc53e('0x20'),_0x455e4d,_0x270c78['error']['message']);return _0x8a522e(_0x270c78['error'][_0xc53e('0x25')]);}else{logger[_0xc53e('0x1f')](_0xc53e('0x20'),_0x455e4d,_0xc53e('0x21'));_0x8a522e(_0x270c78[_0xc53e('0x26')]['message']);}})['catch'](function(_0xe06e42){logger['error'](_0xc53e('0x20'),_0x455e4d,_0xe06e42);_0x191567(_0xe06e42);});});}function respondWithStatusCode(_0x3a5ce8,_0x443179){_0x443179=_0x443179||0xcc;return function(_0x1166e6){if(_0x1166e6){return _0x3a5ce8[_0xc53e('0x27')](_0x443179);}return _0x3a5ce8['status'](_0x443179)[_0xc53e('0x28')]();};}function respondWithResult(_0x4b9f6a,_0x4d9a68){_0x4d9a68=_0x4d9a68||0xc8;return function(_0x5c65d3){if(_0x5c65d3){return _0x4b9f6a[_0xc53e('0x29')](_0x4d9a68)['json'](_0x5c65d3);}};}function respondWithFilteredResult(_0x28240a,_0x4f203d){return function(_0x24a77e){if(_0x24a77e){var _0x5112d2=_0x24a77e[_0xc53e('0x2a')],_0x5ce216=_0x4f203d[_0xc53e('0x2b')],_0x8f0ee6=_0x4f203d[_0xc53e('0x2b')]+_0x4f203d[_0xc53e('0x2c')],_0x6a62b0;if(_0x8f0ee6>=_0x5112d2){_0x8f0ee6=_0x5112d2;_0x6a62b0=0xc8;}else{_0x6a62b0=0xce;}_0x28240a[_0xc53e('0x29')](_0x6a62b0);return _0x28240a[_0xc53e('0x2d')]('Content-Range',_0x5ce216+'-'+_0x8f0ee6+'/'+_0x5112d2)[_0xc53e('0x2e')](_0x24a77e);}return null;};}function patchUpdates(_0x311835){return function(_0x2d36c0){try{jsonpatch['apply'](_0x2d36c0,_0x311835,!![]);}catch(_0x4057f9){return BPromise['reject'](_0x4057f9);}return _0x2d36c0[_0xc53e('0x2f')]();};}function saveUpdates(_0x2467f4,_0x49ab9b){return function(_0x5a64e2){if(_0x5a64e2){return _0x5a64e2[_0xc53e('0x30')](_0x2467f4)[_0xc53e('0x1e')](function(_0x3f4547){return _0x3f4547;});}return null;};}function removeEntity(_0x30d037,_0x1b95c2){return function(_0x45fedc){if(_0x45fedc){return _0x45fedc[_0xc53e('0x31')]()[_0xc53e('0x1e')](function(){_0x30d037['status'](0xcc)[_0xc53e('0x28')]();});}};}function handleEntityNotFound(_0x3bae8a,_0x19020b){return function(_0x17ad32){if(!_0x17ad32){_0x3bae8a[_0xc53e('0x27')](0x194);}return _0x17ad32;};}function handleError(_0x12b32c,_0x1920c8){_0x1920c8=_0x1920c8||0x1f4;return function(_0x16942c){logger[_0xc53e('0x23')](_0x16942c['stack']);if(_0x16942c[_0xc53e('0x32')]){delete _0x16942c['name'];}_0x12b32c[_0xc53e('0x29')](_0x1920c8)[_0xc53e('0x33')](_0x16942c);};}exports['index']=function(_0x37452a,_0x154f8b){var _0x3254e9={},_0x5ed90b={},_0x4b82bb={'count':0x0,'rows':[]};var _0x17ec92=_[_0xc53e('0x34')](db[_0xc53e('0x35')][_0xc53e('0x36')],function(_0x143101){return{'name':_0x143101[_0xc53e('0x37')],'type':_0x143101['type'][_0xc53e('0x38')]};});_0x5ed90b[_0xc53e('0x39')]=_[_0xc53e('0x34')](_0x17ec92,'name');_0x5ed90b[_0xc53e('0x3a')]=_['keys'](_0x37452a[_0xc53e('0x3a')]);_0x5ed90b[_0xc53e('0x3b')]=_[_0xc53e('0x3c')](_0x5ed90b[_0xc53e('0x39')],_0x5ed90b[_0xc53e('0x3a')]);_0x3254e9['attributes']=_[_0xc53e('0x3c')](_0x5ed90b[_0xc53e('0x39')],qs['fields'](_0x37452a['query']['fields']));_0x3254e9['attributes']=_0x3254e9[_0xc53e('0x3d')][_0xc53e('0x3e')]?_0x3254e9['attributes']:_0x5ed90b[_0xc53e('0x39')];if(!_0x37452a['query']['hasOwnProperty']('nolimit')){_0x3254e9[_0xc53e('0x2c')]=qs['limit'](_0x37452a['query'][_0xc53e('0x2c')]);_0x3254e9['offset']=qs[_0xc53e('0x2b')](_0x37452a[_0xc53e('0x3a')]['offset']);}_0x3254e9[_0xc53e('0x3f')]=qs[_0xc53e('0x40')](_0x37452a['query'][_0xc53e('0x40')]);_0x3254e9['where']=qs['filters'](_['pick'](_0x37452a['query'],_0x5ed90b[_0xc53e('0x3b')]));if(_0x37452a[_0xc53e('0x3a')][_0xc53e('0x41')]){_0x3254e9['where']=_[_0xc53e('0x42')](_0x3254e9[_0xc53e('0x43')],{'$or':_['map'](_0x17ec92,function(_0x58ede2){if(_0x58ede2[_0xc53e('0x44')]!==_0xc53e('0x45')){var _0x162acd={};_0x162acd[_0x58ede2['name']]={'$like':'%'+_0x37452a[_0xc53e('0x3a')][_0xc53e('0x41')]+'%'};return _0x162acd;}})});}_0x3254e9=_[_0xc53e('0x42')]({},_0x3254e9,_0x37452a[_0xc53e('0x46')]);var _0x1295cc={'where':_0x3254e9[_0xc53e('0x43')]};return db[_0xc53e('0x35')]['count'](_0x1295cc)[_0xc53e('0x1e')](function(_0x39c467){_0x4b82bb[_0xc53e('0x2a')]=_0x39c467;if(_0x37452a['query'][_0xc53e('0x47')]){_0x3254e9[_0xc53e('0x48')]=[{'all':!![]}];}return db[_0xc53e('0x35')][_0xc53e('0x49')](_0x3254e9);})[_0xc53e('0x1e')](function(_0x17cea5){_0x4b82bb['rows']=_0x17cea5;return _0x4b82bb;})[_0xc53e('0x1e')](respondWithFilteredResult(_0x154f8b,_0x3254e9))[_0xc53e('0x4a')](handleError(_0x154f8b,null));};exports[_0xc53e('0x4b')]=function(_0x5a6e41,_0x33d45c){var _0x1d2491={'raw':![],'where':{'id':_0x5a6e41[_0xc53e('0x4c')]['id']}},_0x1eeb65={};_0x1eeb65[_0xc53e('0x39')]=_[_0xc53e('0x4d')](db[_0xc53e('0x35')][_0xc53e('0x36')]);_0x1eeb65[_0xc53e('0x3a')]=_[_0xc53e('0x4d')](_0x5a6e41['query']);_0x1eeb65[_0xc53e('0x3b')]=_[_0xc53e('0x3c')](_0x1eeb65[_0xc53e('0x39')],_0x1eeb65[_0xc53e('0x3a')]);_0x1d2491[_0xc53e('0x3d')]=_['intersection'](_0x1eeb65['model'],qs[_0xc53e('0x4e')](_0x5a6e41['query'][_0xc53e('0x4e')]));_0x1d2491['attributes']=_0x1d2491[_0xc53e('0x3d')][_0xc53e('0x3e')]?_0x1d2491[_0xc53e('0x3d')]:_0x1eeb65['model'];if(_0x5a6e41[_0xc53e('0x3a')][_0xc53e('0x47')]){_0x1d2491[_0xc53e('0x48')]=[{'all':!![]}];}_0x1d2491=_['merge']({},_0x1d2491,_0x5a6e41[_0xc53e('0x46')]);return db['SalesforceAccount'][_0xc53e('0x4f')](_0x1d2491)[_0xc53e('0x1e')](handleEntityNotFound(_0x33d45c,null))['then'](respondWithResult(_0x33d45c,null))[_0xc53e('0x4a')](handleError(_0x33d45c,null));};exports[_0xc53e('0x50')]=function(_0x5bba72,_0x44f7cc){return db[_0xc53e('0x35')][_0xc53e('0x50')](_0x5bba72[_0xc53e('0x51')],{})[_0xc53e('0x1e')](respondWithResult(_0x44f7cc,0xc9))[_0xc53e('0x4a')](handleError(_0x44f7cc,null));};exports[_0xc53e('0x30')]=function(_0x117c9b,_0x8e5630){if(_0x117c9b[_0xc53e('0x51')]['id']){delete _0x117c9b[_0xc53e('0x51')]['id'];}return db['SalesforceAccount'][_0xc53e('0x4f')]({'where':{'id':_0x117c9b['params']['id']}})[_0xc53e('0x1e')](handleEntityNotFound(_0x8e5630,null))['then'](saveUpdates(_0x117c9b[_0xc53e('0x51')],null))[_0xc53e('0x1e')](respondWithResult(_0x8e5630,null))['catch'](handleError(_0x8e5630,null));};exports[_0xc53e('0x31')]=function(_0x7f0bc0,_0x9c0112){return db[_0xc53e('0x35')]['find']({'where':{'id':_0x7f0bc0[_0xc53e('0x4c')]['id']}})[_0xc53e('0x1e')](handleEntityNotFound(_0x9c0112,null))['then'](removeEntity(_0x9c0112,null))['catch'](handleError(_0x9c0112,null));};exports[_0xc53e('0x52')]=function(_0x51db9a,_0x5c62c7,_0x57c822){var _0x23a4ee={};var _0x5f5dad={};var _0x32b390;var _0x4ee995;return db[_0xc53e('0x35')][_0xc53e('0x53')]({'where':{'id':_0x51db9a[_0xc53e('0x4c')]['id']}})[_0xc53e('0x1e')](handleEntityNotFound(_0x5c62c7,null))[_0xc53e('0x1e')](function(_0x4caf5f){if(_0x4caf5f){_0x32b390=_0x4caf5f;_0x5f5dad['model']=_[_0xc53e('0x4d')](db[_0xc53e('0x54')][_0xc53e('0x36')]);_0x5f5dad[_0xc53e('0x3a')]=_[_0xc53e('0x4d')](_0x51db9a[_0xc53e('0x3a')]);_0x5f5dad[_0xc53e('0x3b')]=_[_0xc53e('0x3c')](_0x5f5dad[_0xc53e('0x39')],_0x5f5dad[_0xc53e('0x3a')]);_0x23a4ee[_0xc53e('0x3d')]=_[_0xc53e('0x3c')](_0x5f5dad[_0xc53e('0x39')],qs['fields'](_0x51db9a[_0xc53e('0x3a')]['fields']));_0x23a4ee[_0xc53e('0x3d')]=_0x23a4ee[_0xc53e('0x3d')][_0xc53e('0x3e')]?_0x23a4ee[_0xc53e('0x3d')]:_0x5f5dad[_0xc53e('0x39')];_0x23a4ee[_0xc53e('0x3f')]=qs[_0xc53e('0x40')](_0x51db9a[_0xc53e('0x3a')]['sort']);_0x23a4ee['where']=qs['filters'](_[_0xc53e('0x55')](_0x51db9a[_0xc53e('0x3a')],_0x5f5dad[_0xc53e('0x3b')]));if(_0x51db9a[_0xc53e('0x3a')][_0xc53e('0x41')]){_0x23a4ee[_0xc53e('0x43')]=_[_0xc53e('0x42')](_0x23a4ee['where'],{'$or':_['map'](_0x23a4ee['attributes'],function(_0x40c8ba){var _0x150212={};_0x150212[_0x40c8ba]={'$like':'%'+_0x51db9a['query'][_0xc53e('0x41')]+'%'};return _0x150212;})});}_0x23a4ee=_[_0xc53e('0x42')]({},_0x23a4ee,_0x51db9a[_0xc53e('0x46')]);return _0x32b390[_0xc53e('0x52')](_0x23a4ee);}})[_0xc53e('0x1e')](function(_0x20cb31){if(_0x20cb31){_0x4ee995=_0x20cb31['length'];if(!_0x51db9a['query'][_0xc53e('0x56')](_0xc53e('0x57'))){_0x23a4ee[_0xc53e('0x2c')]=qs[_0xc53e('0x2c')](_0x51db9a[_0xc53e('0x3a')][_0xc53e('0x2c')]);_0x23a4ee['offset']=qs[_0xc53e('0x2b')](_0x51db9a[_0xc53e('0x3a')][_0xc53e('0x2b')]);}return _0x32b390[_0xc53e('0x52')](_0x23a4ee);}})['then'](function(_0xdd851e){if(_0xdd851e){return _0xdd851e?{'count':_0x4ee995,'rows':_0xdd851e}:null;}})[_0xc53e('0x1e')](respondWithResult(_0x5c62c7,null))[_0xc53e('0x4a')](handleError(_0x5c62c7,null));};exports[_0xc53e('0x58')]=function(_0x32f954,_0x2d9803,_0x51638a){if(_0x32f954[_0xc53e('0x51')]['id']){delete _0x32f954[_0xc53e('0x51')]['id'];}return db[_0xc53e('0x35')][_0xc53e('0x53')]({'where':{'id':_0x32f954['params']['id']}})['then'](handleEntityNotFound(_0x2d9803,null))[_0xc53e('0x1e')](function(_0x340123){if(_0x340123){_0x32f954[_0xc53e('0x51')][_0xc53e('0x59')]=_0x340123['id'];_0x32f954['body'][_0xc53e('0x5a')]=integrations['getSubjects'](_0x32f954[_0xc53e('0x51')]['channel'],_0x32f954[_0xc53e('0x51')]['type']);_0x32f954[_0xc53e('0x51')][_0xc53e('0x5b')]=integrations['getDescriptions'](_0x32f954[_0xc53e('0x51')][_0xc53e('0x5c')],_0x32f954['body']['type']);return db[_0xc53e('0x54')][_0xc53e('0x50')](_0x32f954['body'],{'include':[{'model':db['SalesforceField'],'as':_0xc53e('0x5a')},{'model':db['SalesforceField'],'as':_0xc53e('0x5b')}]});}return null;})['then'](respondWithResult(_0x2d9803,null))[_0xc53e('0x4a')](handleError(_0x2d9803,null));};exports[_0xc53e('0x5d')]=function(_0x10167b,_0x388874,_0x45cee1){var _0x20067c;var _0x143f15='';var _0x15eac2=_0xc53e('0x5e');return db[_0xc53e('0x35')]['findOne']({'where':{'id':_0x10167b[_0xc53e('0x4c')]['id']},'attributes':['id','remoteUri',_0xc53e('0x5f'),_0xc53e('0x60'),_0xc53e('0x61'),_0xc53e('0x62'),_0xc53e('0x63')]})[_0xc53e('0x1e')](handleEntityNotFound(_0x388874,null))[_0xc53e('0x1e')](function(_0x3cc2c7){if(_0x3cc2c7){_0x143f15=_0x3cc2c7[_0xc53e('0x64')];var _0x1f572b=_0x143f15['slice'](-0x1);if(_0x1f572b==='/'){_0x143f15=_0x143f15[_0xc53e('0x65')](0x0,_0x143f15['lastIndexOf'](_0x1f572b));}_0x20067c=new jsforce[(_0xc53e('0x66'))]({'oauth2':{'loginUrl':_0x143f15,'clientId':_0x3cc2c7[_0xc53e('0x5f')],'clientSecret':_0x3cc2c7[_0xc53e('0x60')]}});return _0x20067c['login'](_0x3cc2c7[_0xc53e('0x61')],_0x3cc2c7[_0xc53e('0x62')][_0xc53e('0x67')](_0x3cc2c7[_0xc53e('0x63')]));}})[_0xc53e('0x1e')](function(_0x508671){if(_0x508671){if(!_[_0xc53e('0x68')](_0x10167b[_0xc53e('0x3a')]['ticketType'])){_0x15eac2=_0x10167b[_0xc53e('0x3a')][_0xc53e('0x69')];}return _0x20067c[_0xc53e('0x6a')](_0x15eac2)['describe']();}})[_0xc53e('0x1e')](function(_0x499725){var _0x49bed2=[_0xc53e('0x6b'),_0xc53e('0x6c'),'CallObject','CallType',_0xc53e('0x6d'),'Priority',_0xc53e('0x6e'),_0xc53e('0x6f')];if(!_[_0xc53e('0x68')](_0x10167b['query'][_0xc53e('0x69')])&&_0x10167b[_0xc53e('0x3a')][_0xc53e('0x69')]==='Case'){_0x49bed2=[_0xc53e('0x6f'),_0xc53e('0x70'),_0xc53e('0x71'),_0xc53e('0x6e'),_0xc53e('0x72'),'IsEscalated',_0xc53e('0x73'),_0xc53e('0x74')];}if(_0x499725){_[_0xc53e('0x75')](_0x499725[_0xc53e('0x4e')],function(_0xe6a976){return _0xe6a976[_0xc53e('0x76')]===![]&&!_0x49bed2[_0xc53e('0x77')](_0xe6a976[_0xc53e('0x32')]);});return{'count':_0x499725[_0xc53e('0x4e')]['length'],'rows':_[_0xc53e('0x34')](_0x499725[_0xc53e('0x4e')],function(_0x1c06bc){return{'id':_0x1c06bc[_0xc53e('0x32')],'name':_0x1c06bc[_0xc53e('0x78')],'custom':_0x1c06bc[_0xc53e('0x76')],'options':_0x1c06bc[_0xc53e('0x79')][_0xc53e('0x3e')]>0x0?_[_0xc53e('0x34')](_0x1c06bc['picklistValues'],function(_0x3a54ef){return{'name':_0x3a54ef[_0xc53e('0x78')],'value':_0x3a54ef[_0xc53e('0x7a')]};}):_0x1c06bc[_0xc53e('0x44')]=='boolean'?[{'name':_0xc53e('0x7b'),'value':_0xc53e('0x7c')},{'name':_0xc53e('0x7d'),'value':_0xc53e('0x7e')}]:[]};})};}})['then'](respondWithResult(_0x388874,null))[_0xc53e('0x4a')](function(_0x138870){var _0xa90198=_0x10167b[_0xc53e('0x3a')][_0xc53e('0x19')]?0x1f4:_0x138870[_0xc53e('0x7f')]||0x1f4;logger[_0xc53e('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0xc53e('0x5d'),_0xa90198,JSON['stringify'](_0x138870));delete _0x138870[_0xc53e('0x32')];if(_0xa90198===0x191){_0xa90198=0x190;}_0x388874[_0xc53e('0x29')](_0xa90198)[_0xc53e('0x33')](_0x10167b['query'][_0xc53e('0x19')]?{'message':_0xc53e('0x80'),'statusCode':_0x138870[_0xc53e('0x7f')]}:_0x138870);});}; \ No newline at end of file +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 diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index bdac895..49c2e7f 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 _0x5675=['path','rimraf','../../components/integrations/configuration','exports','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x57f08b,_0x3450d2){var _0x59ef96=function(_0x321aa5){while(--_0x321aa5){_0x57f08b['push'](_0x57f08b['shift']());}};_0x59ef96(++_0x3450d2);}(_0x5675,0x7b));var _0x5567=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0x5675[_0x599e60];return _0x468e19;};'use strict';var _=require(_0x5567('0x0'));var util=require(_0x5567('0x1'));var logger=require(_0x5567('0x2'))(_0x5567('0x3'));var moment=require(_0x5567('0x4'));var BPromise=require(_0x5567('0x5'));var rp=require(_0x5567('0x6'));var fs=require('fs');var path=require(_0x5567('0x7'));var rimraf=require(_0x5567('0x8'));var config=require('../../config/environment');var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x5567('0x9'));module[_0x5567('0xa')]=function(_0x336ee7,_0x4bf6fe){return _0x336ee7['define'](_0x5567('0xb'),attributes,{'tableName':_0x5567('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index f4b0d5f..a43922c 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 _0xbdb7=['model','map','ShowSalesforceAccount','find','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetSalesforceAccount','SalesforceAccount','options','raw','attributes','limit','include'];(function(_0x5d1d3f,_0x368888){var _0x440321=function(_0x1b12bf){while(--_0x1b12bf){_0x5d1d3f['push'](_0x5d1d3f['shift']());}};_0x440321(++_0x368888);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x7ea1fb,_0x2f0b74){_0x7ea1fb=_0x7ea1fb-0x0;var _0x478241=_0xbdb7[_0x7ea1fb];return _0x478241;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});}exports[_0x7bdb('0x15')]=function(_0x5723f4){var _0x2aff6a=this;return new Promise(function(_0x4ffd4b,_0x41f540){return db[_0x7bdb('0x16')]['findAll']({'raw':_0x5723f4[_0x7bdb('0x17')]?_0x5723f4[_0x7bdb('0x17')][_0x7bdb('0x18')]===undefined?!![]:![]:!![],'where':_0x5723f4[_0x7bdb('0x17')]?_0x5723f4[_0x7bdb('0x17')]['where']||null:null,'attributes':_0x5723f4['options']?_0x5723f4[_0x7bdb('0x17')][_0x7bdb('0x19')]||null:null,'limit':_0x5723f4['options']?_0x5723f4[_0x7bdb('0x17')][_0x7bdb('0x1a')]||null:null,'include':_0x5723f4[_0x7bdb('0x17')]?_0x5723f4[_0x7bdb('0x17')][_0x7bdb('0x1b')]?_['map'](_0x5723f4[_0x7bdb('0x17')][_0x7bdb('0x1b')],function(_0x40c447){return{'model':db[_0x40c447[_0x7bdb('0x1c')]],'as':_0x40c447['as'],'attributes':_0x40c447['attributes'],'include':_0x40c447['include']?_[_0x7bdb('0x1d')](_0x40c447['include'],function(_0x47abaf){return{'model':db[_0x47abaf['model']],'as':_0x47abaf['as'],'attributes':_0x47abaf[_0x7bdb('0x19')],'include':_0x47abaf['include']?_[_0x7bdb('0x1d')](_0x47abaf[_0x7bdb('0x1b')],function(_0x3ec129){return{'model':db[_0x3ec129[_0x7bdb('0x1c')]],'as':_0x3ec129['as'],'attributes':_0x3ec129[_0x7bdb('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x10e818){logger[_0x7bdb('0xb')](_0x7bdb('0x15'),_0x5723f4);logger[_0x7bdb('0xe')](_0x7bdb('0x15'),_0x5723f4,JSON[_0x7bdb('0x10')](_0x10e818));_0x4ffd4b(_0x10e818);})[_0x7bdb('0x14')](function(_0xd2d7be){logger[_0x7bdb('0x11')](_0x7bdb('0x15'),_0xd2d7be[_0x7bdb('0x12')],_0x5723f4);_0x41f540(_0x2aff6a[_0x7bdb('0x11')](0x1f4,_0xd2d7be['message']));});});};exports[_0x7bdb('0x1e')]=function(_0x23fc3a){var _0x8f7672=this;return new Promise(function(_0x9f5c1,_0x29eac5){return db['SalesforceAccount'][_0x7bdb('0x1f')]({'raw':_0x23fc3a[_0x7bdb('0x17')]?_0x23fc3a[_0x7bdb('0x17')][_0x7bdb('0x18')]===undefined?!![]:![]:!![],'where':_0x23fc3a['options']?_0x23fc3a['options']['where']||null:null,'attributes':_0x23fc3a[_0x7bdb('0x17')]?_0x23fc3a['options'][_0x7bdb('0x19')]||null:null,'include':_0x23fc3a['options']?_0x23fc3a[_0x7bdb('0x17')][_0x7bdb('0x1b')]?_[_0x7bdb('0x1d')](_0x23fc3a['options'][_0x7bdb('0x1b')],function(_0x514713){return{'model':db[_0x514713['model']],'as':_0x514713['as'],'attributes':_0x514713[_0x7bdb('0x19')],'include':_0x514713['include']?_[_0x7bdb('0x1d')](_0x514713['include'],function(_0x5ee47d){return{'model':db[_0x5ee47d[_0x7bdb('0x1c')]],'as':_0x5ee47d['as'],'attributes':_0x5ee47d[_0x7bdb('0x19')],'include':_0x5ee47d[_0x7bdb('0x1b')]?_[_0x7bdb('0x1d')](_0x5ee47d[_0x7bdb('0x1b')],function(_0x2bb28a){return{'model':db[_0x2bb28a['model']],'as':_0x2bb28a['as'],'attributes':_0x2bb28a[_0x7bdb('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7bdb('0x20')](function(_0x329ecf){logger[_0x7bdb('0xb')](_0x7bdb('0x1e'),_0x23fc3a);logger[_0x7bdb('0xe')](_0x7bdb('0x1e'),_0x23fc3a,JSON[_0x7bdb('0x10')](_0x329ecf));_0x9f5c1(_0x329ecf);})[_0x7bdb('0x14')](function(_0x4e1c97){logger['error'](_0x7bdb('0x1e'),_0x4e1c97[_0x7bdb('0x12')],_0x23fc3a);_0x29eac5(_0x8f7672[_0x7bdb('0x11')](0x1f4,_0x4e1c97[_0x7bdb('0x12')]));});});}; \ No newline at end of file +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 diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 7028493..8cba6e7 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 _0x1699=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','delete','destroy','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields'];(function(_0x4ef952,_0x4496f4){var _0x3ad9b1=function(_0x53206d){while(--_0x53206d){_0x4ef952['push'](_0x4ef952['shift']());}};_0x3ad9b1(++_0x4496f4);}(_0x1699,0x184));var _0x9169=function(_0x35ea44,_0x314ac5){_0x35ea44=_0x35ea44-0x0;var _0x432f30=_0x1699[_0x35ea44];return _0x432f30;};'use strict';var multer=require('multer');var util=require(_0x9169('0x0'));var path=require(_0x9169('0x1'));var timeout=require(_0x9169('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x9169('0x3'));var interaction=require(_0x9169('0x4'));var config=require(_0x9169('0x5'));var controller=require(_0x9169('0x6'));router[_0x9169('0x7')]('/',auth[_0x9169('0x8')](),controller[_0x9169('0x9')]);router[_0x9169('0x7')](_0x9169('0xa'),auth[_0x9169('0x8')](),controller['show']);router['get'](_0x9169('0xb'),auth[_0x9169('0x8')](),controller['getFields']);router[_0x9169('0x7')](_0x9169('0xc'),auth[_0x9169('0x8')](),controller[_0x9169('0xd')]);router['get'](_0x9169('0xe'),auth[_0x9169('0x8')](),controller[_0x9169('0xf')]);router[_0x9169('0x10')]('/',auth[_0x9169('0x8')](),controller[_0x9169('0x11')]);router['put'](_0x9169('0xa'),auth[_0x9169('0x8')](),controller['update']);router[_0x9169('0x12')](_0x9169('0xa'),auth[_0x9169('0x8')](),controller[_0x9169('0x13')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 3e3f734..dcd3370 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 _0x3bdf=['contact','lead','sequelize','exports','STRING','ENUM','Task','Case','contact_lead'];(function(_0x2bde9f,_0x3ccd1b){var _0x3e8886=function(_0x3984bf){while(--_0x3984bf){_0x2bde9f['push'](_0x2bde9f['shift']());}};_0x3e8886(++_0x3ccd1b);}(_0x3bdf,0x110));var _0xf3bd=function(_0x55f71f,_0x4e8655){_0x55f71f=_0x55f71f-0x0;var _0xf64f0f=_0x3bdf[_0x55f71f];return _0xf64f0f;};'use strict';var Sequelize=require(_0xf3bd('0x0'));module[_0xf3bd('0x1')]={'name':{'type':Sequelize[_0xf3bd('0x2')]},'description':{'type':Sequelize[_0xf3bd('0x2')]},'ticketType':{'type':Sequelize[_0xf3bd('0x3')](_0xf3bd('0x4'),_0xf3bd('0x5')),'defaultValue':_0xf3bd('0x4')},'moduleSearch':{'type':Sequelize[_0xf3bd('0x3')](_0xf3bd('0x6'),_0xf3bd('0x7'),_0xf3bd('0x8')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize['ENUM']('nothing',_0xf3bd('0x7'),'lead'),'defaultValue':_0xf3bd('0x8')}}; \ No newline at end of file +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 diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 4b97d94..168657d 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 _0x46d1=['index','SalesforceConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','type','options','includeAll','include','findAll','rows','show','find','create','body','params','getFields','findOne','SalesforceField','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','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','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','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','count','offset','set','Content-Range','json','update','destroy','stack','name'];(function(_0x4b0c37,_0x4cc3a8){var _0x58e950=function(_0x2588ce){while(--_0x2588ce){_0x4b0c37['push'](_0x4b0c37['shift']());}};_0x58e950(++_0x4cc3a8);}(_0x46d1,0x1ab));var _0x146d=function(_0x3b0ee4,_0x3c0c4a){_0x3b0ee4=_0x3b0ee4-0x0;var _0x396cae=_0x46d1[_0x3b0ee4];return _0x396cae;};'use strict';var pdf=require(_0x146d('0x0'));var emlformat=require(_0x146d('0x1'));var rimraf=require(_0x146d('0x2'));var zipdir=require(_0x146d('0x3'));var jsonpatch=require(_0x146d('0x4'));var rp=require(_0x146d('0x5'));var moment=require('moment');var BPromise=require(_0x146d('0x6'));var Mustache=require(_0x146d('0x7'));var util=require(_0x146d('0x8'));var path=require(_0x146d('0x9'));var sox=require(_0x146d('0xa'));var csv=require(_0x146d('0xb'));var ejs=require(_0x146d('0xc'));var fs=require('fs');var _=require(_0x146d('0xd'));var squel=require(_0x146d('0xe'));var crypto=require(_0x146d('0xf'));var jsforce=require(_0x146d('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x146d('0xb'));var querystring=require(_0x146d('0x11'));var Papa=require(_0x146d('0x12'));var Redis=require(_0x146d('0x13'));var authService=require(_0x146d('0x14'));var qs=require(_0x146d('0x15'));var as=require(_0x146d('0x16'));var hardwareService=require(_0x146d('0x17'));var logger=require(_0x146d('0x18'))(_0x146d('0x19'));var utils=require(_0x146d('0x1a'));var config=require(_0x146d('0x1b'));var db=require('../../mysqldb')['db'];var jayson=require(_0x146d('0x1c'));var client=jayson[_0x146d('0x1d')][_0x146d('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x99a56f,_0x5eaba0,_0x5ab6a7){if(_0x5ab6a7){var _0x46763a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x46763a[_0x146d('0x1f')](_0x5eaba0)){return _0x99a56f;}else{throw new db[(_0x146d('0x20'))]['ValidationError'](_0x146d('0x21'));}}else{return _0x99a56f;}}function respondWithRpcPromise(_0x50dcde,_0x16ac20,_0x5a114d,_0xe1b54c){return new BPromise(function(_0x240366,_0x8effda){var _0x2e78dc=_0xe1b54c||client;return _0x2e78dc[_0x146d('0x22')](_0x50dcde,_0x5a114d)[_0x146d('0x23')](function(_0x2f85b7){logger[_0x146d('0x24')]('SalesforceConfiguration,\x20%s,\x20%s',_0x16ac20,'request\x20sent');logger[_0x146d('0x25')](_0x146d('0x26'),_0x16ac20,_0x146d('0x27'),JSON['stringify'](_0x2f85b7));if(_0x2f85b7[_0x146d('0x28')]){if(_0x2f85b7[_0x146d('0x28')][_0x146d('0x29')]===0x1f4){logger[_0x146d('0x28')](_0x146d('0x2a'),_0x16ac20,_0x2f85b7['error'][_0x146d('0x2b')]);return _0x8effda(_0x2f85b7[_0x146d('0x28')][_0x146d('0x2b')]);}logger[_0x146d('0x28')]('SalesforceConfiguration,\x20%s,\x20%s',_0x16ac20,_0x2f85b7[_0x146d('0x28')]['message']);return _0x240366(_0x2f85b7[_0x146d('0x28')][_0x146d('0x2b')]);}else{logger[_0x146d('0x24')](_0x146d('0x2a'),_0x16ac20,_0x146d('0x27'));_0x240366(_0x2f85b7[_0x146d('0x2c')][_0x146d('0x2b')]);}})[_0x146d('0x2d')](function(_0x285839){logger[_0x146d('0x28')](_0x146d('0x2a'),_0x16ac20,_0x285839);_0x8effda(_0x285839);});});}function respondWithStatusCode(_0x243bd6,_0x5e41d2){_0x5e41d2=_0x5e41d2||0xcc;return function(_0x196f7e){if(_0x196f7e){return _0x243bd6[_0x146d('0x2e')](_0x5e41d2);}return _0x243bd6['status'](_0x5e41d2)[_0x146d('0x2f')]();};}function respondWithResult(_0x3dc5e9,_0x197be2){_0x197be2=_0x197be2||0xc8;return function(_0x23b42d){if(_0x23b42d){return _0x3dc5e9[_0x146d('0x30')](_0x197be2)['json'](_0x23b42d);}};}function respondWithFilteredResult(_0x3e8be1,_0x229b5b){return function(_0xb38385){if(_0xb38385){var _0x3fe182=_0xb38385[_0x146d('0x31')],_0x8e1b77=_0x229b5b['offset'],_0x21c630=_0x229b5b[_0x146d('0x32')]+_0x229b5b['limit'],_0x281f4f;if(_0x21c630>=_0x3fe182){_0x21c630=_0x3fe182;_0x281f4f=0xc8;}else{_0x281f4f=0xce;}_0x3e8be1[_0x146d('0x30')](_0x281f4f);return _0x3e8be1[_0x146d('0x33')](_0x146d('0x34'),_0x8e1b77+'-'+_0x21c630+'/'+_0x3fe182)[_0x146d('0x35')](_0xb38385);}return null;};}function patchUpdates(_0xaba144){return function(_0x431fb9){try{jsonpatch['apply'](_0x431fb9,_0xaba144,!![]);}catch(_0x12056f){return BPromise['reject'](_0x12056f);}return _0x431fb9['save']();};}function saveUpdates(_0x2227f3,_0x52cb5c){return function(_0x4777af){if(_0x4777af){return _0x4777af[_0x146d('0x36')](_0x2227f3)['then'](function(_0x57ac2a){return _0x57ac2a;});}return null;};}function removeEntity(_0x93e101,_0x1d0cb2){return function(_0x1e1b36){if(_0x1e1b36){return _0x1e1b36[_0x146d('0x37')]()[_0x146d('0x23')](function(){_0x93e101['status'](0xcc)[_0x146d('0x2f')]();});}};}function handleEntityNotFound(_0x3e20ef,_0x44c201){return function(_0x57b69e){if(!_0x57b69e){_0x3e20ef[_0x146d('0x2e')](0x194);}return _0x57b69e;};}function handleError(_0x26feb3,_0x1bd7dd){_0x1bd7dd=_0x1bd7dd||0x1f4;return function(_0x32d1f3){logger['error'](_0x32d1f3[_0x146d('0x38')]);if(_0x32d1f3[_0x146d('0x39')]){delete _0x32d1f3[_0x146d('0x39')];}_0x26feb3[_0x146d('0x30')](_0x1bd7dd)['send'](_0x32d1f3);};}exports[_0x146d('0x3a')]=function(_0x329da9,_0x4a022d){var _0x5b3d20={},_0x5848eb={},_0x3f7d37={'count':0x0,'rows':[]};var _0x1dc7b2=_['map'](db[_0x146d('0x3b')][_0x146d('0x3c')],function(_0x396ff2){return{'name':_0x396ff2[_0x146d('0x3d')],'type':_0x396ff2['type'][_0x146d('0x3e')]};});_0x5848eb[_0x146d('0x3f')]=_['map'](_0x1dc7b2,_0x146d('0x39'));_0x5848eb[_0x146d('0x40')]=_[_0x146d('0x41')](_0x329da9[_0x146d('0x40')]);_0x5848eb[_0x146d('0x42')]=_['intersection'](_0x5848eb[_0x146d('0x3f')],_0x5848eb[_0x146d('0x40')]);_0x5b3d20[_0x146d('0x43')]=_[_0x146d('0x44')](_0x5848eb[_0x146d('0x3f')],qs[_0x146d('0x45')](_0x329da9[_0x146d('0x40')][_0x146d('0x45')]));_0x5b3d20[_0x146d('0x43')]=_0x5b3d20['attributes'][_0x146d('0x46')]?_0x5b3d20[_0x146d('0x43')]:_0x5848eb[_0x146d('0x3f')];if(!_0x329da9[_0x146d('0x40')][_0x146d('0x47')](_0x146d('0x48'))){_0x5b3d20[_0x146d('0x49')]=qs['limit'](_0x329da9['query']['limit']);_0x5b3d20[_0x146d('0x32')]=qs[_0x146d('0x32')](_0x329da9[_0x146d('0x40')][_0x146d('0x32')]);}_0x5b3d20[_0x146d('0x4a')]=qs['sort'](_0x329da9['query'][_0x146d('0x4b')]);_0x5b3d20[_0x146d('0x4c')]=qs[_0x146d('0x42')](_[_0x146d('0x4d')](_0x329da9['query'],_0x5848eb[_0x146d('0x42')]));if(_0x329da9['query'][_0x146d('0x4e')]){_0x5b3d20[_0x146d('0x4c')]=_[_0x146d('0x4f')](_0x5b3d20[_0x146d('0x4c')],{'$or':_[_0x146d('0x50')](_0x1dc7b2,function(_0x5b3fcd){if(_0x5b3fcd[_0x146d('0x51')]!=='VIRTUAL'){var _0x347344={};_0x347344[_0x5b3fcd[_0x146d('0x39')]]={'$like':'%'+_0x329da9[_0x146d('0x40')][_0x146d('0x4e')]+'%'};return _0x347344;}})});}_0x5b3d20=_[_0x146d('0x4f')]({},_0x5b3d20,_0x329da9[_0x146d('0x52')]);var _0xdbc6f6={'where':_0x5b3d20[_0x146d('0x4c')]};return db[_0x146d('0x3b')][_0x146d('0x31')](_0xdbc6f6)[_0x146d('0x23')](function(_0x4f0916){_0x3f7d37['count']=_0x4f0916;if(_0x329da9[_0x146d('0x40')][_0x146d('0x53')]){_0x5b3d20[_0x146d('0x54')]=[{'all':!![]}];}return db[_0x146d('0x3b')][_0x146d('0x55')](_0x5b3d20);})[_0x146d('0x23')](function(_0x5eafcc){_0x3f7d37[_0x146d('0x56')]=_0x5eafcc;return _0x3f7d37;})[_0x146d('0x23')](respondWithFilteredResult(_0x4a022d,_0x5b3d20))['catch'](handleError(_0x4a022d,null));};exports[_0x146d('0x57')]=function(_0x2f1153,_0x3f9ddb){var _0x136fc0={'raw':![],'where':{'id':_0x2f1153['params']['id']}},_0x11039b={};_0x11039b[_0x146d('0x3f')]=_['keys'](db['SalesforceConfiguration'][_0x146d('0x3c')]);_0x11039b[_0x146d('0x40')]=_[_0x146d('0x41')](_0x2f1153[_0x146d('0x40')]);_0x11039b[_0x146d('0x42')]=_[_0x146d('0x44')](_0x11039b[_0x146d('0x3f')],_0x11039b[_0x146d('0x40')]);_0x136fc0[_0x146d('0x43')]=_[_0x146d('0x44')](_0x11039b[_0x146d('0x3f')],qs[_0x146d('0x45')](_0x2f1153[_0x146d('0x40')][_0x146d('0x45')]));_0x136fc0[_0x146d('0x43')]=_0x136fc0['attributes'][_0x146d('0x46')]?_0x136fc0[_0x146d('0x43')]:_0x11039b[_0x146d('0x3f')];if(_0x2f1153['query'][_0x146d('0x53')]){_0x136fc0[_0x146d('0x54')]=[{'all':!![]}];}_0x136fc0=_[_0x146d('0x4f')]({},_0x136fc0,_0x2f1153['options']);return db[_0x146d('0x3b')][_0x146d('0x58')](_0x136fc0)[_0x146d('0x23')](handleEntityNotFound(_0x3f9ddb,null))[_0x146d('0x23')](respondWithResult(_0x3f9ddb,null))['catch'](handleError(_0x3f9ddb,null));};exports['create']=function(_0x506784,_0x53f343){return db[_0x146d('0x3b')][_0x146d('0x59')](_0x506784[_0x146d('0x5a')],{})['then'](respondWithResult(_0x53f343,0xc9))['catch'](handleError(_0x53f343,null));};exports[_0x146d('0x36')]=function(_0x4060d7,_0x41cda2){if(_0x4060d7['body']['id']){delete _0x4060d7[_0x146d('0x5a')]['id'];}return db['SalesforceConfiguration'][_0x146d('0x58')]({'where':{'id':_0x4060d7[_0x146d('0x5b')]['id']}})[_0x146d('0x23')](handleEntityNotFound(_0x41cda2,null))[_0x146d('0x23')](saveUpdates(_0x4060d7[_0x146d('0x5a')],null))[_0x146d('0x23')](respondWithResult(_0x41cda2,null))[_0x146d('0x2d')](handleError(_0x41cda2,null));};exports[_0x146d('0x37')]=function(_0x381a45,_0x5f1886){return db[_0x146d('0x3b')][_0x146d('0x58')]({'where':{'id':_0x381a45[_0x146d('0x5b')]['id']}})[_0x146d('0x23')](handleEntityNotFound(_0x5f1886,null))[_0x146d('0x23')](removeEntity(_0x5f1886,null))[_0x146d('0x2d')](handleError(_0x5f1886,null));};exports[_0x146d('0x5c')]=function(_0x46fd8c,_0x354b1f,_0x47a1c8){var _0x377177={};var _0xb28e4={};var _0x37858b;var _0x34f679;return db[_0x146d('0x3b')][_0x146d('0x5d')]({'where':{'id':_0x46fd8c['params']['id']}})[_0x146d('0x23')](handleEntityNotFound(_0x354b1f,null))['then'](function(_0x566197){if(_0x566197){_0x37858b=_0x566197;_0xb28e4[_0x146d('0x3f')]=_['keys'](db[_0x146d('0x5e')][_0x146d('0x3c')]);_0xb28e4[_0x146d('0x40')]=_[_0x146d('0x41')](_0x46fd8c['query']);_0xb28e4[_0x146d('0x42')]=_['intersection'](_0xb28e4[_0x146d('0x3f')],_0xb28e4[_0x146d('0x40')]);_0x377177[_0x146d('0x43')]=_['intersection'](_0xb28e4[_0x146d('0x3f')],qs[_0x146d('0x45')](_0x46fd8c[_0x146d('0x40')]['fields']));_0x377177['attributes']=_0x377177[_0x146d('0x43')][_0x146d('0x46')]?_0x377177['attributes']:_0xb28e4['model'];_0x377177[_0x146d('0x4a')]=qs[_0x146d('0x4b')](_0x46fd8c['query']['sort']);_0x377177['where']=qs['filters'](_[_0x146d('0x4d')](_0x46fd8c[_0x146d('0x40')],_0xb28e4[_0x146d('0x42')]));if(_0x46fd8c[_0x146d('0x40')][_0x146d('0x4e')]){_0x377177[_0x146d('0x4c')]=_['merge'](_0x377177[_0x146d('0x4c')],{'$or':_[_0x146d('0x50')](_0x377177[_0x146d('0x43')],function(_0x139589){var _0x45d440={};_0x45d440[_0x139589]={'$like':'%'+_0x46fd8c[_0x146d('0x40')][_0x146d('0x4e')]+'%'};return _0x45d440;})});}_0x377177=_['merge']({},_0x377177,_0x46fd8c[_0x146d('0x52')]);return _0x37858b['getFields'](_0x377177);}})[_0x146d('0x23')](function(_0x3186b9){if(_0x3186b9){_0x34f679=_0x3186b9[_0x146d('0x46')];if(!_0x46fd8c[_0x146d('0x40')]['hasOwnProperty'](_0x146d('0x48'))){_0x377177[_0x146d('0x49')]=qs['limit'](_0x46fd8c[_0x146d('0x40')]['limit']);_0x377177[_0x146d('0x32')]=qs[_0x146d('0x32')](_0x46fd8c[_0x146d('0x40')][_0x146d('0x32')]);}return _0x37858b['getFields'](_0x377177);}})[_0x146d('0x23')](function(_0x3a8b22){if(_0x3a8b22){return _0x3a8b22?{'count':_0x34f679,'rows':_0x3a8b22}:null;}})[_0x146d('0x23')](respondWithResult(_0x354b1f,null))[_0x146d('0x2d')](handleError(_0x354b1f,null));};exports['getSubjects']=function(_0x713c70,_0x4ff46c,_0x47f595){var _0x48d633={};var _0x1dd246={};var _0x13cd7c;var _0x533719;return db[_0x146d('0x3b')]['findOne']({'where':{'id':_0x713c70[_0x146d('0x5b')]['id']}})[_0x146d('0x23')](handleEntityNotFound(_0x4ff46c,null))[_0x146d('0x23')](function(_0x871400){if(_0x871400){_0x13cd7c=_0x871400;_0x1dd246[_0x146d('0x3f')]=_[_0x146d('0x41')](db['SalesforceField'][_0x146d('0x3c')]);_0x1dd246[_0x146d('0x40')]=_[_0x146d('0x41')](_0x713c70[_0x146d('0x40')]);_0x1dd246[_0x146d('0x42')]=_[_0x146d('0x44')](_0x1dd246['model'],_0x1dd246[_0x146d('0x40')]);_0x48d633[_0x146d('0x43')]=_['intersection'](_0x1dd246[_0x146d('0x3f')],qs[_0x146d('0x45')](_0x713c70[_0x146d('0x40')]['fields']));_0x48d633[_0x146d('0x43')]=_0x48d633[_0x146d('0x43')][_0x146d('0x46')]?_0x48d633[_0x146d('0x43')]:_0x1dd246['model'];_0x48d633[_0x146d('0x4a')]=qs['sort'](_0x713c70[_0x146d('0x40')]['sort']);_0x48d633[_0x146d('0x4c')]=qs[_0x146d('0x42')](_[_0x146d('0x4d')](_0x713c70[_0x146d('0x40')],_0x1dd246[_0x146d('0x42')]));if(_0x713c70['query'][_0x146d('0x4e')]){_0x48d633['where']=_['merge'](_0x48d633[_0x146d('0x4c')],{'$or':_[_0x146d('0x50')](_0x48d633[_0x146d('0x43')],function(_0xe299c3){var _0x3e84fc={};_0x3e84fc[_0xe299c3]={'$like':'%'+_0x713c70[_0x146d('0x40')][_0x146d('0x4e')]+'%'};return _0x3e84fc;})});}_0x48d633=_[_0x146d('0x4f')]({},_0x48d633,_0x713c70[_0x146d('0x52')]);return _0x13cd7c[_0x146d('0x5f')](_0x48d633);}})[_0x146d('0x23')](function(_0x6b5471){if(_0x6b5471){_0x533719=_0x6b5471[_0x146d('0x46')];if(!_0x713c70[_0x146d('0x40')]['hasOwnProperty'](_0x146d('0x48'))){_0x48d633[_0x146d('0x49')]=qs['limit'](_0x713c70['query'][_0x146d('0x49')]);_0x48d633[_0x146d('0x32')]=qs[_0x146d('0x32')](_0x713c70[_0x146d('0x40')]['offset']);}return _0x13cd7c[_0x146d('0x5f')](_0x48d633);}})['then'](function(_0x19e528){if(_0x19e528){return _0x19e528?{'count':_0x533719,'rows':_0x19e528}:null;}})[_0x146d('0x23')](respondWithResult(_0x4ff46c,null))[_0x146d('0x2d')](handleError(_0x4ff46c,null));};exports['getDescriptions']=function(_0x4b90c6,_0x22f4fd,_0x10605d){var _0x3428a2={};var _0x5632a9={};var _0x561f3e;var _0x145731;return db[_0x146d('0x3b')][_0x146d('0x5d')]({'where':{'id':_0x4b90c6[_0x146d('0x5b')]['id']}})[_0x146d('0x23')](handleEntityNotFound(_0x22f4fd,null))[_0x146d('0x23')](function(_0x216747){if(_0x216747){_0x561f3e=_0x216747;_0x5632a9['model']=_['keys'](db[_0x146d('0x5e')][_0x146d('0x3c')]);_0x5632a9[_0x146d('0x40')]=_['keys'](_0x4b90c6['query']);_0x5632a9[_0x146d('0x42')]=_[_0x146d('0x44')](_0x5632a9[_0x146d('0x3f')],_0x5632a9['query']);_0x3428a2[_0x146d('0x43')]=_['intersection'](_0x5632a9[_0x146d('0x3f')],qs['fields'](_0x4b90c6[_0x146d('0x40')][_0x146d('0x45')]));_0x3428a2[_0x146d('0x43')]=_0x3428a2[_0x146d('0x43')][_0x146d('0x46')]?_0x3428a2['attributes']:_0x5632a9['model'];_0x3428a2[_0x146d('0x4a')]=qs[_0x146d('0x4b')](_0x4b90c6[_0x146d('0x40')][_0x146d('0x4b')]);_0x3428a2[_0x146d('0x4c')]=qs['filters'](_[_0x146d('0x4d')](_0x4b90c6[_0x146d('0x40')],_0x5632a9[_0x146d('0x42')]));if(_0x4b90c6[_0x146d('0x40')]['filter']){_0x3428a2[_0x146d('0x4c')]=_[_0x146d('0x4f')](_0x3428a2[_0x146d('0x4c')],{'$or':_['map'](_0x3428a2[_0x146d('0x43')],function(_0x62c311){var _0x43a274={};_0x43a274[_0x62c311]={'$like':'%'+_0x4b90c6[_0x146d('0x40')][_0x146d('0x4e')]+'%'};return _0x43a274;})});}_0x3428a2=_[_0x146d('0x4f')]({},_0x3428a2,_0x4b90c6['options']);return _0x561f3e[_0x146d('0x60')](_0x3428a2);}})[_0x146d('0x23')](function(_0x2ff1ee){if(_0x2ff1ee){_0x145731=_0x2ff1ee[_0x146d('0x46')];if(!_0x4b90c6[_0x146d('0x40')][_0x146d('0x47')](_0x146d('0x48'))){_0x3428a2[_0x146d('0x49')]=qs[_0x146d('0x49')](_0x4b90c6[_0x146d('0x40')]['limit']);_0x3428a2[_0x146d('0x32')]=qs[_0x146d('0x32')](_0x4b90c6[_0x146d('0x40')][_0x146d('0x32')]);}return _0x561f3e[_0x146d('0x60')](_0x3428a2);}})[_0x146d('0x23')](function(_0x15f0ff){if(_0x15f0ff){return _0x15f0ff?{'count':_0x145731,'rows':_0x15f0ff}:null;}})[_0x146d('0x23')](respondWithResult(_0x22f4fd,null))['catch'](handleError(_0x22f4fd,null));}; \ No newline at end of file +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 diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index bf93cb7..b8caea9 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 _0x2eca=['define','SalesforceConfiguration','int_salesforce_configurations','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0xfb03e2,_0x5b8d93){var _0x15133a=function(_0x3a36da){while(--_0x3a36da){_0xfb03e2['push'](_0xfb03e2['shift']());}};_0x15133a(++_0x5b8d93);}(_0x2eca,0x18f));var _0xa2ec=function(_0x4ccde3,_0x38ca57){_0x4ccde3=_0x4ccde3-0x0;var _0x3348ac=_0x2eca[_0x4ccde3];return _0x3348ac;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa2ec('0x0'))('api');var moment=require(_0xa2ec('0x1'));var BPromise=require(_0xa2ec('0x2'));var rp=require(_0xa2ec('0x3'));var fs=require('fs');var path=require(_0xa2ec('0x4'));var rimraf=require(_0xa2ec('0x5'));var config=require(_0xa2ec('0x6'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0xa2ec('0x7')]=function(_0x3f368d,_0x105c66){return _0x3f368d[_0xa2ec('0x8')](_0xa2ec('0x9'),attributes,{'tableName':_0xa2ec('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index ef0bac0..6d0374f 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 _0x22ed=['SalesforceConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info'];(function(_0x4f8384,_0x203a58){var _0x7b65df=function(_0x22f6e2){while(--_0x22f6e2){_0x4f8384['push'](_0x4f8384['shift']());}};_0x7b65df(++_0x203a58);}(_0x22ed,0xdb));var _0xd22e=function(_0x96f8b4,_0x43e964){_0x96f8b4=_0x96f8b4-0x0;var _0x30b980=_0x22ed[_0x96f8b4];return _0x30b980;};'use strict';var _=require('lodash');var util=require(_0xd22e('0x0'));var moment=require(_0xd22e('0x1'));var BPromise=require(_0xd22e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd22e('0x3'));var db=require(_0xd22e('0x4'))['db'];var utils=require(_0xd22e('0x5'));var logger=require(_0xd22e('0x6'))(_0xd22e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd22e('0x8')][_0xd22e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d11c3,_0x6cb87d,_0x3babbe){return new BPromise(function(_0x1a4193,_0x2f5686){return client['request'](_0x4d11c3,_0x3babbe)[_0xd22e('0xa')](function(_0x3f1b2e){logger[_0xd22e('0xb')](_0xd22e('0xc'),_0x6cb87d,'request\x20sent');logger[_0xd22e('0xd')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x6cb87d,_0xd22e('0xe'),JSON[_0xd22e('0xf')](_0x3f1b2e));if(_0x3f1b2e[_0xd22e('0x10')]){if(_0x3f1b2e[_0xd22e('0x10')][_0xd22e('0x11')]===0x1f4){logger['error'](_0xd22e('0xc'),_0x6cb87d,_0x3f1b2e[_0xd22e('0x10')][_0xd22e('0x12')]);return _0x2f5686(_0x3f1b2e[_0xd22e('0x10')][_0xd22e('0x12')]);}logger['error'](_0xd22e('0xc'),_0x6cb87d,_0x3f1b2e[_0xd22e('0x10')][_0xd22e('0x12')]);return _0x1a4193(_0x3f1b2e[_0xd22e('0x10')][_0xd22e('0x12')]);}else{logger[_0xd22e('0xb')](_0xd22e('0xc'),_0x6cb87d,'request\x20sent');_0x1a4193(_0x3f1b2e[_0xd22e('0x13')][_0xd22e('0x12')]);}})[_0xd22e('0x14')](function(_0x4025a3){logger[_0xd22e('0x10')](_0xd22e('0xc'),_0x6cb87d,_0x4025a3);_0x2f5686(_0x4025a3);});});} \ No newline at end of file +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 diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 7838198..6a198e8 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 _0x4c60=['connect-timeout','Router','get','isAuthenticated','index','/:id','show','create','put','destroy','exports','multer','util','path'];(function(_0x120369,_0x253ad5){var _0x3b79af=function(_0xe450f2){while(--_0xe450f2){_0x120369['push'](_0x120369['shift']());}};_0x3b79af(++_0x253ad5);}(_0x4c60,0xc1));var _0x04c6=function(_0x1dbd58,_0x34a499){_0x1dbd58=_0x1dbd58-0x0;var _0x47bab0=_0x4c60[_0x1dbd58];return _0x47bab0;};'use strict';var multer=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var path=require(_0x04c6('0x2'));var timeout=require(_0x04c6('0x3'));var express=require('express');var router=express[_0x04c6('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSalesforceField.controller');router[_0x04c6('0x5')]('/',auth[_0x04c6('0x6')](),controller[_0x04c6('0x7')]);router[_0x04c6('0x5')](_0x04c6('0x8'),auth[_0x04c6('0x6')](),controller[_0x04c6('0x9')]);router['post']('/',auth[_0x04c6('0x6')](),controller[_0x04c6('0xa')]);router[_0x04c6('0xb')](_0x04c6('0x8'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x04c6('0x8'),auth['isAuthenticated'](),controller[_0x04c6('0xc')]);module[_0x04c6('0xd')]=router; \ No newline at end of file +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 diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 3b84100..427c9ff 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 _0xa06f=['variable','customVariable','string','STRING','ENUM','exports'];(function(_0x34c6d2,_0x9cc217){var _0x5626e4=function(_0x45d2d8){while(--_0x45d2d8){_0x34c6d2['push'](_0x34c6d2['shift']());}};_0x5626e4(++_0x9cc217);}(_0xa06f,0x161));var _0xfa06=function(_0x18c7d3,_0x314931){_0x18c7d3=_0x18c7d3-0x0;var _0xc183d=_0xa06f[_0x18c7d3];return _0xc183d;};'use strict';var Sequelize=require('sequelize');module[_0xfa06('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0xfa06('0x1'),_0xfa06('0x2'),'keyValue'),'defaultValue':_0xfa06('0x3')},'content':{'type':Sequelize[_0xfa06('0x4')]},'key':{'type':Sequelize[_0xfa06('0x4')]},'keyType':{'type':Sequelize[_0xfa06('0x5')](_0xfa06('0x3'),'variable',_0xfa06('0x2'))},'keyContent':{'type':Sequelize[_0xfa06('0x4')]},'idField':{'type':Sequelize[_0xfa06('0x4')]},'variableName':{'type':Sequelize[_0xfa06('0x4')]}}; \ No newline at end of file +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 diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index a964b0f..ac26f1c 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 _0x5f66=['merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','error','stack','name','index','map','SalesforceField','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x5f66[_0x4cf98e];return _0x1623ac;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x65f6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x65f6('0x1'));var jsonpatch=require(_0x65f6('0x2'));var rp=require(_0x65f6('0x3'));var moment=require(_0x65f6('0x4'));var BPromise=require(_0x65f6('0x5'));var Mustache=require('mustache');var util=require(_0x65f6('0x6'));var path=require('path');var sox=require(_0x65f6('0x7'));var csv=require(_0x65f6('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x8'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x65f6('0x13'))['db'];function respondWithStatusCode(_0x576875,_0x419819){_0x419819=_0x419819||0xcc;return function(_0x4862a5){if(_0x4862a5){return _0x576875[_0x65f6('0x14')](_0x419819);}return _0x576875[_0x65f6('0x15')](_0x419819)[_0x65f6('0x16')]();};}function respondWithResult(_0x217570,_0x369f96){_0x369f96=_0x369f96||0xc8;return function(_0x1d29fd){if(_0x1d29fd){return _0x217570[_0x65f6('0x15')](_0x369f96)[_0x65f6('0x17')](_0x1d29fd);}};}function respondWithFilteredResult(_0x46dbc6,_0x3440af){return function(_0x59154e){if(_0x59154e){var _0x19b9ff=_0x59154e[_0x65f6('0x18')],_0x49a913=_0x3440af[_0x65f6('0x19')],_0x5dd324=_0x3440af[_0x65f6('0x19')]+_0x3440af[_0x65f6('0x1a')],_0x1693e6;if(_0x5dd324>=_0x19b9ff){_0x5dd324=_0x19b9ff;_0x1693e6=0xc8;}else{_0x1693e6=0xce;}_0x46dbc6[_0x65f6('0x15')](_0x1693e6);return _0x46dbc6[_0x65f6('0x1b')](_0x65f6('0x1c'),_0x49a913+'-'+_0x5dd324+'/'+_0x19b9ff)['json'](_0x59154e);}return null;};}function patchUpdates(_0x4d79a1){return function(_0x2d538c){try{jsonpatch['apply'](_0x2d538c,_0x4d79a1,!![]);}catch(_0x4c81f3){return BPromise['reject'](_0x4c81f3);}return _0x2d538c[_0x65f6('0x1d')]();};}function saveUpdates(_0x21ea88,_0x5114a4){return function(_0x39e19f){if(_0x39e19f){return _0x39e19f[_0x65f6('0x1e')](_0x21ea88)[_0x65f6('0x1f')](function(_0x3876ed){return _0x3876ed;});}return null;};}function removeEntity(_0x219ab2,_0xc139c2){return function(_0x581374){if(_0x581374){return _0x581374[_0x65f6('0x20')]()['then'](function(){_0x219ab2['status'](0xcc)[_0x65f6('0x16')]();});}};}function handleEntityNotFound(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(!_0x1eeaaa){_0xd173f4[_0x65f6('0x14')](0x194);}return _0x1eeaaa;};}function handleError(_0x2317ce,_0x2774a1){_0x2774a1=_0x2774a1||0x1f4;return function(_0x4f5a69){logger[_0x65f6('0x21')](_0x4f5a69[_0x65f6('0x22')]);if(_0x4f5a69[_0x65f6('0x23')]){delete _0x4f5a69['name'];}_0x2317ce['status'](_0x2774a1)['send'](_0x4f5a69);};}exports[_0x65f6('0x24')]=function(_0x16cde8,_0x4b2292){var _0x296cd9={},_0x28f710={},_0x52277c={'count':0x0,'rows':[]};var _0x325cb4=_[_0x65f6('0x25')](db[_0x65f6('0x26')]['rawAttributes'],function(_0x4ac04b){return{'name':_0x4ac04b['fieldName'],'type':_0x4ac04b[_0x65f6('0x27')][_0x65f6('0x28')]};});_0x28f710[_0x65f6('0x29')]=_[_0x65f6('0x25')](_0x325cb4,_0x65f6('0x23'));_0x28f710[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](_0x16cde8['query']);_0x28f710['filters']=_[_0x65f6('0x2c')](_0x28f710[_0x65f6('0x29')],_0x28f710['query']);_0x296cd9['attributes']=_[_0x65f6('0x2c')](_0x28f710[_0x65f6('0x29')],qs[_0x65f6('0x2d')](_0x16cde8[_0x65f6('0x2a')][_0x65f6('0x2d')]));_0x296cd9[_0x65f6('0x2e')]=_0x296cd9['attributes'][_0x65f6('0x2f')]?_0x296cd9[_0x65f6('0x2e')]:_0x28f710[_0x65f6('0x29')];if(!_0x16cde8['query'][_0x65f6('0x30')](_0x65f6('0x31'))){_0x296cd9[_0x65f6('0x1a')]=qs[_0x65f6('0x1a')](_0x16cde8[_0x65f6('0x2a')][_0x65f6('0x1a')]);_0x296cd9['offset']=qs[_0x65f6('0x19')](_0x16cde8[_0x65f6('0x2a')]['offset']);}_0x296cd9[_0x65f6('0x32')]=qs['sort'](_0x16cde8[_0x65f6('0x2a')]['sort']);_0x296cd9[_0x65f6('0x33')]=qs[_0x65f6('0x34')](_['pick'](_0x16cde8[_0x65f6('0x2a')],_0x28f710[_0x65f6('0x34')]));if(_0x16cde8[_0x65f6('0x2a')]['filter']){_0x296cd9['where']=_[_0x65f6('0x35')](_0x296cd9['where'],{'$or':_[_0x65f6('0x25')](_0x325cb4,function(_0x4e6653){if(_0x4e6653[_0x65f6('0x27')]!==_0x65f6('0x36')){var _0x5e97f1={};_0x5e97f1[_0x4e6653[_0x65f6('0x23')]]={'$like':'%'+_0x16cde8['query']['filter']+'%'};return _0x5e97f1;}})});}_0x296cd9=_[_0x65f6('0x35')]({},_0x296cd9,_0x16cde8[_0x65f6('0x37')]);var _0x413956={'where':_0x296cd9[_0x65f6('0x33')]};return db[_0x65f6('0x26')][_0x65f6('0x18')](_0x413956)[_0x65f6('0x1f')](function(_0x1153f1){_0x52277c['count']=_0x1153f1;if(_0x16cde8[_0x65f6('0x2a')]['includeAll']){_0x296cd9[_0x65f6('0x38')]=[{'all':!![]}];}return db[_0x65f6('0x26')][_0x65f6('0x39')](_0x296cd9);})[_0x65f6('0x1f')](function(_0x5ef5c2){_0x52277c[_0x65f6('0x3a')]=_0x5ef5c2;return _0x52277c;})[_0x65f6('0x1f')](respondWithFilteredResult(_0x4b2292,_0x296cd9))[_0x65f6('0x3b')](handleError(_0x4b2292,null));};exports[_0x65f6('0x3c')]=function(_0x81fd69,_0x3f6103){var _0xed4c96={'raw':!![],'where':{'id':_0x81fd69[_0x65f6('0x3d')]['id']}},_0x2acca5={};_0x2acca5['model']=_[_0x65f6('0x2b')](db[_0x65f6('0x26')][_0x65f6('0x3e')]);_0x2acca5[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](_0x81fd69[_0x65f6('0x2a')]);_0x2acca5[_0x65f6('0x34')]=_[_0x65f6('0x2c')](_0x2acca5[_0x65f6('0x29')],_0x2acca5[_0x65f6('0x2a')]);_0xed4c96[_0x65f6('0x2e')]=_[_0x65f6('0x2c')](_0x2acca5[_0x65f6('0x29')],qs[_0x65f6('0x2d')](_0x81fd69[_0x65f6('0x2a')][_0x65f6('0x2d')]));_0xed4c96['attributes']=_0xed4c96[_0x65f6('0x2e')][_0x65f6('0x2f')]?_0xed4c96[_0x65f6('0x2e')]:_0x2acca5[_0x65f6('0x29')];if(_0x81fd69['query'][_0x65f6('0x3f')]){_0xed4c96[_0x65f6('0x38')]=[{'all':!![]}];}_0xed4c96=_[_0x65f6('0x35')]({},_0xed4c96,_0x81fd69['options']);return db[_0x65f6('0x26')][_0x65f6('0x40')](_0xed4c96)[_0x65f6('0x1f')](handleEntityNotFound(_0x3f6103,null))[_0x65f6('0x1f')](respondWithResult(_0x3f6103,null))['catch'](handleError(_0x3f6103,null));};exports[_0x65f6('0x41')]=function(_0x512527,_0x3f1baa){return db[_0x65f6('0x26')]['create'](_0x512527[_0x65f6('0x42')],{})['then'](respondWithResult(_0x3f1baa,0xc9))[_0x65f6('0x3b')](handleError(_0x3f1baa,null));};exports[_0x65f6('0x1e')]=function(_0x2d1706,_0xc0db01){if(_0x2d1706[_0x65f6('0x42')]['id']){delete _0x2d1706[_0x65f6('0x42')]['id'];}return db['SalesforceField']['find']({'where':{'id':_0x2d1706[_0x65f6('0x3d')]['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0xc0db01,null))[_0x65f6('0x1f')](saveUpdates(_0x2d1706[_0x65f6('0x42')],null))[_0x65f6('0x1f')](respondWithResult(_0xc0db01,null))[_0x65f6('0x3b')](handleError(_0xc0db01,null));};exports[_0x65f6('0x20')]=function(_0x41690c,_0x414f49){return db['SalesforceField'][_0x65f6('0x40')]({'where':{'id':_0x41690c[_0x65f6('0x3d')]['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0x414f49,null))['then'](removeEntity(_0x414f49,null))[_0x65f6('0x3b')](handleError(_0x414f49,null));}; \ No newline at end of file +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 diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 003384d..af9b813 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 _0xe60e=['moment','bluebird','request-promise','path','rimraf','./intSalesforceField.attributes','exports','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','lodash','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe60e,0x10a));var _0xee60=function(_0x43d12c,_0x1152c6){_0x43d12c=_0x43d12c-0x0;var _0x165d73=_0xe60e[_0x43d12c];return _0x165d73;};'use strict';var _=require(_0xee60('0x0'));var util=require(_0xee60('0x1'));var logger=require(_0xee60('0x2'))(_0xee60('0x3'));var moment=require(_0xee60('0x4'));var BPromise=require(_0xee60('0x5'));var rp=require(_0xee60('0x6'));var fs=require('fs');var path=require(_0xee60('0x7'));var rimraf=require(_0xee60('0x8'));var config=require('../../config/environment');var attributes=require(_0xee60('0x9'));module[_0xee60('0xa')]=function(_0x3d35f7,_0x595ec1){return _0x3d35f7['define'](_0xee60('0xb'),attributes,{'tableName':_0xee60('0xc'),'paranoid':![],'indexes':[{'name':_0xee60('0xd'),'fields':[_0xee60('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 3447e02..057951f 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 _0x9ffd=['SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SalesforceField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x461bd7,_0x59d6e8){var _0x817a93=function(_0x42d61f){while(--_0x42d61f){_0x461bd7['push'](_0x461bd7['shift']());}};_0x817a93(++_0x59d6e8);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x454169,_0x2145c9){_0x454169=_0x454169-0x0;var _0x10ce92=_0x9ffd[_0x454169];return _0x10ce92;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('SalesforceField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('SalesforceField,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('SalesforceField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file +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 diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 09bdabb..7d3cfe9 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 _0x4c9e=['delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations'];(function(_0x2dc702,_0x58be33){var _0xfd7115=function(_0x5ccf51){while(--_0x5ccf51){_0x2dc702['push'](_0x2dc702['shift']());}};_0xfd7115(++_0x58be33);}(_0x4c9e,0x145));var _0xe4c9=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x4c9e[_0x18a79d];return _0x4f8848;};'use strict';var multer=require('multer');var util=require(_0xe4c9('0x0'));var path=require(_0xe4c9('0x1'));var timeout=require(_0xe4c9('0x2'));var express=require(_0xe4c9('0x3'));var router=express[_0xe4c9('0x4')]();var auth=require(_0xe4c9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe4c9('0x6'));var controller=require('./intServicenowAccount.controller');router[_0xe4c9('0x7')]('/',auth['isAuthenticated'](),controller[_0xe4c9('0x8')]);router['get'](_0xe4c9('0x9'),auth[_0xe4c9('0xa')](),controller['show']);router[_0xe4c9('0x7')]('/:id/configurations',auth[_0xe4c9('0xa')](),controller[_0xe4c9('0xb')]);router['get'](_0xe4c9('0xc'),auth[_0xe4c9('0xa')](),controller[_0xe4c9('0xd')]);router[_0xe4c9('0xe')]('/',auth[_0xe4c9('0xa')](),controller[_0xe4c9('0xf')]);router[_0xe4c9('0xe')](_0xe4c9('0x10'),auth[_0xe4c9('0xa')](),controller['addConfiguration']);router['put'](_0xe4c9('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xe4c9('0x11')](_0xe4c9('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xe4c9('0x12')]=router; \ No newline at end of file +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 diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 7aea0f9..407d7f9 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 _0x40e6=['username','remoteUri','STRING'];(function(_0x44044a,_0x3a0097){var _0x43bb6e=function(_0x1afe12){while(--_0x1afe12){_0x44044a['push'](_0x44044a['shift']());}};_0x43bb6e(++_0x3a0097);}(_0x40e6,0x1ca));var _0x640e=function(_0x970068,_0x3e4142){_0x970068=_0x970068-0x0;var _0x51063d=_0x40e6[_0x970068];return _0x51063d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x640e('0x0')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x640e('0x1')},'password':{'type':Sequelize[_0x640e('0x0')]},'email':{'type':Sequelize[_0x640e('0x0')]},'remoteUri':{'type':Sequelize[_0x640e('0x0')],'unique':_0x640e('0x2')},'serverUrl':{'type':Sequelize[_0x640e('0x0')]}}; \ No newline at end of file +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 diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 1b384ba..7f0d489 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 _0xc49a=['count','include','findAll','rows','params','keys','includeAll','merge','options','catch','create','body','find','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','ServicenowField','made_sla','hold_reason','subcategory','close_code','notify','incident_state','severity','parent','caused_by','watch_list','upon_reject','sys_updated_on','resolved_by','sys_updated_by','opened_by','sys_created_on','state','sys_created_by','knowledge','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','correlation_display','delivery_task','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','parent_incident','sys_id','contact_type','urgency','reassignment_count','assigned_to','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','upon_approval','correlation_id','location','category','username','password','remoteUri','serverUrl','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','incident?sysparm_display_value=all','result','log','assign','remove','includes','forEach','internalType','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','statusCode','Wrong\x20credentials','boolean','True','true','false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','value','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','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','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','end','status','json','offset','limit','Content-Range','apply','save','update','destroy','stack','name','send','index','map','ServicenowAccount','rawAttributes','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','type','VIRTUAL','filter'];(function(_0x3c1b5c,_0x23a5ec){var _0x4da83d=function(_0x55787d){while(--_0x55787d){_0x3c1b5c['push'](_0x3c1b5c['shift']());}};_0x4da83d(++_0x23a5ec);}(_0xc49a,0x77));var _0xac49=function(_0x312dd5,_0x27f503){_0x312dd5=_0x312dd5-0x0;var _0x3e330f=_0xc49a[_0x312dd5];return _0x3e330f;};'use strict';var pdf=require(_0xac49('0x0'));var emlformat=require(_0xac49('0x1'));var rimraf=require(_0xac49('0x2'));var zipdir=require(_0xac49('0x3'));var jsonpatch=require(_0xac49('0x4'));var rp=require(_0xac49('0x5'));var moment=require('moment');var BPromise=require(_0xac49('0x6'));var Mustache=require(_0xac49('0x7'));var util=require(_0xac49('0x8'));var path=require(_0xac49('0x9'));var sox=require('sox');var csv=require(_0xac49('0xa'));var ejs=require(_0xac49('0xb'));var fs=require('fs');var _=require(_0xac49('0xc'));var squel=require('squel');var crypto=require(_0xac49('0xd'));var jsforce=require(_0xac49('0xe'));var deskjs=require(_0xac49('0xf'));var toCsv=require(_0xac49('0xa'));var querystring=require(_0xac49('0x10'));var Papa=require(_0xac49('0x11'));var Redis=require(_0xac49('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xac49('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xac49('0x14'));var logger=require(_0xac49('0x15'))(_0xac49('0x16'));var utils=require(_0xac49('0x17'));var config=require(_0xac49('0x18'));var db=require(_0xac49('0x19'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xac49('0x1a'));var client=jayson['client'][_0xac49('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x53c35f,_0x3330a9,_0x3b7678){if(_0x3b7678){var _0x37d799=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x37d799[_0xac49('0x1c')](_0x3330a9)){return _0x53c35f;}else{throw new db[(_0xac49('0x1d'))][(_0xac49('0x1e'))](_0xac49('0x1f'));}}else{return _0x53c35f;}}function respondWithRpcPromise(_0x2ffb9e,_0x47f16d,_0x38b42c,_0x4b548b){return new BPromise(function(_0x594a22,_0xf8c800){var _0x1721c3=_0x4b548b||client;return _0x1721c3[_0xac49('0x20')](_0x2ffb9e,_0x38b42c)[_0xac49('0x21')](function(_0x8afc9a){logger[_0xac49('0x22')](_0xac49('0x23'),_0x47f16d,_0xac49('0x24'));logger[_0xac49('0x25')](_0xac49('0x26'),_0x47f16d,_0xac49('0x24'),JSON['stringify'](_0x8afc9a));if(_0x8afc9a[_0xac49('0x27')]){if(_0x8afc9a[_0xac49('0x27')][_0xac49('0x28')]===0x1f4){logger[_0xac49('0x27')](_0xac49('0x23'),_0x47f16d,_0x8afc9a['error'][_0xac49('0x29')]);return _0xf8c800(_0x8afc9a[_0xac49('0x27')][_0xac49('0x29')]);}logger[_0xac49('0x27')](_0xac49('0x23'),_0x47f16d,_0x8afc9a[_0xac49('0x27')]['message']);return _0x594a22(_0x8afc9a[_0xac49('0x27')][_0xac49('0x29')]);}else{logger[_0xac49('0x22')](_0xac49('0x23'),_0x47f16d,_0xac49('0x24'));_0x594a22(_0x8afc9a['result'][_0xac49('0x29')]);}})['catch'](function(_0x1270c7){logger[_0xac49('0x27')](_0xac49('0x23'),_0x47f16d,_0x1270c7);_0xf8c800(_0x1270c7);});});}function respondWithStatusCode(_0x394e13,_0x5b36a3){_0x5b36a3=_0x5b36a3||0xcc;return function(_0x5a139d){if(_0x5a139d){return _0x394e13[_0xac49('0x2a')](_0x5b36a3);}return _0x394e13['status'](_0x5b36a3)[_0xac49('0x2b')]();};}function respondWithResult(_0x4ff987,_0x110a7e){_0x110a7e=_0x110a7e||0xc8;return function(_0x27841c){if(_0x27841c){return _0x4ff987[_0xac49('0x2c')](_0x110a7e)[_0xac49('0x2d')](_0x27841c);}};}function respondWithFilteredResult(_0x7a3e9c,_0x3fceb8){return function(_0x3fc6b2){if(_0x3fc6b2){var _0x11fed7=_0x3fc6b2['count'],_0xe2fcde=_0x3fceb8[_0xac49('0x2e')],_0x56de6d=_0x3fceb8['offset']+_0x3fceb8[_0xac49('0x2f')],_0x37fe46;if(_0x56de6d>=_0x11fed7){_0x56de6d=_0x11fed7;_0x37fe46=0xc8;}else{_0x37fe46=0xce;}_0x7a3e9c['status'](_0x37fe46);return _0x7a3e9c['set'](_0xac49('0x30'),_0xe2fcde+'-'+_0x56de6d+'/'+_0x11fed7)[_0xac49('0x2d')](_0x3fc6b2);}return null;};}function patchUpdates(_0x2fa53b){return function(_0x590733){try{jsonpatch[_0xac49('0x31')](_0x590733,_0x2fa53b,!![]);}catch(_0x1a352b){return BPromise['reject'](_0x1a352b);}return _0x590733[_0xac49('0x32')]();};}function saveUpdates(_0x46d13d,_0x208a68){return function(_0xf78c09){if(_0xf78c09){return _0xf78c09[_0xac49('0x33')](_0x46d13d)[_0xac49('0x21')](function(_0x5c444f){return _0x5c444f;});}return null;};}function removeEntity(_0x3669fc,_0x57c86e){return function(_0xae060){if(_0xae060){return _0xae060[_0xac49('0x34')]()[_0xac49('0x21')](function(){_0x3669fc[_0xac49('0x2c')](0xcc)[_0xac49('0x2b')]();});}};}function handleEntityNotFound(_0x2f1c67,_0x4afe45){return function(_0x206f55){if(!_0x206f55){_0x2f1c67[_0xac49('0x2a')](0x194);}return _0x206f55;};}function handleError(_0xb2b315,_0x8e1204){_0x8e1204=_0x8e1204||0x1f4;return function(_0x1e86b0){logger[_0xac49('0x27')](_0x1e86b0[_0xac49('0x35')]);if(_0x1e86b0[_0xac49('0x36')]){delete _0x1e86b0[_0xac49('0x36')];}_0xb2b315[_0xac49('0x2c')](_0x8e1204)[_0xac49('0x37')](_0x1e86b0);};}exports[_0xac49('0x38')]=function(_0x25eee8,_0x15e555){var _0xaaef93={},_0x3e555e={},_0x5bed3a={'count':0x0,'rows':[]};var _0x1bc324=_[_0xac49('0x39')](db[_0xac49('0x3a')][_0xac49('0x3b')],function(_0x3457b8){return{'name':_0x3457b8['fieldName'],'type':_0x3457b8['type'][_0xac49('0x3c')]};});_0x3e555e[_0xac49('0x3d')]=_[_0xac49('0x39')](_0x1bc324,_0xac49('0x36'));_0x3e555e[_0xac49('0x3e')]=_['keys'](_0x25eee8['query']);_0x3e555e['filters']=_['intersection'](_0x3e555e['model'],_0x3e555e[_0xac49('0x3e')]);_0xaaef93[_0xac49('0x3f')]=_[_0xac49('0x40')](_0x3e555e[_0xac49('0x3d')],qs[_0xac49('0x41')](_0x25eee8[_0xac49('0x3e')][_0xac49('0x41')]));_0xaaef93[_0xac49('0x3f')]=_0xaaef93[_0xac49('0x3f')][_0xac49('0x42')]?_0xaaef93[_0xac49('0x3f')]:_0x3e555e[_0xac49('0x3d')];if(!_0x25eee8[_0xac49('0x3e')][_0xac49('0x43')](_0xac49('0x44'))){_0xaaef93['limit']=qs['limit'](_0x25eee8[_0xac49('0x3e')]['limit']);_0xaaef93[_0xac49('0x2e')]=qs[_0xac49('0x2e')](_0x25eee8[_0xac49('0x3e')][_0xac49('0x2e')]);}_0xaaef93[_0xac49('0x45')]=qs[_0xac49('0x46')](_0x25eee8[_0xac49('0x3e')][_0xac49('0x46')]);_0xaaef93[_0xac49('0x47')]=qs[_0xac49('0x48')](_[_0xac49('0x49')](_0x25eee8[_0xac49('0x3e')],_0x3e555e[_0xac49('0x48')]));if(_0x25eee8['query']['filter']){_0xaaef93['where']=_['merge'](_0xaaef93[_0xac49('0x47')],{'$or':_[_0xac49('0x39')](_0x1bc324,function(_0x1b382e){if(_0x1b382e[_0xac49('0x4a')]!==_0xac49('0x4b')){var _0x2ac57a={};_0x2ac57a[_0x1b382e[_0xac49('0x36')]]={'$like':'%'+_0x25eee8[_0xac49('0x3e')][_0xac49('0x4c')]+'%'};return _0x2ac57a;}})});}_0xaaef93=_['merge']({},_0xaaef93,_0x25eee8['options']);var _0x21ddde={'where':_0xaaef93[_0xac49('0x47')]};return db[_0xac49('0x3a')][_0xac49('0x4d')](_0x21ddde)[_0xac49('0x21')](function(_0x257e3a){_0x5bed3a[_0xac49('0x4d')]=_0x257e3a;if(_0x25eee8['query']['includeAll']){_0xaaef93[_0xac49('0x4e')]=[{'all':!![]}];}return db[_0xac49('0x3a')][_0xac49('0x4f')](_0xaaef93);})['then'](function(_0x300407){_0x5bed3a[_0xac49('0x50')]=_0x300407;return _0x5bed3a;})['then'](respondWithFilteredResult(_0x15e555,_0xaaef93))['catch'](handleError(_0x15e555,null));};exports['show']=function(_0x2c49e1,_0x3e5f5d){var _0x607302={'raw':![],'where':{'id':_0x2c49e1[_0xac49('0x51')]['id']}},_0x287b55={};_0x287b55['model']=_[_0xac49('0x52')](db['ServicenowAccount'][_0xac49('0x3b')]);_0x287b55[_0xac49('0x3e')]=_['keys'](_0x2c49e1[_0xac49('0x3e')]);_0x287b55['filters']=_[_0xac49('0x40')](_0x287b55[_0xac49('0x3d')],_0x287b55[_0xac49('0x3e')]);_0x607302[_0xac49('0x3f')]=_[_0xac49('0x40')](_0x287b55['model'],qs[_0xac49('0x41')](_0x2c49e1[_0xac49('0x3e')][_0xac49('0x41')]));_0x607302[_0xac49('0x3f')]=_0x607302[_0xac49('0x3f')]['length']?_0x607302[_0xac49('0x3f')]:_0x287b55['model'];if(_0x2c49e1[_0xac49('0x3e')][_0xac49('0x53')]){_0x607302[_0xac49('0x4e')]=[{'all':!![]}];}_0x607302=_[_0xac49('0x54')]({},_0x607302,_0x2c49e1[_0xac49('0x55')]);return db[_0xac49('0x3a')]['find'](_0x607302)[_0xac49('0x21')](handleEntityNotFound(_0x3e5f5d,null))['then'](respondWithResult(_0x3e5f5d,null))[_0xac49('0x56')](handleError(_0x3e5f5d,null));};exports[_0xac49('0x57')]=function(_0x664e8e,_0xb95008){return db[_0xac49('0x3a')][_0xac49('0x57')](_0x664e8e['body'],{})[_0xac49('0x21')](respondWithResult(_0xb95008,0xc9))['catch'](handleError(_0xb95008,null));};exports[_0xac49('0x33')]=function(_0x16c248,_0x4e0b54){if(_0x16c248[_0xac49('0x58')]['id']){delete _0x16c248['body']['id'];}return db[_0xac49('0x3a')][_0xac49('0x59')]({'where':{'id':_0x16c248[_0xac49('0x51')]['id']}})['then'](handleEntityNotFound(_0x4e0b54,null))['then'](saveUpdates(_0x16c248[_0xac49('0x58')],null))['then'](respondWithResult(_0x4e0b54,null))[_0xac49('0x56')](handleError(_0x4e0b54,null));};exports[_0xac49('0x34')]=function(_0x23b140,_0x62edf6){return db[_0xac49('0x3a')][_0xac49('0x59')]({'where':{'id':_0x23b140[_0xac49('0x51')]['id']}})[_0xac49('0x21')](handleEntityNotFound(_0x62edf6,null))[_0xac49('0x21')](removeEntity(_0x62edf6,null))['catch'](handleError(_0x62edf6,null));};exports[_0xac49('0x5a')]=function(_0x3ee110,_0x176670,_0x44f25e){var _0x2fb3a6={};var _0x4d7371={};var _0x2c29a8;var _0x1ac8ac;return db[_0xac49('0x3a')][_0xac49('0x5b')]({'where':{'id':_0x3ee110[_0xac49('0x51')]['id']}})['then'](handleEntityNotFound(_0x176670,null))[_0xac49('0x21')](function(_0x198daf){if(_0x198daf){_0x2c29a8=_0x198daf;_0x4d7371[_0xac49('0x3d')]=_[_0xac49('0x52')](db[_0xac49('0x5c')][_0xac49('0x3b')]);_0x4d7371['query']=_[_0xac49('0x52')](_0x3ee110['query']);_0x4d7371[_0xac49('0x48')]=_[_0xac49('0x40')](_0x4d7371[_0xac49('0x3d')],_0x4d7371['query']);_0x2fb3a6[_0xac49('0x3f')]=_[_0xac49('0x40')](_0x4d7371[_0xac49('0x3d')],qs[_0xac49('0x41')](_0x3ee110[_0xac49('0x3e')][_0xac49('0x41')]));_0x2fb3a6[_0xac49('0x3f')]=_0x2fb3a6[_0xac49('0x3f')][_0xac49('0x42')]?_0x2fb3a6[_0xac49('0x3f')]:_0x4d7371[_0xac49('0x3d')];_0x2fb3a6[_0xac49('0x45')]=qs[_0xac49('0x46')](_0x3ee110[_0xac49('0x3e')]['sort']);_0x2fb3a6['where']=qs[_0xac49('0x48')](_[_0xac49('0x49')](_0x3ee110[_0xac49('0x3e')],_0x4d7371['filters']));if(_0x3ee110[_0xac49('0x3e')][_0xac49('0x4c')]){_0x2fb3a6[_0xac49('0x47')]=_[_0xac49('0x54')](_0x2fb3a6[_0xac49('0x47')],{'$or':_[_0xac49('0x39')](_0x2fb3a6[_0xac49('0x3f')],function(_0x8c48){var _0x3ae938={};_0x3ae938[_0x8c48]={'$like':'%'+_0x3ee110['query']['filter']+'%'};return _0x3ae938;})});}_0x2fb3a6=_[_0xac49('0x54')]({},_0x2fb3a6,_0x3ee110['options']);return _0x2c29a8[_0xac49('0x5a')](_0x2fb3a6);}})[_0xac49('0x21')](function(_0x4b9043){if(_0x4b9043){_0x1ac8ac=_0x4b9043[_0xac49('0x42')];if(!_0x3ee110['query'][_0xac49('0x43')](_0xac49('0x44'))){_0x2fb3a6['limit']=qs[_0xac49('0x2f')](_0x3ee110[_0xac49('0x3e')]['limit']);_0x2fb3a6['offset']=qs['offset'](_0x3ee110[_0xac49('0x3e')][_0xac49('0x2e')]);}return _0x2c29a8[_0xac49('0x5a')](_0x2fb3a6);}})['then'](function(_0x3641b8){if(_0x3641b8){return _0x3641b8?{'count':_0x1ac8ac,'rows':_0x3641b8}:null;}})[_0xac49('0x21')](respondWithResult(_0x176670,null))[_0xac49('0x56')](handleError(_0x176670,null));};exports[_0xac49('0x5d')]=function(_0xa5b922,_0x789a67,_0x2caa24){if(_0xa5b922[_0xac49('0x58')]['id']){delete _0xa5b922[_0xac49('0x58')]['id'];}return db[_0xac49('0x3a')][_0xac49('0x5b')]({'where':{'id':_0xa5b922['params']['id']}})[_0xac49('0x21')](handleEntityNotFound(_0x789a67,null))[_0xac49('0x21')](function(_0x3ae7f3){if(_0x3ae7f3){_0xa5b922[_0xac49('0x58')]['AccountId']=_0x3ae7f3['id'];_0xa5b922[_0xac49('0x58')][_0xac49('0x5e')]=integrations[_0xac49('0x5f')](_0xa5b922[_0xac49('0x58')]['channel'],_0xa5b922[_0xac49('0x58')][_0xac49('0x4a')]);_0xa5b922[_0xac49('0x58')][_0xac49('0x60')]=integrations[_0xac49('0x61')](_0xa5b922[_0xac49('0x58')]['channel'],_0xa5b922['body'][_0xac49('0x4a')]);return db[_0xac49('0x5c')][_0xac49('0x57')](_0xa5b922[_0xac49('0x58')],{'include':[{'model':db['ServicenowField'],'as':_0xac49('0x5e')},{'model':db[_0xac49('0x62')],'as':_0xac49('0x60')}]});}return null;})['then'](respondWithResult(_0x789a67,null))[_0xac49('0x56')](handleError(_0x789a67,null));};exports['getFields']=function(_0x433ef7,_0x65ce08,_0x6ac6c1){var _0x27277f=[_0xac49('0x63'),_0xac49('0x64'),'knowledge',_0xac49('0x65'),_0xac49('0x66'),_0xac49('0x67'),_0xac49('0x68'),_0xac49('0x69'),'category'];var _0x5e72e5=[_0xac49('0x6a'),_0xac49('0x63'),_0xac49('0x6b'),_0xac49('0x6c'),_0xac49('0x6d'),_0xac49('0x6e'),'child_incidents',_0xac49('0x64'),'approval_history','number',_0xac49('0x6f'),_0xac49('0x70'),_0xac49('0x71'),'user_input',_0xac49('0x72'),'sys_domain',_0xac49('0x73'),_0xac49('0x74'),_0xac49('0x75'),_0xac49('0x45'),_0xac49('0x76'),_0xac49('0x77'),_0xac49('0x78'),_0xac49('0x79'),_0xac49('0x7a'),'active',_0xac49('0x7b'),_0xac49('0x7c'),_0xac49('0x7d'),_0xac49('0x7e'),_0xac49('0x7f'),_0xac49('0x80'),_0xac49('0x81'),_0xac49('0x82'),'business_duration',_0xac49('0x83'),_0xac49('0x84'),_0xac49('0x85'),_0xac49('0x86'),_0xac49('0x87'),_0xac49('0x88'),_0xac49('0x65'),'work_notes','short_description',_0xac49('0x66'),_0xac49('0x89'),_0xac49('0x8a'),'work_start',_0xac49('0x8b'),_0xac49('0x8c'),_0xac49('0x8d'),_0xac49('0x8e'),_0xac49('0x8f'),_0xac49('0x67'),_0xac49('0x90'),_0xac49('0x91'),_0xac49('0x92'),'follow_up',_0xac49('0x93'),_0xac49('0x94'),_0xac49('0x95'),'reopened_by','incident_state',_0xac49('0x96'),'problem_id','company',_0xac49('0x97'),'activity_due',_0xac49('0x98'),_0xac49('0x69'),'comments',_0xac49('0x99'),_0xac49('0x9a'),_0xac49('0x9b'),_0xac49('0x9c'),_0xac49('0x9d'),_0xac49('0x9e'),_0xac49('0x9f'),'escalation',_0xac49('0xa0'),_0xac49('0xa1'),_0xac49('0xa2'),_0xac49('0xa3')];var _0x39f9ce='';var _0x1f0f5c='';var _0x40efd0=[];var _0x5904cc='';var _0x161d83='';var _0x2bcbea=[];var _0x9db0ef='';var _0x18314e='';var _0x3a8a44={};var _0x4b22f4='';return db[_0xac49('0x3a')][_0xac49('0x5b')]({'where':{'id':_0x433ef7['params']['id']},'attributes':['id',_0xac49('0xa4'),_0xac49('0xa5'),'email',_0xac49('0xa6'),_0xac49('0xa7')]})['then'](handleEntityNotFound(_0x65ce08,null))[_0xac49('0x21')](function(_0x4a52f7){if(_0x4a52f7){_0x4b22f4=_0x4a52f7['remoteUri'];var _0x4e0322=_0x4b22f4[_0xac49('0xa8')](-0x1);if(_0x4e0322==='/'){_0x4b22f4=_0x4b22f4[_0xac49('0xa9')](0x0,_0x4b22f4[_0xac49('0xaa')](_0x4e0322));}_0x18314e=util['format'](_0xac49('0xab'),_0x4b22f4);_0x9db0ef=util[_0xac49('0xac')]('%s/api/now/table/',_0x4b22f4);_0x3a8a44={'user':_0x4a52f7[_0xac49('0xa4')],'pass':_0x4a52f7[_0xac49('0xa5')]};var _0x39bc1f={'method':'GET','uri':_0x18314e+_0xac49('0xad'),'auth':_0x3a8a44,'json':!![]};return rp(_0x39bc1f);}})[_0xac49('0x21')](function(_0x1b22ec){if(_0x1b22ec[_0xac49('0xae')][_0xac49('0x42')]>0x0){_0x39f9ce=_0x1b22ec[_0xac49('0xae')];}console[_0xac49('0xaf')]('incident\x20table\x20objects',_0x39f9ce);_0x2bcbea=[];_0x1f0f5c=Object[_0xac49('0xb0')]([],_0x39f9ce);_[_0xac49('0xb1')](_0x1f0f5c,function(_0x1535a1){return!_0x27277f[_0xac49('0xb2')](_0x1535a1[_0xac49('0x36')]);});_0x1f0f5c[_0xac49('0xb3')](function(_0x27f610){var _0x1fd6d1=createFieldObject(_0x9db0ef,_0x3a8a44,_0x27f610[_0xac49('0xb4')],_0x27f610['name'],_0x27f610['label'],![]);_0x2bcbea[_0xac49('0xb5')](_0x1fd6d1);});return Promise[_0xac49('0xb6')](_0x2bcbea);})[_0xac49('0x21')](function(_0x339f91){_0x40efd0=_0x339f91;_0x5904cc=Object[_0xac49('0xb0')]([],_0x39f9ce);console[_0xac49('0xaf')](_0xac49('0xb7'),_0x39f9ce);_[_0xac49('0xb1')](_0x5904cc,function(_0x339617){return _0x5e72e5['includes'](_0x339617[_0xac49('0x36')]);});console[_0xac49('0xaf')](_0xac49('0xb8'),_0x5904cc);_0x2bcbea=[];_0x5904cc[_0xac49('0xb3')](function(_0x5136b5){var _0x2c43e5=createFieldObject(_0x9db0ef,_0x3a8a44,_0x5136b5[_0xac49('0xb4')],_0x5136b5[_0xac49('0x36')],_0x5136b5['label'],!![]);_0x2bcbea[_0xac49('0xb5')](_0x2c43e5);});return Promise[_0xac49('0xb6')](_0x2bcbea);})[_0xac49('0x21')](function(_0x2de74e){_0x161d83=_0x2de74e;var _0x3fdc24=_0x40efd0[_0xac49('0xb9')](_0x161d83);return{'count':_0x3fdc24[_0xac49('0x42')],'rows':_0x3fdc24};})[_0xac49('0x21')](respondWithResult(_0x65ce08,null))[_0xac49('0x56')](function(_0xf2cf80){console[_0xac49('0xaf')]('ServiceNow\x20error:\x20'+_0xf2cf80);var _0x215fdd=_0x433ef7[_0xac49('0x3e')][_0xac49('0x1c')]?0x1f4:_0xf2cf80[_0xac49('0xba')]||0x1f4;logger['error'](_0xf2cf80[_0xac49('0x35')]);delete _0xf2cf80['name'];if(_0x215fdd===0x191){_0x215fdd=0x190;}_0x65ce08[_0xac49('0x2c')](_0x215fdd)['send'](_0x433ef7['query'][_0xac49('0x1c')]?{'message':_0xac49('0xbb'),'statusCode':_0xf2cf80[_0xac49('0xba')]}:_0xf2cf80);});};function createFieldObject(_0xbd2725,_0xef3c2d,_0x421cf7,_0x2431b9,_0x578b88,_0x5f0f5b){return new Promise(function(_0x5495da,_0x3ac153){var _0x1ef7bb={'id':_0x2431b9,'name':_0x578b88,'custom':_0x5f0f5b};if(_0x421cf7===_0xac49('0xbc')){_0x1ef7bb[_0xac49('0x55')]=[{'name':_0xac49('0xbd'),'value':_0xac49('0xbe')},{'name':'False','value':_0xac49('0xbf')}];_0x5495da(_0x1ef7bb);}else{var _0x4f4bdf={'method':_0xac49('0xc0'),'uri':_0xbd2725+_0xac49('0xc1')+_0x2431b9,'auth':_0xef3c2d,'json':!![]};return rp(_0x4f4bdf)[_0xac49('0x21')](function(_0x2c9bd8){var _0x2cac7c=[];if(_0x2c9bd8[_0xac49('0xae')][_0xac49('0x42')]>0x0){_0x2c9bd8[_0xac49('0xae')][_0xac49('0xb3')](function(_0x108e31){if(_0x108e31[_0xac49('0xc2')]===_0xac49('0xbf')){var _0x4363f5={'name':_0x108e31['label'],'value':_0x108e31[_0xac49('0xc3')]};_0x2cac7c[_0xac49('0xb5')](_0x4363f5);}});}_0x1ef7bb['options']=_0x2cac7c;if(_0x1ef7bb[_0xac49('0x55')][_0xac49('0x42')]>0x0){_0x5495da(_0x1ef7bb);}else{if(_0x5f0f5b==![]){_0x5495da();}else{_0x5495da(_0x1ef7bb);}}});}});} \ No newline at end of file +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 diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index c06749e..ce0df8d 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 _0xac9d=['bluebird','request-promise','path','../../config/environment','../../components/integrations/configuration','exports','define','ServicenowAccount','lodash','util','../../config/logger','api','moment'];(function(_0xcc2c66,_0x27cf7b){var _0x2197b2=function(_0xacbaeb){while(--_0xacbaeb){_0xcc2c66['push'](_0xcc2c66['shift']());}};_0x2197b2(++_0x27cf7b);}(_0xac9d,0x14d));var _0xdac9=function(_0x648163,_0x241576){_0x648163=_0x648163-0x0;var _0x199d4d=_0xac9d[_0x648163];return _0x199d4d;};'use strict';var _=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var logger=require(_0xdac9('0x2'))(_0xdac9('0x3'));var moment=require(_0xdac9('0x4'));var BPromise=require(_0xdac9('0x5'));var rp=require(_0xdac9('0x6'));var fs=require('fs');var path=require(_0xdac9('0x7'));var rimraf=require('rimraf');var config=require(_0xdac9('0x8'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0xdac9('0x9'));module[_0xdac9('0xa')]=function(_0x1222bb,_0x776b6c){return _0x1222bb[_0xdac9('0xb')](_0xdac9('0xc'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 698ea8d..9118a2a 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 _0x4fb0=['http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','map','include','model','info','find','ShowServicenowAccount','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x5be453,_0x3276e0){var _0x55d2b8=function(_0x5f1234){while(--_0x5f1234){_0x5be453['push'](_0x5be453['shift']());}};_0x55d2b8(++_0x3276e0);}(_0x4fb0,0x129));var _0x04fb=function(_0x580265,_0x2e67dd){_0x580265=_0x580265-0x0;var _0x148f54=_0x4fb0[_0x580265];return _0x148f54;};'use strict';var _=require('lodash');var util=require(_0x04fb('0x0'));var moment=require('moment');var BPromise=require(_0x04fb('0x1'));var rs=require(_0x04fb('0x2'));var fs=require('fs');var Redis=require(_0x04fb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x04fb('0x4'));var logger=require(_0x04fb('0x5'))(_0x04fb('0x6'));var config=require('../../config/environment');var jayson=require(_0x04fb('0x7'));var client=jayson[_0x04fb('0x8')][_0x04fb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x44d143,_0x347a85,_0xcc162a){return new BPromise(function(_0x3ffab8,_0x1540e){return client[_0x04fb('0xa')](_0x44d143,_0xcc162a)[_0x04fb('0xb')](function(_0x3b0f46){logger['info'](_0x04fb('0xc'),_0x347a85,_0x04fb('0xd'));logger[_0x04fb('0xe')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x347a85,_0x04fb('0xd'),JSON[_0x04fb('0xf')](_0x3b0f46));if(_0x3b0f46[_0x04fb('0x10')]){if(_0x3b0f46['error'][_0x04fb('0x11')]===0x1f4){logger[_0x04fb('0x10')](_0x04fb('0xc'),_0x347a85,_0x3b0f46[_0x04fb('0x10')][_0x04fb('0x12')]);return _0x1540e(_0x3b0f46[_0x04fb('0x10')][_0x04fb('0x12')]);}logger['error'](_0x04fb('0xc'),_0x347a85,_0x3b0f46[_0x04fb('0x10')][_0x04fb('0x12')]);return _0x3ffab8(_0x3b0f46['error'][_0x04fb('0x12')]);}else{logger['info'](_0x04fb('0xc'),_0x347a85,_0x04fb('0xd'));_0x3ffab8(_0x3b0f46[_0x04fb('0x13')][_0x04fb('0x12')]);}})[_0x04fb('0x14')](function(_0x182e40){logger[_0x04fb('0x10')](_0x04fb('0xc'),_0x347a85,_0x182e40);_0x1540e(_0x182e40);});});}exports[_0x04fb('0x15')]=function(_0x1b31d9){var _0x2205c0=this;return new Promise(function(_0x15f9c7,_0x5e6db2){return db[_0x04fb('0x16')][_0x04fb('0x17')]({'raw':_0x1b31d9[_0x04fb('0x18')]?_0x1b31d9[_0x04fb('0x18')][_0x04fb('0x19')]===undefined?!![]:![]:!![],'where':_0x1b31d9['options']?_0x1b31d9['options'][_0x04fb('0x1a')]||null:null,'attributes':_0x1b31d9['options']?_0x1b31d9[_0x04fb('0x18')][_0x04fb('0x1b')]||null:null,'limit':_0x1b31d9[_0x04fb('0x18')]?_0x1b31d9[_0x04fb('0x18')]['limit']||null:null,'include':_0x1b31d9[_0x04fb('0x18')]?_0x1b31d9[_0x04fb('0x18')]['include']?_[_0x04fb('0x1c')](_0x1b31d9[_0x04fb('0x18')][_0x04fb('0x1d')],function(_0x232100){return{'model':db[_0x232100[_0x04fb('0x1e')]],'as':_0x232100['as'],'attributes':_0x232100[_0x04fb('0x1b')],'include':_0x232100[_0x04fb('0x1d')]?_[_0x04fb('0x1c')](_0x232100[_0x04fb('0x1d')],function(_0x4fa280){return{'model':db[_0x4fa280['model']],'as':_0x4fa280['as'],'attributes':_0x4fa280[_0x04fb('0x1b')],'include':_0x4fa280[_0x04fb('0x1d')]?_[_0x04fb('0x1c')](_0x4fa280['include'],function(_0x58294c){return{'model':db[_0x58294c[_0x04fb('0x1e')]],'as':_0x58294c['as'],'attributes':_0x58294c[_0x04fb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x04fb('0xb')](function(_0x1d30a2){logger[_0x04fb('0x1f')]('GetServicenowAccount',_0x1b31d9);logger[_0x04fb('0xe')](_0x04fb('0x15'),_0x1b31d9,JSON[_0x04fb('0xf')](_0x1d30a2));_0x15f9c7(_0x1d30a2);})[_0x04fb('0x14')](function(_0x28ba06){logger[_0x04fb('0x10')]('GetServicenowAccount',_0x28ba06[_0x04fb('0x12')],_0x1b31d9);_0x5e6db2(_0x2205c0[_0x04fb('0x10')](0x1f4,_0x28ba06[_0x04fb('0x12')]));});});};exports['ShowServicenowAccount']=function(_0x22dce4){var _0x124dbc=this;return new Promise(function(_0x4ab410,_0x5688d0){return db['ServicenowAccount'][_0x04fb('0x20')]({'raw':_0x22dce4[_0x04fb('0x18')]?_0x22dce4[_0x04fb('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x22dce4['options']?_0x22dce4[_0x04fb('0x18')][_0x04fb('0x1a')]||null:null,'attributes':_0x22dce4[_0x04fb('0x18')]?_0x22dce4[_0x04fb('0x18')][_0x04fb('0x1b')]||null:null,'include':_0x22dce4['options']?_0x22dce4[_0x04fb('0x18')][_0x04fb('0x1d')]?_['map'](_0x22dce4[_0x04fb('0x18')]['include'],function(_0x41bf54){return{'model':db[_0x41bf54[_0x04fb('0x1e')]],'as':_0x41bf54['as'],'attributes':_0x41bf54['attributes'],'include':_0x41bf54[_0x04fb('0x1d')]?_[_0x04fb('0x1c')](_0x41bf54[_0x04fb('0x1d')],function(_0x1ab35f){return{'model':db[_0x1ab35f[_0x04fb('0x1e')]],'as':_0x1ab35f['as'],'attributes':_0x1ab35f['attributes'],'include':_0x1ab35f['include']?_[_0x04fb('0x1c')](_0x1ab35f[_0x04fb('0x1d')],function(_0x1e69a6){return{'model':db[_0x1e69a6['model']],'as':_0x1e69a6['as'],'attributes':_0x1e69a6[_0x04fb('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ef8c6){logger[_0x04fb('0x1f')]('ShowServicenowAccount',_0x22dce4);logger[_0x04fb('0xe')](_0x04fb('0x21'),_0x22dce4,JSON['stringify'](_0x2ef8c6));_0x4ab410(_0x2ef8c6);})[_0x04fb('0x14')](function(_0x5c60a7){logger[_0x04fb('0x10')](_0x04fb('0x21'),_0x5c60a7['message'],_0x22dce4);_0x5688d0(_0x124dbc['error'](0x1f4,_0x5c60a7[_0x04fb('0x12')]));});});}; \ No newline at end of file +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 diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 3018a71..59e1f4d 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 _0x456a=['Router','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','put','update','delete','destroy','multer','connect-timeout'];(function(_0x2134b7,_0x1eb5e2){var _0x6c5914=function(_0x1da201){while(--_0x1da201){_0x2134b7['push'](_0x2134b7['shift']());}};_0x6c5914(++_0x1eb5e2);}(_0x456a,0xa8));var _0xa456=function(_0x2fd4c9,_0x4f6500){_0x2fd4c9=_0x2fd4c9-0x0;var _0x2d1019=_0x456a[_0x2fd4c9];return _0x2d1019;};'use strict';var multer=require(_0xa456('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa456('0x1'));var express=require('express');var router=express[_0xa456('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xa456('0x3'));var config=require(_0xa456('0x4'));var controller=require('./intServicenowConfiguration.controller');router[_0xa456('0x5')]('/',auth['isAuthenticated'](),controller[_0xa456('0x6')]);router[_0xa456('0x5')](_0xa456('0x7'),auth[_0xa456('0x8')](),controller[_0xa456('0x9')]);router[_0xa456('0x5')](_0xa456('0xa'),auth[_0xa456('0x8')](),controller[_0xa456('0xb')]);router[_0xa456('0x5')](_0xa456('0xc'),auth[_0xa456('0x8')](),controller['getSubjects']);router[_0xa456('0x5')]('/:id/descriptions',auth[_0xa456('0x8')](),controller['getDescriptions']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xa456('0xd')](_0xa456('0x7'),auth[_0xa456('0x8')](),controller[_0xa456('0xe')]);router[_0xa456('0xf')](_0xa456('0x7'),auth[_0xa456('0x8')](),controller[_0xa456('0x10')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 81a5cb5..5be6b5f 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 _0x4c6c=['STRING'];(function(_0x1846f3,_0x431932){var _0x5de017=function(_0x230b86){while(--_0x230b86){_0x1846f3['push'](_0x1846f3['shift']());}};_0x5de017(++_0x431932);}(_0x4c6c,0x1cc));var _0xc4c6=function(_0x42d912,_0x474144){_0x42d912=_0x42d912-0x0;var _0x568063=_0x4c6c[_0x42d912];return _0x568063;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc4c6('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +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 diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 817adc0..648f9dd 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 _0xbf5a=['squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','end','json','offset','limit','set','Content-Range','reject','save','update','destroy','sendStatus','name','send','ServicenowConfiguration','rawAttributes','fieldName','type','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','show','params','create','body','find','getFields','findOne','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash'];(function(_0xe6036b,_0x57ced5){var _0x9dd9e=function(_0x413feb){while(--_0x413feb){_0xe6036b['push'](_0xe6036b['shift']());}};_0x9dd9e(++_0x57ced5);}(_0xbf5a,0xad));var _0xabf5=function(_0x3ce572,_0x5abd93){_0x3ce572=_0x3ce572-0x0;var _0xeeab61=_0xbf5a[_0x3ce572];return _0xeeab61;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xabf5('0x0'));var rimraf=require(_0xabf5('0x1'));var zipdir=require(_0xabf5('0x2'));var jsonpatch=require(_0xabf5('0x3'));var rp=require(_0xabf5('0x4'));var moment=require(_0xabf5('0x5'));var BPromise=require(_0xabf5('0x6'));var Mustache=require('mustache');var util=require(_0xabf5('0x7'));var path=require(_0xabf5('0x8'));var sox=require(_0xabf5('0x9'));var csv=require(_0xabf5('0xa'));var ejs=require(_0xabf5('0xb'));var fs=require('fs');var _=require(_0xabf5('0xc'));var squel=require(_0xabf5('0xd'));var crypto=require(_0xabf5('0xe'));var jsforce=require(_0xabf5('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xabf5('0x10'));var Papa=require(_0xabf5('0x11'));var Redis=require('ioredis');var authService=require(_0xabf5('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xabf5('0x13'));var hardwareService=require(_0xabf5('0x14'));var logger=require(_0xabf5('0x15'))(_0xabf5('0x16'));var utils=require(_0xabf5('0x17'));var config=require(_0xabf5('0x18'));var db=require(_0xabf5('0x19'))['db'];var jayson=require(_0xabf5('0x1a'));var client=jayson[_0xabf5('0x1b')][_0xabf5('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x29b6db,_0x53f409,_0x3da638){if(_0x3da638){var _0xd0b7d7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xd0b7d7[_0xabf5('0x1d')](_0x53f409)){return _0x29b6db;}else{throw new db[(_0xabf5('0x1e'))][(_0xabf5('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 _0x29b6db;}}function respondWithRpcPromise(_0x44a7ce,_0x15775a,_0x557e8b,_0x2337f9){return new BPromise(function(_0x6bcb16,_0x51bcf9){var _0x270914=_0x2337f9||client;return _0x270914[_0xabf5('0x20')](_0x44a7ce,_0x557e8b)[_0xabf5('0x21')](function(_0x10fd56){logger[_0xabf5('0x22')](_0xabf5('0x23'),_0x15775a,_0xabf5('0x24'));logger[_0xabf5('0x25')](_0xabf5('0x26'),_0x15775a,_0xabf5('0x24'),JSON['stringify'](_0x10fd56));if(_0x10fd56[_0xabf5('0x27')]){if(_0x10fd56[_0xabf5('0x27')]['code']===0x1f4){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x15775a,_0x10fd56[_0xabf5('0x27')][_0xabf5('0x28')]);return _0x51bcf9(_0x10fd56[_0xabf5('0x27')][_0xabf5('0x28')]);}logger['error'](_0xabf5('0x23'),_0x15775a,_0x10fd56[_0xabf5('0x27')]['message']);return _0x6bcb16(_0x10fd56[_0xabf5('0x27')][_0xabf5('0x28')]);}else{logger[_0xabf5('0x22')](_0xabf5('0x23'),_0x15775a,_0xabf5('0x24'));_0x6bcb16(_0x10fd56[_0xabf5('0x29')]['message']);}})[_0xabf5('0x2a')](function(_0xbd3acc){logger[_0xabf5('0x27')](_0xabf5('0x23'),_0x15775a,_0xbd3acc);_0x51bcf9(_0xbd3acc);});});}function respondWithStatusCode(_0x92e7db,_0x4657c9){_0x4657c9=_0x4657c9||0xcc;return function(_0x2cd3e0){if(_0x2cd3e0){return _0x92e7db['sendStatus'](_0x4657c9);}return _0x92e7db[_0xabf5('0x2b')](_0x4657c9)[_0xabf5('0x2c')]();};}function respondWithResult(_0x1e27ba,_0x33728d){_0x33728d=_0x33728d||0xc8;return function(_0x2d783e){if(_0x2d783e){return _0x1e27ba[_0xabf5('0x2b')](_0x33728d)[_0xabf5('0x2d')](_0x2d783e);}};}function respondWithFilteredResult(_0x27e23d,_0x363875){return function(_0x4b3406){if(_0x4b3406){var _0x4f6dc6=_0x4b3406['count'],_0x2cfac2=_0x363875[_0xabf5('0x2e')],_0x2ec552=_0x363875[_0xabf5('0x2e')]+_0x363875[_0xabf5('0x2f')],_0x52d36e;if(_0x2ec552>=_0x4f6dc6){_0x2ec552=_0x4f6dc6;_0x52d36e=0xc8;}else{_0x52d36e=0xce;}_0x27e23d[_0xabf5('0x2b')](_0x52d36e);return _0x27e23d[_0xabf5('0x30')](_0xabf5('0x31'),_0x2cfac2+'-'+_0x2ec552+'/'+_0x4f6dc6)[_0xabf5('0x2d')](_0x4b3406);}return null;};}function patchUpdates(_0x4bb7a4){return function(_0x3b58f1){try{jsonpatch['apply'](_0x3b58f1,_0x4bb7a4,!![]);}catch(_0x5c1493){return BPromise[_0xabf5('0x32')](_0x5c1493);}return _0x3b58f1[_0xabf5('0x33')]();};}function saveUpdates(_0x4b523e,_0x3d9bb4){return function(_0x2f085e){if(_0x2f085e){return _0x2f085e[_0xabf5('0x34')](_0x4b523e)[_0xabf5('0x21')](function(_0x2ace0b){return _0x2ace0b;});}return null;};}function removeEntity(_0x237c42,_0x350aa9){return function(_0x4c2681){if(_0x4c2681){return _0x4c2681[_0xabf5('0x35')]()[_0xabf5('0x21')](function(){_0x237c42[_0xabf5('0x2b')](0xcc)[_0xabf5('0x2c')]();});}};}function handleEntityNotFound(_0x148be1,_0x5c79f0){return function(_0x18ce2e){if(!_0x18ce2e){_0x148be1[_0xabf5('0x36')](0x194);}return _0x18ce2e;};}function handleError(_0x104ff0,_0x4cc0c7){_0x4cc0c7=_0x4cc0c7||0x1f4;return function(_0x2d096a){logger[_0xabf5('0x27')](_0x2d096a['stack']);if(_0x2d096a[_0xabf5('0x37')]){delete _0x2d096a[_0xabf5('0x37')];}_0x104ff0[_0xabf5('0x2b')](_0x4cc0c7)[_0xabf5('0x38')](_0x2d096a);};}exports['index']=function(_0x45635f,_0x51cfb8){var _0x4927a2={},_0x721747={},_0x46a76c={'count':0x0,'rows':[]};var _0x1be517=_['map'](db[_0xabf5('0x39')][_0xabf5('0x3a')],function(_0x1104ac){return{'name':_0x1104ac[_0xabf5('0x3b')],'type':_0x1104ac[_0xabf5('0x3c')]['key']};});_0x721747['model']=_[_0xabf5('0x3d')](_0x1be517,'name');_0x721747[_0xabf5('0x3e')]=_[_0xabf5('0x3f')](_0x45635f['query']);_0x721747['filters']=_[_0xabf5('0x40')](_0x721747[_0xabf5('0x41')],_0x721747[_0xabf5('0x3e')]);_0x4927a2[_0xabf5('0x42')]=_['intersection'](_0x721747[_0xabf5('0x41')],qs[_0xabf5('0x43')](_0x45635f['query'][_0xabf5('0x43')]));_0x4927a2['attributes']=_0x4927a2[_0xabf5('0x42')][_0xabf5('0x44')]?_0x4927a2['attributes']:_0x721747['model'];if(!_0x45635f[_0xabf5('0x3e')][_0xabf5('0x45')]('nolimit')){_0x4927a2['limit']=qs['limit'](_0x45635f[_0xabf5('0x3e')][_0xabf5('0x2f')]);_0x4927a2[_0xabf5('0x2e')]=qs[_0xabf5('0x2e')](_0x45635f[_0xabf5('0x3e')][_0xabf5('0x2e')]);}_0x4927a2[_0xabf5('0x46')]=qs['sort'](_0x45635f[_0xabf5('0x3e')][_0xabf5('0x47')]);_0x4927a2[_0xabf5('0x48')]=qs[_0xabf5('0x49')](_[_0xabf5('0x4a')](_0x45635f[_0xabf5('0x3e')],_0x721747[_0xabf5('0x49')]));if(_0x45635f['query'][_0xabf5('0x4b')]){_0x4927a2[_0xabf5('0x48')]=_[_0xabf5('0x4c')](_0x4927a2[_0xabf5('0x48')],{'$or':_['map'](_0x1be517,function(_0x824d31){if(_0x824d31[_0xabf5('0x3c')]!==_0xabf5('0x4d')){var _0x4150cc={};_0x4150cc[_0x824d31[_0xabf5('0x37')]]={'$like':'%'+_0x45635f[_0xabf5('0x3e')][_0xabf5('0x4b')]+'%'};return _0x4150cc;}})});}_0x4927a2=_['merge']({},_0x4927a2,_0x45635f[_0xabf5('0x4e')]);var _0x3092f0={'where':_0x4927a2[_0xabf5('0x48')]};return db[_0xabf5('0x39')][_0xabf5('0x4f')](_0x3092f0)[_0xabf5('0x21')](function(_0x5be9f5){_0x46a76c[_0xabf5('0x4f')]=_0x5be9f5;if(_0x45635f[_0xabf5('0x3e')][_0xabf5('0x50')]){_0x4927a2[_0xabf5('0x51')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0xabf5('0x52')](_0x4927a2);})['then'](function(_0x596f9c){_0x46a76c['rows']=_0x596f9c;return _0x46a76c;})['then'](respondWithFilteredResult(_0x51cfb8,_0x4927a2))['catch'](handleError(_0x51cfb8,null));};exports[_0xabf5('0x53')]=function(_0x22dc99,_0x561b16){var _0x410103={'raw':![],'where':{'id':_0x22dc99[_0xabf5('0x54')]['id']}},_0x10e8ed={};_0x10e8ed[_0xabf5('0x41')]=_[_0xabf5('0x3f')](db[_0xabf5('0x39')][_0xabf5('0x3a')]);_0x10e8ed[_0xabf5('0x3e')]=_[_0xabf5('0x3f')](_0x22dc99[_0xabf5('0x3e')]);_0x10e8ed[_0xabf5('0x49')]=_[_0xabf5('0x40')](_0x10e8ed[_0xabf5('0x41')],_0x10e8ed[_0xabf5('0x3e')]);_0x410103[_0xabf5('0x42')]=_[_0xabf5('0x40')](_0x10e8ed['model'],qs['fields'](_0x22dc99[_0xabf5('0x3e')][_0xabf5('0x43')]));_0x410103[_0xabf5('0x42')]=_0x410103['attributes']['length']?_0x410103[_0xabf5('0x42')]:_0x10e8ed[_0xabf5('0x41')];if(_0x22dc99[_0xabf5('0x3e')][_0xabf5('0x50')]){_0x410103[_0xabf5('0x51')]=[{'all':!![]}];}_0x410103=_['merge']({},_0x410103,_0x22dc99[_0xabf5('0x4e')]);return db[_0xabf5('0x39')]['find'](_0x410103)['then'](handleEntityNotFound(_0x561b16,null))[_0xabf5('0x21')](respondWithResult(_0x561b16,null))[_0xabf5('0x2a')](handleError(_0x561b16,null));};exports[_0xabf5('0x55')]=function(_0x24f4e5,_0x43ee04){return db[_0xabf5('0x39')][_0xabf5('0x55')](_0x24f4e5[_0xabf5('0x56')],{})['then'](respondWithResult(_0x43ee04,0xc9))[_0xabf5('0x2a')](handleError(_0x43ee04,null));};exports['update']=function(_0x5652d5,_0x5863ee){if(_0x5652d5[_0xabf5('0x56')]['id']){delete _0x5652d5[_0xabf5('0x56')]['id'];}return db[_0xabf5('0x39')][_0xabf5('0x57')]({'where':{'id':_0x5652d5[_0xabf5('0x54')]['id']}})['then'](handleEntityNotFound(_0x5863ee,null))[_0xabf5('0x21')](saveUpdates(_0x5652d5[_0xabf5('0x56')],null))[_0xabf5('0x21')](respondWithResult(_0x5863ee,null))[_0xabf5('0x2a')](handleError(_0x5863ee,null));};exports[_0xabf5('0x35')]=function(_0x32a6f9,_0x5d1153){return db['ServicenowConfiguration']['find']({'where':{'id':_0x32a6f9[_0xabf5('0x54')]['id']}})[_0xabf5('0x21')](handleEntityNotFound(_0x5d1153,null))[_0xabf5('0x21')](removeEntity(_0x5d1153,null))[_0xabf5('0x2a')](handleError(_0x5d1153,null));};exports[_0xabf5('0x58')]=function(_0x4a7329,_0x552e47,_0x51118f){var _0x28d521={};var _0x20cf20={};var _0x42bb70;var _0x3fc262;return db[_0xabf5('0x39')][_0xabf5('0x59')]({'where':{'id':_0x4a7329[_0xabf5('0x54')]['id']}})[_0xabf5('0x21')](handleEntityNotFound(_0x552e47,null))['then'](function(_0x1ca0e5){if(_0x1ca0e5){_0x42bb70=_0x1ca0e5;_0x20cf20[_0xabf5('0x41')]=_[_0xabf5('0x3f')](db['ServicenowField'][_0xabf5('0x3a')]);_0x20cf20[_0xabf5('0x3e')]=_[_0xabf5('0x3f')](_0x4a7329['query']);_0x20cf20[_0xabf5('0x49')]=_[_0xabf5('0x40')](_0x20cf20[_0xabf5('0x41')],_0x20cf20[_0xabf5('0x3e')]);_0x28d521[_0xabf5('0x42')]=_['intersection'](_0x20cf20[_0xabf5('0x41')],qs[_0xabf5('0x43')](_0x4a7329['query'][_0xabf5('0x43')]));_0x28d521[_0xabf5('0x42')]=_0x28d521[_0xabf5('0x42')]['length']?_0x28d521['attributes']:_0x20cf20[_0xabf5('0x41')];_0x28d521[_0xabf5('0x46')]=qs[_0xabf5('0x47')](_0x4a7329[_0xabf5('0x3e')][_0xabf5('0x47')]);_0x28d521[_0xabf5('0x48')]=qs[_0xabf5('0x49')](_['pick'](_0x4a7329[_0xabf5('0x3e')],_0x20cf20[_0xabf5('0x49')]));if(_0x4a7329[_0xabf5('0x3e')][_0xabf5('0x4b')]){_0x28d521[_0xabf5('0x48')]=_[_0xabf5('0x4c')](_0x28d521[_0xabf5('0x48')],{'$or':_[_0xabf5('0x3d')](_0x28d521[_0xabf5('0x42')],function(_0x2118eb){var _0x5ef6ac={};_0x5ef6ac[_0x2118eb]={'$like':'%'+_0x4a7329[_0xabf5('0x3e')][_0xabf5('0x4b')]+'%'};return _0x5ef6ac;})});}_0x28d521=_['merge']({},_0x28d521,_0x4a7329[_0xabf5('0x4e')]);return _0x42bb70[_0xabf5('0x58')](_0x28d521);}})[_0xabf5('0x21')](function(_0x55a33e){if(_0x55a33e){_0x3fc262=_0x55a33e[_0xabf5('0x44')];if(!_0x4a7329[_0xabf5('0x3e')][_0xabf5('0x45')](_0xabf5('0x5a'))){_0x28d521[_0xabf5('0x2f')]=qs[_0xabf5('0x2f')](_0x4a7329['query'][_0xabf5('0x2f')]);_0x28d521[_0xabf5('0x2e')]=qs[_0xabf5('0x2e')](_0x4a7329[_0xabf5('0x3e')][_0xabf5('0x2e')]);}return _0x42bb70[_0xabf5('0x58')](_0x28d521);}})[_0xabf5('0x21')](function(_0x515267){if(_0x515267){return _0x515267?{'count':_0x3fc262,'rows':_0x515267}:null;}})[_0xabf5('0x21')](respondWithResult(_0x552e47,null))[_0xabf5('0x2a')](handleError(_0x552e47,null));};exports[_0xabf5('0x5b')]=function(_0x4457e0,_0x1b7c21,_0x4cdd2e){var _0x32da4f={};var _0x2462cc={};var _0x15f8aa;var _0x3651a3;return db['ServicenowConfiguration'][_0xabf5('0x59')]({'where':{'id':_0x4457e0[_0xabf5('0x54')]['id']}})[_0xabf5('0x21')](handleEntityNotFound(_0x1b7c21,null))['then'](function(_0x4c7fc3){if(_0x4c7fc3){_0x15f8aa=_0x4c7fc3;_0x2462cc[_0xabf5('0x41')]=_[_0xabf5('0x3f')](db['ServicenowField'][_0xabf5('0x3a')]);_0x2462cc[_0xabf5('0x3e')]=_['keys'](_0x4457e0[_0xabf5('0x3e')]);_0x2462cc[_0xabf5('0x49')]=_[_0xabf5('0x40')](_0x2462cc[_0xabf5('0x41')],_0x2462cc[_0xabf5('0x3e')]);_0x32da4f[_0xabf5('0x42')]=_[_0xabf5('0x40')](_0x2462cc[_0xabf5('0x41')],qs[_0xabf5('0x43')](_0x4457e0[_0xabf5('0x3e')]['fields']));_0x32da4f['attributes']=_0x32da4f['attributes'][_0xabf5('0x44')]?_0x32da4f['attributes']:_0x2462cc['model'];_0x32da4f[_0xabf5('0x46')]=qs[_0xabf5('0x47')](_0x4457e0[_0xabf5('0x3e')][_0xabf5('0x47')]);_0x32da4f[_0xabf5('0x48')]=qs[_0xabf5('0x49')](_[_0xabf5('0x4a')](_0x4457e0[_0xabf5('0x3e')],_0x2462cc[_0xabf5('0x49')]));if(_0x4457e0['query'][_0xabf5('0x4b')]){_0x32da4f[_0xabf5('0x48')]=_[_0xabf5('0x4c')](_0x32da4f[_0xabf5('0x48')],{'$or':_[_0xabf5('0x3d')](_0x32da4f[_0xabf5('0x42')],function(_0x160487){var _0x340c48={};_0x340c48[_0x160487]={'$like':'%'+_0x4457e0[_0xabf5('0x3e')][_0xabf5('0x4b')]+'%'};return _0x340c48;})});}_0x32da4f=_['merge']({},_0x32da4f,_0x4457e0['options']);return _0x15f8aa[_0xabf5('0x5b')](_0x32da4f);}})[_0xabf5('0x21')](function(_0x169ec0){if(_0x169ec0){_0x3651a3=_0x169ec0['length'];if(!_0x4457e0['query'][_0xabf5('0x45')]('nolimit')){_0x32da4f[_0xabf5('0x2f')]=qs[_0xabf5('0x2f')](_0x4457e0['query'][_0xabf5('0x2f')]);_0x32da4f[_0xabf5('0x2e')]=qs[_0xabf5('0x2e')](_0x4457e0[_0xabf5('0x3e')][_0xabf5('0x2e')]);}return _0x15f8aa[_0xabf5('0x5b')](_0x32da4f);}})[_0xabf5('0x21')](function(_0x28b43b){if(_0x28b43b){return _0x28b43b?{'count':_0x3651a3,'rows':_0x28b43b}:null;}})['then'](respondWithResult(_0x1b7c21,null))['catch'](handleError(_0x1b7c21,null));};exports[_0xabf5('0x5c')]=function(_0x39e0e3,_0x1a91e3,_0x5c76e9){var _0x19800a={};var _0x2999e5={};var _0x3701b8;var _0x3071e2;return db['ServicenowConfiguration'][_0xabf5('0x59')]({'where':{'id':_0x39e0e3[_0xabf5('0x54')]['id']}})[_0xabf5('0x21')](handleEntityNotFound(_0x1a91e3,null))[_0xabf5('0x21')](function(_0x24293d){if(_0x24293d){_0x3701b8=_0x24293d;_0x2999e5[_0xabf5('0x41')]=_[_0xabf5('0x3f')](db['ServicenowField'][_0xabf5('0x3a')]);_0x2999e5[_0xabf5('0x3e')]=_[_0xabf5('0x3f')](_0x39e0e3[_0xabf5('0x3e')]);_0x2999e5[_0xabf5('0x49')]=_[_0xabf5('0x40')](_0x2999e5[_0xabf5('0x41')],_0x2999e5[_0xabf5('0x3e')]);_0x19800a[_0xabf5('0x42')]=_[_0xabf5('0x40')](_0x2999e5['model'],qs[_0xabf5('0x43')](_0x39e0e3[_0xabf5('0x3e')][_0xabf5('0x43')]));_0x19800a[_0xabf5('0x42')]=_0x19800a[_0xabf5('0x42')][_0xabf5('0x44')]?_0x19800a[_0xabf5('0x42')]:_0x2999e5[_0xabf5('0x41')];_0x19800a[_0xabf5('0x46')]=qs[_0xabf5('0x47')](_0x39e0e3[_0xabf5('0x3e')]['sort']);_0x19800a[_0xabf5('0x48')]=qs[_0xabf5('0x49')](_[_0xabf5('0x4a')](_0x39e0e3[_0xabf5('0x3e')],_0x2999e5['filters']));if(_0x39e0e3[_0xabf5('0x3e')][_0xabf5('0x4b')]){_0x19800a[_0xabf5('0x48')]=_[_0xabf5('0x4c')](_0x19800a[_0xabf5('0x48')],{'$or':_['map'](_0x19800a[_0xabf5('0x42')],function(_0x505382){var _0x23c99a={};_0x23c99a[_0x505382]={'$like':'%'+_0x39e0e3[_0xabf5('0x3e')][_0xabf5('0x4b')]+'%'};return _0x23c99a;})});}_0x19800a=_[_0xabf5('0x4c')]({},_0x19800a,_0x39e0e3[_0xabf5('0x4e')]);return _0x3701b8[_0xabf5('0x5c')](_0x19800a);}})[_0xabf5('0x21')](function(_0x4a667c){if(_0x4a667c){_0x3071e2=_0x4a667c[_0xabf5('0x44')];if(!_0x39e0e3[_0xabf5('0x3e')][_0xabf5('0x45')](_0xabf5('0x5a'))){_0x19800a[_0xabf5('0x2f')]=qs[_0xabf5('0x2f')](_0x39e0e3[_0xabf5('0x3e')]['limit']);_0x19800a[_0xabf5('0x2e')]=qs[_0xabf5('0x2e')](_0x39e0e3['query'][_0xabf5('0x2e')]);}return _0x3701b8['getDescriptions'](_0x19800a);}})[_0xabf5('0x21')](function(_0x781098){if(_0x781098){return _0x781098?{'count':_0x3071e2,'rows':_0x781098}:null;}})['then'](respondWithResult(_0x1a91e3,null))['catch'](handleError(_0x1a91e3,null));}; \ No newline at end of file +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 diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 360395e..1265df5 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 _0x18fe=['rimraf','define','ServicenowConfiguration','int_servicenow_configurations','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x184759,_0x1cc38a){var _0xf26d5f=function(_0x1010c8){while(--_0x1010c8){_0x184759['push'](_0x184759['shift']());}};_0xf26d5f(++_0x1cc38a);}(_0x18fe,0x19e));var _0xe18f=function(_0x589dae,_0x1062b8){_0x589dae=_0x589dae-0x0;var _0x41c5de=_0x18fe[_0x589dae];return _0x41c5de;};'use strict';var _=require(_0xe18f('0x0'));var util=require('util');var logger=require(_0xe18f('0x1'))(_0xe18f('0x2'));var moment=require('moment');var BPromise=require(_0xe18f('0x3'));var rp=require(_0xe18f('0x4'));var fs=require('fs');var path=require(_0xe18f('0x5'));var rimraf=require(_0xe18f('0x6'));var config=require('../../config/environment');var attributes=require('./intServicenowConfiguration.attributes');module['exports']=function(_0x188f7c,_0x208ba7){return _0x188f7c[_0xe18f('0x7')](_0xe18f('0x8'),attributes,{'tableName':_0xe18f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index b7c9f9c..46b7f44 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 _0xded7=['randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x4dc9eb,_0x329131){var _0x5f0d7c=function(_0x54873f){while(--_0x54873f){_0x4dc9eb['push'](_0x4dc9eb['shift']());}};_0x5f0d7c(++_0x329131);}(_0xded7,0x104));var _0x7ded=function(_0x4573a7,_0x3c7367){_0x4573a7=_0x4573a7-0x0;var _0x38599d=_0xded7[_0x4573a7];return _0x38599d;};'use strict';var _=require(_0x7ded('0x0'));var util=require(_0x7ded('0x1'));var moment=require(_0x7ded('0x2'));var BPromise=require(_0x7ded('0x3'));var rs=require(_0x7ded('0x4'));var fs=require('fs');var Redis=require(_0x7ded('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7ded('0x6'));var logger=require(_0x7ded('0x7'))('rpc');var config=require(_0x7ded('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7ded('0x9')][_0x7ded('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x591b29,_0x3b0b04,_0x2dc062){return new BPromise(function(_0x2252ce,_0x37d5b7){return client['request'](_0x591b29,_0x2dc062)[_0x7ded('0xb')](function(_0x4c79f3){logger['info'](_0x7ded('0xc'),_0x3b0b04,_0x7ded('0xd'));logger['debug'](_0x7ded('0xe'),_0x3b0b04,_0x7ded('0xd'),JSON[_0x7ded('0xf')](_0x4c79f3));if(_0x4c79f3[_0x7ded('0x10')]){if(_0x4c79f3[_0x7ded('0x10')][_0x7ded('0x11')]===0x1f4){logger['error'](_0x7ded('0xc'),_0x3b0b04,_0x4c79f3[_0x7ded('0x10')]['message']);return _0x37d5b7(_0x4c79f3[_0x7ded('0x10')][_0x7ded('0x12')]);}logger[_0x7ded('0x10')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3b0b04,_0x4c79f3[_0x7ded('0x10')][_0x7ded('0x12')]);return _0x2252ce(_0x4c79f3['error'][_0x7ded('0x12')]);}else{logger[_0x7ded('0x13')](_0x7ded('0xc'),_0x3b0b04,_0x7ded('0xd'));_0x2252ce(_0x4c79f3[_0x7ded('0x14')][_0x7ded('0x12')]);}})[_0x7ded('0x15')](function(_0x6d78a3){logger[_0x7ded('0x10')](_0x7ded('0xc'),_0x3b0b04,_0x6d78a3);_0x37d5b7(_0x6d78a3);});});} \ No newline at end of file +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 diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index c12f572..80b430b 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 _0x20c0=['destroy','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x20c0,0x89));var _0x020c=function(_0x467cfc,_0x3ab8fa){_0x467cfc=_0x467cfc-0x0;var _0x3f5691=_0x20c0[_0x467cfc];return _0x3f5691;};'use strict';var multer=require(_0x020c('0x0'));var util=require(_0x020c('0x1'));var path=require(_0x020c('0x2'));var timeout=require(_0x020c('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x020c('0x4'));var interaction=require(_0x020c('0x5'));var config=require('../../config/environment');var controller=require(_0x020c('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x020c('0x7')](_0x020c('0x8'),auth[_0x020c('0x9')](),controller[_0x020c('0xa')]);router[_0x020c('0xb')]('/',auth[_0x020c('0x9')](),controller[_0x020c('0xc')]);router[_0x020c('0xd')]('/:id',auth[_0x020c('0x9')](),controller[_0x020c('0xe')]);router[_0x020c('0xf')](_0x020c('0x8'),auth[_0x020c('0x9')](),controller[_0x020c('0x10')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 83ed154..c165c02 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 _0xbe12=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x56ac79,_0xa1be8){var _0x2601b8=function(_0x2d38d8){while(--_0x2d38d8){_0x56ac79['push'](_0x56ac79['shift']());}};_0x2601b8(++_0xa1be8);}(_0xbe12,0xea));var _0x2be1=function(_0x5285de,_0x554a15){_0x5285de=_0x5285de-0x0;var _0x55691e=_0xbe12[_0x5285de];return _0x55691e;};'use strict';var Sequelize=require(_0x2be1('0x0'));module[_0x2be1('0x1')]={'type':{'type':Sequelize[_0x2be1('0x2')](_0x2be1('0x3'),_0x2be1('0x4'),_0x2be1('0x5'),_0x2be1('0x6')),'defaultValue':_0x2be1('0x3')},'content':{'type':Sequelize[_0x2be1('0x7')]},'key':{'type':Sequelize[_0x2be1('0x7')]},'keyType':{'type':Sequelize[_0x2be1('0x2')](_0x2be1('0x3'),'variable',_0x2be1('0x5'))},'keyContent':{'type':Sequelize[_0x2be1('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2be1('0x7')]},'customField':{'type':Sequelize[_0x2be1('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2be1('0x7')]}}; \ No newline at end of file +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 diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index f5a2543..5474bbe 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 _0xe37f=['filters','attributes','fields','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','ServicenowField','includeAll','include','findAll','rows','params','intersection','length','catch','create','body','find','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','util','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','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','apply','reject','update','then','end','send','map','rawAttributes','type','key','model','name','keys','query'];(function(_0x9cd01b,_0x568ca3){var _0x51cd28=function(_0xee7454){while(--_0xee7454){_0x9cd01b['push'](_0x9cd01b['shift']());}};_0x51cd28(++_0x568ca3);}(_0xe37f,0x9e));var _0xfe37=function(_0x158f01,_0x12af3e){_0x158f01=_0x158f01-0x0;var _0x5ef74e=_0xe37f[_0x158f01];return _0x5ef74e;};'use strict';var pdf=require(_0xfe37('0x0'));var emlformat=require(_0xfe37('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xfe37('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfe37('0x3'));var BPromise=require(_0xfe37('0x4'));var Mustache=require(_0xfe37('0x5'));var util=require(_0xfe37('0x6'));var path=require('path');var sox=require(_0xfe37('0x7'));var csv=require(_0xfe37('0x8'));var ejs=require(_0xfe37('0x9'));var fs=require('fs');var _=require(_0xfe37('0xa'));var squel=require(_0xfe37('0xb'));var crypto=require('crypto');var jsforce=require(_0xfe37('0xc'));var deskjs=require(_0xfe37('0xd'));var toCsv=require(_0xfe37('0x8'));var querystring=require(_0xfe37('0xe'));var Papa=require(_0xfe37('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfe37('0x10'));var as=require(_0xfe37('0x11'));var hardwareService=require(_0xfe37('0x12'));var logger=require(_0xfe37('0x13'))('api');var utils=require(_0xfe37('0x14'));var config=require(_0xfe37('0x15'));var db=require(_0xfe37('0x16'))['db'];function respondWithStatusCode(_0x3e6451,_0x4f0ceb){_0x4f0ceb=_0x4f0ceb||0xcc;return function(_0x49c7ab){if(_0x49c7ab){return _0x3e6451[_0xfe37('0x17')](_0x4f0ceb);}return _0x3e6451[_0xfe37('0x18')](_0x4f0ceb)['end']();};}function respondWithResult(_0x1dbe61,_0x571853){_0x571853=_0x571853||0xc8;return function(_0x180c51){if(_0x180c51){return _0x1dbe61[_0xfe37('0x18')](_0x571853)[_0xfe37('0x19')](_0x180c51);}};}function respondWithFilteredResult(_0x54d04d,_0x5c2484){return function(_0x45d9bf){if(_0x45d9bf){var _0x1cef0b=_0x45d9bf[_0xfe37('0x1a')],_0x40222b=_0x5c2484[_0xfe37('0x1b')],_0x4f1804=_0x5c2484[_0xfe37('0x1b')]+_0x5c2484['limit'],_0x5f52ba;if(_0x4f1804>=_0x1cef0b){_0x4f1804=_0x1cef0b;_0x5f52ba=0xc8;}else{_0x5f52ba=0xce;}_0x54d04d[_0xfe37('0x18')](_0x5f52ba);return _0x54d04d['set'](_0xfe37('0x1c'),_0x40222b+'-'+_0x4f1804+'/'+_0x1cef0b)[_0xfe37('0x19')](_0x45d9bf);}return null;};}function patchUpdates(_0x55caf6){return function(_0x5def8c){try{jsonpatch[_0xfe37('0x1d')](_0x5def8c,_0x55caf6,!![]);}catch(_0x20b6a0){return BPromise[_0xfe37('0x1e')](_0x20b6a0);}return _0x5def8c['save']();};}function saveUpdates(_0x4b7f8e,_0x28b8bd){return function(_0x48485d){if(_0x48485d){return _0x48485d[_0xfe37('0x1f')](_0x4b7f8e)[_0xfe37('0x20')](function(_0x4a11dc){return _0x4a11dc;});}return null;};}function removeEntity(_0x4d152d,_0x55a144){return function(_0x4ce141){if(_0x4ce141){return _0x4ce141['destroy']()['then'](function(){_0x4d152d[_0xfe37('0x18')](0xcc)[_0xfe37('0x21')]();});}};}function handleEntityNotFound(_0x4069ee,_0x3a772e){return function(_0x55b0ee){if(!_0x55b0ee){_0x4069ee[_0xfe37('0x17')](0x194);}return _0x55b0ee;};}function handleError(_0x301c5b,_0x97c10){_0x97c10=_0x97c10||0x1f4;return function(_0x490f1d){logger['error'](_0x490f1d['stack']);if(_0x490f1d['name']){delete _0x490f1d['name'];}_0x301c5b[_0xfe37('0x18')](_0x97c10)[_0xfe37('0x22')](_0x490f1d);};}exports['index']=function(_0x3516cf,_0x59afa8){var _0x10c263={},_0x75e153={},_0x4a5d6c={'count':0x0,'rows':[]};var _0x4479d3=_[_0xfe37('0x23')](db['ServicenowField'][_0xfe37('0x24')],function(_0x3964e9){return{'name':_0x3964e9['fieldName'],'type':_0x3964e9[_0xfe37('0x25')][_0xfe37('0x26')]};});_0x75e153[_0xfe37('0x27')]=_[_0xfe37('0x23')](_0x4479d3,_0xfe37('0x28'));_0x75e153['query']=_[_0xfe37('0x29')](_0x3516cf[_0xfe37('0x2a')]);_0x75e153[_0xfe37('0x2b')]=_['intersection'](_0x75e153['model'],_0x75e153[_0xfe37('0x2a')]);_0x10c263[_0xfe37('0x2c')]=_['intersection'](_0x75e153[_0xfe37('0x27')],qs['fields'](_0x3516cf['query'][_0xfe37('0x2d')]));_0x10c263['attributes']=_0x10c263[_0xfe37('0x2c')]['length']?_0x10c263[_0xfe37('0x2c')]:_0x75e153[_0xfe37('0x27')];if(!_0x3516cf[_0xfe37('0x2a')]['hasOwnProperty']('nolimit')){_0x10c263[_0xfe37('0x2e')]=qs['limit'](_0x3516cf[_0xfe37('0x2a')]['limit']);_0x10c263[_0xfe37('0x1b')]=qs[_0xfe37('0x1b')](_0x3516cf[_0xfe37('0x2a')][_0xfe37('0x1b')]);}_0x10c263[_0xfe37('0x2f')]=qs[_0xfe37('0x30')](_0x3516cf[_0xfe37('0x2a')]['sort']);_0x10c263['where']=qs['filters'](_[_0xfe37('0x31')](_0x3516cf[_0xfe37('0x2a')],_0x75e153['filters']));if(_0x3516cf[_0xfe37('0x2a')][_0xfe37('0x32')]){_0x10c263[_0xfe37('0x33')]=_[_0xfe37('0x34')](_0x10c263[_0xfe37('0x33')],{'$or':_['map'](_0x4479d3,function(_0x3319c4){if(_0x3319c4[_0xfe37('0x25')]!==_0xfe37('0x35')){var _0x117511={};_0x117511[_0x3319c4[_0xfe37('0x28')]]={'$like':'%'+_0x3516cf[_0xfe37('0x2a')][_0xfe37('0x32')]+'%'};return _0x117511;}})});}_0x10c263=_[_0xfe37('0x34')]({},_0x10c263,_0x3516cf[_0xfe37('0x36')]);var _0x241eda={'where':_0x10c263['where']};return db[_0xfe37('0x37')][_0xfe37('0x1a')](_0x241eda)['then'](function(_0x2c1125){_0x4a5d6c['count']=_0x2c1125;if(_0x3516cf[_0xfe37('0x2a')][_0xfe37('0x38')]){_0x10c263[_0xfe37('0x39')]=[{'all':!![]}];}return db['ServicenowField'][_0xfe37('0x3a')](_0x10c263);})[_0xfe37('0x20')](function(_0x3acde0){_0x4a5d6c[_0xfe37('0x3b')]=_0x3acde0;return _0x4a5d6c;})[_0xfe37('0x20')](respondWithFilteredResult(_0x59afa8,_0x10c263))['catch'](handleError(_0x59afa8,null));};exports['show']=function(_0x3cb3ff,_0x4556cf){var _0x4f5252={'raw':!![],'where':{'id':_0x3cb3ff[_0xfe37('0x3c')]['id']}},_0x3d08c0={};_0x3d08c0['model']=_[_0xfe37('0x29')](db[_0xfe37('0x37')][_0xfe37('0x24')]);_0x3d08c0[_0xfe37('0x2a')]=_[_0xfe37('0x29')](_0x3cb3ff[_0xfe37('0x2a')]);_0x3d08c0[_0xfe37('0x2b')]=_[_0xfe37('0x3d')](_0x3d08c0[_0xfe37('0x27')],_0x3d08c0[_0xfe37('0x2a')]);_0x4f5252[_0xfe37('0x2c')]=_[_0xfe37('0x3d')](_0x3d08c0[_0xfe37('0x27')],qs[_0xfe37('0x2d')](_0x3cb3ff[_0xfe37('0x2a')][_0xfe37('0x2d')]));_0x4f5252[_0xfe37('0x2c')]=_0x4f5252[_0xfe37('0x2c')][_0xfe37('0x3e')]?_0x4f5252[_0xfe37('0x2c')]:_0x3d08c0[_0xfe37('0x27')];if(_0x3cb3ff[_0xfe37('0x2a')][_0xfe37('0x38')]){_0x4f5252[_0xfe37('0x39')]=[{'all':!![]}];}_0x4f5252=_[_0xfe37('0x34')]({},_0x4f5252,_0x3cb3ff[_0xfe37('0x36')]);return db[_0xfe37('0x37')]['find'](_0x4f5252)[_0xfe37('0x20')](handleEntityNotFound(_0x4556cf,null))['then'](respondWithResult(_0x4556cf,null))[_0xfe37('0x3f')](handleError(_0x4556cf,null));};exports[_0xfe37('0x40')]=function(_0xaa5534,_0x5da910){return db[_0xfe37('0x37')][_0xfe37('0x40')](_0xaa5534['body'],{})[_0xfe37('0x20')](respondWithResult(_0x5da910,0xc9))[_0xfe37('0x3f')](handleError(_0x5da910,null));};exports[_0xfe37('0x1f')]=function(_0x19936f,_0x4e2662){if(_0x19936f['body']['id']){delete _0x19936f[_0xfe37('0x41')]['id'];}return db[_0xfe37('0x37')][_0xfe37('0x42')]({'where':{'id':_0x19936f['params']['id']}})['then'](handleEntityNotFound(_0x4e2662,null))[_0xfe37('0x20')](saveUpdates(_0x19936f[_0xfe37('0x41')],null))['then'](respondWithResult(_0x4e2662,null))['catch'](handleError(_0x4e2662,null));};exports['destroy']=function(_0x5581b1,_0x38a438){return db['ServicenowField'][_0xfe37('0x42')]({'where':{'id':_0x5581b1[_0xfe37('0x3c')]['id']}})[_0xfe37('0x20')](handleEntityNotFound(_0x38a438,null))['then'](removeEntity(_0x38a438,null))['catch'](handleError(_0x38a438,null));}; \ No newline at end of file +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 diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 1f5fdf4..04a4c25 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 _0x7585=['moment','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','FieldId','lodash','../../config/logger'];(function(_0x5a4a93,_0x44d16c){var _0x19d830=function(_0x309f81){while(--_0x309f81){_0x5a4a93['push'](_0x5a4a93['shift']());}};_0x19d830(++_0x44d16c);}(_0x7585,0x77));var _0x5758=function(_0x51f6cb,_0x1ba61e){_0x51f6cb=_0x51f6cb-0x0;var _0x83a778=_0x7585[_0x51f6cb];return _0x83a778;};'use strict';var _=require(_0x5758('0x0'));var util=require('util');var logger=require(_0x5758('0x1'))('api');var moment=require(_0x5758('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(_0x5758('0x3'));var attributes=require(_0x5758('0x4'));module[_0x5758('0x5')]=function(_0x2fca2e,_0x1b51fd){return _0x2fca2e[_0x5758('0x6')](_0x5758('0x7'),attributes,{'tableName':_0x5758('0x8'),'paranoid':![],'indexes':[{'name':_0x5758('0x9'),'fields':['idField',_0x5758('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index ee696b7..bc3334a 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 _0x037d=['jayson/promise','client','http','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x50713c,_0x58b48c){var _0x26272e=function(_0x48b712){while(--_0x48b712){_0x50713c['push'](_0x50713c['shift']());}};_0x26272e(++_0x58b48c);}(_0x037d,0x85));var _0xd037=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x037d[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0xd037('0x0'));var util=require(_0xd037('0x1'));var moment=require(_0xd037('0x2'));var BPromise=require(_0xd037('0x3'));var rs=require(_0xd037('0x4'));var fs=require('fs');var Redis=require(_0xd037('0x5'));var db=require(_0xd037('0x6'))['db'];var utils=require(_0xd037('0x7'));var logger=require(_0xd037('0x8'))(_0xd037('0x9'));var config=require(_0xd037('0xa'));var jayson=require(_0xd037('0xb'));var client=jayson[_0xd037('0xc')][_0xd037('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2440a0,_0x7da939,_0x6df45e){return new BPromise(function(_0x4fe99a,_0x102917){return client['request'](_0x2440a0,_0x6df45e)['then'](function(_0x41a512){logger[_0xd037('0xe')](_0xd037('0xf'),_0x7da939,_0xd037('0x10'));logger[_0xd037('0x11')](_0xd037('0x12'),_0x7da939,_0xd037('0x10'),JSON[_0xd037('0x13')](_0x41a512));if(_0x41a512[_0xd037('0x14')]){if(_0x41a512[_0xd037('0x14')]['code']===0x1f4){logger[_0xd037('0x14')](_0xd037('0xf'),_0x7da939,_0x41a512[_0xd037('0x14')][_0xd037('0x15')]);return _0x102917(_0x41a512['error'][_0xd037('0x15')]);}logger[_0xd037('0x14')]('ServicenowField,\x20%s,\x20%s',_0x7da939,_0x41a512['error'][_0xd037('0x15')]);return _0x4fe99a(_0x41a512[_0xd037('0x14')][_0xd037('0x15')]);}else{logger[_0xd037('0xe')](_0xd037('0xf'),_0x7da939,'request\x20sent');_0x4fe99a(_0x41a512[_0xd037('0x16')][_0xd037('0x15')]);}})[_0xd037('0x17')](function(_0x423165){logger[_0xd037('0x14')](_0xd037('0xf'),_0x7da939,_0x423165);_0x102917(_0x423165);});});} \ No newline at end of file +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 diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 0faf442..da99f49 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 _0x5e12=['/:id/configurations','getFields','post','addConfiguration','update','delete','util','path','connect-timeout','express','Router','../../config/environment','./intSugarcrmAccount.controller','isAuthenticated','index','get','/:id','show'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x5e12,0x14a));var _0x25e1=function(_0x391c3f,_0x22131c){_0x391c3f=_0x391c3f-0x0;var _0x1205e4=_0x5e12[_0x391c3f];return _0x1205e4;};'use strict';var multer=require('multer');var util=require(_0x25e1('0x0'));var path=require(_0x25e1('0x1'));var timeout=require(_0x25e1('0x2'));var express=require(_0x25e1('0x3'));var router=express[_0x25e1('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x25e1('0x5'));var controller=require(_0x25e1('0x6'));router['get']('/',auth[_0x25e1('0x7')](),controller[_0x25e1('0x8')]);router[_0x25e1('0x9')](_0x25e1('0xa'),auth[_0x25e1('0x7')](),controller[_0x25e1('0xb')]);router[_0x25e1('0x9')](_0x25e1('0xc'),auth[_0x25e1('0x7')](),controller['getConfigurations']);router[_0x25e1('0x9')]('/:id/fields',auth[_0x25e1('0x7')](),controller[_0x25e1('0xd')]);router[_0x25e1('0xe')]('/',auth[_0x25e1('0x7')](),controller['create']);router[_0x25e1('0xe')](_0x25e1('0xc'),auth[_0x25e1('0x7')](),controller[_0x25e1('0xf')]);router['put'](_0x25e1('0xa'),auth[_0x25e1('0x7')](),controller[_0x25e1('0x10')]);router[_0x25e1('0x11')](_0x25e1('0xa'),auth[_0x25e1('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index ec5985e..3e81f83 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 _0x56c0=['STRING','username','remoteUri','sequelize','exports'];(function(_0xf8e8eb,_0x9126c1){var _0x4c6321=function(_0x5c9646){while(--_0x5c9646){_0xf8e8eb['push'](_0xf8e8eb['shift']());}};_0x4c6321(++_0x9126c1);}(_0x56c0,0x14d));var _0x056c=function(_0x4b05bc,_0xab381e){_0x4b05bc=_0x4b05bc-0x0;var _0x4eb14c=_0x56c0[_0x4b05bc];return _0x4eb14c;};'use strict';var Sequelize=require(_0x056c('0x0'));module[_0x056c('0x1')]={'name':{'type':Sequelize[_0x056c('0x2')]},'description':{'type':Sequelize[_0x056c('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x056c('0x3')},'password':{'type':Sequelize[_0x056c('0x2')]},'remoteUri':{'type':Sequelize[_0x056c('0x2')],'unique':_0x056c('0x4')},'serverUrl':{'type':Sequelize[_0x056c('0x2')]}}; \ No newline at end of file +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 diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index c42adfc..7244ceb 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 _0xceea=['SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','count','offset','set','Content-Range','json','apply','save','update','sendStatus','stack','name','send','map','SugarcrmAccount','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','include','findAll','show','params','includeAll','create','body','find','destroy','getConfigurations','findOne','keys','SugarcrmConfiguration','rawAttributes','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SugarcrmField','getFields','assigned_user_id','created_by','duration_minutes','parent_id','parent_type','direction','username','password','remoteUri','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','get_module_fields','Calls','values','remove','includes','label','endsWith','value','statusCode','Wrong\x20credentials','html-pdf','eml-format','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','../../components/integrations/configuration','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'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0xceea,0xe2));var _0xacee=function(_0x413078,_0x4db622){_0x413078=_0x413078-0x0;var _0xf845b4=_0xceea[_0x413078];return _0xf845b4;};'use strict';var pdf=require(_0xacee('0x0'));var emlformat=require(_0xacee('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xacee('0x2'));var moment=require('moment');var BPromise=require(_0xacee('0x3'));var Mustache=require(_0xacee('0x4'));var util=require('util');var path=require(_0xacee('0x5'));var sox=require(_0xacee('0x6'));var csv=require(_0xacee('0x7'));var ejs=require(_0xacee('0x8'));var fs=require('fs');var _=require(_0xacee('0x9'));var squel=require(_0xacee('0xa'));var crypto=require(_0xacee('0xb'));var jsforce=require(_0xacee('0xc'));var deskjs=require(_0xacee('0xd'));var toCsv=require('to-csv');var querystring=require(_0xacee('0xe'));var Papa=require(_0xacee('0xf'));var Redis=require(_0xacee('0x10'));var authService=require(_0xacee('0x11'));var qs=require(_0xacee('0x12'));var as=require(_0xacee('0x13'));var hardwareService=require(_0xacee('0x14'));var logger=require(_0xacee('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xacee('0x16'));var db=require(_0xacee('0x17'))['db'];var integrations=require(_0xacee('0x18'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x1713db,_0x34bf90,_0x494ae9){if(_0x494ae9){var _0x4e7e66=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4e7e66[_0xacee('0x19')](_0x34bf90)){return _0x1713db;}else{throw new db[(_0xacee('0x1a'))][(_0xacee('0x1b'))](_0xacee('0x1c'));}}else{return _0x1713db;}}function respondWithRpcPromise(_0x24d80d,_0x526e74,_0x2e370d,_0x34d812){return new BPromise(function(_0x597b21,_0x3c644b){var _0x42a1f2=_0x34d812||client;return _0x42a1f2[_0xacee('0x1d')](_0x24d80d,_0x2e370d)[_0xacee('0x1e')](function(_0x536cd6){logger[_0xacee('0x1f')](_0xacee('0x20'),_0x526e74,_0xacee('0x21'));logger[_0xacee('0x22')](_0xacee('0x23'),_0x526e74,'request\x20sent',JSON[_0xacee('0x24')](_0x536cd6));if(_0x536cd6[_0xacee('0x25')]){if(_0x536cd6[_0xacee('0x25')][_0xacee('0x26')]===0x1f4){logger['error'](_0xacee('0x20'),_0x526e74,_0x536cd6[_0xacee('0x25')][_0xacee('0x27')]);return _0x3c644b(_0x536cd6[_0xacee('0x25')]['message']);}logger[_0xacee('0x25')](_0xacee('0x20'),_0x526e74,_0x536cd6[_0xacee('0x25')]['message']);return _0x597b21(_0x536cd6['error'][_0xacee('0x27')]);}else{logger[_0xacee('0x1f')](_0xacee('0x20'),_0x526e74,_0xacee('0x21'));_0x597b21(_0x536cd6[_0xacee('0x28')][_0xacee('0x27')]);}})[_0xacee('0x29')](function(_0x6d02ea){logger['error'](_0xacee('0x20'),_0x526e74,_0x6d02ea);_0x3c644b(_0x6d02ea);});});}function respondWithStatusCode(_0x35a192,_0x59ea74){_0x59ea74=_0x59ea74||0xcc;return function(_0x11d441){if(_0x11d441){return _0x35a192['sendStatus'](_0x59ea74);}return _0x35a192[_0xacee('0x2a')](_0x59ea74)[_0xacee('0x2b')]();};}function respondWithResult(_0x4b6b75,_0x338f38){_0x338f38=_0x338f38||0xc8;return function(_0x285291){if(_0x285291){return _0x4b6b75[_0xacee('0x2a')](_0x338f38)['json'](_0x285291);}};}function respondWithFilteredResult(_0x3b3131,_0x47e6a6){return function(_0x2f0100){if(_0x2f0100){var _0x45c926=_0x2f0100[_0xacee('0x2c')],_0x82c385=_0x47e6a6[_0xacee('0x2d')],_0x43dd99=_0x47e6a6[_0xacee('0x2d')]+_0x47e6a6['limit'],_0x232216;if(_0x43dd99>=_0x45c926){_0x43dd99=_0x45c926;_0x232216=0xc8;}else{_0x232216=0xce;}_0x3b3131[_0xacee('0x2a')](_0x232216);return _0x3b3131[_0xacee('0x2e')](_0xacee('0x2f'),_0x82c385+'-'+_0x43dd99+'/'+_0x45c926)[_0xacee('0x30')](_0x2f0100);}return null;};}function patchUpdates(_0x5c4a17){return function(_0xfc908d){try{jsonpatch[_0xacee('0x31')](_0xfc908d,_0x5c4a17,!![]);}catch(_0x7755f1){return BPromise['reject'](_0x7755f1);}return _0xfc908d[_0xacee('0x32')]();};}function saveUpdates(_0x41d0a8,_0x15de83){return function(_0x1edee2){if(_0x1edee2){return _0x1edee2[_0xacee('0x33')](_0x41d0a8)[_0xacee('0x1e')](function(_0x12d5ea){return _0x12d5ea;});}return null;};}function removeEntity(_0x2dc50a,_0x37f781){return function(_0x3f3dfa){if(_0x3f3dfa){return _0x3f3dfa['destroy']()[_0xacee('0x1e')](function(){_0x2dc50a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x322744,_0x2df854){return function(_0x38d1d3){if(!_0x38d1d3){_0x322744[_0xacee('0x34')](0x194);}return _0x38d1d3;};}function handleError(_0x473884,_0x5248ae){_0x5248ae=_0x5248ae||0x1f4;return function(_0x77e905){logger[_0xacee('0x25')](_0x77e905[_0xacee('0x35')]);if(_0x77e905[_0xacee('0x36')]){delete _0x77e905[_0xacee('0x36')];}_0x473884[_0xacee('0x2a')](_0x5248ae)[_0xacee('0x37')](_0x77e905);};}exports['index']=function(_0x4ac0bb,_0x4eb00b){var _0x1d5baf={},_0x175f24={},_0x4cb1c1={'count':0x0,'rows':[]};var _0x2965fb=_[_0xacee('0x38')](db[_0xacee('0x39')]['rawAttributes'],function(_0x5300a7){return{'name':_0x5300a7[_0xacee('0x3a')],'type':_0x5300a7[_0xacee('0x3b')][_0xacee('0x3c')]};});_0x175f24[_0xacee('0x3d')]=_[_0xacee('0x38')](_0x2965fb,'name');_0x175f24[_0xacee('0x3e')]=_['keys'](_0x4ac0bb['query']);_0x175f24[_0xacee('0x3f')]=_[_0xacee('0x40')](_0x175f24['model'],_0x175f24[_0xacee('0x3e')]);_0x1d5baf[_0xacee('0x41')]=_[_0xacee('0x40')](_0x175f24[_0xacee('0x3d')],qs[_0xacee('0x42')](_0x4ac0bb['query'][_0xacee('0x42')]));_0x1d5baf[_0xacee('0x41')]=_0x1d5baf['attributes'][_0xacee('0x43')]?_0x1d5baf[_0xacee('0x41')]:_0x175f24['model'];if(!_0x4ac0bb[_0xacee('0x3e')][_0xacee('0x44')](_0xacee('0x45'))){_0x1d5baf['limit']=qs['limit'](_0x4ac0bb[_0xacee('0x3e')][_0xacee('0x46')]);_0x1d5baf[_0xacee('0x2d')]=qs['offset'](_0x4ac0bb[_0xacee('0x3e')][_0xacee('0x2d')]);}_0x1d5baf[_0xacee('0x47')]=qs[_0xacee('0x48')](_0x4ac0bb[_0xacee('0x3e')][_0xacee('0x48')]);_0x1d5baf[_0xacee('0x49')]=qs[_0xacee('0x3f')](_[_0xacee('0x4a')](_0x4ac0bb['query'],_0x175f24[_0xacee('0x3f')]));if(_0x4ac0bb[_0xacee('0x3e')][_0xacee('0x4b')]){_0x1d5baf[_0xacee('0x49')]=_['merge'](_0x1d5baf[_0xacee('0x49')],{'$or':_[_0xacee('0x38')](_0x2965fb,function(_0x5084bc){if(_0x5084bc[_0xacee('0x3b')]!=='VIRTUAL'){var _0x1f0ff3={};_0x1f0ff3[_0x5084bc[_0xacee('0x36')]]={'$like':'%'+_0x4ac0bb[_0xacee('0x3e')][_0xacee('0x4b')]+'%'};return _0x1f0ff3;}})});}_0x1d5baf=_[_0xacee('0x4c')]({},_0x1d5baf,_0x4ac0bb[_0xacee('0x4d')]);var _0x3565ef={'where':_0x1d5baf['where']};return db[_0xacee('0x39')][_0xacee('0x2c')](_0x3565ef)[_0xacee('0x1e')](function(_0x1b257c){_0x4cb1c1['count']=_0x1b257c;if(_0x4ac0bb[_0xacee('0x3e')]['includeAll']){_0x1d5baf[_0xacee('0x4e')]=[{'all':!![]}];}return db[_0xacee('0x39')][_0xacee('0x4f')](_0x1d5baf);})[_0xacee('0x1e')](function(_0x12afbe){_0x4cb1c1['rows']=_0x12afbe;return _0x4cb1c1;})[_0xacee('0x1e')](respondWithFilteredResult(_0x4eb00b,_0x1d5baf))[_0xacee('0x29')](handleError(_0x4eb00b,null));};exports[_0xacee('0x50')]=function(_0xa77081,_0x437ca3){var _0x1ea8d9={'raw':![],'where':{'id':_0xa77081[_0xacee('0x51')]['id']}},_0xabb5d5={};_0xabb5d5[_0xacee('0x3d')]=_['keys'](db[_0xacee('0x39')]['rawAttributes']);_0xabb5d5[_0xacee('0x3e')]=_['keys'](_0xa77081[_0xacee('0x3e')]);_0xabb5d5[_0xacee('0x3f')]=_[_0xacee('0x40')](_0xabb5d5[_0xacee('0x3d')],_0xabb5d5['query']);_0x1ea8d9[_0xacee('0x41')]=_['intersection'](_0xabb5d5[_0xacee('0x3d')],qs['fields'](_0xa77081[_0xacee('0x3e')]['fields']));_0x1ea8d9[_0xacee('0x41')]=_0x1ea8d9[_0xacee('0x41')]['length']?_0x1ea8d9[_0xacee('0x41')]:_0xabb5d5[_0xacee('0x3d')];if(_0xa77081['query'][_0xacee('0x52')]){_0x1ea8d9['include']=[{'all':!![]}];}_0x1ea8d9=_[_0xacee('0x4c')]({},_0x1ea8d9,_0xa77081['options']);return db[_0xacee('0x39')]['find'](_0x1ea8d9)[_0xacee('0x1e')](handleEntityNotFound(_0x437ca3,null))['then'](respondWithResult(_0x437ca3,null))[_0xacee('0x29')](handleError(_0x437ca3,null));};exports['create']=function(_0x4e2e9a,_0x476601){return db[_0xacee('0x39')][_0xacee('0x53')](_0x4e2e9a[_0xacee('0x54')],{})[_0xacee('0x1e')](respondWithResult(_0x476601,0xc9))[_0xacee('0x29')](handleError(_0x476601,null));};exports[_0xacee('0x33')]=function(_0x244748,_0x1b48d4){if(_0x244748['body']['id']){delete _0x244748[_0xacee('0x54')]['id'];}return db[_0xacee('0x39')][_0xacee('0x55')]({'where':{'id':_0x244748[_0xacee('0x51')]['id']}})['then'](handleEntityNotFound(_0x1b48d4,null))['then'](saveUpdates(_0x244748[_0xacee('0x54')],null))[_0xacee('0x1e')](respondWithResult(_0x1b48d4,null))[_0xacee('0x29')](handleError(_0x1b48d4,null));};exports[_0xacee('0x56')]=function(_0x58620c,_0x2ded48){return db[_0xacee('0x39')]['find']({'where':{'id':_0x58620c[_0xacee('0x51')]['id']}})['then'](handleEntityNotFound(_0x2ded48,null))[_0xacee('0x1e')](removeEntity(_0x2ded48,null))[_0xacee('0x29')](handleError(_0x2ded48,null));};exports[_0xacee('0x57')]=function(_0x1f8756,_0x41dea4,_0x932449){var _0x33093a={};var _0x20ef9e={};var _0x29cb84;var _0x160714;return db[_0xacee('0x39')][_0xacee('0x58')]({'where':{'id':_0x1f8756['params']['id']}})[_0xacee('0x1e')](handleEntityNotFound(_0x41dea4,null))[_0xacee('0x1e')](function(_0x1b493f){if(_0x1b493f){_0x29cb84=_0x1b493f;_0x20ef9e[_0xacee('0x3d')]=_[_0xacee('0x59')](db[_0xacee('0x5a')][_0xacee('0x5b')]);_0x20ef9e['query']=_[_0xacee('0x59')](_0x1f8756[_0xacee('0x3e')]);_0x20ef9e[_0xacee('0x3f')]=_[_0xacee('0x40')](_0x20ef9e[_0xacee('0x3d')],_0x20ef9e['query']);_0x33093a[_0xacee('0x41')]=_[_0xacee('0x40')](_0x20ef9e['model'],qs[_0xacee('0x42')](_0x1f8756['query'][_0xacee('0x42')]));_0x33093a[_0xacee('0x41')]=_0x33093a[_0xacee('0x41')][_0xacee('0x43')]?_0x33093a['attributes']:_0x20ef9e[_0xacee('0x3d')];_0x33093a[_0xacee('0x47')]=qs[_0xacee('0x48')](_0x1f8756[_0xacee('0x3e')][_0xacee('0x48')]);_0x33093a['where']=qs['filters'](_[_0xacee('0x4a')](_0x1f8756[_0xacee('0x3e')],_0x20ef9e[_0xacee('0x3f')]));if(_0x1f8756[_0xacee('0x3e')][_0xacee('0x4b')]){_0x33093a[_0xacee('0x49')]=_['merge'](_0x33093a[_0xacee('0x49')],{'$or':_[_0xacee('0x38')](_0x33093a[_0xacee('0x41')],function(_0x55365c){var _0x5d9ced={};_0x5d9ced[_0x55365c]={'$like':'%'+_0x1f8756[_0xacee('0x3e')][_0xacee('0x4b')]+'%'};return _0x5d9ced;})});}_0x33093a=_[_0xacee('0x4c')]({},_0x33093a,_0x1f8756['options']);return _0x29cb84[_0xacee('0x57')](_0x33093a);}})[_0xacee('0x1e')](function(_0xa077bc){if(_0xa077bc){_0x160714=_0xa077bc[_0xacee('0x43')];if(!_0x1f8756[_0xacee('0x3e')][_0xacee('0x44')](_0xacee('0x45'))){_0x33093a['limit']=qs[_0xacee('0x46')](_0x1f8756[_0xacee('0x3e')][_0xacee('0x46')]);_0x33093a['offset']=qs[_0xacee('0x2d')](_0x1f8756['query'][_0xacee('0x2d')]);}return _0x29cb84[_0xacee('0x57')](_0x33093a);}})[_0xacee('0x1e')](function(_0x187893){if(_0x187893){return _0x187893?{'count':_0x160714,'rows':_0x187893}:null;}})[_0xacee('0x1e')](respondWithResult(_0x41dea4,null))[_0xacee('0x29')](handleError(_0x41dea4,null));};exports['addConfiguration']=function(_0x30532a,_0x5101b4,_0x2d0fac){if(_0x30532a['body']['id']){delete _0x30532a['body']['id'];}return db[_0xacee('0x39')][_0xacee('0x58')]({'where':{'id':_0x30532a['params']['id']}})[_0xacee('0x1e')](handleEntityNotFound(_0x5101b4,null))[_0xacee('0x1e')](function(_0x3a58f0){if(_0x3a58f0){_0x30532a['body'][_0xacee('0x5c')]=_0x3a58f0['id'];_0x30532a['body'][_0xacee('0x5d')]=integrations[_0xacee('0x5e')](_0x30532a['body']['channel'],_0x30532a[_0xacee('0x54')]['type']);_0x30532a['body'][_0xacee('0x5f')]=integrations[_0xacee('0x60')](_0x30532a['body'][_0xacee('0x61')],_0x30532a['body'][_0xacee('0x3b')]);return db['SugarcrmConfiguration'][_0xacee('0x53')](_0x30532a[_0xacee('0x54')],{'include':[{'model':db[_0xacee('0x62')],'as':_0xacee('0x5d')},{'model':db[_0xacee('0x62')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x5101b4,null))[_0xacee('0x29')](handleError(_0x5101b4,null));};exports[_0xacee('0x63')]=function(_0x236d89,_0x59cafd,_0x5e113c){var _0x18d5bd='';var _0x95e5b4=['id',_0xacee('0x36'),_0xacee('0x64'),_0xacee('0x65'),'description','date_start','duration_hours',_0xacee('0x66'),_0xacee('0x67'),_0xacee('0x68'),'parent_name',_0xacee('0x69')];return db[_0xacee('0x39')]['findOne']({'where':{'id':_0x236d89[_0xacee('0x51')]['id']},'attributes':['id',_0xacee('0x6a'),_0xacee('0x6b'),'remoteUri']})['then'](handleEntityNotFound(_0x59cafd,null))[_0xacee('0x1e')](function(_0xa874df){if(_0xa874df){_0x18d5bd=_0xa874df[_0xacee('0x6c')];var _0x2c300e=_0x18d5bd['slice'](-0x1);if(_0x2c300e==='/'){_0x18d5bd=_0x18d5bd['substring'](0x0,_0x18d5bd[_0xacee('0x6d')](_0x2c300e));}return rp({'method':_0xacee('0x6e'),'uri':util[_0xacee('0x6f')](_0xacee('0x70'),_0x18d5bd,_0xacee('0x71')),'json':!![],'form':{'method':_0xacee('0x72'),'input_type':_0xacee('0x73'),'response_type':_0xacee('0x73'),'rest_data':JSON[_0xacee('0x24')]({'user_auth':{'user_name':_0xa874df[_0xacee('0x6a')],'password':_0xa874df['password'],'encryption':_0xacee('0x74')},'application':_0xacee('0x75')})}});}})[_0xacee('0x1e')](function(_0x5f1e1d){if(_0x5f1e1d&&_0x5f1e1d[_0xacee('0x36')]!=='Invalid\x20Login'&&_0x5f1e1d[_0xacee('0x36')]!==_0xacee('0x76')){return rp({'method':'POST','uri':util[_0xacee('0x6f')](_0xacee('0x70'),_0x18d5bd,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xacee('0x77'),'input_type':_0xacee('0x73'),'response_type':_0xacee('0x73'),'rest_data':JSON['stringify']({'session':_0x5f1e1d['id'],'module_name':_0xacee('0x78')})}})[_0xacee('0x1e')](function(_0x5528b5){if(_0x5528b5){var _0xca18dd=_[_0xacee('0x79')](_0x5528b5['module_fields']);_[_0xacee('0x7a')](_0xca18dd,function(_0x270d75){return _0x95e5b4[_0xacee('0x7b')](_0x270d75['name']);});return{'count':_0xca18dd['length'],'rows':_['map'](_0xca18dd,function(_0x1c6482){return{'id':_0x1c6482['name'],'name':_0x1c6482[_0xacee('0x7c')],'custom':_[_0xacee('0x7d')](_0x1c6482[_0xacee('0x36')],'_c')?!![]:![],'options':_0x1c6482['options']?_[_0xacee('0x38')](_[_0xacee('0x79')](_0x1c6482[_0xacee('0x4d')]),function(_0x23761c){return{'name':_0x23761c[_0xacee('0x7e')],'value':_0x23761c[_0xacee('0x36')]};}):[]};})};}})[_0xacee('0x1e')](respondWithResult(_0x59cafd,null))[_0xacee('0x29')](function(_0x2b24b2){var _0x10e1c7=_0x236d89['query'][_0xacee('0x19')]?0x1f4:_0x2b24b2[_0xacee('0x7f')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xacee('0x63'),_0x10e1c7,JSON[_0xacee('0x24')](_0x2b24b2));delete _0x2b24b2[_0xacee('0x36')];if(_0x10e1c7===0x191){_0x10e1c7=0x190;}_0x59cafd[_0xacee('0x2a')](_0x10e1c7)[_0xacee('0x37')](_0x236d89[_0xacee('0x3e')][_0xacee('0x19')]?{'message':_0xacee('0x80'),'statusCode':_0x2b24b2[_0xacee('0x7f')]}:_0x2b24b2);});}else{var _0x530e2b=0x1f4;_0x59cafd[_0xacee('0x2a')](_0x530e2b)['send']({'message':_0xacee('0x80'),'statusCode':0x190});}});}; \ No newline at end of file +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 diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 6143203..1efe2e8 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 _0xac63=['exports','define','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration'];(function(_0x507ac5,_0x33aaee){var _0x12c1bc=function(_0x5c953c){while(--_0x5c953c){_0x507ac5['push'](_0x507ac5['shift']());}};_0x12c1bc(++_0x33aaee);}(_0xac63,0x122));var _0x3ac6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xac63[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0x3ac6('0x0'));var logger=require(_0x3ac6('0x1'))(_0x3ac6('0x2'));var moment=require(_0x3ac6('0x3'));var BPromise=require(_0x3ac6('0x4'));var rp=require(_0x3ac6('0x5'));var fs=require('fs');var path=require(_0x3ac6('0x6'));var rimraf=require(_0x3ac6('0x7'));var config=require('../../config/environment');var attributes=require(_0x3ac6('0x8'));var integrations=require(_0x3ac6('0x9'));module[_0x3ac6('0xa')]=function(_0xc092f0,_0x5a865d){return _0xc092f0[_0x3ac6('0xb')]('SugarcrmAccount',attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index b79ed39..d5f602e 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 _0x4495=['SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','ShowSugarcrmAccount','find','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','GetSugarcrmAccount'];(function(_0x463183,_0x56bd4e){var _0xd5fe56=function(_0x55cb29){while(--_0x55cb29){_0x463183['push'](_0x463183['shift']());}};_0xd5fe56(++_0x56bd4e);}(_0x4495,0xd4));var _0x5449=function(_0x30f5ed,_0x1df729){_0x30f5ed=_0x30f5ed-0x0;var _0x10bb01=_0x4495[_0x30f5ed];return _0x10bb01;};'use strict';var _=require('lodash');var util=require(_0x5449('0x0'));var moment=require(_0x5449('0x1'));var BPromise=require('bluebird');var rs=require(_0x5449('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5449('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5449('0x4'));var config=require(_0x5449('0x5'));var jayson=require(_0x5449('0x6'));var client=jayson[_0x5449('0x7')][_0x5449('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xfaa0dd,_0x3b946b,_0x4a63f2){return new BPromise(function(_0x5507a9,_0x517ba1){return client['request'](_0xfaa0dd,_0x4a63f2)[_0x5449('0x9')](function(_0x168979){logger['info'](_0x5449('0xa'),_0x3b946b,_0x5449('0xb'));logger['debug'](_0x5449('0xc'),_0x3b946b,_0x5449('0xb'),JSON['stringify'](_0x168979));if(_0x168979[_0x5449('0xd')]){if(_0x168979[_0x5449('0xd')]['code']===0x1f4){logger[_0x5449('0xd')]('SugarcrmAccount,\x20%s,\x20%s',_0x3b946b,_0x168979[_0x5449('0xd')][_0x5449('0xe')]);return _0x517ba1(_0x168979[_0x5449('0xd')][_0x5449('0xe')]);}logger['error'](_0x5449('0xa'),_0x3b946b,_0x168979[_0x5449('0xd')][_0x5449('0xe')]);return _0x5507a9(_0x168979[_0x5449('0xd')]['message']);}else{logger[_0x5449('0xf')](_0x5449('0xa'),_0x3b946b,_0x5449('0xb'));_0x5507a9(_0x168979[_0x5449('0x10')][_0x5449('0xe')]);}})[_0x5449('0x11')](function(_0x4e56e1){logger[_0x5449('0xd')](_0x5449('0xa'),_0x3b946b,_0x4e56e1);_0x517ba1(_0x4e56e1);});});}exports[_0x5449('0x12')]=function(_0x2e3060){var _0x5d6c6a=this;return new Promise(function(_0x3c5ae8,_0x5ac0b5){return db[_0x5449('0x13')][_0x5449('0x14')]({'raw':_0x2e3060[_0x5449('0x15')]?_0x2e3060[_0x5449('0x15')][_0x5449('0x16')]===undefined?!![]:![]:!![],'where':_0x2e3060[_0x5449('0x15')]?_0x2e3060[_0x5449('0x15')][_0x5449('0x17')]||null:null,'attributes':_0x2e3060[_0x5449('0x15')]?_0x2e3060[_0x5449('0x15')][_0x5449('0x18')]||null:null,'limit':_0x2e3060[_0x5449('0x15')]?_0x2e3060['options'][_0x5449('0x19')]||null:null,'include':_0x2e3060[_0x5449('0x15')]?_0x2e3060[_0x5449('0x15')][_0x5449('0x1a')]?_[_0x5449('0x1b')](_0x2e3060[_0x5449('0x15')][_0x5449('0x1a')],function(_0x417848){return{'model':db[_0x417848[_0x5449('0x1c')]],'as':_0x417848['as'],'attributes':_0x417848['attributes'],'include':_0x417848[_0x5449('0x1a')]?_[_0x5449('0x1b')](_0x417848['include'],function(_0x12bb8f){return{'model':db[_0x12bb8f[_0x5449('0x1c')]],'as':_0x12bb8f['as'],'attributes':_0x12bb8f[_0x5449('0x18')],'include':_0x12bb8f[_0x5449('0x1a')]?_[_0x5449('0x1b')](_0x12bb8f[_0x5449('0x1a')],function(_0x4206f1){return{'model':db[_0x4206f1['model']],'as':_0x4206f1['as'],'attributes':_0x4206f1[_0x5449('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f0912){logger[_0x5449('0xf')](_0x5449('0x12'),_0x2e3060);logger[_0x5449('0x1d')](_0x5449('0x12'),_0x2e3060,JSON[_0x5449('0x1e')](_0x4f0912));_0x3c5ae8(_0x4f0912);})[_0x5449('0x11')](function(_0x25f2d9){logger[_0x5449('0xd')](_0x5449('0x12'),_0x25f2d9[_0x5449('0xe')],_0x2e3060);_0x5ac0b5(_0x5d6c6a['error'](0x1f4,_0x25f2d9['message']));});});};exports[_0x5449('0x1f')]=function(_0x372a4c){var _0x2e013f=this;return new Promise(function(_0x502f4a,_0x2f44e6){return db[_0x5449('0x13')][_0x5449('0x20')]({'raw':_0x372a4c[_0x5449('0x15')]?_0x372a4c[_0x5449('0x15')][_0x5449('0x16')]===undefined?!![]:![]:!![],'where':_0x372a4c[_0x5449('0x15')]?_0x372a4c[_0x5449('0x15')][_0x5449('0x17')]||null:null,'attributes':_0x372a4c[_0x5449('0x15')]?_0x372a4c[_0x5449('0x15')][_0x5449('0x18')]||null:null,'include':_0x372a4c[_0x5449('0x15')]?_0x372a4c['options']['include']?_[_0x5449('0x1b')](_0x372a4c['options'][_0x5449('0x1a')],function(_0x70e2de){return{'model':db[_0x70e2de[_0x5449('0x1c')]],'as':_0x70e2de['as'],'attributes':_0x70e2de['attributes'],'include':_0x70e2de[_0x5449('0x1a')]?_[_0x5449('0x1b')](_0x70e2de[_0x5449('0x1a')],function(_0x5e0ad3){return{'model':db[_0x5e0ad3[_0x5449('0x1c')]],'as':_0x5e0ad3['as'],'attributes':_0x5e0ad3['attributes'],'include':_0x5e0ad3['include']?_[_0x5449('0x1b')](_0x5e0ad3[_0x5449('0x1a')],function(_0x5e0a2b){return{'model':db[_0x5e0a2b[_0x5449('0x1c')]],'as':_0x5e0a2b['as'],'attributes':_0x5e0a2b[_0x5449('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5dec88){logger['info'](_0x5449('0x1f'),_0x372a4c);logger[_0x5449('0x1d')](_0x5449('0x1f'),_0x372a4c,JSON[_0x5449('0x1e')](_0x5dec88));_0x502f4a(_0x5dec88);})[_0x5449('0x11')](function(_0x4ef536){logger[_0x5449('0xd')](_0x5449('0x1f'),_0x4ef536[_0x5449('0xe')],_0x372a4c);_0x2f44e6(_0x2e013f[_0x5449('0xd')](0x1f4,_0x4ef536[_0x5449('0xe')]));});});}; \ No newline at end of file +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 diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index cdc46c7..0c01d4d 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 _0xde9a=['put','update','delete','destroy','exports','util','path','express','../../components/auth/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create'];(function(_0x3cb40e,_0x53eb07){var _0x3371e8=function(_0x452e38){while(--_0x452e38){_0x3cb40e['push'](_0x3cb40e['shift']());}};_0x3371e8(++_0x53eb07);}(_0xde9a,0x155));var _0xade9=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xde9a[_0x5c2e3e];return _0x53f64a;};'use strict';var multer=require('multer');var util=require(_0xade9('0x0'));var path=require(_0xade9('0x1'));var timeout=require('connect-timeout');var express=require(_0xade9('0x2'));var router=express['Router']();var auth=require(_0xade9('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xade9('0x4'));router[_0xade9('0x5')]('/',auth[_0xade9('0x6')](),controller[_0xade9('0x7')]);router[_0xade9('0x5')](_0xade9('0x8'),auth[_0xade9('0x6')](),controller[_0xade9('0x9')]);router[_0xade9('0x5')]('/:id/fields',auth['isAuthenticated'](),controller[_0xade9('0xa')]);router[_0xade9('0x5')](_0xade9('0xb'),auth[_0xade9('0x6')](),controller[_0xade9('0xc')]);router[_0xade9('0x5')](_0xade9('0xd'),auth['isAuthenticated'](),controller[_0xade9('0xe')]);router['post']('/',auth[_0xade9('0x6')](),controller[_0xade9('0xf')]);router[_0xade9('0x10')](_0xade9('0x8'),auth[_0xade9('0x6')](),controller[_0xade9('0x11')]);router[_0xade9('0x12')](_0xade9('0x8'),auth[_0xade9('0x6')](),controller[_0xade9('0x13')]);module[_0xade9('0x14')]=router; \ No newline at end of file +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 diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 5516c48..5e8d283 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 _0x14df=['STRING','sequelize','exports'];(function(_0x37d0be,_0x4b6660){var _0x2474e2=function(_0x277451){while(--_0x277451){_0x37d0be['push'](_0x37d0be['shift']());}};_0x2474e2(++_0x4b6660);}(_0x14df,0xe2));var _0xf14d=function(_0x132836,_0x2bcae1){_0x132836=_0x132836-0x0;var _0x314e44=_0x14df[_0x132836];return _0x314e44;};'use strict';var Sequelize=require(_0xf14d('0x0'));module[_0xf14d('0x1')]={'name':{'type':Sequelize[_0xf14d('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +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 diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 6c9f024..4c5c65b 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 _0x7da8=['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','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','update','end','stack','name','index','SugarcrmConfiguration','fieldName','key','map','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','show','params','keys','rawAttributes','includeAll','find','create','body','destroy','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','eml-format','rimraf','request-promise','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'];(function(_0x4bd52f,_0x1347e3){var _0x280d6d=function(_0x1ba0b){while(--_0x1ba0b){_0x4bd52f['push'](_0x4bd52f['shift']());}};_0x280d6d(++_0x1347e3);}(_0x7da8,0x168));var _0x87da=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x7da8[_0xbca1b1];return _0x4e1686;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x87da('0x0'));var rimraf=require(_0x87da('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x87da('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x87da('0x3'));var path=require(_0x87da('0x4'));var sox=require(_0x87da('0x5'));var csv=require(_0x87da('0x6'));var ejs=require(_0x87da('0x7'));var fs=require('fs');var _=require(_0x87da('0x8'));var squel=require(_0x87da('0x9'));var crypto=require(_0x87da('0xa'));var jsforce=require(_0x87da('0xb'));var deskjs=require(_0x87da('0xc'));var toCsv=require(_0x87da('0x6'));var querystring=require(_0x87da('0xd'));var Papa=require(_0x87da('0xe'));var Redis=require(_0x87da('0xf'));var authService=require(_0x87da('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x87da('0x11'));var hardwareService=require(_0x87da('0x12'));var logger=require(_0x87da('0x13'))(_0x87da('0x14'));var utils=require(_0x87da('0x15'));var config=require(_0x87da('0x16'));var db=require(_0x87da('0x17'))['db'];var jayson=require(_0x87da('0x18'));var client=jayson['client'][_0x87da('0x19')]({'port':0x232a});function checkPasswordPattern(_0x362869,_0x4f325b,_0x2b33b1){if(_0x2b33b1){var _0x58699f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x58699f[_0x87da('0x1a')](_0x4f325b)){return _0x362869;}else{throw new db[(_0x87da('0x1b'))][(_0x87da('0x1c'))](_0x87da('0x1d'));}}else{return _0x362869;}}function respondWithRpcPromise(_0x33a822,_0x56fa5e,_0x38ae92,_0x4a2674){return new BPromise(function(_0x52326e,_0x204ca2){var _0x5b108c=_0x4a2674||client;return _0x5b108c[_0x87da('0x1e')](_0x33a822,_0x38ae92)[_0x87da('0x1f')](function(_0x29e9ab){logger['info'](_0x87da('0x20'),_0x56fa5e,_0x87da('0x21'));logger[_0x87da('0x22')](_0x87da('0x23'),_0x56fa5e,_0x87da('0x21'),JSON[_0x87da('0x24')](_0x29e9ab));if(_0x29e9ab[_0x87da('0x25')]){if(_0x29e9ab['error'][_0x87da('0x26')]===0x1f4){logger[_0x87da('0x25')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x56fa5e,_0x29e9ab[_0x87da('0x25')]['message']);return _0x204ca2(_0x29e9ab[_0x87da('0x25')][_0x87da('0x27')]);}logger['error'](_0x87da('0x20'),_0x56fa5e,_0x29e9ab[_0x87da('0x25')][_0x87da('0x27')]);return _0x52326e(_0x29e9ab[_0x87da('0x25')][_0x87da('0x27')]);}else{logger[_0x87da('0x28')](_0x87da('0x20'),_0x56fa5e,_0x87da('0x21'));_0x52326e(_0x29e9ab[_0x87da('0x29')][_0x87da('0x27')]);}})[_0x87da('0x2a')](function(_0x2b2fbd){logger['error'](_0x87da('0x20'),_0x56fa5e,_0x2b2fbd);_0x204ca2(_0x2b2fbd);});});}function respondWithStatusCode(_0x30137b,_0x218c3c){_0x218c3c=_0x218c3c||0xcc;return function(_0x43226c){if(_0x43226c){return _0x30137b[_0x87da('0x2b')](_0x218c3c);}return _0x30137b['status'](_0x218c3c)['end']();};}function respondWithResult(_0x5523c6,_0x541287){_0x541287=_0x541287||0xc8;return function(_0x17cd0d){if(_0x17cd0d){return _0x5523c6[_0x87da('0x2c')](_0x541287)[_0x87da('0x2d')](_0x17cd0d);}};}function respondWithFilteredResult(_0x34060b,_0x4c4b71){return function(_0x308810){if(_0x308810){var _0x64063c=_0x308810[_0x87da('0x2e')],_0x4f517e=_0x4c4b71[_0x87da('0x2f')],_0x5cca0a=_0x4c4b71['offset']+_0x4c4b71['limit'],_0x532d04;if(_0x5cca0a>=_0x64063c){_0x5cca0a=_0x64063c;_0x532d04=0xc8;}else{_0x532d04=0xce;}_0x34060b['status'](_0x532d04);return _0x34060b[_0x87da('0x30')](_0x87da('0x31'),_0x4f517e+'-'+_0x5cca0a+'/'+_0x64063c)['json'](_0x308810);}return null;};}function patchUpdates(_0x3aff4c){return function(_0x441c27){try{jsonpatch[_0x87da('0x32')](_0x441c27,_0x3aff4c,!![]);}catch(_0x174fcb){return BPromise[_0x87da('0x33')](_0x174fcb);}return _0x441c27['save']();};}function saveUpdates(_0x28e917,_0xb34ce1){return function(_0x22bcee){if(_0x22bcee){return _0x22bcee[_0x87da('0x34')](_0x28e917)[_0x87da('0x1f')](function(_0x351559){return _0x351559;});}return null;};}function removeEntity(_0x4f9e4f,_0x3b69c3){return function(_0x3530ad){if(_0x3530ad){return _0x3530ad['destroy']()[_0x87da('0x1f')](function(){_0x4f9e4f[_0x87da('0x2c')](0xcc)[_0x87da('0x35')]();});}};}function handleEntityNotFound(_0x4a4ad4,_0x330cb4){return function(_0x3cba37){if(!_0x3cba37){_0x4a4ad4[_0x87da('0x2b')](0x194);}return _0x3cba37;};}function handleError(_0x214c29,_0x10cab4){_0x10cab4=_0x10cab4||0x1f4;return function(_0x2eca2e){logger['error'](_0x2eca2e[_0x87da('0x36')]);if(_0x2eca2e[_0x87da('0x37')]){delete _0x2eca2e[_0x87da('0x37')];}_0x214c29[_0x87da('0x2c')](_0x10cab4)['send'](_0x2eca2e);};}exports[_0x87da('0x38')]=function(_0x2ab5b8,_0x3acfcd){var _0x410e56={},_0x15bd1b={},_0x26e896={'count':0x0,'rows':[]};var _0x47bb83=_['map'](db[_0x87da('0x39')]['rawAttributes'],function(_0x3d345a){return{'name':_0x3d345a[_0x87da('0x3a')],'type':_0x3d345a['type'][_0x87da('0x3b')]};});_0x15bd1b['model']=_[_0x87da('0x3c')](_0x47bb83,'name');_0x15bd1b[_0x87da('0x3d')]=_['keys'](_0x2ab5b8[_0x87da('0x3d')]);_0x15bd1b[_0x87da('0x3e')]=_['intersection'](_0x15bd1b[_0x87da('0x3f')],_0x15bd1b[_0x87da('0x3d')]);_0x410e56[_0x87da('0x40')]=_[_0x87da('0x41')](_0x15bd1b[_0x87da('0x3f')],qs[_0x87da('0x42')](_0x2ab5b8['query']['fields']));_0x410e56[_0x87da('0x40')]=_0x410e56['attributes'][_0x87da('0x43')]?_0x410e56[_0x87da('0x40')]:_0x15bd1b[_0x87da('0x3f')];if(!_0x2ab5b8[_0x87da('0x3d')][_0x87da('0x44')](_0x87da('0x45'))){_0x410e56[_0x87da('0x46')]=qs['limit'](_0x2ab5b8['query'][_0x87da('0x46')]);_0x410e56[_0x87da('0x2f')]=qs[_0x87da('0x2f')](_0x2ab5b8['query'][_0x87da('0x2f')]);}_0x410e56[_0x87da('0x47')]=qs['sort'](_0x2ab5b8['query'][_0x87da('0x48')]);_0x410e56[_0x87da('0x49')]=qs['filters'](_[_0x87da('0x4a')](_0x2ab5b8['query'],_0x15bd1b['filters']));if(_0x2ab5b8['query'][_0x87da('0x4b')]){_0x410e56[_0x87da('0x49')]=_[_0x87da('0x4c')](_0x410e56[_0x87da('0x49')],{'$or':_[_0x87da('0x3c')](_0x47bb83,function(_0x54749f){if(_0x54749f[_0x87da('0x4d')]!==_0x87da('0x4e')){var _0x2ee03d={};_0x2ee03d[_0x54749f[_0x87da('0x37')]]={'$like':'%'+_0x2ab5b8[_0x87da('0x3d')]['filter']+'%'};return _0x2ee03d;}})});}_0x410e56=_[_0x87da('0x4c')]({},_0x410e56,_0x2ab5b8[_0x87da('0x4f')]);var _0x3ba34b={'where':_0x410e56['where']};return db[_0x87da('0x39')][_0x87da('0x2e')](_0x3ba34b)['then'](function(_0x33698c){_0x26e896['count']=_0x33698c;if(_0x2ab5b8[_0x87da('0x3d')]['includeAll']){_0x410e56[_0x87da('0x50')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x87da('0x51')](_0x410e56);})[_0x87da('0x1f')](function(_0x508731){_0x26e896[_0x87da('0x52')]=_0x508731;return _0x26e896;})[_0x87da('0x1f')](respondWithFilteredResult(_0x3acfcd,_0x410e56))[_0x87da('0x2a')](handleError(_0x3acfcd,null));};exports[_0x87da('0x53')]=function(_0x527110,_0x45235d){var _0x59a33c={'raw':![],'where':{'id':_0x527110[_0x87da('0x54')]['id']}},_0x2a40ed={};_0x2a40ed['model']=_[_0x87da('0x55')](db[_0x87da('0x39')][_0x87da('0x56')]);_0x2a40ed['query']=_[_0x87da('0x55')](_0x527110[_0x87da('0x3d')]);_0x2a40ed[_0x87da('0x3e')]=_[_0x87da('0x41')](_0x2a40ed[_0x87da('0x3f')],_0x2a40ed[_0x87da('0x3d')]);_0x59a33c['attributes']=_[_0x87da('0x41')](_0x2a40ed[_0x87da('0x3f')],qs[_0x87da('0x42')](_0x527110[_0x87da('0x3d')]['fields']));_0x59a33c[_0x87da('0x40')]=_0x59a33c[_0x87da('0x40')][_0x87da('0x43')]?_0x59a33c[_0x87da('0x40')]:_0x2a40ed['model'];if(_0x527110[_0x87da('0x3d')][_0x87da('0x57')]){_0x59a33c['include']=[{'all':!![]}];}_0x59a33c=_[_0x87da('0x4c')]({},_0x59a33c,_0x527110[_0x87da('0x4f')]);return db[_0x87da('0x39')][_0x87da('0x58')](_0x59a33c)['then'](handleEntityNotFound(_0x45235d,null))[_0x87da('0x1f')](respondWithResult(_0x45235d,null))[_0x87da('0x2a')](handleError(_0x45235d,null));};exports['create']=function(_0x176f26,_0x2ee7d8){return db[_0x87da('0x39')][_0x87da('0x59')](_0x176f26[_0x87da('0x5a')],{})['then'](respondWithResult(_0x2ee7d8,0xc9))['catch'](handleError(_0x2ee7d8,null));};exports[_0x87da('0x34')]=function(_0xd1071,_0x38e8cc){if(_0xd1071[_0x87da('0x5a')]['id']){delete _0xd1071[_0x87da('0x5a')]['id'];}return db[_0x87da('0x39')][_0x87da('0x58')]({'where':{'id':_0xd1071['params']['id']}})[_0x87da('0x1f')](handleEntityNotFound(_0x38e8cc,null))[_0x87da('0x1f')](saveUpdates(_0xd1071['body'],null))[_0x87da('0x1f')](respondWithResult(_0x38e8cc,null))[_0x87da('0x2a')](handleError(_0x38e8cc,null));};exports[_0x87da('0x5b')]=function(_0xc5333d,_0x18b545){return db[_0x87da('0x39')]['find']({'where':{'id':_0xc5333d['params']['id']}})[_0x87da('0x1f')](handleEntityNotFound(_0x18b545,null))['then'](removeEntity(_0x18b545,null))['catch'](handleError(_0x18b545,null));};exports[_0x87da('0x5c')]=function(_0xe7baf5,_0xfa7d80,_0x189743){var _0x311da8={};var _0x195a9b={};var _0x3f3d43;var _0x527184;return db[_0x87da('0x39')][_0x87da('0x5d')]({'where':{'id':_0xe7baf5[_0x87da('0x54')]['id']}})[_0x87da('0x1f')](handleEntityNotFound(_0xfa7d80,null))[_0x87da('0x1f')](function(_0x22e87d){if(_0x22e87d){_0x3f3d43=_0x22e87d;_0x195a9b[_0x87da('0x3f')]=_[_0x87da('0x55')](db[_0x87da('0x5e')]['rawAttributes']);_0x195a9b[_0x87da('0x3d')]=_[_0x87da('0x55')](_0xe7baf5[_0x87da('0x3d')]);_0x195a9b[_0x87da('0x3e')]=_[_0x87da('0x41')](_0x195a9b[_0x87da('0x3f')],_0x195a9b[_0x87da('0x3d')]);_0x311da8[_0x87da('0x40')]=_[_0x87da('0x41')](_0x195a9b[_0x87da('0x3f')],qs[_0x87da('0x42')](_0xe7baf5[_0x87da('0x3d')][_0x87da('0x42')]));_0x311da8[_0x87da('0x40')]=_0x311da8[_0x87da('0x40')][_0x87da('0x43')]?_0x311da8[_0x87da('0x40')]:_0x195a9b[_0x87da('0x3f')];_0x311da8[_0x87da('0x47')]=qs[_0x87da('0x48')](_0xe7baf5[_0x87da('0x3d')]['sort']);_0x311da8[_0x87da('0x49')]=qs[_0x87da('0x3e')](_[_0x87da('0x4a')](_0xe7baf5[_0x87da('0x3d')],_0x195a9b[_0x87da('0x3e')]));if(_0xe7baf5[_0x87da('0x3d')][_0x87da('0x4b')]){_0x311da8['where']=_['merge'](_0x311da8['where'],{'$or':_['map'](_0x311da8['attributes'],function(_0x3eeddd){var _0x2d1c33={};_0x2d1c33[_0x3eeddd]={'$like':'%'+_0xe7baf5['query'][_0x87da('0x4b')]+'%'};return _0x2d1c33;})});}_0x311da8=_[_0x87da('0x4c')]({},_0x311da8,_0xe7baf5[_0x87da('0x4f')]);return _0x3f3d43[_0x87da('0x5c')](_0x311da8);}})[_0x87da('0x1f')](function(_0x3d902f){if(_0x3d902f){_0x527184=_0x3d902f[_0x87da('0x43')];if(!_0xe7baf5[_0x87da('0x3d')][_0x87da('0x44')]('nolimit')){_0x311da8['limit']=qs[_0x87da('0x46')](_0xe7baf5[_0x87da('0x3d')]['limit']);_0x311da8[_0x87da('0x2f')]=qs[_0x87da('0x2f')](_0xe7baf5[_0x87da('0x3d')]['offset']);}return _0x3f3d43[_0x87da('0x5c')](_0x311da8);}})[_0x87da('0x1f')](function(_0x3f5330){if(_0x3f5330){return _0x3f5330?{'count':_0x527184,'rows':_0x3f5330}:null;}})['then'](respondWithResult(_0xfa7d80,null))[_0x87da('0x2a')](handleError(_0xfa7d80,null));};exports[_0x87da('0x5f')]=function(_0x5130ad,_0x58e177,_0x1d227c){var _0x2ab30b={};var _0x61fe1c={};var _0x216108;var _0x14132d;return db[_0x87da('0x39')][_0x87da('0x5d')]({'where':{'id':_0x5130ad[_0x87da('0x54')]['id']}})[_0x87da('0x1f')](handleEntityNotFound(_0x58e177,null))['then'](function(_0x427aa3){if(_0x427aa3){_0x216108=_0x427aa3;_0x61fe1c[_0x87da('0x3f')]=_[_0x87da('0x55')](db[_0x87da('0x5e')][_0x87da('0x56')]);_0x61fe1c['query']=_[_0x87da('0x55')](_0x5130ad['query']);_0x61fe1c[_0x87da('0x3e')]=_[_0x87da('0x41')](_0x61fe1c['model'],_0x61fe1c[_0x87da('0x3d')]);_0x2ab30b[_0x87da('0x40')]=_[_0x87da('0x41')](_0x61fe1c['model'],qs['fields'](_0x5130ad[_0x87da('0x3d')][_0x87da('0x42')]));_0x2ab30b[_0x87da('0x40')]=_0x2ab30b[_0x87da('0x40')][_0x87da('0x43')]?_0x2ab30b[_0x87da('0x40')]:_0x61fe1c[_0x87da('0x3f')];_0x2ab30b[_0x87da('0x47')]=qs[_0x87da('0x48')](_0x5130ad['query'][_0x87da('0x48')]);_0x2ab30b[_0x87da('0x49')]=qs['filters'](_['pick'](_0x5130ad[_0x87da('0x3d')],_0x61fe1c[_0x87da('0x3e')]));if(_0x5130ad[_0x87da('0x3d')][_0x87da('0x4b')]){_0x2ab30b[_0x87da('0x49')]=_[_0x87da('0x4c')](_0x2ab30b[_0x87da('0x49')],{'$or':_[_0x87da('0x3c')](_0x2ab30b[_0x87da('0x40')],function(_0x49767d){var _0x1b330b={};_0x1b330b[_0x49767d]={'$like':'%'+_0x5130ad[_0x87da('0x3d')][_0x87da('0x4b')]+'%'};return _0x1b330b;})});}_0x2ab30b=_[_0x87da('0x4c')]({},_0x2ab30b,_0x5130ad[_0x87da('0x4f')]);return _0x216108[_0x87da('0x5f')](_0x2ab30b);}})[_0x87da('0x1f')](function(_0x470495){if(_0x470495){_0x14132d=_0x470495[_0x87da('0x43')];if(!_0x5130ad['query'][_0x87da('0x44')](_0x87da('0x45'))){_0x2ab30b[_0x87da('0x46')]=qs[_0x87da('0x46')](_0x5130ad[_0x87da('0x3d')][_0x87da('0x46')]);_0x2ab30b[_0x87da('0x2f')]=qs[_0x87da('0x2f')](_0x5130ad[_0x87da('0x3d')][_0x87da('0x2f')]);}return _0x216108[_0x87da('0x5f')](_0x2ab30b);}})['then'](function(_0x45c0a1){if(_0x45c0a1){return _0x45c0a1?{'count':_0x14132d,'rows':_0x45c0a1}:null;}})['then'](respondWithResult(_0x58e177,null))[_0x87da('0x2a')](handleError(_0x58e177,null));};exports[_0x87da('0x60')]=function(_0x3dcb1a,_0x2eb95a,_0x162e82){var _0x187a15={};var _0x4f3b69={};var _0x3660f6;var _0xe628d1;return db[_0x87da('0x39')][_0x87da('0x5d')]({'where':{'id':_0x3dcb1a['params']['id']}})[_0x87da('0x1f')](handleEntityNotFound(_0x2eb95a,null))[_0x87da('0x1f')](function(_0x502212){if(_0x502212){_0x3660f6=_0x502212;_0x4f3b69[_0x87da('0x3f')]=_[_0x87da('0x55')](db[_0x87da('0x5e')]['rawAttributes']);_0x4f3b69[_0x87da('0x3d')]=_[_0x87da('0x55')](_0x3dcb1a[_0x87da('0x3d')]);_0x4f3b69[_0x87da('0x3e')]=_[_0x87da('0x41')](_0x4f3b69[_0x87da('0x3f')],_0x4f3b69[_0x87da('0x3d')]);_0x187a15[_0x87da('0x40')]=_[_0x87da('0x41')](_0x4f3b69[_0x87da('0x3f')],qs['fields'](_0x3dcb1a['query'][_0x87da('0x42')]));_0x187a15[_0x87da('0x40')]=_0x187a15[_0x87da('0x40')][_0x87da('0x43')]?_0x187a15['attributes']:_0x4f3b69['model'];_0x187a15[_0x87da('0x47')]=qs[_0x87da('0x48')](_0x3dcb1a[_0x87da('0x3d')]['sort']);_0x187a15['where']=qs['filters'](_[_0x87da('0x4a')](_0x3dcb1a[_0x87da('0x3d')],_0x4f3b69['filters']));if(_0x3dcb1a['query'][_0x87da('0x4b')]){_0x187a15[_0x87da('0x49')]=_[_0x87da('0x4c')](_0x187a15[_0x87da('0x49')],{'$or':_['map'](_0x187a15[_0x87da('0x40')],function(_0x2dadbd){var _0x33c6ef={};_0x33c6ef[_0x2dadbd]={'$like':'%'+_0x3dcb1a['query'][_0x87da('0x4b')]+'%'};return _0x33c6ef;})});}_0x187a15=_[_0x87da('0x4c')]({},_0x187a15,_0x3dcb1a[_0x87da('0x4f')]);return _0x3660f6['getDescriptions'](_0x187a15);}})[_0x87da('0x1f')](function(_0x273756){if(_0x273756){_0xe628d1=_0x273756[_0x87da('0x43')];if(!_0x3dcb1a[_0x87da('0x3d')][_0x87da('0x44')](_0x87da('0x45'))){_0x187a15[_0x87da('0x46')]=qs[_0x87da('0x46')](_0x3dcb1a[_0x87da('0x3d')]['limit']);_0x187a15[_0x87da('0x2f')]=qs[_0x87da('0x2f')](_0x3dcb1a[_0x87da('0x3d')][_0x87da('0x2f')]);}return _0x3660f6['getDescriptions'](_0x187a15);}})[_0x87da('0x1f')](function(_0xecd598){if(_0xecd598){return _0xecd598?{'count':_0xe628d1,'rows':_0xecd598}:null;}})[_0x87da('0x1f')](respondWithResult(_0x2eb95a,null))[_0x87da('0x2a')](handleError(_0x2eb95a,null));}; \ No newline at end of file +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 diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index b651dc7..a29acc6 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 _0xe70f=['request-promise','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','lodash','moment'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xe70f,0x116));var _0xfe70=function(_0x328998,_0x188e8d){_0x328998=_0x328998-0x0;var _0x253267=_0xe70f[_0x328998];return _0x253267;};'use strict';var _=require(_0xfe70('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xfe70('0x1'));var BPromise=require('bluebird');var rp=require(_0xfe70('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfe70('0x3'));var config=require(_0xfe70('0x4'));var attributes=require(_0xfe70('0x5'));module[_0xfe70('0x6')]=function(_0x2d7598,_0x42647c){return _0x2d7598['define'](_0xfe70('0x7'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index dc7dd56..877e60b 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 _0xdfb4=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message'];(function(_0x1b85fb,_0x3d7464){var _0x524687=function(_0x150a86){while(--_0x150a86){_0x1b85fb['push'](_0x1b85fb['shift']());}};_0x524687(++_0x3d7464);}(_0xdfb4,0x161));var _0x4dfb=function(_0x21e94a,_0x125545){_0x21e94a=_0x21e94a-0x0;var _0x19265a=_0xdfb4[_0x21e94a];return _0x19265a;};'use strict';var _=require(_0x4dfb('0x0'));var util=require(_0x4dfb('0x1'));var moment=require(_0x4dfb('0x2'));var BPromise=require(_0x4dfb('0x3'));var rs=require(_0x4dfb('0x4'));var fs=require('fs');var Redis=require(_0x4dfb('0x5'));var db=require(_0x4dfb('0x6'))['db'];var utils=require(_0x4dfb('0x7'));var logger=require(_0x4dfb('0x8'))(_0x4dfb('0x9'));var config=require('../../config/environment');var jayson=require(_0x4dfb('0xa'));var client=jayson[_0x4dfb('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a3f0e,_0x55e822,_0x548d9f){return new BPromise(function(_0x248772,_0x3cd927){return client[_0x4dfb('0xc')](_0x2a3f0e,_0x548d9f)['then'](function(_0x298d36){logger[_0x4dfb('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x55e822,'request\x20sent');logger[_0x4dfb('0xe')](_0x4dfb('0xf'),_0x55e822,_0x4dfb('0x10'),JSON['stringify'](_0x298d36));if(_0x298d36[_0x4dfb('0x11')]){if(_0x298d36[_0x4dfb('0x11')][_0x4dfb('0x12')]===0x1f4){logger['error'](_0x4dfb('0x13'),_0x55e822,_0x298d36['error'][_0x4dfb('0x14')]);return _0x3cd927(_0x298d36['error']['message']);}logger['error'](_0x4dfb('0x13'),_0x55e822,_0x298d36[_0x4dfb('0x11')]['message']);return _0x248772(_0x298d36[_0x4dfb('0x11')][_0x4dfb('0x14')]);}else{logger[_0x4dfb('0xd')](_0x4dfb('0x13'),_0x55e822,_0x4dfb('0x10'));_0x248772(_0x298d36[_0x4dfb('0x15')]['message']);}})['catch'](function(_0x33ac07){logger[_0x4dfb('0x11')](_0x4dfb('0x13'),_0x55e822,_0x33ac07);_0x3cd927(_0x33ac07);});});} \ No newline at end of file +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 diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 98a6e13..615b293 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 _0xcec5=['./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','create','put','update','destroy','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0xcec5,0x13d));var _0x5cec=function(_0x283707,_0x1ddf01){_0x283707=_0x283707-0x0;var _0x1d7625=_0xcec5[_0x283707];return _0x1d7625;};'use strict';var multer=require(_0x5cec('0x0'));var util=require('util');var path=require(_0x5cec('0x1'));var timeout=require('connect-timeout');var express=require(_0x5cec('0x2'));var router=express['Router']();var auth=require(_0x5cec('0x3'));var interaction=require(_0x5cec('0x4'));var config=require(_0x5cec('0x5'));var controller=require(_0x5cec('0x6'));router[_0x5cec('0x7')]('/',auth[_0x5cec('0x8')](),controller[_0x5cec('0x9')]);router[_0x5cec('0x7')](_0x5cec('0xa'),auth['isAuthenticated'](),controller[_0x5cec('0xb')]);router['post']('/',auth[_0x5cec('0x8')](),controller[_0x5cec('0xc')]);router[_0x5cec('0xd')](_0x5cec('0xa'),auth[_0x5cec('0x8')](),controller[_0x5cec('0xe')]);router['delete'](_0x5cec('0xa'),auth['isAuthenticated'](),controller[_0x5cec('0xf')]);module[_0x5cec('0x10')]=router; \ No newline at end of file +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 diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 0fc76d8..78fa295 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 _0xa92e=['variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0x3ce210,_0x291eca){var _0x59c5a2=function(_0x5cbf21){while(--_0x5cbf21){_0x3ce210['push'](_0x3ce210['shift']());}};_0x59c5a2(++_0x291eca);}(_0xa92e,0x1e5));var _0xea92=function(_0x6d8954,_0x52815a){_0x6d8954=_0x6d8954-0x0;var _0x283727=_0xa92e[_0x6d8954];return _0x283727;};'use strict';var Sequelize=require(_0xea92('0x0'));module['exports']={'type':{'type':Sequelize[_0xea92('0x1')](_0xea92('0x2'),_0xea92('0x3'),_0xea92('0x4'),_0xea92('0x5')),'defaultValue':_0xea92('0x2')},'content':{'type':Sequelize[_0xea92('0x6')]},'key':{'type':Sequelize[_0xea92('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xea92('0x2'),_0xea92('0x3'),_0xea92('0x4'))},'keyContent':{'type':Sequelize[_0xea92('0x6')]},'idField':{'type':Sequelize[_0xea92('0x6')]},'nameField':{'type':Sequelize[_0xea92('0x6')]},'customField':{'type':Sequelize[_0xea92('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +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 diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index d6e5bf2..37d32e1 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 _0x282d=['model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filter','include','rows','catch','params','includeAll','merge','find','create','body','destroy','html-pdf','eml-format','rimraf','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','set','save','update','then','error','name','index','map','SugarcrmField','fieldName'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x282d,0x108));var _0xd282=function(_0x37f628,_0x3e0334){_0x37f628=_0x37f628-0x0;var _0x46dc28=_0x282d[_0x37f628];return _0x46dc28;};'use strict';var pdf=require(_0xd282('0x0'));var emlformat=require(_0xd282('0x1'));var rimraf=require(_0xd282('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd282('0x3'));var BPromise=require(_0xd282('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd282('0x5'));var sox=require(_0xd282('0x6'));var csv=require(_0xd282('0x7'));var ejs=require(_0xd282('0x8'));var fs=require('fs');var _=require(_0xd282('0x9'));var squel=require(_0xd282('0xa'));var crypto=require(_0xd282('0xb'));var jsforce=require(_0xd282('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd282('0x7'));var querystring=require('querystring');var Papa=require(_0xd282('0xd'));var Redis=require('ioredis');var authService=require(_0xd282('0xe'));var qs=require(_0xd282('0xf'));var as=require(_0xd282('0x10'));var hardwareService=require(_0xd282('0x11'));var logger=require(_0xd282('0x12'))('api');var utils=require(_0xd282('0x13'));var config=require('../../config/environment');var db=require(_0xd282('0x14'))['db'];function respondWithStatusCode(_0x811be3,_0x24245b){_0x24245b=_0x24245b||0xcc;return function(_0xc76f19){if(_0xc76f19){return _0x811be3[_0xd282('0x15')](_0x24245b);}return _0x811be3[_0xd282('0x16')](_0x24245b)[_0xd282('0x17')]();};}function respondWithResult(_0x43c716,_0x3fbad4){_0x3fbad4=_0x3fbad4||0xc8;return function(_0xdd571f){if(_0xdd571f){return _0x43c716[_0xd282('0x16')](_0x3fbad4)['json'](_0xdd571f);}};}function respondWithFilteredResult(_0x1776f9,_0x2b73c2){return function(_0x13f66d){if(_0x13f66d){var _0x5e0fb6=_0x13f66d[_0xd282('0x18')],_0xb50cf2=_0x2b73c2[_0xd282('0x19')],_0x3b2bc9=_0x2b73c2['offset']+_0x2b73c2['limit'],_0xdf745a;if(_0x3b2bc9>=_0x5e0fb6){_0x3b2bc9=_0x5e0fb6;_0xdf745a=0xc8;}else{_0xdf745a=0xce;}_0x1776f9[_0xd282('0x16')](_0xdf745a);return _0x1776f9[_0xd282('0x1a')]('Content-Range',_0xb50cf2+'-'+_0x3b2bc9+'/'+_0x5e0fb6)['json'](_0x13f66d);}return null;};}function patchUpdates(_0x590981){return function(_0x407149){try{jsonpatch['apply'](_0x407149,_0x590981,!![]);}catch(_0x4c8853){return BPromise['reject'](_0x4c8853);}return _0x407149[_0xd282('0x1b')]();};}function saveUpdates(_0x143b37,_0x38a494){return function(_0x37f62c){if(_0x37f62c){return _0x37f62c[_0xd282('0x1c')](_0x143b37)['then'](function(_0x54e7ff){return _0x54e7ff;});}return null;};}function removeEntity(_0x2fb559,_0x4b45ff){return function(_0x292e20){if(_0x292e20){return _0x292e20['destroy']()[_0xd282('0x1d')](function(){_0x2fb559[_0xd282('0x16')](0xcc)[_0xd282('0x17')]();});}};}function handleEntityNotFound(_0x38e492,_0x1ac405){return function(_0xc26c2e){if(!_0xc26c2e){_0x38e492[_0xd282('0x15')](0x194);}return _0xc26c2e;};}function handleError(_0x43cf5c,_0x1c106a){_0x1c106a=_0x1c106a||0x1f4;return function(_0x81e9ef){logger[_0xd282('0x1e')](_0x81e9ef['stack']);if(_0x81e9ef['name']){delete _0x81e9ef[_0xd282('0x1f')];}_0x43cf5c['status'](_0x1c106a)['send'](_0x81e9ef);};}exports[_0xd282('0x20')]=function(_0x139af5,_0x2268f1){var _0x447b33={},_0x1fe9ea={},_0x331f01={'count':0x0,'rows':[]};var _0x4953be=_[_0xd282('0x21')](db[_0xd282('0x22')]['rawAttributes'],function(_0x219b45){return{'name':_0x219b45[_0xd282('0x23')],'type':_0x219b45['type']['key']};});_0x1fe9ea[_0xd282('0x24')]=_['map'](_0x4953be,_0xd282('0x1f'));_0x1fe9ea[_0xd282('0x25')]=_[_0xd282('0x26')](_0x139af5[_0xd282('0x25')]);_0x1fe9ea[_0xd282('0x27')]=_[_0xd282('0x28')](_0x1fe9ea[_0xd282('0x24')],_0x1fe9ea[_0xd282('0x25')]);_0x447b33[_0xd282('0x29')]=_[_0xd282('0x28')](_0x1fe9ea[_0xd282('0x24')],qs[_0xd282('0x2a')](_0x139af5['query'][_0xd282('0x2a')]));_0x447b33[_0xd282('0x29')]=_0x447b33[_0xd282('0x29')][_0xd282('0x2b')]?_0x447b33[_0xd282('0x29')]:_0x1fe9ea[_0xd282('0x24')];if(!_0x139af5[_0xd282('0x25')]['hasOwnProperty'](_0xd282('0x2c'))){_0x447b33[_0xd282('0x2d')]=qs[_0xd282('0x2d')](_0x139af5[_0xd282('0x25')]['limit']);_0x447b33[_0xd282('0x19')]=qs[_0xd282('0x19')](_0x139af5['query'][_0xd282('0x19')]);}_0x447b33[_0xd282('0x2e')]=qs[_0xd282('0x2f')](_0x139af5[_0xd282('0x25')][_0xd282('0x2f')]);_0x447b33[_0xd282('0x30')]=qs[_0xd282('0x27')](_['pick'](_0x139af5['query'],_0x1fe9ea[_0xd282('0x27')]));if(_0x139af5[_0xd282('0x25')][_0xd282('0x31')]){_0x447b33['where']=_['merge'](_0x447b33['where'],{'$or':_[_0xd282('0x21')](_0x4953be,function(_0x37db40){if(_0x37db40['type']!=='VIRTUAL'){var _0x34afe7={};_0x34afe7[_0x37db40[_0xd282('0x1f')]]={'$like':'%'+_0x139af5[_0xd282('0x25')][_0xd282('0x31')]+'%'};return _0x34afe7;}})});}_0x447b33=_['merge']({},_0x447b33,_0x139af5['options']);var _0x412a03={'where':_0x447b33[_0xd282('0x30')]};return db['SugarcrmField'][_0xd282('0x18')](_0x412a03)[_0xd282('0x1d')](function(_0x3f1df3){_0x331f01[_0xd282('0x18')]=_0x3f1df3;if(_0x139af5[_0xd282('0x25')]['includeAll']){_0x447b33[_0xd282('0x32')]=[{'all':!![]}];}return db[_0xd282('0x22')]['findAll'](_0x447b33);})['then'](function(_0x11f08b){_0x331f01[_0xd282('0x33')]=_0x11f08b;return _0x331f01;})[_0xd282('0x1d')](respondWithFilteredResult(_0x2268f1,_0x447b33))[_0xd282('0x34')](handleError(_0x2268f1,null));};exports['show']=function(_0x1d8a27,_0x55ad75){var _0x170214={'raw':!![],'where':{'id':_0x1d8a27[_0xd282('0x35')]['id']}},_0x1a1f94={};_0x1a1f94[_0xd282('0x24')]=_[_0xd282('0x26')](db[_0xd282('0x22')]['rawAttributes']);_0x1a1f94[_0xd282('0x25')]=_[_0xd282('0x26')](_0x1d8a27[_0xd282('0x25')]);_0x1a1f94[_0xd282('0x27')]=_[_0xd282('0x28')](_0x1a1f94[_0xd282('0x24')],_0x1a1f94[_0xd282('0x25')]);_0x170214[_0xd282('0x29')]=_['intersection'](_0x1a1f94['model'],qs[_0xd282('0x2a')](_0x1d8a27[_0xd282('0x25')][_0xd282('0x2a')]));_0x170214['attributes']=_0x170214[_0xd282('0x29')]['length']?_0x170214[_0xd282('0x29')]:_0x1a1f94['model'];if(_0x1d8a27[_0xd282('0x25')][_0xd282('0x36')]){_0x170214[_0xd282('0x32')]=[{'all':!![]}];}_0x170214=_[_0xd282('0x37')]({},_0x170214,_0x1d8a27['options']);return db[_0xd282('0x22')][_0xd282('0x38')](_0x170214)['then'](handleEntityNotFound(_0x55ad75,null))[_0xd282('0x1d')](respondWithResult(_0x55ad75,null))[_0xd282('0x34')](handleError(_0x55ad75,null));};exports[_0xd282('0x39')]=function(_0xf37d02,_0x1d6a5d){return db[_0xd282('0x22')][_0xd282('0x39')](_0xf37d02['body'],{})[_0xd282('0x1d')](respondWithResult(_0x1d6a5d,0xc9))['catch'](handleError(_0x1d6a5d,null));};exports[_0xd282('0x1c')]=function(_0x445dd0,_0x3e3458){if(_0x445dd0['body']['id']){delete _0x445dd0[_0xd282('0x3a')]['id'];}return db[_0xd282('0x22')][_0xd282('0x38')]({'where':{'id':_0x445dd0['params']['id']}})[_0xd282('0x1d')](handleEntityNotFound(_0x3e3458,null))[_0xd282('0x1d')](saveUpdates(_0x445dd0[_0xd282('0x3a')],null))[_0xd282('0x1d')](respondWithResult(_0x3e3458,null))[_0xd282('0x34')](handleError(_0x3e3458,null));};exports[_0xd282('0x3b')]=function(_0x5730c0,_0x18a303){return db[_0xd282('0x22')][_0xd282('0x38')]({'where':{'id':_0x5730c0[_0xd282('0x35')]['id']}})[_0xd282('0x1d')](handleEntityNotFound(_0x18a303,null))['then'](removeEntity(_0x18a303,null))['catch'](handleError(_0x18a303,null));}; \ No newline at end of file +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 diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 383b7aa..f9f29d3 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 _0x3523=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash'];(function(_0x18b076,_0x211599){var _0x332c1a=function(_0x4030d3){while(--_0x4030d3){_0x18b076['push'](_0x18b076['shift']());}};_0x332c1a(++_0x211599);}(_0x3523,0x155));var _0x3352=function(_0x281717,_0x153cbc){_0x281717=_0x281717-0x0;var _0x301a48=_0x3523[_0x281717];return _0x301a48;};'use strict';var _=require(_0x3352('0x0'));var util=require(_0x3352('0x1'));var logger=require(_0x3352('0x2'))(_0x3352('0x3'));var moment=require(_0x3352('0x4'));var BPromise=require(_0x3352('0x5'));var rp=require(_0x3352('0x6'));var fs=require('fs');var path=require(_0x3352('0x7'));var rimraf=require(_0x3352('0x8'));var config=require(_0x3352('0x9'));var attributes=require(_0x3352('0xa'));module[_0x3352('0xb')]=function(_0x2f83dc,_0x1ce835){return _0x2f83dc[_0x3352('0xc')](_0x3352('0xd'),attributes,{'tableName':_0x3352('0xe'),'paranoid':![],'indexes':[{'name':_0x3352('0xf'),'fields':[_0x3352('0x10'),_0x3352('0x11')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index f724404..7a2709a 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 _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmField,\x20%s,\x20%s','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0xe69a91,_0xed1a43){var _0x56c7f5=function(_0x36639c){while(--_0x36639c){_0xe69a91['push'](_0xe69a91['shift']());}};_0x56c7f5(++_0xed1a43);}(_0xb10b,0x12a));var _0xbb10=function(_0x2ddd52,_0x4e3b17){_0x2ddd52=_0x2ddd52-0x0;var _0x4bb4ec=_0xb10b[_0x2ddd52];return _0x4bb4ec;};'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 _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 diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 934359c..d34b5c4 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 _0xde8c=['/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','/:id','multer','util','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','show','get'];(function(_0x21a2b2,_0x22ba1e){var _0x2060b4=function(_0x38cfcb){while(--_0x38cfcb){_0x21a2b2['push'](_0x21a2b2['shift']());}};_0x2060b4(++_0x22ba1e);}(_0xde8c,0x187));var _0xcde8=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xde8c[_0x1abb09];return _0xea1c07;};'use strict';var multer=require(_0xcde8('0x0'));var util=require(_0xcde8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcde8('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xcde8('0x3'));var config=require(_0xcde8('0x4'));var controller=require('./intVtigerAccount.controller');router['get']('/',auth[_0xcde8('0x5')](),controller[_0xcde8('0x6')]);router['get']('/:id',auth[_0xcde8('0x5')](),controller[_0xcde8('0x7')]);router[_0xcde8('0x8')](_0xcde8('0x9'),auth[_0xcde8('0x5')](),controller['getConfigurations']);router['get'](_0xcde8('0xa'),auth['isAuthenticated'](),controller[_0xcde8('0xb')]);router[_0xcde8('0xc')]('/',auth[_0xcde8('0x5')](),controller[_0xcde8('0xd')]);router[_0xcde8('0xc')](_0xcde8('0x9'),auth[_0xcde8('0x5')](),controller[_0xcde8('0xe')]);router['put'](_0xcde8('0xf'),auth[_0xcde8('0x5')](),controller['update']);router['delete'](_0xcde8('0xf'),auth[_0xcde8('0x5')](),controller['destroy']);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 6e9b055..ec45df2 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 _0x3cfc=['exports','STRING','HelpDesk'];(function(_0x312e40,_0x419fba){var _0x47194e=function(_0x4ce786){while(--_0x4ce786){_0x312e40['push'](_0x312e40['shift']());}};_0x47194e(++_0x419fba);}(_0x3cfc,0xae));var _0xc3cf=function(_0x218503,_0x74bf6f){_0x218503=_0x218503-0x0;var _0x46ed5d=_0x3cfc[_0x218503];return _0x46ed5d;};'use strict';var Sequelize=require('sequelize');module[_0xc3cf('0x0')]={'name':{'type':Sequelize[_0xc3cf('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xc3cf('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xc3cf('0x1')],'allowNull':![],'defaultValue':_0xc3cf('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xc3cf('0x1')]},'accessKey':{'type':Sequelize[_0xc3cf('0x1')],'allowNull':![]}}; \ No newline at end of file +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 diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 01de5e8..fb76478 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 _0xe5de=['username','description','remoteUri','serverUrl','accessKey','moduleName','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','login','token','describe','sessionName','autogenerated','reference','owner','includes','remove','editable','false','startsWith','cf_','picklist','picklistValues','label','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','fast-json-patch','request-promise','moment','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','end','count','offset','limit','set','json','apply','reject','save','update','destroy','stack','name','index','VtigerAccount','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','include','findAll','rows','params','find','create','body','findOne','VtigerConfiguration','options','getConfigurations','AccountId','Subjects','getSubjects','channel','getDescriptions','VtigerField','md5','getFields'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xe5de,0x1aa));var _0xee5d=function(_0x16c2c6,_0x4de75f){_0x16c2c6=_0x16c2c6-0x0;var _0xc9b1b4=_0xe5de[_0x16c2c6];return _0xc9b1b4;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee5d('0x0'));var rp=require(_0xee5d('0x1'));var moment=require(_0xee5d('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xee5d('0x3'));var path=require('path');var sox=require(_0xee5d('0x4'));var csv=require(_0xee5d('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xee5d('0x6'));var squel=require(_0xee5d('0x7'));var crypto=require(_0xee5d('0x8'));var jsforce=require(_0xee5d('0x9'));var deskjs=require(_0xee5d('0xa'));var toCsv=require(_0xee5d('0x5'));var querystring=require(_0xee5d('0xb'));var Papa=require(_0xee5d('0xc'));var Redis=require(_0xee5d('0xd'));var authService=require(_0xee5d('0xe'));var qs=require(_0xee5d('0xf'));var as=require(_0xee5d('0x10'));var hardwareService=require(_0xee5d('0x11'));var logger=require('../../config/logger')(_0xee5d('0x12'));var utils=require(_0xee5d('0x13'));var config=require(_0xee5d('0x14'));var db=require(_0xee5d('0x15'))['db'];var integrations=require(_0xee5d('0x16'));var jayson=require(_0xee5d('0x17'));var client=jayson['client'][_0xee5d('0x18')]({'port':0x232a});function checkPasswordPattern(_0x12aa7f,_0x44e281,_0x519b00){if(_0x519b00){var _0x52e82f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x52e82f[_0xee5d('0x19')](_0x44e281)){return _0x12aa7f;}else{throw new db[(_0xee5d('0x1a'))]['ValidationError'](_0xee5d('0x1b'));}}else{return _0x12aa7f;}}function respondWithRpcPromise(_0x422790,_0x4c7cab,_0x2bfe36,_0x2eca64){return new BPromise(function(_0x3e6682,_0x2900bf){var _0x150754=_0x2eca64||client;return _0x150754[_0xee5d('0x1c')](_0x422790,_0x2bfe36)[_0xee5d('0x1d')](function(_0x6e52ee){logger[_0xee5d('0x1e')](_0xee5d('0x1f'),_0x4c7cab,_0xee5d('0x20'));logger['debug'](_0xee5d('0x21'),_0x4c7cab,_0xee5d('0x20'),JSON['stringify'](_0x6e52ee));if(_0x6e52ee[_0xee5d('0x22')]){if(_0x6e52ee[_0xee5d('0x22')]['code']===0x1f4){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x4c7cab,_0x6e52ee['error'][_0xee5d('0x23')]);return _0x2900bf(_0x6e52ee[_0xee5d('0x22')]['message']);}logger[_0xee5d('0x22')](_0xee5d('0x1f'),_0x4c7cab,_0x6e52ee[_0xee5d('0x22')][_0xee5d('0x23')]);return _0x3e6682(_0x6e52ee[_0xee5d('0x22')][_0xee5d('0x23')]);}else{logger[_0xee5d('0x1e')](_0xee5d('0x1f'),_0x4c7cab,'request\x20sent');_0x3e6682(_0x6e52ee[_0xee5d('0x24')][_0xee5d('0x23')]);}})[_0xee5d('0x25')](function(_0x5a393a){logger[_0xee5d('0x22')]('VtigerAccount,\x20%s,\x20%s',_0x4c7cab,_0x5a393a);_0x2900bf(_0x5a393a);});});}function respondWithStatusCode(_0xf95f11,_0x2b91a4){_0x2b91a4=_0x2b91a4||0xcc;return function(_0x1a26bb){if(_0x1a26bb){return _0xf95f11['sendStatus'](_0x2b91a4);}return _0xf95f11[_0xee5d('0x26')](_0x2b91a4)[_0xee5d('0x27')]();};}function respondWithResult(_0x38461f,_0x5a71f8){_0x5a71f8=_0x5a71f8||0xc8;return function(_0x23b059){if(_0x23b059){return _0x38461f[_0xee5d('0x26')](_0x5a71f8)['json'](_0x23b059);}};}function respondWithFilteredResult(_0x2c24aa,_0x20c15e){return function(_0x48984d){if(_0x48984d){var _0x25a043=_0x48984d[_0xee5d('0x28')],_0x4dc108=_0x20c15e['offset'],_0x4e3f05=_0x20c15e[_0xee5d('0x29')]+_0x20c15e[_0xee5d('0x2a')],_0x521bc5;if(_0x4e3f05>=_0x25a043){_0x4e3f05=_0x25a043;_0x521bc5=0xc8;}else{_0x521bc5=0xce;}_0x2c24aa[_0xee5d('0x26')](_0x521bc5);return _0x2c24aa[_0xee5d('0x2b')]('Content-Range',_0x4dc108+'-'+_0x4e3f05+'/'+_0x25a043)[_0xee5d('0x2c')](_0x48984d);}return null;};}function patchUpdates(_0x3ae08a){return function(_0x3adaf8){try{jsonpatch[_0xee5d('0x2d')](_0x3adaf8,_0x3ae08a,!![]);}catch(_0x574108){return BPromise[_0xee5d('0x2e')](_0x574108);}return _0x3adaf8[_0xee5d('0x2f')]();};}function saveUpdates(_0x26ab20,_0x4be0fb){return function(_0x68290e){if(_0x68290e){return _0x68290e[_0xee5d('0x30')](_0x26ab20)[_0xee5d('0x1d')](function(_0x39b27e){return _0x39b27e;});}return null;};}function removeEntity(_0x573772,_0x39cb74){return function(_0x4c7fb3){if(_0x4c7fb3){return _0x4c7fb3[_0xee5d('0x31')]()[_0xee5d('0x1d')](function(){_0x573772[_0xee5d('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4db58f,_0x56f450){return function(_0x13981e){if(!_0x13981e){_0x4db58f['sendStatus'](0x194);}return _0x13981e;};}function handleError(_0x46cf13,_0x4702a1){_0x4702a1=_0x4702a1||0x1f4;return function(_0x51d9a8){logger[_0xee5d('0x22')](_0x51d9a8[_0xee5d('0x32')]);if(_0x51d9a8[_0xee5d('0x33')]){delete _0x51d9a8[_0xee5d('0x33')];}_0x46cf13[_0xee5d('0x26')](_0x4702a1)['send'](_0x51d9a8);};}exports[_0xee5d('0x34')]=function(_0x395509,_0x8ba874){var _0x383c70={},_0x36ead6={},_0x15f152={'count':0x0,'rows':[]};var _0x31ff08=_['map'](db[_0xee5d('0x35')][_0xee5d('0x36')],function(_0x281d9a){return{'name':_0x281d9a['fieldName'],'type':_0x281d9a[_0xee5d('0x37')][_0xee5d('0x38')]};});_0x36ead6[_0xee5d('0x39')]=_[_0xee5d('0x3a')](_0x31ff08,'name');_0x36ead6[_0xee5d('0x3b')]=_[_0xee5d('0x3c')](_0x395509[_0xee5d('0x3b')]);_0x36ead6[_0xee5d('0x3d')]=_[_0xee5d('0x3e')](_0x36ead6['model'],_0x36ead6[_0xee5d('0x3b')]);_0x383c70[_0xee5d('0x3f')]=_[_0xee5d('0x3e')](_0x36ead6['model'],qs[_0xee5d('0x40')](_0x395509[_0xee5d('0x3b')]['fields']));_0x383c70['attributes']=_0x383c70[_0xee5d('0x3f')][_0xee5d('0x41')]?_0x383c70[_0xee5d('0x3f')]:_0x36ead6[_0xee5d('0x39')];if(!_0x395509[_0xee5d('0x3b')][_0xee5d('0x42')](_0xee5d('0x43'))){_0x383c70[_0xee5d('0x2a')]=qs[_0xee5d('0x2a')](_0x395509[_0xee5d('0x3b')][_0xee5d('0x2a')]);_0x383c70['offset']=qs[_0xee5d('0x29')](_0x395509[_0xee5d('0x3b')][_0xee5d('0x29')]);}_0x383c70[_0xee5d('0x44')]=qs[_0xee5d('0x45')](_0x395509[_0xee5d('0x3b')][_0xee5d('0x45')]);_0x383c70[_0xee5d('0x46')]=qs[_0xee5d('0x3d')](_[_0xee5d('0x47')](_0x395509[_0xee5d('0x3b')],_0x36ead6['filters']));if(_0x395509[_0xee5d('0x3b')]['filter']){_0x383c70[_0xee5d('0x46')]=_[_0xee5d('0x48')](_0x383c70[_0xee5d('0x46')],{'$or':_[_0xee5d('0x3a')](_0x31ff08,function(_0x43fae8){if(_0x43fae8['type']!=='VIRTUAL'){var _0x3a8230={};_0x3a8230[_0x43fae8[_0xee5d('0x33')]]={'$like':'%'+_0x395509[_0xee5d('0x3b')][_0xee5d('0x49')]+'%'};return _0x3a8230;}})});}_0x383c70=_[_0xee5d('0x48')]({},_0x383c70,_0x395509['options']);var _0x1f3063={'where':_0x383c70[_0xee5d('0x46')]};return db[_0xee5d('0x35')]['count'](_0x1f3063)[_0xee5d('0x1d')](function(_0x41e2b8){_0x15f152[_0xee5d('0x28')]=_0x41e2b8;if(_0x395509[_0xee5d('0x3b')][_0xee5d('0x4a')]){_0x383c70[_0xee5d('0x4b')]=[{'all':!![]}];}return db[_0xee5d('0x35')][_0xee5d('0x4c')](_0x383c70);})[_0xee5d('0x1d')](function(_0x256787){_0x15f152[_0xee5d('0x4d')]=_0x256787;return _0x15f152;})['then'](respondWithFilteredResult(_0x8ba874,_0x383c70))['catch'](handleError(_0x8ba874,null));};exports['show']=function(_0x2676d7,_0x5a20b7){var _0x4e9c47={'raw':![],'where':{'id':_0x2676d7[_0xee5d('0x4e')]['id']}},_0x118502={};_0x118502[_0xee5d('0x39')]=_['keys'](db[_0xee5d('0x35')]['rawAttributes']);_0x118502[_0xee5d('0x3b')]=_[_0xee5d('0x3c')](_0x2676d7[_0xee5d('0x3b')]);_0x118502[_0xee5d('0x3d')]=_[_0xee5d('0x3e')](_0x118502[_0xee5d('0x39')],_0x118502[_0xee5d('0x3b')]);_0x4e9c47[_0xee5d('0x3f')]=_[_0xee5d('0x3e')](_0x118502[_0xee5d('0x39')],qs[_0xee5d('0x40')](_0x2676d7[_0xee5d('0x3b')]['fields']));_0x4e9c47[_0xee5d('0x3f')]=_0x4e9c47[_0xee5d('0x3f')][_0xee5d('0x41')]?_0x4e9c47[_0xee5d('0x3f')]:_0x118502[_0xee5d('0x39')];if(_0x2676d7[_0xee5d('0x3b')][_0xee5d('0x4a')]){_0x4e9c47['include']=[{'all':!![]}];}_0x4e9c47=_[_0xee5d('0x48')]({},_0x4e9c47,_0x2676d7['options']);return db['VtigerAccount'][_0xee5d('0x4f')](_0x4e9c47)[_0xee5d('0x1d')](handleEntityNotFound(_0x5a20b7,null))[_0xee5d('0x1d')](respondWithResult(_0x5a20b7,null))['catch'](handleError(_0x5a20b7,null));};exports[_0xee5d('0x50')]=function(_0x363045,_0x2633d8){return db[_0xee5d('0x35')][_0xee5d('0x50')](_0x363045['body'],{})[_0xee5d('0x1d')](respondWithResult(_0x2633d8,0xc9))[_0xee5d('0x25')](handleError(_0x2633d8,null));};exports[_0xee5d('0x30')]=function(_0x28e4b9,_0x3b7187){if(_0x28e4b9[_0xee5d('0x51')]['id']){delete _0x28e4b9[_0xee5d('0x51')]['id'];}return db['VtigerAccount'][_0xee5d('0x4f')]({'where':{'id':_0x28e4b9[_0xee5d('0x4e')]['id']}})[_0xee5d('0x1d')](handleEntityNotFound(_0x3b7187,null))['then'](saveUpdates(_0x28e4b9['body'],null))['then'](respondWithResult(_0x3b7187,null))[_0xee5d('0x25')](handleError(_0x3b7187,null));};exports[_0xee5d('0x31')]=function(_0x246417,_0x5f39a6){return db[_0xee5d('0x35')]['find']({'where':{'id':_0x246417[_0xee5d('0x4e')]['id']}})[_0xee5d('0x1d')](handleEntityNotFound(_0x5f39a6,null))[_0xee5d('0x1d')](removeEntity(_0x5f39a6,null))['catch'](handleError(_0x5f39a6,null));};exports['getConfigurations']=function(_0x12fbae,_0x15db0f,_0x278207){var _0x4cdc3c={};var _0x3605b9={};var _0x42001a;var _0x3cd56e;return db['VtigerAccount'][_0xee5d('0x52')]({'where':{'id':_0x12fbae[_0xee5d('0x4e')]['id']}})[_0xee5d('0x1d')](handleEntityNotFound(_0x15db0f,null))[_0xee5d('0x1d')](function(_0x3ee0fa){if(_0x3ee0fa){_0x42001a=_0x3ee0fa;_0x3605b9[_0xee5d('0x39')]=_['keys'](db[_0xee5d('0x53')][_0xee5d('0x36')]);_0x3605b9[_0xee5d('0x3b')]=_['keys'](_0x12fbae['query']);_0x3605b9['filters']=_[_0xee5d('0x3e')](_0x3605b9[_0xee5d('0x39')],_0x3605b9[_0xee5d('0x3b')]);_0x4cdc3c[_0xee5d('0x3f')]=_['intersection'](_0x3605b9[_0xee5d('0x39')],qs[_0xee5d('0x40')](_0x12fbae[_0xee5d('0x3b')][_0xee5d('0x40')]));_0x4cdc3c['attributes']=_0x4cdc3c[_0xee5d('0x3f')][_0xee5d('0x41')]?_0x4cdc3c[_0xee5d('0x3f')]:_0x3605b9[_0xee5d('0x39')];_0x4cdc3c[_0xee5d('0x44')]=qs[_0xee5d('0x45')](_0x12fbae[_0xee5d('0x3b')]['sort']);_0x4cdc3c['where']=qs[_0xee5d('0x3d')](_[_0xee5d('0x47')](_0x12fbae['query'],_0x3605b9[_0xee5d('0x3d')]));if(_0x12fbae[_0xee5d('0x3b')][_0xee5d('0x49')]){_0x4cdc3c[_0xee5d('0x46')]=_['merge'](_0x4cdc3c[_0xee5d('0x46')],{'$or':_[_0xee5d('0x3a')](_0x4cdc3c[_0xee5d('0x3f')],function(_0x802a00){var _0x4ef039={};_0x4ef039[_0x802a00]={'$like':'%'+_0x12fbae['query'][_0xee5d('0x49')]+'%'};return _0x4ef039;})});}_0x4cdc3c=_[_0xee5d('0x48')]({},_0x4cdc3c,_0x12fbae[_0xee5d('0x54')]);return _0x42001a[_0xee5d('0x55')](_0x4cdc3c);}})[_0xee5d('0x1d')](function(_0x1c12ba){if(_0x1c12ba){_0x3cd56e=_0x1c12ba[_0xee5d('0x41')];if(!_0x12fbae[_0xee5d('0x3b')][_0xee5d('0x42')]('nolimit')){_0x4cdc3c[_0xee5d('0x2a')]=qs['limit'](_0x12fbae[_0xee5d('0x3b')][_0xee5d('0x2a')]);_0x4cdc3c['offset']=qs[_0xee5d('0x29')](_0x12fbae[_0xee5d('0x3b')][_0xee5d('0x29')]);}return _0x42001a['getConfigurations'](_0x4cdc3c);}})[_0xee5d('0x1d')](function(_0x121f26){if(_0x121f26){return _0x121f26?{'count':_0x3cd56e,'rows':_0x121f26}:null;}})[_0xee5d('0x1d')](respondWithResult(_0x15db0f,null))[_0xee5d('0x25')](handleError(_0x15db0f,null));};exports['addConfiguration']=function(_0x235374,_0x182fc9,_0x3e1f44){if(_0x235374[_0xee5d('0x51')]['id']){delete _0x235374[_0xee5d('0x51')]['id'];}return db[_0xee5d('0x35')]['findOne']({'where':{'id':_0x235374[_0xee5d('0x4e')]['id']}})[_0xee5d('0x1d')](handleEntityNotFound(_0x182fc9,null))[_0xee5d('0x1d')](function(_0x43a974){if(_0x43a974){_0x235374[_0xee5d('0x51')][_0xee5d('0x56')]=_0x43a974['id'];_0x235374['body'][_0xee5d('0x57')]=integrations[_0xee5d('0x58')](_0x235374[_0xee5d('0x51')][_0xee5d('0x59')],_0x235374['body'][_0xee5d('0x37')]);_0x235374[_0xee5d('0x51')]['Descriptions']=integrations[_0xee5d('0x5a')](_0x235374['body']['channel'],_0x235374['body'][_0xee5d('0x37')]);return db[_0xee5d('0x53')][_0xee5d('0x50')](_0x235374[_0xee5d('0x51')],{'include':[{'model':db[_0xee5d('0x5b')],'as':_0xee5d('0x57')},{'model':db[_0xee5d('0x5b')],'as':'Descriptions'}]});}return null;})[_0xee5d('0x1d')](respondWithResult(_0x182fc9,null))['catch'](handleError(_0x182fc9,null));};var md5=require(_0xee5d('0x5c'));exports[_0xee5d('0x5d')]=function(_0x45183d,_0x5e1794,_0x28ae69){var _0x1ac6ea=null;var _0x4a53aa=null;var _0x32f729=null;var _0x418b37=null;var _0x52e562='';return db[_0xee5d('0x35')][_0xee5d('0x52')]({'where':{'id':_0x45183d[_0xee5d('0x4e')]['id']},'attributes':['id',_0xee5d('0x33'),_0xee5d('0x5e'),_0xee5d('0x5f'),'moduleName',_0xee5d('0x60'),_0xee5d('0x61'),_0xee5d('0x62')]})[_0xee5d('0x1d')](handleEntityNotFound(_0x5e1794,null))['then'](function(_0x47fda1){if(_0x47fda1){_0x1ac6ea=_0x47fda1[_0xee5d('0x5e')];_0x4a53aa=_0x47fda1[_0xee5d('0x62')];_0x32f729=_0x47fda1[_0xee5d('0x63')];_0x52e562=_0x47fda1[_0xee5d('0x60')];var _0x1c4859=_0x52e562[_0xee5d('0x64')](-0x1);if(_0x1c4859==='/'){_0x52e562=_0x52e562[_0xee5d('0x65')](0x0,_0x52e562[_0xee5d('0x66')](_0x1c4859));}_0x418b37=util[_0xee5d('0x67')](_0xee5d('0x68'),_0x52e562);var _0x131ec9={'method':_0xee5d('0x69'),'uri':_0x418b37,'qs':{'operation':_0xee5d('0x6a'),'username':_0x47fda1[_0xee5d('0x5e')]},'json':!![]};return rp(_0x131ec9);}})['then'](function(_0x5f09cd){if(_0x5f09cd[_0xee5d('0x6b')]){var _0x48cbc7={'method':'POST','uri':_0x418b37,'form':{'operation':_0xee5d('0x6c'),'username':_0x1ac6ea,'accessKey':md5(_0x5f09cd[_0xee5d('0x24')][_0xee5d('0x6d')]+_0x4a53aa)},'json':!![]};return rp(_0x48cbc7);}})[_0xee5d('0x1d')](function(_0x4a7165){if(_0x4a7165[_0xee5d('0x6b')]){var _0x21ce0a={'method':_0xee5d('0x69'),'uri':_0x418b37,'qs':{'operation':_0xee5d('0x6e'),'username':_0x1ac6ea,'sessionName':_0x4a7165[_0xee5d('0x24')][_0xee5d('0x6f')],'elementType':_0x32f729},'json':!![]};return rp(_0x21ce0a);}})['then'](function(_0x1e7621){if(_0x1e7621[_0xee5d('0x6b')]){var _0x394836=[_0xee5d('0x70'),_0xee5d('0x71'),_0xee5d('0x72')];_['remove'](_0x1e7621[_0xee5d('0x24')]['fields'],function(_0x2f3013){return _0x394836[_0xee5d('0x73')](_0x2f3013[_0xee5d('0x37')][_0xee5d('0x33')]);});_[_0xee5d('0x74')](_0x1e7621[_0xee5d('0x24')][_0xee5d('0x40')],function(_0x331961){return _0x331961[_0xee5d('0x75')]===_0xee5d('0x76');});return{'count':_0x1e7621['result'][_0xee5d('0x40')][_0xee5d('0x41')],'rows':_[_0xee5d('0x3a')](_0x1e7621[_0xee5d('0x24')][_0xee5d('0x40')],function(_0x42e15b){return{'id':_0x42e15b['name'],'name':_0x42e15b['label'],'custom':_[_0xee5d('0x77')](_0x42e15b[_0xee5d('0x33')],_0xee5d('0x78'))?!![]:![],'options':_0x42e15b[_0xee5d('0x37')]['name']===_0xee5d('0x79')&&_0x42e15b[_0xee5d('0x37')][_0xee5d('0x7a')]['length']>0x0?_['map'](_0x42e15b[_0xee5d('0x37')]['picklistValues'],function(_0x2aa17a){return{'name':_0x2aa17a[_0xee5d('0x7b')],'value':_0x2aa17a['value']};}):[]};})};}})[_0xee5d('0x1d')](respondWithResult(_0x5e1794,null))[_0xee5d('0x25')](function(_0x4af9c9){console['log'](_0xee5d('0x7c')+_0x4af9c9);var _0x3344a2=_0x45183d[_0xee5d('0x3b')]['test']?0x1f4:_0x4af9c9[_0xee5d('0x7d')]||0x1f4;logger['error'](_0xee5d('0x7e'),_0xee5d('0x5d'),_0x3344a2,JSON[_0xee5d('0x7f')](_0x4af9c9));delete _0x4af9c9[_0xee5d('0x33')];if(_0x3344a2===0x191){_0x3344a2=0x190;}_0x5e1794['status'](_0x3344a2)[_0xee5d('0x80')](_0x45183d[_0xee5d('0x3b')]['test']?{'message':_0xee5d('0x81'),'statusCode':_0x4af9c9[_0xee5d('0x7d')]}:_0x4af9c9);});}; \ No newline at end of file +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 diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 4b3a29b..eb3d15d 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 _0x5543=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','VtigerAccount','int_vtiger_accounts'];(function(_0x54c7a0,_0x149449){var _0x552665=function(_0x3c3049){while(--_0x3c3049){_0x54c7a0['push'](_0x54c7a0['shift']());}};_0x552665(++_0x149449);}(_0x5543,0x84));var _0x3554=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0x5543[_0x1477ef];return _0x164acd;};'use strict';var _=require('lodash');var util=require(_0x3554('0x0'));var logger=require(_0x3554('0x1'))('api');var moment=require(_0x3554('0x2'));var BPromise=require(_0x3554('0x3'));var rp=require(_0x3554('0x4'));var fs=require('fs');var path=require(_0x3554('0x5'));var rimraf=require(_0x3554('0x6'));var config=require(_0x3554('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x3554('0x8'));module[_0x3554('0x9')]=function(_0x383851,_0x2a1960){return _0x383851['define'](_0x3554('0xa'),attributes,{'tableName':_0x3554('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 0972dde..fd95992 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 _0xadb0=['GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','limit','include','model','map','then','stringify','find','ShowVtigerAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','debug','request\x20sent','error','VtigerAccount,\x20%s,\x20%s','message','result','catch'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xadb0,0x104));var _0x0adb=function(_0x475139,_0x375487){_0x475139=_0x475139-0x0;var _0x2abd0d=_0xadb0[_0x475139];return _0x2abd0d;};'use strict';var _=require(_0x0adb('0x0'));var util=require('util');var moment=require(_0x0adb('0x1'));var BPromise=require(_0x0adb('0x2'));var rs=require(_0x0adb('0x3'));var fs=require('fs');var Redis=require(_0x0adb('0x4'));var db=require(_0x0adb('0x5'))['db'];var utils=require(_0x0adb('0x6'));var logger=require(_0x0adb('0x7'))(_0x0adb('0x8'));var config=require(_0x0adb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0adb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc2e879,_0x3ecaf9,_0xa425e6){return new BPromise(function(_0xa0527f,_0xb7c8af){return client[_0x0adb('0xb')](_0xc2e879,_0xa425e6)['then'](function(_0x4b7f30){logger[_0x0adb('0xc')]('VtigerAccount,\x20%s,\x20%s',_0x3ecaf9,'request\x20sent');logger[_0x0adb('0xd')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x3ecaf9,_0x0adb('0xe'),JSON['stringify'](_0x4b7f30));if(_0x4b7f30[_0x0adb('0xf')]){if(_0x4b7f30[_0x0adb('0xf')]['code']===0x1f4){logger[_0x0adb('0xf')](_0x0adb('0x10'),_0x3ecaf9,_0x4b7f30['error'][_0x0adb('0x11')]);return _0xb7c8af(_0x4b7f30['error'][_0x0adb('0x11')]);}logger['error'](_0x0adb('0x10'),_0x3ecaf9,_0x4b7f30[_0x0adb('0xf')][_0x0adb('0x11')]);return _0xa0527f(_0x4b7f30['error'][_0x0adb('0x11')]);}else{logger[_0x0adb('0xc')]('VtigerAccount,\x20%s,\x20%s',_0x3ecaf9,_0x0adb('0xe'));_0xa0527f(_0x4b7f30[_0x0adb('0x12')][_0x0adb('0x11')]);}})[_0x0adb('0x13')](function(_0x2d3f06){logger[_0x0adb('0xf')](_0x0adb('0x10'),_0x3ecaf9,_0x2d3f06);_0xb7c8af(_0x2d3f06);});});}exports[_0x0adb('0x14')]=function(_0xc91f47){var _0x27e469=this;return new Promise(function(_0x78e011,_0x3b3826){return db[_0x0adb('0x15')][_0x0adb('0x16')]({'raw':_0xc91f47[_0x0adb('0x17')]?_0xc91f47[_0x0adb('0x17')][_0x0adb('0x18')]===undefined?!![]:![]:!![],'where':_0xc91f47['options']?_0xc91f47[_0x0adb('0x17')][_0x0adb('0x19')]||null:null,'attributes':_0xc91f47['options']?_0xc91f47['options'][_0x0adb('0x1a')]||null:null,'limit':_0xc91f47[_0x0adb('0x17')]?_0xc91f47[_0x0adb('0x17')][_0x0adb('0x1b')]||null:null,'include':_0xc91f47['options']?_0xc91f47['options'][_0x0adb('0x1c')]?_['map'](_0xc91f47[_0x0adb('0x17')]['include'],function(_0x41ca87){return{'model':db[_0x41ca87[_0x0adb('0x1d')]],'as':_0x41ca87['as'],'attributes':_0x41ca87['attributes'],'include':_0x41ca87[_0x0adb('0x1c')]?_[_0x0adb('0x1e')](_0x41ca87[_0x0adb('0x1c')],function(_0x3e77e7){return{'model':db[_0x3e77e7[_0x0adb('0x1d')]],'as':_0x3e77e7['as'],'attributes':_0x3e77e7[_0x0adb('0x1a')],'include':_0x3e77e7['include']?_[_0x0adb('0x1e')](_0x3e77e7[_0x0adb('0x1c')],function(_0x499ec9){return{'model':db[_0x499ec9[_0x0adb('0x1d')]],'as':_0x499ec9['as'],'attributes':_0x499ec9[_0x0adb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0adb('0x1f')](function(_0x454537){logger[_0x0adb('0xc')](_0x0adb('0x14'),_0xc91f47);logger[_0x0adb('0xd')](_0x0adb('0x14'),_0xc91f47,JSON[_0x0adb('0x20')](_0x454537));_0x78e011(_0x454537);})[_0x0adb('0x13')](function(_0xd7091){logger['error']('GetVtigerAccount',_0xd7091[_0x0adb('0x11')],_0xc91f47);_0x3b3826(_0x27e469['error'](0x1f4,_0xd7091[_0x0adb('0x11')]));});});};exports['ShowVtigerAccount']=function(_0x3234fd){var _0x344a3c=this;return new Promise(function(_0x222a85,_0x1bb2df){return db[_0x0adb('0x15')][_0x0adb('0x21')]({'raw':_0x3234fd[_0x0adb('0x17')]?_0x3234fd['options'][_0x0adb('0x18')]===undefined?!![]:![]:!![],'where':_0x3234fd[_0x0adb('0x17')]?_0x3234fd[_0x0adb('0x17')][_0x0adb('0x19')]||null:null,'attributes':_0x3234fd[_0x0adb('0x17')]?_0x3234fd[_0x0adb('0x17')][_0x0adb('0x1a')]||null:null,'include':_0x3234fd['options']?_0x3234fd[_0x0adb('0x17')][_0x0adb('0x1c')]?_['map'](_0x3234fd[_0x0adb('0x17')][_0x0adb('0x1c')],function(_0x2f95a1){return{'model':db[_0x2f95a1[_0x0adb('0x1d')]],'as':_0x2f95a1['as'],'attributes':_0x2f95a1[_0x0adb('0x1a')],'include':_0x2f95a1[_0x0adb('0x1c')]?_[_0x0adb('0x1e')](_0x2f95a1[_0x0adb('0x1c')],function(_0x18c8d3){return{'model':db[_0x18c8d3[_0x0adb('0x1d')]],'as':_0x18c8d3['as'],'attributes':_0x18c8d3[_0x0adb('0x1a')],'include':_0x18c8d3[_0x0adb('0x1c')]?_[_0x0adb('0x1e')](_0x18c8d3[_0x0adb('0x1c')],function(_0x35e77b){return{'model':db[_0x35e77b['model']],'as':_0x35e77b['as'],'attributes':_0x35e77b[_0x0adb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0adb('0x1f')](function(_0x5a8cb8){logger[_0x0adb('0xc')](_0x0adb('0x22'),_0x3234fd);logger[_0x0adb('0xd')](_0x0adb('0x22'),_0x3234fd,JSON[_0x0adb('0x20')](_0x5a8cb8));_0x222a85(_0x5a8cb8);})[_0x0adb('0x13')](function(_0x1c28ca){logger[_0x0adb('0xf')]('ShowVtigerAccount',_0x1c28ca[_0x0adb('0x11')],_0x3234fd);_0x1bb2df(_0x344a3c['error'](0x1f4,_0x1c28ca[_0x0adb('0x11')]));});});}; \ No newline at end of file +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 diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 51e4e39..592bc92 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(_0x472a37,_0x1137be){var _0x1c842b=function(_0x256f1a){while(--_0x256f1a){_0x472a37['push'](_0x472a37['shift']());}};_0x1c842b(++_0x1137be);}(_0xb10b,0x12a));var _0xbb10=function(_0x397f37,_0x3cf86d){_0x397f37=_0x397f37-0x0;var _0x31cae6=_0xb10b[_0x397f37];return _0x31cae6;};'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(_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 diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 60fbccf..072f17d 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 _0xa589=['sequelize','exports','STRING'];(function(_0x48025d,_0x368a9b){var _0x32b0e1=function(_0x3a4886){while(--_0x3a4886){_0x48025d['push'](_0x48025d['shift']());}};_0x32b0e1(++_0x368a9b);}(_0xa589,0x6c));var _0x9a58=function(_0x95e21d,_0x36861e){_0x95e21d=_0x95e21d-0x0;var _0x3fd266=_0xa589[_0x95e21d];return _0x3fd266;};'use strict';var Sequelize=require(_0x9a58('0x0'));module[_0x9a58('0x1')]={'name':{'type':Sequelize[_0x9a58('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +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 diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 65b259d..0b71c03 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 _0x4fb3=['find','create','body','getFields','VtigerField','findOne','getSubjects','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VtigerConfiguration','include','findAll','show','params','includeAll','options'];(function(_0x821aa2,_0x26e437){var _0x18071a=function(_0x319075){while(--_0x319075){_0x821aa2['push'](_0x821aa2['shift']());}};_0x18071a(++_0x26e437);}(_0x4fb3,0x11c));var _0x34fb=function(_0x310615,_0x4e240d){_0x310615=_0x310615-0x0;var _0x590556=_0x4fb3[_0x310615];return _0x590556;};'use strict';var pdf=require(_0x34fb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x34fb('0x1'));var zipdir=require(_0x34fb('0x2'));var jsonpatch=require(_0x34fb('0x3'));var rp=require(_0x34fb('0x4'));var moment=require(_0x34fb('0x5'));var BPromise=require(_0x34fb('0x6'));var Mustache=require(_0x34fb('0x7'));var util=require(_0x34fb('0x8'));var path=require(_0x34fb('0x9'));var sox=require(_0x34fb('0xa'));var csv=require(_0x34fb('0xb'));var ejs=require(_0x34fb('0xc'));var fs=require('fs');var _=require(_0x34fb('0xd'));var squel=require(_0x34fb('0xe'));var crypto=require(_0x34fb('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x34fb('0x10'));var toCsv=require('to-csv');var querystring=require(_0x34fb('0x11'));var Papa=require(_0x34fb('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x34fb('0x13'));var as=require(_0x34fb('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x34fb('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x34fb('0x16'))['db'];var jayson=require(_0x34fb('0x17'));var client=jayson[_0x34fb('0x18')][_0x34fb('0x19')]({'port':0x232a});function checkPasswordPattern(_0x4aed74,_0x5a9fdd,_0x4a7fcf){if(_0x4a7fcf){var _0x26b29f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x26b29f['test'](_0x5a9fdd)){return _0x4aed74;}else{throw new db[(_0x34fb('0x1a'))][(_0x34fb('0x1b'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x4aed74;}}function respondWithRpcPromise(_0x4ed0b9,_0x53ba3d,_0x12a345,_0x4800b6){return new BPromise(function(_0x188cc0,_0x18d177){var _0xe05599=_0x4800b6||client;return _0xe05599[_0x34fb('0x1c')](_0x4ed0b9,_0x12a345)[_0x34fb('0x1d')](function(_0x22b27f){logger[_0x34fb('0x1e')](_0x34fb('0x1f'),_0x53ba3d,'request\x20sent');logger[_0x34fb('0x20')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x53ba3d,_0x34fb('0x21'),JSON['stringify'](_0x22b27f));if(_0x22b27f[_0x34fb('0x22')]){if(_0x22b27f[_0x34fb('0x22')][_0x34fb('0x23')]===0x1f4){logger[_0x34fb('0x22')](_0x34fb('0x1f'),_0x53ba3d,_0x22b27f[_0x34fb('0x22')][_0x34fb('0x24')]);return _0x18d177(_0x22b27f[_0x34fb('0x22')]['message']);}logger['error'](_0x34fb('0x1f'),_0x53ba3d,_0x22b27f[_0x34fb('0x22')][_0x34fb('0x24')]);return _0x188cc0(_0x22b27f[_0x34fb('0x22')][_0x34fb('0x24')]);}else{logger[_0x34fb('0x1e')](_0x34fb('0x1f'),_0x53ba3d,_0x34fb('0x21'));_0x188cc0(_0x22b27f[_0x34fb('0x25')]['message']);}})[_0x34fb('0x26')](function(_0x906ff5){logger[_0x34fb('0x22')](_0x34fb('0x1f'),_0x53ba3d,_0x906ff5);_0x18d177(_0x906ff5);});});}function respondWithStatusCode(_0x28cba7,_0x413c89){_0x413c89=_0x413c89||0xcc;return function(_0x962ae9){if(_0x962ae9){return _0x28cba7[_0x34fb('0x27')](_0x413c89);}return _0x28cba7[_0x34fb('0x28')](_0x413c89)[_0x34fb('0x29')]();};}function respondWithResult(_0x5d2394,_0x2491b8){_0x2491b8=_0x2491b8||0xc8;return function(_0x1a1535){if(_0x1a1535){return _0x5d2394[_0x34fb('0x28')](_0x2491b8)[_0x34fb('0x2a')](_0x1a1535);}};}function respondWithFilteredResult(_0x3a1001,_0x3c16e3){return function(_0x2af436){if(_0x2af436){var _0x6c7574=_0x2af436[_0x34fb('0x2b')],_0x341c86=_0x3c16e3[_0x34fb('0x2c')],_0x4926a9=_0x3c16e3[_0x34fb('0x2c')]+_0x3c16e3['limit'],_0x809836;if(_0x4926a9>=_0x6c7574){_0x4926a9=_0x6c7574;_0x809836=0xc8;}else{_0x809836=0xce;}_0x3a1001[_0x34fb('0x28')](_0x809836);return _0x3a1001[_0x34fb('0x2d')](_0x34fb('0x2e'),_0x341c86+'-'+_0x4926a9+'/'+_0x6c7574)[_0x34fb('0x2a')](_0x2af436);}return null;};}function patchUpdates(_0x350c71){return function(_0x1bb771){try{jsonpatch[_0x34fb('0x2f')](_0x1bb771,_0x350c71,!![]);}catch(_0x267556){return BPromise[_0x34fb('0x30')](_0x267556);}return _0x1bb771['save']();};}function saveUpdates(_0xf5c93a,_0x53defa){return function(_0xa655d){if(_0xa655d){return _0xa655d[_0x34fb('0x31')](_0xf5c93a)[_0x34fb('0x1d')](function(_0x449c37){return _0x449c37;});}return null;};}function removeEntity(_0x189635,_0x27eed0){return function(_0x571235){if(_0x571235){return _0x571235[_0x34fb('0x32')]()[_0x34fb('0x1d')](function(){_0x189635[_0x34fb('0x28')](0xcc)[_0x34fb('0x29')]();});}};}function handleEntityNotFound(_0x288629,_0xdf156a){return function(_0x2933ca){if(!_0x2933ca){_0x288629[_0x34fb('0x27')](0x194);}return _0x2933ca;};}function handleError(_0x3a24d3,_0x23cd73){_0x23cd73=_0x23cd73||0x1f4;return function(_0x3ae99f){logger[_0x34fb('0x22')](_0x3ae99f[_0x34fb('0x33')]);if(_0x3ae99f[_0x34fb('0x34')]){delete _0x3ae99f[_0x34fb('0x34')];}_0x3a24d3[_0x34fb('0x28')](_0x23cd73)[_0x34fb('0x35')](_0x3ae99f);};}exports[_0x34fb('0x36')]=function(_0x4128c2,_0x5d8dd7){var _0x1f5cf6={},_0x4348a4={},_0x199fa1={'count':0x0,'rows':[]};var _0x52cbf0=_[_0x34fb('0x37')](db['VtigerConfiguration'][_0x34fb('0x38')],function(_0x5df9eb){return{'name':_0x5df9eb[_0x34fb('0x39')],'type':_0x5df9eb[_0x34fb('0x3a')][_0x34fb('0x3b')]};});_0x4348a4[_0x34fb('0x3c')]=_[_0x34fb('0x37')](_0x52cbf0,_0x34fb('0x34'));_0x4348a4[_0x34fb('0x3d')]=_[_0x34fb('0x3e')](_0x4128c2[_0x34fb('0x3d')]);_0x4348a4['filters']=_[_0x34fb('0x3f')](_0x4348a4[_0x34fb('0x3c')],_0x4348a4['query']);_0x1f5cf6[_0x34fb('0x40')]=_[_0x34fb('0x3f')](_0x4348a4['model'],qs[_0x34fb('0x41')](_0x4128c2['query']['fields']));_0x1f5cf6[_0x34fb('0x40')]=_0x1f5cf6[_0x34fb('0x40')][_0x34fb('0x42')]?_0x1f5cf6[_0x34fb('0x40')]:_0x4348a4[_0x34fb('0x3c')];if(!_0x4128c2[_0x34fb('0x3d')][_0x34fb('0x43')](_0x34fb('0x44'))){_0x1f5cf6['limit']=qs['limit'](_0x4128c2[_0x34fb('0x3d')][_0x34fb('0x45')]);_0x1f5cf6['offset']=qs[_0x34fb('0x2c')](_0x4128c2['query'][_0x34fb('0x2c')]);}_0x1f5cf6[_0x34fb('0x46')]=qs[_0x34fb('0x47')](_0x4128c2[_0x34fb('0x3d')][_0x34fb('0x47')]);_0x1f5cf6[_0x34fb('0x48')]=qs[_0x34fb('0x49')](_[_0x34fb('0x4a')](_0x4128c2[_0x34fb('0x3d')],_0x4348a4[_0x34fb('0x49')]));if(_0x4128c2[_0x34fb('0x3d')][_0x34fb('0x4b')]){_0x1f5cf6[_0x34fb('0x48')]=_[_0x34fb('0x4c')](_0x1f5cf6[_0x34fb('0x48')],{'$or':_['map'](_0x52cbf0,function(_0x3c7202){if(_0x3c7202[_0x34fb('0x3a')]!=='VIRTUAL'){var _0x557a85={};_0x557a85[_0x3c7202[_0x34fb('0x34')]]={'$like':'%'+_0x4128c2[_0x34fb('0x3d')]['filter']+'%'};return _0x557a85;}})});}_0x1f5cf6=_['merge']({},_0x1f5cf6,_0x4128c2['options']);var _0x165325={'where':_0x1f5cf6[_0x34fb('0x48')]};return db[_0x34fb('0x4d')][_0x34fb('0x2b')](_0x165325)[_0x34fb('0x1d')](function(_0x3b85c5){_0x199fa1[_0x34fb('0x2b')]=_0x3b85c5;if(_0x4128c2[_0x34fb('0x3d')]['includeAll']){_0x1f5cf6[_0x34fb('0x4e')]=[{'all':!![]}];}return db[_0x34fb('0x4d')][_0x34fb('0x4f')](_0x1f5cf6);})[_0x34fb('0x1d')](function(_0x400689){_0x199fa1['rows']=_0x400689;return _0x199fa1;})[_0x34fb('0x1d')](respondWithFilteredResult(_0x5d8dd7,_0x1f5cf6))['catch'](handleError(_0x5d8dd7,null));};exports[_0x34fb('0x50')]=function(_0xba39e0,_0x5da058){var _0x22653c={'raw':![],'where':{'id':_0xba39e0[_0x34fb('0x51')]['id']}},_0x1d0cf1={};_0x1d0cf1[_0x34fb('0x3c')]=_[_0x34fb('0x3e')](db['VtigerConfiguration'][_0x34fb('0x38')]);_0x1d0cf1[_0x34fb('0x3d')]=_[_0x34fb('0x3e')](_0xba39e0[_0x34fb('0x3d')]);_0x1d0cf1[_0x34fb('0x49')]=_[_0x34fb('0x3f')](_0x1d0cf1[_0x34fb('0x3c')],_0x1d0cf1['query']);_0x22653c[_0x34fb('0x40')]=_['intersection'](_0x1d0cf1['model'],qs[_0x34fb('0x41')](_0xba39e0[_0x34fb('0x3d')][_0x34fb('0x41')]));_0x22653c[_0x34fb('0x40')]=_0x22653c['attributes'][_0x34fb('0x42')]?_0x22653c[_0x34fb('0x40')]:_0x1d0cf1[_0x34fb('0x3c')];if(_0xba39e0['query'][_0x34fb('0x52')]){_0x22653c[_0x34fb('0x4e')]=[{'all':!![]}];}_0x22653c=_[_0x34fb('0x4c')]({},_0x22653c,_0xba39e0[_0x34fb('0x53')]);return db[_0x34fb('0x4d')][_0x34fb('0x54')](_0x22653c)[_0x34fb('0x1d')](handleEntityNotFound(_0x5da058,null))[_0x34fb('0x1d')](respondWithResult(_0x5da058,null))[_0x34fb('0x26')](handleError(_0x5da058,null));};exports[_0x34fb('0x55')]=function(_0xd3ce41,_0x122931){return db[_0x34fb('0x4d')]['create'](_0xd3ce41['body'],{})[_0x34fb('0x1d')](respondWithResult(_0x122931,0xc9))[_0x34fb('0x26')](handleError(_0x122931,null));};exports[_0x34fb('0x31')]=function(_0x1036e8,_0x49b51b){if(_0x1036e8[_0x34fb('0x56')]['id']){delete _0x1036e8[_0x34fb('0x56')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x1036e8[_0x34fb('0x51')]['id']}})['then'](handleEntityNotFound(_0x49b51b,null))[_0x34fb('0x1d')](saveUpdates(_0x1036e8['body'],null))[_0x34fb('0x1d')](respondWithResult(_0x49b51b,null))[_0x34fb('0x26')](handleError(_0x49b51b,null));};exports[_0x34fb('0x32')]=function(_0x360a81,_0x545794){return db['VtigerConfiguration'][_0x34fb('0x54')]({'where':{'id':_0x360a81['params']['id']}})[_0x34fb('0x1d')](handleEntityNotFound(_0x545794,null))[_0x34fb('0x1d')](removeEntity(_0x545794,null))['catch'](handleError(_0x545794,null));};exports[_0x34fb('0x57')]=function(_0x57f6c9,_0x612b92,_0x37a2c1){var _0x2879d4={};var _0x12f222={};var _0x54b8d7;var _0x214579;return db[_0x34fb('0x4d')]['findOne']({'where':{'id':_0x57f6c9[_0x34fb('0x51')]['id']}})['then'](handleEntityNotFound(_0x612b92,null))['then'](function(_0x42c068){if(_0x42c068){_0x54b8d7=_0x42c068;_0x12f222[_0x34fb('0x3c')]=_[_0x34fb('0x3e')](db[_0x34fb('0x58')]['rawAttributes']);_0x12f222['query']=_[_0x34fb('0x3e')](_0x57f6c9[_0x34fb('0x3d')]);_0x12f222[_0x34fb('0x49')]=_['intersection'](_0x12f222['model'],_0x12f222[_0x34fb('0x3d')]);_0x2879d4[_0x34fb('0x40')]=_[_0x34fb('0x3f')](_0x12f222[_0x34fb('0x3c')],qs[_0x34fb('0x41')](_0x57f6c9[_0x34fb('0x3d')][_0x34fb('0x41')]));_0x2879d4[_0x34fb('0x40')]=_0x2879d4['attributes'][_0x34fb('0x42')]?_0x2879d4[_0x34fb('0x40')]:_0x12f222[_0x34fb('0x3c')];_0x2879d4[_0x34fb('0x46')]=qs[_0x34fb('0x47')](_0x57f6c9[_0x34fb('0x3d')][_0x34fb('0x47')]);_0x2879d4[_0x34fb('0x48')]=qs[_0x34fb('0x49')](_[_0x34fb('0x4a')](_0x57f6c9[_0x34fb('0x3d')],_0x12f222[_0x34fb('0x49')]));if(_0x57f6c9['query'][_0x34fb('0x4b')]){_0x2879d4['where']=_[_0x34fb('0x4c')](_0x2879d4[_0x34fb('0x48')],{'$or':_[_0x34fb('0x37')](_0x2879d4[_0x34fb('0x40')],function(_0x253356){var _0x268759={};_0x268759[_0x253356]={'$like':'%'+_0x57f6c9[_0x34fb('0x3d')][_0x34fb('0x4b')]+'%'};return _0x268759;})});}_0x2879d4=_[_0x34fb('0x4c')]({},_0x2879d4,_0x57f6c9[_0x34fb('0x53')]);return _0x54b8d7['getFields'](_0x2879d4);}})['then'](function(_0x1c72eb){if(_0x1c72eb){_0x214579=_0x1c72eb[_0x34fb('0x42')];if(!_0x57f6c9[_0x34fb('0x3d')][_0x34fb('0x43')](_0x34fb('0x44'))){_0x2879d4['limit']=qs[_0x34fb('0x45')](_0x57f6c9[_0x34fb('0x3d')][_0x34fb('0x45')]);_0x2879d4[_0x34fb('0x2c')]=qs['offset'](_0x57f6c9[_0x34fb('0x3d')][_0x34fb('0x2c')]);}return _0x54b8d7['getFields'](_0x2879d4);}})[_0x34fb('0x1d')](function(_0x530a2b){if(_0x530a2b){return _0x530a2b?{'count':_0x214579,'rows':_0x530a2b}:null;}})[_0x34fb('0x1d')](respondWithResult(_0x612b92,null))[_0x34fb('0x26')](handleError(_0x612b92,null));};exports['getSubjects']=function(_0x27122d,_0x23d7c6,_0x17b2e8){var _0x489639={};var _0x2b2fa3={};var _0x177eed;var _0x419291;return db[_0x34fb('0x4d')][_0x34fb('0x59')]({'where':{'id':_0x27122d[_0x34fb('0x51')]['id']}})[_0x34fb('0x1d')](handleEntityNotFound(_0x23d7c6,null))[_0x34fb('0x1d')](function(_0x3e974a){if(_0x3e974a){_0x177eed=_0x3e974a;_0x2b2fa3[_0x34fb('0x3c')]=_[_0x34fb('0x3e')](db['VtigerField'][_0x34fb('0x38')]);_0x2b2fa3['query']=_['keys'](_0x27122d['query']);_0x2b2fa3[_0x34fb('0x49')]=_['intersection'](_0x2b2fa3[_0x34fb('0x3c')],_0x2b2fa3[_0x34fb('0x3d')]);_0x489639[_0x34fb('0x40')]=_[_0x34fb('0x3f')](_0x2b2fa3['model'],qs[_0x34fb('0x41')](_0x27122d[_0x34fb('0x3d')]['fields']));_0x489639[_0x34fb('0x40')]=_0x489639[_0x34fb('0x40')]['length']?_0x489639[_0x34fb('0x40')]:_0x2b2fa3[_0x34fb('0x3c')];_0x489639[_0x34fb('0x46')]=qs[_0x34fb('0x47')](_0x27122d[_0x34fb('0x3d')][_0x34fb('0x47')]);_0x489639['where']=qs[_0x34fb('0x49')](_['pick'](_0x27122d[_0x34fb('0x3d')],_0x2b2fa3['filters']));if(_0x27122d[_0x34fb('0x3d')]['filter']){_0x489639[_0x34fb('0x48')]=_[_0x34fb('0x4c')](_0x489639[_0x34fb('0x48')],{'$or':_[_0x34fb('0x37')](_0x489639[_0x34fb('0x40')],function(_0x2eb9df){var _0x2d3baa={};_0x2d3baa[_0x2eb9df]={'$like':'%'+_0x27122d['query'][_0x34fb('0x4b')]+'%'};return _0x2d3baa;})});}_0x489639=_[_0x34fb('0x4c')]({},_0x489639,_0x27122d[_0x34fb('0x53')]);return _0x177eed[_0x34fb('0x5a')](_0x489639);}})['then'](function(_0x2de7f6){if(_0x2de7f6){_0x419291=_0x2de7f6[_0x34fb('0x42')];if(!_0x27122d['query'][_0x34fb('0x43')](_0x34fb('0x44'))){_0x489639[_0x34fb('0x45')]=qs[_0x34fb('0x45')](_0x27122d['query']['limit']);_0x489639[_0x34fb('0x2c')]=qs[_0x34fb('0x2c')](_0x27122d[_0x34fb('0x3d')][_0x34fb('0x2c')]);}return _0x177eed[_0x34fb('0x5a')](_0x489639);}})[_0x34fb('0x1d')](function(_0x23d916){if(_0x23d916){return _0x23d916?{'count':_0x419291,'rows':_0x23d916}:null;}})['then'](respondWithResult(_0x23d7c6,null))[_0x34fb('0x26')](handleError(_0x23d7c6,null));};exports[_0x34fb('0x5b')]=function(_0x1786e0,_0x72bf,_0x174b38){var _0x187cf9={};var _0x42d63b={};var _0x21409f;var _0x120b80;return db[_0x34fb('0x4d')]['findOne']({'where':{'id':_0x1786e0[_0x34fb('0x51')]['id']}})[_0x34fb('0x1d')](handleEntityNotFound(_0x72bf,null))['then'](function(_0x32e6ab){if(_0x32e6ab){_0x21409f=_0x32e6ab;_0x42d63b[_0x34fb('0x3c')]=_[_0x34fb('0x3e')](db['VtigerField'][_0x34fb('0x38')]);_0x42d63b['query']=_['keys'](_0x1786e0[_0x34fb('0x3d')]);_0x42d63b['filters']=_[_0x34fb('0x3f')](_0x42d63b[_0x34fb('0x3c')],_0x42d63b['query']);_0x187cf9[_0x34fb('0x40')]=_['intersection'](_0x42d63b[_0x34fb('0x3c')],qs[_0x34fb('0x41')](_0x1786e0['query'][_0x34fb('0x41')]));_0x187cf9['attributes']=_0x187cf9[_0x34fb('0x40')][_0x34fb('0x42')]?_0x187cf9['attributes']:_0x42d63b[_0x34fb('0x3c')];_0x187cf9[_0x34fb('0x46')]=qs[_0x34fb('0x47')](_0x1786e0[_0x34fb('0x3d')][_0x34fb('0x47')]);_0x187cf9['where']=qs['filters'](_[_0x34fb('0x4a')](_0x1786e0[_0x34fb('0x3d')],_0x42d63b[_0x34fb('0x49')]));if(_0x1786e0[_0x34fb('0x3d')][_0x34fb('0x4b')]){_0x187cf9['where']=_[_0x34fb('0x4c')](_0x187cf9[_0x34fb('0x48')],{'$or':_['map'](_0x187cf9[_0x34fb('0x40')],function(_0x10148e){var _0x4b4695={};_0x4b4695[_0x10148e]={'$like':'%'+_0x1786e0[_0x34fb('0x3d')][_0x34fb('0x4b')]+'%'};return _0x4b4695;})});}_0x187cf9=_[_0x34fb('0x4c')]({},_0x187cf9,_0x1786e0[_0x34fb('0x53')]);return _0x21409f[_0x34fb('0x5b')](_0x187cf9);}})[_0x34fb('0x1d')](function(_0x97c615){if(_0x97c615){_0x120b80=_0x97c615['length'];if(!_0x1786e0['query']['hasOwnProperty'](_0x34fb('0x44'))){_0x187cf9[_0x34fb('0x45')]=qs['limit'](_0x1786e0[_0x34fb('0x3d')]['limit']);_0x187cf9['offset']=qs[_0x34fb('0x2c')](_0x1786e0['query']['offset']);}return _0x21409f[_0x34fb('0x5b')](_0x187cf9);}})[_0x34fb('0x1d')](function(_0x554445){if(_0x554445){return _0x554445?{'count':_0x120b80,'rows':_0x554445}:null;}})['then'](respondWithResult(_0x72bf,null))[_0x34fb('0x26')](handleError(_0x72bf,null));}; \ No newline at end of file +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 diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 6715155..a0235ea 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 _0x1b9c=['int_vtiger_configurations','util','moment','bluebird','request-promise','path','rimraf','./intVtigerConfiguration.attributes','exports','define'];(function(_0x2a9a05,_0x681b4c){var _0x551770=function(_0x1aacc3){while(--_0x1aacc3){_0x2a9a05['push'](_0x2a9a05['shift']());}};_0x551770(++_0x681b4c);}(_0x1b9c,0x8d));var _0xc1b9=function(_0x372d1b,_0x28ff10){_0x372d1b=_0x372d1b-0x0;var _0x5ab0e8=_0x1b9c[_0x372d1b];return _0x5ab0e8;};'use strict';var _=require('lodash');var util=require(_0xc1b9('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xc1b9('0x1'));var BPromise=require(_0xc1b9('0x2'));var rp=require(_0xc1b9('0x3'));var fs=require('fs');var path=require(_0xc1b9('0x4'));var rimraf=require(_0xc1b9('0x5'));var config=require('../../config/environment');var attributes=require(_0xc1b9('0x6'));module[_0xc1b9('0x7')]=function(_0x29f086,_0x43d2c7){return _0x29f086[_0xc1b9('0x8')]('VtigerConfiguration',attributes,{'tableName':_0xc1b9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index ea3dd8e..9d07e3b 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 _0xef7d=['request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x2a9241,_0x27a474){var _0x5ef639=function(_0x531945){while(--_0x531945){_0x2a9241['push'](_0x2a9241['shift']());}};_0x5ef639(++_0x27a474);}(_0xef7d,0x170));var _0xdef7=function(_0x243481,_0x33ba56){_0x243481=_0x243481-0x0;var _0x3c7a5c=_0xef7d[_0x243481];return _0x3c7a5c;};'use strict';var _=require(_0xdef7('0x0'));var util=require(_0xdef7('0x1'));var moment=require(_0xdef7('0x2'));var BPromise=require('bluebird');var rs=require(_0xdef7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdef7('0x4'))['db'];var utils=require(_0xdef7('0x5'));var logger=require(_0xdef7('0x6'))('rpc');var config=require(_0xdef7('0x7'));var jayson=require(_0xdef7('0x8'));var client=jayson[_0xdef7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41295b,_0x23b226,_0x4d697e){return new BPromise(function(_0x4a6145,_0x39afeb){return client[_0xdef7('0xa')](_0x41295b,_0x4d697e)[_0xdef7('0xb')](function(_0x37f5c5){logger[_0xdef7('0xc')](_0xdef7('0xd'),_0x23b226,'request\x20sent');logger[_0xdef7('0xe')](_0xdef7('0xf'),_0x23b226,'request\x20sent',JSON[_0xdef7('0x10')](_0x37f5c5));if(_0x37f5c5[_0xdef7('0x11')]){if(_0x37f5c5['error']['code']===0x1f4){logger[_0xdef7('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x23b226,_0x37f5c5['error'][_0xdef7('0x12')]);return _0x39afeb(_0x37f5c5[_0xdef7('0x11')][_0xdef7('0x12')]);}logger[_0xdef7('0x11')](_0xdef7('0xd'),_0x23b226,_0x37f5c5[_0xdef7('0x11')][_0xdef7('0x12')]);return _0x4a6145(_0x37f5c5['error'][_0xdef7('0x12')]);}else{logger['info'](_0xdef7('0xd'),_0x23b226,'request\x20sent');_0x4a6145(_0x37f5c5[_0xdef7('0x13')][_0xdef7('0x12')]);}})[_0xdef7('0x14')](function(_0x523c93){logger['error'](_0xdef7('0xd'),_0x23b226,_0x523c93);_0x39afeb(_0x523c93);});});} \ No newline at end of file +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 diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 4a5411f..20d61bb 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 _0x2f45=['index','/:id','post','create','put','update','delete','exports','util','path','connect-timeout','../../config/environment','./intVtigerField.controller','get','isAuthenticated'];(function(_0xd06bf8,_0x8d3989){var _0x3e5e8e=function(_0x1bbb8f){while(--_0x1bbb8f){_0xd06bf8['push'](_0xd06bf8['shift']());}};_0x3e5e8e(++_0x8d3989);}(_0x2f45,0x9e));var _0x52f4=function(_0x69ede,_0x3f8e97){_0x69ede=_0x69ede-0x0;var _0x13e7e1=_0x2f45[_0x69ede];return _0x13e7e1;};'use strict';var multer=require('multer');var util=require(_0x52f4('0x0'));var path=require(_0x52f4('0x1'));var timeout=require(_0x52f4('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x52f4('0x3'));var controller=require(_0x52f4('0x4'));router[_0x52f4('0x5')]('/',auth[_0x52f4('0x6')](),controller[_0x52f4('0x7')]);router[_0x52f4('0x5')](_0x52f4('0x8'),auth[_0x52f4('0x6')](),controller['show']);router[_0x52f4('0x9')]('/',auth[_0x52f4('0x6')](),controller[_0x52f4('0xa')]);router[_0x52f4('0xb')](_0x52f4('0x8'),auth[_0x52f4('0x6')](),controller[_0x52f4('0xc')]);router[_0x52f4('0xd')](_0x52f4('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x52f4('0xe')]=router; \ No newline at end of file +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 diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 9fa0454..97be665 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 _0x5270=['STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable'];(function(_0x327a88,_0x5941b3){var _0x27590a=function(_0x23ed82){while(--_0x23ed82){_0x327a88['push'](_0x327a88['shift']());}};_0x27590a(++_0x5941b3);}(_0x5270,0xab));var _0x0527=function(_0x2f9966,_0x3f70fd){_0x2f9966=_0x2f9966-0x0;var _0xe2ca2e=_0x5270[_0x2f9966];return _0xe2ca2e;};'use strict';var Sequelize=require(_0x0527('0x0'));module[_0x0527('0x1')]={'type':{'type':Sequelize['ENUM'](_0x0527('0x2'),_0x0527('0x3'),_0x0527('0x4'),'keyValue'),'defaultValue':_0x0527('0x2')},'content':{'type':Sequelize[_0x0527('0x5')]},'key':{'type':Sequelize[_0x0527('0x5')]},'keyType':{'type':Sequelize[_0x0527('0x6')]('string',_0x0527('0x3'),_0x0527('0x4'))},'keyContent':{'type':Sequelize[_0x0527('0x5')]},'idField':{'type':Sequelize[_0x0527('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0527('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0527('0x5')]}}; \ No newline at end of file +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 diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index e0e146b..c47fb0b 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 _0xcfd8=['findAll','rows','show','params','find','create','body','catch','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','set','Content-Range','json','apply','reject','save','update','then','error','name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include'];(function(_0x702917,_0x574967){var _0x188d16=function(_0x56eace){while(--_0x56eace){_0x702917['push'](_0x702917['shift']());}};_0x188d16(++_0x574967);}(_0xcfd8,0x1d1));var _0x8cfd=function(_0x2300c7,_0x255f74){_0x2300c7=_0x2300c7-0x0;var _0x23f720=_0xcfd8[_0x2300c7];return _0x23f720;};'use strict';var pdf=require(_0x8cfd('0x0'));var emlformat=require(_0x8cfd('0x1'));var rimraf=require(_0x8cfd('0x2'));var zipdir=require(_0x8cfd('0x3'));var jsonpatch=require(_0x8cfd('0x4'));var rp=require(_0x8cfd('0x5'));var moment=require('moment');var BPromise=require(_0x8cfd('0x6'));var Mustache=require(_0x8cfd('0x7'));var util=require(_0x8cfd('0x8'));var path=require(_0x8cfd('0x9'));var sox=require(_0x8cfd('0xa'));var csv=require(_0x8cfd('0xb'));var ejs=require(_0x8cfd('0xc'));var fs=require('fs');var _=require(_0x8cfd('0xd'));var squel=require(_0x8cfd('0xe'));var crypto=require(_0x8cfd('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8cfd('0xb'));var querystring=require('querystring');var Papa=require(_0x8cfd('0x10'));var Redis=require('ioredis');var authService=require(_0x8cfd('0x11'));var qs=require(_0x8cfd('0x12'));var as=require(_0x8cfd('0x13'));var hardwareService=require(_0x8cfd('0x14'));var logger=require('../../config/logger')(_0x8cfd('0x15'));var utils=require(_0x8cfd('0x16'));var config=require('../../config/environment');var db=require(_0x8cfd('0x17'))['db'];function respondWithStatusCode(_0x4b2834,_0x4eaf7d){_0x4eaf7d=_0x4eaf7d||0xcc;return function(_0x28bf06){if(_0x28bf06){return _0x4b2834[_0x8cfd('0x18')](_0x4eaf7d);}return _0x4b2834[_0x8cfd('0x19')](_0x4eaf7d)[_0x8cfd('0x1a')]();};}function respondWithResult(_0x1517cd,_0x4f94b1){_0x4f94b1=_0x4f94b1||0xc8;return function(_0x564479){if(_0x564479){return _0x1517cd[_0x8cfd('0x19')](_0x4f94b1)['json'](_0x564479);}};}function respondWithFilteredResult(_0x378d68,_0x53322a){return function(_0x1f96d5){if(_0x1f96d5){var _0x47e8f3=_0x1f96d5[_0x8cfd('0x1b')],_0x4c0274=_0x53322a['offset'],_0x91e4b1=_0x53322a['offset']+_0x53322a['limit'],_0x6b7848;if(_0x91e4b1>=_0x47e8f3){_0x91e4b1=_0x47e8f3;_0x6b7848=0xc8;}else{_0x6b7848=0xce;}_0x378d68['status'](_0x6b7848);return _0x378d68[_0x8cfd('0x1c')](_0x8cfd('0x1d'),_0x4c0274+'-'+_0x91e4b1+'/'+_0x47e8f3)[_0x8cfd('0x1e')](_0x1f96d5);}return null;};}function patchUpdates(_0x4971fb){return function(_0x454cfc){try{jsonpatch[_0x8cfd('0x1f')](_0x454cfc,_0x4971fb,!![]);}catch(_0x5684c6){return BPromise[_0x8cfd('0x20')](_0x5684c6);}return _0x454cfc[_0x8cfd('0x21')]();};}function saveUpdates(_0x4f190c,_0x4920d0){return function(_0x4325dd){if(_0x4325dd){return _0x4325dd[_0x8cfd('0x22')](_0x4f190c)['then'](function(_0x32a703){return _0x32a703;});}return null;};}function removeEntity(_0x1b0dbc,_0x3127fa){return function(_0x3fa5bd){if(_0x3fa5bd){return _0x3fa5bd['destroy']()[_0x8cfd('0x23')](function(){_0x1b0dbc[_0x8cfd('0x19')](0xcc)[_0x8cfd('0x1a')]();});}};}function handleEntityNotFound(_0x46f332,_0x575e11){return function(_0x3aba88){if(!_0x3aba88){_0x46f332[_0x8cfd('0x18')](0x194);}return _0x3aba88;};}function handleError(_0x472cfc,_0x302344){_0x302344=_0x302344||0x1f4;return function(_0x148117){logger[_0x8cfd('0x24')](_0x148117['stack']);if(_0x148117['name']){delete _0x148117[_0x8cfd('0x25')];}_0x472cfc[_0x8cfd('0x19')](_0x302344)[_0x8cfd('0x26')](_0x148117);};}exports[_0x8cfd('0x27')]=function(_0x17df8f,_0x493e9e){var _0x116c53={},_0x8d6cfb={},_0x11cf92={'count':0x0,'rows':[]};var _0x3b1b08=_[_0x8cfd('0x28')](db[_0x8cfd('0x29')][_0x8cfd('0x2a')],function(_0x4b3687){return{'name':_0x4b3687[_0x8cfd('0x2b')],'type':_0x4b3687[_0x8cfd('0x2c')][_0x8cfd('0x2d')]};});_0x8d6cfb[_0x8cfd('0x2e')]=_[_0x8cfd('0x28')](_0x3b1b08,'name');_0x8d6cfb[_0x8cfd('0x2f')]=_[_0x8cfd('0x30')](_0x17df8f['query']);_0x8d6cfb[_0x8cfd('0x31')]=_[_0x8cfd('0x32')](_0x8d6cfb[_0x8cfd('0x2e')],_0x8d6cfb[_0x8cfd('0x2f')]);_0x116c53[_0x8cfd('0x33')]=_['intersection'](_0x8d6cfb['model'],qs[_0x8cfd('0x34')](_0x17df8f[_0x8cfd('0x2f')][_0x8cfd('0x34')]));_0x116c53['attributes']=_0x116c53[_0x8cfd('0x33')][_0x8cfd('0x35')]?_0x116c53[_0x8cfd('0x33')]:_0x8d6cfb[_0x8cfd('0x2e')];if(!_0x17df8f['query'][_0x8cfd('0x36')](_0x8cfd('0x37'))){_0x116c53[_0x8cfd('0x38')]=qs[_0x8cfd('0x38')](_0x17df8f[_0x8cfd('0x2f')][_0x8cfd('0x38')]);_0x116c53[_0x8cfd('0x39')]=qs['offset'](_0x17df8f[_0x8cfd('0x2f')][_0x8cfd('0x39')]);}_0x116c53['order']=qs[_0x8cfd('0x3a')](_0x17df8f['query']['sort']);_0x116c53[_0x8cfd('0x3b')]=qs[_0x8cfd('0x31')](_[_0x8cfd('0x3c')](_0x17df8f['query'],_0x8d6cfb[_0x8cfd('0x31')]));if(_0x17df8f[_0x8cfd('0x2f')]['filter']){_0x116c53['where']=_[_0x8cfd('0x3d')](_0x116c53[_0x8cfd('0x3b')],{'$or':_[_0x8cfd('0x28')](_0x3b1b08,function(_0x45bc04){if(_0x45bc04['type']!==_0x8cfd('0x3e')){var _0x983169={};_0x983169[_0x45bc04[_0x8cfd('0x25')]]={'$like':'%'+_0x17df8f['query'][_0x8cfd('0x3f')]+'%'};return _0x983169;}})});}_0x116c53=_[_0x8cfd('0x3d')]({},_0x116c53,_0x17df8f[_0x8cfd('0x40')]);var _0x2c87bc={'where':_0x116c53['where']};return db[_0x8cfd('0x29')]['count'](_0x2c87bc)[_0x8cfd('0x23')](function(_0x24aace){_0x11cf92[_0x8cfd('0x1b')]=_0x24aace;if(_0x17df8f[_0x8cfd('0x2f')][_0x8cfd('0x41')]){_0x116c53[_0x8cfd('0x42')]=[{'all':!![]}];}return db[_0x8cfd('0x29')][_0x8cfd('0x43')](_0x116c53);})[_0x8cfd('0x23')](function(_0x49ba53){_0x11cf92[_0x8cfd('0x44')]=_0x49ba53;return _0x11cf92;})[_0x8cfd('0x23')](respondWithFilteredResult(_0x493e9e,_0x116c53))['catch'](handleError(_0x493e9e,null));};exports[_0x8cfd('0x45')]=function(_0x1680af,_0x453e7b){var _0x45cee3={'raw':!![],'where':{'id':_0x1680af[_0x8cfd('0x46')]['id']}},_0x1916e6={};_0x1916e6[_0x8cfd('0x2e')]=_[_0x8cfd('0x30')](db[_0x8cfd('0x29')][_0x8cfd('0x2a')]);_0x1916e6[_0x8cfd('0x2f')]=_[_0x8cfd('0x30')](_0x1680af[_0x8cfd('0x2f')]);_0x1916e6[_0x8cfd('0x31')]=_['intersection'](_0x1916e6[_0x8cfd('0x2e')],_0x1916e6[_0x8cfd('0x2f')]);_0x45cee3[_0x8cfd('0x33')]=_[_0x8cfd('0x32')](_0x1916e6[_0x8cfd('0x2e')],qs[_0x8cfd('0x34')](_0x1680af[_0x8cfd('0x2f')][_0x8cfd('0x34')]));_0x45cee3[_0x8cfd('0x33')]=_0x45cee3[_0x8cfd('0x33')][_0x8cfd('0x35')]?_0x45cee3[_0x8cfd('0x33')]:_0x1916e6[_0x8cfd('0x2e')];if(_0x1680af[_0x8cfd('0x2f')][_0x8cfd('0x41')]){_0x45cee3[_0x8cfd('0x42')]=[{'all':!![]}];}_0x45cee3=_[_0x8cfd('0x3d')]({},_0x45cee3,_0x1680af[_0x8cfd('0x40')]);return db[_0x8cfd('0x29')][_0x8cfd('0x47')](_0x45cee3)[_0x8cfd('0x23')](handleEntityNotFound(_0x453e7b,null))[_0x8cfd('0x23')](respondWithResult(_0x453e7b,null))['catch'](handleError(_0x453e7b,null));};exports[_0x8cfd('0x48')]=function(_0x13e16e,_0x5f0541){return db[_0x8cfd('0x29')]['create'](_0x13e16e[_0x8cfd('0x49')],{})[_0x8cfd('0x23')](respondWithResult(_0x5f0541,0xc9))[_0x8cfd('0x4a')](handleError(_0x5f0541,null));};exports[_0x8cfd('0x22')]=function(_0x10453e,_0x55b8dc){if(_0x10453e[_0x8cfd('0x49')]['id']){delete _0x10453e[_0x8cfd('0x49')]['id'];}return db[_0x8cfd('0x29')]['find']({'where':{'id':_0x10453e[_0x8cfd('0x46')]['id']}})[_0x8cfd('0x23')](handleEntityNotFound(_0x55b8dc,null))[_0x8cfd('0x23')](saveUpdates(_0x10453e['body'],null))[_0x8cfd('0x23')](respondWithResult(_0x55b8dc,null))['catch'](handleError(_0x55b8dc,null));};exports[_0x8cfd('0x4b')]=function(_0x14bbd3,_0x51a772){return db['VtigerField'][_0x8cfd('0x47')]({'where':{'id':_0x14bbd3[_0x8cfd('0x46')]['id']}})[_0x8cfd('0x23')](handleEntityNotFound(_0x51a772,null))['then'](removeEntity(_0x51a772,null))[_0x8cfd('0x4a')](handleError(_0x51a772,null));}; \ No newline at end of file +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 diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index fc1daae..e6ad0f9 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 _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x1bba3b,_0xfdb164){var _0xe03ada=function(_0x5f2b02){while(--_0x5f2b02){_0x1bba3b['push'](_0x1bba3b['shift']());}};_0xe03ada(++_0xfdb164);}(_0x7a54,0x106));var _0x47a5=function(_0x5ca0ff,_0x110623){_0x5ca0ff=_0x5ca0ff-0x0;var _0x2d8004=_0x7a54[_0x5ca0ff];return _0x2d8004;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x47a5('0xc'),'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(_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 diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 00544b1..596898d 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 _0xc900=['request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc900,0xb3));var _0x0c90=function(_0x2b8cef,_0x453dd2){_0x2b8cef=_0x2b8cef-0x0;var _0x55d141=_0xc900[_0x2b8cef];return _0x55d141;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0c90('0x0'));var BPromise=require(_0x0c90('0x1'));var rs=require(_0x0c90('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0c90('0x3'))['db'];var utils=require(_0x0c90('0x4'));var logger=require('../../config/logger')(_0x0c90('0x5'));var config=require(_0x0c90('0x6'));var jayson=require(_0x0c90('0x7'));var client=jayson[_0x0c90('0x8')][_0x0c90('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x302ab1,_0x5b1a5c,_0x24e5be){return new BPromise(function(_0x1c1996,_0x23daed){return client[_0x0c90('0xa')](_0x302ab1,_0x24e5be)[_0x0c90('0xb')](function(_0x3d0f49){logger[_0x0c90('0xc')](_0x0c90('0xd'),_0x5b1a5c,_0x0c90('0xe'));logger[_0x0c90('0xf')](_0x0c90('0x10'),_0x5b1a5c,_0x0c90('0xe'),JSON[_0x0c90('0x11')](_0x3d0f49));if(_0x3d0f49['error']){if(_0x3d0f49[_0x0c90('0x12')]['code']===0x1f4){logger[_0x0c90('0x12')]('VtigerField,\x20%s,\x20%s',_0x5b1a5c,_0x3d0f49[_0x0c90('0x12')][_0x0c90('0x13')]);return _0x23daed(_0x3d0f49[_0x0c90('0x12')][_0x0c90('0x13')]);}logger[_0x0c90('0x12')]('VtigerField,\x20%s,\x20%s',_0x5b1a5c,_0x3d0f49[_0x0c90('0x12')][_0x0c90('0x13')]);return _0x1c1996(_0x3d0f49['error'][_0x0c90('0x13')]);}else{logger[_0x0c90('0xc')](_0x0c90('0xd'),_0x5b1a5c,'request\x20sent');_0x1c1996(_0x3d0f49['result'][_0x0c90('0x13')]);}})[_0x0c90('0x14')](function(_0x2b8135){logger[_0x0c90('0x12')](_0x0c90('0xd'),_0x5b1a5c,_0x2b8135);_0x23daed(_0x2b8135);});});} \ No newline at end of file +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 diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 33ed3c1..f3d25f0 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 _0x4792=['get','index','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','create','addConfiguration','/:id','update','delete','destroy','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller'];(function(_0x35f3e9,_0x451ce5){var _0x1f1b1c=function(_0x19b32){while(--_0x19b32){_0x35f3e9['push'](_0x35f3e9['shift']());}};_0x1f1b1c(++_0x451ce5);}(_0x4792,0x70));var _0x2479=function(_0x58db4e,_0x439d8d){_0x58db4e=_0x58db4e-0x0;var _0x40139a=_0x4792[_0x58db4e];return _0x40139a;};'use strict';var multer=require('multer');var util=require(_0x2479('0x0'));var path=require(_0x2479('0x1'));var timeout=require('connect-timeout');var express=require(_0x2479('0x2'));var router=express[_0x2479('0x3')]();var auth=require(_0x2479('0x4'));var interaction=require(_0x2479('0x5'));var config=require(_0x2479('0x6'));var controller=require(_0x2479('0x7'));router[_0x2479('0x8')]('/',auth['isAuthenticated'](),controller[_0x2479('0x9')]);router[_0x2479('0x8')]('/:id',auth[_0x2479('0xa')](),controller['show']);router[_0x2479('0x8')](_0x2479('0xb'),auth[_0x2479('0xa')](),controller[_0x2479('0xc')]);router[_0x2479('0x8')](_0x2479('0xd'),auth[_0x2479('0xa')](),controller['getFields']);router['post']('/',auth[_0x2479('0xa')](),controller[_0x2479('0xe')]);router['post'](_0x2479('0xb'),auth[_0x2479('0xa')](),controller[_0x2479('0xf')]);router['put'](_0x2479('0x10'),auth['isAuthenticated'](),controller[_0x2479('0x11')]);router[_0x2479('0x12')](_0x2479('0x10'),auth[_0x2479('0xa')](),controller[_0x2479('0x13')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 5ded620..8d8dc88 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 _0x79df=['STRING','username','remoteUri','ENUM','password','token','integrationTab','newTab','sequelize','exports'];(function(_0x2019b3,_0x377489){var _0x1848b5=function(_0x5ee400){while(--_0x5ee400){_0x2019b3['push'](_0x2019b3['shift']());}};_0x1848b5(++_0x377489);}(_0x79df,0xee));var _0xf79d=function(_0x31f68f,_0x7c3538){_0x31f68f=_0x31f68f-0x0;var _0x49a11b=_0x79df[_0x31f68f];return _0x49a11b;};'use strict';var Sequelize=require(_0xf79d('0x0'));module[_0xf79d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf79d('0x2')]},'username':{'type':Sequelize[_0xf79d('0x2')],'unique':_0xf79d('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xf79d('0x2')]},'remoteUri':{'type':Sequelize[_0xf79d('0x2')],'unique':_0xf79d('0x4')},'authType':{'type':Sequelize[_0xf79d('0x5')](_0xf79d('0x6'),_0xf79d('0x7')),'defaultValue':_0xf79d('0x6')},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf79d('0x5')](_0xf79d('0x8'),_0xf79d('0x9')),'defaultValue':'integrationTab'}}; \ No newline at end of file +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 diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 9cd2594..9592d9e 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 _0x66d4=['GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','username','toString','%s/token:%s','base64','Unknown\x20authentication\x20type','group','assignee','remove','position','system_field_options','custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../components/integrations/configuration','client','http','Sequelize','ValidationError','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','end','json','offset','limit','set','Content-Range','reject','update','destroy','status','name','send','map','ZendeskAccount','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','show','params','rawAttributes','create','body','find','getConfigurations','findOne','filters','hasOwnProperty','Subjects','getSubjects','channel','Descriptions','ZendeskConfiguration','ZendeskField','getFields','password','token','authType','remoteUri','slice','lastIndexOf'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x66d4,0x103));var _0x466d=function(_0x2a5099,_0x329e92){_0x2a5099=_0x2a5099-0x0;var _0x2802f1=_0x66d4[_0x2a5099];return _0x2802f1;};'use strict';var pdf=require(_0x466d('0x0'));var emlformat=require(_0x466d('0x1'));var rimraf=require(_0x466d('0x2'));var zipdir=require(_0x466d('0x3'));var jsonpatch=require(_0x466d('0x4'));var rp=require(_0x466d('0x5'));var moment=require(_0x466d('0x6'));var BPromise=require(_0x466d('0x7'));var Mustache=require(_0x466d('0x8'));var util=require(_0x466d('0x9'));var path=require(_0x466d('0xa'));var sox=require(_0x466d('0xb'));var csv=require('to-csv');var ejs=require(_0x466d('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x466d('0xd'));var crypto=require('crypto');var jsforce=require(_0x466d('0xe'));var deskjs=require(_0x466d('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x466d('0x10'));var qs=require(_0x466d('0x11'));var as=require(_0x466d('0x12'));var hardwareService=require(_0x466d('0x13'));var logger=require('../../config/logger')(_0x466d('0x14'));var utils=require('../../config/utils');var config=require(_0x466d('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0x466d('0x16'));var jayson=require('jayson/promise');var client=jayson[_0x466d('0x17')][_0x466d('0x18')]({'port':0x232a});function checkPasswordPattern(_0x4f8c45,_0x5740c8,_0x1cc114){if(_0x1cc114){var _0x117be8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x117be8['test'](_0x5740c8)){return _0x4f8c45;}else{throw new db[(_0x466d('0x19'))][(_0x466d('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 _0x4f8c45;}}function respondWithRpcPromise(_0x5953ac,_0x15171d,_0x34034c,_0x434979){return new BPromise(function(_0x847216,_0x32e3d5){var _0x3a2c7c=_0x434979||client;return _0x3a2c7c[_0x466d('0x1b')](_0x5953ac,_0x34034c)[_0x466d('0x1c')](function(_0x18906e){logger[_0x466d('0x1d')](_0x466d('0x1e'),_0x15171d,_0x466d('0x1f'));logger[_0x466d('0x20')](_0x466d('0x21'),_0x15171d,'request\x20sent',JSON[_0x466d('0x22')](_0x18906e));if(_0x18906e['error']){if(_0x18906e[_0x466d('0x23')]['code']===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x15171d,_0x18906e[_0x466d('0x23')][_0x466d('0x24')]);return _0x32e3d5(_0x18906e[_0x466d('0x23')][_0x466d('0x24')]);}logger[_0x466d('0x23')](_0x466d('0x1e'),_0x15171d,_0x18906e[_0x466d('0x23')][_0x466d('0x24')]);return _0x847216(_0x18906e[_0x466d('0x23')][_0x466d('0x24')]);}else{logger[_0x466d('0x1d')]('ZendeskAccount,\x20%s,\x20%s',_0x15171d,_0x466d('0x1f'));_0x847216(_0x18906e['result'][_0x466d('0x24')]);}})[_0x466d('0x25')](function(_0x277535){logger[_0x466d('0x23')]('ZendeskAccount,\x20%s,\x20%s',_0x15171d,_0x277535);_0x32e3d5(_0x277535);});});}function respondWithStatusCode(_0x1d0ef0,_0x371058){_0x371058=_0x371058||0xcc;return function(_0x3fbc7f){if(_0x3fbc7f){return _0x1d0ef0[_0x466d('0x26')](_0x371058);}return _0x1d0ef0['status'](_0x371058)[_0x466d('0x27')]();};}function respondWithResult(_0x58d7a9,_0x3e18f9){_0x3e18f9=_0x3e18f9||0xc8;return function(_0x51ae30){if(_0x51ae30){return _0x58d7a9['status'](_0x3e18f9)[_0x466d('0x28')](_0x51ae30);}};}function respondWithFilteredResult(_0x15a120,_0x2d88a2){return function(_0x24b11a){if(_0x24b11a){var _0x1ad36b=_0x24b11a['count'],_0x14a4b9=_0x2d88a2[_0x466d('0x29')],_0x1e5263=_0x2d88a2['offset']+_0x2d88a2[_0x466d('0x2a')],_0xbe453a;if(_0x1e5263>=_0x1ad36b){_0x1e5263=_0x1ad36b;_0xbe453a=0xc8;}else{_0xbe453a=0xce;}_0x15a120['status'](_0xbe453a);return _0x15a120[_0x466d('0x2b')](_0x466d('0x2c'),_0x14a4b9+'-'+_0x1e5263+'/'+_0x1ad36b)['json'](_0x24b11a);}return null;};}function patchUpdates(_0x4b0c0b){return function(_0x4ac93a){try{jsonpatch['apply'](_0x4ac93a,_0x4b0c0b,!![]);}catch(_0x3f1816){return BPromise[_0x466d('0x2d')](_0x3f1816);}return _0x4ac93a['save']();};}function saveUpdates(_0x4cd11e,_0xc09e5){return function(_0x41a3cd){if(_0x41a3cd){return _0x41a3cd[_0x466d('0x2e')](_0x4cd11e)[_0x466d('0x1c')](function(_0x22f0b2){return _0x22f0b2;});}return null;};}function removeEntity(_0xad2acb,_0x2ab25b){return function(_0x42fb70){if(_0x42fb70){return _0x42fb70[_0x466d('0x2f')]()[_0x466d('0x1c')](function(){_0xad2acb[_0x466d('0x30')](0xcc)[_0x466d('0x27')]();});}};}function handleEntityNotFound(_0x3c976d,_0x50b5db){return function(_0x5009fb){if(!_0x5009fb){_0x3c976d['sendStatus'](0x194);}return _0x5009fb;};}function handleError(_0x1c2b96,_0xed4273){_0xed4273=_0xed4273||0x1f4;return function(_0x109036){logger['error'](_0x109036['stack']);if(_0x109036[_0x466d('0x31')]){delete _0x109036[_0x466d('0x31')];}_0x1c2b96[_0x466d('0x30')](_0xed4273)[_0x466d('0x32')](_0x109036);};}exports['index']=function(_0x45d14b,_0x384f53){var _0x2b896f={},_0x216140={},_0x45f1dc={'count':0x0,'rows':[]};var _0x53555d=_[_0x466d('0x33')](db[_0x466d('0x34')]['rawAttributes'],function(_0x1200af){return{'name':_0x1200af[_0x466d('0x35')],'type':_0x1200af[_0x466d('0x36')][_0x466d('0x37')]};});_0x216140[_0x466d('0x38')]=_[_0x466d('0x33')](_0x53555d,_0x466d('0x31'));_0x216140[_0x466d('0x39')]=_[_0x466d('0x3a')](_0x45d14b[_0x466d('0x39')]);_0x216140['filters']=_[_0x466d('0x3b')](_0x216140[_0x466d('0x38')],_0x216140[_0x466d('0x39')]);_0x2b896f[_0x466d('0x3c')]=_[_0x466d('0x3b')](_0x216140[_0x466d('0x38')],qs[_0x466d('0x3d')](_0x45d14b[_0x466d('0x39')][_0x466d('0x3d')]));_0x2b896f[_0x466d('0x3c')]=_0x2b896f[_0x466d('0x3c')][_0x466d('0x3e')]?_0x2b896f[_0x466d('0x3c')]:_0x216140[_0x466d('0x38')];if(!_0x45d14b[_0x466d('0x39')]['hasOwnProperty'](_0x466d('0x3f'))){_0x2b896f[_0x466d('0x2a')]=qs['limit'](_0x45d14b[_0x466d('0x39')][_0x466d('0x2a')]);_0x2b896f[_0x466d('0x29')]=qs[_0x466d('0x29')](_0x45d14b['query'][_0x466d('0x29')]);}_0x2b896f[_0x466d('0x40')]=qs[_0x466d('0x41')](_0x45d14b[_0x466d('0x39')][_0x466d('0x41')]);_0x2b896f[_0x466d('0x42')]=qs['filters'](_[_0x466d('0x43')](_0x45d14b[_0x466d('0x39')],_0x216140['filters']));if(_0x45d14b['query'][_0x466d('0x44')]){_0x2b896f[_0x466d('0x42')]=_[_0x466d('0x45')](_0x2b896f[_0x466d('0x42')],{'$or':_[_0x466d('0x33')](_0x53555d,function(_0x17bd23){if(_0x17bd23[_0x466d('0x36')]!==_0x466d('0x46')){var _0x30d907={};_0x30d907[_0x17bd23['name']]={'$like':'%'+_0x45d14b[_0x466d('0x39')][_0x466d('0x44')]+'%'};return _0x30d907;}})});}_0x2b896f=_['merge']({},_0x2b896f,_0x45d14b[_0x466d('0x47')]);var _0x5a4ea6={'where':_0x2b896f[_0x466d('0x42')]};return db['ZendeskAccount'][_0x466d('0x48')](_0x5a4ea6)[_0x466d('0x1c')](function(_0x141b21){_0x45f1dc[_0x466d('0x48')]=_0x141b21;if(_0x45d14b['query'][_0x466d('0x49')]){_0x2b896f[_0x466d('0x4a')]=[{'all':!![]}];}return db['ZendeskAccount']['findAll'](_0x2b896f);})[_0x466d('0x1c')](function(_0x20585d){_0x45f1dc['rows']=_0x20585d;return _0x45f1dc;})[_0x466d('0x1c')](respondWithFilteredResult(_0x384f53,_0x2b896f))[_0x466d('0x25')](handleError(_0x384f53,null));};exports[_0x466d('0x4b')]=function(_0xd8a693,_0x1aa4d5){var _0x5976c7={'raw':![],'where':{'id':_0xd8a693[_0x466d('0x4c')]['id']}},_0x96587e={};_0x96587e[_0x466d('0x38')]=_[_0x466d('0x3a')](db[_0x466d('0x34')][_0x466d('0x4d')]);_0x96587e[_0x466d('0x39')]=_['keys'](_0xd8a693[_0x466d('0x39')]);_0x96587e['filters']=_[_0x466d('0x3b')](_0x96587e[_0x466d('0x38')],_0x96587e[_0x466d('0x39')]);_0x5976c7[_0x466d('0x3c')]=_[_0x466d('0x3b')](_0x96587e[_0x466d('0x38')],qs[_0x466d('0x3d')](_0xd8a693[_0x466d('0x39')][_0x466d('0x3d')]));_0x5976c7[_0x466d('0x3c')]=_0x5976c7[_0x466d('0x3c')]['length']?_0x5976c7[_0x466d('0x3c')]:_0x96587e[_0x466d('0x38')];if(_0xd8a693[_0x466d('0x39')][_0x466d('0x49')]){_0x5976c7['include']=[{'all':!![]}];}_0x5976c7=_[_0x466d('0x45')]({},_0x5976c7,_0xd8a693[_0x466d('0x47')]);return db[_0x466d('0x34')]['find'](_0x5976c7)[_0x466d('0x1c')](handleEntityNotFound(_0x1aa4d5,null))[_0x466d('0x1c')](respondWithResult(_0x1aa4d5,null))['catch'](handleError(_0x1aa4d5,null));};exports['create']=function(_0x3023ac,_0x1509f8){return db[_0x466d('0x34')][_0x466d('0x4e')](_0x3023ac[_0x466d('0x4f')],{})[_0x466d('0x1c')](respondWithResult(_0x1509f8,0xc9))[_0x466d('0x25')](handleError(_0x1509f8,null));};exports[_0x466d('0x2e')]=function(_0x579509,_0x40bba6){if(_0x579509['body']['id']){delete _0x579509[_0x466d('0x4f')]['id'];}return db[_0x466d('0x34')]['find']({'where':{'id':_0x579509[_0x466d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x40bba6,null))['then'](saveUpdates(_0x579509[_0x466d('0x4f')],null))['then'](respondWithResult(_0x40bba6,null))[_0x466d('0x25')](handleError(_0x40bba6,null));};exports['destroy']=function(_0x49ae38,_0x4a7627){return db[_0x466d('0x34')][_0x466d('0x50')]({'where':{'id':_0x49ae38[_0x466d('0x4c')]['id']}})[_0x466d('0x1c')](handleEntityNotFound(_0x4a7627,null))[_0x466d('0x1c')](removeEntity(_0x4a7627,null))[_0x466d('0x25')](handleError(_0x4a7627,null));};exports[_0x466d('0x51')]=function(_0x57af2e,_0x57840f,_0x505d0c){var _0x394d26={};var _0x447c49={};var _0x5a962e;var _0x1e10a3;return db['ZendeskAccount'][_0x466d('0x52')]({'where':{'id':_0x57af2e[_0x466d('0x4c')]['id']}})[_0x466d('0x1c')](handleEntityNotFound(_0x57840f,null))[_0x466d('0x1c')](function(_0x2cf7d9){if(_0x2cf7d9){_0x5a962e=_0x2cf7d9;_0x447c49[_0x466d('0x38')]=_[_0x466d('0x3a')](db['ZendeskConfiguration'][_0x466d('0x4d')]);_0x447c49[_0x466d('0x39')]=_['keys'](_0x57af2e[_0x466d('0x39')]);_0x447c49[_0x466d('0x53')]=_[_0x466d('0x3b')](_0x447c49[_0x466d('0x38')],_0x447c49[_0x466d('0x39')]);_0x394d26[_0x466d('0x3c')]=_[_0x466d('0x3b')](_0x447c49['model'],qs[_0x466d('0x3d')](_0x57af2e[_0x466d('0x39')][_0x466d('0x3d')]));_0x394d26[_0x466d('0x3c')]=_0x394d26[_0x466d('0x3c')]['length']?_0x394d26[_0x466d('0x3c')]:_0x447c49['model'];_0x394d26[_0x466d('0x40')]=qs[_0x466d('0x41')](_0x57af2e[_0x466d('0x39')][_0x466d('0x41')]);_0x394d26[_0x466d('0x42')]=qs[_0x466d('0x53')](_[_0x466d('0x43')](_0x57af2e[_0x466d('0x39')],_0x447c49[_0x466d('0x53')]));if(_0x57af2e[_0x466d('0x39')][_0x466d('0x44')]){_0x394d26[_0x466d('0x42')]=_[_0x466d('0x45')](_0x394d26[_0x466d('0x42')],{'$or':_[_0x466d('0x33')](_0x394d26[_0x466d('0x3c')],function(_0x38b59a){var _0x53d176={};_0x53d176[_0x38b59a]={'$like':'%'+_0x57af2e[_0x466d('0x39')][_0x466d('0x44')]+'%'};return _0x53d176;})});}_0x394d26=_['merge']({},_0x394d26,_0x57af2e[_0x466d('0x47')]);return _0x5a962e['getConfigurations'](_0x394d26);}})[_0x466d('0x1c')](function(_0x2fe94b){if(_0x2fe94b){_0x1e10a3=_0x2fe94b[_0x466d('0x3e')];if(!_0x57af2e[_0x466d('0x39')][_0x466d('0x54')](_0x466d('0x3f'))){_0x394d26['limit']=qs[_0x466d('0x2a')](_0x57af2e[_0x466d('0x39')][_0x466d('0x2a')]);_0x394d26['offset']=qs['offset'](_0x57af2e[_0x466d('0x39')][_0x466d('0x29')]);}return _0x5a962e[_0x466d('0x51')](_0x394d26);}})[_0x466d('0x1c')](function(_0x483192){if(_0x483192){return _0x483192?{'count':_0x1e10a3,'rows':_0x483192}:null;}})[_0x466d('0x1c')](respondWithResult(_0x57840f,null))[_0x466d('0x25')](handleError(_0x57840f,null));};exports['addConfiguration']=function(_0x232244,_0x187968,_0x3530d7){if(_0x232244['body']['id']){delete _0x232244[_0x466d('0x4f')]['id'];}return db[_0x466d('0x34')]['findOne']({'where':{'id':_0x232244[_0x466d('0x4c')]['id']}})[_0x466d('0x1c')](handleEntityNotFound(_0x187968,null))[_0x466d('0x1c')](function(_0x2fa4c0){if(_0x2fa4c0){_0x232244['body']['AccountId']=_0x2fa4c0['id'];_0x232244[_0x466d('0x4f')][_0x466d('0x55')]=integrations[_0x466d('0x56')](_0x232244['body'][_0x466d('0x57')],_0x232244[_0x466d('0x4f')][_0x466d('0x36')]);_0x232244[_0x466d('0x4f')][_0x466d('0x58')]=integrations['getDescriptions'](_0x232244['body'][_0x466d('0x57')],_0x232244[_0x466d('0x4f')]['type']);return db[_0x466d('0x59')]['create'](_0x232244[_0x466d('0x4f')],{'include':[{'model':db[_0x466d('0x5a')],'as':_0x466d('0x55')},{'model':db[_0x466d('0x5a')],'as':_0x466d('0x58')}]});}return null;})['then'](respondWithResult(_0x187968,null))['catch'](handleError(_0x187968,null));};exports[_0x466d('0x5b')]=function(_0x24ac10,_0x461a87,_0x7cb12f){var _0x26f050='';return db['ZendeskAccount'][_0x466d('0x52')]({'where':{'id':_0x24ac10[_0x466d('0x4c')]['id']},'attributes':['id','username',_0x466d('0x5c'),_0x466d('0x5d'),_0x466d('0x5e'),_0x466d('0x5f')]})[_0x466d('0x1c')](handleEntityNotFound(_0x461a87,null))[_0x466d('0x1c')](function(_0x3dac1c){if(_0x3dac1c){_0x26f050=_0x3dac1c['remoteUri'];var _0x1fea96=_0x26f050[_0x466d('0x60')](-0x1);if(_0x1fea96==='/'){_0x26f050=_0x26f050['substring'](0x0,_0x26f050[_0x466d('0x61')](_0x1fea96));}var _0x542ca6={'method':_0x466d('0x62'),'uri':util[_0x466d('0x63')](_0x466d('0x64'),_0x26f050,_0x466d('0x65')),'json':!![]};switch(_0x3dac1c['authType']){case _0x466d('0x5c'):_0x542ca6[_0x466d('0x66')]={'Authorization':util[_0x466d('0x63')](_0x466d('0x67'),new Buffer(util['format']('%s:%s',_0x3dac1c[_0x466d('0x68')],_0x3dac1c[_0x466d('0x5c')]))[_0x466d('0x69')]('base64'))};break;case _0x466d('0x5d'):_0x542ca6['headers']={'Authorization':util['format'](_0x466d('0x67'),new Buffer(util['format'](_0x466d('0x6a'),_0x3dac1c['username'],_0x3dac1c[_0x466d('0x5d')]))[_0x466d('0x69')](_0x466d('0x6b')))};break;default:throw new db[(_0x466d('0x19'))][(_0x466d('0x1a'))](_0x466d('0x6c'));}return rp(_0x542ca6);}})[_0x466d('0x1c')](function(_0xc30cc6){if(_0xc30cc6){var _0xd99d0e=['subject','description',_0x466d('0x6d'),_0x466d('0x6e')];_[_0x466d('0x6f')](_0xc30cc6[_0x466d('0x65')],function(_0xb52f99){return _0xd99d0e['includes'](_0xb52f99[_0x466d('0x36')]);});return{'count':_0xc30cc6[_0x466d('0x65')][_0x466d('0x3e')],'rows':_[_0x466d('0x33')](_0xc30cc6[_0x466d('0x65')],function(_0x4ddb71){return{'id':_0x4ddb71['id'],'name':_0x4ddb71['position']>0x7?_0x4ddb71['title']:_0x4ddb71[_0x466d('0x36')],'custom':_0x4ddb71[_0x466d('0x70')]>0x7?!![]:![],'options':_0x4ddb71[_0x466d('0x71')]?_0x4ddb71[_0x466d('0x71')]:_0x4ddb71['custom_field_options']?_0x4ddb71[_0x466d('0x72')]:[]};})};}})[_0x466d('0x1c')](respondWithResult(_0x461a87,null))[_0x466d('0x25')](function(_0x5e0ddd){var _0x64515d=_0x24ac10[_0x466d('0x39')][_0x466d('0x73')]?0x1f4:_0x5e0ddd['statusCode']||0x1f4;logger[_0x466d('0x23')](_0x466d('0x74'),_0x466d('0x5b'),_0x64515d,JSON[_0x466d('0x22')](_0x5e0ddd));delete _0x5e0ddd[_0x466d('0x31')];if(_0x64515d===0x191){_0x64515d=0x190;}_0x461a87[_0x466d('0x30')](_0x64515d)[_0x466d('0x32')](_0x24ac10['query'][_0x466d('0x73')]?{'message':_0x466d('0x75'),'statusCode':_0x5e0ddd[_0x466d('0x76')]}:_0x5e0ddd);});}; \ No newline at end of file +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 diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 6c8e37c..69ec869 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 _0xa9af=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger'];(function(_0x4a0944,_0xa3e559){var _0x5647cf=function(_0x37d602){while(--_0x37d602){_0x4a0944['push'](_0x4a0944['shift']());}};_0x5647cf(++_0xa3e559);}(_0xa9af,0x14d));var _0xfa9a=function(_0x43735a,_0x3df745){_0x43735a=_0x43735a-0x0;var _0x18353c=_0xa9af[_0x43735a];return _0x18353c;};'use strict';var _=require(_0xfa9a('0x0'));var util=require(_0xfa9a('0x1'));var logger=require(_0xfa9a('0x2'))('api');var moment=require(_0xfa9a('0x3'));var BPromise=require(_0xfa9a('0x4'));var rp=require(_0xfa9a('0x5'));var fs=require('fs');var path=require(_0xfa9a('0x6'));var rimraf=require(_0xfa9a('0x7'));var config=require(_0xfa9a('0x8'));var attributes=require(_0xfa9a('0x9'));var integrations=require(_0xfa9a('0xa'));module['exports']=function(_0x5771dd,_0x3faf3f){return _0x5771dd[_0xfa9a('0xb')](_0xfa9a('0xc'),attributes,{'tableName':_0xfa9a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 1c91900..b1419b5 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 _0xcb91=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','include','map','model','then','ShowZendeskAccount','find','where','moment','bluebird','randomstring','ioredis'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x367361,_0x311488){_0x367361=_0x367361-0x0;var _0x195d2d=_0xcb91[_0x367361];return _0x195d2d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});}exports[_0x1cb9('0x14')]=function(_0x23d3a9){var _0x4e1340=this;return new Promise(function(_0x479d43,_0x1b2fa6){return db[_0x1cb9('0x15')][_0x1cb9('0x16')]({'raw':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x18')]===undefined?!![]:![]:!![],'where':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['where']||null:null,'attributes':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options'][_0x1cb9('0x19')]||null:null,'limit':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['limit']||null:null,'include':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x59ebea){return{'model':db[_0x59ebea['model']],'as':_0x59ebea['as'],'attributes':_0x59ebea[_0x1cb9('0x19')],'include':_0x59ebea['include']?_[_0x1cb9('0x1b')](_0x59ebea[_0x1cb9('0x1a')],function(_0x69b4c8){return{'model':db[_0x69b4c8[_0x1cb9('0x1c')]],'as':_0x69b4c8['as'],'attributes':_0x69b4c8[_0x1cb9('0x19')],'include':_0x69b4c8['include']?_[_0x1cb9('0x1b')](_0x69b4c8[_0x1cb9('0x1a')],function(_0x4c8d76){return{'model':db[_0x4c8d76[_0x1cb9('0x1c')]],'as':_0x4c8d76['as'],'attributes':_0x4c8d76[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x1804fd){logger[_0x1cb9('0xa')](_0x1cb9('0x14'),_0x23d3a9);logger[_0x1cb9('0xd')](_0x1cb9('0x14'),_0x23d3a9,JSON[_0x1cb9('0xf')](_0x1804fd));_0x479d43(_0x1804fd);})[_0x1cb9('0x13')](function(_0x48888d){logger[_0x1cb9('0x10')]('GetZendeskAccount',_0x48888d[_0x1cb9('0x12')],_0x23d3a9);_0x1b2fa6(_0x4e1340['error'](0x1f4,_0x48888d[_0x1cb9('0x12')]));});});};exports[_0x1cb9('0x1e')]=function(_0x3cd7f5){var _0x2038aa=this;return new Promise(function(_0x561d89,_0x1c701f){return db['ZendeskAccount'][_0x1cb9('0x1f')]({'raw':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5['options'][_0x1cb9('0x20')]||null:null,'attributes':_0x3cd7f5['options']?_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x19')]||null:null,'include':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['include']?_[_0x1cb9('0x1b')](_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x91a1db){return{'model':db[_0x91a1db[_0x1cb9('0x1c')]],'as':_0x91a1db['as'],'attributes':_0x91a1db[_0x1cb9('0x19')],'include':_0x91a1db[_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x91a1db[_0x1cb9('0x1a')],function(_0x1de287){return{'model':db[_0x1de287[_0x1cb9('0x1c')]],'as':_0x1de287['as'],'attributes':_0x1de287[_0x1cb9('0x19')],'include':_0x1de287[_0x1cb9('0x1a')]?_['map'](_0x1de287['include'],function(_0x299ff8){return{'model':db[_0x299ff8[_0x1cb9('0x1c')]],'as':_0x299ff8['as'],'attributes':_0x299ff8[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x385daa){logger[_0x1cb9('0xa')](_0x1cb9('0x1e'),_0x3cd7f5);logger[_0x1cb9('0xd')]('ShowZendeskAccount',_0x3cd7f5,JSON[_0x1cb9('0xf')](_0x385daa));_0x561d89(_0x385daa);})[_0x1cb9('0x13')](function(_0xefe136){logger['error'](_0x1cb9('0x1e'),_0xefe136['message'],_0x3cd7f5);_0x1c701f(_0x2038aa[_0x1cb9('0x10')](0x1f4,_0xefe136['message']));});});}; \ No newline at end of file +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 diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 4b45b73..d08f142 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 _0xd0c9=['/:id/tags','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','show','getFields','/:id/subjects','/:id/descriptions','getTags','post','create'];(function(_0x3f1710,_0x3877a2){var _0x528458=function(_0x4b5d0f){while(--_0x4b5d0f){_0x3f1710['push'](_0x3f1710['shift']());}};_0x528458(++_0x3877a2);}(_0xd0c9,0x6a));var _0x9d0c=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0xd0c9[_0x4ed520];return _0x4415a6;};'use strict';var multer=require(_0x9d0c('0x0'));var util=require(_0x9d0c('0x1'));var path=require(_0x9d0c('0x2'));var timeout=require(_0x9d0c('0x3'));var express=require(_0x9d0c('0x4'));var router=express[_0x9d0c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x9d0c('0x6'));var config=require(_0x9d0c('0x7'));var controller=require(_0x9d0c('0x8'));router[_0x9d0c('0x9')]('/',auth[_0x9d0c('0xa')](),controller[_0x9d0c('0xb')]);router[_0x9d0c('0x9')]('/:id',auth[_0x9d0c('0xa')](),controller[_0x9d0c('0xc')]);router[_0x9d0c('0x9')]('/:id/fields',auth[_0x9d0c('0xa')](),controller[_0x9d0c('0xd')]);router['get'](_0x9d0c('0xe'),auth[_0x9d0c('0xa')](),controller['getSubjects']);router[_0x9d0c('0x9')](_0x9d0c('0xf'),auth[_0x9d0c('0xa')](),controller['getDescriptions']);router[_0x9d0c('0x9')]('/:id/tags',auth[_0x9d0c('0xa')](),controller[_0x9d0c('0x10')]);router[_0x9d0c('0x11')]('/',auth[_0x9d0c('0xa')](),controller[_0x9d0c('0x12')]);router[_0x9d0c('0x11')](_0x9d0c('0x13'),auth[_0x9d0c('0xa')](),controller['setTags']);router[_0x9d0c('0x14')]('/:id',auth[_0x9d0c('0xa')](),controller[_0x9d0c('0x15')]);router[_0x9d0c('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x9d0c('0x17')]);module[_0x9d0c('0x18')]=router; \ No newline at end of file +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 diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 78a6d8a..d384278 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 _0xd332=['exports','STRING','sequelize'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd332,0x89));var _0x2d33=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0xd332[_0x819464];return _0x49dcc0;};'use strict';var Sequelize=require(_0x2d33('0x0'));module[_0x2d33('0x1')]={'name':{'type':Sequelize[_0x2d33('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +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 diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index c0d2e41..33b057b 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 _0x814b=['filters','pick','merge','type','VIRTUAL','filter','options','ZendeskConfiguration','count','includeAll','include','findAll','rows','show','params','keys','find','body','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','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','error','ZendeskConfiguration,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','offset','Content-Range','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where'];(function(_0x203c2e,_0x2f6408){var _0x30b1d4=function(_0x4c54c6){while(--_0x4c54c6){_0x203c2e['push'](_0x203c2e['shift']());}};_0x30b1d4(++_0x2f6408);}(_0x814b,0x1a2));var _0xb814=function(_0x5ca644,_0x3d2165){_0x5ca644=_0x5ca644-0x0;var _0x5c87a2=_0x814b[_0x5ca644];return _0x5c87a2;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var db=require(_0xb814('0x19'))['db'];var jayson=require(_0xb814('0x1a'));var client=jayson[_0xb814('0x1b')][_0xb814('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x2ce718,_0x3bde14,_0x1438e7){if(_0x1438e7){var _0x41ed7b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x41ed7b[_0xb814('0x1d')](_0x3bde14)){return _0x2ce718;}else{throw new db[(_0xb814('0x1e'))][(_0xb814('0x1f'))](_0xb814('0x20'));}}else{return _0x2ce718;}}function respondWithRpcPromise(_0x17f5bd,_0x39bfcf,_0x303aca,_0x3a71d6){return new BPromise(function(_0x45e0d0,_0x265a83){var _0x125ce2=_0x3a71d6||client;return _0x125ce2[_0xb814('0x21')](_0x17f5bd,_0x303aca)[_0xb814('0x22')](function(_0x48c9df){logger[_0xb814('0x23')]('ZendeskConfiguration,\x20%s,\x20%s',_0x39bfcf,_0xb814('0x24'));logger[_0xb814('0x25')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x39bfcf,'request\x20sent',JSON['stringify'](_0x48c9df));if(_0x48c9df[_0xb814('0x26')]){if(_0x48c9df['error']['code']===0x1f4){logger[_0xb814('0x26')](_0xb814('0x27'),_0x39bfcf,_0x48c9df[_0xb814('0x26')]['message']);return _0x265a83(_0x48c9df[_0xb814('0x26')]['message']);}logger[_0xb814('0x26')](_0xb814('0x27'),_0x39bfcf,_0x48c9df[_0xb814('0x26')][_0xb814('0x28')]);return _0x45e0d0(_0x48c9df[_0xb814('0x26')][_0xb814('0x28')]);}else{logger[_0xb814('0x23')]('ZendeskConfiguration,\x20%s,\x20%s',_0x39bfcf,_0xb814('0x24'));_0x45e0d0(_0x48c9df['result'][_0xb814('0x28')]);}})[_0xb814('0x29')](function(_0x31c7ec){logger[_0xb814('0x26')](_0xb814('0x27'),_0x39bfcf,_0x31c7ec);_0x265a83(_0x31c7ec);});});}function respondWithStatusCode(_0xb9e57d,_0x3d836c){_0x3d836c=_0x3d836c||0xcc;return function(_0x5755ea){if(_0x5755ea){return _0xb9e57d[_0xb814('0x2a')](_0x3d836c);}return _0xb9e57d[_0xb814('0x2b')](_0x3d836c)[_0xb814('0x2c')]();};}function respondWithResult(_0x349394,_0x32ed56){_0x32ed56=_0x32ed56||0xc8;return function(_0x1d5965){if(_0x1d5965){return _0x349394[_0xb814('0x2b')](_0x32ed56)[_0xb814('0x2d')](_0x1d5965);}};}function respondWithFilteredResult(_0x5a6291,_0x271aa8){return function(_0x328a08){if(_0x328a08){var _0x52ed64=_0x328a08['count'],_0x9008b2=_0x271aa8[_0xb814('0x2e')],_0x37d24d=_0x271aa8[_0xb814('0x2e')]+_0x271aa8['limit'],_0x530744;if(_0x37d24d>=_0x52ed64){_0x37d24d=_0x52ed64;_0x530744=0xc8;}else{_0x530744=0xce;}_0x5a6291[_0xb814('0x2b')](_0x530744);return _0x5a6291['set'](_0xb814('0x2f'),_0x9008b2+'-'+_0x37d24d+'/'+_0x52ed64)['json'](_0x328a08);}return null;};}function patchUpdates(_0x4cfc58){return function(_0x419cd9){try{jsonpatch['apply'](_0x419cd9,_0x4cfc58,!![]);}catch(_0x2431e2){return BPromise[_0xb814('0x30')](_0x2431e2);}return _0x419cd9[_0xb814('0x31')]();};}function saveUpdates(_0x599f9f,_0x51d5ae){return function(_0x26d3a9){if(_0x26d3a9){return _0x26d3a9[_0xb814('0x32')](_0x599f9f)['then'](function(_0x2c8943){return _0x2c8943;});}return null;};}function removeEntity(_0xe558d5,_0x692c72){return function(_0x217b7e){if(_0x217b7e){return _0x217b7e[_0xb814('0x33')]()[_0xb814('0x22')](function(){_0xe558d5[_0xb814('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3207ec,_0x2263f6){return function(_0x30de5a){if(!_0x30de5a){_0x3207ec[_0xb814('0x2a')](0x194);}return _0x30de5a;};}function handleError(_0x14100d,_0x4ff31a){_0x4ff31a=_0x4ff31a||0x1f4;return function(_0x16ef82){logger['error'](_0x16ef82[_0xb814('0x34')]);if(_0x16ef82[_0xb814('0x35')]){delete _0x16ef82[_0xb814('0x35')];}_0x14100d['status'](_0x4ff31a)[_0xb814('0x36')](_0x16ef82);};}exports[_0xb814('0x37')]=function(_0x4ea6f8,_0x2fcd92){var _0x2d0e27={},_0x1a8bd0={},_0x1f7cd8={'count':0x0,'rows':[]};var _0xd77d96=_[_0xb814('0x38')](db['ZendeskConfiguration'][_0xb814('0x39')],function(_0x4e4684){return{'name':_0x4e4684[_0xb814('0x3a')],'type':_0x4e4684['type'][_0xb814('0x3b')]};});_0x1a8bd0['model']=_[_0xb814('0x38')](_0xd77d96,_0xb814('0x35'));_0x1a8bd0['query']=_['keys'](_0x4ea6f8['query']);_0x1a8bd0['filters']=_[_0xb814('0x3c')](_0x1a8bd0[_0xb814('0x3d')],_0x1a8bd0[_0xb814('0x3e')]);_0x2d0e27[_0xb814('0x3f')]=_['intersection'](_0x1a8bd0['model'],qs[_0xb814('0x40')](_0x4ea6f8['query'][_0xb814('0x40')]));_0x2d0e27[_0xb814('0x3f')]=_0x2d0e27[_0xb814('0x3f')][_0xb814('0x41')]?_0x2d0e27[_0xb814('0x3f')]:_0x1a8bd0[_0xb814('0x3d')];if(!_0x4ea6f8[_0xb814('0x3e')][_0xb814('0x42')](_0xb814('0x43'))){_0x2d0e27['limit']=qs['limit'](_0x4ea6f8['query'][_0xb814('0x44')]);_0x2d0e27['offset']=qs[_0xb814('0x2e')](_0x4ea6f8['query'][_0xb814('0x2e')]);}_0x2d0e27[_0xb814('0x45')]=qs[_0xb814('0x46')](_0x4ea6f8[_0xb814('0x3e')]['sort']);_0x2d0e27[_0xb814('0x47')]=qs[_0xb814('0x48')](_[_0xb814('0x49')](_0x4ea6f8[_0xb814('0x3e')],_0x1a8bd0[_0xb814('0x48')]));if(_0x4ea6f8[_0xb814('0x3e')]['filter']){_0x2d0e27[_0xb814('0x47')]=_[_0xb814('0x4a')](_0x2d0e27[_0xb814('0x47')],{'$or':_[_0xb814('0x38')](_0xd77d96,function(_0x46408b){if(_0x46408b[_0xb814('0x4b')]!==_0xb814('0x4c')){var _0x519545={};_0x519545[_0x46408b['name']]={'$like':'%'+_0x4ea6f8[_0xb814('0x3e')][_0xb814('0x4d')]+'%'};return _0x519545;}})});}_0x2d0e27=_[_0xb814('0x4a')]({},_0x2d0e27,_0x4ea6f8[_0xb814('0x4e')]);var _0x43f1b={'where':_0x2d0e27[_0xb814('0x47')]};return db[_0xb814('0x4f')][_0xb814('0x50')](_0x43f1b)[_0xb814('0x22')](function(_0x344198){_0x1f7cd8[_0xb814('0x50')]=_0x344198;if(_0x4ea6f8['query'][_0xb814('0x51')]){_0x2d0e27[_0xb814('0x52')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xb814('0x53')](_0x2d0e27);})['then'](function(_0x2fb0f7){_0x1f7cd8[_0xb814('0x54')]=_0x2fb0f7;return _0x1f7cd8;})[_0xb814('0x22')](respondWithFilteredResult(_0x2fcd92,_0x2d0e27))[_0xb814('0x29')](handleError(_0x2fcd92,null));};exports[_0xb814('0x55')]=function(_0x4096d4,_0x2cc806){var _0x45480e={'raw':![],'where':{'id':_0x4096d4[_0xb814('0x56')]['id']}},_0x32a397={};_0x32a397['model']=_['keys'](db[_0xb814('0x4f')][_0xb814('0x39')]);_0x32a397[_0xb814('0x3e')]=_[_0xb814('0x57')](_0x4096d4[_0xb814('0x3e')]);_0x32a397[_0xb814('0x48')]=_[_0xb814('0x3c')](_0x32a397['model'],_0x32a397[_0xb814('0x3e')]);_0x45480e[_0xb814('0x3f')]=_[_0xb814('0x3c')](_0x32a397['model'],qs[_0xb814('0x40')](_0x4096d4['query'][_0xb814('0x40')]));_0x45480e['attributes']=_0x45480e[_0xb814('0x3f')][_0xb814('0x41')]?_0x45480e['attributes']:_0x32a397[_0xb814('0x3d')];if(_0x4096d4[_0xb814('0x3e')][_0xb814('0x51')]){_0x45480e['include']=[{'all':!![]}];}_0x45480e=_[_0xb814('0x4a')]({},_0x45480e,_0x4096d4['options']);return db[_0xb814('0x4f')][_0xb814('0x58')](_0x45480e)['then'](handleEntityNotFound(_0x2cc806,null))[_0xb814('0x22')](respondWithResult(_0x2cc806,null))['catch'](handleError(_0x2cc806,null));};exports['create']=function(_0x3b9709,_0x35f59a){return db[_0xb814('0x4f')]['create'](_0x3b9709[_0xb814('0x59')],{})['then'](respondWithResult(_0x35f59a,0xc9))[_0xb814('0x29')](handleError(_0x35f59a,null));};exports[_0xb814('0x32')]=function(_0x58d6e5,_0x2db5a6){if(_0x58d6e5['body']['id']){delete _0x58d6e5[_0xb814('0x59')]['id'];}return db[_0xb814('0x4f')][_0xb814('0x58')]({'where':{'id':_0x58d6e5[_0xb814('0x56')]['id']}})[_0xb814('0x22')](handleEntityNotFound(_0x2db5a6,null))[_0xb814('0x22')](saveUpdates(_0x58d6e5[_0xb814('0x59')],null))[_0xb814('0x22')](respondWithResult(_0x2db5a6,null))['catch'](handleError(_0x2db5a6,null));};exports[_0xb814('0x33')]=function(_0x5441c5,_0x5d71d5){return db[_0xb814('0x4f')][_0xb814('0x58')]({'where':{'id':_0x5441c5['params']['id']}})[_0xb814('0x22')](handleEntityNotFound(_0x5d71d5,null))['then'](removeEntity(_0x5d71d5,null))['catch'](handleError(_0x5d71d5,null));};exports[_0xb814('0x5a')]=function(_0x5257be,_0x3ff213,_0xd1cd8b){var _0x2dec52={};var _0x586957={};var _0x1a0ef4;var _0x4df65c;return db[_0xb814('0x4f')][_0xb814('0x5b')]({'where':{'id':_0x5257be[_0xb814('0x56')]['id']}})[_0xb814('0x22')](handleEntityNotFound(_0x3ff213,null))[_0xb814('0x22')](function(_0x3b374b){if(_0x3b374b){_0x1a0ef4=_0x3b374b;_0x586957[_0xb814('0x3d')]=_[_0xb814('0x57')](db[_0xb814('0x5c')]['rawAttributes']);_0x586957[_0xb814('0x3e')]=_[_0xb814('0x57')](_0x5257be[_0xb814('0x3e')]);_0x586957[_0xb814('0x48')]=_[_0xb814('0x3c')](_0x586957[_0xb814('0x3d')],_0x586957['query']);_0x2dec52[_0xb814('0x3f')]=_['intersection'](_0x586957[_0xb814('0x3d')],qs[_0xb814('0x40')](_0x5257be[_0xb814('0x3e')]['fields']));_0x2dec52[_0xb814('0x3f')]=_0x2dec52['attributes'][_0xb814('0x41')]?_0x2dec52['attributes']:_0x586957[_0xb814('0x3d')];_0x2dec52[_0xb814('0x45')]=qs[_0xb814('0x46')](_0x5257be[_0xb814('0x3e')][_0xb814('0x46')]);_0x2dec52[_0xb814('0x47')]=qs[_0xb814('0x48')](_['pick'](_0x5257be[_0xb814('0x3e')],_0x586957['filters']));if(_0x5257be[_0xb814('0x3e')][_0xb814('0x4d')]){_0x2dec52[_0xb814('0x47')]=_[_0xb814('0x4a')](_0x2dec52[_0xb814('0x47')],{'$or':_[_0xb814('0x38')](_0x2dec52['attributes'],function(_0x12882a){var _0x1a2603={};_0x1a2603[_0x12882a]={'$like':'%'+_0x5257be['query'][_0xb814('0x4d')]+'%'};return _0x1a2603;})});}_0x2dec52=_[_0xb814('0x4a')]({},_0x2dec52,_0x5257be[_0xb814('0x4e')]);return _0x1a0ef4[_0xb814('0x5a')](_0x2dec52);}})[_0xb814('0x22')](function(_0x51d834){if(_0x51d834){_0x4df65c=_0x51d834[_0xb814('0x41')];if(!_0x5257be['query'][_0xb814('0x42')](_0xb814('0x43'))){_0x2dec52[_0xb814('0x44')]=qs[_0xb814('0x44')](_0x5257be[_0xb814('0x3e')][_0xb814('0x44')]);_0x2dec52['offset']=qs['offset'](_0x5257be['query'][_0xb814('0x2e')]);}return _0x1a0ef4['getFields'](_0x2dec52);}})[_0xb814('0x22')](function(_0x1d3954){if(_0x1d3954){return _0x1d3954?{'count':_0x4df65c,'rows':_0x1d3954}:null;}})[_0xb814('0x22')](respondWithResult(_0x3ff213,null))['catch'](handleError(_0x3ff213,null));};exports[_0xb814('0x5d')]=function(_0x3e5ce8,_0xee204,_0x5aabbe){var _0x30f717={};var _0x1bf0b7={};var _0x1f39c0;var _0x3564e0;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x3e5ce8[_0xb814('0x56')]['id']}})[_0xb814('0x22')](handleEntityNotFound(_0xee204,null))[_0xb814('0x22')](function(_0x408870){if(_0x408870){_0x1f39c0=_0x408870;_0x1bf0b7[_0xb814('0x3d')]=_[_0xb814('0x57')](db[_0xb814('0x5c')][_0xb814('0x39')]);_0x1bf0b7[_0xb814('0x3e')]=_[_0xb814('0x57')](_0x3e5ce8[_0xb814('0x3e')]);_0x1bf0b7[_0xb814('0x48')]=_[_0xb814('0x3c')](_0x1bf0b7[_0xb814('0x3d')],_0x1bf0b7[_0xb814('0x3e')]);_0x30f717['attributes']=_[_0xb814('0x3c')](_0x1bf0b7[_0xb814('0x3d')],qs[_0xb814('0x40')](_0x3e5ce8[_0xb814('0x3e')][_0xb814('0x40')]));_0x30f717[_0xb814('0x3f')]=_0x30f717['attributes'][_0xb814('0x41')]?_0x30f717['attributes']:_0x1bf0b7[_0xb814('0x3d')];_0x30f717[_0xb814('0x45')]=qs[_0xb814('0x46')](_0x3e5ce8[_0xb814('0x3e')][_0xb814('0x46')]);_0x30f717['where']=qs['filters'](_[_0xb814('0x49')](_0x3e5ce8[_0xb814('0x3e')],_0x1bf0b7[_0xb814('0x48')]));if(_0x3e5ce8[_0xb814('0x3e')]['filter']){_0x30f717[_0xb814('0x47')]=_['merge'](_0x30f717[_0xb814('0x47')],{'$or':_[_0xb814('0x38')](_0x30f717['attributes'],function(_0x58b016){var _0x2fa6b7={};_0x2fa6b7[_0x58b016]={'$like':'%'+_0x3e5ce8['query'][_0xb814('0x4d')]+'%'};return _0x2fa6b7;})});}_0x30f717=_[_0xb814('0x4a')]({},_0x30f717,_0x3e5ce8[_0xb814('0x4e')]);return _0x1f39c0[_0xb814('0x5d')](_0x30f717);}})[_0xb814('0x22')](function(_0x420bde){if(_0x420bde){_0x3564e0=_0x420bde[_0xb814('0x41')];if(!_0x3e5ce8['query'][_0xb814('0x42')]('nolimit')){_0x30f717[_0xb814('0x44')]=qs['limit'](_0x3e5ce8[_0xb814('0x3e')][_0xb814('0x44')]);_0x30f717['offset']=qs[_0xb814('0x2e')](_0x3e5ce8['query'][_0xb814('0x2e')]);}return _0x1f39c0[_0xb814('0x5d')](_0x30f717);}})['then'](function(_0x5a0c4a){if(_0x5a0c4a){return _0x5a0c4a?{'count':_0x3564e0,'rows':_0x5a0c4a}:null;}})[_0xb814('0x22')](respondWithResult(_0xee204,null))[_0xb814('0x29')](handleError(_0xee204,null));};exports[_0xb814('0x5e')]=function(_0x6f5e6a,_0x220f8b,_0x4394da){var _0x2b12a9={};var _0x314600={};var _0x8cb107;var _0x34f49c;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x6f5e6a['params']['id']}})['then'](handleEntityNotFound(_0x220f8b,null))['then'](function(_0x45a202){if(_0x45a202){_0x8cb107=_0x45a202;_0x314600[_0xb814('0x3d')]=_[_0xb814('0x57')](db['ZendeskField'][_0xb814('0x39')]);_0x314600[_0xb814('0x3e')]=_[_0xb814('0x57')](_0x6f5e6a[_0xb814('0x3e')]);_0x314600[_0xb814('0x48')]=_[_0xb814('0x3c')](_0x314600[_0xb814('0x3d')],_0x314600[_0xb814('0x3e')]);_0x2b12a9['attributes']=_[_0xb814('0x3c')](_0x314600[_0xb814('0x3d')],qs[_0xb814('0x40')](_0x6f5e6a[_0xb814('0x3e')]['fields']));_0x2b12a9[_0xb814('0x3f')]=_0x2b12a9[_0xb814('0x3f')][_0xb814('0x41')]?_0x2b12a9[_0xb814('0x3f')]:_0x314600[_0xb814('0x3d')];_0x2b12a9['order']=qs['sort'](_0x6f5e6a[_0xb814('0x3e')]['sort']);_0x2b12a9[_0xb814('0x47')]=qs[_0xb814('0x48')](_['pick'](_0x6f5e6a[_0xb814('0x3e')],_0x314600['filters']));if(_0x6f5e6a[_0xb814('0x3e')]['filter']){_0x2b12a9[_0xb814('0x47')]=_[_0xb814('0x4a')](_0x2b12a9[_0xb814('0x47')],{'$or':_[_0xb814('0x38')](_0x2b12a9[_0xb814('0x3f')],function(_0x1ae812){var _0x455b22={};_0x455b22[_0x1ae812]={'$like':'%'+_0x6f5e6a['query']['filter']+'%'};return _0x455b22;})});}_0x2b12a9=_[_0xb814('0x4a')]({},_0x2b12a9,_0x6f5e6a['options']);return _0x8cb107['getDescriptions'](_0x2b12a9);}})[_0xb814('0x22')](function(_0x8fbda1){if(_0x8fbda1){_0x34f49c=_0x8fbda1[_0xb814('0x41')];if(!_0x6f5e6a['query'][_0xb814('0x42')]('nolimit')){_0x2b12a9[_0xb814('0x44')]=qs[_0xb814('0x44')](_0x6f5e6a[_0xb814('0x3e')][_0xb814('0x44')]);_0x2b12a9['offset']=qs[_0xb814('0x2e')](_0x6f5e6a[_0xb814('0x3e')][_0xb814('0x2e')]);}return _0x8cb107['getDescriptions'](_0x2b12a9);}})[_0xb814('0x22')](function(_0x3fc77d){if(_0x3fc77d){return _0x3fc77d?{'count':_0x34f49c,'rows':_0x3fc77d}:null;}})[_0xb814('0x22')](respondWithResult(_0x220f8b,null))['catch'](handleError(_0x220f8b,null));};exports[_0xb814('0x5f')]=function(_0x2d0651,_0x9dc06b,_0x216d67){var _0x40b3c5={};var _0x1ae8e8={};var _0x37a7ab;var _0x472c38;return db[_0xb814('0x4f')][_0xb814('0x5b')]({'where':{'id':_0x2d0651[_0xb814('0x56')]['id']}})[_0xb814('0x22')](handleEntityNotFound(_0x9dc06b,null))[_0xb814('0x22')](function(_0x5b8d2e){if(_0x5b8d2e){_0x37a7ab=_0x5b8d2e;_0x1ae8e8['model']=_[_0xb814('0x57')](db['Tag'][_0xb814('0x39')]);_0x1ae8e8[_0xb814('0x3e')]=_[_0xb814('0x57')](_0x2d0651[_0xb814('0x3e')]);_0x1ae8e8[_0xb814('0x48')]=_[_0xb814('0x3c')](_0x1ae8e8[_0xb814('0x3d')],_0x1ae8e8['query']);_0x40b3c5['attributes']=_[_0xb814('0x3c')](_0x1ae8e8['model'],qs[_0xb814('0x40')](_0x2d0651[_0xb814('0x3e')][_0xb814('0x40')]));_0x40b3c5['attributes']=_0x40b3c5[_0xb814('0x3f')][_0xb814('0x41')]?_0x40b3c5[_0xb814('0x3f')]:_0x1ae8e8[_0xb814('0x3d')];_0x40b3c5[_0xb814('0x45')]=qs['sort'](_0x2d0651[_0xb814('0x3e')][_0xb814('0x46')]);_0x40b3c5['where']=qs[_0xb814('0x48')](_[_0xb814('0x49')](_0x2d0651[_0xb814('0x3e')],_0x1ae8e8['filters']));if(_0x2d0651[_0xb814('0x3e')][_0xb814('0x4d')]){_0x40b3c5['where']=_[_0xb814('0x4a')](_0x40b3c5[_0xb814('0x47')],{'$or':_['map'](_0x40b3c5[_0xb814('0x3f')],function(_0x269832){var _0x3f4cbf={};_0x3f4cbf[_0x269832]={'$like':'%'+_0x2d0651[_0xb814('0x3e')][_0xb814('0x4d')]+'%'};return _0x3f4cbf;})});}_0x40b3c5=_[_0xb814('0x4a')]({},_0x40b3c5,_0x2d0651[_0xb814('0x4e')]);return _0x37a7ab[_0xb814('0x5f')](_0x40b3c5);}})[_0xb814('0x22')](function(_0x1f8c7a){if(_0x1f8c7a){_0x472c38=_0x1f8c7a[_0xb814('0x41')];if(!_0x2d0651[_0xb814('0x3e')]['hasOwnProperty']('nolimit')){_0x40b3c5[_0xb814('0x44')]=qs['limit'](_0x2d0651['query'][_0xb814('0x44')]);_0x40b3c5['offset']=qs['offset'](_0x2d0651['query'][_0xb814('0x2e')]);}return _0x37a7ab[_0xb814('0x5f')](_0x40b3c5);}})[_0xb814('0x22')](function(_0x5eb4b1){if(_0x5eb4b1){return _0x5eb4b1?{'count':_0x472c38,'rows':_0x5eb4b1}:null;}})[_0xb814('0x22')](respondWithResult(_0x9dc06b,null))['catch'](handleError(_0x9dc06b,null));};exports[_0xb814('0x60')]=function(_0x2e6660,_0x49a8de,_0x3c6a59){if(_0x2e6660['body']['id']){delete _0x2e6660[_0xb814('0x59')]['id'];}return db[_0xb814('0x4f')][_0xb814('0x5b')]({'where':{'id':_0x2e6660[_0xb814('0x56')]['id']}})[_0xb814('0x22')](handleEntityNotFound(_0x49a8de,null))[_0xb814('0x22')](function(_0x1f2ef8){if(_0x1f2ef8){return _0x1f2ef8[_0xb814('0x60')](_0x2e6660[_0xb814('0x59')][_0xb814('0x61')]||[]);}return null;})[_0xb814('0x22')](respondWithResult(_0x49a8de,null))[_0xb814('0x29')](handleError(_0x49a8de,null));}; \ No newline at end of file +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 diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 7d39138..6c55d2a 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 _0xe84b=['ZendeskConfiguration','int_zendesk_configurations','lodash','../../config/logger','api','moment','request-promise','../../config/environment','./intZendeskConfiguration.attributes','exports'];(function(_0x54253e,_0x1e8d6b){var _0x4973a8=function(_0x27db2f){while(--_0x27db2f){_0x54253e['push'](_0x54253e['shift']());}};_0x4973a8(++_0x1e8d6b);}(_0xe84b,0x1b0));var _0xbe84=function(_0xc35932,_0x3ea565){_0xc35932=_0xc35932-0x0;var _0x31efda=_0xe84b[_0xc35932];return _0x31efda;};'use strict';var _=require(_0xbe84('0x0'));var util=require('util');var logger=require(_0xbe84('0x1'))(_0xbe84('0x2'));var moment=require(_0xbe84('0x3'));var BPromise=require('bluebird');var rp=require(_0xbe84('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbe84('0x5'));var attributes=require(_0xbe84('0x6'));module[_0xbe84('0x7')]=function(_0x15a0fb,_0x49cc42){return _0x15a0fb['define'](_0xbe84('0x8'),attributes,{'tableName':_0xbe84('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 0ee7df6..79021e5 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 _0xbef7=['catch','util','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZendeskConfiguration,\x20%s,\x20%s','result'];(function(_0x338bf6,_0x48ee36){var _0x2cbeed=function(_0x148346){while(--_0x148346){_0x338bf6['push'](_0x338bf6['shift']());}};_0x2cbeed(++_0x48ee36);}(_0xbef7,0xfd));var _0x7bef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbef7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7bef('0x0'));var moment=require('moment');var BPromise=require(_0x7bef('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7bef('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7bef('0x3'))(_0x7bef('0x4'));var config=require(_0x7bef('0x5'));var jayson=require(_0x7bef('0x6'));var client=jayson[_0x7bef('0x7')][_0x7bef('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xf08bb4,_0x352a3f,_0x26d0cc){return new BPromise(function(_0x125515,_0x202262){return client['request'](_0xf08bb4,_0x26d0cc)[_0x7bef('0x9')](function(_0x1a1992){logger[_0x7bef('0xa')]('ZendeskConfiguration,\x20%s,\x20%s',_0x352a3f,_0x7bef('0xb'));logger[_0x7bef('0xc')](_0x7bef('0xd'),_0x352a3f,_0x7bef('0xb'),JSON[_0x7bef('0xe')](_0x1a1992));if(_0x1a1992[_0x7bef('0xf')]){if(_0x1a1992[_0x7bef('0xf')][_0x7bef('0x10')]===0x1f4){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x352a3f,_0x1a1992[_0x7bef('0xf')][_0x7bef('0x11')]);return _0x202262(_0x1a1992['error']['message']);}logger[_0x7bef('0xf')](_0x7bef('0x12'),_0x352a3f,_0x1a1992[_0x7bef('0xf')][_0x7bef('0x11')]);return _0x125515(_0x1a1992[_0x7bef('0xf')][_0x7bef('0x11')]);}else{logger[_0x7bef('0xa')](_0x7bef('0x12'),_0x352a3f,_0x7bef('0xb'));_0x125515(_0x1a1992[_0x7bef('0x13')][_0x7bef('0x11')]);}})[_0x7bef('0x14')](function(_0x224c63){logger[_0x7bef('0xf')](_0x7bef('0x12'),_0x352a3f,_0x224c63);_0x202262(_0x224c63);});});} \ No newline at end of file +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 diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 8fdbe7d..476d769 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 _0x6b1c=['Router','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b1c,0xf3));var _0xc6b1=function(_0x373e22,_0x7cc6d1){_0x373e22=_0x373e22-0x0;var _0x3e06b5=_0x6b1c[_0x373e22];return _0x3e06b5;};'use strict';var multer=require(_0xc6b1('0x0'));var util=require('util');var path=require(_0xc6b1('0x1'));var timeout=require(_0xc6b1('0x2'));var express=require(_0xc6b1('0x3'));var router=express[_0xc6b1('0x4')]();var auth=require(_0xc6b1('0x5'));var interaction=require(_0xc6b1('0x6'));var config=require('../../config/environment');var controller=require(_0xc6b1('0x7'));router['get']('/',auth[_0xc6b1('0x8')](),controller[_0xc6b1('0x9')]);router['get'](_0xc6b1('0xa'),auth[_0xc6b1('0x8')](),controller[_0xc6b1('0xb')]);router[_0xc6b1('0xc')]('/',auth['isAuthenticated'](),controller[_0xc6b1('0xd')]);router[_0xc6b1('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xc6b1('0xf')]);router[_0xc6b1('0x10')](_0xc6b1('0xa'),auth[_0xc6b1('0x8')](),controller[_0xc6b1('0x11')]);module[_0xc6b1('0x12')]=router; \ No newline at end of file +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 diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index ef8cf8c..2440db6 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 _0x135c=['customVariable','BOOLEAN','sequelize','exports','string','keyValue','STRING','ENUM','variable'];(function(_0x5241b6,_0x3c0043){var _0x27e1cb=function(_0x36c7ba){while(--_0x36c7ba){_0x5241b6['push'](_0x5241b6['shift']());}};_0x27e1cb(++_0x3c0043);}(_0x135c,0xda));var _0xc135=function(_0x226e5f,_0x301fb0){_0x226e5f=_0x226e5f-0x0;var _0x1d8891=_0x135c[_0x226e5f];return _0x1d8891;};'use strict';var Sequelize=require(_0xc135('0x0'));module[_0xc135('0x1')]={'type':{'type':Sequelize['ENUM'](_0xc135('0x2'),'variable','customVariable',_0xc135('0x3')),'defaultValue':_0xc135('0x2')},'content':{'type':Sequelize[_0xc135('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xc135('0x5')](_0xc135('0x2'),_0xc135('0x6'),_0xc135('0x7'))},'keyContent':{'type':Sequelize[_0xc135('0x4')]},'idField':{'type':Sequelize[_0xc135('0x4')]},'nameField':{'type':Sequelize[_0xc135('0x4')]},'customField':{'type':Sequelize[_0xc135('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc135('0x4')]}}; \ No newline at end of file +var _0x8828=['customVariable','keyValue','string','STRING','ENUM','BOOLEAN','sequelize','exports','variable'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x8828,0x1d1));var _0x8882=function(_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 diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 529e58f..dcfbecf 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 _0xd700=['key','map','query','keys','intersection','model','fields','attributes','nolimit','limit','sort','where','filters','pick','filter','merge','VIRTUAL','options','ZendeskField','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','rawAttributes','type'];(function(_0x159ddb,_0x153981){var _0x4d29b8=function(_0x30e1f0){while(--_0x30e1f0){_0x159ddb['push'](_0x159ddb['shift']());}};_0x4d29b8(++_0x153981);}(_0xd700,0x181));var _0x0d70=function(_0x450b2a,_0x174591){_0x450b2a=_0x450b2a-0x0;var _0x37a7ff=_0xd700[_0x450b2a];return _0x37a7ff;};'use strict';var pdf=require(_0x0d70('0x0'));var emlformat=require(_0x0d70('0x1'));var rimraf=require(_0x0d70('0x2'));var zipdir=require(_0x0d70('0x3'));var jsonpatch=require(_0x0d70('0x4'));var rp=require(_0x0d70('0x5'));var moment=require('moment');var BPromise=require(_0x0d70('0x6'));var Mustache=require(_0x0d70('0x7'));var util=require('util');var path=require(_0x0d70('0x8'));var sox=require(_0x0d70('0x9'));var csv=require(_0x0d70('0xa'));var ejs=require(_0x0d70('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0d70('0xc'));var crypto=require(_0x0d70('0xd'));var jsforce=require(_0x0d70('0xe'));var deskjs=require(_0x0d70('0xf'));var toCsv=require(_0x0d70('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0d70('0x10'));var qs=require(_0x0d70('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0d70('0x12'));var logger=require('../../config/logger')(_0x0d70('0x13'));var utils=require(_0x0d70('0x14'));var config=require(_0x0d70('0x15'));var db=require(_0x0d70('0x16'))['db'];function respondWithStatusCode(_0x59a944,_0x1bba2d){_0x1bba2d=_0x1bba2d||0xcc;return function(_0x3a7369){if(_0x3a7369){return _0x59a944[_0x0d70('0x17')](_0x1bba2d);}return _0x59a944[_0x0d70('0x18')](_0x1bba2d)[_0x0d70('0x19')]();};}function respondWithResult(_0x3c4a9a,_0x439cda){_0x439cda=_0x439cda||0xc8;return function(_0x571fdf){if(_0x571fdf){return _0x3c4a9a[_0x0d70('0x18')](_0x439cda)['json'](_0x571fdf);}};}function respondWithFilteredResult(_0x107f41,_0x15af3b){return function(_0x462c4d){if(_0x462c4d){var _0x107284=_0x462c4d[_0x0d70('0x1a')],_0x377a83=_0x15af3b['offset'],_0x5329aa=_0x15af3b[_0x0d70('0x1b')]+_0x15af3b['limit'],_0x5ef1d3;if(_0x5329aa>=_0x107284){_0x5329aa=_0x107284;_0x5ef1d3=0xc8;}else{_0x5ef1d3=0xce;}_0x107f41[_0x0d70('0x18')](_0x5ef1d3);return _0x107f41[_0x0d70('0x1c')](_0x0d70('0x1d'),_0x377a83+'-'+_0x5329aa+'/'+_0x107284)['json'](_0x462c4d);}return null;};}function patchUpdates(_0x2222b2){return function(_0x1e9a7e){try{jsonpatch[_0x0d70('0x1e')](_0x1e9a7e,_0x2222b2,!![]);}catch(_0x193dc7){return BPromise[_0x0d70('0x1f')](_0x193dc7);}return _0x1e9a7e['save']();};}function saveUpdates(_0x274c53,_0x1ccb7e){return function(_0x433b05){if(_0x433b05){return _0x433b05[_0x0d70('0x20')](_0x274c53)[_0x0d70('0x21')](function(_0x356201){return _0x356201;});}return null;};}function removeEntity(_0x27a622,_0x173599){return function(_0xb7363c){if(_0xb7363c){return _0xb7363c['destroy']()[_0x0d70('0x21')](function(){_0x27a622['status'](0xcc)[_0x0d70('0x19')]();});}};}function handleEntityNotFound(_0x12b169,_0x542bd9){return function(_0x1fa39c){if(!_0x1fa39c){_0x12b169[_0x0d70('0x17')](0x194);}return _0x1fa39c;};}function handleError(_0x3deda9,_0x2af2e7){_0x2af2e7=_0x2af2e7||0x1f4;return function(_0x395212){logger[_0x0d70('0x22')](_0x395212[_0x0d70('0x23')]);if(_0x395212['name']){delete _0x395212[_0x0d70('0x24')];}_0x3deda9[_0x0d70('0x18')](_0x2af2e7)[_0x0d70('0x25')](_0x395212);};}exports[_0x0d70('0x26')]=function(_0x5badae,_0x31e322){var _0x1c5669={},_0x3dadae={},_0x527dec={'count':0x0,'rows':[]};var _0x461f65=_['map'](db['ZendeskField'][_0x0d70('0x27')],function(_0x6e9cdf){return{'name':_0x6e9cdf['fieldName'],'type':_0x6e9cdf[_0x0d70('0x28')][_0x0d70('0x29')]};});_0x3dadae['model']=_[_0x0d70('0x2a')](_0x461f65,_0x0d70('0x24'));_0x3dadae[_0x0d70('0x2b')]=_[_0x0d70('0x2c')](_0x5badae['query']);_0x3dadae['filters']=_[_0x0d70('0x2d')](_0x3dadae[_0x0d70('0x2e')],_0x3dadae[_0x0d70('0x2b')]);_0x1c5669['attributes']=_[_0x0d70('0x2d')](_0x3dadae[_0x0d70('0x2e')],qs['fields'](_0x5badae[_0x0d70('0x2b')][_0x0d70('0x2f')]));_0x1c5669[_0x0d70('0x30')]=_0x1c5669[_0x0d70('0x30')]['length']?_0x1c5669[_0x0d70('0x30')]:_0x3dadae[_0x0d70('0x2e')];if(!_0x5badae['query']['hasOwnProperty'](_0x0d70('0x31'))){_0x1c5669[_0x0d70('0x32')]=qs[_0x0d70('0x32')](_0x5badae[_0x0d70('0x2b')][_0x0d70('0x32')]);_0x1c5669[_0x0d70('0x1b')]=qs[_0x0d70('0x1b')](_0x5badae[_0x0d70('0x2b')][_0x0d70('0x1b')]);}_0x1c5669['order']=qs[_0x0d70('0x33')](_0x5badae[_0x0d70('0x2b')][_0x0d70('0x33')]);_0x1c5669[_0x0d70('0x34')]=qs[_0x0d70('0x35')](_[_0x0d70('0x36')](_0x5badae[_0x0d70('0x2b')],_0x3dadae['filters']));if(_0x5badae[_0x0d70('0x2b')][_0x0d70('0x37')]){_0x1c5669[_0x0d70('0x34')]=_[_0x0d70('0x38')](_0x1c5669[_0x0d70('0x34')],{'$or':_[_0x0d70('0x2a')](_0x461f65,function(_0x34d19a){if(_0x34d19a['type']!==_0x0d70('0x39')){var _0x2fc2d4={};_0x2fc2d4[_0x34d19a[_0x0d70('0x24')]]={'$like':'%'+_0x5badae[_0x0d70('0x2b')][_0x0d70('0x37')]+'%'};return _0x2fc2d4;}})});}_0x1c5669=_[_0x0d70('0x38')]({},_0x1c5669,_0x5badae[_0x0d70('0x3a')]);var _0x45d346={'where':_0x1c5669['where']};return db[_0x0d70('0x3b')][_0x0d70('0x1a')](_0x45d346)[_0x0d70('0x21')](function(_0x460ba4){_0x527dec[_0x0d70('0x1a')]=_0x460ba4;if(_0x5badae[_0x0d70('0x2b')][_0x0d70('0x3c')]){_0x1c5669[_0x0d70('0x3d')]=[{'all':!![]}];}return db['ZendeskField'][_0x0d70('0x3e')](_0x1c5669);})[_0x0d70('0x21')](function(_0x19af28){_0x527dec[_0x0d70('0x3f')]=_0x19af28;return _0x527dec;})[_0x0d70('0x21')](respondWithFilteredResult(_0x31e322,_0x1c5669))[_0x0d70('0x40')](handleError(_0x31e322,null));};exports[_0x0d70('0x41')]=function(_0x253242,_0x3b56eb){var _0x448e2d={'raw':!![],'where':{'id':_0x253242[_0x0d70('0x42')]['id']}},_0x3a9518={};_0x3a9518[_0x0d70('0x2e')]=_['keys'](db[_0x0d70('0x3b')][_0x0d70('0x27')]);_0x3a9518[_0x0d70('0x2b')]=_[_0x0d70('0x2c')](_0x253242['query']);_0x3a9518[_0x0d70('0x35')]=_[_0x0d70('0x2d')](_0x3a9518[_0x0d70('0x2e')],_0x3a9518[_0x0d70('0x2b')]);_0x448e2d[_0x0d70('0x30')]=_[_0x0d70('0x2d')](_0x3a9518[_0x0d70('0x2e')],qs[_0x0d70('0x2f')](_0x253242[_0x0d70('0x2b')][_0x0d70('0x2f')]));_0x448e2d[_0x0d70('0x30')]=_0x448e2d[_0x0d70('0x30')][_0x0d70('0x43')]?_0x448e2d['attributes']:_0x3a9518[_0x0d70('0x2e')];if(_0x253242[_0x0d70('0x2b')][_0x0d70('0x3c')]){_0x448e2d[_0x0d70('0x3d')]=[{'all':!![]}];}_0x448e2d=_[_0x0d70('0x38')]({},_0x448e2d,_0x253242['options']);return db[_0x0d70('0x3b')][_0x0d70('0x44')](_0x448e2d)[_0x0d70('0x21')](handleEntityNotFound(_0x3b56eb,null))['then'](respondWithResult(_0x3b56eb,null))[_0x0d70('0x40')](handleError(_0x3b56eb,null));};exports[_0x0d70('0x45')]=function(_0x486e8a,_0x4d7300){return db[_0x0d70('0x3b')]['create'](_0x486e8a[_0x0d70('0x46')],{})['then'](respondWithResult(_0x4d7300,0xc9))[_0x0d70('0x40')](handleError(_0x4d7300,null));};exports[_0x0d70('0x20')]=function(_0x42dfbd,_0x5eeb65){if(_0x42dfbd['body']['id']){delete _0x42dfbd[_0x0d70('0x46')]['id'];}return db[_0x0d70('0x3b')]['find']({'where':{'id':_0x42dfbd[_0x0d70('0x42')]['id']}})[_0x0d70('0x21')](handleEntityNotFound(_0x5eeb65,null))['then'](saveUpdates(_0x42dfbd[_0x0d70('0x46')],null))[_0x0d70('0x21')](respondWithResult(_0x5eeb65,null))[_0x0d70('0x40')](handleError(_0x5eeb65,null));};exports['destroy']=function(_0x4e1436,_0x5a283c){return db[_0x0d70('0x3b')][_0x0d70('0x44')]({'where':{'id':_0x4e1436[_0x0d70('0x42')]['id']}})[_0x0d70('0x21')](handleEntityNotFound(_0x5a283c,null))['then'](removeEntity(_0x5a283c,null))[_0x0d70('0x40')](handleError(_0x5a283c,null));}; \ No newline at end of file +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 diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index d1aa341..d62abd6 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 _0x1d90=['../../config/logger','moment','request-promise','path','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','zendesk_unique_index','lodash'];(function(_0x568655,_0x50e7e2){var _0xfae557=function(_0x4c78dc){while(--_0x4c78dc){_0x568655['push'](_0x568655['shift']());}};_0xfae557(++_0x50e7e2);}(_0x1d90,0x13e));var _0x01d9=function(_0x2028e0,_0x37d31f){_0x2028e0=_0x2028e0-0x0;var _0x524757=_0x1d90[_0x2028e0];return _0x524757;};'use strict';var _=require(_0x01d9('0x0'));var util=require('util');var logger=require(_0x01d9('0x1'))('api');var moment=require(_0x01d9('0x2'));var BPromise=require('bluebird');var rp=require(_0x01d9('0x3'));var fs=require('fs');var path=require(_0x01d9('0x4'));var rimraf=require('rimraf');var config=require(_0x01d9('0x5'));var attributes=require(_0x01d9('0x6'));module[_0x01d9('0x7')]=function(_0x549267,_0x500fb7){return _0x549267[_0x01d9('0x8')](_0x01d9('0x9'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x01d9('0xa'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 2d610db..85cf900 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 _0x7511=['ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskField,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','request','then','info','request\x20sent'];(function(_0x1fe140,_0x19263c){var _0x59877c=function(_0x89f57e){while(--_0x89f57e){_0x1fe140['push'](_0x1fe140['shift']());}};_0x59877c(++_0x19263c);}(_0x7511,0x183));var _0x1751=function(_0x30e4c0,_0x58fed1){_0x30e4c0=_0x30e4c0-0x0;var _0x30b6d0=_0x7511[_0x30e4c0];return _0x30b6d0;};'use strict';var _=require(_0x1751('0x0'));var util=require(_0x1751('0x1'));var moment=require(_0x1751('0x2'));var BPromise=require(_0x1751('0x3'));var rs=require(_0x1751('0x4'));var fs=require('fs');var Redis=require(_0x1751('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1751('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1751('0x7'));var client=jayson[_0x1751('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x67fe4f,_0x1ca988,_0x12b676){return new BPromise(function(_0x4d3299,_0x411174){return client[_0x1751('0x9')](_0x67fe4f,_0x12b676)[_0x1751('0xa')](function(_0x231bfe){logger[_0x1751('0xb')]('ZendeskField,\x20%s,\x20%s',_0x1ca988,_0x1751('0xc'));logger['debug'](_0x1751('0xd'),_0x1ca988,_0x1751('0xc'),JSON[_0x1751('0xe')](_0x231bfe));if(_0x231bfe[_0x1751('0xf')]){if(_0x231bfe[_0x1751('0xf')][_0x1751('0x10')]===0x1f4){logger[_0x1751('0xf')](_0x1751('0x11'),_0x1ca988,_0x231bfe[_0x1751('0xf')]['message']);return _0x411174(_0x231bfe['error'][_0x1751('0x12')]);}logger[_0x1751('0xf')](_0x1751('0x11'),_0x1ca988,_0x231bfe[_0x1751('0xf')][_0x1751('0x12')]);return _0x4d3299(_0x231bfe['error'][_0x1751('0x12')]);}else{logger[_0x1751('0xb')](_0x1751('0x11'),_0x1ca988,_0x1751('0xc'));_0x4d3299(_0x231bfe['result'][_0x1751('0x12')]);}})[_0x1751('0x13')](function(_0x2083b4){logger[_0x1751('0xf')](_0x1751('0x11'),_0x1ca988,_0x2083b4);_0x411174(_0x2083b4);});});} \ No newline at end of file +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 diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 3215f9d..4c05178 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 _0xc85d=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports'];(function(_0x4d8764,_0xd13d7b){var _0x4e0b49=function(_0x56126a){while(--_0x56126a){_0x4d8764['push'](_0x4d8764['shift']());}};_0x4e0b49(++_0xd13d7b);}(_0xc85d,0xd8));var _0xdc85=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0xc85d[_0x5627e1];return _0x2f013f;};'use strict';var multer=require(_0xdc85('0x0'));var util=require(_0xdc85('0x1'));var path=require('path');var timeout=require(_0xdc85('0x2'));var express=require(_0xdc85('0x3'));var router=express[_0xdc85('0x4')]();var auth=require(_0xdc85('0x5'));var interaction=require(_0xdc85('0x6'));var config=require(_0xdc85('0x7'));var controller=require(_0xdc85('0x8'));router[_0xdc85('0x9')]('/',auth[_0xdc85('0xa')](),controller[_0xdc85('0xb')]);router[_0xdc85('0x9')](_0xdc85('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0xdc85('0xd'),auth[_0xdc85('0xa')](),controller[_0xdc85('0xe')]);router[_0xdc85('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0xdc85('0xf')]);router[_0xdc85('0x10')]('/',auth['isAuthenticated'](),controller[_0xdc85('0x11')]);router['post'](_0xdc85('0xd'),auth[_0xdc85('0xa')](),controller[_0xdc85('0x12')]);router[_0xdc85('0x13')](_0xdc85('0xc'),auth[_0xdc85('0xa')](),controller[_0xdc85('0x14')]);router[_0xdc85('0x15')](_0xdc85('0xc'),auth[_0xdc85('0xa')](),controller[_0xdc85('0x16')]);module[_0xdc85('0x17')]=router; \ No newline at end of file +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 diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 1cc2756..8e4ff65 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 _0xf2c2=['STRING','sequelize','exports'];(function(_0x51144c,_0x137f69){var _0x22b259=function(_0x346686){while(--_0x346686){_0x51144c['push'](_0x51144c['shift']());}};_0x22b259(++_0x137f69);}(_0xf2c2,0x6d));var _0x2f2c=function(_0x10c814,_0x2c5349){_0x10c814=_0x10c814-0x0;var _0x3620e8=_0xf2c2[_0x10c814];return _0x3620e8;};'use strict';var Sequelize=require(_0x2f2c('0x0'));module[_0x2f2c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2f2c('0x2')]},'host':{'type':Sequelize[_0x2f2c('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x2f2c('0x2')]},'serverUrl':{'type':Sequelize[_0x2f2c('0x2')]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x2f2c('0x2')]}}; \ No newline at end of file +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 diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 4b39155..05b1f06 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 _0x5f79=['includes','push','display_label','custom_field','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','test','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','json','offset','set','Content-Range','save','update','destroy','end','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','count','includeAll','include','show','keys','options','find','create','params','getConfigurations','findOne','ZohoConfiguration','pick','addConfiguration','body','AccountId','Subjects','channel','Descriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','Owner','Subject','Description','Call_Duration','Call_Result','Call_Start_Time','Call_Type'];(function(_0x76bd2,_0x487abe){var _0x2e50f3=function(_0x27a6da){while(--_0x27a6da){_0x76bd2['push'](_0x76bd2['shift']());}};_0x2e50f3(++_0x487abe);}(_0x5f79,0x92));var _0x95f7=function(_0x3bd52b,_0xbbc735){_0x3bd52b=_0x3bd52b-0x0;var _0x1e5b89=_0x5f79[_0x3bd52b];return _0x1e5b89;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x95f7('0x0'));var rimraf=require(_0x95f7('0x1'));var zipdir=require(_0x95f7('0x2'));var jsonpatch=require(_0x95f7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x95f7('0x4'));var Mustache=require(_0x95f7('0x5'));var util=require(_0x95f7('0x6'));var path=require('path');var sox=require(_0x95f7('0x7'));var csv=require('to-csv');var ejs=require(_0x95f7('0x8'));var fs=require('fs');var _=require(_0x95f7('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x95f7('0xa'));var deskjs=require(_0x95f7('0xb'));var toCsv=require(_0x95f7('0xc'));var querystring=require(_0x95f7('0xd'));var Papa=require(_0x95f7('0xe'));var Redis=require(_0x95f7('0xf'));var authService=require(_0x95f7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x95f7('0x11'));var hardwareService=require(_0x95f7('0x12'));var logger=require(_0x95f7('0x13'))(_0x95f7('0x14'));var utils=require(_0x95f7('0x15'));var config=require(_0x95f7('0x16'));var db=require(_0x95f7('0x17'))['db'];var integrations=require(_0x95f7('0x18'));var jayson=require(_0x95f7('0x19'));var client=jayson[_0x95f7('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x54b8d1,_0x3d8d1e,_0x4d0de1){if(_0x4d0de1){var _0x14bb8b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x14bb8b[_0x95f7('0x1b')](_0x3d8d1e)){return _0x54b8d1;}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 _0x54b8d1;}}function respondWithRpcPromise(_0x22f374,_0x4bb8e5,_0x1ccbf7,_0x22e66d){return new BPromise(function(_0x4747af,_0x2675d6){var _0x50998e=_0x22e66d||client;return _0x50998e[_0x95f7('0x1c')](_0x22f374,_0x1ccbf7)[_0x95f7('0x1d')](function(_0x22049f){logger[_0x95f7('0x1e')](_0x95f7('0x1f'),_0x4bb8e5,_0x95f7('0x20'));logger['debug'](_0x95f7('0x21'),_0x4bb8e5,_0x95f7('0x20'),JSON[_0x95f7('0x22')](_0x22049f));if(_0x22049f[_0x95f7('0x23')]){if(_0x22049f['error']['code']===0x1f4){logger['error'](_0x95f7('0x1f'),_0x4bb8e5,_0x22049f[_0x95f7('0x23')][_0x95f7('0x24')]);return _0x2675d6(_0x22049f['error'][_0x95f7('0x24')]);}logger[_0x95f7('0x23')](_0x95f7('0x1f'),_0x4bb8e5,_0x22049f['error']['message']);return _0x4747af(_0x22049f[_0x95f7('0x23')]['message']);}else{logger[_0x95f7('0x1e')](_0x95f7('0x1f'),_0x4bb8e5,'request\x20sent');_0x4747af(_0x22049f['result'][_0x95f7('0x24')]);}})[_0x95f7('0x25')](function(_0x16d248){logger[_0x95f7('0x23')](_0x95f7('0x1f'),_0x4bb8e5,_0x16d248);_0x2675d6(_0x16d248);});});}function respondWithStatusCode(_0xf554f4,_0xd58dc4){_0xd58dc4=_0xd58dc4||0xcc;return function(_0x4f78e6){if(_0x4f78e6){return _0xf554f4[_0x95f7('0x26')](_0xd58dc4);}return _0xf554f4[_0x95f7('0x27')](_0xd58dc4)['end']();};}function respondWithResult(_0x239e4a,_0x1ae3a8){_0x1ae3a8=_0x1ae3a8||0xc8;return function(_0x1a432e){if(_0x1a432e){return _0x239e4a[_0x95f7('0x27')](_0x1ae3a8)[_0x95f7('0x28')](_0x1a432e);}};}function respondWithFilteredResult(_0x3a5730,_0x1aaf12){return function(_0x397a39){if(_0x397a39){var _0x38aa10=_0x397a39['count'],_0xeedf86=_0x1aaf12[_0x95f7('0x29')],_0x414132=_0x1aaf12[_0x95f7('0x29')]+_0x1aaf12['limit'],_0x27e35c;if(_0x414132>=_0x38aa10){_0x414132=_0x38aa10;_0x27e35c=0xc8;}else{_0x27e35c=0xce;}_0x3a5730[_0x95f7('0x27')](_0x27e35c);return _0x3a5730[_0x95f7('0x2a')](_0x95f7('0x2b'),_0xeedf86+'-'+_0x414132+'/'+_0x38aa10)[_0x95f7('0x28')](_0x397a39);}return null;};}function patchUpdates(_0x375bfd){return function(_0x304a20){try{jsonpatch['apply'](_0x304a20,_0x375bfd,!![]);}catch(_0x2ff663){return BPromise['reject'](_0x2ff663);}return _0x304a20[_0x95f7('0x2c')]();};}function saveUpdates(_0x2e9371,_0x2bba8d){return function(_0x170c1d){if(_0x170c1d){return _0x170c1d[_0x95f7('0x2d')](_0x2e9371)[_0x95f7('0x1d')](function(_0x221c40){return _0x221c40;});}return null;};}function removeEntity(_0x5049a8,_0x48392d){return function(_0x573c52){if(_0x573c52){return _0x573c52[_0x95f7('0x2e')]()[_0x95f7('0x1d')](function(){_0x5049a8[_0x95f7('0x27')](0xcc)[_0x95f7('0x2f')]();});}};}function handleEntityNotFound(_0x4daf44,_0x34e90c){return function(_0x320600){if(!_0x320600){_0x4daf44[_0x95f7('0x26')](0x194);}return _0x320600;};}function handleError(_0x78f362,_0x4e8894){_0x4e8894=_0x4e8894||0x1f4;return function(_0x907360){logger[_0x95f7('0x23')](_0x907360['stack']);if(_0x907360[_0x95f7('0x30')]){delete _0x907360[_0x95f7('0x30')];}_0x78f362[_0x95f7('0x27')](_0x4e8894)[_0x95f7('0x31')](_0x907360);};}exports[_0x95f7('0x32')]=function(_0xbfca4b,_0x3062b2){var _0x461d40={},_0x4595a1={},_0x3b331f={'count':0x0,'rows':[]};var _0x3493dc=_[_0x95f7('0x33')](db[_0x95f7('0x34')][_0x95f7('0x35')],function(_0x42b445){return{'name':_0x42b445[_0x95f7('0x36')],'type':_0x42b445[_0x95f7('0x37')][_0x95f7('0x38')]};});_0x4595a1[_0x95f7('0x39')]=_[_0x95f7('0x33')](_0x3493dc,_0x95f7('0x30'));_0x4595a1[_0x95f7('0x3a')]=_['keys'](_0xbfca4b[_0x95f7('0x3a')]);_0x4595a1[_0x95f7('0x3b')]=_[_0x95f7('0x3c')](_0x4595a1['model'],_0x4595a1[_0x95f7('0x3a')]);_0x461d40[_0x95f7('0x3d')]=_[_0x95f7('0x3c')](_0x4595a1[_0x95f7('0x39')],qs[_0x95f7('0x3e')](_0xbfca4b[_0x95f7('0x3a')][_0x95f7('0x3e')]));_0x461d40[_0x95f7('0x3d')]=_0x461d40['attributes'][_0x95f7('0x3f')]?_0x461d40[_0x95f7('0x3d')]:_0x4595a1['model'];if(!_0xbfca4b[_0x95f7('0x3a')][_0x95f7('0x40')](_0x95f7('0x41'))){_0x461d40[_0x95f7('0x42')]=qs[_0x95f7('0x42')](_0xbfca4b[_0x95f7('0x3a')][_0x95f7('0x42')]);_0x461d40[_0x95f7('0x29')]=qs['offset'](_0xbfca4b[_0x95f7('0x3a')][_0x95f7('0x29')]);}_0x461d40[_0x95f7('0x43')]=qs[_0x95f7('0x44')](_0xbfca4b[_0x95f7('0x3a')]['sort']);_0x461d40[_0x95f7('0x45')]=qs[_0x95f7('0x3b')](_['pick'](_0xbfca4b[_0x95f7('0x3a')],_0x4595a1[_0x95f7('0x3b')]));if(_0xbfca4b[_0x95f7('0x3a')][_0x95f7('0x46')]){_0x461d40[_0x95f7('0x45')]=_[_0x95f7('0x47')](_0x461d40[_0x95f7('0x45')],{'$or':_[_0x95f7('0x33')](_0x3493dc,function(_0x2c05f2){if(_0x2c05f2[_0x95f7('0x37')]!==_0x95f7('0x48')){var _0x4f74e6={};_0x4f74e6[_0x2c05f2[_0x95f7('0x30')]]={'$like':'%'+_0xbfca4b[_0x95f7('0x3a')][_0x95f7('0x46')]+'%'};return _0x4f74e6;}})});}_0x461d40=_[_0x95f7('0x47')]({},_0x461d40,_0xbfca4b['options']);var _0x11c2ae={'where':_0x461d40[_0x95f7('0x45')]};return db['ZohoAccount'][_0x95f7('0x49')](_0x11c2ae)[_0x95f7('0x1d')](function(_0x363d62){_0x3b331f['count']=_0x363d62;if(_0xbfca4b[_0x95f7('0x3a')][_0x95f7('0x4a')]){_0x461d40[_0x95f7('0x4b')]=[{'all':!![]}];}return db[_0x95f7('0x34')]['findAll'](_0x461d40);})[_0x95f7('0x1d')](function(_0x8267){_0x3b331f['rows']=_0x8267;return _0x3b331f;})[_0x95f7('0x1d')](respondWithFilteredResult(_0x3062b2,_0x461d40))[_0x95f7('0x25')](handleError(_0x3062b2,null));};exports[_0x95f7('0x4c')]=function(_0xac227c,_0x2627bb){var _0x225157={'raw':![],'where':{'id':_0xac227c['params']['id']}},_0x33ad14={};_0x33ad14[_0x95f7('0x39')]=_[_0x95f7('0x4d')](db[_0x95f7('0x34')]['rawAttributes']);_0x33ad14[_0x95f7('0x3a')]=_[_0x95f7('0x4d')](_0xac227c['query']);_0x33ad14[_0x95f7('0x3b')]=_[_0x95f7('0x3c')](_0x33ad14[_0x95f7('0x39')],_0x33ad14[_0x95f7('0x3a')]);_0x225157[_0x95f7('0x3d')]=_['intersection'](_0x33ad14[_0x95f7('0x39')],qs[_0x95f7('0x3e')](_0xac227c[_0x95f7('0x3a')][_0x95f7('0x3e')]));_0x225157[_0x95f7('0x3d')]=_0x225157[_0x95f7('0x3d')]['length']?_0x225157[_0x95f7('0x3d')]:_0x33ad14[_0x95f7('0x39')];if(_0xac227c[_0x95f7('0x3a')][_0x95f7('0x4a')]){_0x225157['include']=[{'all':!![]}];}_0x225157=_[_0x95f7('0x47')]({},_0x225157,_0xac227c[_0x95f7('0x4e')]);return db['ZohoAccount'][_0x95f7('0x4f')](_0x225157)[_0x95f7('0x1d')](handleEntityNotFound(_0x2627bb,null))[_0x95f7('0x1d')](respondWithResult(_0x2627bb,null))[_0x95f7('0x25')](handleError(_0x2627bb,null));};exports[_0x95f7('0x50')]=function(_0x4ea286,_0x463be6){return db[_0x95f7('0x34')][_0x95f7('0x50')](_0x4ea286['body'],{})[_0x95f7('0x1d')](respondWithResult(_0x463be6,0xc9))[_0x95f7('0x25')](handleError(_0x463be6,null));};exports['update']=function(_0x14b30d,_0x39b04e){if(_0x14b30d['body']['id']){delete _0x14b30d['body']['id'];}return db[_0x95f7('0x34')][_0x95f7('0x4f')]({'where':{'id':_0x14b30d['params']['id']}})[_0x95f7('0x1d')](handleEntityNotFound(_0x39b04e,null))['then'](saveUpdates(_0x14b30d['body'],null))[_0x95f7('0x1d')](respondWithResult(_0x39b04e,null))['catch'](handleError(_0x39b04e,null));};exports[_0x95f7('0x2e')]=function(_0x5592c8,_0x3760e6){return db['ZohoAccount'][_0x95f7('0x4f')]({'where':{'id':_0x5592c8[_0x95f7('0x51')]['id']}})['then'](handleEntityNotFound(_0x3760e6,null))[_0x95f7('0x1d')](removeEntity(_0x3760e6,null))[_0x95f7('0x25')](handleError(_0x3760e6,null));};exports[_0x95f7('0x52')]=function(_0x33b6fe,_0x80b814,_0x14314a){var _0x1e1290={};var _0xd37af0={};var _0x36cb94;var _0x26b067;return db[_0x95f7('0x34')][_0x95f7('0x53')]({'where':{'id':_0x33b6fe[_0x95f7('0x51')]['id']}})[_0x95f7('0x1d')](handleEntityNotFound(_0x80b814,null))['then'](function(_0x3472e0){if(_0x3472e0){_0x36cb94=_0x3472e0;_0xd37af0[_0x95f7('0x39')]=_['keys'](db[_0x95f7('0x54')][_0x95f7('0x35')]);_0xd37af0[_0x95f7('0x3a')]=_[_0x95f7('0x4d')](_0x33b6fe['query']);_0xd37af0[_0x95f7('0x3b')]=_[_0x95f7('0x3c')](_0xd37af0[_0x95f7('0x39')],_0xd37af0[_0x95f7('0x3a')]);_0x1e1290[_0x95f7('0x3d')]=_[_0x95f7('0x3c')](_0xd37af0[_0x95f7('0x39')],qs[_0x95f7('0x3e')](_0x33b6fe[_0x95f7('0x3a')][_0x95f7('0x3e')]));_0x1e1290[_0x95f7('0x3d')]=_0x1e1290[_0x95f7('0x3d')][_0x95f7('0x3f')]?_0x1e1290[_0x95f7('0x3d')]:_0xd37af0[_0x95f7('0x39')];_0x1e1290['order']=qs[_0x95f7('0x44')](_0x33b6fe['query'][_0x95f7('0x44')]);_0x1e1290['where']=qs[_0x95f7('0x3b')](_[_0x95f7('0x55')](_0x33b6fe[_0x95f7('0x3a')],_0xd37af0[_0x95f7('0x3b')]));if(_0x33b6fe['query'][_0x95f7('0x46')]){_0x1e1290[_0x95f7('0x45')]=_[_0x95f7('0x47')](_0x1e1290[_0x95f7('0x45')],{'$or':_[_0x95f7('0x33')](_0x1e1290[_0x95f7('0x3d')],function(_0x31752d){var _0x3d7ba9={};_0x3d7ba9[_0x31752d]={'$like':'%'+_0x33b6fe['query']['filter']+'%'};return _0x3d7ba9;})});}_0x1e1290=_['merge']({},_0x1e1290,_0x33b6fe['options']);return _0x36cb94[_0x95f7('0x52')](_0x1e1290);}})[_0x95f7('0x1d')](function(_0x12c134){if(_0x12c134){_0x26b067=_0x12c134[_0x95f7('0x3f')];if(!_0x33b6fe['query']['hasOwnProperty']('nolimit')){_0x1e1290[_0x95f7('0x42')]=qs[_0x95f7('0x42')](_0x33b6fe[_0x95f7('0x3a')][_0x95f7('0x42')]);_0x1e1290[_0x95f7('0x29')]=qs['offset'](_0x33b6fe[_0x95f7('0x3a')][_0x95f7('0x29')]);}return _0x36cb94[_0x95f7('0x52')](_0x1e1290);}})['then'](function(_0x2a15e6){if(_0x2a15e6){return _0x2a15e6?{'count':_0x26b067,'rows':_0x2a15e6}:null;}})[_0x95f7('0x1d')](respondWithResult(_0x80b814,null))[_0x95f7('0x25')](handleError(_0x80b814,null));};exports[_0x95f7('0x56')]=function(_0x2aff63,_0x59cc55,_0x153821){if(_0x2aff63[_0x95f7('0x57')]['id']){delete _0x2aff63[_0x95f7('0x57')]['id'];}return db[_0x95f7('0x34')][_0x95f7('0x53')]({'where':{'id':_0x2aff63[_0x95f7('0x51')]['id']}})[_0x95f7('0x1d')](handleEntityNotFound(_0x59cc55,null))[_0x95f7('0x1d')](function(_0x355254){if(_0x355254){_0x2aff63[_0x95f7('0x57')][_0x95f7('0x58')]=_0x355254['id'];_0x2aff63[_0x95f7('0x57')][_0x95f7('0x59')]=integrations['getSubjects'](_0x2aff63['body'][_0x95f7('0x5a')],_0x2aff63[_0x95f7('0x57')]['type']);_0x2aff63[_0x95f7('0x57')][_0x95f7('0x5b')]=integrations['getDescriptions'](_0x2aff63['body'][_0x95f7('0x5a')],_0x2aff63['body'][_0x95f7('0x37')]);return db[_0x95f7('0x54')][_0x95f7('0x50')](_0x2aff63[_0x95f7('0x57')],{'include':[{'model':db[_0x95f7('0x5c')],'as':_0x95f7('0x59')},{'model':db[_0x95f7('0x5c')],'as':_0x95f7('0x5b')}]});}return null;})[_0x95f7('0x1d')](respondWithResult(_0x59cc55,null))[_0x95f7('0x25')](handleError(_0x59cc55,null));};function getAccessToken(_0x1db41f){return new Promise(function(_0x4b955b,_0x44305a){var _0x1da344;switch(_0x1db41f[_0x95f7('0x5d')]){case'US':_0x1da344=_0x95f7('0x5e');break;case'AU':_0x1da344=_0x95f7('0x5f');break;case'EU':_0x1da344=_0x95f7('0x60');break;case'IN':_0x1da344=_0x95f7('0x61');break;case'CN':_0x1da344='https://accounts.zoho.com.cn';break;default:_0x1da344=_0x95f7('0x60');break;}var _0x3776a1={'method':_0x95f7('0x62'),'uri':_0x1da344+_0x95f7('0x63'),'qs':{'refresh_token':_0x1db41f[_0x95f7('0x64')],'client_id':_0x1db41f[_0x95f7('0x65')],'client_secret':_0x1db41f[_0x95f7('0x66')],'grant_type':_0x95f7('0x67')},'json':!![]};return rp(_0x3776a1)[_0x95f7('0x1d')](function(_0x241d20){if(_0x241d20['access_token']){_0x4b955b(_0x241d20[_0x95f7('0x68')]);}else{_0x44305a(_0x95f7('0x69'));}})[_0x95f7('0x25')](function(_0x29a77e){_0x44305a(_0x29a77e);});});}exports[_0x95f7('0x6a')]=function(_0x43ddc2,_0x61f920,_0x183ac0){var _0x4fc0dd,_0x169388,_0x8a2fa9,_0x310eeb,_0x741111;return db[_0x95f7('0x34')][_0x95f7('0x53')]({'where':{'id':_0x43ddc2['params']['id']},'attributes':['id',_0x95f7('0x6b'),_0x95f7('0x5d'),_0x95f7('0x65'),_0x95f7('0x66'),_0x95f7('0x6c'),'code',_0x95f7('0x64')]})['then'](handleEntityNotFound(_0x61f920,null))[_0x95f7('0x1d')](function(_0x39a3f8){_0x741111=_0x39a3f8;_0x4fc0dd=_0x741111['host'];_0x169388=_0x4fc0dd==='zoho.eu'?'eu':_0x95f7('0x6d');_0x8a2fa9=_0x741111['serverUrl'];var _0x3a2c12=_0x8a2fa9[_0x95f7('0x6e')](-0x1);if(_0x3a2c12==='/'||_0x3a2c12==='\x5c'||_0x3a2c12===':'){_0x8a2fa9=_0x8a2fa9[_0x95f7('0x6f')](0x0,_0x8a2fa9[_0x95f7('0x70')](_0x3a2c12));}if(!_0x741111[_0x95f7('0x64')]){throw new Error(_0x95f7('0x71'));}return getAccessToken(_0x741111);})[_0x95f7('0x1d')](function(_0x58a96c){if(_0x58a96c){return rp({'method':_0x95f7('0x72'),'uri':util[_0x95f7('0x73')](_0x95f7('0x74'),_0x169388),'qs':{'module':'Calls'},'headers':{'Authorization':_0x95f7('0x75')+_0x58a96c},'json':!![]});}})[_0x95f7('0x1d')](function(_0x473ed1){if(_0x473ed1){if(_0x473ed1['response']&&_0x473ed1[_0x95f7('0x76')][_0x95f7('0x23')]){throw new Error(_0x473ed1[_0x95f7('0x76')][_0x95f7('0x23')][_0x95f7('0x24')]);}var _0x6cb280=[];var _0x1cc382=[];var _0x5bf429=[_0x95f7('0x77'),_0x95f7('0x78'),_0x95f7('0x79'),'WhoId',_0x95f7('0x7a'),_0x95f7('0x7b'),_0x95f7('0x7c'),_0x95f7('0x7d')];_0x1cc382=_['remove'](_0x473ed1[_0x95f7('0x3e')],function(_0x1873f7){return _0x5bf429[_0x95f7('0x7e')](_0x1873f7['api_name']);});for(var _0x5a9b28=0x0;_0x5a9b28<_0x1cc382[_0x95f7('0x3f')];_0x5a9b28++){if(_0x1cc382[_0x5a9b28]['system_mandatory']===![]){_0x6cb280[_0x95f7('0x7f')]({'id':_0x1cc382[_0x5a9b28]['id'],'name':_0x1cc382[_0x5a9b28][_0x95f7('0x80')],'custom':_0x1cc382[_0x5a9b28][_0x95f7('0x81')],'options':_0x1cc382[_0x5a9b28][_0x95f7('0x82')]===_0x95f7('0x83')&&_0x1cc382[_0x5a9b28][_0x95f7('0x84')][_0x95f7('0x3f')]>-0x1?_[_0x95f7('0x33')](_0x1cc382[_0x5a9b28][_0x95f7('0x84')],function(_0x2a10f8){return{'name':_0x2a10f8,'value':_0x2a10f8};}):[]});}}return{'count':_0x6cb280[_0x95f7('0x3f')],'rows':_0x6cb280};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x61f920,null))[_0x95f7('0x25')](function(_0x369729){var _0x105746=_0x43ddc2[_0x95f7('0x3a')][_0x95f7('0x1b')]?0x1f4:_0x369729[_0x95f7('0x85')]||0x1f4;logger[_0x95f7('0x23')](_0x95f7('0x86'),'getFields',_0x105746,JSON['stringify'](_0x369729));delete _0x369729['name'];if(_0x105746===0x191){_0x105746=0x190;}_0x61f920[_0x95f7('0x27')](_0x105746)[_0x95f7('0x31')](_0x43ddc2[_0x95f7('0x3a')]['test']?{'message':_0x95f7('0x87'),'statusCode':_0x369729[_0x95f7('0x85')]}:_0x369729);});}; \ No newline at end of file +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 diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 8df4ff2..7bf97f3 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 _0x68be=['format','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','clientSecret','https://accounts.zoho.com.cn','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','ZohoAccount','int_zoho_accounts','zone','serverUrl','changed','code','host','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','clientId','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken'];(function(_0x212234,_0x54d864){var _0x232226=function(_0x460996){while(--_0x460996){_0x212234['push'](_0x212234['shift']());}};_0x232226(++_0x54d864);}(_0x68be,0x171));var _0xe68b=function(_0x76d685,_0x3ffc71){_0x76d685=_0x76d685-0x0;var _0x1f3c0f=_0x68be[_0x76d685];return _0x1f3c0f;};'use strict';var _=require(_0xe68b('0x0'));var util=require(_0xe68b('0x1'));var logger=require(_0xe68b('0x2'))(_0xe68b('0x3'));var moment=require(_0xe68b('0x4'));var BPromise=require('bluebird');var rp=require(_0xe68b('0x5'));var fs=require('fs');var path=require(_0xe68b('0x6'));var rimraf=require(_0xe68b('0x7'));var config=require('../../config/environment');var attributes=require(_0xe68b('0x8'));var integrations=require(_0xe68b('0x9'));module['exports']=function(_0x2b8611,_0x2310c7){return _0x2b8611['define'](_0xe68b('0xa'),attributes,{'tableName':_0xe68b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1c2bb3,_0x9baffb,_0x580840){if(_0x1c2bb3['changed'](_0xe68b('0xc'))||_0x1c2bb3['changed'](_0xe68b('0xd'))||_0x1c2bb3[_0xe68b('0xe')]('clientId')||_0x1c2bb3[_0xe68b('0xe')]('clientSecret')||_0x1c2bb3[_0xe68b('0xe')](_0xe68b('0xf'))||_0x1c2bb3[_0xe68b('0xe')](_0xe68b('0x10'))){var _0x49c85e,_0x3cfc5d;_0x49c85e=_0x1c2bb3[_0xe68b('0xd')];var _0x3c4258=_0x49c85e[_0xe68b('0x11')](-0x1);if(_0x3c4258==='/'||_0x3c4258==='\x5c'||_0x3c4258===':'){_0x49c85e=_0x49c85e['substring'](0x0,_0x49c85e[_0xe68b('0x12')](_0x3c4258));}switch(_0x1c2bb3[_0xe68b('0xc')]){case'US':_0x3cfc5d=_0xe68b('0x13');break;case'AU':_0x3cfc5d=_0xe68b('0x14');break;case'IN':_0x3cfc5d=_0xe68b('0x15');break;case'CN':_0x3cfc5d='https://accounts.zoho.com.cn';break;default:_0x3cfc5d=_0xe68b('0x16');break;}var _0x511ee6={'method':'POST','uri':_0x3cfc5d+_0xe68b('0x17'),'form':{'grant_type':_0xe68b('0x18'),'client_id':_0x1c2bb3[_0xe68b('0x19')],'client_secret':_0x1c2bb3['clientSecret'],'redirect_uri':_0x1c2bb3[_0xe68b('0xd')],'code':_0x1c2bb3['code']},'headers':{'Content-Type':_0xe68b('0x1a')}};return rp(_0x511ee6)[_0xe68b('0x1b')](function(_0x211671){var _0x3c5fce=JSON[_0xe68b('0x1c')](_0x211671);if(_0x3c5fce[_0xe68b('0x1d')]){_0x1c2bb3[_0xe68b('0x1e')]=_0x3c5fce[_0xe68b('0x1d')];logger['info'](util[_0xe68b('0x1f')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1c2bb3['name'],_0x1c2bb3['id']));}else{logger[_0xe68b('0x20')](util['format'](_0xe68b('0x21'),_0x1c2bb3['name'],_0x1c2bb3['id']),util[_0xe68b('0x22')](_0x3c5fce,{'showHidden':![],'depth':null}));}return _0x580840(null,_0x9baffb);})[_0xe68b('0x23')](function(_0x20ed16){logger[_0xe68b('0x20')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1c2bb3['name'],_0x1c2bb3['id']),util[_0xe68b('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x580840(_0x20ed16);});}else{return _0x580840(null,_0x9baffb);}},'beforeUpdate':function(_0x6cbf66,_0xf78f10,_0x13902d){if(_0x6cbf66[_0xe68b('0xe')](_0xe68b('0xc'))||_0x6cbf66['changed'](_0xe68b('0xd'))||_0x6cbf66[_0xe68b('0xe')](_0xe68b('0x19'))||_0x6cbf66[_0xe68b('0xe')](_0xe68b('0x24'))||_0x6cbf66['changed'](_0xe68b('0xf'))||_0x6cbf66[_0xe68b('0xe')](_0xe68b('0x10'))){var _0x527ff2,_0x132f36;_0x527ff2=_0x6cbf66['serverUrl'];var _0x4922ea=_0x527ff2[_0xe68b('0x11')](-0x1);if(_0x4922ea==='/'||_0x4922ea==='\x5c'||_0x4922ea===':'){_0x527ff2=_0x527ff2['substring'](0x0,_0x527ff2[_0xe68b('0x12')](_0x4922ea));}switch(_0x6cbf66[_0xe68b('0xc')]){case'US':_0x132f36='https://accounts.zoho.com';break;case'AU':_0x132f36=_0xe68b('0x14');break;case'IN':_0x132f36=_0xe68b('0x15');break;case'CN':_0x132f36=_0xe68b('0x25');break;default:_0x132f36=_0xe68b('0x16');break;}var _0x16d1c6={'method':'POST','uri':_0x132f36+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x6cbf66['clientId'],'client_secret':_0x6cbf66[_0xe68b('0x24')],'redirect_uri':_0x6cbf66[_0xe68b('0xd')],'code':_0x6cbf66['code']},'headers':{'Content-Type':_0xe68b('0x1a')}};return rp(_0x16d1c6)[_0xe68b('0x1b')](function(_0x6f486c){var _0x2256fb=JSON[_0xe68b('0x1c')](_0x6f486c);if(_0x2256fb[_0xe68b('0x1d')]){_0x6cbf66[_0xe68b('0x1e')]=_0x2256fb[_0xe68b('0x1d')];logger['info'](util[_0xe68b('0x1f')](_0xe68b('0x26'),_0x6cbf66[_0xe68b('0x27')],_0x6cbf66['id']));}else{logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x6cbf66[_0xe68b('0x27')],_0x6cbf66['id']),util[_0xe68b('0x22')](_0x2256fb,{'showHidden':![],'depth':null}));}return _0x13902d(null,_0xf78f10);})[_0xe68b('0x23')](function(_0x58769d){logger[_0xe68b('0x20')](util[_0xe68b('0x1f')](_0xe68b('0x21'),_0x6cbf66[_0xe68b('0x27')],_0x6cbf66['id']),util[_0xe68b('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x13902d(_0x58769d);});}else{return _0x13902d(null,_0xf78f10);}}}});}; \ No newline at end of file +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 diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index c822b74..e063cc9 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 _0xeb3d=['error','code','message','result','ZohoAccount','options','attributes','limit','include','map','model','GetZohoAccount','catch','raw','where','ShowZohoAccount','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xc1263e,_0x56d738){var _0x471f07=function(_0x2e6c55){while(--_0x2e6c55){_0xc1263e['push'](_0xc1263e['shift']());}};_0x471f07(++_0x56d738);}(_0xeb3d,0xab));var _0xdeb3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xeb3d[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xdeb3('0x0'));var util=require(_0xdeb3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdeb3('0x2'));var db=require(_0xdeb3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xdeb3('0x4'))(_0xdeb3('0x5'));var config=require(_0xdeb3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xdeb3('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3301e1,_0x2ae95f,_0x125c9a){return new BPromise(function(_0x24dfcd,_0x19f860){return client['request'](_0x3301e1,_0x125c9a)[_0xdeb3('0x8')](function(_0x2be243){logger[_0xdeb3('0x9')](_0xdeb3('0xa'),_0x2ae95f,_0xdeb3('0xb'));logger[_0xdeb3('0xc')](_0xdeb3('0xd'),_0x2ae95f,_0xdeb3('0xb'),JSON[_0xdeb3('0xe')](_0x2be243));if(_0x2be243['error']){if(_0x2be243[_0xdeb3('0xf')][_0xdeb3('0x10')]===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x2ae95f,_0x2be243[_0xdeb3('0xf')][_0xdeb3('0x11')]);return _0x19f860(_0x2be243[_0xdeb3('0xf')][_0xdeb3('0x11')]);}logger[_0xdeb3('0xf')](_0xdeb3('0xa'),_0x2ae95f,_0x2be243[_0xdeb3('0xf')][_0xdeb3('0x11')]);return _0x24dfcd(_0x2be243['error'][_0xdeb3('0x11')]);}else{logger['info'](_0xdeb3('0xa'),_0x2ae95f,_0xdeb3('0xb'));_0x24dfcd(_0x2be243[_0xdeb3('0x12')][_0xdeb3('0x11')]);}})['catch'](function(_0x5360c2){logger[_0xdeb3('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x2ae95f,_0x5360c2);_0x19f860(_0x5360c2);});});}exports['GetZohoAccount']=function(_0x540d89){var _0x1bcf1c=this;return new Promise(function(_0x3a74c9,_0x4f7439){return db[_0xdeb3('0x13')]['findAll']({'raw':_0x540d89['options']?_0x540d89[_0xdeb3('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x540d89[_0xdeb3('0x14')]?_0x540d89[_0xdeb3('0x14')]['where']||null:null,'attributes':_0x540d89['options']?_0x540d89['options'][_0xdeb3('0x15')]||null:null,'limit':_0x540d89[_0xdeb3('0x14')]?_0x540d89['options'][_0xdeb3('0x16')]||null:null,'include':_0x540d89[_0xdeb3('0x14')]?_0x540d89[_0xdeb3('0x14')][_0xdeb3('0x17')]?_[_0xdeb3('0x18')](_0x540d89[_0xdeb3('0x14')][_0xdeb3('0x17')],function(_0x17c6d4){return{'model':db[_0x17c6d4[_0xdeb3('0x19')]],'as':_0x17c6d4['as'],'attributes':_0x17c6d4['attributes'],'include':_0x17c6d4[_0xdeb3('0x17')]?_[_0xdeb3('0x18')](_0x17c6d4[_0xdeb3('0x17')],function(_0x534979){return{'model':db[_0x534979[_0xdeb3('0x19')]],'as':_0x534979['as'],'attributes':_0x534979[_0xdeb3('0x15')],'include':_0x534979[_0xdeb3('0x17')]?_[_0xdeb3('0x18')](_0x534979['include'],function(_0xf4bb95){return{'model':db[_0xf4bb95[_0xdeb3('0x19')]],'as':_0xf4bb95['as'],'attributes':_0xf4bb95[_0xdeb3('0x15')]};}):[]};}):[]};}):[]:[]})[_0xdeb3('0x8')](function(_0x1267a9){logger[_0xdeb3('0x9')](_0xdeb3('0x1a'),_0x540d89);logger['debug'](_0xdeb3('0x1a'),_0x540d89,JSON[_0xdeb3('0xe')](_0x1267a9));_0x3a74c9(_0x1267a9);})[_0xdeb3('0x1b')](function(_0x1fc303){logger['error'](_0xdeb3('0x1a'),_0x1fc303[_0xdeb3('0x11')],_0x540d89);_0x4f7439(_0x1bcf1c[_0xdeb3('0xf')](0x1f4,_0x1fc303[_0xdeb3('0x11')]));});});};exports['ShowZohoAccount']=function(_0x27c532){var _0x1acc61=this;return new Promise(function(_0x5bef71,_0x36442f){return db[_0xdeb3('0x13')]['find']({'raw':_0x27c532[_0xdeb3('0x14')]?_0x27c532[_0xdeb3('0x14')][_0xdeb3('0x1c')]===undefined?!![]:![]:!![],'where':_0x27c532[_0xdeb3('0x14')]?_0x27c532[_0xdeb3('0x14')][_0xdeb3('0x1d')]||null:null,'attributes':_0x27c532['options']?_0x27c532[_0xdeb3('0x14')][_0xdeb3('0x15')]||null:null,'include':_0x27c532[_0xdeb3('0x14')]?_0x27c532[_0xdeb3('0x14')][_0xdeb3('0x17')]?_[_0xdeb3('0x18')](_0x27c532[_0xdeb3('0x14')][_0xdeb3('0x17')],function(_0x426524){return{'model':db[_0x426524['model']],'as':_0x426524['as'],'attributes':_0x426524[_0xdeb3('0x15')],'include':_0x426524[_0xdeb3('0x17')]?_[_0xdeb3('0x18')](_0x426524['include'],function(_0x28a787){return{'model':db[_0x28a787['model']],'as':_0x28a787['as'],'attributes':_0x28a787['attributes'],'include':_0x28a787[_0xdeb3('0x17')]?_[_0xdeb3('0x18')](_0x28a787['include'],function(_0x375ec6){return{'model':db[_0x375ec6['model']],'as':_0x375ec6['as'],'attributes':_0x375ec6[_0xdeb3('0x15')]};}):[]};}):[]};}):[]:[]})[_0xdeb3('0x8')](function(_0x5a85cd){logger[_0xdeb3('0x9')]('ShowZohoAccount',_0x27c532);logger['debug'](_0xdeb3('0x1e'),_0x27c532,JSON['stringify'](_0x5a85cd));_0x5bef71(_0x5a85cd);})[_0xdeb3('0x1b')](function(_0x51c5c9){logger[_0xdeb3('0xf')]('ShowZohoAccount',_0x51c5c9[_0xdeb3('0x11')],_0x27c532);_0x36442f(_0x1acc61[_0xdeb3('0xf')](0x1f4,_0x51c5c9['message']));});});}; \ No newline at end of file +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 diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 47dcb1e..b903b22 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 _0x14b7=['show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','index','get','/:id'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x14b7,0x144));var _0x714b=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0x14b7[_0x485b5a];return _0xd2b34d;};'use strict';var multer=require(_0x714b('0x0'));var util=require(_0x714b('0x1'));var path=require(_0x714b('0x2'));var timeout=require(_0x714b('0x3'));var express=require('express');var router=express[_0x714b('0x4')]();var auth=require(_0x714b('0x5'));var interaction=require(_0x714b('0x6'));var config=require(_0x714b('0x7'));var controller=require(_0x714b('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x714b('0x9')]);router[_0x714b('0xa')](_0x714b('0xb'),auth['isAuthenticated'](),controller[_0x714b('0xc')]);router[_0x714b('0xa')](_0x714b('0xd'),auth[_0x714b('0xe')](),controller[_0x714b('0xf')]);router['get'](_0x714b('0x10'),auth[_0x714b('0xe')](),controller[_0x714b('0x11')]);router['get'](_0x714b('0x12'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x714b('0x13')]('/',auth[_0x714b('0xe')](),controller['create']);router[_0x714b('0x14')](_0x714b('0xb'),auth[_0x714b('0xe')](),controller[_0x714b('0x15')]);router['delete'](_0x714b('0xb'),auth['isAuthenticated'](),controller[_0x714b('0x16')]);module[_0x714b('0x17')]=router; \ No newline at end of file +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 diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 3a9a5fd..8808b9e 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 _0x4d8f=['exports','STRING','ENUM','lead','contact','nothing','contact_lead','sequelize'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x4d8f,0xf7));var _0xf4d8=function(_0x4544c5,_0x5c69fa){_0x4544c5=_0x4544c5-0x0;var _0x35dbf5=_0x4d8f[_0x4544c5];return _0x35dbf5;};'use strict';var Sequelize=require(_0xf4d8('0x0'));module[_0xf4d8('0x1')]={'name':{'type':Sequelize[_0xf4d8('0x2')]},'moduleCreate':{'type':Sequelize[_0xf4d8('0x3')](_0xf4d8('0x4'),_0xf4d8('0x5'),_0xf4d8('0x6')),'defaultValue':_0xf4d8('0x4')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0xf4d8('0x5'),_0xf4d8('0x4')),'defaultValue':_0xf4d8('0x7')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +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 diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index b784347..491ea7d 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 _0x34e8=['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','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','end','sendStatus','stack','name','send','index','map','ZohoConfiguration','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','filter','merge','where','VIRTUAL','options','findAll','rows','show','params','keys','rawAttributes','includeAll','include','find','body','getFields','findOne','ZohoField','pick','hasOwnProperty','getSubjects','getDescriptions','html-pdf','eml-format','rimraf'];(function(_0x2ea464,_0x3a34ce){var _0x381511=function(_0x569810){while(--_0x569810){_0x2ea464['push'](_0x2ea464['shift']());}};_0x381511(++_0x3a34ce);}(_0x34e8,0x12c));var _0x834e=function(_0x266557,_0x1a5a83){_0x266557=_0x266557-0x0;var _0x5867a5=_0x34e8[_0x266557];return _0x5867a5;};'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'];var jayson=require('jayson/promise');var client=jayson[_0x834e('0x1d')][_0x834e('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x58a27e,_0x23848e,_0x2d95f2){if(_0x2d95f2){var _0x28e659=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x28e659[_0x834e('0x1f')](_0x23848e)){return _0x58a27e;}else{throw new db['Sequelize'][(_0x834e('0x20'))](_0x834e('0x21'));}}else{return _0x58a27e;}}function respondWithRpcPromise(_0x57274a,_0x316205,_0x4a9cdc,_0x38a8cd){return new BPromise(function(_0x36d443,_0x478afe){var _0x43ac41=_0x38a8cd||client;return _0x43ac41[_0x834e('0x22')](_0x57274a,_0x4a9cdc)[_0x834e('0x23')](function(_0x50b3f6){logger[_0x834e('0x24')](_0x834e('0x25'),_0x316205,_0x834e('0x26'));logger[_0x834e('0x27')](_0x834e('0x28'),_0x316205,_0x834e('0x26'),JSON[_0x834e('0x29')](_0x50b3f6));if(_0x50b3f6['error']){if(_0x50b3f6[_0x834e('0x2a')][_0x834e('0x2b')]===0x1f4){logger[_0x834e('0x2a')](_0x834e('0x25'),_0x316205,_0x50b3f6['error'][_0x834e('0x2c')]);return _0x478afe(_0x50b3f6[_0x834e('0x2a')]['message']);}logger[_0x834e('0x2a')](_0x834e('0x25'),_0x316205,_0x50b3f6[_0x834e('0x2a')]['message']);return _0x36d443(_0x50b3f6['error'][_0x834e('0x2c')]);}else{logger[_0x834e('0x24')]('ZohoConfiguration,\x20%s,\x20%s',_0x316205,_0x834e('0x26'));_0x36d443(_0x50b3f6[_0x834e('0x2d')]['message']);}})[_0x834e('0x2e')](function(_0x2e1983){logger[_0x834e('0x2a')]('ZohoConfiguration,\x20%s,\x20%s',_0x316205,_0x2e1983);_0x478afe(_0x2e1983);});});}function respondWithStatusCode(_0x24fcf7,_0x3e310f){_0x3e310f=_0x3e310f||0xcc;return function(_0x5e1cc5){if(_0x5e1cc5){return _0x24fcf7['sendStatus'](_0x3e310f);}return _0x24fcf7[_0x834e('0x2f')](_0x3e310f)['end']();};}function respondWithResult(_0x2826ec,_0x3f1b0b){_0x3f1b0b=_0x3f1b0b||0xc8;return function(_0x3db026){if(_0x3db026){return _0x2826ec[_0x834e('0x2f')](_0x3f1b0b)[_0x834e('0x30')](_0x3db026);}};}function respondWithFilteredResult(_0x130cc5,_0x491919){return function(_0x510780){if(_0x510780){var _0x4dc64a=_0x510780[_0x834e('0x31')],_0x58c1d7=_0x491919['offset'],_0x2c7a8d=_0x491919[_0x834e('0x32')]+_0x491919[_0x834e('0x33')],_0x567cea;if(_0x2c7a8d>=_0x4dc64a){_0x2c7a8d=_0x4dc64a;_0x567cea=0xc8;}else{_0x567cea=0xce;}_0x130cc5[_0x834e('0x2f')](_0x567cea);return _0x130cc5[_0x834e('0x34')](_0x834e('0x35'),_0x58c1d7+'-'+_0x2c7a8d+'/'+_0x4dc64a)[_0x834e('0x30')](_0x510780);}return null;};}function patchUpdates(_0x3d149d){return function(_0xfaf716){try{jsonpatch[_0x834e('0x36')](_0xfaf716,_0x3d149d,!![]);}catch(_0x493289){return BPromise[_0x834e('0x37')](_0x493289);}return _0xfaf716['save']();};}function saveUpdates(_0x2c75c2,_0x3787b0){return function(_0x9ab921){if(_0x9ab921){return _0x9ab921[_0x834e('0x38')](_0x2c75c2)[_0x834e('0x23')](function(_0x4689c2){return _0x4689c2;});}return null;};}function removeEntity(_0x4696a1,_0x38cd29){return function(_0x358c31){if(_0x358c31){return _0x358c31[_0x834e('0x39')]()['then'](function(){_0x4696a1[_0x834e('0x2f')](0xcc)[_0x834e('0x3a')]();});}};}function handleEntityNotFound(_0x24a9df,_0xaf01f4){return function(_0x595cc0){if(!_0x595cc0){_0x24a9df[_0x834e('0x3b')](0x194);}return _0x595cc0;};}function handleError(_0x379d60,_0x4b12f5){_0x4b12f5=_0x4b12f5||0x1f4;return function(_0x496533){logger['error'](_0x496533[_0x834e('0x3c')]);if(_0x496533[_0x834e('0x3d')]){delete _0x496533[_0x834e('0x3d')];}_0x379d60[_0x834e('0x2f')](_0x4b12f5)[_0x834e('0x3e')](_0x496533);};}exports[_0x834e('0x3f')]=function(_0x4c2ef6,_0x2c2d94){var _0x513f36={},_0xe103fe={},_0x6a3ac={'count':0x0,'rows':[]};var _0x47abed=_[_0x834e('0x40')](db[_0x834e('0x41')]['rawAttributes'],function(_0x481f70){return{'name':_0x481f70[_0x834e('0x42')],'type':_0x481f70[_0x834e('0x43')][_0x834e('0x44')]};});_0xe103fe[_0x834e('0x45')]=_[_0x834e('0x40')](_0x47abed,'name');_0xe103fe[_0x834e('0x46')]=_['keys'](_0x4c2ef6['query']);_0xe103fe[_0x834e('0x47')]=_['intersection'](_0xe103fe[_0x834e('0x45')],_0xe103fe[_0x834e('0x46')]);_0x513f36[_0x834e('0x48')]=_[_0x834e('0x49')](_0xe103fe[_0x834e('0x45')],qs['fields'](_0x4c2ef6[_0x834e('0x46')][_0x834e('0x4a')]));_0x513f36[_0x834e('0x48')]=_0x513f36['attributes'][_0x834e('0x4b')]?_0x513f36[_0x834e('0x48')]:_0xe103fe['model'];if(!_0x4c2ef6[_0x834e('0x46')]['hasOwnProperty'](_0x834e('0x4c'))){_0x513f36[_0x834e('0x33')]=qs['limit'](_0x4c2ef6['query'][_0x834e('0x33')]);_0x513f36[_0x834e('0x32')]=qs[_0x834e('0x32')](_0x4c2ef6[_0x834e('0x46')][_0x834e('0x32')]);}_0x513f36[_0x834e('0x4d')]=qs[_0x834e('0x4e')](_0x4c2ef6['query'][_0x834e('0x4e')]);_0x513f36['where']=qs[_0x834e('0x47')](_['pick'](_0x4c2ef6[_0x834e('0x46')],_0xe103fe['filters']));if(_0x4c2ef6[_0x834e('0x46')][_0x834e('0x4f')]){_0x513f36['where']=_[_0x834e('0x50')](_0x513f36[_0x834e('0x51')],{'$or':_[_0x834e('0x40')](_0x47abed,function(_0xd55cc3){if(_0xd55cc3[_0x834e('0x43')]!==_0x834e('0x52')){var _0xfa28da={};_0xfa28da[_0xd55cc3[_0x834e('0x3d')]]={'$like':'%'+_0x4c2ef6[_0x834e('0x46')][_0x834e('0x4f')]+'%'};return _0xfa28da;}})});}_0x513f36=_['merge']({},_0x513f36,_0x4c2ef6[_0x834e('0x53')]);var _0x6fff27={'where':_0x513f36['where']};return db[_0x834e('0x41')][_0x834e('0x31')](_0x6fff27)[_0x834e('0x23')](function(_0x2112d5){_0x6a3ac[_0x834e('0x31')]=_0x2112d5;if(_0x4c2ef6[_0x834e('0x46')]['includeAll']){_0x513f36['include']=[{'all':!![]}];}return db[_0x834e('0x41')][_0x834e('0x54')](_0x513f36);})[_0x834e('0x23')](function(_0x40ff5a){_0x6a3ac[_0x834e('0x55')]=_0x40ff5a;return _0x6a3ac;})[_0x834e('0x23')](respondWithFilteredResult(_0x2c2d94,_0x513f36))[_0x834e('0x2e')](handleError(_0x2c2d94,null));};exports[_0x834e('0x56')]=function(_0x1419eb,_0x390c45){var _0xf02f0d={'raw':![],'where':{'id':_0x1419eb[_0x834e('0x57')]['id']}},_0x385435={};_0x385435[_0x834e('0x45')]=_[_0x834e('0x58')](db[_0x834e('0x41')][_0x834e('0x59')]);_0x385435[_0x834e('0x46')]=_[_0x834e('0x58')](_0x1419eb[_0x834e('0x46')]);_0x385435['filters']=_[_0x834e('0x49')](_0x385435[_0x834e('0x45')],_0x385435['query']);_0xf02f0d[_0x834e('0x48')]=_[_0x834e('0x49')](_0x385435['model'],qs[_0x834e('0x4a')](_0x1419eb[_0x834e('0x46')][_0x834e('0x4a')]));_0xf02f0d[_0x834e('0x48')]=_0xf02f0d[_0x834e('0x48')][_0x834e('0x4b')]?_0xf02f0d[_0x834e('0x48')]:_0x385435['model'];if(_0x1419eb[_0x834e('0x46')][_0x834e('0x5a')]){_0xf02f0d[_0x834e('0x5b')]=[{'all':!![]}];}_0xf02f0d=_[_0x834e('0x50')]({},_0xf02f0d,_0x1419eb[_0x834e('0x53')]);return db[_0x834e('0x41')][_0x834e('0x5c')](_0xf02f0d)[_0x834e('0x23')](handleEntityNotFound(_0x390c45,null))['then'](respondWithResult(_0x390c45,null))[_0x834e('0x2e')](handleError(_0x390c45,null));};exports['create']=function(_0x2f4bde,_0x53a9ee){return db[_0x834e('0x41')]['create'](_0x2f4bde['body'],{})[_0x834e('0x23')](respondWithResult(_0x53a9ee,0xc9))[_0x834e('0x2e')](handleError(_0x53a9ee,null));};exports['update']=function(_0x5be43d,_0x2c8155){if(_0x5be43d[_0x834e('0x5d')]['id']){delete _0x5be43d[_0x834e('0x5d')]['id'];}return db[_0x834e('0x41')][_0x834e('0x5c')]({'where':{'id':_0x5be43d[_0x834e('0x57')]['id']}})[_0x834e('0x23')](handleEntityNotFound(_0x2c8155,null))[_0x834e('0x23')](saveUpdates(_0x5be43d['body'],null))[_0x834e('0x23')](respondWithResult(_0x2c8155,null))[_0x834e('0x2e')](handleError(_0x2c8155,null));};exports['destroy']=function(_0x281342,_0x4e2b22){return db[_0x834e('0x41')][_0x834e('0x5c')]({'where':{'id':_0x281342['params']['id']}})[_0x834e('0x23')](handleEntityNotFound(_0x4e2b22,null))[_0x834e('0x23')](removeEntity(_0x4e2b22,null))[_0x834e('0x2e')](handleError(_0x4e2b22,null));};exports[_0x834e('0x5e')]=function(_0x5a2924,_0xe35ded,_0x438f75){var _0x1dfd5f={};var _0x5925ef={};var _0x246b8e;var _0x1fcae9;return db[_0x834e('0x41')][_0x834e('0x5f')]({'where':{'id':_0x5a2924[_0x834e('0x57')]['id']}})[_0x834e('0x23')](handleEntityNotFound(_0xe35ded,null))[_0x834e('0x23')](function(_0x1def00){if(_0x1def00){_0x246b8e=_0x1def00;_0x5925ef[_0x834e('0x45')]=_[_0x834e('0x58')](db[_0x834e('0x60')][_0x834e('0x59')]);_0x5925ef[_0x834e('0x46')]=_[_0x834e('0x58')](_0x5a2924[_0x834e('0x46')]);_0x5925ef[_0x834e('0x47')]=_[_0x834e('0x49')](_0x5925ef[_0x834e('0x45')],_0x5925ef[_0x834e('0x46')]);_0x1dfd5f[_0x834e('0x48')]=_[_0x834e('0x49')](_0x5925ef[_0x834e('0x45')],qs['fields'](_0x5a2924[_0x834e('0x46')][_0x834e('0x4a')]));_0x1dfd5f[_0x834e('0x48')]=_0x1dfd5f[_0x834e('0x48')]['length']?_0x1dfd5f[_0x834e('0x48')]:_0x5925ef['model'];_0x1dfd5f['order']=qs[_0x834e('0x4e')](_0x5a2924[_0x834e('0x46')][_0x834e('0x4e')]);_0x1dfd5f[_0x834e('0x51')]=qs[_0x834e('0x47')](_[_0x834e('0x61')](_0x5a2924[_0x834e('0x46')],_0x5925ef[_0x834e('0x47')]));if(_0x5a2924['query'][_0x834e('0x4f')]){_0x1dfd5f['where']=_[_0x834e('0x50')](_0x1dfd5f[_0x834e('0x51')],{'$or':_['map'](_0x1dfd5f['attributes'],function(_0x4a4def){var _0x82f2a7={};_0x82f2a7[_0x4a4def]={'$like':'%'+_0x5a2924[_0x834e('0x46')][_0x834e('0x4f')]+'%'};return _0x82f2a7;})});}_0x1dfd5f=_[_0x834e('0x50')]({},_0x1dfd5f,_0x5a2924['options']);return _0x246b8e[_0x834e('0x5e')](_0x1dfd5f);}})[_0x834e('0x23')](function(_0x2df64f){if(_0x2df64f){_0x1fcae9=_0x2df64f[_0x834e('0x4b')];if(!_0x5a2924[_0x834e('0x46')][_0x834e('0x62')](_0x834e('0x4c'))){_0x1dfd5f[_0x834e('0x33')]=qs[_0x834e('0x33')](_0x5a2924[_0x834e('0x46')]['limit']);_0x1dfd5f[_0x834e('0x32')]=qs[_0x834e('0x32')](_0x5a2924[_0x834e('0x46')][_0x834e('0x32')]);}return _0x246b8e['getFields'](_0x1dfd5f);}})[_0x834e('0x23')](function(_0x4ac5f2){if(_0x4ac5f2){return _0x4ac5f2?{'count':_0x1fcae9,'rows':_0x4ac5f2}:null;}})['then'](respondWithResult(_0xe35ded,null))['catch'](handleError(_0xe35ded,null));};exports[_0x834e('0x63')]=function(_0x332d8f,_0x514aac,_0x2645df){var _0x1b200d={};var _0x4d4477={};var _0x353246;var _0x18ccb2;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x332d8f[_0x834e('0x57')]['id']}})[_0x834e('0x23')](handleEntityNotFound(_0x514aac,null))[_0x834e('0x23')](function(_0x44c909){if(_0x44c909){_0x353246=_0x44c909;_0x4d4477[_0x834e('0x45')]=_['keys'](db[_0x834e('0x60')]['rawAttributes']);_0x4d4477[_0x834e('0x46')]=_[_0x834e('0x58')](_0x332d8f[_0x834e('0x46')]);_0x4d4477['filters']=_[_0x834e('0x49')](_0x4d4477[_0x834e('0x45')],_0x4d4477['query']);_0x1b200d[_0x834e('0x48')]=_[_0x834e('0x49')](_0x4d4477[_0x834e('0x45')],qs['fields'](_0x332d8f[_0x834e('0x46')][_0x834e('0x4a')]));_0x1b200d[_0x834e('0x48')]=_0x1b200d[_0x834e('0x48')][_0x834e('0x4b')]?_0x1b200d[_0x834e('0x48')]:_0x4d4477[_0x834e('0x45')];_0x1b200d[_0x834e('0x4d')]=qs[_0x834e('0x4e')](_0x332d8f[_0x834e('0x46')]['sort']);_0x1b200d['where']=qs['filters'](_[_0x834e('0x61')](_0x332d8f[_0x834e('0x46')],_0x4d4477[_0x834e('0x47')]));if(_0x332d8f[_0x834e('0x46')][_0x834e('0x4f')]){_0x1b200d['where']=_['merge'](_0x1b200d[_0x834e('0x51')],{'$or':_[_0x834e('0x40')](_0x1b200d[_0x834e('0x48')],function(_0x18ddac){var _0x40a705={};_0x40a705[_0x18ddac]={'$like':'%'+_0x332d8f['query'][_0x834e('0x4f')]+'%'};return _0x40a705;})});}_0x1b200d=_[_0x834e('0x50')]({},_0x1b200d,_0x332d8f[_0x834e('0x53')]);return _0x353246['getSubjects'](_0x1b200d);}})[_0x834e('0x23')](function(_0x18fde1){if(_0x18fde1){_0x18ccb2=_0x18fde1[_0x834e('0x4b')];if(!_0x332d8f[_0x834e('0x46')][_0x834e('0x62')]('nolimit')){_0x1b200d['limit']=qs[_0x834e('0x33')](_0x332d8f[_0x834e('0x46')]['limit']);_0x1b200d[_0x834e('0x32')]=qs['offset'](_0x332d8f[_0x834e('0x46')][_0x834e('0x32')]);}return _0x353246[_0x834e('0x63')](_0x1b200d);}})['then'](function(_0x155c0f){if(_0x155c0f){return _0x155c0f?{'count':_0x18ccb2,'rows':_0x155c0f}:null;}})['then'](respondWithResult(_0x514aac,null))['catch'](handleError(_0x514aac,null));};exports['getDescriptions']=function(_0x6735e6,_0x4627ac,_0x1d7bab){var _0x1d76c6={};var _0x3b18d0={};var _0x2dad55;var _0x3aa388;return db[_0x834e('0x41')][_0x834e('0x5f')]({'where':{'id':_0x6735e6['params']['id']}})[_0x834e('0x23')](handleEntityNotFound(_0x4627ac,null))['then'](function(_0x11a9f7){if(_0x11a9f7){_0x2dad55=_0x11a9f7;_0x3b18d0[_0x834e('0x45')]=_[_0x834e('0x58')](db[_0x834e('0x60')][_0x834e('0x59')]);_0x3b18d0[_0x834e('0x46')]=_['keys'](_0x6735e6['query']);_0x3b18d0[_0x834e('0x47')]=_[_0x834e('0x49')](_0x3b18d0['model'],_0x3b18d0[_0x834e('0x46')]);_0x1d76c6[_0x834e('0x48')]=_[_0x834e('0x49')](_0x3b18d0[_0x834e('0x45')],qs[_0x834e('0x4a')](_0x6735e6['query'][_0x834e('0x4a')]));_0x1d76c6[_0x834e('0x48')]=_0x1d76c6['attributes']['length']?_0x1d76c6['attributes']:_0x3b18d0[_0x834e('0x45')];_0x1d76c6[_0x834e('0x4d')]=qs['sort'](_0x6735e6[_0x834e('0x46')][_0x834e('0x4e')]);_0x1d76c6['where']=qs[_0x834e('0x47')](_['pick'](_0x6735e6['query'],_0x3b18d0[_0x834e('0x47')]));if(_0x6735e6[_0x834e('0x46')][_0x834e('0x4f')]){_0x1d76c6[_0x834e('0x51')]=_['merge'](_0x1d76c6[_0x834e('0x51')],{'$or':_[_0x834e('0x40')](_0x1d76c6[_0x834e('0x48')],function(_0x1b0b41){var _0x46aabf={};_0x46aabf[_0x1b0b41]={'$like':'%'+_0x6735e6[_0x834e('0x46')][_0x834e('0x4f')]+'%'};return _0x46aabf;})});}_0x1d76c6=_[_0x834e('0x50')]({},_0x1d76c6,_0x6735e6[_0x834e('0x53')]);return _0x2dad55[_0x834e('0x64')](_0x1d76c6);}})[_0x834e('0x23')](function(_0x261e3d){if(_0x261e3d){_0x3aa388=_0x261e3d[_0x834e('0x4b')];if(!_0x6735e6[_0x834e('0x46')][_0x834e('0x62')](_0x834e('0x4c'))){_0x1d76c6[_0x834e('0x33')]=qs[_0x834e('0x33')](_0x6735e6[_0x834e('0x46')][_0x834e('0x33')]);_0x1d76c6[_0x834e('0x32')]=qs[_0x834e('0x32')](_0x6735e6['query'][_0x834e('0x32')]);}return _0x2dad55[_0x834e('0x64')](_0x1d76c6);}})[_0x834e('0x23')](function(_0x2dab75){if(_0x2dab75){return _0x2dab75?{'count':_0x3aa388,'rows':_0x2dab75}:null;}})[_0x834e('0x23')](respondWithResult(_0x4627ac,null))[_0x834e('0x2e')](handleError(_0x4627ac,null));}; \ No newline at end of file +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 diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 72b1d5e..aa95bd8 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 _0x52e4=['request-promise','path','rimraf','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','api'];(function(_0x170cd1,_0x4ba03b){var _0x12724b=function(_0x13dca9){while(--_0x13dca9){_0x170cd1['push'](_0x170cd1['shift']());}};_0x12724b(++_0x4ba03b);}(_0x52e4,0xd7));var _0x452e=function(_0x2ffc46,_0x35ce3c){_0x2ffc46=_0x2ffc46-0x0;var _0x1eda8f=_0x52e4[_0x2ffc46];return _0x1eda8f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x452e('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x452e('0x1'));var fs=require('fs');var path=require(_0x452e('0x2'));var rimraf=require(_0x452e('0x3'));var config=require('../../config/environment');var attributes=require(_0x452e('0x4'));module[_0x452e('0x5')]=function(_0x1230c1,_0x50d6cc){return _0x1230c1[_0x452e('0x6')](_0x452e('0x7'),attributes,{'tableName':_0x452e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 6da12b8..b84da04 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 _0xc39a=['code','message','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x8627a4,_0x187863){var _0x2f3e6c=function(_0x4c045e){while(--_0x4c045e){_0x8627a4['push'](_0x8627a4['shift']());}};_0x2f3e6c(++_0x187863);}(_0xc39a,0xc0));var _0xac39=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0xc39a[_0xc67528];return _0x38e26d;};'use strict';var _=require(_0xac39('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xac39('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xac39('0x2'));var db=require(_0xac39('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xac39('0x4'))(_0xac39('0x5'));var config=require(_0xac39('0x6'));var jayson=require(_0xac39('0x7'));var client=jayson[_0xac39('0x8')][_0xac39('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x12de25,_0x40913f,_0x2f505b){return new BPromise(function(_0x18f0dd,_0xc077af){return client[_0xac39('0xa')](_0x12de25,_0x2f505b)[_0xac39('0xb')](function(_0x204a93){logger['info'](_0xac39('0xc'),_0x40913f,_0xac39('0xd'));logger[_0xac39('0xe')](_0xac39('0xf'),_0x40913f,_0xac39('0xd'),JSON[_0xac39('0x10')](_0x204a93));if(_0x204a93[_0xac39('0x11')]){if(_0x204a93[_0xac39('0x11')][_0xac39('0x12')]===0x1f4){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x40913f,_0x204a93[_0xac39('0x11')]['message']);return _0xc077af(_0x204a93[_0xac39('0x11')][_0xac39('0x13')]);}logger[_0xac39('0x11')](_0xac39('0xc'),_0x40913f,_0x204a93[_0xac39('0x11')][_0xac39('0x13')]);return _0x18f0dd(_0x204a93[_0xac39('0x11')][_0xac39('0x13')]);}else{logger['info'](_0xac39('0xc'),_0x40913f,'request\x20sent');_0x18f0dd(_0x204a93['result']['message']);}})[_0xac39('0x14')](function(_0x39312c){logger[_0xac39('0x11')](_0xac39('0xc'),_0x40913f,_0x39312c);_0xc077af(_0x39312c);});});} \ No newline at end of file +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 diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 95c45ce..746bdfe 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 _0x6a55=['get','/:id','show','post','put','update','delete','destroy','exports','multer','express','../../components/interaction/service','./intZohoField.controller','isAuthenticated','index'];(function(_0x32a884,_0x183853){var _0x242f9b=function(_0x556c63){while(--_0x556c63){_0x32a884['push'](_0x32a884['shift']());}};_0x242f9b(++_0x183853);}(_0x6a55,0xdb));var _0x56a5=function(_0x330414,_0x4f3207){_0x330414=_0x330414-0x0;var _0x99dbff=_0x6a55[_0x330414];return _0x99dbff;};'use strict';var multer=require(_0x56a5('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x56a5('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x56a5('0x2'));var config=require('../../config/environment');var controller=require(_0x56a5('0x3'));router['get']('/',auth[_0x56a5('0x4')](),controller[_0x56a5('0x5')]);router[_0x56a5('0x6')](_0x56a5('0x7'),auth[_0x56a5('0x4')](),controller[_0x56a5('0x8')]);router[_0x56a5('0x9')]('/',auth[_0x56a5('0x4')](),controller['create']);router[_0x56a5('0xa')](_0x56a5('0x7'),auth[_0x56a5('0x4')](),controller[_0x56a5('0xb')]);router[_0x56a5('0xc')](_0x56a5('0x7'),auth[_0x56a5('0x4')](),controller[_0x56a5('0xd')]);module[_0x56a5('0xe')]=router; \ No newline at end of file +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 diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index c7154c1..c3b180a 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 _0x8838=['BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','STRING','customVariable'];(function(_0x1b7f34,_0x407f02){var _0x413c95=function(_0x58fda7){while(--_0x58fda7){_0x1b7f34['push'](_0x1b7f34['shift']());}};_0x413c95(++_0x407f02);}(_0x8838,0xeb));var _0x8883=function(_0x3f359e,_0x46327f){_0x3f359e=_0x3f359e-0x0;var _0xb6ec9b=_0x8838[_0x3f359e];return _0xb6ec9b;};'use strict';var Sequelize=require(_0x8883('0x0'));module[_0x8883('0x1')]={'type':{'type':Sequelize[_0x8883('0x2')](_0x8883('0x3'),_0x8883('0x4'),'customVariable',_0x8883('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x8883('0x6')]},'key':{'type':Sequelize[_0x8883('0x6')]},'keyType':{'type':Sequelize[_0x8883('0x2')]('string',_0x8883('0x4'),_0x8883('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8883('0x6')]},'nameField':{'type':Sequelize[_0x8883('0x6')]},'customField':{'type':Sequelize[_0x8883('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +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 diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 23bfe80..b4f797b 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 _0x242a=['map','VIRTUAL','options','ZohoField','includeAll','findAll','rows','catch','show','include','create','body','find','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge'];(function(_0x4542e1,_0x49de90){var _0x4591cf=function(_0x2ae33c){while(--_0x2ae33c){_0x4542e1['push'](_0x4542e1['shift']());}};_0x4591cf(++_0x49de90);}(_0x242a,0x1ac));var _0xa242=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x242a[_0x1e4360];return _0x31e6b4;};'use strict';var pdf=require(_0xa242('0x0'));var emlformat=require(_0xa242('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa242('0x2'));var jsonpatch=require(_0xa242('0x3'));var rp=require(_0xa242('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa242('0x5'));var path=require(_0xa242('0x6'));var sox=require('sox');var csv=require(_0xa242('0x7'));var ejs=require(_0xa242('0x8'));var fs=require('fs');var _=require(_0xa242('0x9'));var squel=require(_0xa242('0xa'));var crypto=require(_0xa242('0xb'));var jsforce=require(_0xa242('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa242('0x7'));var querystring=require(_0xa242('0xd'));var Papa=require(_0xa242('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa242('0xf'));var as=require(_0xa242('0x10'));var hardwareService=require(_0xa242('0x11'));var logger=require(_0xa242('0x12'))('api');var utils=require(_0xa242('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe8b58b,_0x4f3bdb){_0x4f3bdb=_0x4f3bdb||0xcc;return function(_0x46d52e){if(_0x46d52e){return _0xe8b58b[_0xa242('0x14')](_0x4f3bdb);}return _0xe8b58b[_0xa242('0x15')](_0x4f3bdb)['end']();};}function respondWithResult(_0x1af90c,_0x2fb8c6){_0x2fb8c6=_0x2fb8c6||0xc8;return function(_0x69cc69){if(_0x69cc69){return _0x1af90c[_0xa242('0x15')](_0x2fb8c6)[_0xa242('0x16')](_0x69cc69);}};}function respondWithFilteredResult(_0x4c40ea,_0x520f88){return function(_0x56c9b9){if(_0x56c9b9){var _0xd047a3=_0x56c9b9[_0xa242('0x17')],_0x4677e3=_0x520f88['offset'],_0x612fef=_0x520f88[_0xa242('0x18')]+_0x520f88[_0xa242('0x19')],_0xa04a41;if(_0x612fef>=_0xd047a3){_0x612fef=_0xd047a3;_0xa04a41=0xc8;}else{_0xa04a41=0xce;}_0x4c40ea[_0xa242('0x15')](_0xa04a41);return _0x4c40ea[_0xa242('0x1a')]('Content-Range',_0x4677e3+'-'+_0x612fef+'/'+_0xd047a3)[_0xa242('0x16')](_0x56c9b9);}return null;};}function patchUpdates(_0x1b11db){return function(_0x412ff7){try{jsonpatch[_0xa242('0x1b')](_0x412ff7,_0x1b11db,!![]);}catch(_0x8b2494){return BPromise[_0xa242('0x1c')](_0x8b2494);}return _0x412ff7[_0xa242('0x1d')]();};}function saveUpdates(_0x4bae31,_0x3cf57e){return function(_0x2d0499){if(_0x2d0499){return _0x2d0499[_0xa242('0x1e')](_0x4bae31)[_0xa242('0x1f')](function(_0x120cb6){return _0x120cb6;});}return null;};}function removeEntity(_0x4d4f02,_0x4fa0ac){return function(_0x4efcff){if(_0x4efcff){return _0x4efcff[_0xa242('0x20')]()[_0xa242('0x1f')](function(){_0x4d4f02['status'](0xcc)[_0xa242('0x21')]();});}};}function handleEntityNotFound(_0x49d439,_0x43feda){return function(_0x382563){if(!_0x382563){_0x49d439[_0xa242('0x14')](0x194);}return _0x382563;};}function handleError(_0x30749a,_0x4b380b){_0x4b380b=_0x4b380b||0x1f4;return function(_0x25a51d){logger[_0xa242('0x22')](_0x25a51d[_0xa242('0x23')]);if(_0x25a51d[_0xa242('0x24')]){delete _0x25a51d[_0xa242('0x24')];}_0x30749a['status'](_0x4b380b)[_0xa242('0x25')](_0x25a51d);};}exports['index']=function(_0x4ff913,_0x1f54d9){var _0x4ad853={},_0x99f93a={},_0x17c13f={'count':0x0,'rows':[]};var _0x580e56=_['map'](db['ZohoField'][_0xa242('0x26')],function(_0x2011af){return{'name':_0x2011af['fieldName'],'type':_0x2011af[_0xa242('0x27')][_0xa242('0x28')]};});_0x99f93a['model']=_['map'](_0x580e56,_0xa242('0x24'));_0x99f93a[_0xa242('0x29')]=_['keys'](_0x4ff913[_0xa242('0x29')]);_0x99f93a[_0xa242('0x2a')]=_[_0xa242('0x2b')](_0x99f93a[_0xa242('0x2c')],_0x99f93a[_0xa242('0x29')]);_0x4ad853[_0xa242('0x2d')]=_[_0xa242('0x2b')](_0x99f93a['model'],qs[_0xa242('0x2e')](_0x4ff913['query']['fields']));_0x4ad853[_0xa242('0x2d')]=_0x4ad853['attributes'][_0xa242('0x2f')]?_0x4ad853[_0xa242('0x2d')]:_0x99f93a[_0xa242('0x2c')];if(!_0x4ff913[_0xa242('0x29')]['hasOwnProperty'](_0xa242('0x30'))){_0x4ad853[_0xa242('0x19')]=qs[_0xa242('0x19')](_0x4ff913[_0xa242('0x29')][_0xa242('0x19')]);_0x4ad853[_0xa242('0x18')]=qs[_0xa242('0x18')](_0x4ff913[_0xa242('0x29')][_0xa242('0x18')]);}_0x4ad853[_0xa242('0x31')]=qs[_0xa242('0x32')](_0x4ff913[_0xa242('0x29')][_0xa242('0x32')]);_0x4ad853[_0xa242('0x33')]=qs[_0xa242('0x2a')](_[_0xa242('0x34')](_0x4ff913[_0xa242('0x29')],_0x99f93a[_0xa242('0x2a')]));if(_0x4ff913['query'][_0xa242('0x35')]){_0x4ad853[_0xa242('0x33')]=_[_0xa242('0x36')](_0x4ad853[_0xa242('0x33')],{'$or':_[_0xa242('0x37')](_0x580e56,function(_0x19c2cf){if(_0x19c2cf[_0xa242('0x27')]!==_0xa242('0x38')){var _0x387db7={};_0x387db7[_0x19c2cf[_0xa242('0x24')]]={'$like':'%'+_0x4ff913['query'][_0xa242('0x35')]+'%'};return _0x387db7;}})});}_0x4ad853=_[_0xa242('0x36')]({},_0x4ad853,_0x4ff913[_0xa242('0x39')]);var _0x57bf34={'where':_0x4ad853[_0xa242('0x33')]};return db[_0xa242('0x3a')]['count'](_0x57bf34)[_0xa242('0x1f')](function(_0x46ab0f){_0x17c13f['count']=_0x46ab0f;if(_0x4ff913[_0xa242('0x29')][_0xa242('0x3b')]){_0x4ad853['include']=[{'all':!![]}];}return db[_0xa242('0x3a')][_0xa242('0x3c')](_0x4ad853);})[_0xa242('0x1f')](function(_0x4508b1){_0x17c13f[_0xa242('0x3d')]=_0x4508b1;return _0x17c13f;})[_0xa242('0x1f')](respondWithFilteredResult(_0x1f54d9,_0x4ad853))[_0xa242('0x3e')](handleError(_0x1f54d9,null));};exports[_0xa242('0x3f')]=function(_0x42f176,_0x151d39){var _0x5402b0={'raw':!![],'where':{'id':_0x42f176['params']['id']}},_0x11f871={};_0x11f871[_0xa242('0x2c')]=_['keys'](db[_0xa242('0x3a')][_0xa242('0x26')]);_0x11f871['query']=_['keys'](_0x42f176[_0xa242('0x29')]);_0x11f871[_0xa242('0x2a')]=_['intersection'](_0x11f871[_0xa242('0x2c')],_0x11f871['query']);_0x5402b0[_0xa242('0x2d')]=_[_0xa242('0x2b')](_0x11f871[_0xa242('0x2c')],qs[_0xa242('0x2e')](_0x42f176[_0xa242('0x29')][_0xa242('0x2e')]));_0x5402b0[_0xa242('0x2d')]=_0x5402b0[_0xa242('0x2d')]['length']?_0x5402b0['attributes']:_0x11f871[_0xa242('0x2c')];if(_0x42f176[_0xa242('0x29')]['includeAll']){_0x5402b0[_0xa242('0x40')]=[{'all':!![]}];}_0x5402b0=_['merge']({},_0x5402b0,_0x42f176[_0xa242('0x39')]);return db[_0xa242('0x3a')]['find'](_0x5402b0)[_0xa242('0x1f')](handleEntityNotFound(_0x151d39,null))['then'](respondWithResult(_0x151d39,null))['catch'](handleError(_0x151d39,null));};exports['create']=function(_0x429a3d,_0x1b7211){return db[_0xa242('0x3a')][_0xa242('0x41')](_0x429a3d[_0xa242('0x42')],{})[_0xa242('0x1f')](respondWithResult(_0x1b7211,0xc9))['catch'](handleError(_0x1b7211,null));};exports[_0xa242('0x1e')]=function(_0x200885,_0x6c954f){if(_0x200885[_0xa242('0x42')]['id']){delete _0x200885[_0xa242('0x42')]['id'];}return db[_0xa242('0x3a')][_0xa242('0x43')]({'where':{'id':_0x200885[_0xa242('0x44')]['id']}})[_0xa242('0x1f')](handleEntityNotFound(_0x6c954f,null))[_0xa242('0x1f')](saveUpdates(_0x200885[_0xa242('0x42')],null))['then'](respondWithResult(_0x6c954f,null))[_0xa242('0x3e')](handleError(_0x6c954f,null));};exports[_0xa242('0x20')]=function(_0x5949ab,_0x500535){return db['ZohoField']['find']({'where':{'id':_0x5949ab[_0xa242('0x44')]['id']}})[_0xa242('0x1f')](handleEntityNotFound(_0x500535,null))[_0xa242('0x1f')](removeEntity(_0x500535,null))['catch'](handleError(_0x500535,null));}; \ No newline at end of file +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 diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 38926aa..1b017dd 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 _0x2c87=['bluebird','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x2c87,0xec));var _0x72c8=function(_0x3158bf,_0x3ad357){_0x3158bf=_0x3158bf-0x0;var _0x358405=_0x2c87[_0x3158bf];return _0x358405;};'use strict';var _=require(_0x72c8('0x0'));var util=require(_0x72c8('0x1'));var logger=require(_0x72c8('0x2'))(_0x72c8('0x3'));var moment=require('moment');var BPromise=require(_0x72c8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x72c8('0x5'));var rimraf=require(_0x72c8('0x6'));var config=require(_0x72c8('0x7'));var attributes=require(_0x72c8('0x8'));module[_0x72c8('0x9')]=function(_0x21d767,_0x184e99){return _0x21d767[_0x72c8('0xa')]('ZohoField',attributes,{'tableName':_0x72c8('0xb'),'paranoid':![],'indexes':[{'name':_0x72c8('0xc'),'fields':[_0x72c8('0xd'),_0x72c8('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 9401b96..0e5bce2 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 _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x498cf0,_0x394333){var _0x5011f1=function(_0x33c1ff){while(--_0x33c1ff){_0x498cf0['push'](_0x498cf0['shift']());}};_0x5011f1(++_0x394333);}(_0x6aa7,0x178));var _0x76aa=function(_0x57c7e3,_0x10017f){_0x57c7e3=_0x57c7e3-0x0;var _0x142e3b=_0x6aa7[_0x57c7e3];return _0x142e3b;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file +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 diff --git a/server/api/integration/index.js b/server/api/integration/index.js index a9f1255..071cdbb 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 _0x6a8b=['../../components/interaction/service','multer','path','connect-timeout','Router','../../components/auth/service'];(function(_0x4a413d,_0x4d32c8){var _0x5e829a=function(_0x5848a3){while(--_0x5848a3){_0x4a413d['push'](_0x4a413d['shift']());}};_0x5e829a(++_0x4d32c8);}(_0x6a8b,0x10f));var _0xb6a8=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x6a8b[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0xb6a8('0x0'));var util=require('util');var path=require(_0xb6a8('0x1'));var timeout=require(_0xb6a8('0x2'));var express=require('express');var router=express[_0xb6a8('0x3')]();var auth=require(_0xb6a8('0x4'));var interaction=require(_0xb6a8('0x5'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index ac31b22..82df806 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 _0x9e4f=['sequelize','exports','STRING','unique_name_and_version','INTEGER','BOOLEAN','state'];(function(_0x487541,_0x5be693){var _0xc82a4f=function(_0x4097dc){while(--_0x4097dc){_0x487541['push'](_0x487541['shift']());}};_0xc82a4f(++_0x5be693);}(_0x9e4f,0xe7));var _0xf9e4=function(_0x33a21f,_0x126a3b){_0x33a21f=_0x33a21f-0x0;var _0x53a307=_0x9e4f[_0x33a21f];return _0x53a307;};'use strict';var Sequelize=require(_0xf9e4('0x0'));module[_0xf9e4('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xf9e4('0x2')],'allowNull':![],'unique':_0xf9e4('0x3')},'main':{'type':Sequelize[_0xf9e4('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0xf9e4('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf9e4('0x2')]},'size':{'type':Sequelize[_0xf9e4('0x4')]},'active':{'type':Sequelize[_0xf9e4('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xf9e4('0x2')]},'logo':{'type':Sequelize[_0xf9e4('0x2')]},'state':{'type':Sequelize[_0xf9e4('0x2')],'unique':_0xf9e4('0x6')},'description':{'type':Sequelize[_0xf9e4('0x2')]},'title':{'type':Sequelize[_0xf9e4('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xf9e4('0x2')],'defaultValue':'#'}}; \ No newline at end of file +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 diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 60000cc..11a4195 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 _0xfe04=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','reject','save','update','destroy','then','error','name','send','map','Integration','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','type','VIRTUAL','count','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','html-pdf','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x47619a,_0x424f9f){var _0x2384e6=function(_0x51b1fa){while(--_0x51b1fa){_0x47619a['push'](_0x47619a['shift']());}};_0x2384e6(++_0x424f9f);}(_0xfe04,0x10f));var _0x4fe0=function(_0x41b94a,_0xb002ca){_0x41b94a=_0x41b94a-0x0;var _0x107467=_0xfe04[_0x41b94a];return _0x107467;};'use strict';var pdf=require(_0x4fe0('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4fe0('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x4fe0('0x2'));var util=require(_0x4fe0('0x3'));var path=require(_0x4fe0('0x4'));var sox=require(_0x4fe0('0x5'));var csv=require(_0x4fe0('0x6'));var ejs=require(_0x4fe0('0x7'));var fs=require('fs');var _=require(_0x4fe0('0x8'));var squel=require(_0x4fe0('0x9'));var crypto=require(_0x4fe0('0xa'));var jsforce=require(_0x4fe0('0xb'));var deskjs=require(_0x4fe0('0xc'));var toCsv=require(_0x4fe0('0x6'));var querystring=require(_0x4fe0('0xd'));var Papa=require(_0x4fe0('0xe'));var Redis=require(_0x4fe0('0xf'));var authService=require(_0x4fe0('0x10'));var qs=require(_0x4fe0('0x11'));var as=require(_0x4fe0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4fe0('0x13'))(_0x4fe0('0x14'));var utils=require(_0x4fe0('0x15'));var config=require('../../config/environment');var db=require(_0x4fe0('0x16'))['db'];function respondWithStatusCode(_0x23aa4b,_0x3b54d0){_0x3b54d0=_0x3b54d0||0xcc;return function(_0x39a0a3){if(_0x39a0a3){return _0x23aa4b[_0x4fe0('0x17')](_0x3b54d0);}return _0x23aa4b[_0x4fe0('0x18')](_0x3b54d0)[_0x4fe0('0x19')]();};}function respondWithResult(_0xa29352,_0x241987){_0x241987=_0x241987||0xc8;return function(_0x3d0f19){if(_0x3d0f19){return _0xa29352['status'](_0x241987)[_0x4fe0('0x1a')](_0x3d0f19);}};}function respondWithFilteredResult(_0x516990,_0x336657){return function(_0x413216){if(_0x413216){var _0x187a1f=_0x413216['count'],_0x30b872=_0x336657[_0x4fe0('0x1b')],_0x12df7d=_0x336657[_0x4fe0('0x1b')]+_0x336657['limit'],_0x4eebd7;if(_0x12df7d>=_0x187a1f){_0x12df7d=_0x187a1f;_0x4eebd7=0xc8;}else{_0x4eebd7=0xce;}_0x516990[_0x4fe0('0x18')](_0x4eebd7);return _0x516990[_0x4fe0('0x1c')](_0x4fe0('0x1d'),_0x30b872+'-'+_0x12df7d+'/'+_0x187a1f)[_0x4fe0('0x1a')](_0x413216);}return null;};}function patchUpdates(_0x266dd8){return function(_0x5dfc9f){try{jsonpatch['apply'](_0x5dfc9f,_0x266dd8,!![]);}catch(_0x5dbf95){return BPromise[_0x4fe0('0x1e')](_0x5dbf95);}return _0x5dfc9f[_0x4fe0('0x1f')]();};}function saveUpdates(_0x30b845,_0x36dafb){return function(_0x8afcac){if(_0x8afcac){return _0x8afcac[_0x4fe0('0x20')](_0x30b845)['then'](function(_0x79c624){return _0x79c624;});}return null;};}function removeEntity(_0x14e267,_0x2e3739){return function(_0x5588f6){if(_0x5588f6){return _0x5588f6[_0x4fe0('0x21')]()[_0x4fe0('0x22')](function(){_0x14e267[_0x4fe0('0x18')](0xcc)[_0x4fe0('0x19')]();});}};}function handleEntityNotFound(_0x3030e3,_0x3d1cbb){return function(_0x289fe4){if(!_0x289fe4){_0x3030e3[_0x4fe0('0x17')](0x194);}return _0x289fe4;};}function handleError(_0x2a513d,_0x33dbdf){_0x33dbdf=_0x33dbdf||0x1f4;return function(_0x49253b){logger[_0x4fe0('0x23')](_0x49253b['stack']);if(_0x49253b[_0x4fe0('0x24')]){delete _0x49253b[_0x4fe0('0x24')];}_0x2a513d[_0x4fe0('0x18')](_0x33dbdf)[_0x4fe0('0x25')](_0x49253b);};}exports['index']=function(_0x3695f7,_0x6a8116){var _0x15d09a={},_0x56dc35={},_0x53cf96={'count':0x0,'rows':[]};var _0x50f655=_[_0x4fe0('0x26')](db[_0x4fe0('0x27')][_0x4fe0('0x28')],function(_0x3781c9){return{'name':_0x3781c9[_0x4fe0('0x29')],'type':_0x3781c9['type']['key']};});_0x56dc35[_0x4fe0('0x2a')]=_['map'](_0x50f655,_0x4fe0('0x24'));_0x56dc35[_0x4fe0('0x2b')]=_[_0x4fe0('0x2c')](_0x3695f7['query']);_0x56dc35[_0x4fe0('0x2d')]=_[_0x4fe0('0x2e')](_0x56dc35[_0x4fe0('0x2a')],_0x56dc35['query']);_0x15d09a[_0x4fe0('0x2f')]=_[_0x4fe0('0x2e')](_0x56dc35[_0x4fe0('0x2a')],qs[_0x4fe0('0x30')](_0x3695f7[_0x4fe0('0x2b')][_0x4fe0('0x30')]));_0x15d09a['attributes']=_0x15d09a[_0x4fe0('0x2f')][_0x4fe0('0x31')]?_0x15d09a['attributes']:_0x56dc35[_0x4fe0('0x2a')];if(!_0x3695f7[_0x4fe0('0x2b')][_0x4fe0('0x32')](_0x4fe0('0x33'))){_0x15d09a[_0x4fe0('0x34')]=qs[_0x4fe0('0x34')](_0x3695f7[_0x4fe0('0x2b')][_0x4fe0('0x34')]);_0x15d09a[_0x4fe0('0x1b')]=qs['offset'](_0x3695f7['query'][_0x4fe0('0x1b')]);}_0x15d09a[_0x4fe0('0x35')]=qs['sort'](_0x3695f7[_0x4fe0('0x2b')]['sort']);_0x15d09a[_0x4fe0('0x36')]=qs[_0x4fe0('0x2d')](_[_0x4fe0('0x37')](_0x3695f7[_0x4fe0('0x2b')],_0x56dc35['filters']));if(_0x3695f7[_0x4fe0('0x2b')][_0x4fe0('0x38')]){_0x15d09a[_0x4fe0('0x36')]=_[_0x4fe0('0x39')](_0x15d09a[_0x4fe0('0x36')],{'$or':_[_0x4fe0('0x26')](_0x50f655,function(_0x23b40f){if(_0x23b40f[_0x4fe0('0x3a')]!==_0x4fe0('0x3b')){var _0x3c1a4a={};_0x3c1a4a[_0x23b40f[_0x4fe0('0x24')]]={'$like':'%'+_0x3695f7[_0x4fe0('0x2b')][_0x4fe0('0x38')]+'%'};return _0x3c1a4a;}})});}_0x15d09a=_[_0x4fe0('0x39')]({},_0x15d09a,_0x3695f7['options']);var _0x1439b7={'where':_0x15d09a[_0x4fe0('0x36')]};return db[_0x4fe0('0x27')]['count'](_0x1439b7)[_0x4fe0('0x22')](function(_0x3c7f1d){_0x53cf96[_0x4fe0('0x3c')]=_0x3c7f1d;if(_0x3695f7[_0x4fe0('0x2b')]['includeAll']){_0x15d09a[_0x4fe0('0x3d')]=[{'all':!![]}];}return db[_0x4fe0('0x27')][_0x4fe0('0x3e')](_0x15d09a);})[_0x4fe0('0x22')](function(_0x5d4de7){_0x53cf96[_0x4fe0('0x3f')]=_0x5d4de7;return _0x53cf96;})[_0x4fe0('0x22')](respondWithFilteredResult(_0x6a8116,_0x15d09a))[_0x4fe0('0x40')](handleError(_0x6a8116,null));};exports[_0x4fe0('0x41')]=function(_0x2ec740,_0x280c14){var _0x2c9c8f={'raw':![],'where':{'id':_0x2ec740[_0x4fe0('0x42')]['id']}},_0x24cd0c={};_0x24cd0c[_0x4fe0('0x2a')]=_[_0x4fe0('0x2c')](db['Integration']['rawAttributes']);_0x24cd0c[_0x4fe0('0x2b')]=_[_0x4fe0('0x2c')](_0x2ec740[_0x4fe0('0x2b')]);_0x24cd0c[_0x4fe0('0x2d')]=_[_0x4fe0('0x2e')](_0x24cd0c['model'],_0x24cd0c[_0x4fe0('0x2b')]);_0x2c9c8f[_0x4fe0('0x2f')]=_[_0x4fe0('0x2e')](_0x24cd0c['model'],qs[_0x4fe0('0x30')](_0x2ec740[_0x4fe0('0x2b')][_0x4fe0('0x30')]));_0x2c9c8f[_0x4fe0('0x2f')]=_0x2c9c8f[_0x4fe0('0x2f')]['length']?_0x2c9c8f[_0x4fe0('0x2f')]:_0x24cd0c['model'];if(_0x2ec740[_0x4fe0('0x2b')][_0x4fe0('0x43')]){_0x2c9c8f[_0x4fe0('0x3d')]=[{'all':!![]}];}_0x2c9c8f=_[_0x4fe0('0x39')]({},_0x2c9c8f,_0x2ec740[_0x4fe0('0x44')]);return db[_0x4fe0('0x27')][_0x4fe0('0x45')](_0x2c9c8f)[_0x4fe0('0x22')](handleEntityNotFound(_0x280c14,null))[_0x4fe0('0x22')](respondWithResult(_0x280c14,null))[_0x4fe0('0x40')](handleError(_0x280c14,null));};exports[_0x4fe0('0x46')]=function(_0x3527a5,_0x520815){return db['Integration'][_0x4fe0('0x46')](_0x3527a5[_0x4fe0('0x47')],{})[_0x4fe0('0x22')](respondWithResult(_0x520815,0xc9))[_0x4fe0('0x40')](handleError(_0x520815,null));};exports[_0x4fe0('0x20')]=function(_0x597026,_0x49eea8){if(_0x597026['body']['id']){delete _0x597026[_0x4fe0('0x47')]['id'];}return db['Integration'][_0x4fe0('0x45')]({'where':{'id':_0x597026[_0x4fe0('0x42')]['id']}})[_0x4fe0('0x22')](handleEntityNotFound(_0x49eea8,null))['then'](saveUpdates(_0x597026['body'],null))[_0x4fe0('0x22')](respondWithResult(_0x49eea8,null))[_0x4fe0('0x40')](handleError(_0x49eea8,null));};exports[_0x4fe0('0x21')]=function(_0x47e288,_0x59cac2){return db['Integration']['find']({'where':{'id':_0x47e288['params']['id']}})[_0x4fe0('0x22')](handleEntityNotFound(_0x59cac2,null))[_0x4fe0('0x22')](removeEntity(_0x59cac2,null))['catch'](handleError(_0x59cac2,null));}; \ No newline at end of file +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 diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 03928fe..5c9ad9b 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 _0x8913=['./integration.attributes','exports','define','Integration','integrations','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0xa3a76e,_0x55edec){var _0x125fce=function(_0x1f5af7){while(--_0x1f5af7){_0xa3a76e['push'](_0xa3a76e['shift']());}};_0x125fce(++_0x55edec);}(_0x8913,0x13d));var _0x3891=function(_0x276f3b,_0x2fe7a9){_0x276f3b=_0x276f3b-0x0;var _0x253d7b=_0x8913[_0x276f3b];return _0x253d7b;};'use strict';var _=require('lodash');var util=require(_0x3891('0x0'));var logger=require(_0x3891('0x1'))(_0x3891('0x2'));var moment=require(_0x3891('0x3'));var BPromise=require(_0x3891('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3891('0x5'));var rimraf=require(_0x3891('0x6'));var config=require(_0x3891('0x7'));var attributes=require(_0x3891('0x8'));module[_0x3891('0x9')]=function(_0x14e23e,_0x179fd7){return _0x14e23e[_0x3891('0xa')](_0x3891('0xb'),attributes,{'tableName':_0x3891('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 9b3b00c..2a9f42e 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 _0x78f0=['jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0x1526d2,_0x17f716){var _0x1c21e2=function(_0x5bb30a){while(--_0x5bb30a){_0x1526d2['push'](_0x1526d2['shift']());}};_0x1c21e2(++_0x17f716);}(_0x78f0,0x1dc));var _0x078f=function(_0x265149,_0x4e57ca){_0x265149=_0x265149-0x0;var _0x481d18=_0x78f0[_0x265149];return _0x481d18;};'use strict';var _=require('lodash');var util=require(_0x078f('0x0'));var moment=require(_0x078f('0x1'));var BPromise=require(_0x078f('0x2'));var rs=require(_0x078f('0x3'));var fs=require('fs');var Redis=require(_0x078f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x078f('0x5'))(_0x078f('0x6'));var config=require(_0x078f('0x7'));var jayson=require(_0x078f('0x8'));var client=jayson[_0x078f('0x9')][_0x078f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b0413,_0x15677a,_0x1f31e1){return new BPromise(function(_0x4f6f4d,_0xf0b48d){return client[_0x078f('0xb')](_0x4b0413,_0x1f31e1)[_0x078f('0xc')](function(_0x14ec1e){logger[_0x078f('0xd')](_0x078f('0xe'),_0x15677a,_0x078f('0xf'));logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x15677a,_0x078f('0xf'),JSON[_0x078f('0x10')](_0x14ec1e));if(_0x14ec1e[_0x078f('0x11')]){if(_0x14ec1e['error'][_0x078f('0x12')]===0x1f4){logger[_0x078f('0x11')](_0x078f('0xe'),_0x15677a,_0x14ec1e[_0x078f('0x11')][_0x078f('0x13')]);return _0xf0b48d(_0x14ec1e[_0x078f('0x11')]['message']);}logger[_0x078f('0x11')](_0x078f('0xe'),_0x15677a,_0x14ec1e['error'][_0x078f('0x13')]);return _0x4f6f4d(_0x14ec1e[_0x078f('0x11')][_0x078f('0x13')]);}else{logger[_0x078f('0xd')](_0x078f('0xe'),_0x15677a,_0x078f('0xf'));_0x4f6f4d(_0x14ec1e[_0x078f('0x14')][_0x078f('0x13')]);}})[_0x078f('0x15')](function(_0x569923){logger[_0x078f('0x11')](_0x078f('0xe'),_0x15677a,_0x569923);_0xf0b48d(_0x569923);});});} \ No newline at end of file +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 diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index e064a75..45404a6 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 _0xf579=['create','destroy','util','path','express','Router','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post'];(function(_0x4d3681,_0x136f19){var _0x22c7ac=function(_0x3c6120){while(--_0x3c6120){_0x4d3681['push'](_0x4d3681['shift']());}};_0x22c7ac(++_0x136f19);}(_0xf579,0x1bc));var _0x9f57=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xf579[_0x9cd4c3];return _0x4c9025;};'use strict';var multer=require('multer');var util=require(_0x9f57('0x0'));var path=require(_0x9f57('0x1'));var timeout=require('connect-timeout');var express=require(_0x9f57('0x2'));var router=express[_0x9f57('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x9f57('0x4'));var config=require(_0x9f57('0x5'));var controller=require(_0x9f57('0x6'));router[_0x9f57('0x7')]('/',auth['isAuthenticated'](),controller[_0x9f57('0x8')]);router['get'](_0x9f57('0x9'),auth[_0x9f57('0xa')](),controller[_0x9f57('0xb')]);router[_0x9f57('0x7')](_0x9f57('0xc'),auth[_0x9f57('0xa')](),controller[_0x9f57('0xd')]);router[_0x9f57('0xe')]('/',auth[_0x9f57('0xa')](),controller[_0x9f57('0xf')]);router['put'](_0x9f57('0xc'),auth[_0x9f57('0xa')](),controller['update']);router['delete'](_0x9f57('0xc'),auth[_0x9f57('0xa')](),controller[_0x9f57('0x10')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index c4a9b8f..8ea377b 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 _0x86a5=['INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x86a5,0x166));var _0x586a=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x86a5[_0x5f309e];return _0x487b5e;};'use strict';var Sequelize=require('sequelize');module[_0x586a('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x586a('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x586a('0x2')]},'contacts':{'type':Sequelize[_0x586a('0x1')]},'uniqueid':{'type':Sequelize[_0x586a('0x1')]},'calleridnum':{'type':Sequelize[_0x586a('0x1')]},'calleridname':{'type':Sequelize[_0x586a('0x1')]},'queue':{'type':Sequelize[_0x586a('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x586a('0x1')]},'agentcalledAt':{'type':Sequelize[_0x586a('0x3')]},'agentconnectAt':{'type':Sequelize[_0x586a('0x3')]},'holdtime':{'type':Sequelize[_0x586a('0x2')]},'agentcomplete':{'type':Sequelize[_0x586a('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x586a('0x3')]},'talktime':{'type':Sequelize[_0x586a('0x2')]},'agentacw':{'type':Sequelize[_0x586a('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x586a('0x2')]},'reason':{'type':Sequelize[_0x586a('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x586a('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x586a('0x3')]},'agentdump':{'type':Sequelize[_0x586a('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x586a('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x586a('0x2')]},'channelstatedesc':{'type':Sequelize[_0x586a('0x1')]},'connectedlinenum':{'type':Sequelize[_0x586a('0x1')]},'connectedlinename':{'type':Sequelize[_0x586a('0x1')]},'language':{'type':Sequelize[_0x586a('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x586a('0x1')]},'destchannel':{'type':Sequelize[_0x586a('0x1')]},'destchannelstate':{'type':Sequelize[_0x586a('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x586a('0x1')]},'destcalleridnum':{'type':Sequelize[_0x586a('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x586a('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x586a('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x586a('0x1')]},'destcontext':{'type':Sequelize[_0x586a('0x1')]},'destexten':{'type':Sequelize[_0x586a('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x586a('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x586a('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x586a('0x1')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x586a('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x586a('0x5')]},'status':{'type':Sequelize[_0x586a('0x6')](_0x586a('0x7'),_0x586a('0x8'),_0x586a('0x9'),'FAILED')},'url':{'type':Sequelize[_0x586a('0x1')]},'app':{'type':Sequelize[_0x586a('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x586a('0x2')]}}; \ No newline at end of file +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 diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 40fb3c1..976c968 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 _0x07a2=['key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','set','apply','reject','update','then','destroy','error','name','send','IntegrationReport','rawAttributes','type'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x07a2,0x12c));var _0x207a=function(_0x23c651,_0x143982){_0x23c651=_0x23c651-0x0;var _0xbe7bdb=_0x07a2[_0x23c651];return _0xbe7bdb;};'use strict';var pdf=require(_0x207a('0x0'));var emlformat=require(_0x207a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x207a('0x2'));var jsonpatch=require(_0x207a('0x3'));var rp=require(_0x207a('0x4'));var moment=require(_0x207a('0x5'));var BPromise=require(_0x207a('0x6'));var Mustache=require(_0x207a('0x7'));var util=require(_0x207a('0x8'));var path=require(_0x207a('0x9'));var sox=require(_0x207a('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x207a('0xb'));var squel=require(_0x207a('0xc'));var crypto=require(_0x207a('0xd'));var jsforce=require(_0x207a('0xe'));var deskjs=require(_0x207a('0xf'));var toCsv=require(_0x207a('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x207a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x207a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x207a('0x13'));var utils=require(_0x207a('0x14'));var config=require(_0x207a('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18d39f,_0x20ce67){_0x20ce67=_0x20ce67||0xcc;return function(_0x39e886){if(_0x39e886){return _0x18d39f['sendStatus'](_0x20ce67);}return _0x18d39f[_0x207a('0x16')](_0x20ce67)[_0x207a('0x17')]();};}function respondWithResult(_0xae35ec,_0x3f161f){_0x3f161f=_0x3f161f||0xc8;return function(_0x2865cd){if(_0x2865cd){return _0xae35ec['status'](_0x3f161f)[_0x207a('0x18')](_0x2865cd);}};}function respondWithFilteredResult(_0x5ed660,_0x201f87){return function(_0x2fbafd){if(_0x2fbafd){var _0x2edadb=_0x2fbafd[_0x207a('0x19')],_0x2ab68=_0x201f87[_0x207a('0x1a')],_0x4cfe8c=_0x201f87[_0x207a('0x1a')]+_0x201f87[_0x207a('0x1b')],_0x3e8db5;if(_0x4cfe8c>=_0x2edadb){_0x4cfe8c=_0x2edadb;_0x3e8db5=0xc8;}else{_0x3e8db5=0xce;}_0x5ed660['status'](_0x3e8db5);return _0x5ed660[_0x207a('0x1c')]('Content-Range',_0x2ab68+'-'+_0x4cfe8c+'/'+_0x2edadb)[_0x207a('0x18')](_0x2fbafd);}return null;};}function patchUpdates(_0x28246e){return function(_0x108c0c){try{jsonpatch[_0x207a('0x1d')](_0x108c0c,_0x28246e,!![]);}catch(_0x35150b){return BPromise[_0x207a('0x1e')](_0x35150b);}return _0x108c0c['save']();};}function saveUpdates(_0x104593,_0x30ff20){return function(_0x4ab87d){if(_0x4ab87d){return _0x4ab87d[_0x207a('0x1f')](_0x104593)[_0x207a('0x20')](function(_0x4734db){return _0x4734db;});}return null;};}function removeEntity(_0x30fe52,_0x215467){return function(_0x2d904a){if(_0x2d904a){return _0x2d904a[_0x207a('0x21')]()[_0x207a('0x20')](function(){_0x30fe52[_0x207a('0x16')](0xcc)[_0x207a('0x17')]();});}};}function handleEntityNotFound(_0x391cff,_0x3d793d){return function(_0x8ffe88){if(!_0x8ffe88){_0x391cff['sendStatus'](0x194);}return _0x8ffe88;};}function handleError(_0x9003c0,_0x1ac358){_0x1ac358=_0x1ac358||0x1f4;return function(_0x85233e){logger[_0x207a('0x22')](_0x85233e['stack']);if(_0x85233e[_0x207a('0x23')]){delete _0x85233e[_0x207a('0x23')];}_0x9003c0['status'](_0x1ac358)[_0x207a('0x24')](_0x85233e);};}exports['index']=function(_0x4f09c1,_0x3c81bd){var _0x5a378e={},_0x29b4cc={},_0x2df192={'count':0x0,'rows':[]};var _0x5e540f=_['map'](db[_0x207a('0x25')][_0x207a('0x26')],function(_0x5eb403){return{'name':_0x5eb403['fieldName'],'type':_0x5eb403[_0x207a('0x27')][_0x207a('0x28')]};});_0x29b4cc[_0x207a('0x29')]=_[_0x207a('0x2a')](_0x5e540f,_0x207a('0x23'));_0x29b4cc[_0x207a('0x2b')]=_[_0x207a('0x2c')](_0x4f09c1['query']);_0x29b4cc[_0x207a('0x2d')]=_[_0x207a('0x2e')](_0x29b4cc[_0x207a('0x29')],_0x29b4cc['query']);_0x5a378e['attributes']=_['intersection'](_0x29b4cc['model'],qs[_0x207a('0x2f')](_0x4f09c1[_0x207a('0x2b')][_0x207a('0x2f')]));_0x5a378e[_0x207a('0x30')]=_0x5a378e[_0x207a('0x30')][_0x207a('0x31')]?_0x5a378e[_0x207a('0x30')]:_0x29b4cc[_0x207a('0x29')];if(!_0x4f09c1[_0x207a('0x2b')][_0x207a('0x32')]('nolimit')){_0x5a378e[_0x207a('0x1b')]=qs[_0x207a('0x1b')](_0x4f09c1[_0x207a('0x2b')]['limit']);_0x5a378e['offset']=qs[_0x207a('0x1a')](_0x4f09c1[_0x207a('0x2b')]['offset']);}_0x5a378e[_0x207a('0x33')]=qs[_0x207a('0x34')](_0x4f09c1['query'][_0x207a('0x34')]);_0x5a378e[_0x207a('0x35')]=qs[_0x207a('0x2d')](_['pick'](_0x4f09c1[_0x207a('0x2b')],_0x29b4cc['filters']));if(_0x4f09c1['query'][_0x207a('0x36')]){_0x5a378e[_0x207a('0x35')]=_['merge'](_0x5a378e[_0x207a('0x35')],{'$or':_[_0x207a('0x2a')](_0x5e540f,function(_0x5d4df4){if(_0x5d4df4[_0x207a('0x27')]!==_0x207a('0x37')){var _0x1b100b={};_0x1b100b[_0x5d4df4[_0x207a('0x23')]]={'$like':'%'+_0x4f09c1[_0x207a('0x2b')]['filter']+'%'};return _0x1b100b;}})});}_0x5a378e=_[_0x207a('0x38')]({},_0x5a378e,_0x4f09c1[_0x207a('0x39')]);var _0xd24dc6={'where':_0x5a378e[_0x207a('0x35')]};return db[_0x207a('0x25')][_0x207a('0x19')](_0xd24dc6)[_0x207a('0x20')](function(_0x54b21c){_0x2df192[_0x207a('0x19')]=_0x54b21c;if(_0x4f09c1['query'][_0x207a('0x3a')]){_0x5a378e[_0x207a('0x3b')]=[{'all':!![]}];}return db['IntegrationReport'][_0x207a('0x3c')](_0x5a378e);})['then'](function(_0x1dde4f){_0x2df192[_0x207a('0x3d')]=_0x1dde4f;return _0x2df192;})[_0x207a('0x20')](respondWithFilteredResult(_0x3c81bd,_0x5a378e))[_0x207a('0x3e')](handleError(_0x3c81bd,null));};exports['show']=function(_0x798a62,_0x3cb5a9){var _0x3287e2={'raw':![],'where':{'id':_0x798a62[_0x207a('0x3f')]['id']}},_0xf7999f={};_0xf7999f[_0x207a('0x29')]=_['keys'](db[_0x207a('0x25')]['rawAttributes']);_0xf7999f['query']=_[_0x207a('0x2c')](_0x798a62['query']);_0xf7999f['filters']=_[_0x207a('0x2e')](_0xf7999f['model'],_0xf7999f[_0x207a('0x2b')]);_0x3287e2[_0x207a('0x30')]=_[_0x207a('0x2e')](_0xf7999f[_0x207a('0x29')],qs[_0x207a('0x2f')](_0x798a62[_0x207a('0x2b')][_0x207a('0x2f')]));_0x3287e2[_0x207a('0x30')]=_0x3287e2[_0x207a('0x30')]['length']?_0x3287e2['attributes']:_0xf7999f[_0x207a('0x29')];if(_0x798a62[_0x207a('0x2b')][_0x207a('0x3a')]){_0x3287e2[_0x207a('0x3b')]=[{'all':!![]}];}_0x3287e2=_[_0x207a('0x38')]({},_0x3287e2,_0x798a62[_0x207a('0x39')]);return db[_0x207a('0x25')][_0x207a('0x40')](_0x3287e2)[_0x207a('0x20')](handleEntityNotFound(_0x3cb5a9,null))[_0x207a('0x20')](respondWithResult(_0x3cb5a9,null))[_0x207a('0x3e')](handleError(_0x3cb5a9,null));};exports[_0x207a('0x41')]=function(_0x246237,_0x41738c){return db[_0x207a('0x25')][_0x207a('0x41')](_0x246237[_0x207a('0x42')],{})[_0x207a('0x20')](respondWithResult(_0x41738c,0xc9))[_0x207a('0x3e')](handleError(_0x41738c,null));};exports[_0x207a('0x1f')]=function(_0x1c743c,_0x1191ce){if(_0x1c743c[_0x207a('0x42')]['id']){delete _0x1c743c['body']['id'];}return db[_0x207a('0x25')][_0x207a('0x40')]({'where':{'id':_0x1c743c['params']['id']}})['then'](handleEntityNotFound(_0x1191ce,null))['then'](saveUpdates(_0x1c743c['body'],null))['then'](respondWithResult(_0x1191ce,null))[_0x207a('0x3e')](handleError(_0x1191ce,null));};exports['destroy']=function(_0x37c22d,_0xa6097){return db[_0x207a('0x25')][_0x207a('0x40')]({'where':{'id':_0x37c22d[_0x207a('0x3f')]['id']}})[_0x207a('0x20')](handleEntityNotFound(_0xa6097,null))['then'](removeEntity(_0xa6097,null))['catch'](handleError(_0xa6097,null));};exports[_0x207a('0x43')]=function(_0x24c1b2,_0x1bb615){return db[_0x207a('0x25')]['describe']()[_0x207a('0x20')](respondWithResult(_0x1bb615,null))[_0x207a('0x3e')](handleError(_0x1bb615,null));}; \ No newline at end of file +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 diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index dcf03b1..3d20c54 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 _0x86f7=['../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x18af0f,_0x37a72c){var _0x1ea52d=function(_0x7d9dee){while(--_0x7d9dee){_0x18af0f['push'](_0x18af0f['shift']());}};_0x1ea52d(++_0x37a72c);}(_0x86f7,0xf7));var _0x786f=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x86f7[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x786f('0x0'))(_0x786f('0x1'));var moment=require(_0x786f('0x2'));var BPromise=require(_0x786f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x786f('0x4'));var rimraf=require(_0x786f('0x5'));var config=require(_0x786f('0x6'));var attributes=require(_0x786f('0x7'));module[_0x786f('0x8')]=function(_0x27c7ac,_0x3791ec){return _0x27c7ac[_0x786f('0x9')](_0x786f('0xa'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 85f43d2..fd632b4 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 _0x0713=['IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x5d500c,_0x290419){var _0xcffbca=function(_0x103451){while(--_0x103451){_0x5d500c['push'](_0x5d500c['shift']());}};_0xcffbca(++_0x290419);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +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 diff --git a/server/api/interval/index.js b/server/api/interval/index.js index b490bd4..be13f92 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 _0x7217=['multer','path','connect-timeout','express','Router','../../components/auth/service','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','destroy','exports'];(function(_0x57306c,_0xdeff85){var _0x413cfb=function(_0x31c65b){while(--_0x31c65b){_0x57306c['push'](_0x57306c['shift']());}};_0x413cfb(++_0xdeff85);}(_0x7217,0x19e));var _0x7721=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x7217[_0x173d7e];return _0x2220d6;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var auth=require(_0x7721('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7721('0x6'));router[_0x7721('0x7')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0x9')]);router[_0x7721('0x7')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0xb')]);router[_0x7721('0x7')](_0x7721('0xc'),auth[_0x7721('0x8')](),controller[_0x7721('0xd')]);router[_0x7721('0xe')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0xf')]);router['post'](_0x7721('0xc'),auth[_0x7721('0x8')](),controller[_0x7721('0x10')]);router[_0x7721('0xe')](_0x7721('0x11'),auth[_0x7721('0x8')](),controller[_0x7721('0x12')]);router[_0x7721('0x13')]('/:id',auth[_0x7721('0x8')](),controller[_0x7721('0x14')]);router['delete'](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x15')]);module[_0x7721('0x16')]=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(_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 diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 7729473..c9c82bb 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 _0x7d3b=['STRING','sequelize'];(function(_0x49fdf9,_0x1860de){var _0x33c00d=function(_0x245da6){while(--_0x245da6){_0x49fdf9['push'](_0x49fdf9['shift']());}};_0x33c00d(++_0x1860de);}(_0x7d3b,0xa5));var _0xb7d3=function(_0x359b3c,_0x742d83){_0x359b3c=_0x359b3c-0x0;var _0x2a18ca=_0x7d3b[_0x359b3c];return _0x2a18ca;};'use strict';var Sequelize=require(_0xb7d3('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb7d3('0x1')]},'interval':{'type':Sequelize[_0xb7d3('0x1')],'allowNull':!![]}}; \ No newline at end of file +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 diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 17055ed..71e9ad3 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 _0x70e0=['findAll','rows','catch','show','keys','includeAll','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addInterval','getIntervals','findOne','order','hasOwnProperty','addIntervals','transaction','IntervalId','bulkCreate','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','../../components/extensions/rewrite','end','status','json','offset','limit','set','apply','update','destroy','then','get','Intervals','sendStatus','stack','name','send','index','rawAttributes','fieldName','key','model','map','intersection','query','attributes','fields','length','sort','pick','filters','filter','merge','where','type','VIRTUAL','options','Interval','count'];(function(_0x2730da,_0x1098bd){var _0xfe9991=function(_0x2ea521){while(--_0x2ea521){_0x2730da['push'](_0x2730da['shift']());}};_0xfe9991(++_0x1098bd);}(_0x70e0,0x17b));var _0x070e=function(_0x48612e,_0x5a01bb){_0x48612e=_0x48612e-0x0;var _0x5a6d9e=_0x70e0[_0x48612e];return _0x5a6d9e;};'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'];var extensions=require(_0x070e('0x16'));function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x17')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x18')](_0x4a33d2)[_0x070e('0x19')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=_0x373d86['count'],_0x180897=_0x5d3a38[_0x070e('0x1a')],_0x19d9da=_0x5d3a38[_0x070e('0x1a')]+_0x5d3a38[_0x070e('0x1b')],_0x5bc71e;if(_0x19d9da>=_0xeae1a5){_0x19d9da=_0xeae1a5;_0x5bc71e=0xc8;}else{_0x5bc71e=0xce;}_0x51d14d[_0x070e('0x18')](_0x5bc71e);return _0x51d14d[_0x070e('0x1c')]('Content-Range',_0x180897+'-'+_0x19d9da+'/'+_0xeae1a5)[_0x070e('0x19')](_0x373d86);}return null;};}function patchUpdates(_0x168dc6){return function(_0x1ad3de){try{jsonpatch[_0x070e('0x1d')](_0x1ad3de,_0x168dc6,!![]);}catch(_0x259893){return BPromise['reject'](_0x259893);}return _0x1ad3de['save']();};}function saveUpdates(_0x4e958f,_0x9907cf){return function(_0x3004f0){if(_0x3004f0){return _0x3004f0[_0x070e('0x1e')](_0x4e958f)['then'](function(_0x5b184){return _0x5b184;});}return null;};}function removeEntity(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x1f')]()[_0x070e('0x20')](function(){var _0x28a1c3=_0x3f6985[_0x070e('0x21')]({'plain':!![]});var _0xe405e=_0x070e('0x22');return db['UserProfileResource'][_0x070e('0x1f')]({'where':{'type':_0xe405e,'resourceId':_0x28a1c3['id']}})[_0x070e('0x20')](function(){return _0x3f6985;});})[_0x070e('0x20')](function(){_0x5dc5d2['status'](0xcc)[_0x070e('0x17')]();});}};}function handleEntityNotFound(_0x5f3e9d,_0x4a2dbd){return function(_0x2ccbd7){if(!_0x2ccbd7){_0x5f3e9d[_0x070e('0x23')](0x194);}return _0x2ccbd7;};}function handleError(_0x41deb1,_0x1743cc){_0x1743cc=_0x1743cc||0x1f4;return function(_0x4763c6){logger['error'](_0x4763c6[_0x070e('0x24')]);if(_0x4763c6[_0x070e('0x25')]){delete _0x4763c6[_0x070e('0x25')];}_0x41deb1[_0x070e('0x18')](_0x1743cc)[_0x070e('0x26')](_0x4763c6);};}exports[_0x070e('0x27')]=function(_0x1a1892,_0x26373b){var _0x5e8326={},_0x282344={},_0x351641={'count':0x0,'rows':[]};var _0x3a16d0=_['map'](db['Interval'][_0x070e('0x28')],function(_0x46065c){return{'name':_0x46065c[_0x070e('0x29')],'type':_0x46065c['type'][_0x070e('0x2a')]};});_0x282344[_0x070e('0x2b')]=_[_0x070e('0x2c')](_0x3a16d0,_0x070e('0x25'));_0x282344['query']=_['keys'](_0x1a1892['query']);_0x282344['filters']=_[_0x070e('0x2d')](_0x282344['model'],_0x282344[_0x070e('0x2e')]);_0x5e8326[_0x070e('0x2f')]=_['intersection'](_0x282344['model'],qs[_0x070e('0x30')](_0x1a1892[_0x070e('0x2e')]['fields']));_0x5e8326['attributes']=_0x5e8326[_0x070e('0x2f')][_0x070e('0x31')]?_0x5e8326[_0x070e('0x2f')]:_0x282344[_0x070e('0x2b')];if(!_0x1a1892[_0x070e('0x2e')]['hasOwnProperty']('nolimit')){_0x5e8326[_0x070e('0x1b')]=qs[_0x070e('0x1b')](_0x1a1892[_0x070e('0x2e')][_0x070e('0x1b')]);_0x5e8326[_0x070e('0x1a')]=qs['offset'](_0x1a1892[_0x070e('0x2e')][_0x070e('0x1a')]);}_0x5e8326['order']=qs[_0x070e('0x32')](_0x1a1892[_0x070e('0x2e')]['sort']);_0x5e8326['where']=qs['filters'](_[_0x070e('0x33')](_0x1a1892[_0x070e('0x2e')],_0x282344[_0x070e('0x34')]));if(_0x1a1892[_0x070e('0x2e')][_0x070e('0x35')]){_0x5e8326['where']=_[_0x070e('0x36')](_0x5e8326[_0x070e('0x37')],{'$or':_[_0x070e('0x2c')](_0x3a16d0,function(_0x487276){if(_0x487276[_0x070e('0x38')]!==_0x070e('0x39')){var _0x165c16={};_0x165c16[_0x487276['name']]={'$like':'%'+_0x1a1892[_0x070e('0x2e')][_0x070e('0x35')]+'%'};return _0x165c16;}})});}_0x5e8326=_['merge']({},_0x5e8326,_0x1a1892[_0x070e('0x3a')]);var _0x5d689b={'where':_0x5e8326[_0x070e('0x37')]};return db[_0x070e('0x3b')][_0x070e('0x3c')](_0x5d689b)[_0x070e('0x20')](function(_0xd03404){_0x351641['count']=_0xd03404;if(_0x1a1892[_0x070e('0x2e')]['includeAll']){_0x5e8326['include']=[{'all':!![]}];}return db[_0x070e('0x3b')][_0x070e('0x3d')](_0x5e8326);})[_0x070e('0x20')](function(_0x4d52ff){_0x351641[_0x070e('0x3e')]=_0x4d52ff;return _0x351641;})[_0x070e('0x20')](respondWithFilteredResult(_0x26373b,_0x5e8326))[_0x070e('0x3f')](handleError(_0x26373b,null));};exports[_0x070e('0x40')]=function(_0x4a4ee3,_0x13e4e0){var _0x5851ab={'raw':!![],'where':{'id':_0x4a4ee3['params']['id']}},_0x544b53={};_0x544b53[_0x070e('0x2b')]=_[_0x070e('0x41')](db[_0x070e('0x3b')][_0x070e('0x28')]);_0x544b53[_0x070e('0x2e')]=_['keys'](_0x4a4ee3[_0x070e('0x2e')]);_0x544b53['filters']=_[_0x070e('0x2d')](_0x544b53[_0x070e('0x2b')],_0x544b53[_0x070e('0x2e')]);_0x5851ab['attributes']=_['intersection'](_0x544b53[_0x070e('0x2b')],qs['fields'](_0x4a4ee3[_0x070e('0x2e')][_0x070e('0x30')]));_0x5851ab[_0x070e('0x2f')]=_0x5851ab['attributes'][_0x070e('0x31')]?_0x5851ab[_0x070e('0x2f')]:_0x544b53['model'];if(_0x4a4ee3['query'][_0x070e('0x42')]){_0x5851ab[_0x070e('0x43')]=[{'all':!![]}];}_0x5851ab=_[_0x070e('0x36')]({},_0x5851ab,_0x4a4ee3[_0x070e('0x3a')]);return db[_0x070e('0x3b')]['find'](_0x5851ab)[_0x070e('0x20')](handleEntityNotFound(_0x13e4e0,null))[_0x070e('0x20')](respondWithResult(_0x13e4e0,null))[_0x070e('0x3f')](handleError(_0x13e4e0,null));};exports[_0x070e('0x44')]=function(_0x79eaa0,_0xcd1c61){return db[_0x070e('0x3b')][_0x070e('0x44')](_0x79eaa0[_0x070e('0x45')],{})[_0x070e('0x20')](function(_0x210c4d){var _0x3be553=_0x79eaa0[_0x070e('0x46')][_0x070e('0x21')]({'plain':!![]});if(!_0x3be553)throw new Error(_0x070e('0x47'));if(_0x3be553['role']===_0x070e('0x46')){var _0xa7a41b=_0x210c4d[_0x070e('0x21')]({'plain':!![]});var _0x249e3f=_0x070e('0x22');return db[_0x070e('0x48')][_0x070e('0x49')]({'where':{'name':_0x249e3f,'userProfileId':_0x3be553[_0x070e('0x4a')]},'raw':!![]})[_0x070e('0x20')](function(_0x5744c5){if(_0x5744c5&&_0x5744c5[_0x070e('0x4b')]===0x0){return db['UserProfileResource'][_0x070e('0x44')]({'name':_0xa7a41b[_0x070e('0x25')],'resourceId':_0xa7a41b['id'],'type':_0x5744c5['name'],'sectionId':_0x5744c5['id']},{})[_0x070e('0x20')](function(){return _0x210c4d;});}else{return _0x210c4d;}})[_0x070e('0x3f')](function(_0x25466f){logger[_0x070e('0x4c')](_0x070e('0x4d'),_0x25466f);throw _0x25466f;});}return _0x210c4d;})[_0x070e('0x20')](respondWithResult(_0xcd1c61,0xc9))[_0x070e('0x3f')](handleError(_0xcd1c61,null));};exports['update']=function(_0x296978,_0x5bacbd){if(_0x296978['body']['id']){delete _0x296978[_0x070e('0x45')]['id'];}return db[_0x070e('0x3b')][_0x070e('0x49')]({'where':{'id':_0x296978[_0x070e('0x4e')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x5bacbd,null))[_0x070e('0x20')](saveUpdates(_0x296978[_0x070e('0x45')],null))[_0x070e('0x20')](respondWithResult(_0x5bacbd,null))['catch'](handleError(_0x5bacbd,null));};exports[_0x070e('0x1f')]=function(_0x51d27d,_0x564d82){return db[_0x070e('0x3b')][_0x070e('0x49')]({'where':{'id':_0x51d27d['params']['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x564d82,null))[_0x070e('0x20')](removeEntity(_0x564d82,null))[_0x070e('0x3f')](handleError(_0x564d82,null));};exports[_0x070e('0x4f')]=function(_0x1aacfc,_0x382ce3,_0x1b36cd){if(_0x1aacfc['body']['id']){delete _0x1aacfc['body']['id'];}return db['Interval'][_0x070e('0x49')]({'where':{'id':_0x1aacfc[_0x070e('0x4e')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x382ce3,null))[_0x070e('0x20')](function(_0x5ac0b5){if(_0x5ac0b5){_0x1aacfc[_0x070e('0x45')]['IntervalId']=_0x5ac0b5['id'];return db[_0x070e('0x3b')][_0x070e('0x44')](_0x1aacfc[_0x070e('0x45')]);}})[_0x070e('0x20')](respondWithResult(_0x382ce3,null))[_0x070e('0x3f')](handleError(_0x382ce3,null));};exports[_0x070e('0x50')]=function(_0x5561ed,_0x20ff87,_0x18e8d0){var _0x8aaf00={};var _0x533431={};var _0x1d7873;var _0x1da803;return db['Interval'][_0x070e('0x51')]({'where':{'id':_0x5561ed['params']['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x20ff87,null))['then'](function(_0x4cb86f){if(_0x4cb86f){_0x1d7873=_0x4cb86f;_0x533431['model']=_[_0x070e('0x41')](db[_0x070e('0x3b')][_0x070e('0x28')]);_0x533431[_0x070e('0x2e')]=_[_0x070e('0x41')](_0x5561ed[_0x070e('0x2e')]);_0x533431['filters']=_[_0x070e('0x2d')](_0x533431['model'],_0x533431[_0x070e('0x2e')]);_0x8aaf00['attributes']=_[_0x070e('0x2d')](_0x533431[_0x070e('0x2b')],qs['fields'](_0x5561ed[_0x070e('0x2e')]['fields']));_0x8aaf00[_0x070e('0x2f')]=_0x8aaf00[_0x070e('0x2f')][_0x070e('0x31')]?_0x8aaf00[_0x070e('0x2f')]:_0x533431[_0x070e('0x2b')];_0x8aaf00[_0x070e('0x52')]=qs[_0x070e('0x32')](_0x5561ed[_0x070e('0x2e')][_0x070e('0x32')]);_0x8aaf00[_0x070e('0x37')]=qs[_0x070e('0x34')](_[_0x070e('0x33')](_0x5561ed[_0x070e('0x2e')],_0x533431[_0x070e('0x34')]));if(_0x5561ed['query'][_0x070e('0x35')]){_0x8aaf00[_0x070e('0x37')]=_[_0x070e('0x36')](_0x8aaf00[_0x070e('0x37')],{'$or':_['map'](_0x8aaf00[_0x070e('0x2f')],function(_0x4e8e58){var _0x398f54={};_0x398f54[_0x4e8e58]={'$like':'%'+_0x5561ed[_0x070e('0x2e')][_0x070e('0x35')]+'%'};return _0x398f54;})});}_0x8aaf00=_[_0x070e('0x36')]({},_0x8aaf00,_0x5561ed['options']);return _0x1d7873[_0x070e('0x50')](_0x8aaf00);}})[_0x070e('0x20')](function(_0x240ec9){if(_0x240ec9){_0x1da803=_0x240ec9[_0x070e('0x31')];if(!_0x5561ed['query'][_0x070e('0x53')]('nolimit')){_0x8aaf00[_0x070e('0x1b')]=qs[_0x070e('0x1b')](_0x5561ed[_0x070e('0x2e')][_0x070e('0x1b')]);_0x8aaf00[_0x070e('0x1a')]=qs['offset'](_0x5561ed[_0x070e('0x2e')][_0x070e('0x1a')]);}return _0x1d7873[_0x070e('0x50')](_0x8aaf00);}})[_0x070e('0x20')](function(_0x5591dd){if(_0x5591dd){return _0x5591dd?{'count':_0x1da803,'rows':_0x5591dd}:null;}})[_0x070e('0x20')](respondWithResult(_0x20ff87,null))['catch'](handleError(_0x20ff87,null));};exports[_0x070e('0x54')]=function(_0x44e465,_0x1214d2,_0x57585e){return db[_0x070e('0x3b')]['findOne']({'where':{'id':_0x44e465[_0x070e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1214d2,null))[_0x070e('0x20')](function(_0x17b28c){if(_0x17b28c){return db['sequelize'][_0x070e('0x55')](function(_0x53f9a8){return db[_0x070e('0x3b')][_0x070e('0x1f')]({'where':{'IntervalId':_0x44e465['params']['id']},'transaction':_0x53f9a8})['then'](function(_0x29ee66){var _0x3022cd=_[_0x070e('0x2c')](_0x44e465[_0x070e('0x45')],function(_0x25f1d0){delete _0x25f1d0['id'];_0x25f1d0[_0x070e('0x56')]=_0x44e465[_0x070e('0x4e')]['id'];return _0x25f1d0;});return db[_0x070e('0x3b')][_0x070e('0x57')](_0x3022cd,{'transaction':_0x53f9a8});});})[_0x070e('0x20')](function(){return db[_0x070e('0x3b')][_0x070e('0x3d')]({'where':{'IntervalId':_0x44e465[_0x070e('0x4e')]['id']}});});}})['then'](respondWithResult(_0x1214d2,null))[_0x070e('0x3f')](handleError(_0x1214d2,null));}; \ No newline at end of file +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 diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index c32b614..ee3f34b 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 _0x876b=['tools_intervals','rewrite','../../config/logger','api','request-promise','path','../../config/environment','./interval.attributes','../../components/extensions/rewrite','Interval'];(function(_0x14d896,_0x53578b){var _0x28679a=function(_0x14921f){while(--_0x14921f){_0x14d896['push'](_0x14d896['shift']());}};_0x28679a(++_0x53578b);}(_0x876b,0x1ba));var _0xb876=function(_0x3161a1,_0x21be28){_0x3161a1=_0x3161a1-0x0;var _0x4d0cc0=_0x876b[_0x3161a1];return _0x4d0cc0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb876('0x0'))(_0xb876('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb876('0x2'));var fs=require('fs');var path=require(_0xb876('0x3'));var rimraf=require('rimraf');var config=require(_0xb876('0x4'));var attributes=require(_0xb876('0x5'));var extensions=require(_0xb876('0x6'));module['exports']=function(_0x275125,_0x4353cf){return _0x275125['define'](_0xb876('0x7'),attributes,{'tableName':_0xb876('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1a79d3,_0x2e5760){extensions['rewrite'](_0x275125,_0x1a79d3);},'afterBulkCreate':function(_0x45bd6f,_0x488dc4,_0x4770a2){_0x4770a2();extensions[_0xb876('0x9')](_0x275125,_0x45bd6f[0x0]);},'afterUpdate':function(_0x59a812,_0x5cd511){extensions['rewrite'](_0x275125,_0x59a812);},'afterDestroy':function(_0x9e5a93,_0x5a0da3){extensions[_0xb876('0x9')](_0x275125,_0x9e5a93);}}});}; \ No newline at end of file +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 diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 40c477b..73af0a1 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 _0xdaa2=['message','catch','GetInterval','findAll','options','raw','limit','map','include','model','attributes','ShowInterval','find','where','lodash','util','../../config/logger','../../config/environment','jayson/promise','http','then','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdaa2,0x1a4));var _0x2daa=function(_0x3ce87c,_0x32ef6f){_0x3ce87c=_0x3ce87c-0x0;var _0x3463f8=_0xdaa2[_0x3ce87c];return _0x3463f8;};'use strict';var _=require(_0x2daa('0x0'));var util=require(_0x2daa('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2daa('0x2'))('rpc');var config=require(_0x2daa('0x3'));var jayson=require(_0x2daa('0x4'));var client=jayson['client'][_0x2daa('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x28eea7,_0x333b46,_0x463441){return new BPromise(function(_0x2327d2,_0x5715f9){return client['request'](_0x28eea7,_0x463441)[_0x2daa('0x6')](function(_0x2ae11b){logger[_0x2daa('0x7')](_0x2daa('0x8'),_0x333b46,_0x2daa('0x9'));logger[_0x2daa('0xa')](_0x2daa('0xb'),_0x333b46,'request\x20sent',JSON[_0x2daa('0xc')](_0x2ae11b));if(_0x2ae11b[_0x2daa('0xd')]){if(_0x2ae11b[_0x2daa('0xd')][_0x2daa('0xe')]===0x1f4){logger[_0x2daa('0xd')](_0x2daa('0x8'),_0x333b46,_0x2ae11b[_0x2daa('0xd')]['message']);return _0x5715f9(_0x2ae11b[_0x2daa('0xd')][_0x2daa('0xf')]);}logger[_0x2daa('0xd')](_0x2daa('0x8'),_0x333b46,_0x2ae11b[_0x2daa('0xd')][_0x2daa('0xf')]);return _0x2327d2(_0x2ae11b[_0x2daa('0xd')][_0x2daa('0xf')]);}else{logger['info'](_0x2daa('0x8'),_0x333b46,_0x2daa('0x9'));_0x2327d2(_0x2ae11b['result'][_0x2daa('0xf')]);}})[_0x2daa('0x10')](function(_0x2e5ee4){logger[_0x2daa('0xd')]('Interval,\x20%s,\x20%s',_0x333b46,_0x2e5ee4);_0x5715f9(_0x2e5ee4);});});}exports[_0x2daa('0x11')]=function(_0x3fc4b8){var _0x2d7daf=this;return new Promise(function(_0x208a59,_0x66645d){return db['Interval'][_0x2daa('0x12')]({'raw':_0x3fc4b8[_0x2daa('0x13')]?_0x3fc4b8['options'][_0x2daa('0x14')]===undefined?!![]:![]:!![],'where':_0x3fc4b8[_0x2daa('0x13')]?_0x3fc4b8[_0x2daa('0x13')]['where']||null:null,'attributes':_0x3fc4b8[_0x2daa('0x13')]?_0x3fc4b8[_0x2daa('0x13')]['attributes']||null:null,'limit':_0x3fc4b8[_0x2daa('0x13')]?_0x3fc4b8[_0x2daa('0x13')][_0x2daa('0x15')]||null:null,'include':_0x3fc4b8['options']?_0x3fc4b8[_0x2daa('0x13')]['include']?_[_0x2daa('0x16')](_0x3fc4b8[_0x2daa('0x13')][_0x2daa('0x17')],function(_0x34663c){return{'model':db[_0x34663c[_0x2daa('0x18')]],'as':_0x34663c['as'],'attributes':_0x34663c[_0x2daa('0x19')],'include':_0x34663c['include']?_[_0x2daa('0x16')](_0x34663c[_0x2daa('0x17')],function(_0x15f93b){return{'model':db[_0x15f93b[_0x2daa('0x18')]],'as':_0x15f93b['as'],'attributes':_0x15f93b['attributes'],'include':_0x15f93b['include']?_['map'](_0x15f93b[_0x2daa('0x17')],function(_0x291bd3){return{'model':db[_0x291bd3[_0x2daa('0x18')]],'as':_0x291bd3['as'],'attributes':_0x291bd3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x180459){logger[_0x2daa('0x7')](_0x2daa('0x11'),_0x3fc4b8);logger[_0x2daa('0xa')](_0x2daa('0x11'),_0x3fc4b8,JSON[_0x2daa('0xc')](_0x180459));_0x208a59(_0x180459);})[_0x2daa('0x10')](function(_0x39e06d){logger[_0x2daa('0xd')](_0x2daa('0x11'),_0x39e06d[_0x2daa('0xf')],_0x3fc4b8);_0x66645d(_0x2d7daf[_0x2daa('0xd')](0x1f4,_0x39e06d[_0x2daa('0xf')]));});});};exports[_0x2daa('0x1a')]=function(_0x50df8a){var _0x49381b=this;return new Promise(function(_0x268353,_0x168c3d){return db['Interval'][_0x2daa('0x1b')]({'raw':_0x50df8a[_0x2daa('0x13')]?_0x50df8a[_0x2daa('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x50df8a[_0x2daa('0x13')]?_0x50df8a[_0x2daa('0x13')][_0x2daa('0x1c')]||null:null,'attributes':_0x50df8a[_0x2daa('0x13')]?_0x50df8a[_0x2daa('0x13')][_0x2daa('0x19')]||null:null,'include':_0x50df8a[_0x2daa('0x13')]?_0x50df8a[_0x2daa('0x13')][_0x2daa('0x17')]?_[_0x2daa('0x16')](_0x50df8a[_0x2daa('0x13')][_0x2daa('0x17')],function(_0x34bb7e){return{'model':db[_0x34bb7e[_0x2daa('0x18')]],'as':_0x34bb7e['as'],'attributes':_0x34bb7e[_0x2daa('0x19')],'include':_0x34bb7e[_0x2daa('0x17')]?_[_0x2daa('0x16')](_0x34bb7e[_0x2daa('0x17')],function(_0x5b41d0){return{'model':db[_0x5b41d0[_0x2daa('0x18')]],'as':_0x5b41d0['as'],'attributes':_0x5b41d0[_0x2daa('0x19')],'include':_0x5b41d0['include']?_[_0x2daa('0x16')](_0x5b41d0['include'],function(_0x4c89c8){return{'model':db[_0x4c89c8['model']],'as':_0x4c89c8['as'],'attributes':_0x4c89c8[_0x2daa('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1598b4){logger[_0x2daa('0x7')](_0x2daa('0x1a'),_0x50df8a);logger[_0x2daa('0xa')](_0x2daa('0x1a'),_0x50df8a,JSON[_0x2daa('0xc')](_0x1598b4));_0x268353(_0x1598b4);})[_0x2daa('0x10')](function(_0x47105f){logger[_0x2daa('0xd')]('ShowInterval',_0x47105f[_0x2daa('0xf')],_0x50df8a);_0x168c3d(_0x49381b[_0x2daa('0xd')](0x1f4,_0x47105f[_0x2daa('0xf')]));});});}; \ No newline at end of file +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 diff --git a/server/api/jira/index.js b/server/api/jira/index.js index e26a287..d6bf13d 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 _0xe141=['Router','../../components/auth/service','./jira.controller','send','exports','express'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe141,0x17f));var _0x1e14=function(_0x361d3f,_0x3be2aa){_0x361d3f=_0x361d3f-0x0;var _0x320229=_0xe141[_0x361d3f];return _0x320229;};'use strict';var express=require(_0x1e14('0x0'));var router=express[_0x1e14('0x1')]();var auth=require(_0x1e14('0x2'));var controller=require(_0x1e14('0x3'));router['post']('/',auth['isAuthenticated'](),controller[_0x1e14('0x4')]);module[_0x1e14('0x5')]=router; \ No newline at end of file +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 diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 5f22fff..698c599 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 _0x24f1=['stringify','request','data','status','statusCode','json','parse','error','api.jira','write','end','send','body','headers','x-forwarded-for','connection','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','issuetype','Bug','fields','customfield_11500','email','oldToken','newToken','customfield_11503','name','customfield_11504','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64'];(function(_0x498692,_0x3d73d2){var _0x34124b=function(_0x4ff007){while(--_0x4ff007){_0x498692['push'](_0x498692['shift']());}};_0x34124b(++_0x3d73d2);}(_0x24f1,0x1af));var _0x124f=function(_0x1f007d,_0x171049){_0x1f007d=_0x1f007d-0x0;var _0x45255d=_0x24f1[_0x1f007d];return _0x45255d;};'use strict';var BPromise=require(_0x124f('0x0'));var https=require(_0x124f('0x1'));var logger=require(_0x124f('0x2'))(_0x124f('0x3'));var USERNAME=_0x124f('0x4');var PASSWORD=_0x124f('0x5');function openIssue(_0x4f3073,_0x27dcf5){var _0xa370ed={'fields':{'project':{'key':_0x4f3073[_0x124f('0x6')]||_0x124f('0x7')},'summary':(_0x4f3073[_0x124f('0x8')]||_0x124f('0x9'))+_0x124f('0xa')+_0x4f3073['ip'],'description':_0x4f3073['description']||JSON['stringify'](_0x4f3073),'issuetype':{'name':_0x4f3073[_0x124f('0xb')]||_0x124f('0xc')}}};_0xa370ed[_0x124f('0xd')][_0x124f('0xe')]=_0x4f3073[_0x124f('0xf')];_0xa370ed[_0x124f('0xd')]['customfield_11501']=_0x4f3073[_0x124f('0x10')];_0xa370ed[_0x124f('0xd')]['customfield_11502']=_0x4f3073[_0x124f('0x11')];_0xa370ed[_0x124f('0xd')][_0x124f('0x12')]=_0x4f3073[_0x124f('0x13')];_0xa370ed[_0x124f('0xd')][_0x124f('0x14')]=_0x4f3073['reason'];_0xa370ed['fields'][_0x124f('0x15')]=_0x4f3073['ip'];var _0x289bde={'host':_0x124f('0x16'),'port':0x1bb,'path':_0x124f('0x17'),'method':_0x124f('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0x124f('0x19'),'Authorization':_0x124f('0x1a')+new Buffer(USERNAME+':'+PASSWORD)[_0x124f('0x1b')](_0x124f('0x1c'))}};var _0x21d4f7=JSON[_0x124f('0x1d')](_0xa370ed);var _0x50eaf4=https[_0x124f('0x1e')](_0x289bde,function(_0x436360){_0x436360['setEncoding']('utf8');var _0x4aa915='';_0x436360['on'](_0x124f('0x1f'),function(_0x21da81){_0x4aa915+=_0x21da81;});_0x436360['on']('end',function(){if(_0x27dcf5){return _0x27dcf5[_0x124f('0x20')](_0x436360[_0x124f('0x21')])[_0x124f('0x22')](JSON[_0x124f('0x23')](_0x4aa915));}});});_0x50eaf4['on'](_0x124f('0x24'),function(_0x48827d){if(_0x27dcf5){return _0x27dcf5[_0x124f('0x20')](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x124f('0x25')}]});}});_0x50eaf4[_0x124f('0x26')](_0x21d4f7);_0x50eaf4[_0x124f('0x27')]();}exports['openIssue']=openIssue;exports[_0x124f('0x28')]=function(_0x3166cb,_0x12e5a5){_0x3166cb[_0x124f('0x29')]['ip']=_0x3166cb[_0x124f('0x2a')][_0x124f('0x2b')]||_0x3166cb[_0x124f('0x2c')]['remoteAddress']||_0x3166cb[_0x124f('0x2d')]['remoteAddress']||_0x3166cb['connection'][_0x124f('0x2d')]['remoteAddress'];return openIssue(_0x3166cb['body'],_0x12e5a5);}; \ No newline at end of file +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 diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index ae74452..1e23cf3 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 _0xd923=['../../components/interaction/service','./jscriptyAnswerReport.controller','isAuthenticated','get','describe','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x341095,_0x4b00e6){var _0x51e224=function(_0x5db840){while(--_0x5db840){_0x341095['push'](_0x341095['shift']());}};_0x51e224(++_0x4b00e6);}(_0xd923,0x18b));var _0x3d92=function(_0x3332ac,_0x9aaa68){_0x3332ac=_0x3332ac-0x0;var _0x341e28=_0xd923[_0x3332ac];return _0x341e28;};'use strict';var multer=require('multer');var util=require(_0x3d92('0x0'));var path=require(_0x3d92('0x1'));var timeout=require(_0x3d92('0x2'));var express=require(_0x3d92('0x3'));var router=express['Router']();var auth=require(_0x3d92('0x4'));var interaction=require(_0x3d92('0x5'));var config=require('../../config/environment');var controller=require(_0x3d92('0x6'));router['get']('/',auth[_0x3d92('0x7')](),controller['index']);router[_0x3d92('0x8')]('/describe',auth[_0x3d92('0x7')](),controller[_0x3d92('0x9')]);router[_0x3d92('0x8')]('/:id',auth[_0x3d92('0x7')](),controller['show']);router[_0x3d92('0xa')]('/',auth['isAuthenticated'](),controller[_0x3d92('0xb')]);router['put'](_0x3d92('0xc'),auth[_0x3d92('0x7')](),controller['update']);router[_0x3d92('0xd')](_0x3d92('0xc'),auth[_0x3d92('0x7')](),controller[_0x3d92('0xe')]);module[_0x3d92('0xf')]=router; \ No newline at end of file +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 diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 7a5cc5d..977823a 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 _0x0845=['TEXT','long','STRING','sequelize','exports'];(function(_0x4df69e,_0x5131d5){var _0x1f9041=function(_0x1e6288){while(--_0x1e6288){_0x4df69e['push'](_0x4df69e['shift']());}};_0x1f9041(++_0x5131d5);}(_0x0845,0x1f2));var _0x5084=function(_0x461e9e,_0x5514ad){_0x461e9e=_0x461e9e-0x0;var _0x5b6061=_0x0845[_0x461e9e];return _0x5b6061;};'use strict';var Sequelize=require(_0x5084('0x0'));module[_0x5084('0x1')]={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize[_0x5084('0x2')](_0x5084('0x3'))},'membername':{'type':Sequelize[_0x5084('0x4')]},'projectname':{'type':Sequelize[_0x5084('0x4')]},'queue':{'type':Sequelize[_0x5084('0x4')]},'uniqueid':{'type':Sequelize[_0x5084('0x4')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x5084('0x4')]},'questionId':{'type':Sequelize[_0x5084('0x4')]}}; \ No newline at end of file +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 diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 29acad4..f1083a8 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 _0x3ce9=['body','find','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','status','json','count','offset','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','index','map','JscriptyAnswerReport','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','pick','filter','where','merge','options','include','rows','catch','params','keys','rawAttributes','includeAll','create'];(function(_0x281052,_0x4089bb){var _0xae6dfe=function(_0x335bd5){while(--_0x335bd5){_0x281052['push'](_0x281052['shift']());}};_0xae6dfe(++_0x4089bb);}(_0x3ce9,0x85));var _0x93ce=function(_0x30aa58,_0x1a1fd4){_0x30aa58=_0x30aa58-0x0;var _0x4a45dd=_0x3ce9[_0x30aa58];return _0x4a45dd;};'use strict';var pdf=require(_0x93ce('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x93ce('0x1'));var zipdir=require(_0x93ce('0x2'));var jsonpatch=require(_0x93ce('0x3'));var rp=require(_0x93ce('0x4'));var moment=require(_0x93ce('0x5'));var BPromise=require(_0x93ce('0x6'));var Mustache=require('mustache');var util=require(_0x93ce('0x7'));var path=require(_0x93ce('0x8'));var sox=require(_0x93ce('0x9'));var csv=require(_0x93ce('0xa'));var ejs=require(_0x93ce('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x93ce('0xc'));var crypto=require(_0x93ce('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x93ce('0xe'));var Papa=require('papaparse');var Redis=require(_0x93ce('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x93ce('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x93ce('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d326a,_0x2bb32c){_0x2bb32c=_0x2bb32c||0xcc;return function(_0x17302d){if(_0x17302d){return _0x1d326a['sendStatus'](_0x2bb32c);}return _0x1d326a[_0x93ce('0x12')](_0x2bb32c)['end']();};}function respondWithResult(_0x37d198,_0x175e00){_0x175e00=_0x175e00||0xc8;return function(_0x4de84e){if(_0x4de84e){return _0x37d198['status'](_0x175e00)[_0x93ce('0x13')](_0x4de84e);}};}function respondWithFilteredResult(_0x549f83,_0x15a719){return function(_0x4bc3e1){if(_0x4bc3e1){var _0xecc51b=_0x4bc3e1[_0x93ce('0x14')],_0x5cd45f=_0x15a719[_0x93ce('0x15')],_0x20323f=_0x15a719[_0x93ce('0x15')]+_0x15a719['limit'],_0x6f74cf;if(_0x20323f>=_0xecc51b){_0x20323f=_0xecc51b;_0x6f74cf=0xc8;}else{_0x6f74cf=0xce;}_0x549f83[_0x93ce('0x12')](_0x6f74cf);return _0x549f83[_0x93ce('0x16')](_0x93ce('0x17'),_0x5cd45f+'-'+_0x20323f+'/'+_0xecc51b)[_0x93ce('0x13')](_0x4bc3e1);}return null;};}function patchUpdates(_0x2071ac){return function(_0x25be3b){try{jsonpatch['apply'](_0x25be3b,_0x2071ac,!![]);}catch(_0x4d33de){return BPromise[_0x93ce('0x18')](_0x4d33de);}return _0x25be3b[_0x93ce('0x19')]();};}function saveUpdates(_0x11c534,_0x1b46a4){return function(_0x4166c8){if(_0x4166c8){return _0x4166c8[_0x93ce('0x1a')](_0x11c534)[_0x93ce('0x1b')](function(_0x30172d){return _0x30172d;});}return null;};}function removeEntity(_0x563c21,_0x38b308){return function(_0x2c8595){if(_0x2c8595){return _0x2c8595[_0x93ce('0x1c')]()[_0x93ce('0x1b')](function(){_0x563c21['status'](0xcc)[_0x93ce('0x1d')]();});}};}function handleEntityNotFound(_0x49ecf4,_0xcb26b3){return function(_0x5d35dc){if(!_0x5d35dc){_0x49ecf4['sendStatus'](0x194);}return _0x5d35dc;};}function handleError(_0x337edb,_0x2aa61b){_0x2aa61b=_0x2aa61b||0x1f4;return function(_0x3613e9){logger[_0x93ce('0x1e')](_0x3613e9[_0x93ce('0x1f')]);if(_0x3613e9[_0x93ce('0x20')]){delete _0x3613e9[_0x93ce('0x20')];}_0x337edb[_0x93ce('0x12')](_0x2aa61b)['send'](_0x3613e9);};}exports[_0x93ce('0x21')]=function(_0x24ce92,_0x2dabdc){var _0x56332a={},_0x105ac6={},_0x6eaecb={'count':0x0,'rows':[]};var _0x442fc9=_[_0x93ce('0x22')](db[_0x93ce('0x23')]['rawAttributes'],function(_0x27f208){return{'name':_0x27f208[_0x93ce('0x24')],'type':_0x27f208[_0x93ce('0x25')]['key']};});_0x105ac6[_0x93ce('0x26')]=_[_0x93ce('0x22')](_0x442fc9,_0x93ce('0x20'));_0x105ac6[_0x93ce('0x27')]=_['keys'](_0x24ce92[_0x93ce('0x27')]);_0x105ac6[_0x93ce('0x28')]=_[_0x93ce('0x29')](_0x105ac6[_0x93ce('0x26')],_0x105ac6[_0x93ce('0x27')]);_0x56332a['attributes']=_[_0x93ce('0x29')](_0x105ac6['model'],qs[_0x93ce('0x2a')](_0x24ce92[_0x93ce('0x27')]['fields']));_0x56332a[_0x93ce('0x2b')]=_0x56332a[_0x93ce('0x2b')][_0x93ce('0x2c')]?_0x56332a[_0x93ce('0x2b')]:_0x105ac6[_0x93ce('0x26')];if(!_0x24ce92[_0x93ce('0x27')][_0x93ce('0x2d')]('nolimit')){_0x56332a['limit']=qs[_0x93ce('0x2e')](_0x24ce92[_0x93ce('0x27')][_0x93ce('0x2e')]);_0x56332a[_0x93ce('0x15')]=qs[_0x93ce('0x15')](_0x24ce92[_0x93ce('0x27')][_0x93ce('0x15')]);}_0x56332a[_0x93ce('0x2f')]=qs[_0x93ce('0x30')](_0x24ce92[_0x93ce('0x27')][_0x93ce('0x30')]);_0x56332a['where']=qs[_0x93ce('0x28')](_[_0x93ce('0x31')](_0x24ce92[_0x93ce('0x27')],_0x105ac6[_0x93ce('0x28')]));if(_0x24ce92[_0x93ce('0x27')][_0x93ce('0x32')]){_0x56332a[_0x93ce('0x33')]=_[_0x93ce('0x34')](_0x56332a['where'],{'$or':_[_0x93ce('0x22')](_0x442fc9,function(_0x2e74a2){if(_0x2e74a2['type']!=='VIRTUAL'){var _0x1fcca7={};_0x1fcca7[_0x2e74a2[_0x93ce('0x20')]]={'$like':'%'+_0x24ce92[_0x93ce('0x27')][_0x93ce('0x32')]+'%'};return _0x1fcca7;}})});}_0x56332a=_[_0x93ce('0x34')]({},_0x56332a,_0x24ce92[_0x93ce('0x35')]);var _0x41ed4a={'where':_0x56332a[_0x93ce('0x33')]};return db[_0x93ce('0x23')][_0x93ce('0x14')](_0x41ed4a)[_0x93ce('0x1b')](function(_0x29fd9a){_0x6eaecb[_0x93ce('0x14')]=_0x29fd9a;if(_0x24ce92[_0x93ce('0x27')]['includeAll']){_0x56332a[_0x93ce('0x36')]=[{'all':!![]}];}return db[_0x93ce('0x23')]['findAll'](_0x56332a);})['then'](function(_0x36aa51){_0x6eaecb[_0x93ce('0x37')]=_0x36aa51;return _0x6eaecb;})[_0x93ce('0x1b')](respondWithFilteredResult(_0x2dabdc,_0x56332a))[_0x93ce('0x38')](handleError(_0x2dabdc,null));};exports['show']=function(_0x1299a9,_0x2d410e){var _0x1d3219={'raw':!![],'where':{'id':_0x1299a9[_0x93ce('0x39')]['id']}},_0x1762f7={};_0x1762f7[_0x93ce('0x26')]=_[_0x93ce('0x3a')](db['JscriptyAnswerReport'][_0x93ce('0x3b')]);_0x1762f7[_0x93ce('0x27')]=_[_0x93ce('0x3a')](_0x1299a9[_0x93ce('0x27')]);_0x1762f7['filters']=_[_0x93ce('0x29')](_0x1762f7['model'],_0x1762f7[_0x93ce('0x27')]);_0x1d3219['attributes']=_[_0x93ce('0x29')](_0x1762f7['model'],qs['fields'](_0x1299a9[_0x93ce('0x27')][_0x93ce('0x2a')]));_0x1d3219[_0x93ce('0x2b')]=_0x1d3219['attributes']['length']?_0x1d3219[_0x93ce('0x2b')]:_0x1762f7[_0x93ce('0x26')];if(_0x1299a9[_0x93ce('0x27')][_0x93ce('0x3c')]){_0x1d3219['include']=[{'all':!![]}];}_0x1d3219=_[_0x93ce('0x34')]({},_0x1d3219,_0x1299a9[_0x93ce('0x35')]);return db[_0x93ce('0x23')]['find'](_0x1d3219)[_0x93ce('0x1b')](handleEntityNotFound(_0x2d410e,null))[_0x93ce('0x1b')](respondWithResult(_0x2d410e,null))[_0x93ce('0x38')](handleError(_0x2d410e,null));};exports[_0x93ce('0x3d')]=function(_0x587c7c,_0x15992a){return db[_0x93ce('0x23')][_0x93ce('0x3d')](_0x587c7c[_0x93ce('0x3e')],{})[_0x93ce('0x1b')](respondWithResult(_0x15992a,0xc9))[_0x93ce('0x38')](handleError(_0x15992a,null));};exports[_0x93ce('0x1a')]=function(_0x2d8f5d,_0x4dd8b1){if(_0x2d8f5d['body']['id']){delete _0x2d8f5d[_0x93ce('0x3e')]['id'];}return db[_0x93ce('0x23')]['find']({'where':{'id':_0x2d8f5d[_0x93ce('0x39')]['id']}})['then'](handleEntityNotFound(_0x4dd8b1,null))[_0x93ce('0x1b')](saveUpdates(_0x2d8f5d[_0x93ce('0x3e')],null))[_0x93ce('0x1b')](respondWithResult(_0x4dd8b1,null))[_0x93ce('0x38')](handleError(_0x4dd8b1,null));};exports[_0x93ce('0x1c')]=function(_0x144855,_0x13239c){return db[_0x93ce('0x23')][_0x93ce('0x3f')]({'where':{'id':_0x144855[_0x93ce('0x39')]['id']}})['then'](handleEntityNotFound(_0x13239c,null))[_0x93ce('0x1b')](removeEntity(_0x13239c,null))[_0x93ce('0x38')](handleError(_0x13239c,null));};exports[_0x93ce('0x40')]=function(_0x2ba28e,_0x109208){return db[_0x93ce('0x23')][_0x93ce('0x40')]()[_0x93ce('0x1b')](respondWithResult(_0x109208,null))[_0x93ce('0x38')](handleError(_0x109208,null));}; \ No newline at end of file +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 diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 259fff4..9c1b26d 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 _0x0d65=['../../config/environment','exports','report_jscripty_answers','lodash','util','bluebird','request-promise','path','rimraf'];(function(_0x381d47,_0x5b6e3e){var _0x4507e5=function(_0x2cb3fc){while(--_0x2cb3fc){_0x381d47['push'](_0x381d47['shift']());}};_0x4507e5(++_0x5b6e3e);}(_0x0d65,0x81));var _0x50d6=function(_0x1fece0,_0x3b8db2){_0x1fece0=_0x1fece0-0x0;var _0x1f9d65=_0x0d65[_0x1fece0];return _0x1f9d65;};'use strict';var _=require(_0x50d6('0x0'));var util=require(_0x50d6('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x50d6('0x2'));var rp=require(_0x50d6('0x3'));var fs=require('fs');var path=require(_0x50d6('0x4'));var rimraf=require(_0x50d6('0x5'));var config=require(_0x50d6('0x6'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x50d6('0x7')]=function(_0x9f174d,_0x526c20){return _0x9f174d['define']('JscriptyAnswerReport',attributes,{'tableName':_0x50d6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 46c60c1..2dcc6ce 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 _0x0e21=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','JscriptyAnswerReport,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x0e21,0xe0));var _0x10e2=function(_0x545299,_0x22045a){_0x545299=_0x545299-0x0;var _0x18b228=_0x0e21[_0x545299];return _0x18b228;};'use strict';var _=require('lodash');var util=require(_0x10e2('0x0'));var moment=require(_0x10e2('0x1'));var BPromise=require(_0x10e2('0x2'));var rs=require(_0x10e2('0x3'));var fs=require('fs');var Redis=require(_0x10e2('0x4'));var db=require(_0x10e2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x10e2('0x6'))('rpc');var config=require(_0x10e2('0x7'));var jayson=require(_0x10e2('0x8'));var client=jayson[_0x10e2('0x9')][_0x10e2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x803dd1,_0x1e5e1d,_0xb4566e){return new BPromise(function(_0x473205,_0x4e73dc){return client[_0x10e2('0xb')](_0x803dd1,_0xb4566e)[_0x10e2('0xc')](function(_0x5a7681){logger[_0x10e2('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x1e5e1d,_0x10e2('0xe'));logger['debug'](_0x10e2('0xf'),_0x1e5e1d,'request\x20sent',JSON[_0x10e2('0x10')](_0x5a7681));if(_0x5a7681[_0x10e2('0x11')]){if(_0x5a7681[_0x10e2('0x11')]['code']===0x1f4){logger['error'](_0x10e2('0x12'),_0x1e5e1d,_0x5a7681[_0x10e2('0x11')][_0x10e2('0x13')]);return _0x4e73dc(_0x5a7681['error']['message']);}logger[_0x10e2('0x11')](_0x10e2('0x12'),_0x1e5e1d,_0x5a7681[_0x10e2('0x11')][_0x10e2('0x13')]);return _0x473205(_0x5a7681[_0x10e2('0x11')][_0x10e2('0x13')]);}else{logger[_0x10e2('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x1e5e1d,'request\x20sent');_0x473205(_0x5a7681[_0x10e2('0x14')]['message']);}})['catch'](function(_0x5c948b){logger['error'](_0x10e2('0x12'),_0x1e5e1d,_0x5c948b);_0x4e73dc(_0x5c948b);});});} \ No newline at end of file +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 diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 8550a5e..76793c8 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 _0x9af3=['../../components/interaction/service','../../config/environment','./jscriptyProject.controller','isAuthenticated','index','show','get','/:id/sessions','getSessions','/:id/answers','/:id/summary','30s','create','post','/:id/clone','clone','/:id','update','delete','multer','util','path','connect-timeout','express','Router'];(function(_0x29a657,_0x43bef8){var _0x1e10a3=function(_0x324de1){while(--_0x324de1){_0x29a657['push'](_0x29a657['shift']());}};_0x1e10a3(++_0x43bef8);}(_0x9af3,0x158));var _0x39af=function(_0x242d9e,_0xaa11e4){_0x242d9e=_0x242d9e-0x0;var _0x5962b3=_0x9af3[_0x242d9e];return _0x5962b3;};'use strict';var multer=require(_0x39af('0x0'));var util=require(_0x39af('0x1'));var path=require(_0x39af('0x2'));var timeout=require(_0x39af('0x3'));var express=require(_0x39af('0x4'));var router=express[_0x39af('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x39af('0x6'));var config=require(_0x39af('0x7'));var controller=require(_0x39af('0x8'));router['get']('/',auth[_0x39af('0x9')](),controller[_0x39af('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x39af('0xb')]);router[_0x39af('0xc')](_0x39af('0xd'),auth[_0x39af('0x9')](),controller[_0x39af('0xe')]);router[_0x39af('0xc')](_0x39af('0xf'),auth[_0x39af('0x9')](),controller['getAnswers']);router['get'](_0x39af('0x10'),auth[_0x39af('0x9')](),timeout(_0x39af('0x11')),controller['getSummary']);router['post']('/',auth[_0x39af('0x9')](),controller[_0x39af('0x12')]);router[_0x39af('0x13')](_0x39af('0x14'),auth[_0x39af('0x9')](),controller[_0x39af('0x15')]);router['put'](_0x39af('0x16'),auth[_0x39af('0x9')](),controller[_0x39af('0x17')]);router[_0x39af('0x18')](_0x39af('0x16'),auth[_0x39af('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 6826920..dfeb7ce 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 _0x65cb=['description','BOOLEAN','sequelize','lodash','util','STRING','name','TEXT','long','setDataValue','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue'];(function(_0x4e7c4c,_0xde744f){var _0x46ac31=function(_0x23761f){while(--_0x23761f){_0x4e7c4c['push'](_0x4e7c4c['shift']());}};_0x46ac31(++_0xde744f);}(_0x65cb,0x80));var _0xb65c=function(_0x18b6ed,_0x27490c){_0x18b6ed=_0x18b6ed-0x0;var _0x5aefe3=_0x65cb[_0x18b6ed];return _0x5aefe3;};'use strict';var Sequelize=require(_0xb65c('0x0'));var _=require(_0xb65c('0x1'));var util=require(_0xb65c('0x2'));module['exports']={'name':{'type':Sequelize[_0xb65c('0x3')],'unique':_0xb65c('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xb65c('0x5')](_0xb65c('0x6')),'set':function(_0x33c6ed){if(_['isObjectLike'](_0x33c6ed)){this[_0xb65c('0x7')](_0xb65c('0x8'),JSON['stringify'](_0x33c6ed));}else if(_['isString'](_0x33c6ed)){this[_0xb65c('0x7')](_0xb65c('0x8'),_0x33c6ed);}else{this['setDataValue'](_0xb65c('0x8'),util[_0xb65c('0x9')](_0xb65c('0xa'),this[_0xb65c('0xb')](_0xb65c('0x4'))||'',this[_0xb65c('0xb')](_0xb65c('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xb65c('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xb65c('0xd')],'defaultValue':![]}}; \ No newline at end of file +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 diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 7a8160d..2c5a89e 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 _0xdc82=['map','JscriptyProject','fieldName','type','key','model','query','filters','intersection','fields','attributes','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','rows','catch','show','params','keys','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','includeAll','omit','createdAt','updatedAt','getSessions','findOne','JscriptySessionReport','hasOwnProperty','ProjectId','getAnswers','JscriptyAnswerReport','findAll','number','fromCharCode','toString','indexOf','replace','startTime','starttime','parse','JscriptyQuestionReport','questionId','question','format','SessionId','answer','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','Content-Range','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','error','stack','send','index'];(function(_0x2929f0,_0x166d1c){var _0x53ffa2=function(_0x541c77){while(--_0x541c77){_0x2929f0['push'](_0x2929f0['shift']());}};_0x53ffa2(++_0x166d1c);}(_0xdc82,0xc5));var _0x2dc8=function(_0x39b086,_0x296bb0){_0x39b086=_0x39b086-0x0;var _0x443a9e=_0xdc82[_0x39b086];return _0x443a9e;};'use strict';var pdf=require(_0x2dc8('0x0'));var emlformat=require(_0x2dc8('0x1'));var rimraf=require(_0x2dc8('0x2'));var zipdir=require(_0x2dc8('0x3'));var jsonpatch=require(_0x2dc8('0x4'));var rp=require(_0x2dc8('0x5'));var moment=require(_0x2dc8('0x6'));var BPromise=require(_0x2dc8('0x7'));var Mustache=require('mustache');var util=require(_0x2dc8('0x8'));var path=require('path');var sox=require(_0x2dc8('0x9'));var csv=require(_0x2dc8('0xa'));var ejs=require(_0x2dc8('0xb'));var fs=require('fs');var _=require(_0x2dc8('0xc'));var squel=require(_0x2dc8('0xd'));var crypto=require(_0x2dc8('0xe'));var jsforce=require(_0x2dc8('0xf'));var deskjs=require(_0x2dc8('0x10'));var toCsv=require(_0x2dc8('0xa'));var querystring=require(_0x2dc8('0x11'));var Papa=require(_0x2dc8('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2dc8('0x13'));var as=require(_0x2dc8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2dc8('0x15'))(_0x2dc8('0x16'));var utils=require(_0x2dc8('0x17'));var config=require(_0x2dc8('0x18'));var db=require(_0x2dc8('0x19'))['db'];function respondWithStatusCode(_0x526725,_0x305546){_0x305546=_0x305546||0xcc;return function(_0x3a079a){if(_0x3a079a){return _0x526725[_0x2dc8('0x1a')](_0x305546);}return _0x526725[_0x2dc8('0x1b')](_0x305546)[_0x2dc8('0x1c')]();};}function respondWithResult(_0x51c170,_0x9b08bd){_0x9b08bd=_0x9b08bd||0xc8;return function(_0x8ada39){if(_0x8ada39){return _0x51c170[_0x2dc8('0x1b')](_0x9b08bd)[_0x2dc8('0x1d')](_0x8ada39);}};}function respondWithFilteredResult(_0x5a12e4,_0x419439){return function(_0x12a8cc){if(_0x12a8cc){var _0x3372ef=_0x12a8cc['count'],_0x3885fa=_0x419439['offset'],_0x3049d9=_0x419439['offset']+_0x419439[_0x2dc8('0x1e')],_0x3b13a1;if(_0x3049d9>=_0x3372ef){_0x3049d9=_0x3372ef;_0x3b13a1=0xc8;}else{_0x3b13a1=0xce;}_0x5a12e4[_0x2dc8('0x1b')](_0x3b13a1);return _0x5a12e4['set'](_0x2dc8('0x1f'),_0x3885fa+'-'+_0x3049d9+'/'+_0x3372ef)[_0x2dc8('0x1d')](_0x12a8cc);}return null;};}function patchUpdates(_0x55d9e6){return function(_0x528581){try{jsonpatch[_0x2dc8('0x20')](_0x528581,_0x55d9e6,!![]);}catch(_0x3b4809){return BPromise[_0x2dc8('0x21')](_0x3b4809);}return _0x528581[_0x2dc8('0x22')]();};}function saveUpdates(_0x4509da,_0xce7248){return function(_0x46680b){if(_0x46680b){return _0x46680b[_0x2dc8('0x23')](_0x4509da)[_0x2dc8('0x24')](function(_0x157fd5){return _0x157fd5;});}return null;};}function removeEntity(_0xa6a3e7,_0x456d9d){return function(_0x379348){if(_0x379348){return _0x379348[_0x2dc8('0x25')]()[_0x2dc8('0x24')](function(){var _0xebc7f7=_0x379348[_0x2dc8('0x26')]({'plain':!![]});var _0x5a3a4a=_0x2dc8('0x27');return db[_0x2dc8('0x28')][_0x2dc8('0x25')]({'where':{'type':_0x5a3a4a,'resourceId':_0xebc7f7['id']}})[_0x2dc8('0x24')](function(){return _0x379348;});})[_0x2dc8('0x24')](function(){_0xa6a3e7[_0x2dc8('0x1b')](0xcc)[_0x2dc8('0x1c')]();});}};}function handleEntityNotFound(_0x11315f,_0x34fa5b){return function(_0x556d91){if(!_0x556d91){_0x11315f['sendStatus'](0x194);}return _0x556d91;};}function handleError(_0x27a536,_0x4ad9b9){_0x4ad9b9=_0x4ad9b9||0x1f4;return function(_0xfb8475){logger[_0x2dc8('0x29')](_0xfb8475[_0x2dc8('0x2a')]);if(_0xfb8475['name']){delete _0xfb8475['name'];}_0x27a536['status'](_0x4ad9b9)[_0x2dc8('0x2b')](_0xfb8475);};}exports[_0x2dc8('0x2c')]=function(_0x2546c7,_0x5a49d5){var _0x11d12c={},_0x45271b={},_0x5075fa={'count':0x0,'rows':[]};var _0x10839f=_[_0x2dc8('0x2d')](db[_0x2dc8('0x2e')]['rawAttributes'],function(_0x2ee0b7){return{'name':_0x2ee0b7[_0x2dc8('0x2f')],'type':_0x2ee0b7[_0x2dc8('0x30')][_0x2dc8('0x31')]};});_0x45271b[_0x2dc8('0x32')]=_[_0x2dc8('0x2d')](_0x10839f,'name');_0x45271b[_0x2dc8('0x33')]=_['keys'](_0x2546c7[_0x2dc8('0x33')]);_0x45271b[_0x2dc8('0x34')]=_[_0x2dc8('0x35')](_0x45271b[_0x2dc8('0x32')],_0x45271b[_0x2dc8('0x33')]);_0x11d12c['attributes']=_[_0x2dc8('0x35')](_0x45271b[_0x2dc8('0x32')],qs[_0x2dc8('0x36')](_0x2546c7[_0x2dc8('0x33')][_0x2dc8('0x36')]));_0x11d12c['attributes']=_0x11d12c['attributes']['length']?_0x11d12c[_0x2dc8('0x37')]:_0x45271b[_0x2dc8('0x32')];if(!_0x2546c7['query']['hasOwnProperty'](_0x2dc8('0x38'))){_0x11d12c[_0x2dc8('0x1e')]=qs[_0x2dc8('0x1e')](_0x2546c7[_0x2dc8('0x33')][_0x2dc8('0x1e')]);_0x11d12c[_0x2dc8('0x39')]=qs[_0x2dc8('0x39')](_0x2546c7[_0x2dc8('0x33')][_0x2dc8('0x39')]);}_0x11d12c[_0x2dc8('0x3a')]=qs[_0x2dc8('0x3b')](_0x2546c7[_0x2dc8('0x33')]['sort']);_0x11d12c[_0x2dc8('0x3c')]=qs[_0x2dc8('0x34')](_[_0x2dc8('0x3d')](_0x2546c7[_0x2dc8('0x33')],_0x45271b[_0x2dc8('0x34')]));if(_0x2546c7['query'][_0x2dc8('0x3e')]){_0x11d12c[_0x2dc8('0x3c')]=_[_0x2dc8('0x3f')](_0x11d12c[_0x2dc8('0x3c')],{'$or':_['map'](_0x10839f,function(_0x4ee539){if(_0x4ee539[_0x2dc8('0x30')]!==_0x2dc8('0x40')){var _0x236cfd={};_0x236cfd[_0x4ee539['name']]={'$like':'%'+_0x2546c7[_0x2dc8('0x33')]['filter']+'%'};return _0x236cfd;}})});}_0x11d12c=_[_0x2dc8('0x3f')]({},_0x11d12c,_0x2546c7[_0x2dc8('0x41')]);var _0x38680b={'where':_0x11d12c[_0x2dc8('0x3c')]};return db[_0x2dc8('0x2e')][_0x2dc8('0x42')](_0x38680b)[_0x2dc8('0x24')](function(_0xfe6b62){_0x5075fa[_0x2dc8('0x42')]=_0xfe6b62;if(_0x2546c7[_0x2dc8('0x33')]['includeAll']){_0x11d12c[_0x2dc8('0x43')]=[{'all':!![]}];}return db['JscriptyProject']['findAll'](_0x11d12c);})[_0x2dc8('0x24')](function(_0x3a7325){_0x5075fa[_0x2dc8('0x44')]=_0x3a7325;return _0x5075fa;})[_0x2dc8('0x24')](respondWithFilteredResult(_0x5a49d5,_0x11d12c))[_0x2dc8('0x45')](handleError(_0x5a49d5,null));};exports[_0x2dc8('0x46')]=function(_0x548167,_0x4c7d90){var _0x15e5e6={'raw':![],'where':{'id':_0x548167[_0x2dc8('0x47')]['id']}},_0x24beeb={};_0x24beeb[_0x2dc8('0x32')]=_[_0x2dc8('0x48')](db['JscriptyProject'][_0x2dc8('0x49')]);_0x24beeb['query']=_['keys'](_0x548167[_0x2dc8('0x33')]);_0x24beeb[_0x2dc8('0x34')]=_[_0x2dc8('0x35')](_0x24beeb[_0x2dc8('0x32')],_0x24beeb[_0x2dc8('0x33')]);_0x15e5e6['attributes']=_[_0x2dc8('0x35')](_0x24beeb['model'],qs[_0x2dc8('0x36')](_0x548167[_0x2dc8('0x33')][_0x2dc8('0x36')]));_0x15e5e6[_0x2dc8('0x37')]=_0x15e5e6[_0x2dc8('0x37')][_0x2dc8('0x4a')]?_0x15e5e6[_0x2dc8('0x37')]:_0x24beeb[_0x2dc8('0x32')];if(_0x548167['query']['includeAll']){_0x15e5e6['include']=[{'all':!![]}];}_0x15e5e6=_['merge']({},_0x15e5e6,_0x548167[_0x2dc8('0x41')]);return db[_0x2dc8('0x2e')][_0x2dc8('0x4b')](_0x15e5e6)['then'](handleEntityNotFound(_0x4c7d90,null))[_0x2dc8('0x24')](respondWithResult(_0x4c7d90,null))[_0x2dc8('0x45')](handleError(_0x4c7d90,null));};exports[_0x2dc8('0x4c')]=function(_0x3e397c,_0x1f0797){return db['JscriptyProject'][_0x2dc8('0x4c')](_0x3e397c[_0x2dc8('0x4d')],{})[_0x2dc8('0x24')](function(_0x251ece){var _0x360823=_0x3e397c[_0x2dc8('0x4e')][_0x2dc8('0x26')]({'plain':!![]});if(!_0x360823)throw new Error(_0x2dc8('0x4f'));if(_0x360823[_0x2dc8('0x50')]===_0x2dc8('0x4e')){var _0x8b6beb=_0x251ece['get']({'plain':!![]});var _0x28f465=_0x2dc8('0x27');return db[_0x2dc8('0x51')]['find']({'where':{'name':_0x28f465,'userProfileId':_0x360823[_0x2dc8('0x52')]},'raw':!![]})['then'](function(_0x53063d){if(_0x53063d&&_0x53063d[_0x2dc8('0x53')]===0x0){return db[_0x2dc8('0x28')]['create']({'name':_0x8b6beb[_0x2dc8('0x54')],'resourceId':_0x8b6beb['id'],'type':_0x53063d[_0x2dc8('0x54')],'sectionId':_0x53063d['id']},{})[_0x2dc8('0x24')](function(){return _0x251ece;});}else{return _0x251ece;}})[_0x2dc8('0x45')](function(_0x2d25a5){logger[_0x2dc8('0x29')](_0x2dc8('0x55'),_0x2d25a5);throw _0x2d25a5;});}return _0x251ece;})['then'](respondWithResult(_0x1f0797,0xc9))['catch'](handleError(_0x1f0797,null));};exports['clone']=function(_0x4d7322,_0x456ad8){var _0x3990ae={'where':{'id':_0x4d7322[_0x2dc8('0x47')]['id']}},_0x28e543={};_0x28e543[_0x2dc8('0x32')]=_[_0x2dc8('0x48')](db[_0x2dc8('0x2e')][_0x2dc8('0x49')]);_0x3990ae[_0x2dc8('0x37')]=_[_0x2dc8('0x35')](_0x28e543[_0x2dc8('0x32')],qs[_0x2dc8('0x36')](_0x4d7322[_0x2dc8('0x33')][_0x2dc8('0x36')]));_0x3990ae[_0x2dc8('0x37')]=_0x3990ae[_0x2dc8('0x37')][_0x2dc8('0x4a')]?_0x3990ae[_0x2dc8('0x37')]:_0x28e543['model'];if(_0x4d7322[_0x2dc8('0x33')][_0x2dc8('0x56')]){_0x3990ae['include']=[{'all':!![]}];}_0x3990ae=_['merge']({},_0x3990ae,_0x4d7322[_0x2dc8('0x41')]);return db[_0x2dc8('0x2e')]['find'](_0x3990ae)['then'](handleEntityNotFound(_0x456ad8,null))['then'](function(_0xffc58c){if(_0xffc58c){var _0x4a5f72=_0xffc58c[_0x2dc8('0x26')]({'plain':!![]});_0x4a5f72=qs[_0x2dc8('0x57')](_0x4a5f72,['id',_0x2dc8('0x58'),_0x2dc8('0x59')]);_0x4d7322[_0x2dc8('0x4d')]=_['omit'](_0x4d7322[_0x2dc8('0x4d')],['id','createdAt',_0x2dc8('0x59')]);return db[_0x2dc8('0x2e')]['create'](_[_0x2dc8('0x3f')](_0x4a5f72,_0x4d7322['body']),{'include':_0x4d7322[_0x2dc8('0x33')][_0x2dc8('0x56')]?[{'all':!![]}]:undefined})[_0x2dc8('0x24')](function(_0x2005eb){var _0x1a214c=_0x4d7322['user'][_0x2dc8('0x26')]({'plain':!![]});if(!_0x1a214c)throw new Error(_0x2dc8('0x4f'));if(_0x1a214c[_0x2dc8('0x50')]===_0x2dc8('0x4e')){var _0x47050d=_0x2005eb[_0x2dc8('0x26')]({'plain':!![]});var _0x5dc992=_0x2dc8('0x27');return db[_0x2dc8('0x51')]['find']({'where':{'name':_0x5dc992,'userProfileId':_0x1a214c[_0x2dc8('0x52')]},'raw':!![]})['then'](function(_0x272b6b){if(_0x272b6b&&_0x272b6b[_0x2dc8('0x53')]===0x0){return db[_0x2dc8('0x28')][_0x2dc8('0x4c')]({'name':_0x47050d[_0x2dc8('0x54')],'resourceId':_0x47050d['id'],'type':_0x272b6b['name'],'sectionId':_0x272b6b['id']},{})['then'](function(){return _0x2005eb;});}else{return _0x2005eb;}})[_0x2dc8('0x45')](function(_0x118ea2){logger[_0x2dc8('0x29')](_0x2dc8('0x55'),_0x118ea2);throw _0x118ea2;});}return _0x2005eb;});}})[_0x2dc8('0x24')](respondWithResult(_0x456ad8,0xc9))[_0x2dc8('0x45')](handleError(_0x456ad8,null));};exports[_0x2dc8('0x23')]=function(_0x417fde,_0xa5feb4){if(_0x417fde[_0x2dc8('0x4d')]['id']){delete _0x417fde[_0x2dc8('0x4d')]['id'];}return db[_0x2dc8('0x2e')]['find']({'where':{'id':_0x417fde[_0x2dc8('0x47')]['id']}})[_0x2dc8('0x24')](handleEntityNotFound(_0xa5feb4,null))[_0x2dc8('0x24')](saveUpdates(_0x417fde[_0x2dc8('0x4d')],null))['then'](respondWithResult(_0xa5feb4,null))[_0x2dc8('0x45')](handleError(_0xa5feb4,null));};exports[_0x2dc8('0x25')]=function(_0x3f5bd1,_0xf9bc02){return db[_0x2dc8('0x2e')]['find']({'where':{'id':_0x3f5bd1[_0x2dc8('0x47')]['id']}})[_0x2dc8('0x24')](handleEntityNotFound(_0xf9bc02,null))['then'](removeEntity(_0xf9bc02,null))[_0x2dc8('0x45')](handleError(_0xf9bc02,null));};exports[_0x2dc8('0x5a')]=function(_0x5e54cb,_0x337466,_0x417850){var _0x1af43d={'raw':!![],'where':{}};var _0x322711={};var _0x53df5c={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x2dc8('0x5b')]({'where':{'id':_0x5e54cb['params']['id']}})[_0x2dc8('0x24')](handleEntityNotFound(_0x337466,null))[_0x2dc8('0x24')](function(_0x509de6){if(_0x509de6){_0x322711[_0x2dc8('0x32')]=_['keys'](db[_0x2dc8('0x5c')][_0x2dc8('0x49')]);_0x322711[_0x2dc8('0x33')]=_['keys'](_0x5e54cb[_0x2dc8('0x33')]);_0x322711[_0x2dc8('0x34')]=_[_0x2dc8('0x35')](_0x322711['model'],_0x322711[_0x2dc8('0x33')]);_0x1af43d[_0x2dc8('0x37')]=_['intersection'](_0x322711[_0x2dc8('0x32')],qs[_0x2dc8('0x36')](_0x5e54cb[_0x2dc8('0x33')]['fields']));_0x1af43d[_0x2dc8('0x37')]=_0x1af43d[_0x2dc8('0x37')][_0x2dc8('0x4a')]?_0x1af43d['attributes']:_0x322711[_0x2dc8('0x32')];if(!_0x5e54cb['query'][_0x2dc8('0x5d')](_0x2dc8('0x38'))){_0x1af43d[_0x2dc8('0x1e')]=qs[_0x2dc8('0x1e')](_0x5e54cb[_0x2dc8('0x33')][_0x2dc8('0x1e')]);_0x1af43d[_0x2dc8('0x39')]=qs['offset'](_0x5e54cb[_0x2dc8('0x33')]['offset']);}_0x1af43d[_0x2dc8('0x3a')]=qs['sort'](_0x5e54cb['query']['sort']);_0x1af43d[_0x2dc8('0x3c')]=qs['filters'](_[_0x2dc8('0x3d')](_0x5e54cb['query'],_0x322711[_0x2dc8('0x34')]));_0x1af43d[_0x2dc8('0x3c')][_0x2dc8('0x5e')]=_0x509de6['id'];if(_0x5e54cb[_0x2dc8('0x33')][_0x2dc8('0x3e')]){_0x1af43d[_0x2dc8('0x3c')]=_['merge'](_0x1af43d[_0x2dc8('0x3c')],{'$or':_[_0x2dc8('0x2d')](_0x1af43d[_0x2dc8('0x37')],function(_0x3c1a94){var _0x512f63={};_0x512f63[_0x3c1a94]={'$like':'%'+_0x5e54cb[_0x2dc8('0x33')]['filter']+'%'};return _0x512f63;})});}_0x1af43d=_['merge']({},_0x1af43d,_0x5e54cb[_0x2dc8('0x41')]);return db['JscriptySessionReport'][_0x2dc8('0x42')]({'where':_0x1af43d[_0x2dc8('0x3c')]})[_0x2dc8('0x24')](function(_0xb22911){_0x53df5c[_0x2dc8('0x42')]=_0xb22911;if(_0x5e54cb['query'][_0x2dc8('0x56')]){_0x1af43d[_0x2dc8('0x43')]=[{'all':!![]}];}return db[_0x2dc8('0x5c')]['findAll'](_0x1af43d);})['then'](function(_0xcbf8a0){_0x53df5c[_0x2dc8('0x44')]=_0xcbf8a0;return _0x53df5c;});}})[_0x2dc8('0x24')](respondWithFilteredResult(_0x337466,_0x1af43d))[_0x2dc8('0x45')](handleError(_0x337466,null));};exports[_0x2dc8('0x5f')]=function(_0x10daee,_0x638b,_0x4633b4){var _0xe5731={'raw':!![],'where':{}};var _0x4697d5={};var _0x1ab8d4={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x2dc8('0x5b')]({'where':{'id':_0x10daee[_0x2dc8('0x47')]['id']}})['then'](handleEntityNotFound(_0x638b,null))[_0x2dc8('0x24')](function(_0x1d89c8){if(_0x1d89c8){_0x4697d5[_0x2dc8('0x32')]=_['keys'](db[_0x2dc8('0x60')][_0x2dc8('0x49')]);_0x4697d5['query']=_[_0x2dc8('0x48')](_0x10daee[_0x2dc8('0x33')]);_0x4697d5['filters']=_[_0x2dc8('0x35')](_0x4697d5[_0x2dc8('0x32')],_0x4697d5['query']);_0xe5731[_0x2dc8('0x37')]=_['intersection'](_0x4697d5['model'],qs['fields'](_0x10daee[_0x2dc8('0x33')][_0x2dc8('0x36')]));_0xe5731[_0x2dc8('0x37')]=_0xe5731['attributes'][_0x2dc8('0x4a')]?_0xe5731[_0x2dc8('0x37')]:_0x4697d5['model'];if(!_0x10daee[_0x2dc8('0x33')][_0x2dc8('0x5d')]('nolimit')){_0xe5731[_0x2dc8('0x1e')]=qs[_0x2dc8('0x1e')](_0x10daee['query']['limit']);_0xe5731[_0x2dc8('0x39')]=qs[_0x2dc8('0x39')](_0x10daee['query']['offset']);}_0xe5731[_0x2dc8('0x3a')]=qs[_0x2dc8('0x3b')](_0x10daee['query']['sort']);_0xe5731['where']=qs[_0x2dc8('0x34')](_['pick'](_0x10daee['query'],_0x4697d5[_0x2dc8('0x34')]));_0xe5731[_0x2dc8('0x3c')][_0x2dc8('0x5e')]=_0x1d89c8['id'];if(_0x10daee[_0x2dc8('0x33')][_0x2dc8('0x3e')]){_0xe5731['where']=_[_0x2dc8('0x3f')](_0xe5731[_0x2dc8('0x3c')],{'$or':_[_0x2dc8('0x2d')](_0xe5731[_0x2dc8('0x37')],function(_0x2b33ff){var _0x47ea55={};_0x47ea55[_0x2b33ff]={'$like':'%'+_0x10daee[_0x2dc8('0x33')]['filter']+'%'};return _0x47ea55;})});}_0xe5731=_['merge']({},_0xe5731,_0x10daee[_0x2dc8('0x41')]);return db[_0x2dc8('0x60')]['count']({'where':_0xe5731[_0x2dc8('0x3c')]})[_0x2dc8('0x24')](function(_0x229d40){_0x1ab8d4[_0x2dc8('0x42')]=_0x229d40;if(_0x10daee[_0x2dc8('0x33')][_0x2dc8('0x56')]){_0xe5731[_0x2dc8('0x43')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x2dc8('0x61')](_0xe5731);})[_0x2dc8('0x24')](function(_0x1483d7){_0x1ab8d4[_0x2dc8('0x44')]=_0x1483d7;return _0x1ab8d4;});}})[_0x2dc8('0x24')](respondWithFilteredResult(_0x638b,_0xe5731))[_0x2dc8('0x45')](handleError(_0x638b,null));};function char(_0x4e369b){return _0x2dc8('0x62')===typeof _0x4e369b?String[_0x2dc8('0x63')]['apply'](null,arguments):_0x4e369b;}function needsEncapsulation(_0x1049c7){return!!_0x1049c7&&(_0x1049c7['toString']()['indexOf'](char(0xd))>=0x0||_0x1049c7[_0x2dc8('0x64')]()[_0x2dc8('0x65')](char(0xa))>=0x0||_0x1049c7['toString']()[_0x2dc8('0x65')](char(0x2c))>=0x0||_0x1049c7[_0x2dc8('0x64')]()[_0x2dc8('0x65')](char(0x22))>=0x0);}function encapsulate(_0x31d807){var _0x1b3e21=char(0x22),_0xc99830='\x5c'+char(0x22),_0x1224ba=_0x31d807[_0x2dc8('0x64')]()[_0x2dc8('0x66')](new RegExp(_0x1b3e21,'g'),_0xc99830);return _0x1b3e21+_0x1224ba+_0x1b3e21;}exports['getSummary']=function(_0x3b5d0d,_0x5e63eb,_0x1681ce){var _0xf466bf,_0x521f20;var _0x3d1094={'where':{'ProjectId':_0x3b5d0d[_0x2dc8('0x47')]['id']}};if(_0x3b5d0d[_0x2dc8('0x33')][_0x2dc8('0x67')]){_0x3d1094[_0x2dc8('0x3c')][_0x2dc8('0x68')]=JSON[_0x2dc8('0x69')](_0x3b5d0d[_0x2dc8('0x33')]['startTime']);}return db['JscriptySessionReport'][_0x2dc8('0x61')](_0x3d1094)[_0x2dc8('0x24')](handleEntityNotFound(_0x5e63eb,null))[_0x2dc8('0x24')](function(_0x32e9ec){if(_0x32e9ec){_0xf466bf=_0x32e9ec;return db[_0x2dc8('0x6a')][_0x2dc8('0x61')]({'where':{'SessionId':{'$in':_['map'](_0xf466bf,'id')},'ProjectId':_0x3b5d0d[_0x2dc8('0x47')]['id']},'order':'-createdAt'});}})[_0x2dc8('0x24')](handleEntityNotFound(_0x5e63eb,null))[_0x2dc8('0x24')](function(_0x49901f){if(_0x49901f){_0x521f20=_0x49901f;var _0x5c9cea={};for(var _0x7a97fd=0x0,_0x2a8243=_0x521f20[_0x2dc8('0x4a')];_0x7a97fd<_0x2a8243;_0x7a97fd++){if(!_0x5c9cea[_0x2dc8('0x5d')](_0x521f20[_0x7a97fd][_0x2dc8('0x6b')])){_0x5c9cea[_0x521f20[_0x7a97fd][_0x2dc8('0x6b')]]=needsEncapsulation(_0x521f20[_0x7a97fd]['question'])?encapsulate(_0x521f20[_0x7a97fd][_0x2dc8('0x6c')]):_0x521f20[_0x7a97fd][_0x2dc8('0x6c')];}}var _0x24c944=[],_0x5ae8c5={};for(var _0x3125c3=0x0,_0x5f3b6b=_0xf466bf['length'];_0x3125c3<_0x5f3b6b;_0x3125c3++){_0x5ae8c5={'ProjectId':_0x3b5d0d['params']['id'],'SessionId':_0xf466bf[_0x3125c3]['id'],'StartTime':moment(_0xf466bf[_0x3125c3][_0x2dc8('0x68')])[_0x2dc8('0x6d')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x48474e=0x0,_0x576cd0=_0x521f20['length'];_0x48474e<_0x576cd0;_0x48474e++){if(_0x521f20[_0x48474e][_0x2dc8('0x6e')]==_0xf466bf[_0x3125c3]['id']&&_0x5c9cea[_0x2dc8('0x5d')](_0x521f20[_0x48474e][_0x2dc8('0x6b')])){_0x5ae8c5[_0x5c9cea[_0x521f20[_0x48474e][_0x2dc8('0x6b')]]]=_0x521f20[_0x48474e][_0x2dc8('0x6f')];}}for(var _0x527eb2 in _0x5c9cea){if(!_0x5ae8c5[_0x2dc8('0x5d')](_0x5c9cea[_0x527eb2])){_0x5ae8c5[_0x5c9cea[_0x527eb2]]=null;}}_0x24c944['push'](_0x5ae8c5);}return _0x24c944;}})[_0x2dc8('0x24')](function(_0x4e1dc0){if(!_['isEmpty'](_0x4e1dc0)){var _0x26c92b=toCsv(_0x4e1dc0);var _0x2810d8=Date['now']();fs[_0x2dc8('0x70')](util[_0x2dc8('0x6d')](_0x2dc8('0x71'),_0x3b5d0d[_0x2dc8('0x47')]['id'],_0x2810d8),_0x26c92b);_0x5e63eb[_0x2dc8('0x72')](_0x2dc8('0x73'),_0x2dc8('0x74')+util['format'](_0x2dc8('0x75'),_0x3b5d0d[_0x2dc8('0x47')]['id'],_0x2810d8));_0x5e63eb[_0x2dc8('0x72')](_0x2dc8('0x76'),_0x2dc8('0x77'));return _0x5e63eb[_0x2dc8('0x78')](util['format'](_0x2dc8('0x71'),_0x3b5d0d[_0x2dc8('0x47')]['id'],_0x2810d8));}else{return _0x5e63eb[_0x2dc8('0x1a')](0xcc);}})[_0x2dc8('0x45')](handleError(_0x5e63eb,null));}; \ No newline at end of file +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 diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 5bc5443..2a3d75b 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 _0xf321=['path','jscripty_projects','util','api','moment','bluebird','request-promise'];(function(_0xf7c911,_0x430ce3){var _0x56b15a=function(_0x26aef7){while(--_0x26aef7){_0xf7c911['push'](_0xf7c911['shift']());}};_0x56b15a(++_0x430ce3);}(_0xf321,0x14b));var _0x1f32=function(_0x2b4025,_0x49aa4c){_0x2b4025=_0x2b4025-0x0;var _0x281ea1=_0xf321[_0x2b4025];return _0x281ea1;};'use strict';var _=require('lodash');var util=require(_0x1f32('0x0'));var logger=require('../../config/logger')(_0x1f32('0x1'));var moment=require(_0x1f32('0x2'));var BPromise=require(_0x1f32('0x3'));var rp=require(_0x1f32('0x4'));var fs=require('fs');var path=require(_0x1f32('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module['exports']=function(_0x485e3a,_0xed0396){return _0x485e3a['define']('JscriptyProject',attributes,{'tableName':_0x1f32('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index b43d26b..b4e4632 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 _0x90b3=['request','JscriptyProject,\x20%s,\x20%s','request\x20sent','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x3af5cc,_0x118c5e){var _0x3a7a3b=function(_0x76ca5c){while(--_0x76ca5c){_0x3af5cc['push'](_0x3af5cc['shift']());}};_0x3a7a3b(++_0x118c5e);}(_0x90b3,0x129));var _0x390b=function(_0x2c2526,_0x2c1188){_0x2c2526=_0x2c2526-0x0;var _0x45439d=_0x90b3[_0x2c2526];return _0x45439d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x390b('0x0'));var BPromise=require(_0x390b('0x1'));var rs=require(_0x390b('0x2'));var fs=require('fs');var Redis=require(_0x390b('0x3'));var db=require(_0x390b('0x4'))['db'];var utils=require(_0x390b('0x5'));var logger=require('../../config/logger')(_0x390b('0x6'));var config=require(_0x390b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x390b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30ff0d,_0x884b9b,_0x383674){return new BPromise(function(_0x5e9454,_0x249e28){return client[_0x390b('0x9')](_0x30ff0d,_0x383674)['then'](function(_0x345d25){logger['info'](_0x390b('0xa'),_0x884b9b,_0x390b('0xb'));logger['debug'](_0x390b('0xc'),_0x884b9b,_0x390b('0xb'),JSON[_0x390b('0xd')](_0x345d25));if(_0x345d25[_0x390b('0xe')]){if(_0x345d25[_0x390b('0xe')][_0x390b('0xf')]===0x1f4){logger[_0x390b('0xe')]('JscriptyProject,\x20%s,\x20%s',_0x884b9b,_0x345d25[_0x390b('0xe')][_0x390b('0x10')]);return _0x249e28(_0x345d25[_0x390b('0xe')][_0x390b('0x10')]);}logger[_0x390b('0xe')](_0x390b('0xa'),_0x884b9b,_0x345d25[_0x390b('0xe')][_0x390b('0x10')]);return _0x5e9454(_0x345d25[_0x390b('0xe')][_0x390b('0x10')]);}else{logger['info'](_0x390b('0xa'),_0x884b9b,_0x390b('0xb'));_0x5e9454(_0x345d25[_0x390b('0x11')][_0x390b('0x10')]);}})['catch'](function(_0x2a02df){logger['error'](_0x390b('0xa'),_0x884b9b,_0x2a02df);_0x249e28(_0x2a02df);});});} \ No newline at end of file +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 diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index b7bb020..210a138 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 _0x64bb=['get','isAuthenticated','index','describe','/:id','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller'];(function(_0x4a4219,_0x55d299){var _0x1bb2a7=function(_0x48202c){while(--_0x48202c){_0x4a4219['push'](_0x4a4219['shift']());}};_0x1bb2a7(++_0x55d299);}(_0x64bb,0x127));var _0xb64b=function(_0x3b467f,_0x2c5684){_0x3b467f=_0x3b467f-0x0;var _0x48abb3=_0x64bb[_0x3b467f];return _0x48abb3;};'use strict';var multer=require(_0xb64b('0x0'));var util=require(_0xb64b('0x1'));var path=require(_0xb64b('0x2'));var timeout=require(_0xb64b('0x3'));var express=require('express');var router=express[_0xb64b('0x4')]();var auth=require(_0xb64b('0x5'));var interaction=require(_0xb64b('0x6'));var config=require(_0xb64b('0x7'));var controller=require(_0xb64b('0x8'));router[_0xb64b('0x9')]('/',auth[_0xb64b('0xa')](),controller[_0xb64b('0xb')]);router[_0xb64b('0x9')]('/describe',auth[_0xb64b('0xa')](),controller[_0xb64b('0xc')]);router[_0xb64b('0x9')](_0xb64b('0xd'),auth[_0xb64b('0xa')](),controller['show']);router['post']('/',auth[_0xb64b('0xa')](),controller[_0xb64b('0xe')]);router[_0xb64b('0xf')](_0xb64b('0xd'),auth[_0xb64b('0xa')](),controller['update']);router[_0xb64b('0x10')]('/:id',auth[_0xb64b('0xa')](),controller[_0xb64b('0x11')]);module[_0xb64b('0x12')]=router; \ No newline at end of file +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 diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 556ccf6..518ee1f 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 _0x7ca7=['long','sequelize','exports','STRING','TEXT'];(function(_0xfab3c1,_0x501208){var _0x4ed9a8=function(_0x4376c5){while(--_0x4376c5){_0xfab3c1['push'](_0xfab3c1['shift']());}};_0x4ed9a8(++_0x501208);}(_0x7ca7,0x6f));var _0x77ca=function(_0x4c6cf0,_0x826f70){_0x4c6cf0=_0x4c6cf0-0x0;var _0x108145=_0x7ca7[_0x4c6cf0];return _0x108145;};'use strict';var Sequelize=require(_0x77ca('0x0'));module[_0x77ca('0x1')]={'question':{'type':Sequelize[_0x77ca('0x2')]},'answer':{'type':Sequelize[_0x77ca('0x3')](_0x77ca('0x4'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x77ca('0x2')]},'queue':{'type':Sequelize[_0x77ca('0x2')]},'uniqueid':{'type':Sequelize[_0x77ca('0x2')]},'calleridname':{'type':Sequelize[_0x77ca('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0x77ca('0x2')]}}; \ No newline at end of file +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 diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 3dd6514..02a04a7 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 _0x68f9=['bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x41a455,_0x9f406a){var _0x594411=function(_0x2b09f9){while(--_0x2b09f9){_0x41a455['push'](_0x41a455['shift']());}};_0x594411(++_0x9f406a);}(_0x68f9,0x12b));var _0x968f=function(_0x4fa934,_0x16e1ef){_0x4fa934=_0x4fa934-0x0;var _0x39aaf2=_0x68f9[_0x4fa934];return _0x39aaf2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x968f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x968f('0x1'));var jsonpatch=require(_0x968f('0x2'));var rp=require(_0x968f('0x3'));var moment=require(_0x968f('0x4'));var BPromise=require(_0x968f('0x5'));var Mustache=require(_0x968f('0x6'));var util=require(_0x968f('0x7'));var path=require('path');var sox=require(_0x968f('0x8'));var csv=require(_0x968f('0x9'));var ejs=require(_0x968f('0xa'));var fs=require('fs');var _=require(_0x968f('0xb'));var squel=require(_0x968f('0xc'));var crypto=require(_0x968f('0xd'));var jsforce=require(_0x968f('0xe'));var deskjs=require(_0x968f('0xf'));var toCsv=require(_0x968f('0x9'));var querystring=require(_0x968f('0x10'));var Papa=require(_0x968f('0x11'));var Redis=require(_0x968f('0x12'));var authService=require(_0x968f('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x968f('0x14'));var logger=require(_0x968f('0x15'))(_0x968f('0x16'));var utils=require(_0x968f('0x17'));var config=require(_0x968f('0x18'));var db=require(_0x968f('0x19'))['db'];function respondWithStatusCode(_0x2886ff,_0x1dcfe5){_0x1dcfe5=_0x1dcfe5||0xcc;return function(_0x572e8a){if(_0x572e8a){return _0x2886ff[_0x968f('0x1a')](_0x1dcfe5);}return _0x2886ff[_0x968f('0x1b')](_0x1dcfe5)[_0x968f('0x1c')]();};}function respondWithResult(_0x4e2a7d,_0x27c248){_0x27c248=_0x27c248||0xc8;return function(_0x5df8d6){if(_0x5df8d6){return _0x4e2a7d['status'](_0x27c248)[_0x968f('0x1d')](_0x5df8d6);}};}function respondWithFilteredResult(_0x2d351e,_0x19c109){return function(_0x33d127){if(_0x33d127){var _0x430d58=_0x33d127[_0x968f('0x1e')],_0x103de3=_0x19c109[_0x968f('0x1f')],_0x1e5da1=_0x19c109[_0x968f('0x1f')]+_0x19c109['limit'],_0x46073f;if(_0x1e5da1>=_0x430d58){_0x1e5da1=_0x430d58;_0x46073f=0xc8;}else{_0x46073f=0xce;}_0x2d351e[_0x968f('0x1b')](_0x46073f);return _0x2d351e[_0x968f('0x20')](_0x968f('0x21'),_0x103de3+'-'+_0x1e5da1+'/'+_0x430d58)[_0x968f('0x1d')](_0x33d127);}return null;};}function patchUpdates(_0x125923){return function(_0xea4452){try{jsonpatch['apply'](_0xea4452,_0x125923,!![]);}catch(_0xf14dc0){return BPromise[_0x968f('0x22')](_0xf14dc0);}return _0xea4452[_0x968f('0x23')]();};}function saveUpdates(_0x2f52a4,_0x48ffd4){return function(_0x2626fe){if(_0x2626fe){return _0x2626fe[_0x968f('0x24')](_0x2f52a4)[_0x968f('0x25')](function(_0x571635){return _0x571635;});}return null;};}function removeEntity(_0x2f8c69,_0x7e249d){return function(_0x14b4b4){if(_0x14b4b4){return _0x14b4b4[_0x968f('0x26')]()[_0x968f('0x25')](function(){_0x2f8c69['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x508820,_0x57446f){return function(_0x237239){if(!_0x237239){_0x508820['sendStatus'](0x194);}return _0x237239;};}function handleError(_0x19442b,_0x5d6912){_0x5d6912=_0x5d6912||0x1f4;return function(_0xb5ecd2){logger[_0x968f('0x27')](_0xb5ecd2[_0x968f('0x28')]);if(_0xb5ecd2[_0x968f('0x29')]){delete _0xb5ecd2['name'];}_0x19442b[_0x968f('0x1b')](_0x5d6912)[_0x968f('0x2a')](_0xb5ecd2);};}exports['index']=function(_0x6e148,_0x5505bd){var _0xb07cd={},_0x54a592={},_0x3d6738={'count':0x0,'rows':[]};var _0x59c2cc=_[_0x968f('0x2b')](db[_0x968f('0x2c')][_0x968f('0x2d')],function(_0x549d7f){return{'name':_0x549d7f[_0x968f('0x2e')],'type':_0x549d7f[_0x968f('0x2f')][_0x968f('0x30')]};});_0x54a592[_0x968f('0x31')]=_['map'](_0x59c2cc,'name');_0x54a592[_0x968f('0x32')]=_[_0x968f('0x33')](_0x6e148['query']);_0x54a592[_0x968f('0x34')]=_[_0x968f('0x35')](_0x54a592[_0x968f('0x31')],_0x54a592[_0x968f('0x32')]);_0xb07cd[_0x968f('0x36')]=_[_0x968f('0x35')](_0x54a592['model'],qs[_0x968f('0x37')](_0x6e148[_0x968f('0x32')]['fields']));_0xb07cd[_0x968f('0x36')]=_0xb07cd[_0x968f('0x36')]['length']?_0xb07cd[_0x968f('0x36')]:_0x54a592[_0x968f('0x31')];if(!_0x6e148[_0x968f('0x32')][_0x968f('0x38')](_0x968f('0x39'))){_0xb07cd[_0x968f('0x3a')]=qs['limit'](_0x6e148[_0x968f('0x32')][_0x968f('0x3a')]);_0xb07cd['offset']=qs[_0x968f('0x1f')](_0x6e148[_0x968f('0x32')][_0x968f('0x1f')]);}_0xb07cd[_0x968f('0x3b')]=qs[_0x968f('0x3c')](_0x6e148[_0x968f('0x32')][_0x968f('0x3c')]);_0xb07cd[_0x968f('0x3d')]=qs[_0x968f('0x34')](_[_0x968f('0x3e')](_0x6e148[_0x968f('0x32')],_0x54a592['filters']));if(_0x6e148[_0x968f('0x32')][_0x968f('0x3f')]){_0xb07cd[_0x968f('0x3d')]=_['merge'](_0xb07cd[_0x968f('0x3d')],{'$or':_[_0x968f('0x2b')](_0x59c2cc,function(_0x178b4a){if(_0x178b4a['type']!=='VIRTUAL'){var _0x30c6e1={};_0x30c6e1[_0x178b4a['name']]={'$like':'%'+_0x6e148[_0x968f('0x32')][_0x968f('0x3f')]+'%'};return _0x30c6e1;}})});}_0xb07cd=_[_0x968f('0x40')]({},_0xb07cd,_0x6e148[_0x968f('0x41')]);var _0x960d62={'where':_0xb07cd[_0x968f('0x3d')]};return db[_0x968f('0x2c')][_0x968f('0x1e')](_0x960d62)[_0x968f('0x25')](function(_0x5bfde7){_0x3d6738[_0x968f('0x1e')]=_0x5bfde7;if(_0x6e148[_0x968f('0x32')][_0x968f('0x42')]){_0xb07cd[_0x968f('0x43')]=[{'all':!![]}];}return db[_0x968f('0x2c')][_0x968f('0x44')](_0xb07cd);})[_0x968f('0x25')](function(_0xc2c95b){_0x3d6738[_0x968f('0x45')]=_0xc2c95b;return _0x3d6738;})[_0x968f('0x25')](respondWithFilteredResult(_0x5505bd,_0xb07cd))[_0x968f('0x46')](handleError(_0x5505bd,null));};exports[_0x968f('0x47')]=function(_0x5ad4a5,_0x4be79e){var _0x205490={'raw':!![],'where':{'id':_0x5ad4a5['params']['id']}},_0xa9879a={};_0xa9879a[_0x968f('0x31')]=_['keys'](db[_0x968f('0x2c')][_0x968f('0x2d')]);_0xa9879a[_0x968f('0x32')]=_[_0x968f('0x33')](_0x5ad4a5[_0x968f('0x32')]);_0xa9879a[_0x968f('0x34')]=_[_0x968f('0x35')](_0xa9879a[_0x968f('0x31')],_0xa9879a[_0x968f('0x32')]);_0x205490['attributes']=_[_0x968f('0x35')](_0xa9879a[_0x968f('0x31')],qs['fields'](_0x5ad4a5[_0x968f('0x32')][_0x968f('0x37')]));_0x205490[_0x968f('0x36')]=_0x205490[_0x968f('0x36')]['length']?_0x205490['attributes']:_0xa9879a[_0x968f('0x31')];if(_0x5ad4a5[_0x968f('0x32')][_0x968f('0x42')]){_0x205490[_0x968f('0x43')]=[{'all':!![]}];}_0x205490=_[_0x968f('0x40')]({},_0x205490,_0x5ad4a5[_0x968f('0x41')]);return db[_0x968f('0x2c')]['find'](_0x205490)[_0x968f('0x25')](handleEntityNotFound(_0x4be79e,null))[_0x968f('0x25')](respondWithResult(_0x4be79e,null))['catch'](handleError(_0x4be79e,null));};exports[_0x968f('0x48')]=function(_0x176c42,_0x1e776e){return db['JscriptyQuestionReport']['create'](_0x176c42[_0x968f('0x49')],{})[_0x968f('0x25')](respondWithResult(_0x1e776e,0xc9))[_0x968f('0x46')](handleError(_0x1e776e,null));};exports[_0x968f('0x24')]=function(_0x5d6f11,_0x35c13c){if(_0x5d6f11[_0x968f('0x49')]['id']){delete _0x5d6f11[_0x968f('0x49')]['id'];}return db[_0x968f('0x2c')]['find']({'where':{'id':_0x5d6f11[_0x968f('0x4a')]['id']}})[_0x968f('0x25')](handleEntityNotFound(_0x35c13c,null))[_0x968f('0x25')](saveUpdates(_0x5d6f11['body'],null))[_0x968f('0x25')](respondWithResult(_0x35c13c,null))[_0x968f('0x46')](handleError(_0x35c13c,null));};exports[_0x968f('0x26')]=function(_0x25f8b7,_0x36b8e8){return db[_0x968f('0x2c')]['find']({'where':{'id':_0x25f8b7[_0x968f('0x4a')]['id']}})[_0x968f('0x25')](handleEntityNotFound(_0x36b8e8,null))[_0x968f('0x25')](removeEntity(_0x36b8e8,null))['catch'](handleError(_0x36b8e8,null));};exports[_0x968f('0x4b')]=function(_0x11538f,_0x40d065){return db['JscriptyQuestionReport'][_0x968f('0x4b')]()['then'](respondWithResult(_0x40d065,null))['catch'](handleError(_0x40d065,null));}; \ No newline at end of file +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 diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 3d79e29..a691811 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 _0x357b=['define','report_jscripty_questions','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./jscriptyQuestionReport.attributes'];(function(_0x40822a,_0x582b60){var _0x357420=function(_0x6cee0b){while(--_0x6cee0b){_0x40822a['push'](_0x40822a['shift']());}};_0x357420(++_0x582b60);}(_0x357b,0x7a));var _0xb357=function(_0xf27bb4,_0x1bd503){_0xf27bb4=_0xf27bb4-0x0;var _0x359fee=_0x357b[_0xf27bb4];return _0x359fee;};'use strict';var _=require(_0xb357('0x0'));var util=require('util');var logger=require(_0xb357('0x1'))(_0xb357('0x2'));var moment=require('moment');var BPromise=require(_0xb357('0x3'));var rp=require(_0xb357('0x4'));var fs=require('fs');var path=require(_0xb357('0x5'));var rimraf=require(_0xb357('0x6'));var config=require('../../config/environment');var attributes=require(_0xb357('0x7'));module['exports']=function(_0x531b73,_0x1b0a45){return _0x531b73[_0xb357('0x8')]('JscriptyQuestionReport',attributes,{'tableName':_0xb357('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index ae035c1..b3d4f02 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 _0x563c=['client','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','util','bluebird','randomstring','../../config/utils','../../config/environment'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x563c,0x1ee));var _0xc563=function(_0x55fb33,_0x173b04){_0x55fb33=_0x55fb33-0x0;var _0x745748=_0x563c[_0x55fb33];return _0x745748;};'use strict';var _=require(_0xc563('0x0'));var util=require(_0xc563('0x1'));var moment=require('moment');var BPromise=require(_0xc563('0x2'));var rs=require(_0xc563('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc563('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xc563('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xc563('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a4c7b,_0x5cced1,_0x5afae0){return new BPromise(function(_0x1cc8ef,_0x595e5b){return client[_0xc563('0x7')](_0x3a4c7b,_0x5afae0)[_0xc563('0x8')](function(_0x156944){logger[_0xc563('0x9')](_0xc563('0xa'),_0x5cced1,_0xc563('0xb'));logger[_0xc563('0xc')](_0xc563('0xd'),_0x5cced1,_0xc563('0xb'),JSON[_0xc563('0xe')](_0x156944));if(_0x156944['error']){if(_0x156944[_0xc563('0xf')][_0xc563('0x10')]===0x1f4){logger[_0xc563('0xf')](_0xc563('0xa'),_0x5cced1,_0x156944[_0xc563('0xf')][_0xc563('0x11')]);return _0x595e5b(_0x156944[_0xc563('0xf')][_0xc563('0x11')]);}logger[_0xc563('0xf')](_0xc563('0xa'),_0x5cced1,_0x156944[_0xc563('0xf')][_0xc563('0x11')]);return _0x1cc8ef(_0x156944[_0xc563('0xf')][_0xc563('0x11')]);}else{logger[_0xc563('0x9')](_0xc563('0xa'),_0x5cced1,_0xc563('0xb'));_0x1cc8ef(_0x156944[_0xc563('0x12')][_0xc563('0x11')]);}})[_0xc563('0x13')](function(_0x59cb0d){logger[_0xc563('0xf')](_0xc563('0xa'),_0x5cced1,_0x59cb0d);_0x595e5b(_0x59cb0d);});});} \ No newline at end of file +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 diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 7e9bedf..7abb3c7 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 _0x3b75=['/:id','show','/:id/questions','getQuestions','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe'];(function(_0x1829c6,_0x4d98fd){var _0x19a7a0=function(_0x1292d5){while(--_0x1292d5){_0x1829c6['push'](_0x1829c6['shift']());}};_0x19a7a0(++_0x4d98fd);}(_0x3b75,0x144));var _0x53b7=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x3b75[_0x29d915];return _0x160f86;};'use strict';var multer=require(_0x53b7('0x0'));var util=require(_0x53b7('0x1'));var path=require(_0x53b7('0x2'));var timeout=require(_0x53b7('0x3'));var express=require(_0x53b7('0x4'));var router=express[_0x53b7('0x5')]();var auth=require(_0x53b7('0x6'));var interaction=require(_0x53b7('0x7'));var config=require('../../config/environment');var controller=require('./jscriptySessionReport.controller');router[_0x53b7('0x8')]('/',auth[_0x53b7('0x9')](),controller[_0x53b7('0xa')]);router[_0x53b7('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x53b7('0xb')]);router[_0x53b7('0x8')](_0x53b7('0xc'),auth[_0x53b7('0x9')](),controller[_0x53b7('0xd')]);router['get'](_0x53b7('0xe'),auth[_0x53b7('0x9')](),controller[_0x53b7('0xf')]);router[_0x53b7('0x10')]('/',auth[_0x53b7('0x9')](),controller[_0x53b7('0x11')]);router['put']('/:id',auth[_0x53b7('0x9')](),controller['update']);router[_0x53b7('0x12')]('/:id',auth[_0x53b7('0x9')](),controller[_0x53b7('0x13')]);module[_0x53b7('0x14')]=router; \ No newline at end of file +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 diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 44fe4a5..da1f8d3 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 _0x8183=['setDataValue','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','exports','DATE'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x8183,0x65));var _0x3818=function(_0x548627,_0x4ec392){_0x548627=_0x548627-0x0;var _0x844a84=_0x8183[_0x548627];return _0x844a84;};'use strict';var moment=require(_0x3818('0x0'));var Sequelize=require('sequelize');module[_0x3818('0x1')]={'starttime':{'type':Sequelize[_0x3818('0x2')],'set':function(_0x1b6729){this[_0x3818('0x3')]('starttime',_0x1b6729);this['setDataValue'](_0x3818('0x4'),moment()['format'](_0x3818('0x5')));}},'endtime':{'type':Sequelize[_0x3818('0x2')]},'membername':{'type':Sequelize[_0x3818('0x6')]},'projectname':{'type':Sequelize[_0x3818('0x6')]},'queue':{'type':Sequelize[_0x3818('0x6')]},'uniqueid':{'type':Sequelize[_0x3818('0x6')]},'calleridname':{'type':Sequelize[_0x3818('0x6')]},'calleridnum':{'type':Sequelize[_0x3818('0x6')]},'completed':{'type':Sequelize[_0x3818('0x7')],'defaultValue':![]}}; \ No newline at end of file +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 diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 3aaec2f..6b57bd9 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 _0xfd4e=['model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','JscriptySessionReport','includeAll','include','rows','catch','params','intersection','options','find','create','body','describe','getQuestions','SessionId','JscriptyQuestionReport','findAll','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key'];(function(_0x358222,_0x40554c){var _0x2e99fb=function(_0x4504f5){while(--_0x4504f5){_0x358222['push'](_0x358222['shift']());}};_0x2e99fb(++_0x40554c);}(_0xfd4e,0xbc));var _0xefd4=function(_0x2160ed,_0x11c414){_0x2160ed=_0x2160ed-0x0;var _0x50603b=_0xfd4e[_0x2160ed];return _0x50603b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xefd4('0x0'));var rimraf=require(_0xefd4('0x1'));var zipdir=require(_0xefd4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xefd4('0x3'));var BPromise=require(_0xefd4('0x4'));var Mustache=require(_0xefd4('0x5'));var util=require(_0xefd4('0x6'));var path=require(_0xefd4('0x7'));var sox=require(_0xefd4('0x8'));var csv=require(_0xefd4('0x9'));var ejs=require(_0xefd4('0xa'));var fs=require('fs');var _=require(_0xefd4('0xb'));var squel=require(_0xefd4('0xc'));var crypto=require(_0xefd4('0xd'));var jsforce=require(_0xefd4('0xe'));var deskjs=require(_0xefd4('0xf'));var toCsv=require(_0xefd4('0x9'));var querystring=require(_0xefd4('0x10'));var Papa=require('papaparse');var Redis=require(_0xefd4('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xefd4('0x12'));var hardwareService=require(_0xefd4('0x13'));var logger=require(_0xefd4('0x14'))(_0xefd4('0x15'));var utils=require(_0xefd4('0x16'));var config=require(_0xefd4('0x17'));var db=require(_0xefd4('0x18'))['db'];function respondWithStatusCode(_0x1047ce,_0xc1cfa0){_0xc1cfa0=_0xc1cfa0||0xcc;return function(_0x2063eb){if(_0x2063eb){return _0x1047ce[_0xefd4('0x19')](_0xc1cfa0);}return _0x1047ce[_0xefd4('0x1a')](_0xc1cfa0)[_0xefd4('0x1b')]();};}function respondWithResult(_0x43a0e5,_0x6032e6){_0x6032e6=_0x6032e6||0xc8;return function(_0x49114c){if(_0x49114c){return _0x43a0e5[_0xefd4('0x1a')](_0x6032e6)[_0xefd4('0x1c')](_0x49114c);}};}function respondWithFilteredResult(_0x2fce43,_0x5b87f5){return function(_0x3d9bed){if(_0x3d9bed){var _0x118fc3=_0x3d9bed[_0xefd4('0x1d')],_0x2856f6=_0x5b87f5[_0xefd4('0x1e')],_0x5f537f=_0x5b87f5[_0xefd4('0x1e')]+_0x5b87f5[_0xefd4('0x1f')],_0xaa70d7;if(_0x5f537f>=_0x118fc3){_0x5f537f=_0x118fc3;_0xaa70d7=0xc8;}else{_0xaa70d7=0xce;}_0x2fce43[_0xefd4('0x1a')](_0xaa70d7);return _0x2fce43[_0xefd4('0x20')](_0xefd4('0x21'),_0x2856f6+'-'+_0x5f537f+'/'+_0x118fc3)[_0xefd4('0x1c')](_0x3d9bed);}return null;};}function patchUpdates(_0x5d96f9){return function(_0x1d6c0c){try{jsonpatch[_0xefd4('0x22')](_0x1d6c0c,_0x5d96f9,!![]);}catch(_0xdf9de6){return BPromise[_0xefd4('0x23')](_0xdf9de6);}return _0x1d6c0c[_0xefd4('0x24')]();};}function saveUpdates(_0x1b11fd,_0x12a86a){return function(_0x3f50fc){if(_0x3f50fc){return _0x3f50fc[_0xefd4('0x25')](_0x1b11fd)[_0xefd4('0x26')](function(_0x2fe7e8){return _0x2fe7e8;});}return null;};}function removeEntity(_0x176701,_0x5a316c){return function(_0x5355e1){if(_0x5355e1){return _0x5355e1[_0xefd4('0x27')]()[_0xefd4('0x26')](function(){_0x176701['status'](0xcc)[_0xefd4('0x1b')]();});}};}function handleEntityNotFound(_0x346c5f,_0x37bfe0){return function(_0x2ca647){if(!_0x2ca647){_0x346c5f[_0xefd4('0x19')](0x194);}return _0x2ca647;};}function handleError(_0x461888,_0x966fe1){_0x966fe1=_0x966fe1||0x1f4;return function(_0x288a40){logger[_0xefd4('0x28')](_0x288a40[_0xefd4('0x29')]);if(_0x288a40['name']){delete _0x288a40[_0xefd4('0x2a')];}_0x461888['status'](_0x966fe1)['send'](_0x288a40);};}exports[_0xefd4('0x2b')]=function(_0x4631f1,_0x2a59ce){var _0x51ff71={},_0x39aad6={},_0x155426={'count':0x0,'rows':[]};var _0x4634ba=_[_0xefd4('0x2c')](db['JscriptySessionReport'][_0xefd4('0x2d')],function(_0x29b329){return{'name':_0x29b329[_0xefd4('0x2e')],'type':_0x29b329[_0xefd4('0x2f')][_0xefd4('0x30')]};});_0x39aad6[_0xefd4('0x31')]=_[_0xefd4('0x2c')](_0x4634ba,'name');_0x39aad6['query']=_[_0xefd4('0x32')](_0x4631f1[_0xefd4('0x33')]);_0x39aad6[_0xefd4('0x34')]=_['intersection'](_0x39aad6[_0xefd4('0x31')],_0x39aad6['query']);_0x51ff71[_0xefd4('0x35')]=_['intersection'](_0x39aad6['model'],qs['fields'](_0x4631f1[_0xefd4('0x33')][_0xefd4('0x36')]));_0x51ff71[_0xefd4('0x35')]=_0x51ff71[_0xefd4('0x35')][_0xefd4('0x37')]?_0x51ff71['attributes']:_0x39aad6[_0xefd4('0x31')];if(!_0x4631f1[_0xefd4('0x33')][_0xefd4('0x38')](_0xefd4('0x39'))){_0x51ff71['limit']=qs[_0xefd4('0x1f')](_0x4631f1[_0xefd4('0x33')]['limit']);_0x51ff71[_0xefd4('0x1e')]=qs['offset'](_0x4631f1[_0xefd4('0x33')][_0xefd4('0x1e')]);}_0x51ff71['order']=qs[_0xefd4('0x3a')](_0x4631f1[_0xefd4('0x33')][_0xefd4('0x3a')]);_0x51ff71[_0xefd4('0x3b')]=qs[_0xefd4('0x34')](_['pick'](_0x4631f1[_0xefd4('0x33')],_0x39aad6[_0xefd4('0x34')]));if(_0x4631f1['query']['filter']){_0x51ff71[_0xefd4('0x3b')]=_[_0xefd4('0x3c')](_0x51ff71['where'],{'$or':_[_0xefd4('0x2c')](_0x4634ba,function(_0x124bee){if(_0x124bee[_0xefd4('0x2f')]!==_0xefd4('0x3d')){var _0x43c5d7={};_0x43c5d7[_0x124bee[_0xefd4('0x2a')]]={'$like':'%'+_0x4631f1[_0xefd4('0x33')][_0xefd4('0x3e')]+'%'};return _0x43c5d7;}})});}_0x51ff71=_[_0xefd4('0x3c')]({},_0x51ff71,_0x4631f1['options']);var _0x360f5c={'where':_0x51ff71['where']};return db[_0xefd4('0x3f')][_0xefd4('0x1d')](_0x360f5c)['then'](function(_0x286320){_0x155426[_0xefd4('0x1d')]=_0x286320;if(_0x4631f1[_0xefd4('0x33')][_0xefd4('0x40')]){_0x51ff71[_0xefd4('0x41')]=[{'all':!![]}];}return db[_0xefd4('0x3f')]['findAll'](_0x51ff71);})[_0xefd4('0x26')](function(_0x15a27e){_0x155426[_0xefd4('0x42')]=_0x15a27e;return _0x155426;})['then'](respondWithFilteredResult(_0x2a59ce,_0x51ff71))[_0xefd4('0x43')](handleError(_0x2a59ce,null));};exports['show']=function(_0x57b989,_0x36b9c1){var _0xf9479c={'raw':!![],'where':{'id':_0x57b989[_0xefd4('0x44')]['id']}},_0x45dc6b={};_0x45dc6b[_0xefd4('0x31')]=_[_0xefd4('0x32')](db[_0xefd4('0x3f')][_0xefd4('0x2d')]);_0x45dc6b[_0xefd4('0x33')]=_[_0xefd4('0x32')](_0x57b989[_0xefd4('0x33')]);_0x45dc6b['filters']=_[_0xefd4('0x45')](_0x45dc6b[_0xefd4('0x31')],_0x45dc6b[_0xefd4('0x33')]);_0xf9479c[_0xefd4('0x35')]=_[_0xefd4('0x45')](_0x45dc6b[_0xefd4('0x31')],qs[_0xefd4('0x36')](_0x57b989[_0xefd4('0x33')][_0xefd4('0x36')]));_0xf9479c[_0xefd4('0x35')]=_0xf9479c['attributes'][_0xefd4('0x37')]?_0xf9479c[_0xefd4('0x35')]:_0x45dc6b[_0xefd4('0x31')];if(_0x57b989[_0xefd4('0x33')]['includeAll']){_0xf9479c[_0xefd4('0x41')]=[{'all':!![]}];}_0xf9479c=_[_0xefd4('0x3c')]({},_0xf9479c,_0x57b989[_0xefd4('0x46')]);return db[_0xefd4('0x3f')][_0xefd4('0x47')](_0xf9479c)[_0xefd4('0x26')](handleEntityNotFound(_0x36b9c1,null))[_0xefd4('0x26')](respondWithResult(_0x36b9c1,null))[_0xefd4('0x43')](handleError(_0x36b9c1,null));};exports['create']=function(_0xcf0cf5,_0x5bec2d){return db[_0xefd4('0x3f')][_0xefd4('0x48')](_0xcf0cf5[_0xefd4('0x49')],{})[_0xefd4('0x26')](respondWithResult(_0x5bec2d,0xc9))[_0xefd4('0x43')](handleError(_0x5bec2d,null));};exports[_0xefd4('0x25')]=function(_0x4732ee,_0x4458bd){if(_0x4732ee[_0xefd4('0x49')]['id']){delete _0x4732ee[_0xefd4('0x49')]['id'];}return db[_0xefd4('0x3f')]['find']({'where':{'id':_0x4732ee[_0xefd4('0x44')]['id']}})[_0xefd4('0x26')](handleEntityNotFound(_0x4458bd,null))[_0xefd4('0x26')](saveUpdates(_0x4732ee[_0xefd4('0x49')],null))['then'](respondWithResult(_0x4458bd,null))[_0xefd4('0x43')](handleError(_0x4458bd,null));};exports['destroy']=function(_0x1e348f,_0x58f698){return db['JscriptySessionReport'][_0xefd4('0x47')]({'where':{'id':_0x1e348f['params']['id']}})[_0xefd4('0x26')](handleEntityNotFound(_0x58f698,null))[_0xefd4('0x26')](removeEntity(_0x58f698,null))[_0xefd4('0x43')](handleError(_0x58f698,null));};exports[_0xefd4('0x4a')]=function(_0x192033,_0x414098){return db[_0xefd4('0x3f')][_0xefd4('0x4a')]()[_0xefd4('0x26')](respondWithResult(_0x414098,null))[_0xefd4('0x43')](handleError(_0x414098,null));};exports[_0xefd4('0x4b')]=function(_0x4d4847,_0x2444bb,_0x2288f0){var _0x49e16b={'raw':!![],'where':{}};var _0x3e149f={};var _0x4b1c59={'count':0x0,'rows':[]};return db[_0xefd4('0x3f')]['findOne']({'where':{'id':_0x4d4847[_0xefd4('0x44')]['id']}})['then'](handleEntityNotFound(_0x2444bb,null))[_0xefd4('0x26')](function(_0x494be7){if(_0x494be7){_0x3e149f[_0xefd4('0x31')]=_[_0xefd4('0x32')](db['JscriptyQuestionReport'][_0xefd4('0x2d')]);_0x3e149f[_0xefd4('0x33')]=_[_0xefd4('0x32')](_0x4d4847[_0xefd4('0x33')]);_0x3e149f['filters']=_['intersection'](_0x3e149f['model'],_0x3e149f['query']);_0x49e16b['attributes']=_[_0xefd4('0x45')](_0x3e149f[_0xefd4('0x31')],qs[_0xefd4('0x36')](_0x4d4847[_0xefd4('0x33')]['fields']));_0x49e16b[_0xefd4('0x35')]=_0x49e16b[_0xefd4('0x35')][_0xefd4('0x37')]?_0x49e16b[_0xefd4('0x35')]:_0x3e149f['model'];if(!_0x4d4847['query'][_0xefd4('0x38')](_0xefd4('0x39'))){_0x49e16b['limit']=qs['limit'](_0x4d4847['query'][_0xefd4('0x1f')]);_0x49e16b[_0xefd4('0x1e')]=qs[_0xefd4('0x1e')](_0x4d4847[_0xefd4('0x33')][_0xefd4('0x1e')]);}_0x49e16b['order']=qs[_0xefd4('0x3a')](_0x4d4847[_0xefd4('0x33')]['sort']);_0x49e16b[_0xefd4('0x3b')]=qs[_0xefd4('0x34')](_['pick'](_0x4d4847[_0xefd4('0x33')],_0x3e149f[_0xefd4('0x34')]));_0x49e16b['where'][_0xefd4('0x4c')]=_0x494be7['id'];if(_0x4d4847[_0xefd4('0x33')][_0xefd4('0x3e')]){_0x49e16b[_0xefd4('0x3b')]=_['merge'](_0x49e16b['where'],{'$or':_['map'](_0x49e16b[_0xefd4('0x35')],function(_0x4eed9){var _0x19d63f={};_0x19d63f[_0x4eed9]={'$like':'%'+_0x4d4847[_0xefd4('0x33')]['filter']+'%'};return _0x19d63f;})});}_0x49e16b=_['merge']({},_0x49e16b,_0x4d4847[_0xefd4('0x46')]);return db[_0xefd4('0x4d')][_0xefd4('0x1d')]({'where':_0x49e16b[_0xefd4('0x3b')]})['then'](function(_0x58d7ec){_0x4b1c59[_0xefd4('0x1d')]=_0x58d7ec;if(_0x4d4847['query']['includeAll']){_0x49e16b[_0xefd4('0x41')]=[{'all':!![]}];}return db[_0xefd4('0x4d')][_0xefd4('0x4e')](_0x49e16b);})[_0xefd4('0x26')](function(_0x134cea){_0x4b1c59['rows']=_0x134cea;return _0x4b1c59;});}})['then'](respondWithFilteredResult(_0x2444bb,_0x49e16b))['catch'](handleError(_0x2444bb,null));}; \ No newline at end of file +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 diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 7bfb239..cff3e99 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 _0x6ac5=['JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x29c42c,_0x12a918){var _0x5ea3db=function(_0x45424e){while(--_0x45424e){_0x29c42c['push'](_0x29c42c['shift']());}};_0x5ea3db(++_0x12a918);}(_0x6ac5,0x9e));var _0x56ac=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6ac5[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x56ac('0x0'));var util=require(_0x56ac('0x1'));var logger=require(_0x56ac('0x2'))(_0x56ac('0x3'));var moment=require(_0x56ac('0x4'));var BPromise=require(_0x56ac('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x56ac('0x6'));var rimraf=require(_0x56ac('0x7'));var config=require(_0x56ac('0x8'));var attributes=require('./jscriptySessionReport.attributes');module[_0x56ac('0x9')]=function(_0x56e5f7,_0xdc3287){return _0x56e5f7['define'](_0x56ac('0xa'),attributes,{'tableName':_0x56ac('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index a69520d..e4d1bbd 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 _0x1fee=['jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x1fee,0x12e));var _0xe1fe=function(_0x7d829d,_0x3a0add){_0x7d829d=_0x7d829d-0x0;var _0x4b9e35=_0x1fee[_0x7d829d];return _0x4b9e35;};'use strict';var _=require(_0xe1fe('0x0'));var util=require(_0xe1fe('0x1'));var moment=require(_0xe1fe('0x2'));var BPromise=require(_0xe1fe('0x3'));var rs=require(_0xe1fe('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe1fe('0x5'))['db'];var utils=require(_0xe1fe('0x6'));var logger=require(_0xe1fe('0x7'))(_0xe1fe('0x8'));var config=require(_0xe1fe('0x9'));var jayson=require(_0xe1fe('0xa'));var client=jayson[_0xe1fe('0xb')][_0xe1fe('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x48462a,_0x5a25b5,_0xcd0968){return new BPromise(function(_0x40bd2e,_0x56ee79){return client[_0xe1fe('0xd')](_0x48462a,_0xcd0968)['then'](function(_0x245ebc){logger[_0xe1fe('0xe')]('JscriptySessionReport,\x20%s,\x20%s',_0x5a25b5,_0xe1fe('0xf'));logger[_0xe1fe('0x10')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x5a25b5,_0xe1fe('0xf'),JSON[_0xe1fe('0x11')](_0x245ebc));if(_0x245ebc[_0xe1fe('0x12')]){if(_0x245ebc[_0xe1fe('0x12')][_0xe1fe('0x13')]===0x1f4){logger[_0xe1fe('0x12')](_0xe1fe('0x14'),_0x5a25b5,_0x245ebc[_0xe1fe('0x12')][_0xe1fe('0x15')]);return _0x56ee79(_0x245ebc['error']['message']);}logger[_0xe1fe('0x12')](_0xe1fe('0x14'),_0x5a25b5,_0x245ebc[_0xe1fe('0x12')][_0xe1fe('0x15')]);return _0x40bd2e(_0x245ebc[_0xe1fe('0x12')][_0xe1fe('0x15')]);}else{logger[_0xe1fe('0xe')](_0xe1fe('0x14'),_0x5a25b5,_0xe1fe('0xf'));_0x40bd2e(_0x245ebc[_0xe1fe('0x16')][_0xe1fe('0x15')]);}})[_0xe1fe('0x17')](function(_0x5daa4f){logger[_0xe1fe('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x5a25b5,_0x5daa4f);_0x56ee79(_0x5daa4f);});});} \ No newline at end of file +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 diff --git a/server/api/license/index.js b/server/api/license/index.js index 522c4a5..e9c6af4 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 _0x5cb4=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','/:id','isAuthenticated','exports','util','path'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x5cb4,0x98));var _0x45cb=function(_0x57f442,_0x521bd8){_0x57f442=_0x57f442-0x0;var _0x499120=_0x5cb4[_0x57f442];return _0x499120;};'use strict';var multer=require('multer');var util=require(_0x45cb('0x0'));var path=require(_0x45cb('0x1'));var timeout=require(_0x45cb('0x2'));var express=require(_0x45cb('0x3'));var router=express[_0x45cb('0x4')]();var auth=require(_0x45cb('0x5'));var interaction=require(_0x45cb('0x6'));var config=require(_0x45cb('0x7'));var controller=require(_0x45cb('0x8'));router[_0x45cb('0x9')]('/',controller[_0x45cb('0xa')]);router['put'](_0x45cb('0xb'),auth[_0x45cb('0xc')](),controller['update']);module[_0x45cb('0xd')]=router; \ No newline at end of file +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 diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 765bc53..3abd3e0 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 _0x814b=['TEXT','STRING','INTEGER','sequelize','exports'];(function(_0x41ed2f,_0x91c6b4){var _0x5e0588=function(_0x24a687){while(--_0x24a687){_0x41ed2f['push'](_0x41ed2f['shift']());}};_0x5e0588(++_0x91c6b4);}(_0x814b,0x1a2));var _0xb814=function(_0xbf19d7,_0x58b2bf){_0xbf19d7=_0xbf19d7-0x0;var _0x376e11=_0x814b[_0xbf19d7];return _0x376e11;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'license':{'type':Sequelize[_0xb814('0x2')]},'data1':{'type':Sequelize[_0xb814('0x3')]},'data2':{'type':Sequelize[_0xb814('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xb814('0x4')],'defaultValue':0x0}}; \ No newline at end of file +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 diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index a33dcf3..ee16e3d 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 _0x49aa=['options','getLicense','catch','body','find','params','checkLicense','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','then','stack','name','send','../../config/license/util','index','keys','License','rawAttributes','query','filters','intersection','model','fields','attributes','length'];(function(_0x4ae2fb,_0x1c1c67){var _0x4f5268=function(_0x11236b){while(--_0x11236b){_0x4ae2fb['push'](_0x4ae2fb['shift']());}};_0x4f5268(++_0x1c1c67);}(_0x49aa,0xe3));var _0xa49a=function(_0x4ab596,_0x106ca0){_0x4ab596=_0x4ab596-0x0;var _0x142d00=_0x49aa[_0x4ab596];return _0x142d00;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa49a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa49a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa49a('0x2'));var moment=require(_0xa49a('0x3'));var BPromise=require(_0xa49a('0x4'));var Mustache=require(_0xa49a('0x5'));var util=require(_0xa49a('0x6'));var path=require(_0xa49a('0x7'));var sox=require(_0xa49a('0x8'));var csv=require(_0xa49a('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa49a('0xa'));var squel=require('squel');var crypto=require(_0xa49a('0xb'));var jsforce=require(_0xa49a('0xc'));var deskjs=require(_0xa49a('0xd'));var toCsv=require(_0xa49a('0x9'));var querystring=require(_0xa49a('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa49a('0xf'));var qs=require(_0xa49a('0x10'));var as=require(_0xa49a('0x11'));var hardwareService=require(_0xa49a('0x12'));var logger=require(_0xa49a('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xa49a('0x14'))['db'];function respondWithStatusCode(_0x4b8329,_0x1b5864){_0x1b5864=_0x1b5864||0xcc;return function(_0x3dffd3){if(_0x3dffd3){return _0x4b8329[_0xa49a('0x15')](_0x1b5864);}return _0x4b8329[_0xa49a('0x16')](_0x1b5864)[_0xa49a('0x17')]();};}function respondWithResult(_0x4f88d3,_0xc8171a){_0xc8171a=_0xc8171a||0xc8;return function(_0x18528d){if(_0x18528d){return _0x4f88d3[_0xa49a('0x16')](_0xc8171a)[_0xa49a('0x18')](_0x18528d);}};}function respondWithFilteredResult(_0x4120f2,_0x1606f9){return function(_0x4d6188){if(_0x4d6188){var _0x365e01=_0x4d6188['count'],_0xc09030=_0x1606f9[_0xa49a('0x19')],_0x549236=_0x1606f9['offset']+_0x1606f9[_0xa49a('0x1a')],_0xe4da77;if(_0x549236>=_0x365e01){_0x549236=_0x365e01;_0xe4da77=0xc8;}else{_0xe4da77=0xce;}_0x4120f2[_0xa49a('0x16')](_0xe4da77);return _0x4120f2[_0xa49a('0x1b')]('Content-Range',_0xc09030+'-'+_0x549236+'/'+_0x365e01)[_0xa49a('0x18')](_0x4d6188);}return null;};}function patchUpdates(_0x4c1b93){return function(_0x1d8631){try{jsonpatch[_0xa49a('0x1c')](_0x1d8631,_0x4c1b93,!![]);}catch(_0x5d001e){return BPromise[_0xa49a('0x1d')](_0x5d001e);}return _0x1d8631[_0xa49a('0x1e')]();};}function saveUpdates(_0x537422,_0x4d69c9){return function(_0x221d11){if(_0x221d11){return _0x221d11[_0xa49a('0x1f')](_0x537422)[_0xa49a('0x20')](function(_0x523d6c){return _0x523d6c;});}return null;};}function removeEntity(_0x2f0546,_0x3d2d40){return function(_0x15efd2){if(_0x15efd2){return _0x15efd2['destroy']()[_0xa49a('0x20')](function(){_0x2f0546['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a0663,_0x55e78b){return function(_0xec78b3){if(!_0xec78b3){_0x2a0663[_0xa49a('0x15')](0x194);}return _0xec78b3;};}function handleError(_0x51a134,_0x415bd2){_0x415bd2=_0x415bd2||0x1f4;return function(_0x376e0e){logger['error'](_0x376e0e[_0xa49a('0x21')]);if(_0x376e0e['name']){delete _0x376e0e[_0xa49a('0x22')];}_0x51a134[_0xa49a('0x16')](_0x415bd2)[_0xa49a('0x23')](_0x376e0e);};}var utilLicense=require(_0xa49a('0x24'));exports[_0xa49a('0x25')]=function(_0xaf1360,_0xc97e6e){var _0x71c459={'raw':!![],'where':{'id':0x1}},_0x569b39={};_0x569b39['model']=_[_0xa49a('0x26')](db[_0xa49a('0x27')][_0xa49a('0x28')]);_0x569b39['query']=_[_0xa49a('0x26')](_0xaf1360[_0xa49a('0x29')]);_0x569b39[_0xa49a('0x2a')]=_[_0xa49a('0x2b')](_0x569b39[_0xa49a('0x2c')],_0x569b39[_0xa49a('0x29')]);_0x71c459['attributes']=_[_0xa49a('0x2b')](_0x569b39['model'],qs[_0xa49a('0x2d')](_0xaf1360[_0xa49a('0x29')][_0xa49a('0x2d')]));_0x71c459[_0xa49a('0x2e')]=_0x71c459[_0xa49a('0x2e')][_0xa49a('0x2f')]?_0x71c459[_0xa49a('0x2e')]:_0x569b39[_0xa49a('0x2c')];_0x71c459=_['merge']({},_0x71c459,_0xaf1360[_0xa49a('0x30')]);return utilLicense[_0xa49a('0x31')](_0x71c459)[_0xa49a('0x20')](respondWithResult(_0xc97e6e,null))[_0xa49a('0x32')](handleError(_0xc97e6e,null));};exports[_0xa49a('0x1f')]=function(_0x40d0f4,_0x395f01){if(_0x40d0f4[_0xa49a('0x33')]['id']){delete _0x40d0f4['body']['id'];}return db[_0xa49a('0x27')][_0xa49a('0x34')]({'where':{'id':_0x40d0f4[_0xa49a('0x35')]['id']}})['then'](handleEntityNotFound(_0x395f01,null))['then'](function(_0x9157b3){var _0xd75933=_0x9157b3['get']({'plain':!![]});return utilLicense[_0xa49a('0x36')](_0xd75933,_0x40d0f4[_0xa49a('0x33')]['key']);})[_0xa49a('0x20')](function(_0x27a373){if(!_0x27a373['demo']){return saveUpdates(_0x40d0f4[_0xa49a('0x33')],null);}return _0x27a373;})[_0xa49a('0x20')](respondWithResult(_0x395f01,null))[_0xa49a('0x32')](handleError(_0x395f01,null));}; \ No newline at end of file +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 diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 106b1d1..dc5d1ef 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 _0xe77f=['request-promise','path','../../config/environment','./license.attributes','exports','license','lodash','util','api','moment'];(function(_0x2b6e2f,_0x2e9736){var _0x2ef6ef=function(_0x46d310){while(--_0x46d310){_0x2b6e2f['push'](_0x2b6e2f['shift']());}};_0x2ef6ef(++_0x2e9736);}(_0xe77f,0xba));var _0xfe77=function(_0x40ef2d,_0x3063e0){_0x40ef2d=_0x40ef2d-0x0;var _0x5234d3=_0xe77f[_0x40ef2d];return _0x5234d3;};'use strict';var _=require(_0xfe77('0x0'));var util=require(_0xfe77('0x1'));var logger=require('../../config/logger')(_0xfe77('0x2'));var moment=require(_0xfe77('0x3'));var BPromise=require('bluebird');var rp=require(_0xfe77('0x4'));var fs=require('fs');var path=require(_0xfe77('0x5'));var rimraf=require('rimraf');var config=require(_0xfe77('0x6'));var attributes=require(_0xfe77('0x7'));module[_0xfe77('0x8')]=function(_0x1ce970,_0x130b85){return _0x1ce970['define']('License',attributes,{'tableName':_0xfe77('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 4a1d1e3..f147d94 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 _0x9086=['debug','License,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','License,\x20%s,\x20%s','request\x20sent'];(function(_0x53a4fc,_0x4b8049){var _0x162dd9=function(_0x10b6a1){while(--_0x10b6a1){_0x53a4fc['push'](_0x53a4fc['shift']());}};_0x162dd9(++_0x4b8049);}(_0x9086,0x10b));var _0x6908=function(_0x34c4e1,_0x310387){_0x34c4e1=_0x34c4e1-0x0;var _0x5a11ef=_0x9086[_0x34c4e1];return _0x5a11ef;};'use strict';var _=require(_0x6908('0x0'));var util=require(_0x6908('0x1'));var moment=require('moment');var BPromise=require(_0x6908('0x2'));var rs=require(_0x6908('0x3'));var fs=require('fs');var Redis=require(_0x6908('0x4'));var db=require(_0x6908('0x5'))['db'];var utils=require(_0x6908('0x6'));var logger=require(_0x6908('0x7'))('rpc');var config=require(_0x6908('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6908('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e8ff0,_0xd81571,_0x2049a1){return new BPromise(function(_0x2ce577,_0x56df93){return client[_0x6908('0xa')](_0x4e8ff0,_0x2049a1)['then'](function(_0x1efa71){logger['info'](_0x6908('0xb'),_0xd81571,_0x6908('0xc'));logger[_0x6908('0xd')](_0x6908('0xe'),_0xd81571,_0x6908('0xc'),JSON['stringify'](_0x1efa71));if(_0x1efa71[_0x6908('0xf')]){if(_0x1efa71[_0x6908('0xf')][_0x6908('0x10')]===0x1f4){logger[_0x6908('0xf')](_0x6908('0xb'),_0xd81571,_0x1efa71[_0x6908('0xf')][_0x6908('0x11')]);return _0x56df93(_0x1efa71[_0x6908('0xf')][_0x6908('0x11')]);}logger['error'](_0x6908('0xb'),_0xd81571,_0x1efa71['error'][_0x6908('0x11')]);return _0x2ce577(_0x1efa71[_0x6908('0xf')]['message']);}else{logger[_0x6908('0x12')](_0x6908('0xb'),_0xd81571,_0x6908('0xc'));_0x2ce577(_0x1efa71[_0x6908('0x13')][_0x6908('0x11')]);}})['catch'](function(_0x538ad1){logger[_0x6908('0xf')](_0x6908('0xb'),_0xd81571,_0x538ad1);_0x56df93(_0x538ad1);});});} \ No newline at end of file +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 diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 685464d..9dd2e65 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 _0x1ae5=['post','addDisposition','addAnswer','create','addImap','addInteraction','addApplications','send','/:id/users','addAgents','put','update','removeDispositions','delete','removeImap','removeSmtp','destroy','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','getApplications','getMessages','/:id/verify','verifySmtp'];(function(_0x483102,_0x54e93d){var _0x5cc885=function(_0x54931c){while(--_0x54931c){_0x483102['push'](_0x483102['shift']());}};_0x5cc885(++_0x54e93d);}(_0x1ae5,0x1cb));var _0x51ae=function(_0x478a61,_0x2ec43a){_0x478a61=_0x478a61-0x0;var _0x5a3ce3=_0x1ae5[_0x478a61];return _0x5a3ce3;};'use strict';var multer=require(_0x51ae('0x0'));var util=require('util');var path=require(_0x51ae('0x1'));var timeout=require(_0x51ae('0x2'));var express=require(_0x51ae('0x3'));var router=express['Router']();var auth=require(_0x51ae('0x4'));var interaction=require(_0x51ae('0x5'));var config=require(_0x51ae('0x6'));var controller=require('./mailAccount.controller');router[_0x51ae('0x7')]('/',auth['isAuthenticated'](),controller[_0x51ae('0x8')]);router[_0x51ae('0x7')]('/describe',auth[_0x51ae('0x9')](),controller[_0x51ae('0xa')]);router[_0x51ae('0x7')](_0x51ae('0xb'),auth[_0x51ae('0x9')](),controller['show']);router[_0x51ae('0x7')](_0x51ae('0xc'),auth[_0x51ae('0x9')](),controller[_0x51ae('0xd')]);router[_0x51ae('0x7')](_0x51ae('0xe'),auth[_0x51ae('0x9')](),controller[_0x51ae('0xf')]);router[_0x51ae('0x7')](_0x51ae('0x10'),auth[_0x51ae('0x9')](),controller['getImap']);router['get'](_0x51ae('0x11'),auth[_0x51ae('0x9')](),controller[_0x51ae('0x12')]);router['get'](_0x51ae('0x13'),auth[_0x51ae('0x9')](),controller[_0x51ae('0x14')]);router[_0x51ae('0x7')]('/:id/applications',auth['isAuthenticated'](),controller[_0x51ae('0x15')]);router[_0x51ae('0x7')]('/:id/messages',auth[_0x51ae('0x9')](),controller[_0x51ae('0x16')]);router[_0x51ae('0x7')](_0x51ae('0x17'),auth[_0x51ae('0x9')](),controller[_0x51ae('0x18')]);router[_0x51ae('0x7')]('/:id/users',auth[_0x51ae('0x9')](),controller['getAgents']);router[_0x51ae('0x19')](_0x51ae('0xc'),auth[_0x51ae('0x9')](),controller[_0x51ae('0x1a')]);router[_0x51ae('0x19')](_0x51ae('0xe'),auth[_0x51ae('0x9')](),controller[_0x51ae('0x1b')]);router[_0x51ae('0x19')]('/',auth[_0x51ae('0x9')](),controller[_0x51ae('0x1c')]);router[_0x51ae('0x19')](_0x51ae('0x10'),auth[_0x51ae('0x9')](),controller[_0x51ae('0x1d')]);router[_0x51ae('0x19')](_0x51ae('0x11'),auth['isAuthenticated'](),controller['addSmtp']);router['post'](_0x51ae('0x13'),auth[_0x51ae('0x9')](),controller[_0x51ae('0x1e')]);router[_0x51ae('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x51ae('0x1f')]);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0x51ae('0x20')]);router['post'](_0x51ae('0x21'),auth['isAuthenticated'](),controller[_0x51ae('0x22')]);router[_0x51ae('0x23')](_0x51ae('0xb'),auth['isAuthenticated'](),controller[_0x51ae('0x24')]);router['delete'](_0x51ae('0xc'),auth[_0x51ae('0x9')](),controller[_0x51ae('0x25')]);router[_0x51ae('0x26')](_0x51ae('0xe'),auth[_0x51ae('0x9')](),controller['removeAnswers']);router['delete']('/:id/in_servers',auth[_0x51ae('0x9')](),controller[_0x51ae('0x27')]);router[_0x51ae('0x26')]('/:id/out_servers',auth[_0x51ae('0x9')](),controller[_0x51ae('0x28')]);router[_0x51ae('0x26')](_0x51ae('0xb'),auth[_0x51ae('0x9')](),controller[_0x51ae('0x29')]);router[_0x51ae('0x26')]('/:id/users',auth[_0x51ae('0x9')](),controller[_0x51ae('0x2a')]);module[_0x51ae('0x2b')]=router; \ No newline at end of file +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 diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 3251b39..74e4eef 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 _0x4529=['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}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue'];(function(_0x22ee74,_0x86fe6d){var _0x309825=function(_0x4f2c6){while(--_0x4f2c6){_0x22ee74['push'](_0x22ee74['shift']());}};_0x309825(++_0x86fe6d);}(_0x4529,0x9c));var _0x9452=function(_0x445a17,_0x5082dd){_0x445a17=_0x445a17-0x0;var _0x4dbfc3=_0x4529[_0x445a17];return _0x4dbfc3;};'use strict';var Sequelize=require('sequelize');module[_0x9452('0x0')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x9452('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x9452('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x9452('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x9452('0x2')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x9452('0x3')]},'markAsUnread':{'type':Sequelize[_0x9452('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9452('0x4')},'fontSize':{'type':Sequelize[_0x9452('0x5')](0x2)[_0x9452('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x9452('0x7');}},'notificationSound':{'type':Sequelize[_0x9452('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9452('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9452('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9452('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9452('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x9452('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x9452('0x2')],'defaultValue':![],'comment':_0x9452('0x9'),'set':function(_0x465e77){if(!_0x465e77)this['setDataValue'](_0x9452('0xa'),null);this[_0x9452('0xb')]('mandatoryDisposition',_0x465e77);}}}; \ No newline at end of file +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 diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 4c11ba3..bee11ce 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 _0x7099=['%s\x20<%s>','attachments','join','root','server/files/attachments','basename','secure','auth','SendMail','sendMail','List\x20not\x20found','messageId','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','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','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','status','json','count','limit','set','Content-Range','save','then','destroy','get','MailAccounts','UserProfileResource','end','sendStatus','stack','name','send','index','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','offset','order','sort','where','pick','merge','filter','options','includeAll','include','MailAccount','findAll','show','params','MailServerIn','length','find','update','body','catch','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','rows','removeDispositions','ids','addAnswer','findOne','CannedAnswer','nolimit','removeAnswers','email','ListId','isNil','active','description','cauthentication','user','cuser','pass','cpassword','authentication','host','port','service','cservice','password','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','setSmtp','addInteraction','omit','getInteractions','MailInteraction','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','tag','sequelize','transaction','MailApplication','bulkCreate','priority','getApplications','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','split','CmList','List','Contacts','updatedAt','DESC','from'];(function(_0x5f2ed7,_0x229833){var _0x196053=function(_0x114dde){while(--_0x114dde){_0x5f2ed7['push'](_0x5f2ed7['shift']());}};_0x196053(++_0x229833);}(_0x7099,0xe4));var _0x9709=function(_0x3598b5,_0x419f0){_0x3598b5=_0x3598b5-0x0;var _0x4bd112=_0x7099[_0x3598b5];return _0x4bd112;};'use strict';var pdf=require(_0x9709('0x0'));var emlformat=require(_0x9709('0x1'));var rimraf=require(_0x9709('0x2'));var zipdir=require(_0x9709('0x3'));var jsonpatch=require(_0x9709('0x4'));var rp=require(_0x9709('0x5'));var moment=require(_0x9709('0x6'));var BPromise=require(_0x9709('0x7'));var Mustache=require(_0x9709('0x8'));var util=require(_0x9709('0x9'));var path=require(_0x9709('0xa'));var sox=require('sox');var csv=require(_0x9709('0xb'));var ejs=require(_0x9709('0xc'));var fs=require('fs');var _=require(_0x9709('0xd'));var squel=require(_0x9709('0xe'));var crypto=require(_0x9709('0xf'));var jsforce=require(_0x9709('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x9709('0xb'));var querystring=require(_0x9709('0x11'));var Papa=require(_0x9709('0x12'));var Redis=require(_0x9709('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x9709('0x14'));var as=require(_0x9709('0x15'));var hardwareService=require(_0x9709('0x16'));var logger=require(_0x9709('0x17'))('api');var utils=require(_0x9709('0x18'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x9709('0x19')]=_[_0x9709('0x1a')](config[_0x9709('0x19')],{'host':_0x9709('0x1b'),'port':0x18eb});var socket=require(_0x9709('0x1c'))(new Redis(config[_0x9709('0x19')]));require(_0x9709('0x1d'))['register'](socket);var jayson=require(_0x9709('0x1e'));var client=jayson['client'][_0x9709('0x1f')]({'port':0x232b});function checkPasswordPattern(_0xf248c8,_0x5bcd14,_0x47f34f){if(_0x47f34f){var _0x38c079=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x38c079[_0x9709('0x20')](_0x5bcd14)){return _0xf248c8;}else{throw new db[(_0x9709('0x21'))][(_0x9709('0x22'))](_0x9709('0x23'));}}else{return _0xf248c8;}}function respondWithRpcPromise(_0x247d15,_0x529083,_0x1b481c,_0x1d6db8){return new BPromise(function(_0x78bc1e,_0x51d317){var _0x37ec30=_0x1d6db8||client;return _0x37ec30[_0x9709('0x24')](_0x247d15,_0x1b481c)['then'](function(_0x599f11){logger[_0x9709('0x25')]('MailAccount,\x20%s,\x20%s',_0x529083,_0x9709('0x26'));logger[_0x9709('0x27')](_0x9709('0x28'),_0x529083,_0x9709('0x26'),JSON[_0x9709('0x29')](_0x599f11));if(_0x599f11['error']){if(_0x599f11[_0x9709('0x2a')][_0x9709('0x2b')]===0x1f4){logger[_0x9709('0x2a')](_0x9709('0x2c'),_0x529083,_0x599f11[_0x9709('0x2a')][_0x9709('0x2d')]);return _0x51d317(_0x599f11[_0x9709('0x2a')][_0x9709('0x2d')]);}logger[_0x9709('0x2a')](_0x9709('0x2c'),_0x529083,_0x599f11[_0x9709('0x2a')][_0x9709('0x2d')]);return _0x78bc1e(_0x599f11[_0x9709('0x2a')]['message']);}else{logger[_0x9709('0x25')]('MailAccount,\x20%s,\x20%s',_0x529083,_0x9709('0x26'));_0x78bc1e(_0x599f11[_0x9709('0x2e')]['message']);}})['catch'](function(_0x427357){logger[_0x9709('0x2a')](_0x9709('0x2c'),_0x529083,_0x427357);_0x51d317(_0x427357);});});}function respondWithStatusCode(_0x892b92,_0x4e7afc){_0x4e7afc=_0x4e7afc||0xcc;return function(_0xde3ae6){if(_0xde3ae6){return _0x892b92['sendStatus'](_0x4e7afc);}return _0x892b92[_0x9709('0x2f')](_0x4e7afc)['end']();};}function respondWithResult(_0x2bf36c,_0x33348b){_0x33348b=_0x33348b||0xc8;return function(_0x5be68e){if(_0x5be68e){return _0x2bf36c['status'](_0x33348b)[_0x9709('0x30')](_0x5be68e);}};}function respondWithFilteredResult(_0x54d565,_0x2c4bd9){return function(_0x35462e){if(_0x35462e){var _0x47fe84=_0x35462e[_0x9709('0x31')],_0x2e4c0c=_0x2c4bd9['offset'],_0x18e8be=_0x2c4bd9['offset']+_0x2c4bd9[_0x9709('0x32')],_0x263244;if(_0x18e8be>=_0x47fe84){_0x18e8be=_0x47fe84;_0x263244=0xc8;}else{_0x263244=0xce;}_0x54d565[_0x9709('0x2f')](_0x263244);return _0x54d565[_0x9709('0x33')](_0x9709('0x34'),_0x2e4c0c+'-'+_0x18e8be+'/'+_0x47fe84)['json'](_0x35462e);}return null;};}function patchUpdates(_0x193444){return function(_0x221ca7){try{jsonpatch['apply'](_0x221ca7,_0x193444,!![]);}catch(_0xc42a01){return BPromise['reject'](_0xc42a01);}return _0x221ca7[_0x9709('0x35')]();};}function saveUpdates(_0x5ce49a,_0x1019ae){return function(_0x4c04b4){if(_0x4c04b4){return _0x4c04b4['update'](_0x5ce49a)[_0x9709('0x36')](function(_0x28fdf3){return _0x28fdf3;});}return null;};}function removeEntity(_0x10b8d3,_0x3f7a6a){return function(_0x57a1d4){if(_0x57a1d4){return _0x57a1d4[_0x9709('0x37')]()[_0x9709('0x36')](function(){var _0x113d0a=_0x57a1d4[_0x9709('0x38')]({'plain':!![]});var _0x4d3b2c=_0x9709('0x39');return db[_0x9709('0x3a')][_0x9709('0x37')]({'where':{'type':_0x4d3b2c,'resourceId':_0x113d0a['id']}})[_0x9709('0x36')](function(){return _0x57a1d4;});})[_0x9709('0x36')](function(){_0x10b8d3['status'](0xcc)[_0x9709('0x3b')]();});}};}function handleEntityNotFound(_0x466c89,_0x5dc5e7){return function(_0x5340ba){if(!_0x5340ba){_0x466c89[_0x9709('0x3c')](0x194);}return _0x5340ba;};}function handleError(_0x2fb232,_0x19c89f){_0x19c89f=_0x19c89f||0x1f4;return function(_0x41cf25){logger[_0x9709('0x2a')](_0x41cf25[_0x9709('0x3d')]);if(_0x41cf25[_0x9709('0x3e')]){delete _0x41cf25[_0x9709('0x3e')];}_0x2fb232[_0x9709('0x2f')](_0x19c89f)[_0x9709('0x3f')](_0x41cf25);};}exports[_0x9709('0x40')]=function(_0xe13f36,_0x458722){var _0xf84a17={'include':[{'model':db['MailServerIn'],'as':_0x9709('0x41')},{'model':db[_0x9709('0x42')],'as':_0x9709('0x43')},{'model':db[_0x9709('0x44')],'as':_0x9709('0x45')}]},_0x52dbff={},_0x619ce9={'count':0x0,'rows':[]};var _0x31ac0b=_[_0x9709('0x46')](db['MailAccount'][_0x9709('0x47')],function(_0x5e657){return{'name':_0x5e657['fieldName'],'type':_0x5e657[_0x9709('0x48')][_0x9709('0x49')]};});_0x52dbff[_0x9709('0x4a')]=_[_0x9709('0x46')](_0x31ac0b,_0x9709('0x3e'));_0x52dbff[_0x9709('0x4b')]=_[_0x9709('0x4c')](_0xe13f36[_0x9709('0x4b')]);_0x52dbff[_0x9709('0x4d')]=_[_0x9709('0x4e')](_0x52dbff[_0x9709('0x4a')],_0x52dbff[_0x9709('0x4b')]);_0xf84a17[_0x9709('0x4f')]=_['intersection'](_0x52dbff[_0x9709('0x4a')],qs[_0x9709('0x50')](_0xe13f36[_0x9709('0x4b')][_0x9709('0x50')]));_0xf84a17[_0x9709('0x4f')]=_0xf84a17['attributes']['length']?_0xf84a17['attributes']:_0x52dbff['model'];if(!_0xe13f36[_0x9709('0x4b')][_0x9709('0x51')]('nolimit')){_0xf84a17[_0x9709('0x32')]=qs[_0x9709('0x32')](_0xe13f36[_0x9709('0x4b')]['limit']);_0xf84a17[_0x9709('0x52')]=qs[_0x9709('0x52')](_0xe13f36[_0x9709('0x4b')][_0x9709('0x52')]);}_0xf84a17[_0x9709('0x53')]=qs[_0x9709('0x54')](_0xe13f36[_0x9709('0x4b')][_0x9709('0x54')]);_0xf84a17[_0x9709('0x55')]=qs[_0x9709('0x4d')](_[_0x9709('0x56')](_0xe13f36[_0x9709('0x4b')],_0x52dbff[_0x9709('0x4d')]));if(_0xe13f36[_0x9709('0x4b')]['filter']){_0xf84a17[_0x9709('0x55')]=_[_0x9709('0x57')](_0xf84a17[_0x9709('0x55')],{'$or':_[_0x9709('0x46')](_0x31ac0b,function(_0x1145eb){if(_0x1145eb[_0x9709('0x48')]!=='VIRTUAL'){var _0x545808={};_0x545808[_0x1145eb[_0x9709('0x3e')]]={'$like':'%'+_0xe13f36['query'][_0x9709('0x58')]+'%'};return _0x545808;}})});}_0xf84a17=_[_0x9709('0x57')]({},_0xf84a17,_0xe13f36[_0x9709('0x59')]);var _0x9a3b38={'where':_0xf84a17[_0x9709('0x55')]};return db['MailAccount'][_0x9709('0x31')](_0x9a3b38)[_0x9709('0x36')](function(_0x228094){_0x619ce9[_0x9709('0x31')]=_0x228094;if(_0xe13f36[_0x9709('0x4b')][_0x9709('0x5a')]){_0xf84a17[_0x9709('0x5b')]=[{'all':!![]}];}return db[_0x9709('0x5c')][_0x9709('0x5d')](_0xf84a17);})[_0x9709('0x36')](function(_0x479083){_0x619ce9['rows']=_0x479083;return _0x619ce9;})['then'](respondWithFilteredResult(_0x458722,_0xf84a17))['catch'](handleError(_0x458722,null));};exports[_0x9709('0x5e')]=function(_0x209c06,_0x51beab){var _0x485f4a={'raw':![],'where':{'id':_0x209c06[_0x9709('0x5f')]['id']},'include':[{'model':db[_0x9709('0x60')],'as':_0x9709('0x41')},{'model':db[_0x9709('0x42')],'as':_0x9709('0x43')},{'model':db[_0x9709('0x44')],'as':_0x9709('0x45')}]},_0xb31752={};_0xb31752[_0x9709('0x4a')]=_['keys'](db[_0x9709('0x5c')]['rawAttributes']);_0xb31752[_0x9709('0x4b')]=_[_0x9709('0x4c')](_0x209c06['query']);_0xb31752[_0x9709('0x4d')]=_[_0x9709('0x4e')](_0xb31752[_0x9709('0x4a')],_0xb31752[_0x9709('0x4b')]);_0x485f4a[_0x9709('0x4f')]=_['intersection'](_0xb31752['model'],qs[_0x9709('0x50')](_0x209c06['query'][_0x9709('0x50')]));_0x485f4a[_0x9709('0x4f')]=_0x485f4a[_0x9709('0x4f')][_0x9709('0x61')]?_0x485f4a[_0x9709('0x4f')]:_0xb31752[_0x9709('0x4a')];if(_0x209c06['query'][_0x9709('0x5a')]){_0x485f4a[_0x9709('0x5b')]=[{'all':!![]}];}_0x485f4a=_[_0x9709('0x57')]({},_0x485f4a,_0x209c06[_0x9709('0x59')]);return db['MailAccount'][_0x9709('0x62')](_0x485f4a)['then'](handleEntityNotFound(_0x51beab,null))[_0x9709('0x36')](respondWithResult(_0x51beab,null))['catch'](handleError(_0x51beab,null));};exports[_0x9709('0x63')]=function(_0x544b86,_0x454b89){if(_0x544b86[_0x9709('0x64')]['id']){delete _0x544b86[_0x9709('0x64')]['id'];}return db[_0x9709('0x5c')][_0x9709('0x62')]({'where':{'id':_0x544b86[_0x9709('0x5f')]['id']},'include':[{'model':db[_0x9709('0x60')],'as':_0x9709('0x41')},{'model':db[_0x9709('0x42')],'as':'Smtp'},{'model':db[_0x9709('0x44')],'as':_0x9709('0x45')}]})[_0x9709('0x36')](handleEntityNotFound(_0x454b89,null))[_0x9709('0x36')](saveUpdates(_0x544b86['body'],null))['then'](function(_0x2f56ce){if(_0x2f56ce&&_0x544b86[_0x9709('0x64')][_0x9709('0x41')]){return db[_0x9709('0x60')][_0x9709('0x63')](_0x544b86[_0x9709('0x64')][_0x9709('0x41')],{'where':{'MailAccountId':_0x2f56ce['id']}})[_0x9709('0x36')](function(){return _0x2f56ce;});}return _0x2f56ce;})['then'](function(_0x5f8622){if(_0x5f8622&&_0x544b86[_0x9709('0x64')][_0x9709('0x43')]){return db[_0x9709('0x42')][_0x9709('0x63')](_0x544b86['body'][_0x9709('0x43')],{'where':{'MailAccountId':_0x5f8622['id']}})['then'](function(){return _0x5f8622;});}return _0x5f8622;})[_0x9709('0x36')](respondWithResult(_0x454b89,null))[_0x9709('0x65')](handleError(_0x454b89,null));};exports['describe']=function(_0x4cc319,_0x4e38e6){return db['MailAccount'][_0x9709('0x66')]()['then'](respondWithResult(_0x4e38e6,null))[_0x9709('0x65')](handleError(_0x4e38e6,null));};exports[_0x9709('0x67')]=function(_0x302e58,_0x45cac9,_0x566114){if(_0x302e58['body']['id']){delete _0x302e58[_0x9709('0x64')]['id'];}return db[_0x9709('0x5c')]['find']({'where':{'id':_0x302e58[_0x9709('0x5f')]['id']}})['then'](handleEntityNotFound(_0x45cac9,null))[_0x9709('0x36')](function(_0x3b6a34){if(_0x3b6a34){_0x302e58[_0x9709('0x64')][_0x9709('0x68')]=_0x3b6a34['id'];return db[_0x9709('0x69')][_0x9709('0x6a')](_0x302e58['body']);}})[_0x9709('0x36')](respondWithResult(_0x45cac9,null))[_0x9709('0x65')](handleError(_0x45cac9,null));};exports[_0x9709('0x6b')]=function(_0xd12d59,_0x828202,_0x1de7a4){var _0x354857={'raw':![],'where':{}};var _0x31c3f7={};var _0x464dce={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0xd12d59[_0x9709('0x5f')]['id']}})[_0x9709('0x36')](handleEntityNotFound(_0x828202,null))[_0x9709('0x36')](function(_0x294d61){if(_0x294d61){_0x31c3f7[_0x9709('0x4a')]=_[_0x9709('0x4c')](db['Disposition'][_0x9709('0x47')]);_0x31c3f7[_0x9709('0x4b')]=_[_0x9709('0x4c')](_0xd12d59[_0x9709('0x4b')]);_0x31c3f7[_0x9709('0x4d')]=_[_0x9709('0x4e')](_0x31c3f7['model'],_0x31c3f7[_0x9709('0x4b')]);_0x354857[_0x9709('0x4f')]=_[_0x9709('0x4e')](_0x31c3f7[_0x9709('0x4a')],qs[_0x9709('0x50')](_0xd12d59[_0x9709('0x4b')][_0x9709('0x50')]));_0x354857[_0x9709('0x4f')]=_0x354857[_0x9709('0x4f')]['length']?_0x354857[_0x9709('0x4f')]:_0x31c3f7[_0x9709('0x4a')];if(!_0xd12d59[_0x9709('0x4b')][_0x9709('0x51')]('nolimit')){_0x354857[_0x9709('0x32')]=qs['limit'](_0xd12d59['query'][_0x9709('0x32')]);_0x354857[_0x9709('0x52')]=qs['offset'](_0xd12d59[_0x9709('0x4b')]['offset']);}_0x354857['order']=qs[_0x9709('0x54')](_0xd12d59[_0x9709('0x4b')]['sort']);_0x354857[_0x9709('0x55')]=qs[_0x9709('0x4d')](_['pick'](_0xd12d59[_0x9709('0x4b')],_0x31c3f7[_0x9709('0x4d')]));_0x354857['where'][_0x9709('0x68')]=_0x294d61['id'];if(_0xd12d59[_0x9709('0x4b')][_0x9709('0x58')]){_0x354857[_0x9709('0x55')]=_[_0x9709('0x57')](_0x354857['where'],{'$or':_[_0x9709('0x46')](_0x354857[_0x9709('0x4f')],function(_0x51cc82){var _0xf9f2b9={};_0xf9f2b9[_0x51cc82]={'$like':'%'+_0xd12d59[_0x9709('0x4b')][_0x9709('0x58')]+'%'};return _0xf9f2b9;})});}_0x354857=_[_0x9709('0x57')]({},_0x354857,_0xd12d59[_0x9709('0x59')]);return db[_0x9709('0x69')]['count']({'where':_0x354857[_0x9709('0x55')]})[_0x9709('0x36')](function(_0x5c8806){_0x464dce['count']=_0x5c8806;if(_0xd12d59[_0x9709('0x4b')][_0x9709('0x5a')]){_0x354857['include']=[{'all':!![]}];}return db[_0x9709('0x69')][_0x9709('0x5d')](_0x354857);})[_0x9709('0x36')](function(_0x2fc120){_0x464dce[_0x9709('0x6c')]=_0x2fc120;return _0x464dce;});}})[_0x9709('0x36')](respondWithFilteredResult(_0x828202,_0x354857))['catch'](handleError(_0x828202,null));};exports[_0x9709('0x6d')]=function(_0x508444,_0x159f08,_0x3d5cbf){return db['MailAccount'][_0x9709('0x62')]({'where':{'id':_0x508444[_0x9709('0x5f')]['id']}})['then'](handleEntityNotFound(_0x159f08,null))[_0x9709('0x36')](function(_0x2d3d7b){if(_0x2d3d7b){return _0x2d3d7b['removeDispositions'](_0x508444[_0x9709('0x4b')][_0x9709('0x6e')]);}})[_0x9709('0x36')](respondWithStatusCode(_0x159f08,null))['catch'](handleError(_0x159f08,null));};exports[_0x9709('0x6f')]=function(_0x2ef573,_0x4e69b8,_0x1c52aa){if(_0x2ef573['body']['id']){delete _0x2ef573[_0x9709('0x64')]['id'];}return db['MailAccount'][_0x9709('0x62')]({'where':{'id':_0x2ef573[_0x9709('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4e69b8,null))[_0x9709('0x36')](function(_0x3b37f9){if(_0x3b37f9){_0x2ef573[_0x9709('0x64')][_0x9709('0x68')]=_0x3b37f9['id'];return db['CannedAnswer'][_0x9709('0x6a')](_0x2ef573[_0x9709('0x64')]);}})[_0x9709('0x36')](respondWithResult(_0x4e69b8,null))['catch'](handleError(_0x4e69b8,null));};exports['getAnswers']=function(_0x5de815,_0x53aa58,_0x31b62e){var _0x5c43df={'raw':![],'where':{}};var _0x44d553={};var _0x53ff51={'count':0x0,'rows':[]};return db[_0x9709('0x5c')][_0x9709('0x70')]({'where':{'id':_0x5de815[_0x9709('0x5f')]['id']}})[_0x9709('0x36')](handleEntityNotFound(_0x53aa58,null))[_0x9709('0x36')](function(_0x3969ea){if(_0x3969ea){_0x44d553[_0x9709('0x4a')]=_[_0x9709('0x4c')](db[_0x9709('0x71')][_0x9709('0x47')]);_0x44d553['query']=_[_0x9709('0x4c')](_0x5de815['query']);_0x44d553[_0x9709('0x4d')]=_[_0x9709('0x4e')](_0x44d553[_0x9709('0x4a')],_0x44d553[_0x9709('0x4b')]);_0x5c43df['attributes']=_[_0x9709('0x4e')](_0x44d553[_0x9709('0x4a')],qs['fields'](_0x5de815[_0x9709('0x4b')][_0x9709('0x50')]));_0x5c43df[_0x9709('0x4f')]=_0x5c43df[_0x9709('0x4f')][_0x9709('0x61')]?_0x5c43df['attributes']:_0x44d553[_0x9709('0x4a')];if(!_0x5de815[_0x9709('0x4b')][_0x9709('0x51')](_0x9709('0x72'))){_0x5c43df[_0x9709('0x32')]=qs[_0x9709('0x32')](_0x5de815[_0x9709('0x4b')][_0x9709('0x32')]);_0x5c43df[_0x9709('0x52')]=qs['offset'](_0x5de815[_0x9709('0x4b')][_0x9709('0x52')]);}_0x5c43df[_0x9709('0x53')]=qs[_0x9709('0x54')](_0x5de815[_0x9709('0x4b')][_0x9709('0x54')]);_0x5c43df[_0x9709('0x55')]=qs[_0x9709('0x4d')](_[_0x9709('0x56')](_0x5de815[_0x9709('0x4b')],_0x44d553[_0x9709('0x4d')]));_0x5c43df[_0x9709('0x55')][_0x9709('0x68')]=_0x3969ea['id'];if(_0x5de815[_0x9709('0x4b')][_0x9709('0x58')]){_0x5c43df[_0x9709('0x55')]=_['merge'](_0x5c43df[_0x9709('0x55')],{'$or':_[_0x9709('0x46')](_0x5c43df['attributes'],function(_0x2d79e4){var _0x4422e1={};_0x4422e1[_0x2d79e4]={'$like':'%'+_0x5de815[_0x9709('0x4b')][_0x9709('0x58')]+'%'};return _0x4422e1;})});}_0x5c43df=_[_0x9709('0x57')]({},_0x5c43df,_0x5de815[_0x9709('0x59')]);return db['CannedAnswer']['count']({'where':_0x5c43df[_0x9709('0x55')]})[_0x9709('0x36')](function(_0x7ff97b){_0x53ff51[_0x9709('0x31')]=_0x7ff97b;if(_0x5de815[_0x9709('0x4b')][_0x9709('0x5a')]){_0x5c43df['include']=[{'all':!![]}];}return db[_0x9709('0x71')][_0x9709('0x5d')](_0x5c43df);})[_0x9709('0x36')](function(_0x42e595){_0x53ff51['rows']=_0x42e595;return _0x53ff51;});}})[_0x9709('0x36')](respondWithFilteredResult(_0x53aa58,_0x5c43df))[_0x9709('0x65')](handleError(_0x53aa58,null));};exports[_0x9709('0x73')]=function(_0x58d78d,_0x3421dc,_0x1ed140){return db[_0x9709('0x5c')][_0x9709('0x62')]({'where':{'id':_0x58d78d[_0x9709('0x5f')]['id']}})[_0x9709('0x36')](handleEntityNotFound(_0x3421dc,null))[_0x9709('0x36')](function(_0x22927b){if(_0x22927b){return _0x22927b[_0x9709('0x73')](_0x58d78d[_0x9709('0x4b')][_0x9709('0x6e')]);}})['then'](respondWithStatusCode(_0x3421dc,null))[_0x9709('0x65')](handleError(_0x3421dc,null));};exports['create']=function(_0x2e4a95,_0x2d93ac){var _0x2d7bd1={'name':_0x2e4a95[_0x9709('0x64')][_0x9709('0x3e')],'key':_0x2e4a95[_0x9709('0x64')][_0x9709('0x49')],'email':_0x2e4a95['body'][_0x9709('0x74')],'ListId':_0x2e4a95['body'][_0x9709('0x75')],'active':!_[_0x9709('0x76')](_0x2e4a95['body'][_0x9709('0x77')])?_0x2e4a95[_0x9709('0x64')]['active']:!![],'description':_0x2e4a95[_0x9709('0x64')][_0x9709('0x78')]||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x2e4a95[_0x9709('0x64')]['cservice'])){if(_0x2e4a95['body'][_0x9709('0x79')]){_0x2d7bd1[_0x9709('0x41')][_0x9709('0x7a')]=_0x2d7bd1[_0x9709('0x43')][_0x9709('0x7a')]=_0x2e4a95['body'][_0x9709('0x7b')];_0x2d7bd1[_0x9709('0x41')]['password']=_0x2d7bd1[_0x9709('0x43')][_0x9709('0x7c')]=_0x2e4a95[_0x9709('0x64')][_0x9709('0x7d')];}else{_0x2d7bd1[_0x9709('0x41')][_0x9709('0x7e')]=_0x2d7bd1[_0x9709('0x43')][_0x9709('0x7e')]=![];}_0x2d7bd1[_0x9709('0x41')][_0x9709('0x7f')]=_0x2e4a95[_0x9709('0x64')]['Imap'][_0x9709('0x7f')];_0x2d7bd1[_0x9709('0x41')][_0x9709('0x80')]=_0x2e4a95['body'][_0x9709('0x41')][_0x9709('0x80')];_0x2d7bd1[_0x9709('0x43')]['host']=_0x2e4a95['body'][_0x9709('0x43')]['host'];_0x2d7bd1[_0x9709('0x43')][_0x9709('0x80')]=_0x2e4a95[_0x9709('0x64')][_0x9709('0x43')][_0x9709('0x80')];}else{_0x2d7bd1['Imap'][_0x9709('0x81')]=_0x2d7bd1['Smtp'][_0x9709('0x81')]=_0x2e4a95['body'][_0x9709('0x82')];_0x2d7bd1[_0x9709('0x41')]['user']=_0x2d7bd1[_0x9709('0x43')][_0x9709('0x7a')]=_0x2e4a95['body'][_0x9709('0x7b')];_0x2d7bd1[_0x9709('0x41')][_0x9709('0x83')]=_0x2d7bd1[_0x9709('0x43')][_0x9709('0x7c')]=_0x2e4a95[_0x9709('0x64')][_0x9709('0x7d')];}return db[_0x9709('0x5c')][_0x9709('0x6a')](_0x2d7bd1,{'include':[{'model':db[_0x9709('0x42')],'as':_0x9709('0x43')},{'model':db[_0x9709('0x60')],'as':_0x9709('0x41')}]})[_0x9709('0x36')](function(_0x183a0a){var _0x5876fa=_0x2e4a95['user'][_0x9709('0x38')]({'plain':!![]});if(!_0x5876fa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5876fa['role']===_0x9709('0x7a')){var _0xdb2e00=_0x183a0a[_0x9709('0x38')]({'plain':!![]});return db[_0x9709('0x84')][_0x9709('0x62')]({'where':{'name':_0x9709('0x39'),'userProfileId':_0x5876fa[_0x9709('0x85')]},'raw':!![]})[_0x9709('0x36')](function(_0xa8c551){if(_0xa8c551&&_0xa8c551[_0x9709('0x86')]===0x0){return db['UserProfileResource'][_0x9709('0x6a')]({'name':_0xdb2e00[_0x9709('0x3e')],'resourceId':_0xdb2e00['id'],'type':_0xa8c551['name'],'sectionId':_0xa8c551['id']},{})[_0x9709('0x36')](function(){return _0x183a0a;});}else{return _0x183a0a;}})[_0x9709('0x65')](function(_0x3bc86a){logger[_0x9709('0x2a')](_0x9709('0x87'),_0x3bc86a);throw _0x3bc86a;});}return _0x183a0a;})[_0x9709('0x36')](respondWithResult(_0x2d93ac,0xc9))[_0x9709('0x65')](handleError(_0x2d93ac,null));};exports[_0x9709('0x88')]=function(_0x53a81f,_0x138dbe,_0x21fef3){return db[_0x9709('0x5c')]['findOne']({'where':{'id':_0x53a81f[_0x9709('0x5f')]['id']}})[_0x9709('0x36')](handleEntityNotFound(_0x138dbe,null))[_0x9709('0x36')](function(_0x5a80c9){if(_0x5a80c9){return _0x5a80c9[_0x9709('0x88')]();}return null;})[_0x9709('0x36')](respondWithResult(_0x138dbe,null))[_0x9709('0x65')](handleError(_0x138dbe,null));};exports[_0x9709('0x89')]=function(_0x52340e,_0x581bfc,_0x4f71c6){if(_0x52340e[_0x9709('0x64')]['id']){delete _0x52340e['body']['id'];}return db[_0x9709('0x5c')][_0x9709('0x62')]({'where':{'id':_0x52340e[_0x9709('0x5f')]['id']}})[_0x9709('0x36')](handleEntityNotFound(_0x581bfc,null))[_0x9709('0x36')](function(_0xd52037){if(_0xd52037){_0x52340e[_0x9709('0x64')][_0x9709('0x68')]=_0xd52037['id'];return db[_0x9709('0x60')]['create'](_0x52340e[_0x9709('0x64')]);}})[_0x9709('0x36')](respondWithResult(_0x581bfc,null))['catch'](handleError(_0x581bfc,null));};exports[_0x9709('0x8a')]=function(_0x341d0f,_0x18ff61,_0x257b97){return db[_0x9709('0x5c')][_0x9709('0x70')]({'where':{'id':_0x341d0f['params']['id']}})[_0x9709('0x36')](handleEntityNotFound(_0x18ff61,null))['then'](function(_0x558f0d){if(_0x558f0d){return _0x558f0d[_0x9709('0x8b')](null);}return null;})[_0x9709('0x36')](respondWithStatusCode(_0x18ff61,null))[_0x9709('0x65')](handleError(_0x18ff61,null));};exports[_0x9709('0x8c')]=function(_0x5b8c28,_0x3b741c,_0x1263f7){return db[_0x9709('0x5c')]['findOne']({'where':{'id':_0x5b8c28['params']['id']}})['then'](handleEntityNotFound(_0x3b741c,null))[_0x9709('0x36')](function(_0xe83d32){if(_0xe83d32){return _0xe83d32[_0x9709('0x8c')]();}return null;})[_0x9709('0x36')](respondWithResult(_0x3b741c,null))[_0x9709('0x65')](handleError(_0x3b741c,null));};exports[_0x9709('0x8d')]=function(_0x67cc65,_0x4d987b,_0x22e211){if(_0x67cc65['body']['id']){delete _0x67cc65[_0x9709('0x64')]['id'];}return db[_0x9709('0x5c')][_0x9709('0x62')]({'where':{'id':_0x67cc65[_0x9709('0x5f')]['id']}})[_0x9709('0x36')](handleEntityNotFound(_0x4d987b,null))[_0x9709('0x36')](function(_0x3429f5){if(_0x3429f5){_0x67cc65['body'][_0x9709('0x68')]=_0x3429f5['id'];return db[_0x9709('0x42')]['create'](_0x67cc65[_0x9709('0x64')]);}})[_0x9709('0x36')](respondWithResult(_0x4d987b,null))[_0x9709('0x65')](handleError(_0x4d987b,null));};exports['removeSmtp']=function(_0x346a56,_0x3b797e,_0x49dc32){return db[_0x9709('0x5c')][_0x9709('0x70')]({'where':{'id':_0x346a56['params']['id']}})[_0x9709('0x36')](handleEntityNotFound(_0x3b797e,null))[_0x9709('0x36')](function(_0x5720eb){if(_0x5720eb){return _0x5720eb[_0x9709('0x8e')](null);}return null;})[_0x9709('0x36')](respondWithStatusCode(_0x3b797e,null))['catch'](handleError(_0x3b797e,null));};exports['addInteraction']=function(_0xedbd95,_0x107dd1,_0x13dc60){return db['MailInteraction'][_0x9709('0x62')]({'where':{'id':_0xedbd95[_0x9709('0x5f')]['id']}})[_0x9709('0x36')](handleEntityNotFound(_0x107dd1,null))[_0x9709('0x36')](function(_0x3e9a49){if(_0x3e9a49){return _0x3e9a49[_0x9709('0x8f')](_0xedbd95[_0x9709('0x64')][_0x9709('0x6e')],_[_0x9709('0x90')](_0xedbd95['body'],[_0x9709('0x6e'),'id'])||{});}})['then'](respondWithResult(_0x107dd1,null))[_0x9709('0x65')](handleError(_0x107dd1,null));};exports[_0x9709('0x91')]=function(_0x3308f0,_0x2ad9d4,_0x2b1d32){var _0x170e0c={'raw':![],'where':{}};var _0x334afa={};var _0x50d46f={'count':0x0,'rows':[]};return db[_0x9709('0x5c')][_0x9709('0x70')]({'where':{'id':_0x3308f0[_0x9709('0x5f')]['id']}})[_0x9709('0x36')](handleEntityNotFound(_0x2ad9d4,null))['then'](function(_0x3c768d){if(_0x3c768d){_0x334afa[_0x9709('0x4a')]=_[_0x9709('0x4c')](db['MailInteraction']['rawAttributes']);_0x334afa[_0x9709('0x4b')]=_[_0x9709('0x4c')](_0x3308f0[_0x9709('0x4b')]);_0x334afa[_0x9709('0x4d')]=_[_0x9709('0x4e')](_0x334afa[_0x9709('0x4a')],_0x334afa[_0x9709('0x4b')]);_0x170e0c[_0x9709('0x4f')]=_[_0x9709('0x4e')](_0x334afa[_0x9709('0x4a')],qs[_0x9709('0x50')](_0x3308f0[_0x9709('0x4b')][_0x9709('0x50')]));_0x170e0c[_0x9709('0x4f')]=_0x170e0c['attributes']['length']?_0x170e0c[_0x9709('0x4f')]:_0x334afa[_0x9709('0x4a')];if(!_0x3308f0[_0x9709('0x4b')][_0x9709('0x51')](_0x9709('0x72'))){_0x170e0c[_0x9709('0x32')]=qs[_0x9709('0x32')](_0x3308f0[_0x9709('0x4b')][_0x9709('0x32')]);_0x170e0c[_0x9709('0x52')]=qs['offset'](_0x3308f0[_0x9709('0x4b')]['offset']);}_0x170e0c[_0x9709('0x53')]=qs[_0x9709('0x54')](_0x3308f0[_0x9709('0x4b')][_0x9709('0x54')]);_0x170e0c[_0x9709('0x55')]=qs['filters'](_[_0x9709('0x56')](_0x3308f0[_0x9709('0x4b')],_0x334afa[_0x9709('0x4d')]));_0x170e0c['where'][_0x9709('0x68')]=_0x3c768d['id'];if(_0x3308f0[_0x9709('0x4b')][_0x9709('0x58')]){_0x170e0c['where']=_[_0x9709('0x57')](_0x170e0c['where'],{'$or':_[_0x9709('0x46')](_0x170e0c[_0x9709('0x4f')],function(_0x5045ae){var _0x880c3f={};_0x880c3f[_0x5045ae]={'$like':'%'+_0x3308f0[_0x9709('0x4b')][_0x9709('0x58')]+'%'};return _0x880c3f;})});}_0x170e0c=_[_0x9709('0x57')]({},_0x170e0c,_0x3308f0[_0x9709('0x59')]);return db[_0x9709('0x92')][_0x9709('0x31')]({'where':_0x170e0c[_0x9709('0x55')]})[_0x9709('0x36')](function(_0x43a7d8){_0x50d46f[_0x9709('0x31')]=_0x43a7d8;if(_0x3308f0[_0x9709('0x4b')][_0x9709('0x5a')]){_0x170e0c[_0x9709('0x5b')]=[{'model':db[_0x9709('0x93')],'as':_0x9709('0x94'),'required':![]},{'model':db[_0x9709('0x95')],'as':_0x9709('0x96'),'attributes':[_0x9709('0x3e'),_0x9709('0x97'),_0x9709('0x98')],'required':![]},{'model':db[_0x9709('0x99')],'as':_0x9709('0x9a'),'attributes':['id',_0x9709('0x3e'),'color'],'where':_0x3308f0[_0x9709('0x4b')]['tag']?{'id':_0x3308f0[_0x9709('0x4b')][_0x9709('0x9b')]}:undefined,'required':_0x3308f0[_0x9709('0x4b')]['tag']?!![]:![]}];}return db[_0x9709('0x92')][_0x9709('0x5d')](_0x170e0c);})['then'](function(_0x465dfc){_0x50d46f[_0x9709('0x6c')]=_0x465dfc;return _0x50d46f;});}})[_0x9709('0x36')](respondWithFilteredResult(_0x2ad9d4,_0x170e0c))['catch'](handleError(_0x2ad9d4,null));};exports['addApplications']=function(_0x4053ce,_0x1a0e38,_0x24b4b3){return db[_0x9709('0x5c')][_0x9709('0x70')]({'where':{'id':_0x4053ce[_0x9709('0x5f')]['id']}})[_0x9709('0x36')](handleEntityNotFound(_0x1a0e38,null))['then'](function(_0x5a3cbf){if(_0x5a3cbf){return db[_0x9709('0x9c')][_0x9709('0x9d')](function(_0x72275a){return db[_0x9709('0x9e')][_0x9709('0x37')]({'where':{'MailAccountId':_0x4053ce[_0x9709('0x5f')]['id']},'transaction':_0x72275a})[_0x9709('0x36')](function(_0x3082c6){var _0x42e0f4=_['map'](_0x4053ce[_0x9709('0x64')],function(_0x54c991){_0x54c991[_0x9709('0x68')]=_0x4053ce[_0x9709('0x5f')]['id'];return _0x54c991;});return db[_0x9709('0x9e')][_0x9709('0x9f')](_0x42e0f4,{'transaction':_0x72275a});});})['then'](function(){return db[_0x9709('0x9e')]['findAndCountAll']({'where':{'MailAccountId':_0x4053ce[_0x9709('0x5f')]['id']},'order':_0x9709('0xa0')});});}})[_0x9709('0x36')](respondWithResult(_0x1a0e38,null))['catch'](handleError(_0x1a0e38,null));};exports[_0x9709('0xa1')]=function(_0x593e8d,_0x3a33f6,_0x394c30){var _0xcb38d3={};var _0x52d060={};var _0x202873;var _0x1cd5e2;return db[_0x9709('0x5c')][_0x9709('0x70')]({'where':{'id':_0x593e8d['params']['id']}})[_0x9709('0x36')](handleEntityNotFound(_0x3a33f6,null))['then'](function(_0x58864f){if(_0x58864f){_0x202873=_0x58864f;_0x52d060['model']=_[_0x9709('0x4c')](db[_0x9709('0x9e')]['rawAttributes']);_0x52d060['query']=_[_0x9709('0x4c')](_0x593e8d['query']);_0x52d060[_0x9709('0x4d')]=_['intersection'](_0x52d060[_0x9709('0x4a')],_0x52d060['query']);_0xcb38d3[_0x9709('0x4f')]=_[_0x9709('0x4e')](_0x52d060[_0x9709('0x4a')],qs[_0x9709('0x50')](_0x593e8d[_0x9709('0x4b')][_0x9709('0x50')]));_0xcb38d3[_0x9709('0x4f')]=_0xcb38d3[_0x9709('0x4f')][_0x9709('0x61')]?_0xcb38d3[_0x9709('0x4f')]:_0x52d060[_0x9709('0x4a')];_0xcb38d3[_0x9709('0x53')]=qs[_0x9709('0x54')](_0x593e8d['query']['sort']);_0xcb38d3['where']=qs['filters'](_['pick'](_0x593e8d[_0x9709('0x4b')],_0x52d060[_0x9709('0x4d')]));if(_0x593e8d[_0x9709('0x4b')][_0x9709('0x58')]){_0xcb38d3[_0x9709('0x55')]=_['merge'](_0xcb38d3[_0x9709('0x55')],{'$or':_[_0x9709('0x46')](_0xcb38d3[_0x9709('0x4f')],function(_0x156c28){var _0x419064={};_0x419064[_0x156c28]={'$like':'%'+_0x593e8d['query']['filter']+'%'};return _0x419064;})});}_0xcb38d3=_[_0x9709('0x57')]({},_0xcb38d3,_0x593e8d['options']);return _0x202873['getApplications'](_0xcb38d3);}})[_0x9709('0x36')](function(_0xc32bd1){if(_0xc32bd1){_0x1cd5e2=_0xc32bd1[_0x9709('0x61')];if(!_0x593e8d['query'][_0x9709('0x51')](_0x9709('0x72'))){_0xcb38d3[_0x9709('0x32')]=qs['limit'](_0x593e8d[_0x9709('0x4b')][_0x9709('0x32')]);_0xcb38d3[_0x9709('0x52')]=qs['offset'](_0x593e8d[_0x9709('0x4b')][_0x9709('0x52')]);}return _0x202873['getApplications'](_0xcb38d3);}})[_0x9709('0x36')](function(_0x3fdee0){if(_0x3fdee0){return _0x3fdee0?{'count':_0x1cd5e2,'rows':_0x3fdee0}:null;}})['then'](respondWithResult(_0x3a33f6,null))['catch'](handleError(_0x3a33f6,null));};exports[_0x9709('0xa2')]=function(_0xe22253,_0x4c37ff,_0x3c1f59){var _0x5a6f5f={'raw':!![],'where':{}};var _0x37713c={};var _0x1a3b30={'count':0x0,'rows':[]};return db[_0x9709('0x5c')][_0x9709('0x70')]({'where':{'id':_0xe22253['params']['id']}})[_0x9709('0x36')](handleEntityNotFound(_0x4c37ff,null))[_0x9709('0x36')](function(_0x54a37b){if(_0x54a37b){_0x37713c[_0x9709('0x4a')]=_['keys'](db['MailMessage'][_0x9709('0x47')]);_0x37713c[_0x9709('0x4b')]=_['keys'](_0xe22253[_0x9709('0x4b')]);_0x37713c[_0x9709('0x4d')]=_[_0x9709('0x4e')](_0x37713c[_0x9709('0x4a')],_0x37713c[_0x9709('0x4b')]);_0x5a6f5f[_0x9709('0x4f')]=_['intersection'](_0x37713c[_0x9709('0x4a')],qs[_0x9709('0x50')](_0xe22253[_0x9709('0x4b')][_0x9709('0x50')]));_0x5a6f5f[_0x9709('0x4f')]=_0x5a6f5f[_0x9709('0x4f')][_0x9709('0x61')]?_0x5a6f5f[_0x9709('0x4f')]:_0x37713c[_0x9709('0x4a')];if(!_0xe22253[_0x9709('0x4b')]['hasOwnProperty'](_0x9709('0x72'))){_0x5a6f5f[_0x9709('0x32')]=qs[_0x9709('0x32')](_0xe22253[_0x9709('0x4b')][_0x9709('0x32')]);_0x5a6f5f[_0x9709('0x52')]=qs[_0x9709('0x52')](_0xe22253[_0x9709('0x4b')][_0x9709('0x52')]);}_0x5a6f5f[_0x9709('0x53')]=qs[_0x9709('0x54')](_0xe22253['query'][_0x9709('0x54')]);_0x5a6f5f[_0x9709('0x55')]=qs[_0x9709('0x4d')](_[_0x9709('0x56')](_0xe22253['query'],_0x37713c[_0x9709('0x4d')]));_0x5a6f5f['where'][_0x9709('0x68')]=_0x54a37b['id'];if(_0xe22253[_0x9709('0x4b')]['filter']){_0x5a6f5f[_0x9709('0x55')]=_['merge'](_0x5a6f5f['where'],{'$or':_[_0x9709('0x46')](_0x5a6f5f['attributes'],function(_0x92a43){var _0xde9ec={};_0xde9ec[_0x92a43]={'$like':'%'+_0xe22253['query'][_0x9709('0x58')]+'%'};return _0xde9ec;})});}if(_0xe22253[_0x9709('0x4b')][_0x9709('0xa3')]){var _0x505847=_0xe22253['query'][_0x9709('0xa3')]['split'](',');var _0x91bae6={};_0x91bae6[_0x505847[0x0]]={'$gte':moment(_0x505847[0x1])[_0x9709('0xa4')](_0x9709('0xa5'))};_0x5a6f5f[_0x9709('0x55')]=_[_0x9709('0x57')](_0x5a6f5f[_0x9709('0x55')],_0x91bae6);}_0x5a6f5f=_[_0x9709('0x57')]({},_0x5a6f5f,_0xe22253[_0x9709('0x59')]);return db[_0x9709('0xa6')][_0x9709('0x31')]({'where':_0x5a6f5f[_0x9709('0x55')]})['then'](function(_0x24b58b){_0x1a3b30[_0x9709('0x31')]=_0x24b58b;if(_0xe22253[_0x9709('0x4b')][_0x9709('0x5a')]){_0x5a6f5f[_0x9709('0x5b')]=[{'all':!![]}];}return db[_0x9709('0xa6')][_0x9709('0x5d')](_0x5a6f5f);})[_0x9709('0x36')](function(_0x3036dd){_0x1a3b30[_0x9709('0x6c')]=_0x3036dd;return _0x1a3b30;});}})[_0x9709('0x36')](respondWithFilteredResult(_0x4c37ff,_0x5a6f5f))[_0x9709('0x65')](handleError(_0x4c37ff,null));};exports['send']=function(_0x58af40,_0x280886,_0x594509){var _0x58410f,_0x1056eb={},_0x339a3c;if(_0x58af40[_0x9709('0x64')]['to']){_0x339a3c=_0x58af40[_0x9709('0x64')]['to'][_0x9709('0xa7')](',')[0x0];}return db['MailAccount'][_0x9709('0x62')]({'where':{'id':_0x58af40[_0x9709('0x5f')]['id']},'include':[{'model':db[_0x9709('0xa8')],'as':_0x9709('0xa9'),'include':[{'model':db[_0x9709('0x93')],'as':_0x9709('0xaa'),'where':{'email':_0x339a3c},'limit':0x1,'order':[[_0x9709('0xab'),_0x9709('0xac')]]}]},{'model':db[_0x9709('0x42')],'as':_0x9709('0x43'),'raw':!![]}]})['then'](handleEntityNotFound(_0x280886,null))['then'](function(_0x3a7d4d){if(_0x3a7d4d){_0x58410f=_0x3a7d4d;if(_0x3a7d4d[_0x9709('0x43')]){if(_[_0x9709('0x76')](_0x58af40[_0x9709('0x64')][_0x9709('0xad')])){_0x58af40[_0x9709('0x64')][_0x9709('0xad')]=util['format'](_0x9709('0xae'),_0x3a7d4d['name'],_0x3a7d4d['email']||_0x3a7d4d[_0x9709('0x43')][_0x9709('0x7a')]);}if(_0x58af40[_0x9709('0x64')][_0x9709('0xaf')]&&_0x58af40[_0x9709('0x64')][_0x9709('0xaf')][_0x9709('0x61')]){for(var _0x4f0495=0x0;_0x4f0495<_0x58af40['body'][_0x9709('0xaf')][_0x9709('0x61')];_0x4f0495+=0x1){_0x58af40[_0x9709('0x64')]['attachments'][_0x4f0495]={'filename':_0x58af40[_0x9709('0x64')][_0x9709('0xaf')][_0x4f0495][_0x9709('0x3e')],'path':path[_0x9709('0xb0')](config[_0x9709('0xb1')],_0x9709('0xb2'),_0x58af40[_0x9709('0x64')][_0x9709('0xaf')][_0x4f0495][_0x9709('0xb3')])};}}var _0x3114e0={'tls':{'rejectUnauthorized':![]}};if(_[_0x9709('0x76')](_0x3a7d4d['Smtp'][_0x9709('0x81')])){if(_0x3a7d4d['Smtp'][_0x9709('0x7e')]){_0x3114e0['auth']={'user':_0x3a7d4d[_0x9709('0x43')][_0x9709('0x7a')],'pass':_0x3a7d4d['Smtp'][_0x9709('0x7c')]};}_0x3114e0[_0x9709('0x7f')]=_0x3a7d4d[_0x9709('0x43')]['host'];_0x3114e0[_0x9709('0x80')]=_0x3a7d4d[_0x9709('0x43')][_0x9709('0x80')];_0x3114e0[_0x9709('0xb4')]=_0x3a7d4d[_0x9709('0x43')][_0x9709('0xb4')];}else{_0x3114e0[_0x9709('0x81')]=_0x3a7d4d[_0x9709('0x43')][_0x9709('0x81')];_0x3114e0[_0x9709('0xb5')]={'user':_0x3a7d4d['Smtp'][_0x9709('0x7a')],'pass':_0x3a7d4d['Smtp'][_0x9709('0x7c')]};}return respondWithRpcPromise(_0x9709('0xb6'),_0x9709('0xb7'),{'account':_0x3114e0,'message':_0x58af40[_0x9709('0x64')]});}else{throw new Error(_0x9709('0xb8'));}}})[_0x9709('0x36')](function(_0x11b8f4){if(_0x11b8f4){_0x1056eb=_0x11b8f4;if(_0x58410f[_0x9709('0xa9')]){if(_0x58410f['List'][_0x9709('0xaa')]['length']){return _0x58410f[_0x9709('0xa9')][_0x9709('0xaa')][0x0];}else{return db[_0x9709('0x93')][_0x9709('0x6a')](_[_0x9709('0x1a')](_0x58af40[_0x9709('0x64')],{'firstName':_0x58af40[_0x9709('0x64')]['to'],'email':_0x58af40[_0x9709('0x64')]['to'],'phone':_0x58af40['body']['to'],'ListId':_0x58410f[_0x9709('0x75')]}));}}else{throw new Error(_0x9709('0xb8'));}}})['then'](function(_0x2ac49b){if(_0x2ac49b){var _0x4c927d={'UserId':_0x58af40[_0x9709('0x7a')]['id'],'ContactId':_0x2ac49b['id'],'MailAccountId':_0x58410f['id'],'inReplyTo':_0x1056eb[_0x9709('0xb9')],'to':_0x58af40['body'][_0x9709('0xad')],'cc':_0x58af40[_0x9709('0x64')]['cc'],'subject':_0x58af40['body']['subject'],'attach':_0x58af40['body'][_0x9709('0xba')],'firstMsgDirection':_0x9709('0xbb'),'lastMsgAt':moment()[_0x9709('0xa4')](_0x9709('0xa5')),'lastMsgDirection':_0x9709('0xbb'),'lastMsgBody':_0x58af40[_0x9709('0x64')][_0x9709('0x64')],'Messages':[_['merge'](_0x58af40[_0x9709('0x64')],{'messageId':_0x1056eb[_0x9709('0xb9')],'sentAt':moment()[_0x9709('0xa4')](_0x9709('0xa5')),'read':!![],'MailAccountId':_0x58410f['id'],'UserId':_0x58af40[_0x9709('0x7a')]['id'],'ContactId':_0x2ac49b['id']})]};if(_0x58af40['body'][_0x9709('0xbc')]){_0x4c927d=_['merge'](_0x4c927d,_0x58af40[_0x9709('0x64')][_0x9709('0xbc')]);}return db[_0x9709('0x92')][_0x9709('0x6a')](_0x4c927d,{'include':[{'model':db[_0x9709('0xa6')],'as':_0x9709('0xbd')}]});}})[_0x9709('0x36')](respondWithResult(_0x280886,null))[_0x9709('0x65')](handleError(_0x280886,null));};exports[_0x9709('0xbe')]=function(_0x33ee92,_0x3058ac,_0x2015d6){return db['MailAccount'][_0x9709('0x62')]({'where':{'id':_0x33ee92[_0x9709('0x5f')]['id']},'include':[{'model':db[_0x9709('0x42')],'as':_0x9709('0x43'),'raw':!![]}]})['then'](handleEntityNotFound(_0x3058ac,null))['then'](function(_0x191fa8){if(_0x191fa8&&_0x191fa8['Smtp']){var _0x3d36a1={'id':_0x191fa8['id'],'tls':{'rejectUnauthorized':![]}};if(_0x191fa8[_0x9709('0x43')][_0x9709('0x81')]){_0x3d36a1[_0x9709('0x81')]=_0x191fa8[_0x9709('0x43')][_0x9709('0x81')];}else{_0x3d36a1[_0x9709('0x7f')]=_0x191fa8[_0x9709('0x43')][_0x9709('0x7f')];_0x3d36a1['port']=_0x191fa8[_0x9709('0x43')]['port'];_0x3d36a1[_0x9709('0xb4')]=_0x191fa8['Smtp'][_0x9709('0xb4')];}if(_0x191fa8[_0x9709('0x43')][_0x9709('0x7e')]){_0x3d36a1['auth']={'user':_0x191fa8['Smtp'][_0x9709('0x7a')],'pass':_0x191fa8[_0x9709('0x43')][_0x9709('0x7c')]};}return respondWithRpcPromise(_0x9709('0xbf'),'verifySmtp',{'account':_0x3d36a1});}})[_0x9709('0x36')](respondWithResult(_0x3058ac,null))['catch'](handleError(_0x3058ac,null));};exports[_0x9709('0x37')]=function(_0x3696a6,_0x211213){return db[_0x9709('0x5c')][_0x9709('0x62')]({'where':{'id':_0x3696a6[_0x9709('0x5f')]['id']}})['then'](handleEntityNotFound(_0x211213,null))['then'](function(_0x125802){if(_0x125802&&_0x125802[_0x9709('0x81')]){throw new db[(_0x9709('0x21'))][(_0x9709('0x22'))](_0x9709('0xc0'));}return _0x125802;})[_0x9709('0x36')](removeEntity(_0x211213,null))[_0x9709('0x65')](handleError(_0x211213,null));};exports['addAgents']=function(_0x1bd9b6,_0x8ffe6e,_0x365835){return db[_0x9709('0x5c')][_0x9709('0x62')]({'where':{'id':_0x1bd9b6['params']['id']}})[_0x9709('0x36')](handleEntityNotFound(_0x8ffe6e,null))[_0x9709('0x36')](function(_0x573eaa){if(_0x573eaa){return _0x573eaa[_0x9709('0xc1')](_0x1bd9b6[_0x9709('0x64')]['ids'],_[_0x9709('0x90')](_0x1bd9b6[_0x9709('0x64')],[_0x9709('0x6e'),'id'])||{})[_0x9709('0xc2')](function(_0x257024){for(var _0x1d264b=0x0;_0x1d264b<_0x1bd9b6[_0x9709('0x64')]['ids'][_0x9709('0x61')];_0x1d264b+=0x1){socket['emit'](_0x9709('0xc3'),{'UserId':_0x1bd9b6[_0x9709('0x64')][_0x9709('0x6e')][_0x1d264b],'MailAccountId':_0x1bd9b6[_0x9709('0x5f')]['id']});}return _0x257024;});}})['then'](respondWithResult(_0x8ffe6e,null))[_0x9709('0x65')](handleError(_0x8ffe6e,null));};exports['removeAgents']=function(_0x2963ae,_0x45692b,_0xf0bf57){return db[_0x9709('0x5c')]['find']({'where':{'id':_0x2963ae[_0x9709('0x5f')]['id']}})[_0x9709('0x36')](handleEntityNotFound(_0x45692b,null))[_0x9709('0x36')](function(_0x1210d3){if(_0x1210d3){return _0x1210d3[_0x9709('0xc4')](_0x2963ae[_0x9709('0x4b')][_0x9709('0x6e')])[_0x9709('0x36')](function(){if(_[_0x9709('0xc5')](_0x2963ae[_0x9709('0x4b')][_0x9709('0x6e')])){for(var _0x289a40=0x0;_0x289a40<_0x2963ae['query']['ids'][_0x9709('0x61')];_0x289a40+=0x1){socket[_0x9709('0xc6')](_0x9709('0xc7'),{'UserId':Number(_0x2963ae[_0x9709('0x4b')][_0x9709('0x6e')][_0x289a40]),'MailAccountId':Number(_0x2963ae['params']['id'])});}}else{socket['emit'](_0x9709('0xc7'),{'UserId':Number(_0x2963ae[_0x9709('0x4b')][_0x9709('0x6e')]),'MailAccountId':Number(_0x2963ae[_0x9709('0x5f')]['id'])});}});}})['then'](respondWithStatusCode(_0x45692b,null))[_0x9709('0x65')](handleError(_0x45692b,null));};exports[_0x9709('0xc8')]=function(_0x43eb62,_0x2f1216,_0x474e98){var _0x1a272b={};var _0x26f68c={};var _0x59dcf7;var _0x52599d;return db[_0x9709('0x5c')]['findOne']({'where':{'id':_0x43eb62[_0x9709('0x5f')]['id']}})[_0x9709('0x36')](handleEntityNotFound(_0x2f1216,null))[_0x9709('0x36')](function(_0x286b31){if(_0x286b31){_0x59dcf7=_0x286b31;_0x26f68c[_0x9709('0x4a')]=_[_0x9709('0x4c')](db[_0x9709('0x95')]['rawAttributes']);_0x26f68c[_0x9709('0x4b')]=_[_0x9709('0x4c')](_0x43eb62[_0x9709('0x4b')]);_0x26f68c[_0x9709('0x4d')]=_['intersection'](_0x26f68c['model'],_0x26f68c[_0x9709('0x4b')]);_0x1a272b[_0x9709('0x4f')]=_['intersection'](_0x26f68c[_0x9709('0x4a')],qs[_0x9709('0x50')](_0x43eb62[_0x9709('0x4b')]['fields']));_0x1a272b['attributes']=_0x1a272b['attributes']['length']?_0x1a272b[_0x9709('0x4f')]:_0x26f68c[_0x9709('0x4a')];_0x1a272b[_0x9709('0x53')]=qs[_0x9709('0x54')](_0x43eb62['query'][_0x9709('0x54')]);_0x1a272b['where']=qs['filters'](_[_0x9709('0x56')](_0x43eb62[_0x9709('0x4b')],_0x26f68c[_0x9709('0x4d')]));if(_0x43eb62[_0x9709('0x4b')][_0x9709('0x58')]){_0x1a272b[_0x9709('0x55')]=_[_0x9709('0x57')](_0x1a272b[_0x9709('0x55')],{'$or':_[_0x9709('0x46')](_0x1a272b[_0x9709('0x4f')],function(_0x57ea20){var _0x1846c0={};_0x1846c0[_0x57ea20]={'$like':'%'+_0x43eb62[_0x9709('0x4b')][_0x9709('0x58')]+'%'};return _0x1846c0;})});}_0x1a272b=_[_0x9709('0x57')]({},_0x1a272b,_0x43eb62['options']);return _0x59dcf7['getAgents'](_0x1a272b);}})[_0x9709('0x36')](function(_0x4299ff){if(_0x4299ff){_0x52599d=_0x4299ff[_0x9709('0x61')];if(!_0x43eb62[_0x9709('0x4b')][_0x9709('0x51')](_0x9709('0x72'))){_0x1a272b[_0x9709('0x32')]=qs[_0x9709('0x32')](_0x43eb62[_0x9709('0x4b')][_0x9709('0x32')]);_0x1a272b['offset']=qs[_0x9709('0x52')](_0x43eb62[_0x9709('0x4b')][_0x9709('0x52')]);}return _0x59dcf7[_0x9709('0xc8')](_0x1a272b);}})[_0x9709('0x36')](function(_0x5a23d9){if(_0x5a23d9){return _0x5a23d9?{'count':_0x52599d,'rows':_0x5a23d9}:null;}})[_0x9709('0x36')](respondWithResult(_0x2f1216,null))[_0x9709('0x65')](handleError(_0x2f1216,null));}; \ No newline at end of file +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 diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index ce65abf..205c1f8 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 _0x78c6=['hasOwnProperty','hook','exports','setMaxListeners','save','remove','emit'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x78c6,0x168));var _0x678c=function(_0x4bec7e,_0x178726){_0x4bec7e=_0x4bec7e-0x0;var _0x33d234=_0x78c6[_0x4bec7e];return _0x33d234;};'use strict';var EventEmitter=require('events');var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x678c('0x0')](0x0);var events={'afterCreate':_0x678c('0x1'),'afterUpdate':'update','afterDestroy':_0x678c('0x2')};function emitEvent(_0x5339f7){return function(_0x75a6fd,_0x30a6b2,_0x388cc5){MailAccountEvents['emit'](_0x5339f7+':'+_0x75a6fd['id'],_0x75a6fd);MailAccountEvents[_0x678c('0x3')](_0x5339f7,_0x75a6fd);_0x388cc5(null);};}for(var e in events){if(events[_0x678c('0x4')](e)){var event=events[e];MailAccount[_0x678c('0x5')](e,emitEvent(event));}}module[_0x678c('0x6')]=MailAccountEvents; \ No newline at end of file +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 diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 119e1ca..2feaf8b 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 _0xd2f0=['util','api','moment','request-promise','path','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','lodash'];(function(_0x1547f7,_0x51cd0e){var _0x30e6c8=function(_0x2ac785){while(--_0x2ac785){_0x1547f7['push'](_0x1547f7['shift']());}};_0x30e6c8(++_0x51cd0e);}(_0xd2f0,0x18b));var _0x0d2f=function(_0x2dc391,_0x2d3362){_0x2dc391=_0x2dc391-0x0;var _0x3515ad=_0xd2f0[_0x2dc391];return _0x3515ad;};'use strict';var _=require(_0x0d2f('0x0'));var util=require(_0x0d2f('0x1'));var logger=require('../../config/logger')(_0x0d2f('0x2'));var moment=require(_0x0d2f('0x3'));var BPromise=require('bluebird');var rp=require(_0x0d2f('0x4'));var fs=require('fs');var path=require(_0x0d2f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0d2f('0x6'));module[_0x0d2f('0x7')]=function(_0x54dcd9,_0x3a8973){return _0x54dcd9[_0x0d2f('0x8')](_0x0d2f('0x9'),attributes,{'tableName':_0x0d2f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 498a3b3..f648e55 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 _0xc2e8=['created','MailMessage','attachments','originTo','bcc','Attachments','name','UserId','agent','waitForTheAssignedAgent','Start','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','socket.io-emitter','redis','./mailAccount.socket','register','request','then','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','MailAccount,\x20%s,\x20%s','info','result','GetMailAccount','MailAccount','findAll','options','raw','where','limit','map','include','attributes','model','ShowMailAccount','find','catch','NotifyMailAccount','mail','keys','CmContact','createdAt','CompanyId','ListId','body','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','Contacts','updatedAt','DESC','MailApplication','Applications','MailServerOut','Smtp','List','omit','applications','orderBy','priority','asc','autoclose','push','length','*,*,*,*','defaults','List\x20not\x20found','contact','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','inReplyTo','create','update','subject','get','interaction'];(function(_0x4a0f16,_0x21ba18){var _0x45d653=function(_0x137e2c){while(--_0x137e2c){_0x4a0f16['push'](_0x4a0f16['shift']());}};_0x45d653(++_0x21ba18);}(_0xc2e8,0x70));var _0x8c2e=function(_0x28ffbf,_0x1fee58){_0x28ffbf=_0x28ffbf-0x0;var _0x17da05=_0xc2e8[_0x28ffbf];return _0x17da05;};'use strict';var _=require(_0x8c2e('0x0'));var util=require(_0x8c2e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8c2e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c2e('0x3'))['db'];var utils=require(_0x8c2e('0x4'));var logger=require(_0x8c2e('0x5'))('rpc');var config=require(_0x8c2e('0x6'));var jayson=require(_0x8c2e('0x7'));var client=jayson[_0x8c2e('0x8')]['http']({'port':0x232c});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8c2e('0x9'))(new Redis(config[_0x8c2e('0xa')]));require(_0x8c2e('0xb'))[_0x8c2e('0xc')](socket);function respondWithRpcPromise(_0x41771b,_0x3414c5,_0x138bb7){return new BPromise(function(_0x1d5e16,_0x4a4cf4){return client[_0x8c2e('0xd')](_0x41771b,_0x138bb7)[_0x8c2e('0xe')](function(_0x1ade02){logger['info']('MailAccount,\x20%s,\x20%s',_0x3414c5,'request\x20sent');logger[_0x8c2e('0xf')](_0x8c2e('0x10'),_0x3414c5,_0x8c2e('0x11'),JSON[_0x8c2e('0x12')](_0x1ade02));if(_0x1ade02[_0x8c2e('0x13')]){if(_0x1ade02[_0x8c2e('0x13')][_0x8c2e('0x14')]===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x3414c5,_0x1ade02[_0x8c2e('0x13')][_0x8c2e('0x15')]);return _0x4a4cf4(_0x1ade02[_0x8c2e('0x13')][_0x8c2e('0x15')]);}logger[_0x8c2e('0x13')](_0x8c2e('0x16'),_0x3414c5,_0x1ade02['error'][_0x8c2e('0x15')]);return _0x1d5e16(_0x1ade02[_0x8c2e('0x13')][_0x8c2e('0x15')]);}else{logger[_0x8c2e('0x17')]('MailAccount,\x20%s,\x20%s',_0x3414c5,_0x8c2e('0x11'));_0x1d5e16(_0x1ade02[_0x8c2e('0x18')][_0x8c2e('0x15')]);}})['catch'](function(_0x4a7752){logger[_0x8c2e('0x13')]('MailAccount,\x20%s,\x20%s',_0x3414c5,_0x4a7752);_0x4a4cf4(_0x4a7752);});});}exports[_0x8c2e('0x19')]=function(_0xa02a92){var _0x575133=this;return new Promise(function(_0x1e8578,_0x3b101e){return db[_0x8c2e('0x1a')][_0x8c2e('0x1b')]({'raw':_0xa02a92[_0x8c2e('0x1c')]?_0xa02a92['options'][_0x8c2e('0x1d')]===undefined?!![]:![]:!![],'where':_0xa02a92['options']?_0xa02a92['options'][_0x8c2e('0x1e')]||null:null,'attributes':_0xa02a92[_0x8c2e('0x1c')]?_0xa02a92['options']['attributes']||null:null,'limit':_0xa02a92[_0x8c2e('0x1c')]?_0xa02a92['options'][_0x8c2e('0x1f')]||null:null,'include':_0xa02a92[_0x8c2e('0x1c')]?_0xa02a92[_0x8c2e('0x1c')]['include']?_[_0x8c2e('0x20')](_0xa02a92[_0x8c2e('0x1c')][_0x8c2e('0x21')],function(_0x389297){return{'model':db[_0x389297['model']],'as':_0x389297['as'],'attributes':_0x389297[_0x8c2e('0x22')],'include':_0x389297['include']?_['map'](_0x389297[_0x8c2e('0x21')],function(_0x26fa84){return{'model':db[_0x26fa84['model']],'as':_0x26fa84['as'],'attributes':_0x26fa84['attributes'],'include':_0x26fa84[_0x8c2e('0x21')]?_[_0x8c2e('0x20')](_0x26fa84[_0x8c2e('0x21')],function(_0x46a69f){return{'model':db[_0x46a69f[_0x8c2e('0x23')]],'as':_0x46a69f['as'],'attributes':_0x46a69f[_0x8c2e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x8c2e('0xe')](function(_0x589304){logger['info']('GetMailAccount',_0xa02a92);logger[_0x8c2e('0xf')](_0x8c2e('0x19'),_0xa02a92,JSON[_0x8c2e('0x12')](_0x589304));_0x1e8578(_0x589304);})['catch'](function(_0x89de37){logger[_0x8c2e('0x13')](_0x8c2e('0x19'),_0x89de37[_0x8c2e('0x15')],_0xa02a92);_0x3b101e(_0x575133[_0x8c2e('0x13')](0x1f4,_0x89de37['message']));});});};exports[_0x8c2e('0x24')]=function(_0xf71050){var _0x49dc45=this;return new Promise(function(_0x261944,_0x419b56){return db[_0x8c2e('0x1a')][_0x8c2e('0x25')]({'raw':_0xf71050[_0x8c2e('0x1c')]?_0xf71050[_0x8c2e('0x1c')][_0x8c2e('0x1d')]===undefined?!![]:![]:!![],'where':_0xf71050[_0x8c2e('0x1c')]?_0xf71050['options'][_0x8c2e('0x1e')]||null:null,'attributes':_0xf71050[_0x8c2e('0x1c')]?_0xf71050[_0x8c2e('0x1c')][_0x8c2e('0x22')]||null:null,'include':_0xf71050[_0x8c2e('0x1c')]?_0xf71050[_0x8c2e('0x1c')][_0x8c2e('0x21')]?_[_0x8c2e('0x20')](_0xf71050[_0x8c2e('0x1c')]['include'],function(_0x252346){return{'model':db[_0x252346[_0x8c2e('0x23')]],'as':_0x252346['as'],'attributes':_0x252346[_0x8c2e('0x22')],'include':_0x252346[_0x8c2e('0x21')]?_[_0x8c2e('0x20')](_0x252346['include'],function(_0x591ef8){return{'model':db[_0x591ef8[_0x8c2e('0x23')]],'as':_0x591ef8['as'],'attributes':_0x591ef8[_0x8c2e('0x22')],'include':_0x591ef8[_0x8c2e('0x21')]?_[_0x8c2e('0x20')](_0x591ef8[_0x8c2e('0x21')],function(_0x31c677){return{'model':db[_0x31c677[_0x8c2e('0x23')]],'as':_0x31c677['as'],'attributes':_0x31c677['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2777f5){logger[_0x8c2e('0x17')](_0x8c2e('0x24'),_0xf71050);logger[_0x8c2e('0xf')](_0x8c2e('0x24'),_0xf71050,JSON[_0x8c2e('0x12')](_0x2777f5));_0x261944(_0x2777f5);})[_0x8c2e('0x26')](function(_0x210fb3){logger['error'](_0x8c2e('0x24'),_0x210fb3[_0x8c2e('0x15')],_0xf71050);_0x419b56(_0x49dc45[_0x8c2e('0x13')](0x1f4,_0x210fb3['message']));});});};exports[_0x8c2e('0x27')]=function(_0x5ce170){var _0x280188=this;return new Promise(function(_0x3aefd4,_0x346da0){var _0x5052c3={'body':_0x5ce170['body'],'channel':_0x8c2e('0x28')};var _0x148c84=_['difference'](_[_0x8c2e('0x29')](db[_0x8c2e('0x2a')]['rawAttributes']),[_0x8c2e('0x2b'),'updatedAt',_0x8c2e('0x2c'),_0x8c2e('0x2d')]);var _0x3c1937=![];if(_0x5ce170[_0x8c2e('0x2e')]['id']){delete _0x5ce170[_0x8c2e('0x2e')]['id'];}if(_['isNil'](_0x5ce170[_0x8c2e('0x2e')][_0x8c2e('0x2f')])){return _0x346da0(_0x280188[_0x8c2e('0x13')](0x1f4,_0x8c2e('0x30')));}if(_['isNil'](_0x5ce170['body'][_0x8c2e('0x2e')])||_0x5ce170[_0x8c2e('0x2e')][_0x8c2e('0x2e')]===''){return _0x346da0(_0x280188[_0x8c2e('0x13')](0x1f4,_0x8c2e('0x31')));}if(_[_0x8c2e('0x32')](_0x5ce170[_0x8c2e('0x2e')][_0x8c2e('0x33')])){return _0x346da0(_0x280188['error'](0x1f4,_0x8c2e('0x34')+_0x148c84));}if(!_[_0x8c2e('0x35')](_0x148c84,_0x5ce170[_0x8c2e('0x2e')][_0x8c2e('0x33')])){return _0x346da0(_0x280188[_0x8c2e('0x13')](0x1f4,_0x8c2e('0x36')+_0x148c84));}var _0x25b653={};_0x25b653[_0x5ce170[_0x8c2e('0x2e')][_0x8c2e('0x33')]]=_0x5ce170[_0x8c2e('0x2e')][_0x8c2e('0x2f')];return db['MailAccount'][_0x8c2e('0x25')]({'where':{'id':_0x5ce170[_0x8c2e('0x37')]['id']},'include':[{'model':db[_0x8c2e('0x38')],'as':'List','include':[{'model':db[_0x8c2e('0x2a')],'as':_0x8c2e('0x39'),'where':_0x25b653,'limit':0x1,'order':[[_0x8c2e('0x3a'),_0x8c2e('0x3b')]]}]},{'model':db[_0x8c2e('0x3c')],'as':_0x8c2e('0x3d')},{'model':db[_0x8c2e('0x3e')],'as':_0x8c2e('0x3f')}]})[_0x8c2e('0xe')](function(_0x1c0676){if(_0x1c0676&&_0x1c0676[_0x8c2e('0x40')]){var _0x394a08=_0x1c0676['get']({'plain':!![]});_0x5052c3['account']=_[_0x8c2e('0x41')](_0x394a08,[_0x8c2e('0x3d'),'List']);_0x5052c3['applications']=_0x394a08['Applications'];_0x5052c3['list']=_0x394a08[_0x8c2e('0x40')];_0x5052c3[_0x8c2e('0x42')]=_[_0x8c2e('0x43')](_0x5052c3[_0x8c2e('0x42')],[_0x8c2e('0x44')],[_0x8c2e('0x45')]);if(_0x5052c3[_0x8c2e('0x37')]&&_0x5052c3[_0x8c2e('0x37')][_0x8c2e('0x46')]){_0x5052c3[_0x8c2e('0x42')][_0x8c2e('0x47')]({'id':0x0,'priority':_0x5052c3[_0x8c2e('0x42')][_0x8c2e('0x48')]+0x1,'app':'close','appdata':_0x8c2e('0x46'),'interval':_0x8c2e('0x49')});}if(_0x5052c3[_0x8c2e('0x37')][_0x8c2e('0x3d')]){delete _0x5052c3['account'][_0x8c2e('0x3d')];}if(_0x5052c3[_0x8c2e('0x37')][_0x8c2e('0x40')]){delete _0x5052c3[_0x8c2e('0x37')][_0x8c2e('0x40')];}if(_0x394a08[_0x8c2e('0x40')][_0x8c2e('0x39')][_0x8c2e('0x48')]){return _0x394a08[_0x8c2e('0x40')][_0x8c2e('0x39')][0x0];}var _0x5dfdd3=_[_0x8c2e('0x4a')](_0x5ce170[_0x8c2e('0x2e')],{'firstName':_0x5ce170[_0x8c2e('0x2e')][_0x8c2e('0x2f')],'ListId':_0x394a08['ListId']});_0x5dfdd3[_0x5ce170[_0x8c2e('0x2e')]['mapKey']]=_0x5ce170[_0x8c2e('0x2e')]['from'];return db[_0x8c2e('0x2a')]['create'](_0x5dfdd3);}else{throw new Error(_0x8c2e('0x4b'));}})['then'](function(_0x18da1a){_0x5052c3[_0x8c2e('0x4c')]=_0x18da1a;if(_0x18da1a){if(!_0x5ce170['body'][_0x8c2e('0x15')][_0x8c2e('0x4d')]){_0x5ce170[_0x8c2e('0x2e')]['message'][_0x8c2e('0x4d')]=rs[_0x8c2e('0x4e')]()+'\x20'+_0x5ce170['body'][_0x8c2e('0x15')]['from'];}var _0x547ca6={'ContactId':_0x18da1a['id'],'MailAccountId':_0x5ce170[_0x8c2e('0x37')]['id'],'inReplyTo':_0x5ce170[_0x8c2e('0x2e')][_0x8c2e('0x15')][_0x8c2e('0x4d')],'to':_0x5ce170[_0x8c2e('0x2e')][_0x8c2e('0x15')][_0x8c2e('0x2f')],'cc':_0x5ce170[_0x8c2e('0x2e')][_0x8c2e('0x15')]['cc'],'subject':_0x5ce170[_0x8c2e('0x2e')][_0x8c2e('0x15')]['subject'],'attach':_0x5ce170['body'][_0x8c2e('0x15')][_0x8c2e('0x4f')],'lastMsgAt':moment()[_0x8c2e('0x50')](_0x8c2e('0x51')),'lastMsgDirection':'in','lastMsgBody':_0x5ce170['body'][_0x8c2e('0x2e')]};return db[_0x8c2e('0x52')][_0x8c2e('0x25')]({'where':{'closed':![],'MailAccountId':_0x5ce170[_0x8c2e('0x37')]['id']},'include':[{'model':db['MailMessage'],'as':_0x8c2e('0x53'),'attributes':[_0x8c2e('0x4d')],'where':{'messageId':_0x5ce170[_0x8c2e('0x2e')][_0x8c2e('0x15')][_0x8c2e('0x54')]}}]})[_0x8c2e('0xe')](function(_0xa5ad4a){if(_0xa5ad4a){return[_0xa5ad4a,![]];}return db[_0x8c2e('0x52')][_0x8c2e('0x55')](_0x547ca6)[_0x8c2e('0xe')](function(_0x14b126){return[_0x14b126,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x44adc8,_0x21e540){if(_0x44adc8){_0x3c1937=_0x21e540;if(!_0x21e540){return _0x44adc8[_0x8c2e('0x56')]({'inReplyTo':_0x5ce170[_0x8c2e('0x2e')][_0x8c2e('0x15')][_0x8c2e('0x4d')],'to':_0x5ce170[_0x8c2e('0x2e')][_0x8c2e('0x15')]['from'],'cc':_0x5ce170[_0x8c2e('0x2e')][_0x8c2e('0x15')]['cc'],'subject':_0x5ce170[_0x8c2e('0x2e')][_0x8c2e('0x15')][_0x8c2e('0x57')],'attach':_0x44adc8['attach']?_0x44adc8[_0x8c2e('0x4f')]:_0x5ce170[_0x8c2e('0x2e')]['message'][_0x8c2e('0x4f')],'substatus':null,'substatusAt':moment()[_0x8c2e('0x50')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x8c2e('0x50')](_0x8c2e('0x51')),'lastMsgDirection':'in','lastMsgBody':_0x5ce170[_0x8c2e('0x2e')][_0x8c2e('0x2e')]});}else{return _0x44adc8;}}})[_0x8c2e('0xe')](function(_0x8e2615){_0x5052c3['interaction']=_0x8e2615[_0x8c2e('0x58')]({'plain':!![]});_0x5052c3[_0x8c2e('0x59')][_0x8c2e('0x5a')]=_0x3c1937;return db[_0x8c2e('0x5b')][_0x8c2e('0x55')]({'body':_0x5ce170[_0x8c2e('0x2e')][_0x8c2e('0x2e')],'MailAccountId':_0x5ce170[_0x8c2e('0x37')]['id'],'MailInteractionId':_0x8e2615['id'],'direction':'in','ContactId':_0x5052c3['contact']['id'],'messageId':_0x5ce170[_0x8c2e('0x2e')]['message']['messageId'],'from':_0x5ce170[_0x8c2e('0x2e')]['message'][_0x8c2e('0x2f')],'to':_0x5ce170[_0x8c2e('0x2e')][_0x8c2e('0x15')]['to'],'cc':_0x5ce170[_0x8c2e('0x2e')][_0x8c2e('0x15')]['cc'],'subject':_0x5ce170['body'][_0x8c2e('0x15')]['subject'],'attach':_0x5ce170[_0x8c2e('0x2e')][_0x8c2e('0x15')][_0x8c2e('0x4f')],'Attachments':_0x5ce170[_0x8c2e('0x2e')][_0x8c2e('0x15')][_0x8c2e('0x5c')],'originTo':_0x5ce170[_0x8c2e('0x2e')][_0x8c2e('0x15')][_0x8c2e('0x5d')],'originCc':_0x5ce170[_0x8c2e('0x2e')][_0x8c2e('0x15')]['originCc'],'bcc':_0x5ce170['body'][_0x8c2e('0x15')][_0x8c2e('0x5e')]},{'include':[{'model':db['Attachment'],'as':_0x8c2e('0x5f')}]});})[_0x8c2e('0xe')](function(_0x2b1ffa){_0x5052c3['message']=_0x2b1ffa;if(_0x5052c3[_0x8c2e('0x59')]['UserId']){return db['User']['find']({'attributes':['id',_0x8c2e('0x60')],'where':{'id':_0x5052c3[_0x8c2e('0x59')][_0x8c2e('0x61')]}})[_0x8c2e('0xe')](function(_0x5aaed9){if(_0x5aaed9){_0x5052c3[_0x8c2e('0x42')]['unshift']({'id':0x0,'priority':0x0,'app':_0x8c2e('0x62'),'appdata':_0x5aaed9[_0x8c2e('0x60')]+','+(_0x5052c3['account'][_0x8c2e('0x63')]||0xa),'interval':_0x8c2e('0x49')});}return respondWithRpcPromise(_0x8c2e('0x64'),'startRouting',_0x5052c3);});}return respondWithRpcPromise(_0x8c2e('0x64'),'startRouting',_0x5052c3);})['then'](function(_0x3928d0){_0x3aefd4(_0x3928d0);})[_0x8c2e('0x26')](function(_0x5445ab){_0x346da0(_0x280188['error'](0x1f4,_0x5445ab[_0x8c2e('0x15')]));});});}; \ No newline at end of file +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 diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 10be056..056c3b4 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 _0x34aa=['update','emit','removeListener','register','length','./mailAccount.events','remove'];(function(_0xea0e29,_0x4edde0){var _0x35b910=function(_0x411c63){while(--_0x411c63){_0xea0e29['push'](_0xea0e29['shift']());}};_0x35b910(++_0x4edde0);}(_0x34aa,0x171));var _0xa34a=function(_0x3dee92,_0x55e1eb){_0x3dee92=_0x3dee92-0x0;var _0x44d36e=_0x34aa[_0x3dee92];return _0x44d36e;};'use strict';var MailAccountEvents=require(_0xa34a('0x0'));var events=['save',_0xa34a('0x1'),_0xa34a('0x2')];function createListener(_0xbb3857,_0x1fc924){return function(_0x496e55){_0x1fc924[_0xa34a('0x3')](_0xbb3857,_0x496e55);};}function removeListener(_0x30f3a2,_0x284561){return function(){MailAccountEvents[_0xa34a('0x4')](_0x30f3a2,_0x284561);};}exports[_0xa34a('0x5')]=function(_0x475f8f){for(var _0x27349c=0x0,_0x43f9ea=events[_0xa34a('0x6')];_0x27349c<_0x43f9ea;_0x27349c++){var _0x45f2b4=events[_0x27349c];var _0x467864=createListener('mailAccount:'+_0x45f2b4,_0x475f8f);MailAccountEvents['on'](_0x45f2b4,_0x467864);}}; \ No newline at end of file +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 diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index bea0d3e..51da7f5 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 _0xa9e0=['Router','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','show','put','delete','destroy','exports','multer','util','path'];(function(_0x446410,_0x1a1425){var _0x17bd55=function(_0x466961){while(--_0x466961){_0x446410['push'](_0x446410['shift']());}};_0x17bd55(++_0x1a1425);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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')](_0x0a9e('0x8'),auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0xa')](_0x0a9e('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xc')]);module[_0x0a9e('0xd')]=router; \ No newline at end of file +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 diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index f0b538a..bbac671 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 _0x0699=['sequelize','INTEGER','noop','TEXT','STRING'];(function(_0x1bb812,_0x23eacc){var _0x372adb=function(_0x5ad456){while(--_0x5ad456){_0x1bb812['push'](_0x1bb812['shift']());}};_0x372adb(++_0x23eacc);}(_0x0699,0x1db));var _0x9069=function(_0x555bce,_0x119cc9){_0x555bce=_0x555bce-0x0;var _0x186523=_0x0699[_0x555bce];return _0x186523;};'use strict';var Sequelize=require(_0x9069('0x0'));module['exports']={'priority':{'type':Sequelize[_0x9069('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9069('0x2')},'appdata':{'type':Sequelize[_0x9069('0x3')]()},'description':{'type':Sequelize[_0x9069('0x4')]},'interval':{'type':Sequelize[_0x9069('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +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 diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 5ea05a0..8b5c2d3 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 _0xa02e=['path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','show','model','keys','MailApplication','query','filters','intersection','attributes','fields','includeAll','include','merge','options','catch','body','params','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x10a12a,_0xee7529){var _0x1905af=function(_0x41c8b4){while(--_0x41c8b4){_0x10a12a['push'](_0x10a12a['shift']());}};_0x1905af(++_0xee7529);}(_0xa02e,0xa3));var _0xea02=function(_0x1b96b5,_0x3ebfb0){_0x1b96b5=_0x1b96b5-0x0;var _0x35a906=_0xa02e[_0x1b96b5];return _0x35a906;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xea02('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xea02('0x1'));var jsonpatch=require(_0xea02('0x2'));var rp=require(_0xea02('0x3'));var moment=require(_0xea02('0x4'));var BPromise=require(_0xea02('0x5'));var Mustache=require(_0xea02('0x6'));var util=require(_0xea02('0x7'));var path=require(_0xea02('0x8'));var sox=require(_0xea02('0x9'));var csv=require(_0xea02('0xa'));var ejs=require(_0xea02('0xb'));var fs=require('fs');var _=require(_0xea02('0xc'));var squel=require(_0xea02('0xd'));var crypto=require(_0xea02('0xe'));var jsforce=require(_0xea02('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xea02('0xa'));var querystring=require(_0xea02('0x10'));var Papa=require(_0xea02('0x11'));var Redis=require(_0xea02('0x12'));var authService=require(_0xea02('0x13'));var qs=require(_0xea02('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xea02('0x15'));var logger=require(_0xea02('0x16'))(_0xea02('0x17'));var utils=require(_0xea02('0x18'));var config=require('../../config/environment');var db=require(_0xea02('0x19'))['db'];function respondWithStatusCode(_0x49b068,_0x21230b){_0x21230b=_0x21230b||0xcc;return function(_0x460376){if(_0x460376){return _0x49b068[_0xea02('0x1a')](_0x21230b);}return _0x49b068[_0xea02('0x1b')](_0x21230b)['end']();};}function respondWithResult(_0x236eac,_0x8c253d){_0x8c253d=_0x8c253d||0xc8;return function(_0x4e3c3c){if(_0x4e3c3c){return _0x236eac[_0xea02('0x1b')](_0x8c253d)['json'](_0x4e3c3c);}};}function respondWithFilteredResult(_0x2cf4ae,_0x320c7d){return function(_0x12e389){if(_0x12e389){var _0x229c8c=_0x12e389[_0xea02('0x1c')],_0x52d3bb=_0x320c7d[_0xea02('0x1d')],_0x5492f7=_0x320c7d[_0xea02('0x1d')]+_0x320c7d['limit'],_0x520a0f;if(_0x5492f7>=_0x229c8c){_0x5492f7=_0x229c8c;_0x520a0f=0xc8;}else{_0x520a0f=0xce;}_0x2cf4ae[_0xea02('0x1b')](_0x520a0f);return _0x2cf4ae[_0xea02('0x1e')](_0xea02('0x1f'),_0x52d3bb+'-'+_0x5492f7+'/'+_0x229c8c)['json'](_0x12e389);}return null;};}function patchUpdates(_0x170474){return function(_0x2d73e9){try{jsonpatch[_0xea02('0x20')](_0x2d73e9,_0x170474,!![]);}catch(_0x1ede33){return BPromise[_0xea02('0x21')](_0x1ede33);}return _0x2d73e9['save']();};}function saveUpdates(_0x3683d3,_0x59cf65){return function(_0x442446){if(_0x442446){return _0x442446[_0xea02('0x22')](_0x3683d3)[_0xea02('0x23')](function(_0x5c61f4){return _0x5c61f4;});}return null;};}function removeEntity(_0x39ea06,_0x193a33){return function(_0x1ce3f7){if(_0x1ce3f7){return _0x1ce3f7[_0xea02('0x24')]()[_0xea02('0x23')](function(){_0x39ea06['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55fe8a,_0x15ffb2){return function(_0x48a22f){if(!_0x48a22f){_0x55fe8a[_0xea02('0x1a')](0x194);}return _0x48a22f;};}function handleError(_0x3c6a94,_0xe7c9aa){_0xe7c9aa=_0xe7c9aa||0x1f4;return function(_0x54f7f9){logger['error'](_0x54f7f9[_0xea02('0x25')]);if(_0x54f7f9[_0xea02('0x26')]){delete _0x54f7f9[_0xea02('0x26')];}_0x3c6a94[_0xea02('0x1b')](_0xe7c9aa)[_0xea02('0x27')](_0x54f7f9);};}exports[_0xea02('0x28')]=function(_0x3f4673,_0x4c7133){var _0x318898={'raw':!![],'where':{'id':_0x3f4673['params']['id']}},_0x212d63={};_0x212d63[_0xea02('0x29')]=_[_0xea02('0x2a')](db[_0xea02('0x2b')]['rawAttributes']);_0x212d63[_0xea02('0x2c')]=_[_0xea02('0x2a')](_0x3f4673[_0xea02('0x2c')]);_0x212d63[_0xea02('0x2d')]=_[_0xea02('0x2e')](_0x212d63[_0xea02('0x29')],_0x212d63[_0xea02('0x2c')]);_0x318898[_0xea02('0x2f')]=_[_0xea02('0x2e')](_0x212d63[_0xea02('0x29')],qs[_0xea02('0x30')](_0x3f4673[_0xea02('0x2c')][_0xea02('0x30')]));_0x318898['attributes']=_0x318898[_0xea02('0x2f')]['length']?_0x318898[_0xea02('0x2f')]:_0x212d63[_0xea02('0x29')];if(_0x3f4673[_0xea02('0x2c')][_0xea02('0x31')]){_0x318898[_0xea02('0x32')]=[{'all':!![]}];}_0x318898=_[_0xea02('0x33')]({},_0x318898,_0x3f4673[_0xea02('0x34')]);return db[_0xea02('0x2b')]['find'](_0x318898)[_0xea02('0x23')](handleEntityNotFound(_0x4c7133,null))[_0xea02('0x23')](respondWithResult(_0x4c7133,null))[_0xea02('0x35')](handleError(_0x4c7133,null));};exports[_0xea02('0x22')]=function(_0x2f8402,_0x9a84c8){if(_0x2f8402[_0xea02('0x36')]['id']){delete _0x2f8402[_0xea02('0x36')]['id'];}return db[_0xea02('0x2b')]['find']({'where':{'id':_0x2f8402[_0xea02('0x37')]['id']}})[_0xea02('0x23')](handleEntityNotFound(_0x9a84c8,null))['then'](saveUpdates(_0x2f8402[_0xea02('0x36')],null))['then'](respondWithResult(_0x9a84c8,null))[_0xea02('0x35')](handleError(_0x9a84c8,null));};exports[_0xea02('0x24')]=function(_0x64cae1,_0x324aef){return db['MailApplication'][_0xea02('0x38')]({'where':{'id':_0x64cae1[_0xea02('0x37')]['id']}})['then'](handleEntityNotFound(_0x324aef,null))[_0xea02('0x23')](removeEntity(_0x324aef,null))[_0xea02('0x35')](handleError(_0x324aef,null));}; \ No newline at end of file +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 diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index d7e30bf..b5f57f4 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 _0x47d6=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0xae9024,_0x17f58e){var _0x23e7d3=function(_0x5911fb){while(--_0x5911fb){_0xae9024['push'](_0xae9024['shift']());}};_0x23e7d3(++_0x17f58e);}(_0x47d6,0x13f));var _0x647d=function(_0x220d3e,_0x1096b6){_0x220d3e=_0x220d3e-0x0;var _0x47801f=_0x47d6[_0x220d3e];return _0x47801f;};'use strict';var _=require(_0x647d('0x0'));var util=require(_0x647d('0x1'));var logger=require(_0x647d('0x2'))(_0x647d('0x3'));var moment=require(_0x647d('0x4'));var BPromise=require(_0x647d('0x5'));var rp=require(_0x647d('0x6'));var fs=require('fs');var path=require(_0x647d('0x7'));var rimraf=require(_0x647d('0x8'));var config=require(_0x647d('0x9'));var attributes=require(_0x647d('0xa'));module[_0x647d('0xb')]=function(_0x8a0753,_0x8ffe2b){return _0x8a0753[_0x647d('0xc')](_0x647d('0xd'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x647d('0xe'),'collate':_0x647d('0xf')});}; \ No newline at end of file +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 diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index c6dd11c..f6782cd 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 _0xed93=['MailApplication','update','body','options','raw','where','attributes','limit','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateMailApplication'];(function(_0x5e7df4,_0x21486e){var _0x17bda7=function(_0xcc3684){while(--_0xcc3684){_0x5e7df4['push'](_0x5e7df4['shift']());}};_0x17bda7(++_0x21486e);}(_0xed93,0x6f));var _0x3ed9=function(_0x22eb3f,_0x692bef){_0x22eb3f=_0x22eb3f-0x0;var _0x168263=_0xed93[_0x22eb3f];return _0x168263;};'use strict';var _=require(_0x3ed9('0x0'));var util=require(_0x3ed9('0x1'));var moment=require(_0x3ed9('0x2'));var BPromise=require(_0x3ed9('0x3'));var rs=require(_0x3ed9('0x4'));var fs=require('fs');var Redis=require(_0x3ed9('0x5'));var db=require(_0x3ed9('0x6'))['db'];var utils=require(_0x3ed9('0x7'));var logger=require(_0x3ed9('0x8'))(_0x3ed9('0x9'));var config=require(_0x3ed9('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x3ed9('0xb')][_0x3ed9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x350db2,_0x111ef9,_0x3bc83f){return new BPromise(function(_0x4eae93,_0x454631){return client[_0x3ed9('0xd')](_0x350db2,_0x3bc83f)[_0x3ed9('0xe')](function(_0x1966d0){logger[_0x3ed9('0xf')](_0x3ed9('0x10'),_0x111ef9,_0x3ed9('0x11'));logger['debug'](_0x3ed9('0x12'),_0x111ef9,_0x3ed9('0x11'),JSON[_0x3ed9('0x13')](_0x1966d0));if(_0x1966d0[_0x3ed9('0x14')]){if(_0x1966d0[_0x3ed9('0x14')]['code']===0x1f4){logger[_0x3ed9('0x14')](_0x3ed9('0x10'),_0x111ef9,_0x1966d0['error'][_0x3ed9('0x15')]);return _0x454631(_0x1966d0['error'][_0x3ed9('0x15')]);}logger[_0x3ed9('0x14')](_0x3ed9('0x10'),_0x111ef9,_0x1966d0[_0x3ed9('0x14')][_0x3ed9('0x15')]);return _0x4eae93(_0x1966d0[_0x3ed9('0x14')][_0x3ed9('0x15')]);}else{logger[_0x3ed9('0xf')]('MailApplication,\x20%s,\x20%s',_0x111ef9,_0x3ed9('0x11'));_0x4eae93(_0x1966d0[_0x3ed9('0x16')][_0x3ed9('0x15')]);}})[_0x3ed9('0x17')](function(_0x296b0e){logger['error'](_0x3ed9('0x10'),_0x111ef9,_0x296b0e);_0x454631(_0x296b0e);});});}exports[_0x3ed9('0x18')]=function(_0x145944){var _0x276071=this;return new Promise(function(_0x1a2105,_0x45fec4){return db[_0x3ed9('0x19')][_0x3ed9('0x1a')](_0x145944[_0x3ed9('0x1b')],{'raw':_0x145944[_0x3ed9('0x1c')]?_0x145944[_0x3ed9('0x1c')][_0x3ed9('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x145944['options']?_0x145944[_0x3ed9('0x1c')][_0x3ed9('0x1e')]||null:null,'attributes':_0x145944[_0x3ed9('0x1c')]?_0x145944[_0x3ed9('0x1c')][_0x3ed9('0x1f')]||null:null,'limit':_0x145944['options']?_0x145944[_0x3ed9('0x1c')][_0x3ed9('0x20')]||null:null})['then'](function(_0x96551f){logger[_0x3ed9('0xf')](_0x3ed9('0x18'),_0x145944);logger[_0x3ed9('0x21')](_0x3ed9('0x18'),_0x145944,JSON[_0x3ed9('0x13')](_0x96551f));_0x1a2105(_0x96551f);})['catch'](function(_0x5afae5){logger[_0x3ed9('0x14')](_0x3ed9('0x18'),_0x5afae5['message'],_0x145944);_0x45fec4(_0x276071['error'](0x1f4,_0x5afae5[_0x3ed9('0x15')]));});});}; \ No newline at end of file +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 diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index bc16553..b7729b1 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 _0x6788=['addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','put','mailinteraction:update','mailinteraction:destroy','delete','exports','multer','util','path','connect-timeout','express','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create'];(function(_0x487d8d,_0x54ef64){var _0x412410=function(_0x4fd5b5){while(--_0x4fd5b5){_0x487d8d['push'](_0x487d8d['shift']());}};_0x412410(++_0x54ef64);}(_0x6788,0xfa));var _0x8678=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x6788[_0x27af45];return _0x18df21;};'use strict';var multer=require(_0x8678('0x0'));var util=require(_0x8678('0x1'));var path=require(_0x8678('0x2'));var timeout=require(_0x8678('0x3'));var express=require(_0x8678('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8678('0x5'));var controller=require(_0x8678('0x6'));router[_0x8678('0x7')]('/',auth[_0x8678('0x8')](),controller[_0x8678('0x9')]);router[_0x8678('0x7')](_0x8678('0xa'),auth[_0x8678('0x8')](),controller[_0x8678('0xb')]);router[_0x8678('0x7')](_0x8678('0xc'),auth['isAuthenticated'](),controller[_0x8678('0xd')]);router[_0x8678('0x7')](_0x8678('0xe'),auth[_0x8678('0x8')](),controller[_0x8678('0xf')]);router[_0x8678('0x7')](_0x8678('0x10'),auth[_0x8678('0x8')](),controller[_0x8678('0x11')]);router[_0x8678('0x12')]('/',auth[_0x8678('0x8')](),controller[_0x8678('0x13')]);router[_0x8678('0x12')]('/:id/messages',auth[_0x8678('0x8')](),controller[_0x8678('0x14')]);router['post'](_0x8678('0x15'),auth[_0x8678('0x8')](),interaction[_0x8678('0x16')](_0x8678('0x17'),_0x8678('0x18')),controller['addTags']);router[_0x8678('0x19')](_0x8678('0xc'),auth[_0x8678('0x8')](),interaction[_0x8678('0x16')](_0x8678('0x17'),_0x8678('0x1a')),controller['update']);router['delete']('/:id',auth[_0x8678('0x8')](),interaction[_0x8678('0x16')]('mail',_0x8678('0x1b')),controller['destroy']);router[_0x8678('0x1c')](_0x8678('0x15'),auth[_0x8678('0x8')](),controller['removeTags']);module[_0x8678('0x1d')]=router; \ No newline at end of file +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 diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index ea23364..40dcb86 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 _0x8afb=['TEXT','iconv','exports','BOOLEAN','DATE','STRING','long','ENUM','out'];(function(_0x31110b,_0x527d9d){var _0x4ca64c=function(_0x3fbee3){while(--_0x3fbee3){_0x31110b['push'](_0x31110b['shift']());}};_0x4ca64c(++_0x527d9d);}(_0x8afb,0x172));var _0xb8af=function(_0x2ec53e,_0x59038e){_0x2ec53e=_0x2ec53e-0x0;var _0x3a42d0=_0x8afb[_0x2ec53e];return _0x3a42d0;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xb8af('0x0'));module[_0xb8af('0x1')]={'closed':{'type':Sequelize[_0xb8af('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb8af('0x3')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xb8af('0x4')]},'inReplyTo':{'type':Sequelize[_0xb8af('0x4')](0x1fe)},'to':{'type':Sequelize[_0xb8af('0x4')]},'cc':{'type':Sequelize['TEXT'](_0xb8af('0x5'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0xb8af('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xb8af('0x3')]},'substatus':{'type':Sequelize[_0xb8af('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xb8af('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xb8af('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb8af('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xb8af('0x6')]('in',_0xb8af('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xb8af('0x8')]('long')},'lastMsgText':{'type':Sequelize[_0xb8af('0x8')](_0xb8af('0x5'))}}; \ No newline at end of file +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 diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index b49bbeb..924c600 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 _0x9085=['set','Content-Range','json','apply','reject','save','update','destroy','error','stack','name','send','Users','map','fullname','Tags','TagIds','split','forEach','push','MailInteraction','lastMsgBody','then','lastMsgText','trimStart','fromString','catch','index','rawAttributes','fieldName','key','model','keys','query','filters','attributes','fields','length','order','sort','where','pick','field','color','u.id','u.fullname','ui.MailInteractionId','from','user_has_mail_interactions','left_join','u.id\x20=\x20ui.UserId','select','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.MailAccountId','mail_messages','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','start','plainBody','MailAccountId','i.MailAccountId\x20IN\x20?','concat','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','DESC','isEmpty','t.id\x20IN\x20?','resolve','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.closed','i.closedAt','i.lastMsgDirection','i.subject','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','findOne','enableEmailPreview','rows','intersection','includeAll','include','options','create','body','params','describe','addMessage','ids','omit','getMessages','MailMessage','hasOwnProperty','nolimit','format','setTags','spread','findAll','emit','mailInteractionTags:save','removeTags','download','unix','root','server','tmp','join','files','attachments','Attachment','Messages','subject','createdAt','get','mkdirSync','each','headers','bcc','Bcc','Attachments','basename','readFileSync','build','message%d.eml','log','err','unlinkSync','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','offset','limit'];(function(_0xb52a30,_0x4aeb34){var _0x3498e0=function(_0xe00f09){while(--_0xe00f09){_0xb52a30['push'](_0xb52a30['shift']());}};_0x3498e0(++_0x4aeb34);}(_0x9085,0xcb));var _0x5908=function(_0x51a1e7,_0x54cc87){_0x51a1e7=_0x51a1e7-0x0;var _0x4980d2=_0x9085[_0x51a1e7];return _0x4980d2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5908('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5908('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5908('0x2'));var moment=require('moment');var BPromise=require(_0x5908('0x3'));var Mustache=require(_0x5908('0x4'));var util=require(_0x5908('0x5'));var path=require(_0x5908('0x6'));var sox=require(_0x5908('0x7'));var csv=require(_0x5908('0x8'));var ejs=require(_0x5908('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5908('0xa'));var crypto=require(_0x5908('0xb'));var jsforce=require(_0x5908('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5908('0x8'));var querystring=require(_0x5908('0xd'));var Papa=require('papaparse');var htmlToText=require(_0x5908('0xe'));var Redis=require(_0x5908('0xf'));var authService=require(_0x5908('0x10'));var qs=require(_0x5908('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5908('0x12'))(_0x5908('0x13'));var utils=require(_0x5908('0x14'));var config=require(_0x5908('0x15'));var db=require(_0x5908('0x16'))['db'];config[_0x5908('0x17')]=_[_0x5908('0x18')](config[_0x5908('0x17')],{'host':_0x5908('0x19'),'port':0x18eb});var socket=require(_0x5908('0x1a'))(new Redis(config[_0x5908('0x17')]));require(_0x5908('0x1b'))[_0x5908('0x1c')](socket);function respondWithStatusCode(_0x48aea7,_0x2d6ef9){_0x2d6ef9=_0x2d6ef9||0xcc;return function(_0x18d2b6){if(_0x18d2b6){return _0x48aea7[_0x5908('0x1d')](_0x2d6ef9);}return _0x48aea7[_0x5908('0x1e')](_0x2d6ef9)[_0x5908('0x1f')]();};}function respondWithResult(_0x1c1123,_0x10c025){_0x10c025=_0x10c025||0xc8;return function(_0x225bc5){if(_0x225bc5){return _0x1c1123[_0x5908('0x1e')](_0x10c025)['json'](_0x225bc5);}};}function respondWithFilteredResult(_0x5c1795,_0x40e236){return function(_0x56ffaf){if(_0x56ffaf){var _0x6a6cfb=_0x56ffaf['count'],_0x356959=_0x40e236[_0x5908('0x20')],_0x21cb67=_0x40e236['offset']+_0x40e236[_0x5908('0x21')],_0x4c0176;if(_0x21cb67>=_0x6a6cfb){_0x21cb67=_0x6a6cfb;_0x4c0176=0xc8;}else{_0x4c0176=0xce;}_0x5c1795[_0x5908('0x1e')](_0x4c0176);return _0x5c1795[_0x5908('0x22')](_0x5908('0x23'),_0x356959+'-'+_0x21cb67+'/'+_0x6a6cfb)[_0x5908('0x24')](_0x56ffaf);}return null;};}function patchUpdates(_0xb987af){return function(_0x2149ba){try{jsonpatch[_0x5908('0x25')](_0x2149ba,_0xb987af,!![]);}catch(_0x313d8f){return BPromise[_0x5908('0x26')](_0x313d8f);}return _0x2149ba[_0x5908('0x27')]();};}function saveUpdates(_0x2f9537,_0x31de80){return function(_0x20562f){if(_0x20562f){return _0x20562f[_0x5908('0x28')](_0x2f9537)['then'](function(_0x381a8d){return _0x381a8d;});}return null;};}function removeEntity(_0x2ad6af,_0x4c9b26){return function(_0x2021b2){if(_0x2021b2){return _0x2021b2[_0x5908('0x29')]()['then'](function(){_0x2ad6af[_0x5908('0x1e')](0xcc)[_0x5908('0x1f')]();});}};}function handleEntityNotFound(_0xb1550d,_0x5bcb92){return function(_0x14ba2b){if(!_0x14ba2b){_0xb1550d[_0x5908('0x1d')](0x194);}return _0x14ba2b;};}function handleError(_0x30e203,_0xd5c0a4){_0xd5c0a4=_0xd5c0a4||0x1f4;return function(_0x171260){logger[_0x5908('0x2a')](_0x171260[_0x5908('0x2b')]);if(_0x171260[_0x5908('0x2c')]){delete _0x171260['name'];}_0x30e203[_0x5908('0x1e')](_0xd5c0a4)[_0x5908('0x2d')](_0x171260);};}function getInteractionUsers(_0x291993,_0x235b12){return new BPromise(function(_0x308114,_0x5f262e){try{if(_0x235b12[_0x291993['id']]){_0x291993[_0x5908('0x2e')]=_[_0x5908('0x2f')](_0x235b12[_0x291993['id']],function(_0x5c0bf3){return{'id':_0x5c0bf3['id'],'fullname':_0x5c0bf3[_0x5908('0x30')]};});}}catch(_0x68ea1b){_0x5f262e(_0x68ea1b);}_0x308114(_0x291993);});}function getInteractionTags(_0x262322,_0xeb9cc0){return new BPromise(function(_0x5b6fa5,_0x45530d){try{if(_0x262322['TagIds']){_0x262322[_0x5908('0x31')]=[];_0x262322[_0x5908('0x32')][_0x5908('0x33')](',')[_0x5908('0x34')](function(_0xbbe777){_0x262322[_0x5908('0x31')][_0x5908('0x35')](_0xeb9cc0[_0xbbe777]);});}delete _0x262322['TagIds'];}catch(_0x45cc05){_0x45530d(_0x45cc05);}_0x5b6fa5(_0x262322);});}function getLastMessageText(_0x2f789c){return new BPromise(function(_0x5f25c5,_0x220b71){return db[_0x5908('0x36')]['findOne']({'where':{'id':_0x2f789c['id']},'attributes':[_0x5908('0x37'),'lastMsgText'],'raw':!![]})[_0x5908('0x38')](function(_0x16707a){if(!_0x16707a[_0x5908('0x39')]){_0x2f789c['lastMsgText']=_[_0x5908('0x3a')](htmlToText[_0x5908('0x3b')](_0x16707a[_0x5908('0x37')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x2f789c[_0x5908('0x39')]=_0x16707a[_0x5908('0x39')];}_0x5f25c5(_0x2f789c);})['catch'](function(_0x5e907e){_0x220b71(_0x5e907e);});});}function updateMailInteraction(_0x7fe3bb,_0x49ec7b,_0x831227,_0x53fa37){return new BPromise(function(_0x2de54d,_0xb0056c){return getInteractionUsers(_0x7fe3bb,_0x831227)['then'](function(_0x5666b2){return getInteractionTags(_0x5666b2,_0x49ec7b);})[_0x5908('0x38')](function(_0x424b9a){if(_0x53fa37){_0x2de54d(getLastMessageText(_0x424b9a));}else{_0x2de54d(_0x424b9a);}})[_0x5908('0x3c')](function(_0x410005){_0xb0056c(_0x410005);});});}exports[_0x5908('0x3d')]=function(_0x5eb061,_0x2960fb){var _0x377304={},_0x4a1686={},_0x215f1e={'count':0x0,'rows':[]};var _0x45edb1=_[_0x5908('0x2f')](db[_0x5908('0x36')][_0x5908('0x3e')],function(_0x5f3734){return{'name':_0x5f3734[_0x5908('0x3f')],'type':_0x5f3734['type'][_0x5908('0x40')]};});_0x4a1686[_0x5908('0x41')]=_[_0x5908('0x2f')](_0x45edb1,_0x5908('0x2c'));_0x4a1686['query']=_[_0x5908('0x42')](_0x5eb061[_0x5908('0x43')]);_0x4a1686[_0x5908('0x44')]=_['intersection'](_0x4a1686[_0x5908('0x41')],_0x4a1686['query']);_0x377304[_0x5908('0x45')]=_['intersection'](_0x4a1686[_0x5908('0x41')],qs[_0x5908('0x46')](_0x5eb061[_0x5908('0x43')][_0x5908('0x46')]));_0x377304['attributes']=_0x377304['attributes'][_0x5908('0x47')]?_0x377304[_0x5908('0x45')]:_0x4a1686[_0x5908('0x41')];if(!_0x5eb061[_0x5908('0x43')]['hasOwnProperty']('nolimit')){_0x377304[_0x5908('0x21')]=qs[_0x5908('0x21')](_0x5eb061['query'][_0x5908('0x21')]);_0x377304[_0x5908('0x20')]=qs[_0x5908('0x20')](_0x5eb061['query'][_0x5908('0x20')]);}_0x377304[_0x5908('0x48')]=qs[_0x5908('0x49')](_0x5eb061[_0x5908('0x43')][_0x5908('0x49')]);_0x377304[_0x5908('0x4a')]=qs[_0x5908('0x44')](_[_0x5908('0x4b')](_0x5eb061[_0x5908('0x43')],_0x4a1686[_0x5908('0x44')]));var _0x2cf890=[];var _0x18fa02=squel['select']()[_0x5908('0x4c')]('id')[_0x5908('0x4c')](_0x5908('0x2c'))[_0x5908('0x4c')](_0x5908('0x4d'))['from']('tools_tags');var _0x4a2883=squel['select']()[_0x5908('0x4c')](_0x5908('0x4e'))['field'](_0x5908('0x4f'))[_0x5908('0x4c')](_0x5908('0x50'))[_0x5908('0x51')](_0x5908('0x52'),'ui')[_0x5908('0x53')]('users','u',_0x5908('0x54'));var _0x3888e5=squel[_0x5908('0x55')]()[_0x5908('0x51')](_0x5908('0x56'),'i')['left_join'](_0x5908('0x57'),'c',_0x5908('0x58'))[_0x5908('0x53')]('users','o','o.id\x20=\x20i.UserId')[_0x5908('0x53')]('mail_accounts','a',_0x5908('0x59'))[_0x5908('0x53')](_0x5908('0x5a'),'me','me.MailInteractionId\x20=\x20i.id')[_0x5908('0x53')](_0x5908('0x5b'),'it',_0x5908('0x5c'))['left_join'](_0x5908('0x5d'),'t',_0x5908('0x5e'));var _0x56bf09=squel[_0x5908('0x5f')]();var _0x1b4255=[];var _0x265a67=squel['expr']();var _0x43fa35;if(_0x5eb061[_0x5908('0x43')][_0x5908('0x60')]){_0x43fa35=as[_0x5908('0x61')](_0x5eb061[_0x5908('0x43')]['search']);var _0x1bf2bc=_0x43fa35[_0x5908('0x62')];for(var _0x404d99=0x0;_0x404d99<_0x43fa35[_0x5908('0x63')]['length'];_0x404d99++){var _0x1a59fd=_0x43fa35[_0x5908('0x63')][_0x404d99];var _0x52007f='i';var _0x3e580c=_[_0x5908('0x64')](_0x45edb1,[_0x5908('0x2c'),_0x1a59fd['field']]);if(!_0x3e580c){switch(_0x1a59fd[_0x5908('0x4c')]){case _0x5908('0x65'):if(_0x1a59fd[_0x5908('0x66')]==0x1){_0x3888e5[_0x5908('0x67')]('`'+_0x1a59fd['field']+_0x5908('0x68'));}else{_0x3888e5['having']('`'+_0x1a59fd[_0x5908('0x4c')]+_0x5908('0x69'));}break;case'Contact':if(_0x1a59fd[_0x5908('0x6a')]==='$substring'){if(_0x1a59fd[_0x5908('0x66')][_0x5908('0x33')]('\x20')['length']>0x1){_0x56bf09[_0x1bf2bc](_0x5908('0x6b'),qs[_0x5908('0x6c')](_0x1a59fd[_0x5908('0x66')]),null);}else{var _0x165f44='%'+_0x1a59fd[_0x5908('0x66')]+'%';_0x56bf09[_0x1bf2bc](_0x5908('0x6d'),_0x165f44,_0x165f44,_0x165f44);}}else{_0x3e580c=_[_0x5908('0x64')](_0x45edb1,[_0x5908('0x2c'),_0x5908('0x6e')]);_0x1a59fd[_0x5908('0x4c')]=_0x5908('0x6e');_0x3f4e02=as[_0x5908('0x6f')](_0x52007f,_0x3e580c[_0x5908('0x70')],_0x1a59fd);_0x56bf09[_0x1bf2bc](_0x3f4e02['text'],_0x3f4e02['value']['start'],_0x3f4e02[_0x5908('0x66')][_0x5908('0x1f')]);}break;case _0x5908('0x71'):var _0x2d5ecf=_0x1a59fd['value'][_0x5908('0x33')](',')['map'](function(_0x23c938){return Number(_0x23c938);});_0x2d5ecf[_0x5908('0x34')](function(_0xec6af){_0x265a67['or'](_0x5908('0x72'),'%,'+_0xec6af+',%');});_0x1b4255=_[_0x5908('0x73')](_0x1b4255,_0x2d5ecf);break;case'User':if(_0x1a59fd['operator']===_0x5908('0x74')){_0x56bf09[_0x1bf2bc](_0x5908('0x75'),'%'+_0x1a59fd['value']+'%',null);}else{_0x3e580c=_[_0x5908('0x64')](_0x45edb1,[_0x5908('0x2c'),'UserId']);_0x1a59fd[_0x5908('0x4c')]=_0x5908('0x76');_0x3f4e02=as[_0x5908('0x6f')](_0x52007f,_0x3e580c[_0x5908('0x70')],_0x1a59fd);_0x56bf09[_0x1bf2bc](_0x3f4e02[_0x5908('0x77')],_0x3f4e02[_0x5908('0x66')][_0x5908('0x78')],_0x3f4e02[_0x5908('0x66')]['end']);}break;case _0x5908('0x79'):_0x3f4e02=as[_0x5908('0x6f')]('me',null,_0x1a59fd);_0x56bf09[_0x1bf2bc](_0x3f4e02[_0x5908('0x77')],_0x3f4e02[_0x5908('0x66')][_0x5908('0x78')],_0x3f4e02[_0x5908('0x66')]['end']);break;}}else{var _0x3f4e02=as[_0x5908('0x6f')](_0x52007f,_0x3e580c[_0x5908('0x70')],_0x1a59fd);_0x56bf09[_0x1bf2bc](_0x3f4e02['text'],_0x3f4e02[_0x5908('0x66')][_0x5908('0x78')],_0x3f4e02[_0x5908('0x66')][_0x5908('0x1f')]);}}}else{var _0x103402=_(_0x5eb061[_0x5908('0x43')])[_0x5908('0x42')]()[_0x5908('0x2f')](function(_0x52e86e){return _['some'](_0x45edb1,[_0x5908('0x2c'),_0x52e86e])?_0x52e86e:undefined;})['compact']()['value']();if(!_['isEmpty'](_0x103402)){_0x103402[_0x5908('0x34')](function(_0x527fbe){if(_0x527fbe===_0x5908('0x7a')){_0x3888e5[_0x5908('0x4a')](_0x5908('0x7b'),[][_0x5908('0x7c')](_0x5eb061['query'][_0x527fbe]));}else if(_0x527fbe==='createdAt'){var _0x1a118c=JSON['parse'](_0x5eb061[_0x5908('0x43')][_0x527fbe])[_0x5908('0x7d')];var _0x2f58c2=JSON['parse'](_0x5eb061[_0x5908('0x43')][_0x527fbe])[_0x5908('0x7e')];_0x3888e5[_0x5908('0x4a')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1a118c,_0x2f58c2);}else{if(_0x5eb061[_0x5908('0x43')][_0x527fbe]===_0x5908('0x7f')){_0x3888e5[_0x5908('0x4a')]('i.'+_0x527fbe+_0x5908('0x80'));}else{_0x3888e5[_0x5908('0x4a')]('i.'+_0x527fbe+_0x5908('0x81'),_0x5eb061[_0x5908('0x43')][_0x527fbe]);}}});}if(_0x5eb061[_0x5908('0x43')][_0x5908('0x82')]){if(_0x5eb061[_0x5908('0x43')][_0x5908('0x82')]==0x1){_0x3888e5[_0x5908('0x67')](_0x5908('0x83'));}else{_0x3888e5[_0x5908('0x67')]('`unreadMessages`\x20>\x200');}}if(_0x5eb061['query']['tag']){_0x1b4255=_[_0x5908('0x84')](_0x5eb061[_0x5908('0x43')][_0x5908('0x85')])?_0x5eb061[_0x5908('0x43')][_0x5908('0x85')]:new Array(_0x5eb061['query'][_0x5908('0x85')]);_0x1b4255[_0x5908('0x34')](function(_0x499a8b){_0x265a67['or'](_0x5908('0x72'),'%,'+_0x499a8b+',%');});}if(_0x5eb061[_0x5908('0x43')]['filter']){var _0x44ef9f=_0x5eb061[_0x5908('0x43')][_0x5908('0x86')][_0x5908('0x87')]('\x5c','\x5c\x5c')[_0x5908('0x87')]('\x27\x27',_0x5908('0x88'));if(qs[_0x5908('0x89')](_0x44ef9f)){_0x56bf09['or'](_0x5908('0x8a'),_0x44ef9f+'%');}else if(qs['isEmail'](_0x44ef9f)){_0x56bf09['or'](_0x5908('0x8b'),_0x44ef9f+'%');}else{_0x56bf09['or'](_0x5908('0x8c'),qs[_0x5908('0x6c')](_0x44ef9f))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x5908('0x6c')](_0x44ef9f));}}}_0x3888e5[_0x5908('0x4a')](_0x56bf09);_0x3888e5[_0x5908('0x8d')](_0x5908('0x8e'));var _0x408d96={'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]};var _0x391818=_0x3888e5['clone']();_0x391818[_0x5908('0x4c')]('i.id');_0x391818['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x5908('0x65'));if(_0x377304[_0x5908('0x48')]){_0x377304['order'][_0x5908('0x34')](function(_0x1c9f88){_0x3888e5[_0x5908('0x48')]('i.'+_0x1c9f88[0x0],_0x1c9f88[0x1]===_0x5908('0x8f')?![]:!![]);});}if(!_[_0x5908('0x90')](_0x1b4255)){_0x3888e5[_0x5908('0x67')](_0x265a67);_0x391818[_0x5908('0x4a')](_0x5908('0x91'),_0x1b4255);}BPromise[_0x5908('0x92')]()['then'](function(){if(!_0x43fa35){if(_0x5eb061[_0x5908('0x43')][_0x5908('0x7a')]||_0x5eb061[_0x5908('0x43')][_0x5908('0x93')])return;_0x391818[_0x5908('0x4a')](_0x5908('0x94'));_0x3888e5[_0x5908('0x4a')](_0x5908('0x94'));return;}return _0x5eb061[_0x5908('0x95')][_0x5908('0x96')]({'attributes':['id'],'raw':!![]})[_0x5908('0x38')](function(_0x2b2ee6){if(_[_0x5908('0x90')](_0x2b2ee6)){_0x391818['where'](_0x5908('0x97'));_0x3888e5[_0x5908('0x4a')](_0x5908('0x97'));}else{_0x391818[_0x5908('0x4a')](_0x5908('0x7b'),_[_0x5908('0x2f')](_0x2b2ee6,'id'));_0x3888e5['where'](_0x5908('0x7b'),_[_0x5908('0x2f')](_0x2b2ee6,'id'));}});})[_0x5908('0x38')](function(){db[_0x5908('0x98')]['query'](_0x391818[_0x5908('0x99')](),_0x408d96)[_0x5908('0x38')](function(_0x2f890b){_0x215f1e[_0x5908('0x9a')]=_0x2f890b[_0x5908('0x47')];if(_0x215f1e[_0x5908('0x9a')]===0x0)return[];return db['sequelize'][_0x5908('0x43')](_0x18fa02[_0x5908('0x99')](),_0x408d96)[_0x5908('0x38')](function(_0x246304){_0x2cf890=_[_0x5908('0x9b')](_0x246304,'id');_0x408d96=_[_0x5908('0x9c')](_0x408d96,{'model':db[_0x5908('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5eb061['query'][_0x5908('0x46')]){_0x377304[_0x5908('0x45')]['forEach'](function(_0x24cf7f){_0x3888e5[_0x5908('0x4c')]('i.'+_0x24cf7f);});}else{_0x3888e5['field'](_0x5908('0x9d'),_0x5908('0x65'));_0x3888e5[_0x5908('0x4c')](_0x5908('0x9e'),_0x5908('0x9f'));_0x3888e5[_0x5908('0x4c')](_0x5908('0xa0'),_0x5908('0xa1'));_0x3888e5[_0x5908('0x4c')]('i.id');_0x3888e5['field']('i.createdAt');_0x3888e5[_0x5908('0x4c')]('i.updatedAt');_0x3888e5['field'](_0x5908('0xa2'));_0x3888e5[_0x5908('0x4c')](_0x5908('0xa3'));_0x3888e5[_0x5908('0x4c')]('i.attach');_0x3888e5[_0x5908('0x4c')]('i.lastMsgAt');_0x3888e5[_0x5908('0x4c')](_0x5908('0xa4'));_0x3888e5[_0x5908('0x4c')](_0x5908('0xa5'));_0x3888e5['field']('i.disposition');_0x3888e5['field'](_0x5908('0xa6'));_0x3888e5[_0x5908('0x4c')](_0x5908('0xa7'));_0x3888e5['field'](_0x5908('0xa8'));_0x3888e5[_0x5908('0x4c')](_0x5908('0xa9'));_0x3888e5[_0x5908('0x4c')](_0x5908('0xaa'));_0x3888e5[_0x5908('0x4c')](_0x5908('0xab'),_0x5908('0xac'));_0x3888e5[_0x5908('0x4c')](_0x5908('0xad'),_0x5908('0xae'));_0x3888e5[_0x5908('0x4c')](_0x5908('0xaf'),_0x5908('0xb0'));_0x3888e5['field'](_0x5908('0xb1'),_0x5908('0xb2'));_0x3888e5[_0x5908('0x4c')](_0x5908('0xb3'),_0x5908('0xb4'));_0x3888e5['field'](_0x5908('0xb5'),'Contact.fax');_0x3888e5[_0x5908('0x4c')](_0x5908('0xb6'),'Owner.fullname');_0x3888e5[_0x5908('0x4c')]('o.internal','Owner.internal');_0x3888e5['field'](_0x5908('0xb7'),_0x5908('0x32'));}_0x3888e5[_0x5908('0x21')](_0x377304['limit']);_0x3888e5[_0x5908('0x20')](_0x377304[_0x5908('0x20')]);return db[_0x5908('0x98')][_0x5908('0x43')](_0x3888e5[_0x5908('0x99')](),_0x408d96);})[_0x5908('0x38')](function(_0x4b786e){_0x4a2883['where'](_0x5908('0xb8'),_[_0x5908('0x2f')](_0x4b786e,'id'));return db['sequelize'][_0x5908('0x43')](_0x4a2883['toString'](),_0x408d96)['then'](function(_0x255e3c){var _0x3c0a49=_[_0x5908('0xb9')](_0x255e3c,'MailInteractionId');var _0x3a20ad=[];return db['Setting'][_0x5908('0xba')]({'attributes':[_0x5908('0xbb')],'raw':!![]})[_0x5908('0x38')](function(_0x11f319){var _0xaa1f1c=_0x11f319[_0x5908('0xbb')];_0x4b786e[_0x5908('0x34')](function(_0x3fe571){_0x3a20ad[_0x5908('0x35')](updateMailInteraction(_0x3fe571,_0x2cf890,_0x3c0a49,_0xaa1f1c));});return BPromise['all'](_0x3a20ad);});});});})[_0x5908('0x38')](function(_0x1be3d6){_0x215f1e[_0x5908('0xbc')]=_0x1be3d6;return _0x215f1e;})[_0x5908('0x38')](respondWithFilteredResult(_0x2960fb,_0x377304));})[_0x5908('0x3c')](handleError(_0x2960fb,null));};exports['show']=function(_0x58a92c,_0x37ecf6){var _0x3a0fe3={'raw':![],'where':{'id':_0x58a92c['params']['id']}},_0x25eb27={};_0x25eb27['model']=_[_0x5908('0x42')](db['MailInteraction'][_0x5908('0x3e')]);_0x25eb27[_0x5908('0x43')]=_['keys'](_0x58a92c[_0x5908('0x43')]);_0x25eb27[_0x5908('0x44')]=_[_0x5908('0xbd')](_0x25eb27[_0x5908('0x41')],_0x25eb27[_0x5908('0x43')]);_0x3a0fe3[_0x5908('0x45')]=_[_0x5908('0xbd')](_0x25eb27[_0x5908('0x41')],qs[_0x5908('0x46')](_0x58a92c[_0x5908('0x43')][_0x5908('0x46')]));_0x3a0fe3[_0x5908('0x45')]=_0x3a0fe3[_0x5908('0x45')]['length']?_0x3a0fe3[_0x5908('0x45')]:_0x25eb27[_0x5908('0x41')];if(_0x58a92c[_0x5908('0x43')][_0x5908('0xbe')]){_0x3a0fe3[_0x5908('0xbf')]=[{'all':!![]}];}_0x3a0fe3=_[_0x5908('0x9c')]({},_0x3a0fe3,_0x58a92c[_0x5908('0xc0')]);return db[_0x5908('0x36')][_0x5908('0x64')](_0x3a0fe3)[_0x5908('0x38')](handleEntityNotFound(_0x37ecf6,null))[_0x5908('0x38')](respondWithResult(_0x37ecf6,null))[_0x5908('0x3c')](handleError(_0x37ecf6,null));};exports[_0x5908('0xc1')]=function(_0xe8d9a4,_0x17843a){return db[_0x5908('0x36')][_0x5908('0xc1')](_0xe8d9a4[_0x5908('0xc2')],{})[_0x5908('0x38')](respondWithResult(_0x17843a,0xc9))['catch'](handleError(_0x17843a,null));};exports['update']=function(_0x4e7875,_0x2dc3be){if(_0x4e7875[_0x5908('0xc2')]['id']){delete _0x4e7875['body']['id'];}return db['MailInteraction']['find']({'where':{'id':_0x4e7875[_0x5908('0xc3')]['id']}})[_0x5908('0x38')](handleEntityNotFound(_0x2dc3be,null))[_0x5908('0x38')](saveUpdates(_0x4e7875[_0x5908('0xc2')],null))[_0x5908('0x38')](respondWithResult(_0x2dc3be,null))['catch'](handleError(_0x2dc3be,null));};exports[_0x5908('0x29')]=function(_0x3cdb6b,_0x3d21cd){return db[_0x5908('0x36')]['find']({'where':{'id':_0x3cdb6b[_0x5908('0xc3')]['id']}})['then'](handleEntityNotFound(_0x3d21cd,null))[_0x5908('0x38')](removeEntity(_0x3d21cd,null))[_0x5908('0x3c')](handleError(_0x3d21cd,null));};exports[_0x5908('0xc4')]=function(_0x2aa3ef,_0x29bfbd){return db[_0x5908('0x36')]['describe']()['then'](respondWithResult(_0x29bfbd,null))[_0x5908('0x3c')](handleError(_0x29bfbd,null));};exports[_0x5908('0xc5')]=function(_0x586739,_0x58566c,_0x510e15){return db['MailMessage'][_0x5908('0x64')]({'where':{'id':_0x586739['params']['id']}})[_0x5908('0x38')](handleEntityNotFound(_0x58566c,null))['then'](function(_0x1d27e4){if(_0x1d27e4){return _0x1d27e4['addMessage'](_0x586739[_0x5908('0xc2')][_0x5908('0xc6')],_[_0x5908('0xc7')](_0x586739[_0x5908('0xc2')],[_0x5908('0xc6'),'id'])||{});}})[_0x5908('0x38')](respondWithResult(_0x58566c,null))[_0x5908('0x3c')](handleError(_0x58566c,null));};exports[_0x5908('0xc8')]=function(_0x1a1599,_0x12cc59,_0x2816dd){var _0x4b5316={'raw':![],'where':{}};var _0x14751f={};var _0x17ec17={'count':0x0,'rows':[]};return db[_0x5908('0x36')][_0x5908('0xba')]({'where':{'id':_0x1a1599[_0x5908('0xc3')]['id']}})['then'](handleEntityNotFound(_0x12cc59,null))['then'](function(_0x4fbd64){if(_0x4fbd64){_0x14751f['model']=_[_0x5908('0x42')](db[_0x5908('0xc9')]['rawAttributes']);_0x14751f['query']=_[_0x5908('0x42')](_0x1a1599['query']);_0x14751f[_0x5908('0x44')]=_[_0x5908('0xbd')](_0x14751f[_0x5908('0x41')],_0x14751f['query']);_0x4b5316['attributes']=_[_0x5908('0xbd')](_0x14751f['model'],qs[_0x5908('0x46')](_0x1a1599['query'][_0x5908('0x46')]));_0x4b5316[_0x5908('0x45')]=_0x4b5316[_0x5908('0x45')][_0x5908('0x47')]?_0x4b5316[_0x5908('0x45')]:_0x14751f['model'];if(!_0x1a1599[_0x5908('0x43')][_0x5908('0xca')](_0x5908('0xcb'))){_0x4b5316[_0x5908('0x21')]=qs[_0x5908('0x21')](_0x1a1599[_0x5908('0x43')][_0x5908('0x21')]);_0x4b5316['offset']=qs[_0x5908('0x20')](_0x1a1599[_0x5908('0x43')][_0x5908('0x20')]);}_0x4b5316['order']=qs[_0x5908('0x49')](_0x1a1599[_0x5908('0x43')][_0x5908('0x49')]);_0x4b5316[_0x5908('0x4a')]=qs[_0x5908('0x44')](_[_0x5908('0x4b')](_0x1a1599[_0x5908('0x43')],_0x14751f[_0x5908('0x44')]));_0x4b5316[_0x5908('0x4a')]['MailInteractionId']=_0x4fbd64['id'];if(_0x1a1599[_0x5908('0x43')][_0x5908('0x86')]){_0x4b5316['where']=_[_0x5908('0x9c')](_0x4b5316['where'],{'$or':_[_0x5908('0x2f')](_0x4b5316[_0x5908('0x45')],function(_0x5cfb08){var _0x2746c1={};_0x2746c1[_0x5cfb08]={'$like':'%'+_0x1a1599[_0x5908('0x43')][_0x5908('0x86')]+'%'};return _0x2746c1;})});}if(_0x1a1599['query'][_0x5908('0x7d')]){var _0x3c7686=_0x1a1599['query'][_0x5908('0x7d')][_0x5908('0x33')](',');var _0x2341ee={};_0x2341ee[_0x3c7686[0x0]]={'$gte':moment(_0x3c7686[0x1])[_0x5908('0xcc')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4b5316['where']=_[_0x5908('0x9c')](_0x4b5316[_0x5908('0x4a')],_0x2341ee);}_0x4b5316=_[_0x5908('0x9c')]({},_0x4b5316,_0x1a1599[_0x5908('0xc0')]);return db['MailMessage'][_0x5908('0x9a')]({'where':_0x4b5316[_0x5908('0x4a')]})[_0x5908('0x38')](function(_0x409efd){_0x17ec17[_0x5908('0x9a')]=_0x409efd;if(_0x1a1599[_0x5908('0x43')][_0x5908('0xbe')]){_0x4b5316['include']=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x4b5316);})[_0x5908('0x38')](function(_0x56f98c){_0x17ec17['rows']=_0x56f98c;return _0x17ec17;});}})[_0x5908('0x38')](respondWithFilteredResult(_0x12cc59,_0x4b5316))[_0x5908('0x3c')](handleError(_0x12cc59,null));};exports['addTags']=function(_0x2a7a84,_0x297af7,_0x4b4a46){return db[_0x5908('0x36')][_0x5908('0x64')]({'where':{'id':_0x2a7a84[_0x5908('0xc3')]['id']}})[_0x5908('0x38')](handleEntityNotFound(_0x297af7,null))['then'](function(_0x59e66f){if(_0x59e66f){return _0x59e66f[_0x5908('0xcd')](_0x2a7a84[_0x5908('0xc2')]['ids'],_[_0x5908('0xc7')](_0x2a7a84['body'],[_0x5908('0xc6'),'id'])||{})[_0x5908('0xce')](function(){return db[_0x5908('0x71')][_0x5908('0xcf')]({'attributes':['id',_0x5908('0x2c'),_0x5908('0x4d')],'where':{'id':_0x2a7a84[_0x5908('0xc2')][_0x5908('0xc6')]}});})[_0x5908('0x38')](function(_0x437724){socket[_0x5908('0xd0')](_0x5908('0xd1'),{'id':Number(_0x2a7a84[_0x5908('0xc3')]['id']),'tags':_0x437724||[]});return{'id':Number(_0x2a7a84[_0x5908('0xc3')]['id']),'tags':_0x437724||[]};});}})[_0x5908('0x38')](respondWithResult(_0x297af7,null))[_0x5908('0x3c')](handleError(_0x297af7,null));};exports[_0x5908('0xd2')]=function(_0x1c5841,_0x3e39f4,_0x21fb75){return db[_0x5908('0x36')][_0x5908('0x64')]({'where':{'id':_0x1c5841[_0x5908('0xc3')]['id']}})[_0x5908('0x38')](handleEntityNotFound(_0x3e39f4,null))[_0x5908('0x38')](function(_0x5b5290){if(_0x5b5290){return _0x5b5290['removeTags'](_0x1c5841[_0x5908('0x43')][_0x5908('0xc6')]);}})['then'](respondWithStatusCode(_0x3e39f4,null))[_0x5908('0x3c')](handleError(_0x3e39f4,null));};exports[_0x5908('0xd3')]=function(_0x26519d,_0xd413e1){var _0x84d0f6=moment()[_0x5908('0xd4')]()[_0x5908('0x99')]();var _0x547a25=path['join'](config[_0x5908('0xd5')],_0x5908('0xd6'),'files',_0x5908('0xd7'));var _0x512156=path[_0x5908('0xd8')](config[_0x5908('0xd5')],'server',_0x5908('0xd9'),_0x5908('0xda'));var _0x4c66c4=path[_0x5908('0xd8')](_0x547a25,_0x84d0f6);var _0x5943ca=util[_0x5908('0xcc')]('transcript-%d-%s.zip',_0x26519d[_0x5908('0xc3')]['id'],_0x84d0f6);var _0x432b96=path[_0x5908('0xd8')](_0x547a25,_0x5943ca);var _0x4ba88e=[];if(_0x26519d[_0x5908('0x43')][_0x5908('0xda')]){_0x4ba88e['push']({'model':db[_0x5908('0xdb')],'as':'Attachments','raw':!![]});}var _0x43bf6f=[{'model':db['MailMessage'],'as':_0x5908('0xdc'),'attributes':['id',_0x5908('0xc2'),'from','to','cc','bcc',_0x5908('0xdd'),_0x5908('0xde')],'where':{'secret':![]},'order':qs[_0x5908('0x49')]('id'),'include':_0x4ba88e}];return db[_0x5908('0x36')][_0x5908('0x64')]({'where':{'id':_0x26519d[_0x5908('0xc3')]['id']},'include':_0x43bf6f})[_0x5908('0x38')](handleEntityNotFound(_0xd413e1,null))['then'](function(_0x449183){if(_0x449183&&_0x449183[_0x5908('0xdc')]){var _0x5da293=_0x449183[_0x5908('0xdf')]({'plain':!![]});fs[_0x5908('0xe0')](_0x4c66c4);return BPromise[_0x5908('0xe1')](_0x5da293[_0x5908('0xdc')],function(_0x56da25,_0x73d43e){var _0x40ffb5={'from':_0x56da25['from'],'to':_0x56da25['to'],'subject':_0x56da25[_0x5908('0xdd')],'html':_0x56da25[_0x5908('0xc2')],'headers':{'Date':moment(_0x56da25['createdAt'])[_0x5908('0xcc')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x56da25['cc']){_0x40ffb5[_0x5908('0xe2')]['Cc']=_0x56da25['cc'];}if(_0x56da25[_0x5908('0xe3')]){_0x40ffb5['headers'][_0x5908('0xe4')]=_0x56da25['bcc'];}return new BPromise(function(_0x41efaf,_0x20133a){if(_0x56da25[_0x5908('0xe5')]){for(var _0x4312ef=0x0;_0x4312ef<_0x56da25[_0x5908('0xe5')][_0x5908('0x47')];_0x4312ef++){var _0x4aaff3=_0x56da25[_0x5908('0xe5')][_0x4312ef];var _0x2fbdae=path[_0x5908('0xd8')](_0x512156,_0x4aaff3[_0x5908('0xe6')]);if(fs['existsSync'](_0x2fbdae)){_0x40ffb5[_0x5908('0xda')][_0x5908('0x35')]({'name':_0x4aaff3[_0x5908('0x2c')],'contentType':_0x4aaff3[_0x5908('0x70')],'data':fs[_0x5908('0xe7')](_0x2fbdae)});}}}emlformat[_0x5908('0xe8')](_0x40ffb5,function(_0x46c5a8,_0x31c1f7){if(_0x46c5a8)return _0x20133a(_0x46c5a8);fs['writeFileSync'](path[_0x5908('0xd8')](_0x4c66c4,util[_0x5908('0xcc')](_0x5908('0xe9'),_0x73d43e)),_0x31c1f7);return _0x41efaf(_0x31c1f7);});});})['then'](function(){return new BPromise(function(_0x2ee65d,_0x237dc7){zipdir(_0x4c66c4,{'saveTo':_0x432b96},function(_0x370e07,_0xb5c5e7){if(_0x370e07)return _0x237dc7(_0x370e07);return _0x2ee65d(_0xb5c5e7);});})[_0x5908('0x38')](function(){return new BPromise(function(_0xf3cc9f,_0x4fd230){rimraf(_0x4c66c4,function(_0x4284bf){if(_0x4284bf)_0x4fd230(_0x4284bf);return _0xf3cc9f();});});})[_0x5908('0x38')](function(){return _0xd413e1[_0x5908('0xd3')](_0x432b96,_0x5943ca,function(_0x2cee28){if(_0x2cee28){console[_0x5908('0xea')](_0x5908('0xeb'),_0x2cee28);}else{fs[_0x5908('0xec')](_0x432b96);}});});});}else{return _0xd413e1[_0x5908('0x1d')](0xc8);}})[_0x5908('0x3c')](handleError(_0xd413e1,null));}; \ No newline at end of file +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 diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index f3f0d78..1a4296a 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 _0x4e82=['../../mysqldb','MailMessage','setMaxListeners','save','update','then','setDataValue','Users','map','unreadMessages','length','emit','hook','exports','events','MailInteraction'];(function(_0x179555,_0x144352){var _0x474d57=function(_0x2dff64){while(--_0x2dff64){_0x179555['push'](_0x179555['shift']());}};_0x474d57(++_0x144352);}(_0x4e82,0x18e));var _0x24e8=function(_0x281f74,_0x4edfe1){_0x281f74=_0x281f74-0x0;var _0x57669b=_0x4e82[_0x281f74];return _0x57669b;};'use strict';var EventEmitter=require(_0x24e8('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x24e8('0x1')];var MailMessage=require(_0x24e8('0x2'))['db'][_0x24e8('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x24e8('0x4')](0x0);var events={'afterCreate':_0x24e8('0x5'),'afterUpdate':_0x24e8('0x6'),'afterDestroy':'remove'};function emitEvent(_0x56ea18){return function(_0x2409c3,_0x90242c,_0x375aef){_0x2409c3['getUsers']({'attributes':['id'],'raw':!![]})[_0x24e8('0x7')](function(_0x1f6bb4){_0x2409c3[_0x24e8('0x8')](_0x24e8('0x9'),_0x1f6bb4[_0x24e8('0xa')](function(_0x4d4402){return{'id':_0x4d4402['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x2409c3['id'],'direction':'in','read':![]},'raw':!![]});})[_0x24e8('0x7')](function(_0x20ba0f){_0x2409c3[_0x24e8('0x8')](_0x24e8('0xb'),_0x20ba0f[_0x24e8('0xc')]);MailInteractionEvents['emit'](_0x56ea18+':'+_0x2409c3['id'],_0x2409c3);MailInteractionEvents[_0x24e8('0xd')](_0x56ea18,_0x2409c3);_0x375aef(null);})['catch'](_0x375aef(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x24e8('0xe')](e,emitEvent(event));}}module[_0x24e8('0xf')]=MailInteractionEvents; \ No newline at end of file +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 diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 4d34bd5..28b068f 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 _0x5dd5=['changed','YYYY-MM-DD\x20HH:mm:ss','models','get','MailMessage','catch','utf8mb4','utf8mb4_unicode_ci','util','moment','bluebird','path','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','closed'];(function(_0x305c31,_0x466b17){var _0x17f39f=function(_0x53ae03){while(--_0x53ae03){_0x305c31['push'](_0x305c31['shift']());}};_0x17f39f(++_0x466b17);}(_0x5dd5,0x1a0));var _0x55dd=function(_0x5c1b26,_0x452a0b){_0x5c1b26=_0x5c1b26-0x0;var _0x15bb7c=_0x5dd5[_0x5c1b26];return _0x15bb7c;};'use strict';var _=require('lodash');var util=require(_0x55dd('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x55dd('0x1'));var BPromise=require(_0x55dd('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x55dd('0x3'));var rimraf=require(_0x55dd('0x4'));var config=require('../../config/environment');var attributes=require(_0x55dd('0x5'));module[_0x55dd('0x6')]=function(_0x203d6d,_0x3d24f0){return _0x203d6d[_0x55dd('0x7')](_0x55dd('0x8'),attributes,{'tableName':_0x55dd('0x9'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x55dd('0xa'),'to'],'type':_0x55dd('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4859bc,_0x47c921,_0x567d18){if(_0x4859bc[_0x55dd('0xc')]){_0x4859bc[_0x55dd('0xd')]=moment()[_0x55dd('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x4859bc[_0x55dd('0xf')]){_0x4859bc['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x567d18(null,_0x47c921);},'beforeUpdate':function(_0x497489,_0x246b61,_0x1f06ee){if(_0x497489[_0x55dd('0x10')]('substatus')){_0x497489['substatusAt']=_0x497489[_0x55dd('0xc')]?moment()[_0x55dd('0xe')](_0x55dd('0x11')):null;}if(_0x497489[_0x55dd('0x10')](_0x55dd('0xf'))){_0x497489['closedAt']=moment()['format'](_0x55dd('0x11'));_0x497489[_0x55dd('0xc')]=null;_0x497489[_0x55dd('0xd')]=null;}_0x1f06ee(null,_0x497489);},'afterUpdate':function(_0x48e062,_0x5b4ba6,_0x24ad1c){var _0x96aa2a=_0x203d6d[_0x55dd('0x12')];var _0x10effc=_0x48e062[_0x55dd('0x13')]({'plain':!![]});if(_0x10effc[_0x55dd('0xf')]){return _0x96aa2a[_0x55dd('0x14')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x10effc['id']}})['then'](function(){_0x24ad1c();})[_0x55dd('0x15')](function(_0x1c5029){_0x24ad1c(_0x1c5029);});}else{_0x24ad1c();}}},'charset':_0x55dd('0x16'),'collate':_0x55dd('0x17')});}; \ No newline at end of file +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 diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index a196c75..cde3798 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 _0x2e21=['MailInteraction,\x20%s,\x20%s','message','result','catch','UpdateMailInteraction','MailInteraction','body','options','raw','where','debug','AddTagsToMailInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2f1595,_0x541f28){var _0x53f819=function(_0x287f01){while(--_0x287f01){_0x2f1595['push'](_0x2f1595['shift']());}};_0x53f819(++_0x541f28);}(_0x2e21,0xba));var _0x12e2=function(_0x359c85,_0x3309b2){_0x359c85=_0x359c85-0x0;var _0x600f7b=_0x2e21[_0x359c85];return _0x600f7b;};'use strict';var _=require(_0x12e2('0x0'));var util=require(_0x12e2('0x1'));var moment=require(_0x12e2('0x2'));var BPromise=require('bluebird');var rs=require(_0x12e2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x12e2('0x4'))['db'];var utils=require(_0x12e2('0x5'));var logger=require(_0x12e2('0x6'))(_0x12e2('0x7'));var config=require(_0x12e2('0x8'));var jayson=require(_0x12e2('0x9'));var client=jayson[_0x12e2('0xa')][_0x12e2('0xb')]({'port':0x232a});config[_0x12e2('0xc')]=_[_0x12e2('0xd')](config[_0x12e2('0xc')],{'host':_0x12e2('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x12e2('0xc')]));require('./mailInteraction.socket')[_0x12e2('0xf')](socket);function respondWithRpcPromise(_0x57c018,_0x2ce51c,_0x357dd8){return new BPromise(function(_0x3c9607,_0x5a231c){return client[_0x12e2('0x10')](_0x57c018,_0x357dd8)[_0x12e2('0x11')](function(_0x5776c6){logger[_0x12e2('0x12')]('MailInteraction,\x20%s,\x20%s',_0x2ce51c,_0x12e2('0x13'));logger['debug'](_0x12e2('0x14'),_0x2ce51c,_0x12e2('0x13'),JSON[_0x12e2('0x15')](_0x5776c6));if(_0x5776c6[_0x12e2('0x16')]){if(_0x5776c6[_0x12e2('0x16')][_0x12e2('0x17')]===0x1f4){logger[_0x12e2('0x16')](_0x12e2('0x18'),_0x2ce51c,_0x5776c6[_0x12e2('0x16')]['message']);return _0x5a231c(_0x5776c6[_0x12e2('0x16')][_0x12e2('0x19')]);}logger[_0x12e2('0x16')](_0x12e2('0x18'),_0x2ce51c,_0x5776c6[_0x12e2('0x16')][_0x12e2('0x19')]);return _0x3c9607(_0x5776c6[_0x12e2('0x16')][_0x12e2('0x19')]);}else{logger[_0x12e2('0x12')](_0x12e2('0x18'),_0x2ce51c,_0x12e2('0x13'));_0x3c9607(_0x5776c6[_0x12e2('0x1a')][_0x12e2('0x19')]);}})[_0x12e2('0x1b')](function(_0x4aa685){logger[_0x12e2('0x16')](_0x12e2('0x18'),_0x2ce51c,_0x4aa685);_0x5a231c(_0x4aa685);});});}exports[_0x12e2('0x1c')]=function(_0x720d2e){var _0x141c18=this;return new Promise(function(_0xec1afe,_0xd85795){return db[_0x12e2('0x1d')]['update'](_0x720d2e[_0x12e2('0x1e')],{'raw':_0x720d2e[_0x12e2('0x1f')]?_0x720d2e[_0x12e2('0x1f')][_0x12e2('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x720d2e['options']?_0x720d2e[_0x12e2('0x1f')][_0x12e2('0x21')]||null:null,'attributes':_0x720d2e['options']?_0x720d2e[_0x12e2('0x1f')]['attributes']||null:null,'limit':_0x720d2e[_0x12e2('0x1f')]?_0x720d2e[_0x12e2('0x1f')]['limit']||null:null})[_0x12e2('0x11')](function(_0x2b735a){logger['info']('UpdateMailInteraction',_0x720d2e);logger[_0x12e2('0x22')](_0x12e2('0x1c'),_0x720d2e,JSON['stringify'](_0x2b735a));_0xec1afe(_0x2b735a);})[_0x12e2('0x1b')](function(_0x18639b){logger[_0x12e2('0x16')](_0x12e2('0x1c'),_0x18639b[_0x12e2('0x19')],_0x720d2e);_0xd85795(_0x141c18[_0x12e2('0x16')](0x1f4,_0x18639b[_0x12e2('0x19')]));});});};exports[_0x12e2('0x23')]=function(_0x50e6f7){return new Promise(function(_0xe392f6,_0x2a32a6){return db[_0x12e2('0x1d')][_0x12e2('0x24')]({'where':_0x50e6f7[_0x12e2('0x1f')]?_0x50e6f7[_0x12e2('0x1f')]['where']||null:null})[_0x12e2('0x11')](function(_0x3da6a3){if(_0x3da6a3){return _0x3da6a3[_0x12e2('0x25')](_0x50e6f7['body'][_0x12e2('0x26')],_[_0x12e2('0x27')](_0x50e6f7['body'],[_0x12e2('0x26'),'id'])||{});}})[_0x12e2('0x28')](function(_0x1dca57){logger[_0x12e2('0x12')](_0x12e2('0x29'),_0x50e6f7);logger['debug'](_0x12e2('0x29'),_0x50e6f7,JSON[_0x12e2('0x15')](_0x1dca57));_0xe392f6(_0x1dca57);})[_0x12e2('0x1b')](function(_0x513d80){logger[_0x12e2('0x16')](_0x12e2('0x29'),_0x513d80[_0x12e2('0x19')],_0x50e6f7);_0x2a32a6(_this['error'](0x1f4,_0x513d80[_0x12e2('0x19')]));});});}; \ No newline at end of file +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 diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 071ff9e..b8dff36 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 _0x35f9=['removeListener','register','length','mailInteraction:','./mailInteraction.events','remove','update','emit'];(function(_0x429900,_0x4713c6){var _0x86e6f4=function(_0x1d77d2){while(--_0x1d77d2){_0x429900['push'](_0x429900['shift']());}};_0x86e6f4(++_0x4713c6);}(_0x35f9,0x104));var _0x935f=function(_0x34e2a2,_0x4614bd){_0x34e2a2=_0x34e2a2-0x0;var _0x1d9b60=_0x35f9[_0x34e2a2];return _0x1d9b60;};'use strict';var MailInteractionEvents=require(_0x935f('0x0'));var events=['save',_0x935f('0x1'),_0x935f('0x2')];function createListener(_0x99659d,_0x43f166){return function(_0x1261ed){_0x43f166[_0x935f('0x3')](_0x99659d,_0x1261ed);};}function removeListener(_0x2717a9,_0x3b5b84){return function(){MailInteractionEvents[_0x935f('0x4')](_0x2717a9,_0x3b5b84);};}exports[_0x935f('0x5')]=function(_0xe9b136){for(var _0x1dbb97=0x0,_0x43c214=events[_0x935f('0x6')];_0x1dbb97<_0x43c214;_0x1dbb97++){var _0x25da22=events[_0x1dbb97];var _0x174d30=createListener(_0x935f('0x7')+_0x25da22,_0xe9b136);MailInteractionEvents['on'](_0x25da22,_0x174d30);}}; \ No newline at end of file +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 diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 846ea44..fe8ef32 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 _0xedd9=['get','isAuthenticated','index','/:id','show','/:id/download','download','post','tracked','mail','create','put','update','/:id/accept','/:id/reject','reject','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4a0af5,_0x19c2ab){var _0x359b72=function(_0x329ee5){while(--_0x329ee5){_0x4a0af5['push'](_0x4a0af5['shift']());}};_0x359b72(++_0x19c2ab);}(_0xedd9,0xfc));var _0x9edd=function(_0x3130cf,_0x174ae3){_0x3130cf=_0x3130cf-0x0;var _0x4e728a=_0xedd9[_0x3130cf];return _0x4e728a;};'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('./mailMessage.controller');router[_0x9edd('0x8')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xa')]);router[_0x9edd('0x8')]('/describe',auth[_0x9edd('0x9')](),controller['describe']);router[_0x9edd('0x8')](_0x9edd('0xb'),auth[_0x9edd('0x9')](),controller[_0x9edd('0xc')]);router['get'](_0x9edd('0xd'),auth['isAuthenticated'](),controller[_0x9edd('0xe')]);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),interaction[_0x9edd('0x10')](_0x9edd('0x11'),'mailmessage:create'),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')](_0x9edd('0xb'),auth[_0x9edd('0x9')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')](_0x9edd('0x15'),auth[_0x9edd('0x9')](),controller['accept']);router[_0x9edd('0x13')](_0x9edd('0x16'),auth[_0x9edd('0x9')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xb'),auth[_0x9edd('0x9')](),controller[_0x9edd('0x19')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 9e80bf1..4ee23bc 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 _0xd4ad=['DATE','INTEGER','BOOLEAN','sequelize','lodash','exports','TEXT','medium','out','STRING','long'];(function(_0x2dcc3c,_0x46efa9){var _0x2980a9=function(_0x4e2f0a){while(--_0x4e2f0a){_0x2dcc3c['push'](_0x2dcc3c['shift']());}};_0x2980a9(++_0x46efa9);}(_0xd4ad,0x158));var _0xdd4a=function(_0x35e191,_0x47ce81){_0x35e191=_0x35e191-0x0;var _0x2a62b1=_0xd4ad[_0x35e191];return _0x2a62b1;};'use strict';var Sequelize=require(_0xdd4a('0x0'));var _=require(_0xdd4a('0x1'));module[_0xdd4a('0x2')]={'body':{'type':Sequelize[_0xdd4a('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xdd4a('0x3')](_0xdd4a('0x4'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xdd4a('0x5')),'defaultValue':_0xdd4a('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0xdd4a('0x6')]},'to':{'type':Sequelize['TEXT'](_0xdd4a('0x7'))},'cc':{'type':Sequelize[_0xdd4a('0x3')]('long')},'bcc':{'type':Sequelize[_0xdd4a('0x3')]('long')},'subject':{'type':Sequelize[_0xdd4a('0x3')]},'sentAt':{'type':Sequelize[_0xdd4a('0x8')]},'attach':{'type':Sequelize[_0xdd4a('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xdd4a('0xa')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xdd4a('0x8')]},'originTo':{'type':Sequelize[_0xdd4a('0x3')]('long')},'originCc':{'type':Sequelize['TEXT'](_0xdd4a('0x7'))}}; \ No newline at end of file +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 diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 3a3774f..d304a66 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 _0x90ec=['info','request\x20sent','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','key','keys','intersection','attributes','fields','query','length','model','hasOwnProperty','order','sort','where','filters','filter','merge','type','options','MailMessage','includeAll','findAll','rows','show','params','include','find','body','describe','create','direction','out','secret','split','MailAccountId','List','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','service','secure','authentication','auth','user','pass','attachments','join','root','server/files/attachments','CmContact','ListId','List\x20not\x20found','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','mail-interactions','mail','read','format','UserId','Contact','get','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','agent','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','download','toString','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','push','readFileSync','build','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','api','defaults','redis','socket.io-emitter','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','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5bc75a,_0x38ce5c){var _0x51abb3=function(_0x2622c0){while(--_0x2622c0){_0x5bc75a['push'](_0x5bc75a['shift']());}};_0x51abb3(++_0x38ce5c);}(_0x90ec,0x1d4));var _0xc90e=function(_0x3c57ea,_0x1a75f6){_0x3c57ea=_0x3c57ea-0x0;var _0x475400=_0x90ec[_0x3c57ea];return _0x475400;};'use strict';var pdf=require(_0xc90e('0x0'));var emlformat=require(_0xc90e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc90e('0x2'));var jsonpatch=require(_0xc90e('0x3'));var rp=require(_0xc90e('0x4'));var moment=require(_0xc90e('0x5'));var BPromise=require(_0xc90e('0x6'));var Mustache=require('mustache');var util=require(_0xc90e('0x7'));var path=require(_0xc90e('0x8'));var sox=require(_0xc90e('0x9'));var csv=require('to-csv');var ejs=require(_0xc90e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc90e('0xb'));var crypto=require(_0xc90e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc90e('0xd'));var toCsv=require(_0xc90e('0xe'));var querystring=require(_0xc90e('0xf'));var Papa=require(_0xc90e('0x10'));var Redis=require(_0xc90e('0x11'));var authService=require(_0xc90e('0x12'));var qs=require(_0xc90e('0x13'));var as=require(_0xc90e('0x14'));var hardwareService=require(_0xc90e('0x15'));var logger=require('../../config/logger')(_0xc90e('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0xc90e('0x17')](config[_0xc90e('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xc90e('0x19'))(new Redis(config[_0xc90e('0x18')]));require('./mailMessage.socket')[_0xc90e('0x1a')](socket);var jayson=require(_0xc90e('0x1b'));var client=jayson[_0xc90e('0x1c')][_0xc90e('0x1d')]({'port':0x232c});var client9003=jayson[_0xc90e('0x1c')][_0xc90e('0x1d')]({'port':0x232b});var client9002=jayson['client'][_0xc90e('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x2ada5a,_0x4ff295,_0xd16172){if(_0xd16172){var _0x48eac8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x48eac8[_0xc90e('0x1e')](_0x4ff295)){return _0x2ada5a;}else{throw new db[(_0xc90e('0x1f'))]['ValidationError'](_0xc90e('0x20'));}}else{return _0x2ada5a;}}function respondWithRpcPromise(_0xe0e0bc,_0x17ec6b,_0x54e957,_0x5cf3f5){return new BPromise(function(_0x486725,_0x161a3a){var _0x147120=_0x5cf3f5||client;return _0x147120[_0xc90e('0x21')](_0xe0e0bc,_0x54e957)[_0xc90e('0x22')](function(_0x8fb1ef){logger['info'](_0xc90e('0x23'),_0x17ec6b,'request\x20sent');logger[_0xc90e('0x24')](_0xc90e('0x25'),_0x17ec6b,'request\x20sent',JSON[_0xc90e('0x26')](_0x8fb1ef));if(_0x8fb1ef[_0xc90e('0x27')]){if(_0x8fb1ef[_0xc90e('0x27')][_0xc90e('0x28')]===0x1f4){logger[_0xc90e('0x27')](_0xc90e('0x23'),_0x17ec6b,_0x8fb1ef[_0xc90e('0x27')][_0xc90e('0x29')]);return _0x161a3a(_0x8fb1ef[_0xc90e('0x27')]['message']);}logger[_0xc90e('0x27')](_0xc90e('0x23'),_0x17ec6b,_0x8fb1ef[_0xc90e('0x27')][_0xc90e('0x29')]);return _0x486725(_0x8fb1ef[_0xc90e('0x27')]['message']);}else{logger[_0xc90e('0x2a')](_0xc90e('0x23'),_0x17ec6b,_0xc90e('0x2b'));_0x486725(_0x8fb1ef['result'][_0xc90e('0x29')]);}})[_0xc90e('0x2c')](function(_0x45ac61){logger[_0xc90e('0x27')](_0xc90e('0x23'),_0x17ec6b,_0x45ac61);_0x161a3a(_0x45ac61);});});}function respondWithStatusCode(_0x270040,_0x5ab0af){_0x5ab0af=_0x5ab0af||0xcc;return function(_0x481b4b){if(_0x481b4b){return _0x270040[_0xc90e('0x2d')](_0x5ab0af);}return _0x270040['status'](_0x5ab0af)[_0xc90e('0x2e')]();};}function respondWithResult(_0xae20be,_0x1baedc){_0x1baedc=_0x1baedc||0xc8;return function(_0x404eef){if(_0x404eef){return _0xae20be[_0xc90e('0x2f')](_0x1baedc)[_0xc90e('0x30')](_0x404eef);}};}function respondWithFilteredResult(_0x42b79b,_0x50e0d7){return function(_0x39f6b9){if(_0x39f6b9){var _0xb2df9d=_0x39f6b9[_0xc90e('0x31')],_0x4cbcac=_0x50e0d7[_0xc90e('0x32')],_0x2b6f23=_0x50e0d7[_0xc90e('0x32')]+_0x50e0d7[_0xc90e('0x33')],_0x58b26b;if(_0x2b6f23>=_0xb2df9d){_0x2b6f23=_0xb2df9d;_0x58b26b=0xc8;}else{_0x58b26b=0xce;}_0x42b79b[_0xc90e('0x2f')](_0x58b26b);return _0x42b79b[_0xc90e('0x34')](_0xc90e('0x35'),_0x4cbcac+'-'+_0x2b6f23+'/'+_0xb2df9d)[_0xc90e('0x30')](_0x39f6b9);}return null;};}function patchUpdates(_0x89462e){return function(_0x5bca9e){try{jsonpatch['apply'](_0x5bca9e,_0x89462e,!![]);}catch(_0x24bd29){return BPromise[_0xc90e('0x36')](_0x24bd29);}return _0x5bca9e[_0xc90e('0x37')]();};}function saveUpdates(_0x296bc2,_0x403cfd){return function(_0x314644){if(_0x314644){return _0x314644[_0xc90e('0x38')](_0x296bc2)[_0xc90e('0x22')](function(_0x42b216){return _0x42b216;});}return null;};}function removeEntity(_0x186db4,_0x4fc508){return function(_0x1b3f7a){if(_0x1b3f7a){return _0x1b3f7a[_0xc90e('0x39')]()[_0xc90e('0x22')](function(){_0x186db4[_0xc90e('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bcfe4,_0x587adf){return function(_0x443271){if(!_0x443271){_0x5bcfe4[_0xc90e('0x2d')](0x194);}return _0x443271;};}function handleError(_0x37a8ad,_0x2027f0){_0x2027f0=_0x2027f0||0x1f4;return function(_0x19d37e){logger['error'](_0x19d37e[_0xc90e('0x3a')]);if(_0x19d37e[_0xc90e('0x3b')]){delete _0x19d37e[_0xc90e('0x3b')];}_0x37a8ad[_0xc90e('0x2f')](_0x2027f0)[_0xc90e('0x3c')](_0x19d37e);};}exports[_0xc90e('0x3d')]=function(_0x224732,_0x1a4e39){var _0x22f73d={},_0x2ce110={},_0x39f241={'count':0x0,'rows':[]};var _0x5feb0c=_[_0xc90e('0x3e')](db['MailMessage'][_0xc90e('0x3f')],function(_0xff7f52){return{'name':_0xff7f52['fieldName'],'type':_0xff7f52['type'][_0xc90e('0x40')]};});_0x2ce110['model']=_[_0xc90e('0x3e')](_0x5feb0c,_0xc90e('0x3b'));_0x2ce110['query']=_[_0xc90e('0x41')](_0x224732['query']);_0x2ce110['filters']=_[_0xc90e('0x42')](_0x2ce110['model'],_0x2ce110['query']);_0x22f73d[_0xc90e('0x43')]=_[_0xc90e('0x42')](_0x2ce110['model'],qs[_0xc90e('0x44')](_0x224732[_0xc90e('0x45')][_0xc90e('0x44')]));_0x22f73d[_0xc90e('0x43')]=_0x22f73d[_0xc90e('0x43')][_0xc90e('0x46')]?_0x22f73d[_0xc90e('0x43')]:_0x2ce110[_0xc90e('0x47')];if(!_0x224732['query'][_0xc90e('0x48')]('nolimit')){_0x22f73d['limit']=qs[_0xc90e('0x33')](_0x224732['query'][_0xc90e('0x33')]);_0x22f73d['offset']=qs[_0xc90e('0x32')](_0x224732[_0xc90e('0x45')][_0xc90e('0x32')]);}_0x22f73d[_0xc90e('0x49')]=qs[_0xc90e('0x4a')](_0x224732[_0xc90e('0x45')][_0xc90e('0x4a')]);_0x22f73d[_0xc90e('0x4b')]=qs[_0xc90e('0x4c')](_['pick'](_0x224732[_0xc90e('0x45')],_0x2ce110[_0xc90e('0x4c')]));if(_0x224732[_0xc90e('0x45')][_0xc90e('0x4d')]){_0x22f73d['where']=_[_0xc90e('0x4e')](_0x22f73d[_0xc90e('0x4b')],{'$or':_[_0xc90e('0x3e')](_0x5feb0c,function(_0x48cb44){if(_0x48cb44[_0xc90e('0x4f')]!=='VIRTUAL'){var _0x45f816={};_0x45f816[_0x48cb44['name']]={'$like':'%'+_0x224732[_0xc90e('0x45')]['filter']+'%'};return _0x45f816;}})});}_0x22f73d=_[_0xc90e('0x4e')]({},_0x22f73d,_0x224732[_0xc90e('0x50')]);var _0x3812ed={'where':_0x22f73d[_0xc90e('0x4b')]};return db[_0xc90e('0x51')][_0xc90e('0x31')](_0x3812ed)[_0xc90e('0x22')](function(_0x1d7f6a){_0x39f241['count']=_0x1d7f6a;if(_0x224732[_0xc90e('0x45')][_0xc90e('0x52')]){_0x22f73d['include']=[{'all':!![]}];}return db['MailMessage'][_0xc90e('0x53')](_0x22f73d);})['then'](function(_0xea3599){_0x39f241[_0xc90e('0x54')]=_0xea3599;return _0x39f241;})[_0xc90e('0x22')](respondWithFilteredResult(_0x1a4e39,_0x22f73d))[_0xc90e('0x2c')](handleError(_0x1a4e39,null));};exports[_0xc90e('0x55')]=function(_0x56d274,_0x3a5704){var _0x377c06={'raw':!![],'where':{'id':_0x56d274[_0xc90e('0x56')]['id']}},_0x496b00={};_0x496b00['model']=_[_0xc90e('0x41')](db['MailMessage'][_0xc90e('0x3f')]);_0x496b00[_0xc90e('0x45')]=_[_0xc90e('0x41')](_0x56d274[_0xc90e('0x45')]);_0x496b00[_0xc90e('0x4c')]=_[_0xc90e('0x42')](_0x496b00[_0xc90e('0x47')],_0x496b00[_0xc90e('0x45')]);_0x377c06[_0xc90e('0x43')]=_[_0xc90e('0x42')](_0x496b00[_0xc90e('0x47')],qs[_0xc90e('0x44')](_0x56d274[_0xc90e('0x45')][_0xc90e('0x44')]));_0x377c06[_0xc90e('0x43')]=_0x377c06[_0xc90e('0x43')]['length']?_0x377c06[_0xc90e('0x43')]:_0x496b00[_0xc90e('0x47')];if(_0x56d274[_0xc90e('0x45')][_0xc90e('0x52')]){_0x377c06[_0xc90e('0x57')]=[{'all':!![]}];}_0x377c06=_[_0xc90e('0x4e')]({},_0x377c06,_0x56d274[_0xc90e('0x50')]);return db['MailMessage'][_0xc90e('0x58')](_0x377c06)['then'](handleEntityNotFound(_0x3a5704,null))[_0xc90e('0x22')](respondWithResult(_0x3a5704,null))[_0xc90e('0x2c')](handleError(_0x3a5704,null));};exports[_0xc90e('0x38')]=function(_0x22f0b2,_0x373965){if(_0x22f0b2['body']['id']){delete _0x22f0b2[_0xc90e('0x59')]['id'];}return db[_0xc90e('0x51')]['find']({'where':{'id':_0x22f0b2[_0xc90e('0x56')]['id']}})[_0xc90e('0x22')](handleEntityNotFound(_0x373965,null))[_0xc90e('0x22')](saveUpdates(_0x22f0b2[_0xc90e('0x59')],null))['then'](respondWithResult(_0x373965,null))['catch'](handleError(_0x373965,null));};exports[_0xc90e('0x39')]=function(_0x2b21f8,_0x3f6102){return db[_0xc90e('0x51')][_0xc90e('0x58')]({'where':{'id':_0x2b21f8['params']['id']}})[_0xc90e('0x22')](handleEntityNotFound(_0x3f6102,null))[_0xc90e('0x22')](removeEntity(_0x3f6102,null))['catch'](handleError(_0x3f6102,null));};exports['describe']=function(_0x3aac42,_0x1814c2){return db[_0xc90e('0x51')][_0xc90e('0x5a')]()['then'](respondWithResult(_0x1814c2,null))[_0xc90e('0x2c')](handleError(_0x1814c2,null));};exports[_0xc90e('0x5b')]=function(_0x31fdf8,_0x119d77){return db[_0xc90e('0x51')][_0xc90e('0x5b')](_0x31fdf8[_0xc90e('0x59')])[_0xc90e('0x22')](function(_0x57db5e){if(_0x57db5e){if(_0x57db5e[_0xc90e('0x5c')]===_0xc90e('0x5d')&&!_0x57db5e[_0xc90e('0x5e')]){var _0x23b547,_0x180ce1,_0x47fc0d;if(_0x31fdf8[_0xc90e('0x59')]['to']){_0x180ce1=_0x31fdf8[_0xc90e('0x59')]['to'][_0xc90e('0x5f')](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0x57db5e[_0xc90e('0x60')]},'include':[{'model':db['CmList'],'as':_0xc90e('0x61'),'include':[{'model':db['CmContact'],'as':_0xc90e('0x62'),'where':{'email':_0x180ce1},'limit':0x1,'order':[[_0xc90e('0x63'),_0xc90e('0x64')]]}]},{'model':db[_0xc90e('0x65')],'as':_0xc90e('0x66'),'raw':!![]}]})[_0xc90e('0x22')](function(_0xb44c95){_0x23b547=_0xb44c95;if(_0x23b547&&_0x23b547[_0xc90e('0x66')]){var _0x2f2bcb={'tls':{'rejectUnauthorized':![]}};if(_[_0xc90e('0x67')](_0x23b547[_0xc90e('0x66')][_0xc90e('0x68')])){_0x2f2bcb['host']=_0x23b547[_0xc90e('0x66')]['host'];_0x2f2bcb['port']=_0x23b547['Smtp']['port'];_0x2f2bcb[_0xc90e('0x69')]=_0x23b547[_0xc90e('0x66')]['secure'];if(_0x23b547[_0xc90e('0x66')][_0xc90e('0x6a')]){_0x2f2bcb[_0xc90e('0x6b')]={'user':_0x23b547[_0xc90e('0x66')][_0xc90e('0x6c')],'pass':_0x23b547[_0xc90e('0x66')]['pass']};}}else{_0x2f2bcb[_0xc90e('0x68')]=_0x23b547[_0xc90e('0x66')][_0xc90e('0x68')];_0x2f2bcb[_0xc90e('0x6b')]={'user':_0x23b547[_0xc90e('0x66')][_0xc90e('0x6c')],'pass':_0x23b547['Smtp'][_0xc90e('0x6d')]};_0x2f2bcb['secure']=_0x23b547[_0xc90e('0x66')]['secure'];}if(_0x31fdf8['body'][_0xc90e('0x6e')]&&_0x31fdf8[_0xc90e('0x59')]['attachments'][_0xc90e('0x46')]){for(var _0x59765e=0x0;_0x59765e<_0x31fdf8['body']['attachments']['length'];_0x59765e+=0x1){_0x31fdf8[_0xc90e('0x59')][_0xc90e('0x6e')][_0x59765e]={'filename':_0x31fdf8['body'][_0xc90e('0x6e')][_0x59765e][_0xc90e('0x3b')],'path':path[_0xc90e('0x6f')](config[_0xc90e('0x70')],_0xc90e('0x71'),_0x31fdf8[_0xc90e('0x59')][_0xc90e('0x6e')][_0x59765e]['basename'])};}}_0x47fc0d={'account':_0x2f2bcb,'message':_0x31fdf8[_0xc90e('0x59')]};return;}})[_0xc90e('0x22')](function(){if(_0x23b547['List']){if(_0x23b547['List'][_0xc90e('0x62')]['length']){return _0x23b547['List'][_0xc90e('0x62')][0x0];}else{return db[_0xc90e('0x72')][_0xc90e('0x5b')](_[_0xc90e('0x17')](_0x31fdf8[_0xc90e('0x59')],{'firstName':_0x31fdf8[_0xc90e('0x59')]['to'],'email':_0x31fdf8[_0xc90e('0x59')]['to'],'phone':_0x31fdf8['body']['to'],'ListId':_0x23b547[_0xc90e('0x73')]}));}}else{throw new Error(_0xc90e('0x74'));}})['then'](function(){if(_0x47fc0d){return respondWithRpcPromise(_0xc90e('0x75'),_0xc90e('0x76'),_0x47fc0d,client9003)[_0xc90e('0x22')](function(_0x5840e9){return _0x57db5e['update']({'read':!![],'messageId':_0x5840e9[_0xc90e('0x77')],'sentAt':moment()['format'](_0xc90e('0x78'))});})[_0xc90e('0x2c')](function(_0x1c1cd6){logger[_0xc90e('0x27')]('%s',JSON['stringify'](_0x1c1cd6));return _0x57db5e;});}return _0x57db5e;});}return _0x57db5e;}})[_0xc90e('0x22')](respondWithResult(_0x119d77,0xc9))[_0xc90e('0x2c')](handleError(_0x119d77,null));};var interaction_log=require(_0xc90e('0x79'))(_0xc90e('0x7a'));exports['accept']=function(_0x12a7cd,_0x59ffa8,_0x41a031){var _0xfa8ced={'channel':_0xc90e('0x7b')};if(_0x12a7cd[_0xc90e('0x59')]['id']){delete _0x12a7cd[_0xc90e('0x59')]['id'];}_0x12a7cd['body'][_0xc90e('0x7c')]=!![];_0x12a7cd[_0xc90e('0x59')]['readAt']=moment()[_0xc90e('0x7d')](_0xc90e('0x78'));_0x12a7cd[_0xc90e('0x59')][_0xc90e('0x7e')]=_0x12a7cd[_0xc90e('0x59')][_0xc90e('0x7e')]||_0x12a7cd['user']['id'];return db['MailMessage'][_0xc90e('0x58')]({'where':{'id':_0x12a7cd[_0xc90e('0x56')]['id'],'UserId':null},'include':[{'model':db[_0xc90e('0x72')],'as':_0xc90e('0x7f')}]})['then'](handleEntityNotFound(_0x59ffa8,null))[_0xc90e('0x22')](saveUpdates(_0x12a7cd['body'],null))['then'](function(_0x22483e){if(_0x22483e){_0xfa8ced[_0xc90e('0x29')]=_0x22483e[_0xc90e('0x80')]({'plain':!![]});return db['MailInteraction'][_0xc90e('0x58')]({'where':{'id':_0x22483e[_0xc90e('0x81')]}});}return null;})[_0xc90e('0x22')](handleEntityNotFound(_0x59ffa8,null))[_0xc90e('0x22')](function(_0x2ff368){if(_0x2ff368){return _0x2ff368['update']({'UserId':_0x12a7cd[_0xc90e('0x59')][_0xc90e('0x7e')],'read1stAt':_[_0xc90e('0x67')](_0x2ff368[_0xc90e('0x82')])?moment()[_0xc90e('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xc90e('0x22')](function(_0x2da854){if(_0x2da854){_0xfa8ced[_0xc90e('0x83')]=_0x2da854[_0xc90e('0x80')]({'plain':!![]});interaction_log['info'](_0xc90e('0x84'),_0x12a7cd[_0xc90e('0x6c')]['id'],_0x12a7cd[_0xc90e('0x6c')][_0xc90e('0x3b')],_0x12a7cd['user'][_0xc90e('0x85')],_0xfa8ced[_0xc90e('0x83')]['id'],_0x12a7cd[_0xc90e('0x59')]?JSON[_0xc90e('0x26')](_0x12a7cd['body']):_0xc90e('0x86'));return respondWithRpcPromise('AcceptMessage',_0xc90e('0x87'),_0xfa8ced);}return null;})[_0xc90e('0x22')](function(_0x58f17d){if(_0x58f17d){if(_0x12a7cd[_0xc90e('0x59')][_0xc90e('0x88')]){_0xfa8ced[_0xc90e('0x29')][_0xc90e('0x89')]=util[_0xc90e('0x7d')](_0xc90e('0x8a'),_0x12a7cd[_0xc90e('0x6c')][_0xc90e('0x3b')]);_0xfa8ced[_0xc90e('0x29')][_0xc90e('0x8b')]=_0xfa8ced[_0xc90e('0x8b')];_0xfa8ced[_0xc90e('0x29')][_0xc90e('0x8c')]=_0xc90e('0x8d');return respondWithRpcPromise(_0xc90e('0x8e'),_0xc90e('0x8e'),{'event':_0xc90e('0x8f'),'message':_0xfa8ced['message']},client9002)[_0xc90e('0x22')](function(){return _0xfa8ced;});}return _0xfa8ced;}return null;})[_0xc90e('0x22')](respondWithResult(_0x59ffa8,null))['catch'](handleError(_0x59ffa8,null));};var interaction_log=require('../../config/logger')(_0xc90e('0x7a'));exports[_0xc90e('0x36')]=function(_0x4bc529,_0x5743ec,_0x49bee2){var _0x585fe0={'agent':{},'channel':'mail'};if(_0x4bc529[_0xc90e('0x59')]['id']){delete _0x4bc529['body']['id'];}_0x4bc529[_0xc90e('0x59')][_0xc90e('0x7e')]=_0x4bc529[_0xc90e('0x59')]['UserId']||_0x4bc529['user']['id'];_0x585fe0[_0xc90e('0x90')]['id']=_0x4bc529[_0xc90e('0x59')][_0xc90e('0x7e')];return db[_0xc90e('0x51')][_0xc90e('0x58')]({'where':{'id':_0x4bc529['params']['id'],'UserId':null}})[_0xc90e('0x22')](handleEntityNotFound(_0x5743ec,null))[_0xc90e('0x22')](function(_0x3810fe){if(_0x3810fe){_0x585fe0['message']=_0x3810fe[_0xc90e('0x80')]({'plain':!![]});return db[_0xc90e('0x91')][_0xc90e('0x58')]({'where':{'id':_0x3810fe['MailInteractionId']}});}return null;})[_0xc90e('0x22')](handleEntityNotFound(_0x5743ec,null))['then'](function(_0x599796){if(_0x599796){_0x585fe0[_0xc90e('0x83')]=_0x599796[_0xc90e('0x80')]({'plain':!![]});interaction_log[_0xc90e('0x2a')](_0xc90e('0x92'),_0x4bc529[_0xc90e('0x6c')]['id'],_0x4bc529[_0xc90e('0x6c')][_0xc90e('0x3b')],_0x4bc529[_0xc90e('0x6c')][_0xc90e('0x85')],_0x585fe0[_0xc90e('0x83')]['id'],_0x4bc529[_0xc90e('0x59')]?JSON['stringify'](_0x4bc529[_0xc90e('0x59')]):'null');return respondWithRpcPromise(_0xc90e('0x93'),_0xc90e('0x94'),_0x585fe0);}return null;})[_0xc90e('0x22')](function(_0x55946b){if(_0x55946b){_0x55946b[_0xc90e('0x29')][_0xc90e('0x89')]=util[_0xc90e('0x7d')](_0xc90e('0x8a'),_0x4bc529[_0xc90e('0x6c')][_0xc90e('0x3b')]);_0x55946b[_0xc90e('0x29')][_0xc90e('0x8b')]=_0x585fe0[_0xc90e('0x8b')];_0x55946b[_0xc90e('0x29')][_0xc90e('0x8c')]='reject';respondWithRpcPromise(_0xc90e('0x8e'),_0xc90e('0x8e'),{'event':_0xc90e('0x95'),'message':_0x55946b[_0xc90e('0x29')]},client9002);return _0x585fe0;}return null;})[_0xc90e('0x22')](respondWithResult(_0x5743ec,null))[_0xc90e('0x2c')](handleError(_0x5743ec,null));};exports[_0xc90e('0x96')]=function(_0x393231,_0x3fcfa7){var _0x1d10eb=moment()['unix']()[_0xc90e('0x97')]();var _0x2b0e01=path['join'](config[_0xc90e('0x70')],_0xc90e('0x98'),_0xc90e('0x99'),_0xc90e('0x9a'));var _0x3dfc0a=path[_0xc90e('0x6f')](config['root'],_0xc90e('0x98'),_0xc90e('0x99'),_0xc90e('0x6e'));var _0x1ad48f=util[_0xc90e('0x7d')](_0xc90e('0x9b'),_0x1d10eb);return db['MailMessage'][_0xc90e('0x58')]({'where':{'id':_0x393231[_0xc90e('0x56')]['id']},'attributes':['id',_0xc90e('0x59'),_0xc90e('0x9c'),'to','cc',_0xc90e('0x9d'),_0xc90e('0x9e'),_0xc90e('0x9f')],'include':_0x393231['query']['attachments']?[{'model':db['Attachment'],'as':_0xc90e('0xa0')}]:undefined})[_0xc90e('0x22')](handleEntityNotFound(_0x3fcfa7,null))[_0xc90e('0x22')](function(_0x5f0ae5){if(_0x5f0ae5){var _0x52f3df=_0x5f0ae5;var _0x2b8517={'from':_0x52f3df[_0xc90e('0x9c')],'to':_0x52f3df['to'],'subject':_0x52f3df[_0xc90e('0x9e')],'html':_0x52f3df[_0xc90e('0x59')],'headers':{'Date':moment(_0x52f3df[_0xc90e('0x9f')])['format'](_0xc90e('0xa1'))},'attachments':[]};if(_0x5f0ae5['cc']){_0x2b8517[_0xc90e('0xa2')]['Cc']=_0x5f0ae5['cc'];}if(_0x5f0ae5['bcc']){_0x2b8517[_0xc90e('0xa2')][_0xc90e('0xa3')]=_0x5f0ae5[_0xc90e('0x9d')];}return new BPromise(function(_0x1adad7,_0x48922d){if(_0x5f0ae5[_0xc90e('0xa0')]){for(var _0x536a17=0x0;_0x536a17<_0x5f0ae5[_0xc90e('0xa0')][_0xc90e('0x46')];_0x536a17++){var _0x534565=_0x5f0ae5[_0xc90e('0xa0')][_0x536a17];var _0x5cf738=path['join'](_0x3dfc0a,_0x534565[_0xc90e('0xa4')]);if(fs[_0xc90e('0xa5')](_0x5cf738)){_0x2b8517[_0xc90e('0x6e')][_0xc90e('0xa6')]({'name':_0x534565[_0xc90e('0x3b')],'contentType':_0x534565[_0xc90e('0x4f')],'data':fs[_0xc90e('0xa7')](_0x5cf738)});}}}emlformat[_0xc90e('0xa8')](_0x2b8517,function(_0x286448,_0x2d3d31){if(_0x286448)return _0x48922d(_0x286448);fs['writeFileSync'](path[_0xc90e('0x6f')](_0x2b0e01,_0x1ad48f),_0x2d3d31);return _0x1adad7(_0x2d3d31);});});}})[_0xc90e('0x22')](function(_0x1a2ad1){if(_0x1a2ad1){return _0x3fcfa7['download'](path[_0xc90e('0x6f')](_0x2b0e01,_0x1ad48f),_0x1ad48f,function(_0x3fa02c){if(_0x3fa02c){console['log']('err',_0x3fa02c);}else{fs[_0xc90e('0xa9')](path[_0xc90e('0x6f')](_0x2b0e01,_0x1ad48f));}});}})[_0xc90e('0x2c')](handleError(_0x3fcfa7,null));}; \ No newline at end of file +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 diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 60347db..e6aa4dc 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 _0x3eee=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x4854d6,_0x2f1264){var _0x3885c0=function(_0x4d564d){while(--_0x4d564d){_0x4854d6['push'](_0x4854d6['shift']());}};_0x3885c0(++_0x2f1264);}(_0x3eee,0x13e));var _0xe3ee=function(_0x3ff90a,_0x28b3ee){_0x3ff90a=_0x3ff90a-0x0;var _0x250545=_0x3eee[_0x3ff90a];return _0x250545;};'use strict';var EventEmitter=require(_0xe3ee('0x0'));var MailMessage=require(_0xe3ee('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xe3ee('0x2')](0x0);var events={'afterCreate':_0xe3ee('0x3'),'afterUpdate':_0xe3ee('0x4'),'afterDestroy':'remove'};function emitEvent(_0x428e84){return function(_0x302382,_0x119132,_0x490b4e){MailMessageEvents[_0xe3ee('0x5')](_0x428e84+':'+_0x302382['id'],_0x302382);MailMessageEvents[_0xe3ee('0x5')](_0x428e84,_0x302382);_0x490b4e(null);};}for(var e in events){if(events[_0xe3ee('0x6')](e)){var event=events[e];MailMessage[_0xe3ee('0x7')](e,emitEvent(event));}}module[_0xe3ee('0x8')]=MailMessageEvents; \ No newline at end of file +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 diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index c321165..e8bb773 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 _0x8a53=['rimraf','exports','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','fromString','body','models','get','direction','toLowerCase','out','secret','MailInteraction','then','update','catch','error','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path'];(function(_0x41382c,_0xc3ffd1){var _0x4da35b=function(_0x5d56b8){while(--_0x5d56b8){_0x41382c['push'](_0x41382c['shift']());}};_0x4da35b(++_0xc3ffd1);}(_0x8a53,0xd0));var _0x38a5=function(_0x3a19b5,_0xb2d070){_0x3a19b5=_0x3a19b5-0x0;var _0x3618b4=_0x8a53[_0x3a19b5];return _0x3618b4;};'use strict';var _=require(_0x38a5('0x0'));var util=require(_0x38a5('0x1'));var logger=require(_0x38a5('0x2'))(_0x38a5('0x3'));var moment=require(_0x38a5('0x4'));var BPromise=require(_0x38a5('0x5'));var rp=require(_0x38a5('0x6'));var htmlToText=require(_0x38a5('0x7'));var fs=require('fs');var path=require(_0x38a5('0x8'));var rimraf=require(_0x38a5('0x9'));var config=require('../../config/environment');var attributes=require('./mailMessage.attributes');module[_0x38a5('0xa')]=function(_0x34fbaf,_0x3444fa){return _0x34fbaf['define'](_0x38a5('0xb'),attributes,{'tableName':_0x38a5('0xc'),'paranoid':![],'indexes':[{'name':_0x38a5('0xd'),'fields':[_0x38a5('0xd')]},{'name':_0x38a5('0xe'),'fields':[_0x38a5('0xf'),_0x38a5('0x10')],'type':_0x38a5('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4fb2ad,_0x2057c1,_0x2934f3){if(_0x4fb2ad['body']){_0x4fb2ad[_0x38a5('0xf')]=htmlToText[_0x38a5('0x12')](_0x4fb2ad[_0x38a5('0x13')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2934f3(null,_0x2057c1);},'afterCreate':function(_0x5e2f3f,_0x10986c,_0x2bd088){var _0x391251=_0x34fbaf[_0x38a5('0x14')];var _0x13d083=_0x5e2f3f[_0x38a5('0x15')]({'plain':!![]});if(_0x13d083[_0x38a5('0x16')][_0x38a5('0x17')]()==='in'||_0x13d083[_0x38a5('0x16')]['toLowerCase']()===_0x38a5('0x18')&&!_0x13d083[_0x38a5('0x19')]&&!_['isNil'](_0x13d083['UserId'])){_0x391251[_0x38a5('0x1a')]['findOne']({'where':{'id':_0x13d083['MailInteractionId']}})[_0x38a5('0x1b')](function(_0x3cb7e0){if(_0x3cb7e0){_0x3cb7e0[_0x38a5('0x1c')]({'lastMsgAt':_0x13d083['createdAt'],'lastMsgDirection':_0x13d083['direction'][_0x38a5('0x17')](),'lastMsgBody':_0x13d083[_0x38a5('0x13')]});}})[_0x38a5('0x1d')](function(_0x40a87e){console[_0x38a5('0x1e')](_0x40a87e);});}_0x2bd088();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +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 diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 15ef5b4..f2ce339 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 _0x553a=['request\x20sent','debug','stringify','error','message','info','catch','MailMessage','create','options','raw','CreateMailMessage','util','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','redis','defaults','socket.io-emitter','./mailMessage.socket','register','request','then','MailMessage,\x20%s,\x20%s'];(function(_0x37c99c,_0x1b01bd){var _0x1806f5=function(_0x547710){while(--_0x547710){_0x37c99c['push'](_0x37c99c['shift']());}};_0x1806f5(++_0x1b01bd);}(_0x553a,0x192));var _0xa553=function(_0x14d250,_0x4b2e12){_0x14d250=_0x14d250-0x0;var _0xb991d8=_0x553a[_0x14d250];return _0xb991d8;};'use strict';var _=require('lodash');var util=require(_0xa553('0x0'));var moment=require('moment');var BPromise=require(_0xa553('0x1'));var rs=require(_0xa553('0x2'));var fs=require('fs');var Redis=require(_0xa553('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa553('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa553('0x5'));var client=jayson['client']['http']({'port':0x232a});config[_0xa553('0x6')]=_[_0xa553('0x7')](config[_0xa553('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0xa553('0x8'))(new Redis(config['redis']));require(_0xa553('0x9'))[_0xa553('0xa')](socket);function respondWithRpcPromise(_0x368216,_0x4b3546,_0x5ad48b){return new BPromise(function(_0xc275e6,_0x58c170){return client[_0xa553('0xb')](_0x368216,_0x5ad48b)[_0xa553('0xc')](function(_0x137813){logger['info'](_0xa553('0xd'),_0x4b3546,_0xa553('0xe'));logger[_0xa553('0xf')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x4b3546,_0xa553('0xe'),JSON[_0xa553('0x10')](_0x137813));if(_0x137813[_0xa553('0x11')]){if(_0x137813['error']['code']===0x1f4){logger[_0xa553('0x11')](_0xa553('0xd'),_0x4b3546,_0x137813[_0xa553('0x11')][_0xa553('0x12')]);return _0x58c170(_0x137813['error'][_0xa553('0x12')]);}logger['error'](_0xa553('0xd'),_0x4b3546,_0x137813['error']['message']);return _0xc275e6(_0x137813[_0xa553('0x11')]['message']);}else{logger[_0xa553('0x13')](_0xa553('0xd'),_0x4b3546,_0xa553('0xe'));_0xc275e6(_0x137813['result'][_0xa553('0x12')]);}})[_0xa553('0x14')](function(_0x4fd13a){logger[_0xa553('0x11')](_0xa553('0xd'),_0x4b3546,_0x4fd13a);_0x58c170(_0x4fd13a);});});}exports['CreateMailMessage']=function(_0x1b83cb){var _0x52624d=this;return new Promise(function(_0x309eb7,_0x18af22){return db[_0xa553('0x15')][_0xa553('0x16')](_0x1b83cb['body'],{'raw':_0x1b83cb[_0xa553('0x17')]?_0x1b83cb[_0xa553('0x17')][_0xa553('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x17b058){logger['info']('CreateMailMessage',_0x1b83cb);logger[_0xa553('0xf')](_0xa553('0x19'),_0x1b83cb,JSON['stringify'](_0x17b058));_0x309eb7(_0x17b058);})[_0xa553('0x14')](function(_0x1c95bd){logger[_0xa553('0x11')]('CreateMailMessage',_0x1c95bd[_0xa553('0x12')],_0x1b83cb);_0x18af22(_0x52624d[_0xa553('0x11')](0x1f4,_0x1c95bd[_0xa553('0x12')]));});});}; \ No newline at end of file +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 diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index d058f5b..234b60e 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 _0xc57c=['emit','removeListener','length','./mailMessage.events','remove','update'];(function(_0x2264bc,_0x262c1d){var _0x487cf5=function(_0x3021d3){while(--_0x3021d3){_0x2264bc['push'](_0x2264bc['shift']());}};_0x487cf5(++_0x262c1d);}(_0xc57c,0x9f));var _0xcc57=function(_0x53def8,_0x325ccb){_0x53def8=_0x53def8-0x0;var _0x497baa=_0xc57c[_0x53def8];return _0x497baa;};'use strict';var MailMessageEvents=require(_0xcc57('0x0'));var events=['save',_0xcc57('0x1'),_0xcc57('0x2')];function createListener(_0x3922e7,_0x35a33c){return function(_0x282b8d){_0x35a33c[_0xcc57('0x3')](_0x3922e7,_0x282b8d);};}function removeListener(_0x10b827,_0x217b01){return function(){MailMessageEvents[_0xcc57('0x4')](_0x10b827,_0x217b01);};}exports['register']=function(_0x1d77dd){for(var _0x243766=0x0,_0x49138a=events[_0xcc57('0x5')];_0x243766<_0x49138a;_0x243766++){var _0x2fd77f=events[_0x243766];var _0xba17a5=createListener('mailMessage:'+_0x2fd77f,_0x1d77dd);MailMessageEvents['on'](_0x2fd77f,_0xba17a5);}}; \ No newline at end of file +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 diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 27da3f5..6185387 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 _0x77a7=['getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','/:id','removeTeams','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','isAuthenticated','index','get','/describe','describe','show','/:id/members'];(function(_0x383356,_0x33d2f5){var _0x32ee5a=function(_0x2741db){while(--_0x2741db){_0x383356['push'](_0x383356['shift']());}};_0x32ee5a(++_0x33d2f5);}(_0x77a7,0xaf));var _0x777a=function(_0x2e1daa,_0x2b5d5b){_0x2e1daa=_0x2e1daa-0x0;var _0x5ae5f9=_0x77a7[_0x2e1daa];return _0x5ae5f9;};'use strict';var multer=require(_0x777a('0x0'));var util=require(_0x777a('0x1'));var path=require(_0x777a('0x2'));var timeout=require(_0x777a('0x3'));var express=require(_0x777a('0x4'));var router=express[_0x777a('0x5')]();var auth=require(_0x777a('0x6'));var interaction=require(_0x777a('0x7'));var config=require(_0x777a('0x8'));var controller=require(_0x777a('0x9'));router['get']('/',auth[_0x777a('0xa')](),controller[_0x777a('0xb')]);router[_0x777a('0xc')](_0x777a('0xd'),auth[_0x777a('0xa')](),controller[_0x777a('0xe')]);router[_0x777a('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x777a('0xf')]);router[_0x777a('0xc')](_0x777a('0x10'),auth['isAuthenticated'](),controller[_0x777a('0x11')]);router['get'](_0x777a('0x12'),auth[_0x777a('0xa')](),controller[_0x777a('0x13')]);router[_0x777a('0xc')](_0x777a('0x14'),auth[_0x777a('0xa')](),controller[_0x777a('0x15')]);router[_0x777a('0x16')]('/',auth[_0x777a('0xa')](),controller[_0x777a('0x17')]);router[_0x777a('0x16')](_0x777a('0x12'),auth[_0x777a('0xa')](),controller[_0x777a('0x18')]);router[_0x777a('0x16')](_0x777a('0x14'),auth[_0x777a('0xa')](),controller[_0x777a('0x19')]);router[_0x777a('0x1a')]('/:id',auth[_0x777a('0xa')](),controller[_0x777a('0x1b')]);router[_0x777a('0x1c')](_0x777a('0x1d'),auth[_0x777a('0xa')](),controller['destroy']);router[_0x777a('0x1c')](_0x777a('0x12'),auth[_0x777a('0xa')](),controller[_0x777a('0x1e')]);router[_0x777a('0x1c')]('/:id/users',auth[_0x777a('0xa')](),controller['removeAgents']);module[_0x777a('0x1f')]=router; \ No newline at end of file +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 diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 88997d8..5de8fbb 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 _0x0d91=['STRING','name','INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x0d91,0x76));var _0x10d9=function(_0x5df445,_0x3d96e2){_0x5df445=_0x5df445-0x0;var _0x4f76b5=_0x0d91[_0x5df445];return _0x4f76b5;};'use strict';var Sequelize=require(_0x10d9('0x0'));module[_0x10d9('0x1')]={'name':{'type':Sequelize[_0x10d9('0x2')],'unique':_0x10d9('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x10d9('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x10d9('0x5')](_0x10d9('0x6'),'beepall',_0x10d9('0x7'))}}; \ No newline at end of file +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 diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 65fc95b..9330fbe 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 _0x04ad=['pick','filter','VIRTUAL','merge','options','includeAll','include','catch','params','find','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserMailQueue','MailQueueId','findAll','User','findAndCountAll','agent','mailPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userMailQueue:save','select','field','from','team_has_mail_queues','join','user_has_teams','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','compact','transaction','removeTeams','isEmpty','removeAgents','addAgents','spread','isArray','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','get','MailQueues','sendStatus','error','stack','name','index','map','MailQueue','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x44a4ca,_0x1ef0ea){var _0x2f51e7=function(_0x2d056e){while(--_0x2d056e){_0x44a4ca['push'](_0x44a4ca['shift']());}};_0x2f51e7(++_0x1ef0ea);}(_0x04ad,0x169));var _0xd04a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x04ad[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0xd04a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd04a('0x1'));var zipdir=require(_0xd04a('0x2'));var jsonpatch=require(_0xd04a('0x3'));var rp=require(_0xd04a('0x4'));var moment=require(_0xd04a('0x5'));var BPromise=require(_0xd04a('0x6'));var Mustache=require('mustache');var util=require(_0xd04a('0x7'));var path=require('path');var sox=require(_0xd04a('0x8'));var csv=require(_0xd04a('0x9'));var ejs=require(_0xd04a('0xa'));var fs=require('fs');var _=require(_0xd04a('0xb'));var squel=require(_0xd04a('0xc'));var crypto=require(_0xd04a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd04a('0xe'));var toCsv=require(_0xd04a('0x9'));var querystring=require(_0xd04a('0xf'));var Papa=require(_0xd04a('0x10'));var Redis=require(_0xd04a('0x11'));var authService=require(_0xd04a('0x12'));var qs=require(_0xd04a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd04a('0x14'));var logger=require(_0xd04a('0x15'))('api');var utils=require(_0xd04a('0x16'));var config=require(_0xd04a('0x17'));var db=require(_0xd04a('0x18'))['db'];config['redis']=_[_0xd04a('0x19')](config[_0xd04a('0x1a')],{'host':_0xd04a('0x1b'),'port':0x18eb});var socket=require(_0xd04a('0x1c'))(new Redis(config[_0xd04a('0x1a')]));require(_0xd04a('0x1d'))['register'](socket);function respondWithStatusCode(_0x5a9476,_0xfbc833){_0xfbc833=_0xfbc833||0xcc;return function(_0x408a1d){if(_0x408a1d){return _0x5a9476['sendStatus'](_0xfbc833);}return _0x5a9476[_0xd04a('0x1e')](_0xfbc833)[_0xd04a('0x1f')]();};}function respondWithResult(_0x429e7c,_0x51c73b){_0x51c73b=_0x51c73b||0xc8;return function(_0x78e0d4){if(_0x78e0d4){return _0x429e7c[_0xd04a('0x1e')](_0x51c73b)[_0xd04a('0x20')](_0x78e0d4);}};}function respondWithFilteredResult(_0x214ef6,_0x4710bf){return function(_0x203ff0){if(_0x203ff0){var _0x1c3a1b=_0x203ff0[_0xd04a('0x21')],_0x2be95c=_0x4710bf[_0xd04a('0x22')],_0x4e7b8f=_0x4710bf['offset']+_0x4710bf[_0xd04a('0x23')],_0x3826b6;if(_0x4e7b8f>=_0x1c3a1b){_0x4e7b8f=_0x1c3a1b;_0x3826b6=0xc8;}else{_0x3826b6=0xce;}_0x214ef6[_0xd04a('0x1e')](_0x3826b6);return _0x214ef6[_0xd04a('0x24')](_0xd04a('0x25'),_0x2be95c+'-'+_0x4e7b8f+'/'+_0x1c3a1b)['json'](_0x203ff0);}return null;};}function patchUpdates(_0x611ab3){return function(_0x12d7d4){try{jsonpatch['apply'](_0x12d7d4,_0x611ab3,!![]);}catch(_0xcb193d){return BPromise[_0xd04a('0x26')](_0xcb193d);}return _0x12d7d4[_0xd04a('0x27')]();};}function saveUpdates(_0x163dc2,_0x3753b4){return function(_0x100aa5){if(_0x100aa5){return _0x100aa5[_0xd04a('0x28')](_0x163dc2)['then'](function(_0xdcaef1){return _0xdcaef1;});}return null;};}function removeEntity(_0x48ac17,_0x5949d0){return function(_0x1929bd){if(_0x1929bd){return _0x1929bd[_0xd04a('0x29')]()[_0xd04a('0x2a')](function(){var _0x546360=_0x1929bd[_0xd04a('0x2b')]({'plain':!![]});var _0x40850f=_0xd04a('0x2c');return db['UserProfileResource'][_0xd04a('0x29')]({'where':{'type':_0x40850f,'resourceId':_0x546360['id']}})[_0xd04a('0x2a')](function(){return _0x1929bd;});})[_0xd04a('0x2a')](function(){_0x48ac17[_0xd04a('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x592701,_0x294c98){return function(_0x434cc6){if(!_0x434cc6){_0x592701[_0xd04a('0x2d')](0x194);}return _0x434cc6;};}function handleError(_0xf4bc7a,_0x59130d){_0x59130d=_0x59130d||0x1f4;return function(_0x3dff03){logger[_0xd04a('0x2e')](_0x3dff03[_0xd04a('0x2f')]);if(_0x3dff03[_0xd04a('0x30')]){delete _0x3dff03[_0xd04a('0x30')];}_0xf4bc7a[_0xd04a('0x1e')](_0x59130d)['send'](_0x3dff03);};}exports[_0xd04a('0x31')]=function(_0x1191ce,_0x21caa5){var _0x3d92e6={},_0x280aec={},_0x20973b={'count':0x0,'rows':[]};var _0x56beb6=_[_0xd04a('0x32')](db[_0xd04a('0x33')][_0xd04a('0x34')],function(_0x21d664){return{'name':_0x21d664['fieldName'],'type':_0x21d664[_0xd04a('0x35')][_0xd04a('0x36')]};});_0x280aec[_0xd04a('0x37')]=_['map'](_0x56beb6,_0xd04a('0x30'));_0x280aec['query']=_[_0xd04a('0x38')](_0x1191ce[_0xd04a('0x39')]);_0x280aec[_0xd04a('0x3a')]=_['intersection'](_0x280aec['model'],_0x280aec[_0xd04a('0x39')]);_0x3d92e6[_0xd04a('0x3b')]=_[_0xd04a('0x3c')](_0x280aec[_0xd04a('0x37')],qs[_0xd04a('0x3d')](_0x1191ce['query'][_0xd04a('0x3d')]));_0x3d92e6[_0xd04a('0x3b')]=_0x3d92e6[_0xd04a('0x3b')][_0xd04a('0x3e')]?_0x3d92e6['attributes']:_0x280aec[_0xd04a('0x37')];if(!_0x1191ce[_0xd04a('0x39')][_0xd04a('0x3f')](_0xd04a('0x40'))){_0x3d92e6[_0xd04a('0x23')]=qs[_0xd04a('0x23')](_0x1191ce[_0xd04a('0x39')][_0xd04a('0x23')]);_0x3d92e6[_0xd04a('0x22')]=qs[_0xd04a('0x22')](_0x1191ce[_0xd04a('0x39')]['offset']);}_0x3d92e6[_0xd04a('0x41')]=qs[_0xd04a('0x42')](_0x1191ce['query']['sort']);_0x3d92e6[_0xd04a('0x43')]=qs[_0xd04a('0x3a')](_[_0xd04a('0x44')](_0x1191ce[_0xd04a('0x39')],_0x280aec['filters']));if(_0x1191ce['query'][_0xd04a('0x45')]){_0x3d92e6[_0xd04a('0x43')]=_['merge'](_0x3d92e6['where'],{'$or':_[_0xd04a('0x32')](_0x56beb6,function(_0x24804f){if(_0x24804f[_0xd04a('0x35')]!==_0xd04a('0x46')){var _0x88ae93={};_0x88ae93[_0x24804f[_0xd04a('0x30')]]={'$like':'%'+_0x1191ce['query'][_0xd04a('0x45')]+'%'};return _0x88ae93;}})});}_0x3d92e6=_[_0xd04a('0x47')]({},_0x3d92e6,_0x1191ce[_0xd04a('0x48')]);var _0x127a5e={'where':_0x3d92e6[_0xd04a('0x43')]};return db[_0xd04a('0x33')][_0xd04a('0x21')](_0x127a5e)['then'](function(_0x12e2df){_0x20973b[_0xd04a('0x21')]=_0x12e2df;if(_0x1191ce[_0xd04a('0x39')][_0xd04a('0x49')]){_0x3d92e6[_0xd04a('0x4a')]=[{'all':!![]}];}return db['MailQueue']['findAll'](_0x3d92e6);})[_0xd04a('0x2a')](function(_0x45a04e){_0x20973b['rows']=_0x45a04e;return _0x20973b;})[_0xd04a('0x2a')](respondWithFilteredResult(_0x21caa5,_0x3d92e6))[_0xd04a('0x4b')](handleError(_0x21caa5,null));};exports['show']=function(_0x58a182,_0x545c41){var _0x53c97b={'raw':!![],'where':{'id':_0x58a182[_0xd04a('0x4c')]['id']}},_0x2e6c60={};_0x2e6c60[_0xd04a('0x37')]=_[_0xd04a('0x38')](db[_0xd04a('0x33')][_0xd04a('0x34')]);_0x2e6c60[_0xd04a('0x39')]=_[_0xd04a('0x38')](_0x58a182[_0xd04a('0x39')]);_0x2e6c60[_0xd04a('0x3a')]=_['intersection'](_0x2e6c60[_0xd04a('0x37')],_0x2e6c60[_0xd04a('0x39')]);_0x53c97b[_0xd04a('0x3b')]=_[_0xd04a('0x3c')](_0x2e6c60['model'],qs[_0xd04a('0x3d')](_0x58a182['query'][_0xd04a('0x3d')]));_0x53c97b[_0xd04a('0x3b')]=_0x53c97b[_0xd04a('0x3b')]['length']?_0x53c97b[_0xd04a('0x3b')]:_0x2e6c60[_0xd04a('0x37')];if(_0x58a182['query']['includeAll']){_0x53c97b[_0xd04a('0x4a')]=[{'all':!![]}];}_0x53c97b=_[_0xd04a('0x47')]({},_0x53c97b,_0x58a182[_0xd04a('0x48')]);return db[_0xd04a('0x33')][_0xd04a('0x4d')](_0x53c97b)['then'](handleEntityNotFound(_0x545c41,null))[_0xd04a('0x2a')](respondWithResult(_0x545c41,null))['catch'](handleError(_0x545c41,null));};exports['create']=function(_0x352a5e,_0x5b2745){return db[_0xd04a('0x33')]['create'](_0x352a5e['body'],{})[_0xd04a('0x2a')](function(_0x45f3cf){var _0x2b8a48=_0x352a5e['user'][_0xd04a('0x2b')]({'plain':!![]});if(!_0x2b8a48)throw new Error(_0xd04a('0x4e'));if(_0x2b8a48['role']===_0xd04a('0x4f')){var _0x425e54=_0x45f3cf[_0xd04a('0x2b')]({'plain':!![]});var _0x854091=_0xd04a('0x2c');return db[_0xd04a('0x50')]['find']({'where':{'name':_0x854091,'userProfileId':_0x2b8a48[_0xd04a('0x51')]},'raw':!![]})[_0xd04a('0x2a')](function(_0x1bac85){if(_0x1bac85&&_0x1bac85[_0xd04a('0x52')]===0x0){return db[_0xd04a('0x53')][_0xd04a('0x54')]({'name':_0x425e54[_0xd04a('0x30')],'resourceId':_0x425e54['id'],'type':_0x1bac85[_0xd04a('0x30')],'sectionId':_0x1bac85['id']},{})[_0xd04a('0x2a')](function(){return _0x45f3cf;});}else{return _0x45f3cf;}})[_0xd04a('0x4b')](function(_0x19611c){logger[_0xd04a('0x2e')](_0xd04a('0x55'),_0x19611c);throw _0x19611c;});}return _0x45f3cf;})[_0xd04a('0x2a')](respondWithResult(_0x5b2745,0xc9))[_0xd04a('0x4b')](handleError(_0x5b2745,null));};exports['update']=function(_0x5ab21e,_0x50c9dc){if(_0x5ab21e[_0xd04a('0x56')]['id']){delete _0x5ab21e['body']['id'];}return db[_0xd04a('0x33')][_0xd04a('0x4d')]({'where':{'id':_0x5ab21e[_0xd04a('0x4c')]['id']}})[_0xd04a('0x2a')](handleEntityNotFound(_0x50c9dc,null))[_0xd04a('0x2a')](saveUpdates(_0x5ab21e[_0xd04a('0x56')],null))[_0xd04a('0x2a')](respondWithResult(_0x50c9dc,null))['catch'](handleError(_0x50c9dc,null));};exports[_0xd04a('0x29')]=function(_0x1bb86a,_0x308965){return db[_0xd04a('0x33')][_0xd04a('0x4d')]({'where':{'id':_0x1bb86a[_0xd04a('0x4c')]['id']}})[_0xd04a('0x2a')](handleEntityNotFound(_0x308965,null))['then'](removeEntity(_0x308965,null))['catch'](handleError(_0x308965,null));};exports['describe']=function(_0x443ead,_0x3be646){return db['MailQueue'][_0xd04a('0x57')]()[_0xd04a('0x2a')](respondWithResult(_0x3be646,null))[_0xd04a('0x4b')](handleError(_0x3be646,null));};exports[_0xd04a('0x58')]=function(_0x21e81b,_0x158899,_0x12a17d){var _0x507f75={'raw':!![],'where':{}},_0x204ada={},_0x1b6ab5;return db[_0xd04a('0x33')][_0xd04a('0x59')]({'where':{'id':_0x21e81b[_0xd04a('0x4c')]['id']}})[_0xd04a('0x2a')](handleEntityNotFound(_0x158899,null))[_0xd04a('0x2a')](function(_0x2a0162){if(_0x2a0162){_0x1b6ab5=_0x2a0162[_0xd04a('0x2b')]({'plain':!![]});_0x204ada[_0xd04a('0x37')]=_[_0xd04a('0x38')](db[_0xd04a('0x5a')][_0xd04a('0x34')]);_0x204ada[_0xd04a('0x39')]=_[_0xd04a('0x38')](_0x21e81b['query']);_0x204ada[_0xd04a('0x3a')]=_[_0xd04a('0x3c')](_0x204ada[_0xd04a('0x37')],_0x204ada[_0xd04a('0x39')]);_0x507f75[_0xd04a('0x3b')]=_[_0xd04a('0x3c')](_0x204ada[_0xd04a('0x37')],qs[_0xd04a('0x3d')](_0x21e81b['query']['fields']));_0x507f75['attributes']=_0x507f75[_0xd04a('0x3b')][_0xd04a('0x3e')]?_0x507f75['attributes']:_0x204ada[_0xd04a('0x37')];if(!_0x21e81b[_0xd04a('0x39')][_0xd04a('0x3f')]('nolimit')){_0x507f75['limit']=qs[_0xd04a('0x23')](_0x21e81b[_0xd04a('0x39')][_0xd04a('0x23')]);_0x507f75[_0xd04a('0x22')]=qs[_0xd04a('0x22')](_0x21e81b[_0xd04a('0x39')]['offset']);}_0x507f75['order']=qs[_0xd04a('0x42')](_0x21e81b['query'][_0xd04a('0x42')]);_0x507f75[_0xd04a('0x43')]=qs[_0xd04a('0x3a')](_['pick'](_0x21e81b['query'],_0x204ada[_0xd04a('0x3a')]));_0x507f75['where'][_0xd04a('0x5b')]=_0x2a0162['id'];if(_0x21e81b['query']['filter']){_0x507f75[_0xd04a('0x43')]=_[_0xd04a('0x47')](_0x507f75[_0xd04a('0x43')],{'$or':_['map'](_0x507f75[_0xd04a('0x3b')],function(_0x3858f7){var _0x18a517={};_0x18a517[_0x3858f7]={'$like':'%'+_0x21e81b['query'][_0xd04a('0x45')]+'%'};return _0x18a517;})});}_0x507f75=_['merge']({},_0x507f75,_0x21e81b[_0xd04a('0x48')]);return db[_0xd04a('0x5a')][_0xd04a('0x5c')](_0x507f75);}})[_0xd04a('0x2a')](function(_0x3172df){if(_0x3172df){return db[_0xd04a('0x5d')][_0xd04a('0x5e')]({'where':{'id':_['map'](_0x3172df,'UserId'),'role':_0xd04a('0x5f')},'attributes':['id',_0xd04a('0x30'),_0xd04a('0x60'),_0xd04a('0x61'),_0xd04a('0x62')]});}})[_0xd04a('0x2a')](function(_0x58d31a){if(_0x58d31a){return{'count':_0x58d31a['count'],'rows':_[_0xd04a('0x32')](_0x58d31a[_0xd04a('0x63')],function(_0x1b76ef){return{'membername':_0x1b76ef[_0xd04a('0x30')],'UserId':_0x1b76ef['id'],'queue_name':_0x1b6ab5[_0xd04a('0x30')],'MailQueueId':_0x1b6ab5['id'],'interface':util[_0xd04a('0x64')](_0xd04a('0x65'),_0xd04a('0x66'),_0x1b76ef[_0xd04a('0x30')]),'penalty':0x0,'paused':_0x1b76ef[_0xd04a('0x60')],'createdAt':_0x1b76ef['createdAt'],'updatedAt':_0x1b76ef[_0xd04a('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd04a('0x2a')](respondWithFilteredResult(_0x158899,_0x507f75))[_0xd04a('0x4b')](handleError(_0x158899,null));};exports[_0xd04a('0x67')]=function(_0x10739b,_0x12d387,_0x10892e){var _0x4e3432={};var _0x384f45={};var _0x315fd8;var _0x111977;return db[_0xd04a('0x33')][_0xd04a('0x59')]({'where':{'id':_0x10739b[_0xd04a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x12d387,null))['then'](function(_0x3ba609){if(_0x3ba609){_0x315fd8=_0x3ba609;_0x384f45[_0xd04a('0x37')]=_[_0xd04a('0x38')](db[_0xd04a('0x68')][_0xd04a('0x34')]);_0x384f45[_0xd04a('0x39')]=_['keys'](_0x10739b[_0xd04a('0x39')]);_0x384f45[_0xd04a('0x3a')]=_['intersection'](_0x384f45['model'],_0x384f45[_0xd04a('0x39')]);_0x4e3432[_0xd04a('0x3b')]=_['intersection'](_0x384f45['model'],qs['fields'](_0x10739b[_0xd04a('0x39')][_0xd04a('0x3d')]));_0x4e3432['attributes']=_0x4e3432[_0xd04a('0x3b')]['length']?_0x4e3432[_0xd04a('0x3b')]:_0x384f45['model'];_0x4e3432[_0xd04a('0x41')]=qs[_0xd04a('0x42')](_0x10739b['query'][_0xd04a('0x42')]);_0x4e3432[_0xd04a('0x43')]=qs[_0xd04a('0x3a')](_['pick'](_0x10739b['query'],_0x384f45[_0xd04a('0x3a')]));if(_0x10739b[_0xd04a('0x39')]['filter']){_0x4e3432[_0xd04a('0x43')]=_['merge'](_0x4e3432[_0xd04a('0x43')],{'$or':_[_0xd04a('0x32')](_0x4e3432[_0xd04a('0x3b')],function(_0x56db76){var _0x256744={};_0x256744[_0x56db76]={'$like':'%'+_0x10739b['query'][_0xd04a('0x45')]+'%'};return _0x256744;})});}_0x4e3432=_['merge']({},_0x4e3432,_0x10739b[_0xd04a('0x48')]);return _0x315fd8['getTeams'](_0x4e3432);}})[_0xd04a('0x2a')](function(_0x18ff24){if(_0x18ff24){_0x111977=_0x18ff24[_0xd04a('0x3e')];if(!_0x10739b[_0xd04a('0x39')][_0xd04a('0x3f')](_0xd04a('0x40'))){_0x4e3432[_0xd04a('0x23')]=qs[_0xd04a('0x23')](_0x10739b['query'][_0xd04a('0x23')]);_0x4e3432[_0xd04a('0x22')]=qs[_0xd04a('0x22')](_0x10739b[_0xd04a('0x39')][_0xd04a('0x22')]);}return _0x315fd8[_0xd04a('0x67')](_0x4e3432);}})[_0xd04a('0x2a')](function(_0x22c1f8){if(_0x22c1f8){return _0x22c1f8?{'count':_0x111977,'rows':_0x22c1f8}:null;}})[_0xd04a('0x2a')](respondWithResult(_0x12d387,null))[_0xd04a('0x4b')](handleError(_0x12d387,null));};exports[_0xd04a('0x69')]=function(_0xa97126,_0x157f51,_0x46e630){var _0x4faca1=_0xa97126[_0xd04a('0x56')][_0xd04a('0x6a')];return db[_0xd04a('0x68')][_0xd04a('0x5c')]({'where':{'id':_0x4faca1},'attributes':['id'],'include':[{'model':db[_0xd04a('0x5d')],'as':_0xd04a('0x6b'),'attributes':['id',_0xd04a('0x30'),_0xd04a('0x6c'),'voicePause',_0xd04a('0x6d')],'raw':!![]}]})['then'](function(_0x3306e7){if(_0x3306e7){var _0x585949=_[_0xd04a('0x6e')](_0x3306e7,function(_0x37a0cc){var _0x1954e8=_0x37a0cc['get']({'plain':!![]});return _0x1954e8[_0xd04a('0x6b')];});return db[_0xd04a('0x33')]['find']({'where':{'id':_0xa97126[_0xd04a('0x4c')]['id']}})[_0xd04a('0x2a')](function(_0x45fb03){return db[_0xd04a('0x6f')]['transaction'](function(_0x23243d){return _0x45fb03[_0xd04a('0x69')](_0x4faca1,{'transaction':_0x23243d})[_0xd04a('0x2a')](function(){return BPromise[_0xd04a('0x70')](_0x585949,function(_0x2e6436){return db['UserMailQueue'][_0xd04a('0x71')]({'where':{'UserId':_0x2e6436['id'],'MailQueueId':_0xa97126[_0xd04a('0x4c')]['id']},'transaction':_0x23243d});});})['then'](function(){_0x585949[_0xd04a('0x72')](function(_0x5f06e6){socket[_0xd04a('0x73')](_0xd04a('0x74'),{'UserId':_0x5f06e6['id'],'MailQueueId':_0x45fb03['id']});});});});});}})[_0xd04a('0x2a')](respondWithStatusCode(_0x157f51,null))[_0xd04a('0x4b')](handleError(_0x157f51,null));};exports['removeTeams']=function(_0x2fbc7d,_0x29f228,_0x120bf8){return db['Team']['findAll']({'where':{'id':_0x2fbc7d[_0xd04a('0x39')][_0xd04a('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xd04a('0x5d')],'as':_0xd04a('0x6b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x29f228,null))[_0xd04a('0x2a')](function(_0x24b12e){var _0x39adc0=_[_0xd04a('0x32')](_0x24b12e,'id');var _0x5d9465=[];var _0x2f0425=[];var _0x8a0bc6=squel[_0xd04a('0x75')]();_0x8a0bc6[_0xd04a('0x76')]('tq.TeamId')[_0xd04a('0x77')](_0xd04a('0x78'),'tq')[_0xd04a('0x79')](_0xd04a('0x7a'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xd04a('0x43')](_0xd04a('0x7b'),_0x2fbc7d[_0xd04a('0x4c')]['id']);for(var _0x305ffb=0x0;_0x305ffb<_0x24b12e['length'];_0x305ffb+=0x1){let _0x14e0bc=_0x24b12e[_0x305ffb];for(var _0x16242e=0x0;_0x16242e<_0x14e0bc['Agents'][_0xd04a('0x3e')];_0x16242e+=0x1){let _0x22873d=_0x14e0bc['Agents'][_0x16242e];var _0x24951c=_0x8a0bc6[_0xd04a('0x7c')]();_0x24951c[_0xd04a('0x43')](_0xd04a('0x7d'),_0x22873d['id']);_0x2f0425[_0xd04a('0x7e')](db[_0xd04a('0x6f')][_0xd04a('0x39')](_0x24951c[_0xd04a('0x7f')](),{'type':db['sequelize'][_0xd04a('0x80')]['SELECT']})[_0xd04a('0x2a')](function(_0x37c46d){if(_0x37c46d[_0xd04a('0x3e')]===0x1){return _0x22873d['id'];}else{var _0x5853b0=_[_0xd04a('0x81')](_[_0xd04a('0x32')](_0x37c46d,_0xd04a('0x82')),function(_0x4bed8c){return _[_0xd04a('0x83')](_0x39adc0,_0x4bed8c);});if(_0x5853b0){return _0x22873d['id'];}}}));}}return BPromise[_0xd04a('0x84')](_0x2f0425)[_0xd04a('0x2a')](function(_0x549591){_0x5d9465=_(_0x5d9465)[_0xd04a('0x85')](_0x549591)[_0xd04a('0x86')]()['value']();return db[_0xd04a('0x33')][_0xd04a('0x4d')]({'where':{'id':_0x2fbc7d['params']['id']}})[_0xd04a('0x2a')](function(_0x366f74){return db[_0xd04a('0x6f')][_0xd04a('0x87')](function(_0x5e5d33){return _0x366f74[_0xd04a('0x88')](_0x2fbc7d[_0xd04a('0x39')][_0xd04a('0x6a')],{'transaction':_0x5e5d33})[_0xd04a('0x2a')](function(){if(!_[_0xd04a('0x89')](_0x5d9465)){return _0x366f74[_0xd04a('0x8a')](_0x5d9465,{'transaction':_0x5e5d33});}})[_0xd04a('0x2a')](function(){_0x5d9465[_0xd04a('0x72')](function(_0x2533dd){socket['emit']('userMailQueue:remove',{'UserId':_0x2533dd,'MailQueueId':_0x366f74['id']});});});});});});})['then'](respondWithStatusCode(_0x29f228,null))[_0xd04a('0x4b')](handleError(_0x29f228,null));};exports[_0xd04a('0x8b')]=function(_0x1183cd,_0x12e199,_0x22f587){return db['MailQueue'][_0xd04a('0x4d')]({'where':{'id':_0x1183cd['params']['id']}})[_0xd04a('0x2a')](handleEntityNotFound(_0x12e199,null))['then'](function(_0x48e590){if(_0x48e590){return _0x48e590['addAgents'](_0x1183cd[_0xd04a('0x56')][_0xd04a('0x6a')],_['omit'](_0x1183cd['body'],[_0xd04a('0x6a'),'id'])||{})[_0xd04a('0x8c')](function(_0xbe4a96){for(var _0xaef7f1=0x0;_0xaef7f1<_0x1183cd[_0xd04a('0x56')][_0xd04a('0x6a')][_0xd04a('0x3e')];_0xaef7f1+=0x1){socket[_0xd04a('0x73')](_0xd04a('0x74'),{'UserId':_0x1183cd[_0xd04a('0x56')][_0xd04a('0x6a')][_0xaef7f1],'MailQueueId':_0x1183cd[_0xd04a('0x4c')]['id']});}return _0xbe4a96;});}})['then'](respondWithResult(_0x12e199,null))[_0xd04a('0x4b')](handleError(_0x12e199,null));};exports[_0xd04a('0x8a')]=function(_0x35d731,_0x1f3573,_0x356fd7){return db['MailQueue'][_0xd04a('0x4d')]({'where':{'id':_0x35d731[_0xd04a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1f3573,null))[_0xd04a('0x2a')](function(_0x48583a){if(_0x48583a){return _0x48583a[_0xd04a('0x8a')](_0x35d731[_0xd04a('0x39')][_0xd04a('0x6a')])[_0xd04a('0x2a')](function(){if(_[_0xd04a('0x8d')](_0x35d731[_0xd04a('0x39')][_0xd04a('0x6a')])){for(var _0x4af97a=0x0;_0x4af97a<_0x35d731[_0xd04a('0x39')]['ids'][_0xd04a('0x3e')];_0x4af97a+=0x1){socket['emit']('userMailQueue:remove',{'UserId':Number(_0x35d731[_0xd04a('0x39')][_0xd04a('0x6a')][_0x4af97a]),'MailQueueId':Number(_0x35d731[_0xd04a('0x4c')]['id'])});}}else{socket[_0xd04a('0x73')]('userMailQueue:remove',{'UserId':Number(_0x35d731[_0xd04a('0x39')][_0xd04a('0x6a')]),'MailQueueId':Number(_0x35d731[_0xd04a('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x1f3573,null))[_0xd04a('0x4b')](handleError(_0x1f3573,null));};exports['getAgents']=function(_0x32a662,_0x5d803e,_0x2d2481){var _0x4da101={};var _0x465721={};var _0x520d5c;var _0x559d6e;return db['MailQueue'][_0xd04a('0x59')]({'where':{'id':_0x32a662[_0xd04a('0x4c')]['id']}})[_0xd04a('0x2a')](handleEntityNotFound(_0x5d803e,null))[_0xd04a('0x2a')](function(_0x1b89fc){if(_0x1b89fc){_0x520d5c=_0x1b89fc;_0x465721[_0xd04a('0x37')]=_['keys'](db['User']['rawAttributes']);_0x465721[_0xd04a('0x39')]=_['keys'](_0x32a662[_0xd04a('0x39')]);_0x465721[_0xd04a('0x3a')]=_[_0xd04a('0x3c')](_0x465721[_0xd04a('0x37')],_0x465721['query']);_0x4da101[_0xd04a('0x3b')]=_[_0xd04a('0x3c')](_0x465721[_0xd04a('0x37')],qs[_0xd04a('0x3d')](_0x32a662[_0xd04a('0x39')][_0xd04a('0x3d')]));_0x4da101[_0xd04a('0x3b')]=_0x4da101[_0xd04a('0x3b')][_0xd04a('0x3e')]?_0x4da101[_0xd04a('0x3b')]:_0x465721[_0xd04a('0x37')];_0x4da101[_0xd04a('0x41')]=qs[_0xd04a('0x42')](_0x32a662[_0xd04a('0x39')][_0xd04a('0x42')]);_0x4da101[_0xd04a('0x43')]=qs[_0xd04a('0x3a')](_[_0xd04a('0x44')](_0x32a662[_0xd04a('0x39')],_0x465721[_0xd04a('0x3a')]));if(_0x32a662[_0xd04a('0x39')][_0xd04a('0x45')]){_0x4da101[_0xd04a('0x43')]=_[_0xd04a('0x47')](_0x4da101[_0xd04a('0x43')],{'$or':_[_0xd04a('0x32')](_0x4da101[_0xd04a('0x3b')],function(_0x29be72){var _0x22bfeb={};_0x22bfeb[_0x29be72]={'$like':'%'+_0x32a662[_0xd04a('0x39')][_0xd04a('0x45')]+'%'};return _0x22bfeb;})});}_0x4da101=_['merge']({},_0x4da101,_0x32a662[_0xd04a('0x48')]);return _0x520d5c[_0xd04a('0x8e')](_0x4da101);}})[_0xd04a('0x2a')](function(_0x418b7b){if(_0x418b7b){_0x559d6e=_0x418b7b[_0xd04a('0x3e')];if(!_0x32a662['query']['hasOwnProperty'](_0xd04a('0x40'))){_0x4da101[_0xd04a('0x23')]=qs['limit'](_0x32a662[_0xd04a('0x39')][_0xd04a('0x23')]);_0x4da101[_0xd04a('0x22')]=qs['offset'](_0x32a662[_0xd04a('0x39')]['offset']);}return _0x520d5c[_0xd04a('0x8e')](_0x4da101);}})[_0xd04a('0x2a')](function(_0x187b60){if(_0x187b60){return _0x187b60?{'count':_0x559d6e,'rows':_0x187b60}:null;}})['then'](respondWithResult(_0x5d803e,null))[_0xd04a('0x4b')](handleError(_0x5d803e,null));}; \ No newline at end of file +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 diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 176cc29..3c8b95f 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 _0x635d=['emit','hasOwnProperty','events','../../mysqldb','MailQueue','setMaxListeners','save','remove'];(function(_0xf36a86,_0x24ae13){var _0x32f641=function(_0x90e64e){while(--_0x90e64e){_0xf36a86['push'](_0xf36a86['shift']());}};_0x32f641(++_0x24ae13);}(_0x635d,0x19a));var _0xd635=function(_0x1b6b20,_0x4f4b69){_0x1b6b20=_0x1b6b20-0x0;var _0x1b362e=_0x635d[_0x1b6b20];return _0x1b362e;};'use strict';var EventEmitter=require(_0xd635('0x0'));var MailQueue=require(_0xd635('0x1'))['db'][_0xd635('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xd635('0x3')](0x0);var events={'afterCreate':_0xd635('0x4'),'afterUpdate':'update','afterDestroy':_0xd635('0x5')};function emitEvent(_0x3b5b7a){return function(_0x3c10f2,_0x3fc334,_0x5f2e54){MailQueueEvents[_0xd635('0x6')](_0x3b5b7a+':'+_0x3c10f2['id'],_0x3c10f2);MailQueueEvents['emit'](_0x3b5b7a,_0x3c10f2);_0x5f2e54(null);};}for(var e in events){if(events[_0xd635('0x7')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +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 diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index c367edb..1023aa4 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 _0xa155=['rimraf','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5bbdd3,_0x3be03b){var _0xbb2c40=function(_0x446bbb){while(--_0x446bbb){_0x5bbdd3['push'](_0x5bbdd3['shift']());}};_0xbb2c40(++_0x3be03b);}(_0xa155,0x69));var _0x5a15=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa155[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0x5a15('0x0'));var util=require(_0x5a15('0x1'));var logger=require(_0x5a15('0x2'))(_0x5a15('0x3'));var moment=require('moment');var BPromise=require(_0x5a15('0x4'));var rp=require(_0x5a15('0x5'));var fs=require('fs');var path=require(_0x5a15('0x6'));var rimraf=require(_0x5a15('0x7'));var config=require(_0x5a15('0x8'));var attributes=require(_0x5a15('0x9'));module[_0x5a15('0xa')]=function(_0x3a3aa0,_0x4b890e){return _0x3a3aa0[_0x5a15('0xb')](_0x5a15('0xc'),attributes,{'tableName':_0x5a15('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 6e5f600..d051083 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 _0x47e1=['register','request','then','info','MailQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowMailQueue','find','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./mailQueue.socket'];(function(_0x238c56,_0x1e046f){var _0x25519b=function(_0x4234bd){while(--_0x4234bd){_0x238c56['push'](_0x238c56['shift']());}};_0x25519b(++_0x1e046f);}(_0x47e1,0x12a));var _0x147e=function(_0x4057e9,_0x12ac10){_0x4057e9=_0x4057e9-0x0;var _0x2b3ff0=_0x47e1[_0x4057e9];return _0x2b3ff0;};'use strict';var _=require(_0x147e('0x0'));var util=require(_0x147e('0x1'));var moment=require('moment');var BPromise=require(_0x147e('0x2'));var rs=require(_0x147e('0x3'));var fs=require('fs');var Redis=require(_0x147e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x147e('0x5'))(_0x147e('0x6'));var config=require(_0x147e('0x7'));var jayson=require(_0x147e('0x8'));var client=jayson['client'][_0x147e('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x147e('0xa')],{'host':_0x147e('0xb'),'port':0x18eb});var socket=require(_0x147e('0xc'))(new Redis(config[_0x147e('0xa')]));require(_0x147e('0xd'))[_0x147e('0xe')](socket);function respondWithRpcPromise(_0x10edc8,_0x13c614,_0x524d6b){return new BPromise(function(_0x48c197,_0x15f071){return client[_0x147e('0xf')](_0x10edc8,_0x524d6b)[_0x147e('0x10')](function(_0x32277d){logger[_0x147e('0x11')](_0x147e('0x12'),_0x13c614,'request\x20sent');logger[_0x147e('0x13')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x13c614,_0x147e('0x14'),JSON[_0x147e('0x15')](_0x32277d));if(_0x32277d[_0x147e('0x16')]){if(_0x32277d[_0x147e('0x16')]['code']===0x1f4){logger[_0x147e('0x16')](_0x147e('0x12'),_0x13c614,_0x32277d[_0x147e('0x16')]['message']);return _0x15f071(_0x32277d[_0x147e('0x16')][_0x147e('0x17')]);}logger[_0x147e('0x16')](_0x147e('0x12'),_0x13c614,_0x32277d[_0x147e('0x16')]['message']);return _0x48c197(_0x32277d[_0x147e('0x16')]['message']);}else{logger[_0x147e('0x11')]('MailQueue,\x20%s,\x20%s',_0x13c614,'request\x20sent');_0x48c197(_0x32277d[_0x147e('0x18')][_0x147e('0x17')]);}})[_0x147e('0x19')](function(_0x59eafd){logger[_0x147e('0x16')]('MailQueue,\x20%s,\x20%s',_0x13c614,_0x59eafd);_0x15f071(_0x59eafd);});});}exports[_0x147e('0x1a')]=function(_0x2232a0){var _0x538eec=this;return new Promise(function(_0x3bf0c1,_0x20e8b6){return db[_0x147e('0x1b')][_0x147e('0x1c')]({'raw':_0x2232a0[_0x147e('0x1d')]?_0x2232a0[_0x147e('0x1d')][_0x147e('0x1e')]===undefined?!![]:![]:!![],'where':_0x2232a0[_0x147e('0x1d')]?_0x2232a0[_0x147e('0x1d')][_0x147e('0x1f')]||null:null,'attributes':_0x2232a0[_0x147e('0x1d')]?_0x2232a0[_0x147e('0x1d')][_0x147e('0x20')]||null:null,'limit':_0x2232a0[_0x147e('0x1d')]?_0x2232a0['options'][_0x147e('0x21')]||null:null,'include':_0x2232a0[_0x147e('0x1d')]?_0x2232a0['options'][_0x147e('0x22')]?_[_0x147e('0x23')](_0x2232a0[_0x147e('0x1d')]['include'],function(_0x1b78fd){return{'model':db[_0x1b78fd[_0x147e('0x24')]],'as':_0x1b78fd['as'],'attributes':_0x1b78fd[_0x147e('0x20')],'include':_0x1b78fd[_0x147e('0x22')]?_['map'](_0x1b78fd[_0x147e('0x22')],function(_0x1a43cf){return{'model':db[_0x1a43cf[_0x147e('0x24')]],'as':_0x1a43cf['as'],'attributes':_0x1a43cf[_0x147e('0x20')],'include':_0x1a43cf[_0x147e('0x22')]?_['map'](_0x1a43cf[_0x147e('0x22')],function(_0x2e7bb9){return{'model':db[_0x2e7bb9[_0x147e('0x24')]],'as':_0x2e7bb9['as'],'attributes':_0x2e7bb9[_0x147e('0x20')]};}):[]};}):[]};}):[]:[]})[_0x147e('0x10')](function(_0x36f7c5){logger[_0x147e('0x11')](_0x147e('0x1a'),_0x2232a0);logger[_0x147e('0x13')](_0x147e('0x1a'),_0x2232a0,JSON['stringify'](_0x36f7c5));_0x3bf0c1(_0x36f7c5);})[_0x147e('0x19')](function(_0x2c684d){logger[_0x147e('0x16')](_0x147e('0x1a'),_0x2c684d[_0x147e('0x17')],_0x2232a0);_0x20e8b6(_0x538eec[_0x147e('0x16')](0x1f4,_0x2c684d['message']));});});};exports[_0x147e('0x25')]=function(_0x4bee4d){var _0x47d217=this;return new Promise(function(_0x2141e0,_0x48ff24){return db[_0x147e('0x1b')][_0x147e('0x26')]({'raw':_0x4bee4d[_0x147e('0x1d')]?_0x4bee4d[_0x147e('0x1d')][_0x147e('0x1e')]===undefined?!![]:![]:!![],'where':_0x4bee4d[_0x147e('0x1d')]?_0x4bee4d[_0x147e('0x1d')][_0x147e('0x1f')]||null:null,'attributes':_0x4bee4d[_0x147e('0x1d')]?_0x4bee4d[_0x147e('0x1d')]['attributes']||null:null,'include':_0x4bee4d['options']?_0x4bee4d['options'][_0x147e('0x22')]?_[_0x147e('0x23')](_0x4bee4d['options'][_0x147e('0x22')],function(_0x40db88){return{'model':db[_0x40db88[_0x147e('0x24')]],'as':_0x40db88['as'],'attributes':_0x40db88[_0x147e('0x20')],'include':_0x40db88[_0x147e('0x22')]?_['map'](_0x40db88[_0x147e('0x22')],function(_0x5611c1){return{'model':db[_0x5611c1['model']],'as':_0x5611c1['as'],'attributes':_0x5611c1[_0x147e('0x20')],'include':_0x5611c1[_0x147e('0x22')]?_['map'](_0x5611c1[_0x147e('0x22')],function(_0x67852f){return{'model':db[_0x67852f['model']],'as':_0x67852f['as'],'attributes':_0x67852f['attributes']};}):[]};}):[]};}):[]:[]})[_0x147e('0x10')](function(_0x94aa3d){logger['info'](_0x147e('0x25'),_0x4bee4d);logger['debug']('ShowMailQueue',_0x4bee4d,JSON['stringify'](_0x94aa3d));_0x2141e0(_0x94aa3d);})[_0x147e('0x19')](function(_0x45375c){logger[_0x147e('0x16')](_0x147e('0x25'),_0x45375c['message'],_0x4bee4d);_0x48ff24(_0x47d217['error'](0x1f4,_0x45375c['message']));});});}; \ No newline at end of file +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 diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 4bafac7..0028388 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 _0x1f43=['emit','removeListener','register','length','mailQueue:','./mailQueue.events','save','remove','update'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1f43,0x15b));var _0x31f4=function(_0x319f3f,_0x83e174){_0x319f3f=_0x319f3f-0x0;var _0x15b8ad=_0x1f43[_0x319f3f];return _0x15b8ad;};'use strict';var MailQueueEvents=require(_0x31f4('0x0'));var events=[_0x31f4('0x1'),_0x31f4('0x2'),_0x31f4('0x3')];function createListener(_0x26f411,_0x122d6b){return function(_0x4d45c7){_0x122d6b[_0x31f4('0x4')](_0x26f411,_0x4d45c7);};}function removeListener(_0x117c0e,_0x2b87b8){return function(){MailQueueEvents[_0x31f4('0x5')](_0x117c0e,_0x2b87b8);};}exports[_0x31f4('0x6')]=function(_0x4400fc){for(var _0x209e80=0x0,_0x2b1153=events[_0x31f4('0x7')];_0x209e80<_0x2b1153;_0x209e80++){var _0x459c01=events[_0x209e80];var _0x3ebef8=createListener(_0x31f4('0x8')+_0x459c01,_0x4400fc);MailQueueEvents['on'](_0x459c01,_0x3ebef8);}}; \ No newline at end of file +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 diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 697406c..1fa81b5 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 _0xc8ee=['update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','post','create','put'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0xc8ee,0x1d6));var _0xec8e=function(_0x21b707,_0x50dbb8){_0x21b707=_0x21b707-0x0;var _0x463bd0=_0xc8ee[_0x21b707];return _0x463bd0;};'use strict';var multer=require(_0xec8e('0x0'));var util=require(_0xec8e('0x1'));var path=require('path');var timeout=require(_0xec8e('0x2'));var express=require(_0xec8e('0x3'));var router=express[_0xec8e('0x4')]();var auth=require(_0xec8e('0x5'));var interaction=require(_0xec8e('0x6'));var config=require(_0xec8e('0x7'));var controller=require('./mailQueueReport.controller');router[_0xec8e('0x8')]('/',auth[_0xec8e('0x9')](),controller[_0xec8e('0xa')]);router[_0xec8e('0x8')]('/describe',auth[_0xec8e('0x9')](),controller[_0xec8e('0xb')]);router[_0xec8e('0x8')](_0xec8e('0xc'),auth[_0xec8e('0x9')](),controller['show']);router[_0xec8e('0xd')]('/',auth['isAuthenticated'](),controller[_0xec8e('0xe')]);router[_0xec8e('0xf')](_0xec8e('0xc'),auth[_0xec8e('0x9')](),controller[_0xec8e('0x10')]);router['delete'](_0xec8e('0xc'),auth[_0xec8e('0x9')](),controller['destroy']);module[_0xec8e('0x11')]=router; \ No newline at end of file +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 diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index ba2e185..e698c2d 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 _0x52c0=['exports','STRING','DATE','moment','sequelize'];(function(_0x2838c3,_0x5b7722){var _0x4df6fa=function(_0x59b198){while(--_0x59b198){_0x2838c3['push'](_0x2838c3['shift']());}};_0x4df6fa(++_0x5b7722);}(_0x52c0,0x107));var _0x052c=function(_0x39770f,_0x2d1235){_0x39770f=_0x39770f-0x0;var _0x40bd4d=_0x52c0[_0x39770f];return _0x40bd4d;};'use strict';var moment=require(_0x052c('0x0'));var Sequelize=require(_0x052c('0x1'));module[_0x052c('0x2')]={'uniqueid':{'type':Sequelize[_0x052c('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x052c('0x3')]},'joinAt':{'type':Sequelize[_0x052c('0x4')]},'leaveAt':{'type':Sequelize[_0x052c('0x4')]},'acceptAt':{'type':Sequelize[_0x052c('0x4')]},'exitAt':{'type':Sequelize[_0x052c('0x4')]},'reason':{'type':Sequelize[_0x052c('0x3')]}}; \ No newline at end of file +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 diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index cea2c4c..ea1d7e4 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 _0x25d0=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','end','error','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','include','MailQueueReport','rows','catch','show','params','options','find','create','body','update','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x55a7ec,_0xd0e384){var _0x4c574c=function(_0x36cb0d){while(--_0x36cb0d){_0x55a7ec['push'](_0x55a7ec['shift']());}};_0x4c574c(++_0xd0e384);}(_0x25d0,0x1ed));var _0x025d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x25d0[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x025d('0x0'));var emlformat=require(_0x025d('0x1'));var rimraf=require(_0x025d('0x2'));var zipdir=require(_0x025d('0x3'));var jsonpatch=require(_0x025d('0x4'));var rp=require(_0x025d('0x5'));var moment=require(_0x025d('0x6'));var BPromise=require(_0x025d('0x7'));var Mustache=require(_0x025d('0x8'));var util=require(_0x025d('0x9'));var path=require(_0x025d('0xa'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x025d('0xb'));var fs=require('fs');var _=require(_0x025d('0xc'));var squel=require(_0x025d('0xd'));var crypto=require(_0x025d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x025d('0xf'));var toCsv=require(_0x025d('0x10'));var querystring=require(_0x025d('0x11'));var Papa=require('papaparse');var Redis=require(_0x025d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x025d('0x13'));var as=require(_0x025d('0x14'));var hardwareService=require(_0x025d('0x15'));var logger=require(_0x025d('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x025d('0x17'));var db=require(_0x025d('0x18'))['db'];function respondWithStatusCode(_0x134022,_0x231ddf){_0x231ddf=_0x231ddf||0xcc;return function(_0x460965){if(_0x460965){return _0x134022[_0x025d('0x19')](_0x231ddf);}return _0x134022[_0x025d('0x1a')](_0x231ddf)['end']();};}function respondWithResult(_0x1e4289,_0x2384c4){_0x2384c4=_0x2384c4||0xc8;return function(_0x191d53){if(_0x191d53){return _0x1e4289['status'](_0x2384c4)[_0x025d('0x1b')](_0x191d53);}};}function respondWithFilteredResult(_0x1ff794,_0x5e6a1f){return function(_0x5316bb){if(_0x5316bb){var _0x10104e=_0x5316bb[_0x025d('0x1c')],_0x53b577=_0x5e6a1f['offset'],_0x4921ed=_0x5e6a1f[_0x025d('0x1d')]+_0x5e6a1f[_0x025d('0x1e')],_0x42186a;if(_0x4921ed>=_0x10104e){_0x4921ed=_0x10104e;_0x42186a=0xc8;}else{_0x42186a=0xce;}_0x1ff794[_0x025d('0x1a')](_0x42186a);return _0x1ff794[_0x025d('0x1f')](_0x025d('0x20'),_0x53b577+'-'+_0x4921ed+'/'+_0x10104e)[_0x025d('0x1b')](_0x5316bb);}return null;};}function patchUpdates(_0x48060b){return function(_0x3b9a9c){try{jsonpatch['apply'](_0x3b9a9c,_0x48060b,!![]);}catch(_0x3dfc33){return BPromise[_0x025d('0x21')](_0x3dfc33);}return _0x3b9a9c[_0x025d('0x22')]();};}function saveUpdates(_0x40ea4d,_0x284068){return function(_0x3c6441){if(_0x3c6441){return _0x3c6441['update'](_0x40ea4d)[_0x025d('0x23')](function(_0x42f171){return _0x42f171;});}return null;};}function removeEntity(_0x9e826a,_0x2fbabd){return function(_0x1af9bd){if(_0x1af9bd){return _0x1af9bd[_0x025d('0x24')]()[_0x025d('0x23')](function(){_0x9e826a[_0x025d('0x1a')](0xcc)[_0x025d('0x25')]();});}};}function handleEntityNotFound(_0x4a30fc,_0x32422a){return function(_0x51e736){if(!_0x51e736){_0x4a30fc[_0x025d('0x19')](0x194);}return _0x51e736;};}function handleError(_0x302e0c,_0x5cce4c){_0x5cce4c=_0x5cce4c||0x1f4;return function(_0x536bac){logger[_0x025d('0x26')](_0x536bac['stack']);if(_0x536bac[_0x025d('0x27')]){delete _0x536bac['name'];}_0x302e0c[_0x025d('0x1a')](_0x5cce4c)['send'](_0x536bac);};}exports[_0x025d('0x28')]=function(_0x2b1eee,_0x4a45a1){var _0xd6be8e={},_0xce8377={},_0x35501e={'count':0x0,'rows':[]};var _0x18c396=_['map'](db['MailQueueReport'][_0x025d('0x29')],function(_0x2c8fe5){return{'name':_0x2c8fe5[_0x025d('0x2a')],'type':_0x2c8fe5[_0x025d('0x2b')][_0x025d('0x2c')]};});_0xce8377[_0x025d('0x2d')]=_[_0x025d('0x2e')](_0x18c396,_0x025d('0x27'));_0xce8377[_0x025d('0x2f')]=_[_0x025d('0x30')](_0x2b1eee[_0x025d('0x2f')]);_0xce8377['filters']=_[_0x025d('0x31')](_0xce8377[_0x025d('0x2d')],_0xce8377[_0x025d('0x2f')]);_0xd6be8e['attributes']=_[_0x025d('0x31')](_0xce8377[_0x025d('0x2d')],qs[_0x025d('0x32')](_0x2b1eee[_0x025d('0x2f')][_0x025d('0x32')]));_0xd6be8e[_0x025d('0x33')]=_0xd6be8e['attributes'][_0x025d('0x34')]?_0xd6be8e[_0x025d('0x33')]:_0xce8377['model'];if(!_0x2b1eee[_0x025d('0x2f')][_0x025d('0x35')]('nolimit')){_0xd6be8e['limit']=qs[_0x025d('0x1e')](_0x2b1eee['query'][_0x025d('0x1e')]);_0xd6be8e[_0x025d('0x1d')]=qs[_0x025d('0x1d')](_0x2b1eee[_0x025d('0x2f')][_0x025d('0x1d')]);}_0xd6be8e[_0x025d('0x36')]=qs[_0x025d('0x37')](_0x2b1eee[_0x025d('0x2f')][_0x025d('0x37')]);_0xd6be8e[_0x025d('0x38')]=qs[_0x025d('0x39')](_['pick'](_0x2b1eee[_0x025d('0x2f')],_0xce8377[_0x025d('0x39')]));if(_0x2b1eee[_0x025d('0x2f')][_0x025d('0x3a')]){_0xd6be8e[_0x025d('0x38')]=_[_0x025d('0x3b')](_0xd6be8e[_0x025d('0x38')],{'$or':_[_0x025d('0x2e')](_0x18c396,function(_0x9c655c){if(_0x9c655c[_0x025d('0x2b')]!=='VIRTUAL'){var _0x4d2084={};_0x4d2084[_0x9c655c[_0x025d('0x27')]]={'$like':'%'+_0x2b1eee[_0x025d('0x2f')]['filter']+'%'};return _0x4d2084;}})});}_0xd6be8e=_['merge']({},_0xd6be8e,_0x2b1eee['options']);var _0x1478cd={'where':_0xd6be8e[_0x025d('0x38')]};return db['MailQueueReport'][_0x025d('0x1c')](_0x1478cd)['then'](function(_0x5bda0b){_0x35501e[_0x025d('0x1c')]=_0x5bda0b;if(_0x2b1eee[_0x025d('0x2f')]['includeAll']){_0xd6be8e[_0x025d('0x3c')]=[{'all':!![]}];}return db[_0x025d('0x3d')]['findAll'](_0xd6be8e);})[_0x025d('0x23')](function(_0x39316f){_0x35501e[_0x025d('0x3e')]=_0x39316f;return _0x35501e;})[_0x025d('0x23')](respondWithFilteredResult(_0x4a45a1,_0xd6be8e))[_0x025d('0x3f')](handleError(_0x4a45a1,null));};exports[_0x025d('0x40')]=function(_0x4814d9,_0x4ea6ee){var _0x2beee2={'raw':!![],'where':{'id':_0x4814d9[_0x025d('0x41')]['id']}},_0x1d2d60={};_0x1d2d60[_0x025d('0x2d')]=_[_0x025d('0x30')](db[_0x025d('0x3d')][_0x025d('0x29')]);_0x1d2d60[_0x025d('0x2f')]=_['keys'](_0x4814d9[_0x025d('0x2f')]);_0x1d2d60['filters']=_[_0x025d('0x31')](_0x1d2d60['model'],_0x1d2d60[_0x025d('0x2f')]);_0x2beee2[_0x025d('0x33')]=_['intersection'](_0x1d2d60[_0x025d('0x2d')],qs[_0x025d('0x32')](_0x4814d9[_0x025d('0x2f')][_0x025d('0x32')]));_0x2beee2[_0x025d('0x33')]=_0x2beee2[_0x025d('0x33')][_0x025d('0x34')]?_0x2beee2['attributes']:_0x1d2d60[_0x025d('0x2d')];if(_0x4814d9[_0x025d('0x2f')]['includeAll']){_0x2beee2[_0x025d('0x3c')]=[{'all':!![]}];}_0x2beee2=_[_0x025d('0x3b')]({},_0x2beee2,_0x4814d9[_0x025d('0x42')]);return db[_0x025d('0x3d')][_0x025d('0x43')](_0x2beee2)[_0x025d('0x23')](handleEntityNotFound(_0x4ea6ee,null))[_0x025d('0x23')](respondWithResult(_0x4ea6ee,null))[_0x025d('0x3f')](handleError(_0x4ea6ee,null));};exports[_0x025d('0x44')]=function(_0x301a2a,_0x481c29){return db[_0x025d('0x3d')][_0x025d('0x44')](_0x301a2a[_0x025d('0x45')],{})[_0x025d('0x23')](respondWithResult(_0x481c29,0xc9))['catch'](handleError(_0x481c29,null));};exports[_0x025d('0x46')]=function(_0x5b4969,_0x3b9648){if(_0x5b4969[_0x025d('0x45')]['id']){delete _0x5b4969[_0x025d('0x45')]['id'];}return db[_0x025d('0x3d')][_0x025d('0x43')]({'where':{'id':_0x5b4969['params']['id']}})['then'](handleEntityNotFound(_0x3b9648,null))[_0x025d('0x23')](saveUpdates(_0x5b4969['body'],null))[_0x025d('0x23')](respondWithResult(_0x3b9648,null))[_0x025d('0x3f')](handleError(_0x3b9648,null));};exports[_0x025d('0x24')]=function(_0x3628b8,_0x3981bb){return db[_0x025d('0x3d')][_0x025d('0x43')]({'where':{'id':_0x3628b8['params']['id']}})[_0x025d('0x23')](handleEntityNotFound(_0x3981bb,null))['then'](removeEntity(_0x3981bb,null))[_0x025d('0x3f')](handleError(_0x3981bb,null));};exports['describe']=function(_0x1d6328,_0x391f50){return db[_0x025d('0x3d')]['describe']()['then'](respondWithResult(_0x391f50,null))[_0x025d('0x3f')](handleError(_0x391f50,null));}; \ No newline at end of file +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 diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 4aac3d5..8a6840b 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 _0x3133=['./mailQueueReport.attributes','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3f3480,_0x2ddb9f){var _0x29e2cc=function(_0x5c5a61){while(--_0x5c5a61){_0x3f3480['push'](_0x3f3480['shift']());}};_0x29e2cc(++_0x2ddb9f);}(_0x3133,0x1cb));var _0x3313=function(_0x44b827,_0x1bb1aa){_0x44b827=_0x44b827-0x0;var _0x527342=_0x3133[_0x44b827];return _0x527342;};'use strict';var _=require(_0x3313('0x0'));var util=require(_0x3313('0x1'));var logger=require(_0x3313('0x2'))(_0x3313('0x3'));var moment=require(_0x3313('0x4'));var BPromise=require(_0x3313('0x5'));var rp=require(_0x3313('0x6'));var fs=require('fs');var path=require(_0x3313('0x7'));var rimraf=require(_0x3313('0x8'));var config=require('../../config/environment');var attributes=require(_0x3313('0x9'));module['exports']=function(_0x4620ec,_0x12c026){return _0x4620ec['define']('MailQueueReport',attributes,{'tableName':_0x3313('0xa'),'paranoid':![],'indexes':[{'name':_0x3313('0xb'),'fields':[_0x3313('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 8661d62..40403a1 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 _0xc1c6=['stringify','error','message','info','catch','create','options','raw','CreateMailQueueReport','UpdateMailQueueReport','MailQueueReport','update','body','where','limit','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x46cf00,_0x457a43){var _0x3974dc=function(_0x4b5d0a){while(--_0x4b5d0a){_0x46cf00['push'](_0x46cf00['shift']());}};_0x3974dc(++_0x457a43);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x163413,_0x340ac1){_0x163413=_0x163413-0x0;var _0x3b8093=_0xc1c6[_0x163413];return _0x3b8093;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var moment=require(_0x6c1c('0x2'));var BPromise=require('bluebird');var rs=require(_0x6c1c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c1c('0x4'))['db'];var utils=require(_0x6c1c('0x5'));var logger=require(_0x6c1c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6c1c('0x7'));var client=jayson['client'][_0x6c1c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x582bec,_0xe510ca,_0x2eb1ba){return new BPromise(function(_0x38369d,_0x2cec58){return client['request'](_0x582bec,_0x2eb1ba)[_0x6c1c('0x9')](function(_0x3ca985){logger['info'](_0x6c1c('0xa'),_0xe510ca,_0x6c1c('0xb'));logger[_0x6c1c('0xc')](_0x6c1c('0xd'),_0xe510ca,'request\x20sent',JSON[_0x6c1c('0xe')](_0x3ca985));if(_0x3ca985[_0x6c1c('0xf')]){if(_0x3ca985[_0x6c1c('0xf')]['code']===0x1f4){logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x3ca985[_0x6c1c('0xf')]['message']);return _0x2cec58(_0x3ca985[_0x6c1c('0xf')]['message']);}logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x3ca985[_0x6c1c('0xf')][_0x6c1c('0x10')]);return _0x38369d(_0x3ca985[_0x6c1c('0xf')][_0x6c1c('0x10')]);}else{logger[_0x6c1c('0x11')](_0x6c1c('0xa'),_0xe510ca,_0x6c1c('0xb'));_0x38369d(_0x3ca985['result'][_0x6c1c('0x10')]);}})[_0x6c1c('0x12')](function(_0x5214ee){logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x5214ee);_0x2cec58(_0x5214ee);});});}exports['CreateMailQueueReport']=function(_0x137770){var _0x4ede06=this;return new Promise(function(_0x338dc2,_0x1a0ab9){return db['MailQueueReport'][_0x6c1c('0x13')](_0x137770['body'],{'raw':_0x137770[_0x6c1c('0x14')]?_0x137770[_0x6c1c('0x14')][_0x6c1c('0x15')]===undefined?!![]:![]:!![]})[_0x6c1c('0x9')](function(_0x1acf7f){logger[_0x6c1c('0x11')](_0x6c1c('0x16'),_0x137770);logger[_0x6c1c('0xc')](_0x6c1c('0x16'),_0x137770,JSON[_0x6c1c('0xe')](_0x1acf7f));_0x338dc2(_0x1acf7f);})[_0x6c1c('0x12')](function(_0x450b1f){logger[_0x6c1c('0xf')](_0x6c1c('0x16'),_0x450b1f[_0x6c1c('0x10')],_0x137770);_0x1a0ab9(_0x4ede06[_0x6c1c('0xf')](0x1f4,_0x450b1f[_0x6c1c('0x10')]));});});};exports[_0x6c1c('0x17')]=function(_0x3a3f13){var _0x1dba08=this;return new Promise(function(_0x96046a,_0x3f517e){return db[_0x6c1c('0x18')][_0x6c1c('0x19')](_0x3a3f13[_0x6c1c('0x1a')],{'raw':_0x3a3f13[_0x6c1c('0x14')]?_0x3a3f13[_0x6c1c('0x14')][_0x6c1c('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a3f13[_0x6c1c('0x14')]?_0x3a3f13['options'][_0x6c1c('0x1b')]||null:null,'attributes':_0x3a3f13['options']?_0x3a3f13[_0x6c1c('0x14')]['attributes']||null:null,'limit':_0x3a3f13[_0x6c1c('0x14')]?_0x3a3f13['options'][_0x6c1c('0x1c')]||null:null})[_0x6c1c('0x9')](function(_0x504348){logger[_0x6c1c('0x11')](_0x6c1c('0x17'),_0x3a3f13);logger['debug'](_0x6c1c('0x17'),_0x3a3f13,JSON[_0x6c1c('0xe')](_0x504348));_0x96046a(_0x504348);})[_0x6c1c('0x12')](function(_0xcb489a){logger['error']('UpdateMailQueueReport',_0xcb489a[_0x6c1c('0x10')],_0x3a3f13);_0x3f517e(_0x1dba08[_0x6c1c('0xf')](0x1f4,_0xcb489a[_0x6c1c('0x10')]));});});}; \ No newline at end of file +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 diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index abb3d2a..7f41faf 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 _0x3b82=['exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x5aaf95,_0x5e8f9b){var _0x1eb0c5=function(_0x593d43){while(--_0x593d43){_0x5aaf95['push'](_0x5aaf95['shift']());}};_0x1eb0c5(++_0x5e8f9b);}(_0x3b82,0x172));var _0x23b8=function(_0x359d3e,_0x9d9e5b){_0x359d3e=_0x359d3e-0x0;var _0x533931=_0x3b82[_0x359d3e];return _0x533931;};'use strict';var multer=require(_0x23b8('0x0'));var util=require(_0x23b8('0x1'));var path=require(_0x23b8('0x2'));var timeout=require(_0x23b8('0x3'));var express=require(_0x23b8('0x4'));var router=express[_0x23b8('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x23b8('0x6'));var config=require(_0x23b8('0x7'));module[_0x23b8('0x8')]=router; \ No newline at end of file +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 diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 14118b0..8947429 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 _0x6bb5=['exports','STRING','BOOLEAN','INTEGER'];(function(_0x4b299d,_0x4d9447){var _0x26975=function(_0x2f0b58){while(--_0x2f0b58){_0x4b299d['push'](_0x4b299d['shift']());}};_0x26975(++_0x4d9447);}(_0x6bb5,0x1e4));var _0x56bb=function(_0x5e8eae,_0x4f81e0){_0x5e8eae=_0x5e8eae-0x0;var _0xdd09cd=_0x6bb5[_0x5e8eae];return _0xdd09cd;};'use strict';var Sequelize=require('sequelize');module[_0x56bb('0x0')]={'description':{'type':Sequelize[_0x56bb('0x1')]},'host':{'type':Sequelize[_0x56bb('0x1')]},'authentication':{'type':Sequelize[_0x56bb('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x56bb('0x1')],'unique':'username'},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x56bb('0x3')]},'tls':{'type':Sequelize[_0x56bb('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x56bb('0x1')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x56bb('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x56bb('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x56bb('0x1')]}}; \ No newline at end of file +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 diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index f7d862d..d90a4c1 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 _0x9861=['MailServerIn','mail_servers_in','lodash','api','moment','bluebird','request-promise','path','rimraf','./mailServerIn.attributes','exports','define'];(function(_0x3ec28a,_0x141408){var _0x15e81d=function(_0x3ef627){while(--_0x3ef627){_0x3ec28a['push'](_0x3ec28a['shift']());}};_0x15e81d(++_0x141408);}(_0x9861,0x176));var _0x1986=function(_0x2bdc5b,_0x26fa99){_0x2bdc5b=_0x2bdc5b-0x0;var _0x57371c=_0x9861[_0x2bdc5b];return _0x57371c;};'use strict';var _=require(_0x1986('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1986('0x1'));var moment=require(_0x1986('0x2'));var BPromise=require(_0x1986('0x3'));var rp=require(_0x1986('0x4'));var fs=require('fs');var path=require(_0x1986('0x5'));var rimraf=require(_0x1986('0x6'));var config=require('../../config/environment');var attributes=require(_0x1986('0x7'));module[_0x1986('0x8')]=function(_0x1b56d6,_0x17ccbf){return _0x1b56d6[_0x1986('0x9')](_0x1986('0xa'),attributes,{'tableName':_0x1986('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index bb7199a..42747a5 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 _0x8a96=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug','error','code','MailServerIn,\x20%s,\x20%s','message','request\x20sent','result','catch','GetMailServerIn','MailServerIn','findAll','options','attributes','limit','include','map','model'];(function(_0x418f0b,_0xe47fcf){var _0x4c0491=function(_0xf1922e){while(--_0xf1922e){_0x418f0b['push'](_0x418f0b['shift']());}};_0x4c0491(++_0xe47fcf);}(_0x8a96,0x12c));var _0x68a9=function(_0x515640,_0x27b10e){_0x515640=_0x515640-0x0;var _0x5328b=_0x8a96[_0x515640];return _0x5328b;};'use strict';var _=require(_0x68a9('0x0'));var util=require('util');var moment=require(_0x68a9('0x1'));var BPromise=require(_0x68a9('0x2'));var rs=require(_0x68a9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x68a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x68a9('0x5'))('rpc');var config=require(_0x68a9('0x6'));var jayson=require(_0x68a9('0x7'));var client=jayson[_0x68a9('0x8')][_0x68a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ff454,_0x41e180,_0xc10e0f){return new BPromise(function(_0x5e5d9c,_0x491569){return client[_0x68a9('0xa')](_0x3ff454,_0xc10e0f)[_0x68a9('0xb')](function(_0x1efb76){logger[_0x68a9('0xc')]('MailServerIn,\x20%s,\x20%s',_0x41e180,'request\x20sent');logger[_0x68a9('0xd')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x41e180,'request\x20sent',JSON['stringify'](_0x1efb76));if(_0x1efb76[_0x68a9('0xe')]){if(_0x1efb76[_0x68a9('0xe')][_0x68a9('0xf')]===0x1f4){logger['error'](_0x68a9('0x10'),_0x41e180,_0x1efb76['error'][_0x68a9('0x11')]);return _0x491569(_0x1efb76[_0x68a9('0xe')][_0x68a9('0x11')]);}logger[_0x68a9('0xe')]('MailServerIn,\x20%s,\x20%s',_0x41e180,_0x1efb76[_0x68a9('0xe')][_0x68a9('0x11')]);return _0x5e5d9c(_0x1efb76[_0x68a9('0xe')][_0x68a9('0x11')]);}else{logger['info'](_0x68a9('0x10'),_0x41e180,_0x68a9('0x12'));_0x5e5d9c(_0x1efb76[_0x68a9('0x13')][_0x68a9('0x11')]);}})[_0x68a9('0x14')](function(_0x3d7784){logger[_0x68a9('0xe')](_0x68a9('0x10'),_0x41e180,_0x3d7784);_0x491569(_0x3d7784);});});}exports[_0x68a9('0x15')]=function(_0xcc6d7d){var _0x4ad6da=this;return new Promise(function(_0x2b580a,_0x9a24c9){return db[_0x68a9('0x16')][_0x68a9('0x17')]({'raw':_0xcc6d7d[_0x68a9('0x18')]?_0xcc6d7d[_0x68a9('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xcc6d7d[_0x68a9('0x18')]?_0xcc6d7d[_0x68a9('0x18')]['where']||null:null,'attributes':_0xcc6d7d['options']?_0xcc6d7d[_0x68a9('0x18')][_0x68a9('0x19')]||null:null,'limit':_0xcc6d7d[_0x68a9('0x18')]?_0xcc6d7d[_0x68a9('0x18')][_0x68a9('0x1a')]||null:null,'include':_0xcc6d7d[_0x68a9('0x18')]?_0xcc6d7d[_0x68a9('0x18')][_0x68a9('0x1b')]?_[_0x68a9('0x1c')](_0xcc6d7d['options'][_0x68a9('0x1b')],function(_0xd19e28){return{'model':db[_0xd19e28[_0x68a9('0x1d')]],'as':_0xd19e28['as'],'attributes':_0xd19e28[_0x68a9('0x19')],'include':_0xd19e28[_0x68a9('0x1b')]?_['map'](_0xd19e28[_0x68a9('0x1b')],function(_0x473093){return{'model':db[_0x473093[_0x68a9('0x1d')]],'as':_0x473093['as'],'attributes':_0x473093[_0x68a9('0x19')],'include':_0x473093[_0x68a9('0x1b')]?_[_0x68a9('0x1c')](_0x473093[_0x68a9('0x1b')],function(_0x127bbe){return{'model':db[_0x127bbe['model']],'as':_0x127bbe['as'],'attributes':_0x127bbe[_0x68a9('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x40a5de){logger[_0x68a9('0xc')](_0x68a9('0x15'),_0xcc6d7d);logger[_0x68a9('0xd')](_0x68a9('0x15'),_0xcc6d7d,JSON['stringify'](_0x40a5de));_0x2b580a(_0x40a5de);})[_0x68a9('0x14')](function(_0x554dcb){logger[_0x68a9('0xe')](_0x68a9('0x15'),_0x554dcb[_0x68a9('0x11')],_0xcc6d7d);_0x9a24c9(_0x4ad6da[_0x68a9('0xe')](0x1f4,_0x554dcb[_0x68a9('0x11')]));});});}; \ No newline at end of file +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 diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 126ca0c..c44dfe0 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 _0x3beb=['get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller'];(function(_0x552b66,_0x576017){var _0x500a4b=function(_0x907a98){while(--_0x907a98){_0x552b66['push'](_0x552b66['shift']());}};_0x500a4b(++_0x576017);}(_0x3beb,0x9e));var _0xb3be=function(_0xab0217,_0x223438){_0xab0217=_0xab0217-0x0;var _0x285dc1=_0x3beb[_0xab0217];return _0x285dc1;};'use strict';var multer=require(_0xb3be('0x0'));var util=require(_0xb3be('0x1'));var path=require(_0xb3be('0x2'));var timeout=require(_0xb3be('0x3'));var express=require(_0xb3be('0x4'));var router=express[_0xb3be('0x5')]();var auth=require(_0xb3be('0x6'));var interaction=require(_0xb3be('0x7'));var config=require(_0xb3be('0x8'));var controller=require(_0xb3be('0x9'));router[_0xb3be('0xa')]('/',auth[_0xb3be('0xb')](),controller[_0xb3be('0xc')]);router[_0xb3be('0xa')](_0xb3be('0xd'),auth['isAuthenticated'](),controller[_0xb3be('0xe')]);router['post']('/',auth[_0xb3be('0xb')](),controller[_0xb3be('0xf')]);router[_0xb3be('0x10')](_0xb3be('0xd'),auth[_0xb3be('0xb')](),controller[_0xb3be('0x11')]);router[_0xb3be('0x12')]('/:id',auth[_0xb3be('0xb')](),controller[_0xb3be('0x13')]);module[_0xb3be('0x14')]=router; \ No newline at end of file +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 diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index aad8bca..e9f3a43 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 _0xe9ef=['sequelize','STRING','BOOLEAN'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0xe9ef,0x16e));var _0xfe9e=function(_0x4f4d19,_0x574245){_0x4f4d19=_0x4f4d19-0x0;var _0x27a258=_0xe9ef[_0x4f4d19];return _0x27a258;};'use strict';var Sequelize=require(_0xfe9e('0x0'));module['exports']={'description':{'type':Sequelize[_0xfe9e('0x1')]},'host':{'type':Sequelize[_0xfe9e('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xfe9e('0x1')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0xfe9e('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0xfe9e('0x1')]},'authentication':{'type':Sequelize[_0xfe9e('0x2')],'defaultValue':!![]}}; \ No newline at end of file +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 diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 9c53b19..e9b24b3 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 _0x996a=['send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','limit','sort','where','filters','pick','filter','merge','VIRTUAL','options','MailServerOut','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name'];(function(_0x5f58c2,_0x7385b8){var _0x3c9797=function(_0x44a267){while(--_0x44a267){_0x5f58c2['push'](_0x5f58c2['shift']());}};_0x3c9797(++_0x7385b8);}(_0x996a,0x6a));var _0xa996=function(_0x452317,_0x7b0389){_0x452317=_0x452317-0x0;var _0x190778=_0x996a[_0x452317];return _0x190778;};'use strict';var pdf=require(_0xa996('0x0'));var emlformat=require(_0xa996('0x1'));var rimraf=require(_0xa996('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa996('0x3'));var rp=require(_0xa996('0x4'));var moment=require(_0xa996('0x5'));var BPromise=require(_0xa996('0x6'));var Mustache=require(_0xa996('0x7'));var util=require(_0xa996('0x8'));var path=require(_0xa996('0x9'));var sox=require(_0xa996('0xa'));var csv=require(_0xa996('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa996('0xc'));var squel=require(_0xa996('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa996('0xe'));var toCsv=require(_0xa996('0xb'));var querystring=require('querystring');var Papa=require(_0xa996('0xf'));var Redis=require(_0xa996('0x10'));var authService=require(_0xa996('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa996('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa996('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xa996('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x504498,_0x1e1261){_0x1e1261=_0x1e1261||0xcc;return function(_0x58410b){if(_0x58410b){return _0x504498[_0xa996('0x15')](_0x1e1261);}return _0x504498[_0xa996('0x16')](_0x1e1261)['end']();};}function respondWithResult(_0x1c157f,_0x260ff5){_0x260ff5=_0x260ff5||0xc8;return function(_0x599d5b){if(_0x599d5b){return _0x1c157f[_0xa996('0x16')](_0x260ff5)[_0xa996('0x17')](_0x599d5b);}};}function respondWithFilteredResult(_0x624041,_0x4f0c39){return function(_0x2b4db9){if(_0x2b4db9){var _0x15ce91=_0x2b4db9[_0xa996('0x18')],_0xdbc16a=_0x4f0c39[_0xa996('0x19')],_0x2a3d0e=_0x4f0c39[_0xa996('0x19')]+_0x4f0c39['limit'],_0x29de25;if(_0x2a3d0e>=_0x15ce91){_0x2a3d0e=_0x15ce91;_0x29de25=0xc8;}else{_0x29de25=0xce;}_0x624041[_0xa996('0x16')](_0x29de25);return _0x624041[_0xa996('0x1a')](_0xa996('0x1b'),_0xdbc16a+'-'+_0x2a3d0e+'/'+_0x15ce91)[_0xa996('0x17')](_0x2b4db9);}return null;};}function patchUpdates(_0x1c8900){return function(_0x21c679){try{jsonpatch[_0xa996('0x1c')](_0x21c679,_0x1c8900,!![]);}catch(_0xecec3c){return BPromise[_0xa996('0x1d')](_0xecec3c);}return _0x21c679[_0xa996('0x1e')]();};}function saveUpdates(_0x54a82a,_0x1fd08e){return function(_0x37696a){if(_0x37696a){return _0x37696a[_0xa996('0x1f')](_0x54a82a)[_0xa996('0x20')](function(_0x1f7448){return _0x1f7448;});}return null;};}function removeEntity(_0xcfe2bd,_0x20482d){return function(_0x4c4f7b){if(_0x4c4f7b){return _0x4c4f7b[_0xa996('0x21')]()[_0xa996('0x20')](function(){_0xcfe2bd['status'](0xcc)[_0xa996('0x22')]();});}};}function handleEntityNotFound(_0x4cff0b,_0x3cb372){return function(_0x3660af){if(!_0x3660af){_0x4cff0b[_0xa996('0x15')](0x194);}return _0x3660af;};}function handleError(_0x43121e,_0x4bb40a){_0x4bb40a=_0x4bb40a||0x1f4;return function(_0x35e193){logger[_0xa996('0x23')](_0x35e193[_0xa996('0x24')]);if(_0x35e193[_0xa996('0x25')]){delete _0x35e193[_0xa996('0x25')];}_0x43121e[_0xa996('0x16')](_0x4bb40a)[_0xa996('0x26')](_0x35e193);};}exports['index']=function(_0x472a11,_0x3251bd){var _0xa0ab55={},_0x2f0532={},_0x2337fd={'count':0x0,'rows':[]};var _0xeeef88=_[_0xa996('0x27')](db['MailServerOut'][_0xa996('0x28')],function(_0x3abb16){return{'name':_0x3abb16[_0xa996('0x29')],'type':_0x3abb16[_0xa996('0x2a')][_0xa996('0x2b')]};});_0x2f0532[_0xa996('0x2c')]=_['map'](_0xeeef88,_0xa996('0x25'));_0x2f0532[_0xa996('0x2d')]=_[_0xa996('0x2e')](_0x472a11[_0xa996('0x2d')]);_0x2f0532['filters']=_[_0xa996('0x2f')](_0x2f0532[_0xa996('0x2c')],_0x2f0532['query']);_0xa0ab55[_0xa996('0x30')]=_['intersection'](_0x2f0532[_0xa996('0x2c')],qs[_0xa996('0x31')](_0x472a11[_0xa996('0x2d')]['fields']));_0xa0ab55[_0xa996('0x30')]=_0xa0ab55[_0xa996('0x30')]['length']?_0xa0ab55['attributes']:_0x2f0532[_0xa996('0x2c')];if(!_0x472a11[_0xa996('0x2d')]['hasOwnProperty'](_0xa996('0x32'))){_0xa0ab55[_0xa996('0x33')]=qs[_0xa996('0x33')](_0x472a11['query'][_0xa996('0x33')]);_0xa0ab55[_0xa996('0x19')]=qs['offset'](_0x472a11[_0xa996('0x2d')][_0xa996('0x19')]);}_0xa0ab55['order']=qs[_0xa996('0x34')](_0x472a11[_0xa996('0x2d')]['sort']);_0xa0ab55[_0xa996('0x35')]=qs[_0xa996('0x36')](_[_0xa996('0x37')](_0x472a11[_0xa996('0x2d')],_0x2f0532[_0xa996('0x36')]));if(_0x472a11[_0xa996('0x2d')][_0xa996('0x38')]){_0xa0ab55[_0xa996('0x35')]=_[_0xa996('0x39')](_0xa0ab55[_0xa996('0x35')],{'$or':_[_0xa996('0x27')](_0xeeef88,function(_0x5dc0ce){if(_0x5dc0ce[_0xa996('0x2a')]!==_0xa996('0x3a')){var _0x99eaa2={};_0x99eaa2[_0x5dc0ce[_0xa996('0x25')]]={'$like':'%'+_0x472a11[_0xa996('0x2d')][_0xa996('0x38')]+'%'};return _0x99eaa2;}})});}_0xa0ab55=_[_0xa996('0x39')]({},_0xa0ab55,_0x472a11[_0xa996('0x3b')]);var _0x2c5b49={'where':_0xa0ab55[_0xa996('0x35')]};return db[_0xa996('0x3c')][_0xa996('0x18')](_0x2c5b49)[_0xa996('0x20')](function(_0xb17a65){_0x2337fd[_0xa996('0x18')]=_0xb17a65;if(_0x472a11[_0xa996('0x2d')][_0xa996('0x3d')]){_0xa0ab55['include']=[{'all':!![]}];}return db[_0xa996('0x3c')][_0xa996('0x3e')](_0xa0ab55);})['then'](function(_0x46e6fc){_0x2337fd[_0xa996('0x3f')]=_0x46e6fc;return _0x2337fd;})['then'](respondWithFilteredResult(_0x3251bd,_0xa0ab55))[_0xa996('0x40')](handleError(_0x3251bd,null));};exports[_0xa996('0x41')]=function(_0x1e99ae,_0x4259d3){var _0x1ba2da={'raw':!![],'where':{'id':_0x1e99ae[_0xa996('0x42')]['id']}},_0x1f482b={};_0x1f482b[_0xa996('0x2c')]=_['keys'](db[_0xa996('0x3c')][_0xa996('0x28')]);_0x1f482b[_0xa996('0x2d')]=_[_0xa996('0x2e')](_0x1e99ae[_0xa996('0x2d')]);_0x1f482b[_0xa996('0x36')]=_[_0xa996('0x2f')](_0x1f482b[_0xa996('0x2c')],_0x1f482b[_0xa996('0x2d')]);_0x1ba2da[_0xa996('0x30')]=_['intersection'](_0x1f482b['model'],qs[_0xa996('0x31')](_0x1e99ae[_0xa996('0x2d')][_0xa996('0x31')]));_0x1ba2da[_0xa996('0x30')]=_0x1ba2da['attributes'][_0xa996('0x43')]?_0x1ba2da[_0xa996('0x30')]:_0x1f482b[_0xa996('0x2c')];if(_0x1e99ae[_0xa996('0x2d')][_0xa996('0x3d')]){_0x1ba2da[_0xa996('0x44')]=[{'all':!![]}];}_0x1ba2da=_[_0xa996('0x39')]({},_0x1ba2da,_0x1e99ae['options']);return db['MailServerOut'][_0xa996('0x45')](_0x1ba2da)[_0xa996('0x20')](handleEntityNotFound(_0x4259d3,null))[_0xa996('0x20')](respondWithResult(_0x4259d3,null))[_0xa996('0x40')](handleError(_0x4259d3,null));};exports[_0xa996('0x46')]=function(_0x1bd0d5,_0x105a34){return db['MailServerOut']['create'](_0x1bd0d5['body'],{})[_0xa996('0x20')](respondWithResult(_0x105a34,0xc9))[_0xa996('0x40')](handleError(_0x105a34,null));};exports['update']=function(_0x550861,_0x303856){if(_0x550861[_0xa996('0x47')]['id']){delete _0x550861[_0xa996('0x47')]['id'];}return db[_0xa996('0x3c')][_0xa996('0x45')]({'where':{'id':_0x550861[_0xa996('0x42')]['id']}})['then'](handleEntityNotFound(_0x303856,null))[_0xa996('0x20')](saveUpdates(_0x550861[_0xa996('0x47')],null))[_0xa996('0x20')](respondWithResult(_0x303856,null))[_0xa996('0x40')](handleError(_0x303856,null));};exports[_0xa996('0x21')]=function(_0x3b706a,_0x3e8cf6){return db['MailServerOut'][_0xa996('0x45')]({'where':{'id':_0x3b706a[_0xa996('0x42')]['id']}})[_0xa996('0x20')](handleEntityNotFound(_0x3e8cf6,null))[_0xa996('0x20')](removeEntity(_0x3e8cf6,null))['catch'](handleError(_0x3e8cf6,null));}; \ No newline at end of file +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 diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index a5d5ce2..32cb2f8 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(_0x1a8b5a,_0x3a5957){var _0x5c6a41=function(_0x365dd1){while(--_0x365dd1){_0x1a8b5a['push'](_0x1a8b5a['shift']());}};_0x5c6a41(++_0x3a5957);}(_0x7da7,0x10d));var _0x77da=function(_0x22bdd3,_0x552e50){_0x22bdd3=_0x22bdd3-0x0;var _0x44d9d9=_0x7da7[_0x22bdd3];return _0x44d9d9;};'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 _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 diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index c8222bc..5e0a99c 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 _0x7e93=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','MailServerOut,\x20%s,\x20%s','debug','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','moment','bluebird'];(function(_0x5933fb,_0x9115ad){var _0x44d988=function(_0x295228){while(--_0x295228){_0x5933fb['push'](_0x5933fb['shift']());}};_0x44d988(++_0x9115ad);}(_0x7e93,0x13d));var _0x37e9=function(_0x1a2d62,_0x78d738){_0x1a2d62=_0x1a2d62-0x0;var _0x7bc44f=_0x7e93[_0x1a2d62];return _0x7bc44f;};'use strict';var _=require(_0x37e9('0x0'));var util=require('util');var moment=require(_0x37e9('0x1'));var BPromise=require(_0x37e9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x37e9('0x3'))['db'];var utils=require(_0x37e9('0x4'));var logger=require(_0x37e9('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x37e9('0x6'));var client=jayson[_0x37e9('0x7')][_0x37e9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4ae26b,_0x5893ca,_0x3d6aa4){return new BPromise(function(_0x3b7821,_0x172968){return client['request'](_0x4ae26b,_0x3d6aa4)[_0x37e9('0x9')](function(_0x4a2407){logger['info'](_0x37e9('0xa'),_0x5893ca,'request\x20sent');logger[_0x37e9('0xb')](_0x37e9('0xc'),_0x5893ca,_0x37e9('0xd'),JSON[_0x37e9('0xe')](_0x4a2407));if(_0x4a2407[_0x37e9('0xf')]){if(_0x4a2407['error']['code']===0x1f4){logger['error'](_0x37e9('0xa'),_0x5893ca,_0x4a2407[_0x37e9('0xf')][_0x37e9('0x10')]);return _0x172968(_0x4a2407[_0x37e9('0xf')][_0x37e9('0x10')]);}logger[_0x37e9('0xf')](_0x37e9('0xa'),_0x5893ca,_0x4a2407[_0x37e9('0xf')]['message']);return _0x3b7821(_0x4a2407[_0x37e9('0xf')][_0x37e9('0x10')]);}else{logger[_0x37e9('0x11')]('MailServerOut,\x20%s,\x20%s',_0x5893ca,_0x37e9('0xd'));_0x3b7821(_0x4a2407[_0x37e9('0x12')]['message']);}})[_0x37e9('0x13')](function(_0x4f263b){logger[_0x37e9('0xf')](_0x37e9('0xa'),_0x5893ca,_0x4f263b);_0x172968(_0x4f263b);});});} \ No newline at end of file +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 diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 1646a3c..6e201fd 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 _0xe25d=['/describe','describe','post','create','put','/:id','multer','util','express','Router','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index'];(function(_0x4a82ac,_0x1fb931){var _0x58ee97=function(_0xc7050a){while(--_0xc7050a){_0x4a82ac['push'](_0x4a82ac['shift']());}};_0x58ee97(++_0x1fb931);}(_0xe25d,0x1e6));var _0xde25=function(_0x3fd7f1,_0x50fa9b){_0x3fd7f1=_0x3fd7f1-0x0;var _0x57b7c7=_0xe25d[_0x3fd7f1];return _0x57b7c7;};'use strict';var multer=require(_0xde25('0x0'));var util=require(_0xde25('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xde25('0x2'));var router=express[_0xde25('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xde25('0x4'));var config=require(_0xde25('0x5'));var controller=require(_0xde25('0x6'));router[_0xde25('0x7')]('/',auth[_0xde25('0x8')](),controller[_0xde25('0x9')]);router[_0xde25('0x7')](_0xde25('0xa'),auth['isAuthenticated'](),controller[_0xde25('0xb')]);router[_0xde25('0x7')]('/:id',auth[_0xde25('0x8')](),controller['show']);router[_0xde25('0xc')]('/',auth[_0xde25('0x8')](),controller[_0xde25('0xd')]);router[_0xde25('0xe')](_0xde25('0xf'),auth[_0xde25('0x8')](),controller['update']);router['delete'](_0xde25('0xf'),auth[_0xde25('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 28dd51d..a24ade4 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 _0x63d4=['sequelize','exports','STRING'];(function(_0x543313,_0x10cb23){var _0x3532a6=function(_0x1f28ba){while(--_0x1f28ba){_0x543313['push'](_0x543313['shift']());}};_0x3532a6(++_0x10cb23);}(_0x63d4,0x117));var _0x463d=function(_0xeedf0a,_0x21e230){_0xeedf0a=_0xeedf0a-0x0;var _0x50983c=_0x63d4[_0xeedf0a];return _0x50983c;};'use strict';var Sequelize=require(_0x463d('0x0'));module[_0x463d('0x1')]={'name':{'type':Sequelize[_0x463d('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x463d('0x2')]}}; \ No newline at end of file +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 diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 7fe93dd..22b4d21 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 _0x7fbe=['query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','MailSubstatus','includeAll','findAll','rows','show','params','include','options','catch','create','body','destroy','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','save','update','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','keys'];(function(_0x1ffa61,_0x36aa8d){var _0x3f22f5=function(_0x2c4a45){while(--_0x2c4a45){_0x1ffa61['push'](_0x1ffa61['shift']());}};_0x3f22f5(++_0x36aa8d);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x59f97a,_0x511696){_0x59f97a=_0x59f97a-0x0;var _0x411b33=_0x7fbe[_0x59f97a];return _0x411b33;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe7fb('0x0'));var zipdir=require(_0xe7fb('0x1'));var jsonpatch=require(_0xe7fb('0x2'));var rp=require(_0xe7fb('0x3'));var moment=require(_0xe7fb('0x4'));var BPromise=require(_0xe7fb('0x5'));var Mustache=require(_0xe7fb('0x6'));var util=require(_0xe7fb('0x7'));var path=require(_0xe7fb('0x8'));var sox=require(_0xe7fb('0x9'));var csv=require(_0xe7fb('0xa'));var ejs=require(_0xe7fb('0xb'));var fs=require('fs');var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0xa'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var db=require(_0xe7fb('0x19'))['db'];function respondWithStatusCode(_0x2fe8ab,_0x2437d4){_0x2437d4=_0x2437d4||0xcc;return function(_0x188e1d){if(_0x188e1d){return _0x2fe8ab[_0xe7fb('0x1a')](_0x2437d4);}return _0x2fe8ab[_0xe7fb('0x1b')](_0x2437d4)[_0xe7fb('0x1c')]();};}function respondWithResult(_0x598729,_0x278b75){_0x278b75=_0x278b75||0xc8;return function(_0x2225e5){if(_0x2225e5){return _0x598729['status'](_0x278b75)[_0xe7fb('0x1d')](_0x2225e5);}};}function respondWithFilteredResult(_0x37eb9f,_0x482f7d){return function(_0xa76acf){if(_0xa76acf){var _0x559129=_0xa76acf[_0xe7fb('0x1e')],_0x12fff6=_0x482f7d['offset'],_0x18d23c=_0x482f7d[_0xe7fb('0x1f')]+_0x482f7d['limit'],_0x12603d;if(_0x18d23c>=_0x559129){_0x18d23c=_0x559129;_0x12603d=0xc8;}else{_0x12603d=0xce;}_0x37eb9f[_0xe7fb('0x1b')](_0x12603d);return _0x37eb9f['set'](_0xe7fb('0x20'),_0x12fff6+'-'+_0x18d23c+'/'+_0x559129)[_0xe7fb('0x1d')](_0xa76acf);}return null;};}function patchUpdates(_0x3f96a7){return function(_0x182269){try{jsonpatch['apply'](_0x182269,_0x3f96a7,!![]);}catch(_0x44466e){return BPromise['reject'](_0x44466e);}return _0x182269[_0xe7fb('0x21')]();};}function saveUpdates(_0x51f01f,_0x15f7a4){return function(_0x4ea664){if(_0x4ea664){return _0x4ea664[_0xe7fb('0x22')](_0x51f01f)[_0xe7fb('0x23')](function(_0x4a9994){return _0x4a9994;});}return null;};}function removeEntity(_0x143eb6,_0x4742bd){return function(_0x3ae8f1){if(_0x3ae8f1){return _0x3ae8f1['destroy']()[_0xe7fb('0x23')](function(){_0x143eb6[_0xe7fb('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bea27,_0x52f08b){return function(_0x35e4db){if(!_0x35e4db){_0x5bea27['sendStatus'](0x194);}return _0x35e4db;};}function handleError(_0x49b219,_0x4026b1){_0x4026b1=_0x4026b1||0x1f4;return function(_0x32e8b2){logger[_0xe7fb('0x24')](_0x32e8b2['stack']);if(_0x32e8b2[_0xe7fb('0x25')]){delete _0x32e8b2[_0xe7fb('0x25')];}_0x49b219[_0xe7fb('0x1b')](_0x4026b1)[_0xe7fb('0x26')](_0x32e8b2);};}exports[_0xe7fb('0x27')]=function(_0x16237a,_0x380130){var _0x59e015={},_0x5df9f2={},_0x1086e6={'count':0x0,'rows':[]};var _0x3bdee9=_[_0xe7fb('0x28')](db['MailSubstatus'][_0xe7fb('0x29')],function(_0x251807){return{'name':_0x251807[_0xe7fb('0x2a')],'type':_0x251807[_0xe7fb('0x2b')][_0xe7fb('0x2c')]};});_0x5df9f2[_0xe7fb('0x2d')]=_[_0xe7fb('0x28')](_0x3bdee9,_0xe7fb('0x25'));_0x5df9f2['query']=_[_0xe7fb('0x2e')](_0x16237a[_0xe7fb('0x2f')]);_0x5df9f2[_0xe7fb('0x30')]=_['intersection'](_0x5df9f2['model'],_0x5df9f2[_0xe7fb('0x2f')]);_0x59e015['attributes']=_[_0xe7fb('0x31')](_0x5df9f2[_0xe7fb('0x2d')],qs[_0xe7fb('0x32')](_0x16237a[_0xe7fb('0x2f')]['fields']));_0x59e015[_0xe7fb('0x33')]=_0x59e015[_0xe7fb('0x33')][_0xe7fb('0x34')]?_0x59e015[_0xe7fb('0x33')]:_0x5df9f2[_0xe7fb('0x2d')];if(!_0x16237a['query'][_0xe7fb('0x35')](_0xe7fb('0x36'))){_0x59e015[_0xe7fb('0x37')]=qs[_0xe7fb('0x37')](_0x16237a[_0xe7fb('0x2f')][_0xe7fb('0x37')]);_0x59e015[_0xe7fb('0x1f')]=qs[_0xe7fb('0x1f')](_0x16237a[_0xe7fb('0x2f')]['offset']);}_0x59e015[_0xe7fb('0x38')]=qs[_0xe7fb('0x39')](_0x16237a[_0xe7fb('0x2f')]['sort']);_0x59e015[_0xe7fb('0x3a')]=qs[_0xe7fb('0x30')](_[_0xe7fb('0x3b')](_0x16237a[_0xe7fb('0x2f')],_0x5df9f2[_0xe7fb('0x30')]));if(_0x16237a[_0xe7fb('0x2f')][_0xe7fb('0x3c')]){_0x59e015[_0xe7fb('0x3a')]=_[_0xe7fb('0x3d')](_0x59e015[_0xe7fb('0x3a')],{'$or':_[_0xe7fb('0x28')](_0x3bdee9,function(_0x3c4f4b){if(_0x3c4f4b[_0xe7fb('0x2b')]!==_0xe7fb('0x3e')){var _0xeb7c29={};_0xeb7c29[_0x3c4f4b[_0xe7fb('0x25')]]={'$like':'%'+_0x16237a[_0xe7fb('0x2f')][_0xe7fb('0x3c')]+'%'};return _0xeb7c29;}})});}_0x59e015=_[_0xe7fb('0x3d')]({},_0x59e015,_0x16237a['options']);var _0x261ec5={'where':_0x59e015[_0xe7fb('0x3a')]};return db[_0xe7fb('0x3f')][_0xe7fb('0x1e')](_0x261ec5)['then'](function(_0x3426a9){_0x1086e6[_0xe7fb('0x1e')]=_0x3426a9;if(_0x16237a[_0xe7fb('0x2f')][_0xe7fb('0x40')]){_0x59e015['include']=[{'all':!![]}];}return db[_0xe7fb('0x3f')][_0xe7fb('0x41')](_0x59e015);})[_0xe7fb('0x23')](function(_0x62a8a1){_0x1086e6[_0xe7fb('0x42')]=_0x62a8a1;return _0x1086e6;})[_0xe7fb('0x23')](respondWithFilteredResult(_0x380130,_0x59e015))['catch'](handleError(_0x380130,null));};exports[_0xe7fb('0x43')]=function(_0x35139f,_0x3a96cd){var _0x4b263d={'raw':!![],'where':{'id':_0x35139f[_0xe7fb('0x44')]['id']}},_0x36a341={};_0x36a341['model']=_['keys'](db['MailSubstatus']['rawAttributes']);_0x36a341['query']=_[_0xe7fb('0x2e')](_0x35139f[_0xe7fb('0x2f')]);_0x36a341[_0xe7fb('0x30')]=_['intersection'](_0x36a341[_0xe7fb('0x2d')],_0x36a341['query']);_0x4b263d[_0xe7fb('0x33')]=_[_0xe7fb('0x31')](_0x36a341['model'],qs[_0xe7fb('0x32')](_0x35139f[_0xe7fb('0x2f')][_0xe7fb('0x32')]));_0x4b263d[_0xe7fb('0x33')]=_0x4b263d['attributes'][_0xe7fb('0x34')]?_0x4b263d[_0xe7fb('0x33')]:_0x36a341[_0xe7fb('0x2d')];if(_0x35139f['query'][_0xe7fb('0x40')]){_0x4b263d[_0xe7fb('0x45')]=[{'all':!![]}];}_0x4b263d=_[_0xe7fb('0x3d')]({},_0x4b263d,_0x35139f[_0xe7fb('0x46')]);return db[_0xe7fb('0x3f')]['find'](_0x4b263d)[_0xe7fb('0x23')](handleEntityNotFound(_0x3a96cd,null))['then'](respondWithResult(_0x3a96cd,null))[_0xe7fb('0x47')](handleError(_0x3a96cd,null));};exports[_0xe7fb('0x48')]=function(_0x3520e3,_0x1ecbfd){return db[_0xe7fb('0x3f')]['create'](_0x3520e3[_0xe7fb('0x49')],{})['then'](respondWithResult(_0x1ecbfd,0xc9))['catch'](handleError(_0x1ecbfd,null));};exports[_0xe7fb('0x22')]=function(_0x3d740f,_0x16327f){if(_0x3d740f['body']['id']){delete _0x3d740f[_0xe7fb('0x49')]['id'];}return db[_0xe7fb('0x3f')]['find']({'where':{'id':_0x3d740f['params']['id']}})[_0xe7fb('0x23')](handleEntityNotFound(_0x16327f,null))[_0xe7fb('0x23')](saveUpdates(_0x3d740f[_0xe7fb('0x49')],null))[_0xe7fb('0x23')](respondWithResult(_0x16327f,null))[_0xe7fb('0x47')](handleError(_0x16327f,null));};exports[_0xe7fb('0x4a')]=function(_0x18a590,_0x347177){return db['MailSubstatus'][_0xe7fb('0x4b')]({'where':{'id':_0x18a590['params']['id']}})[_0xe7fb('0x23')](handleEntityNotFound(_0x347177,null))[_0xe7fb('0x23')](removeEntity(_0x347177,null))['catch'](handleError(_0x347177,null));};exports[_0xe7fb('0x4c')]=function(_0x5efd24,_0x239c56){return db['MailSubstatus'][_0xe7fb('0x4c')]()['then'](respondWithResult(_0x239c56,null))[_0xe7fb('0x47')](handleError(_0x239c56,null));}; \ No newline at end of file +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 diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 8f57919..772e6e7 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 _0x1c77=['path','rimraf','../../config/environment','./mailSubstatus.attributes','exports','mail_substatuses','util','../../config/logger','api','moment','bluebird'];(function(_0x1f6f84,_0x2bab55){var _0x177f40=function(_0x384ab4){while(--_0x384ab4){_0x1f6f84['push'](_0x1f6f84['shift']());}};_0x177f40(++_0x2bab55);}(_0x1c77,0xed));var _0x71c7=function(_0x2525f1,_0x47034f){_0x2525f1=_0x2525f1-0x0;var _0x13c1b5=_0x1c77[_0x2525f1];return _0x13c1b5;};'use strict';var _=require('lodash');var util=require(_0x71c7('0x0'));var logger=require(_0x71c7('0x1'))(_0x71c7('0x2'));var moment=require(_0x71c7('0x3'));var BPromise=require(_0x71c7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x71c7('0x5'));var rimraf=require(_0x71c7('0x6'));var config=require(_0x71c7('0x7'));var attributes=require(_0x71c7('0x8'));module[_0x71c7('0x9')]=function(_0x1ee344,_0x2fb422){return _0x1ee344['define']('MailSubstatus',attributes,{'tableName':_0x71c7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 10c229a..49469e6 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 _0x17ba=['code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4c4ab1,_0x50e63d){var _0x3faa92=function(_0x2f2f44){while(--_0x2f2f44){_0x4c4ab1['push'](_0x4c4ab1['shift']());}};_0x3faa92(++_0x50e63d);}(_0x17ba,0xab));var _0xa17b=function(_0x12a39a,_0x50ec36){_0x12a39a=_0x12a39a-0x0;var _0x31c724=_0x17ba[_0x12a39a];return _0x31c724;};'use strict';var _=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var moment=require('moment');var BPromise=require(_0xa17b('0x2'));var rs=require(_0xa17b('0x3'));var fs=require('fs');var Redis=require(_0xa17b('0x4'));var db=require(_0xa17b('0x5'))['db'];var utils=require(_0xa17b('0x6'));var logger=require(_0xa17b('0x7'))(_0xa17b('0x8'));var config=require(_0xa17b('0x9'));var jayson=require(_0xa17b('0xa'));var client=jayson[_0xa17b('0xb')][_0xa17b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e3d43,_0x1957be,_0x57f9cd){return new BPromise(function(_0x2ca4d3,_0x17d1d2){return client[_0xa17b('0xd')](_0x2e3d43,_0x57f9cd)[_0xa17b('0xe')](function(_0x15bdfc){logger['info'](_0xa17b('0xf'),_0x1957be,_0xa17b('0x10'));logger[_0xa17b('0x11')](_0xa17b('0x12'),_0x1957be,_0xa17b('0x10'),JSON[_0xa17b('0x13')](_0x15bdfc));if(_0x15bdfc[_0xa17b('0x14')]){if(_0x15bdfc['error'][_0xa17b('0x15')]===0x1f4){logger[_0xa17b('0x14')](_0xa17b('0xf'),_0x1957be,_0x15bdfc['error'][_0xa17b('0x16')]);return _0x17d1d2(_0x15bdfc[_0xa17b('0x14')][_0xa17b('0x16')]);}logger[_0xa17b('0x14')]('MailSubstatus,\x20%s,\x20%s',_0x1957be,_0x15bdfc[_0xa17b('0x14')]['message']);return _0x2ca4d3(_0x15bdfc[_0xa17b('0x14')][_0xa17b('0x16')]);}else{logger['info'](_0xa17b('0xf'),_0x1957be,_0xa17b('0x10'));_0x2ca4d3(_0x15bdfc[_0xa17b('0x17')][_0xa17b('0x16')]);}})['catch'](function(_0x98a295){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x1957be,_0x98a295);_0x17d1d2(_0x98a295);});});} \ No newline at end of file +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 diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index fc57556..7ac570f 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 _0xd7a5=['create','put','/:id','update','delete','exports','multer','util','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show','post'];(function(_0xe9de2,_0x5bffbb){var _0x35ab0e=function(_0x2bb5fd){while(--_0x2bb5fd){_0xe9de2['push'](_0xe9de2['shift']());}};_0x35ab0e(++_0x5bffbb);}(_0xd7a5,0xd2));var _0x5d7a=function(_0x247fa1,_0x4ec37c){_0x247fa1=_0x247fa1-0x0;var _0x244f35=_0xd7a5[_0x247fa1];return _0x244f35;};'use strict';var multer=require(_0x5d7a('0x0'));var util=require(_0x5d7a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5d7a('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x5d7a('0x3'));var config=require(_0x5d7a('0x4'));var controller=require('./mailTransferReport.controller');router[_0x5d7a('0x5')]('/',auth[_0x5d7a('0x6')](),controller['index']);router['get'](_0x5d7a('0x7'),auth[_0x5d7a('0x6')](),controller[_0x5d7a('0x8')]);router[_0x5d7a('0x5')]('/:id',auth[_0x5d7a('0x6')](),controller[_0x5d7a('0x9')]);router[_0x5d7a('0xa')]('/',auth[_0x5d7a('0x6')](),controller[_0x5d7a('0xb')]);router[_0x5d7a('0xc')](_0x5d7a('0xd'),auth[_0x5d7a('0x6')](),controller[_0x5d7a('0xe')]);router[_0x5d7a('0xf')](_0x5d7a('0xd'),auth[_0x5d7a('0x6')](),controller['destroy']);module[_0x5d7a('0x10')]=router; \ No newline at end of file +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 diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index d24d303..41e462a 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 _0x132e=['agent','queue','DATE','NOW','sequelize','STRING'];(function(_0x336376,_0xe4b28d){var _0x1d2a8e=function(_0x3afe68){while(--_0x3afe68){_0x336376['push'](_0x336376['shift']());}};_0x1d2a8e(++_0xe4b28d);}(_0x132e,0xb2));var _0xe132=function(_0x25c92b,_0x41b368){_0x25c92b=_0x25c92b-0x0;var _0xc59d85=_0x132e[_0x25c92b];return _0xc59d85;};'use strict';var moment=require('moment');var Sequelize=require(_0xe132('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe132('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0xe132('0x2'),_0xe132('0x3')),'allowNull':![],'defaultValue':_0xe132('0x3')},'transferredAt':{'type':Sequelize[_0xe132('0x4')],'allowNull':![],'defaultValue':Sequelize[_0xe132('0x5')]}}; \ No newline at end of file +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 diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 34d0335..bb9ad91 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 _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(_0x342947,_0x21f657){var _0xe12795=function(_0x58884a){while(--_0x58884a){_0x342947['push'](_0x342947['shift']());}};_0xe12795(++_0x21f657);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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 +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 diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index eea5cec..83f560e 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 _0x29d0=['report_mail_transfer','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./mailTransferReport.attributes','define','MailTransferReport'];(function(_0x2c9ea3,_0x515521){var _0x5c5c65=function(_0x3878ee){while(--_0x3878ee){_0x2c9ea3['push'](_0x2c9ea3['shift']());}};_0x5c5c65(++_0x515521);}(_0x29d0,0xf3));var _0x029d=function(_0x501487,_0x545b40){_0x501487=_0x501487-0x0;var _0x4b8291=_0x29d0[_0x501487];return _0x4b8291;};'use strict';var _=require(_0x029d('0x0'));var util=require(_0x029d('0x1'));var logger=require(_0x029d('0x2'))(_0x029d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x029d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x029d('0x5'));var config=require(_0x029d('0x6'));var attributes=require(_0x029d('0x7'));module['exports']=function(_0x3c252f,_0x5bba67){return _0x3c252f[_0x029d('0x8')](_0x029d('0x9'),attributes,{'tableName':_0x029d('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index abe9956..2eb3bb6 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 _0x2fbb=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x55c9c,_0x49e686){var _0x5a63c7=function(_0x458398){while(--_0x458398){_0x55c9c['push'](_0x55c9c['shift']());}};_0x5a63c7(++_0x49e686);}(_0x2fbb,0xbd));var _0xb2fb=function(_0x40a930,_0x3d5ac9){_0x40a930=_0x40a930-0x0;var _0x8e44db=_0x2fbb[_0x40a930];return _0x8e44db;};'use strict';var _=require(_0xb2fb('0x0'));var util=require('util');var moment=require(_0xb2fb('0x1'));var BPromise=require(_0xb2fb('0x2'));var rs=require(_0xb2fb('0x3'));var fs=require('fs');var Redis=require(_0xb2fb('0x4'));var db=require(_0xb2fb('0x5'))['db'];var utils=require(_0xb2fb('0x6'));var logger=require(_0xb2fb('0x7'))(_0xb2fb('0x8'));var config=require('../../config/environment');var jayson=require(_0xb2fb('0x9'));var client=jayson[_0xb2fb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x141b9a,_0x4e5528,_0x5bd0f3){return new BPromise(function(_0x3c2538,_0x33bbca){return client['request'](_0x141b9a,_0x5bd0f3)['then'](function(_0x7abddd){logger[_0xb2fb('0xb')](_0xb2fb('0xc'),_0x4e5528,'request\x20sent');logger[_0xb2fb('0xd')](_0xb2fb('0xe'),_0x4e5528,_0xb2fb('0xf'),JSON[_0xb2fb('0x10')](_0x7abddd));if(_0x7abddd[_0xb2fb('0x11')]){if(_0x7abddd[_0xb2fb('0x11')][_0xb2fb('0x12')]===0x1f4){logger['error'](_0xb2fb('0xc'),_0x4e5528,_0x7abddd['error'][_0xb2fb('0x13')]);return _0x33bbca(_0x7abddd[_0xb2fb('0x11')][_0xb2fb('0x13')]);}logger[_0xb2fb('0x11')](_0xb2fb('0xc'),_0x4e5528,_0x7abddd['error'][_0xb2fb('0x13')]);return _0x3c2538(_0x7abddd[_0xb2fb('0x11')][_0xb2fb('0x13')]);}else{logger[_0xb2fb('0xb')]('MailTransferReport,\x20%s,\x20%s',_0x4e5528,_0xb2fb('0xf'));_0x3c2538(_0x7abddd[_0xb2fb('0x14')][_0xb2fb('0x13')]);}})['catch'](function(_0x4da2ae){logger[_0xb2fb('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x4e5528,_0x4da2ae);_0x33bbca(_0x4da2ae);});});} \ No newline at end of file +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 diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 356396e..d2864b7 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 _0xbf8c=['path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0xbf8c,0xe5));var _0xcbf8=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0xbf8c[_0x75f869];return _0x10af8b;};'use strict';var multer=require(_0xcbf8('0x0'));var util=require(_0xcbf8('0x1'));var path=require(_0xcbf8('0x2'));var timeout=require(_0xcbf8('0x3'));var express=require('express');var router=express[_0xcbf8('0x4')]();var auth=require(_0xcbf8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcbf8('0x6'));var controller=require('./memberReport.controller');router[_0xcbf8('0x7')]('/',auth[_0xcbf8('0x8')](),controller[_0xcbf8('0x9')]);router[_0xcbf8('0x7')](_0xcbf8('0xa'),auth[_0xcbf8('0x8')](),controller[_0xcbf8('0xb')]);router[_0xcbf8('0x7')](_0xcbf8('0xc'),auth[_0xcbf8('0x8')](),controller[_0xcbf8('0xd')]);router[_0xcbf8('0xe')]('/',auth[_0xcbf8('0x8')](),controller[_0xcbf8('0xf')]);router[_0xcbf8('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xcbf8('0x11')]);router[_0xcbf8('0x12')](_0xcbf8('0xc'),auth[_0xcbf8('0x8')](),controller[_0xcbf8('0x13')]);module[_0xcbf8('0x14')]=router; \ No newline at end of file +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 diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 7e0bf7a..c835d8c 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 _0x0465=['STRING','DEFAULT\x20PAUSE','DATE','getDataValue','enterAt','diff','setDataValue','exitAt','duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','exports'];(function(_0x21cb7f,_0x48cd16){var _0x5a079a=function(_0x569a4f){while(--_0x569a4f){_0x21cb7f['push'](_0x21cb7f['shift']());}};_0x5a079a(++_0x48cd16);}(_0x0465,0x1b2));var _0x5046=function(_0xc634ea,_0x5c6e0b){_0xc634ea=_0xc634ea-0x0;var _0x2268e0=_0x0465[_0xc634ea];return _0x2268e0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x5046('0x0')]={'channel':{'type':Sequelize[_0x5046('0x1')]},'membername':{'type':Sequelize[_0x5046('0x1')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':_0x5046('0x2'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x5046('0x3')]},'exitAt':{'type':Sequelize[_0x5046('0x3')],'set':function(_0x30fb24){var _0x1876f8=moment(_0x30fb24);var _0x2c34bd=moment(this[_0x5046('0x4')](_0x5046('0x5')));var _0x406d3a=_0x1876f8[_0x5046('0x6')](_0x2c34bd,'seconds');this[_0x5046('0x7')](_0x5046('0x8'),_0x30fb24);this[_0x5046('0x7')](_0x5046('0x9'),_0x406d3a||null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x5046('0x1')],'comment':_0x5046('0xa')},'data3':{'type':Sequelize[_0x5046('0x1')],'comment':_0x5046('0xb')},'data4':{'type':Sequelize['STRING'],'comment':_0x5046('0xc')},'data5':{'type':Sequelize[_0x5046('0x1')],'comment':_0x5046('0xd')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x5046('0xe')]},'uniqueid':{'type':Sequelize[_0x5046('0x1')]}}; \ No newline at end of file +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 diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index f95d0ba..1dffafa 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 _0xf8c0=['MemberReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows','params','includeAll','options','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map'];(function(_0x1520f0,_0x3132d6){var _0x2bea3d=function(_0x29eab8){while(--_0x29eab8){_0x1520f0['push'](_0x1520f0['shift']());}};_0x2bea3d(++_0x3132d6);}(_0xf8c0,0x197));var _0x0f8c=function(_0x511b76,_0x4727fa){_0x511b76=_0x511b76-0x0;var _0x5424ff=_0xf8c0[_0x511b76];return _0x5424ff;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0f8c('0x0'));var rimraf=require(_0x0f8c('0x1'));var zipdir=require(_0x0f8c('0x2'));var jsonpatch=require(_0x0f8c('0x3'));var rp=require(_0x0f8c('0x4'));var moment=require(_0x0f8c('0x5'));var BPromise=require(_0x0f8c('0x6'));var Mustache=require(_0x0f8c('0x7'));var util=require(_0x0f8c('0x8'));var path=require(_0x0f8c('0x9'));var sox=require(_0x0f8c('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x0f8c('0xb'));var squel=require(_0x0f8c('0xc'));var crypto=require('crypto');var jsforce=require(_0x0f8c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0f8c('0xe'));var querystring=require(_0x0f8c('0xf'));var Papa=require(_0x0f8c('0x10'));var Redis=require(_0x0f8c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0f8c('0x12'));var as=require(_0x0f8c('0x13'));var hardwareService=require(_0x0f8c('0x14'));var logger=require('../../config/logger')(_0x0f8c('0x15'));var utils=require(_0x0f8c('0x16'));var config=require(_0x0f8c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc2a6ff,_0x12e78b){_0x12e78b=_0x12e78b||0xcc;return function(_0x3293ed){if(_0x3293ed){return _0xc2a6ff[_0x0f8c('0x18')](_0x12e78b);}return _0xc2a6ff[_0x0f8c('0x19')](_0x12e78b)[_0x0f8c('0x1a')]();};}function respondWithResult(_0x344b80,_0x1d995f){_0x1d995f=_0x1d995f||0xc8;return function(_0x51ee6d){if(_0x51ee6d){return _0x344b80['status'](_0x1d995f)[_0x0f8c('0x1b')](_0x51ee6d);}};}function respondWithFilteredResult(_0x7bc1b6,_0xf7efb3){return function(_0x485476){if(_0x485476){var _0x582634=_0x485476[_0x0f8c('0x1c')],_0x1e9449=_0xf7efb3['offset'],_0x1c517a=_0xf7efb3['offset']+_0xf7efb3[_0x0f8c('0x1d')],_0x10f1cd;if(_0x1c517a>=_0x582634){_0x1c517a=_0x582634;_0x10f1cd=0xc8;}else{_0x10f1cd=0xce;}_0x7bc1b6['status'](_0x10f1cd);return _0x7bc1b6[_0x0f8c('0x1e')]('Content-Range',_0x1e9449+'-'+_0x1c517a+'/'+_0x582634)[_0x0f8c('0x1b')](_0x485476);}return null;};}function patchUpdates(_0x576fb9){return function(_0x2d3568){try{jsonpatch[_0x0f8c('0x1f')](_0x2d3568,_0x576fb9,!![]);}catch(_0x40cef2){return BPromise[_0x0f8c('0x20')](_0x40cef2);}return _0x2d3568[_0x0f8c('0x21')]();};}function saveUpdates(_0x51741e,_0x39fdb8){return function(_0x513540){if(_0x513540){return _0x513540[_0x0f8c('0x22')](_0x51741e)[_0x0f8c('0x23')](function(_0x5eedee){return _0x5eedee;});}return null;};}function removeEntity(_0x5864df,_0x1402de){return function(_0x1658a0){if(_0x1658a0){return _0x1658a0[_0x0f8c('0x24')]()[_0x0f8c('0x23')](function(){_0x5864df[_0x0f8c('0x19')](0xcc)[_0x0f8c('0x1a')]();});}};}function handleEntityNotFound(_0x463938,_0x145133){return function(_0x2f16c3){if(!_0x2f16c3){_0x463938[_0x0f8c('0x18')](0x194);}return _0x2f16c3;};}function handleError(_0x22fbb7,_0x35d4a0){_0x35d4a0=_0x35d4a0||0x1f4;return function(_0x44aa3b){logger[_0x0f8c('0x25')](_0x44aa3b[_0x0f8c('0x26')]);if(_0x44aa3b['name']){delete _0x44aa3b[_0x0f8c('0x27')];}_0x22fbb7['status'](_0x35d4a0)[_0x0f8c('0x28')](_0x44aa3b);};}exports[_0x0f8c('0x29')]=function(_0xb45d99,_0x2c336b){var _0x150ad1={},_0x5e19f1={},_0x286d5a={'count':0x0,'rows':[]};var _0x2c7c65=_[_0x0f8c('0x2a')](db[_0x0f8c('0x2b')][_0x0f8c('0x2c')],function(_0x27bf65){return{'name':_0x27bf65[_0x0f8c('0x2d')],'type':_0x27bf65['type'][_0x0f8c('0x2e')]};});_0x5e19f1[_0x0f8c('0x2f')]=_['map'](_0x2c7c65,_0x0f8c('0x27'));_0x5e19f1['query']=_[_0x0f8c('0x30')](_0xb45d99[_0x0f8c('0x31')]);_0x5e19f1[_0x0f8c('0x32')]=_[_0x0f8c('0x33')](_0x5e19f1['model'],_0x5e19f1['query']);_0x150ad1[_0x0f8c('0x34')]=_[_0x0f8c('0x33')](_0x5e19f1['model'],qs['fields'](_0xb45d99['query'][_0x0f8c('0x35')]));_0x150ad1[_0x0f8c('0x34')]=_0x150ad1[_0x0f8c('0x34')][_0x0f8c('0x36')]?_0x150ad1[_0x0f8c('0x34')]:_0x5e19f1[_0x0f8c('0x2f')];if(!_0xb45d99[_0x0f8c('0x31')][_0x0f8c('0x37')](_0x0f8c('0x38'))){_0x150ad1['limit']=qs[_0x0f8c('0x1d')](_0xb45d99[_0x0f8c('0x31')][_0x0f8c('0x1d')]);_0x150ad1[_0x0f8c('0x39')]=qs[_0x0f8c('0x39')](_0xb45d99[_0x0f8c('0x31')][_0x0f8c('0x39')]);}_0x150ad1['order']=qs[_0x0f8c('0x3a')](_0xb45d99[_0x0f8c('0x31')][_0x0f8c('0x3a')]);_0x150ad1[_0x0f8c('0x3b')]=qs['filters'](_[_0x0f8c('0x3c')](_0xb45d99['query'],_0x5e19f1[_0x0f8c('0x32')]));if(_0xb45d99[_0x0f8c('0x31')]['filter']){_0x150ad1[_0x0f8c('0x3b')]=_[_0x0f8c('0x3d')](_0x150ad1[_0x0f8c('0x3b')],{'$or':_[_0x0f8c('0x2a')](_0x2c7c65,function(_0x397983){if(_0x397983['type']!==_0x0f8c('0x3e')){var _0x2beb06={};_0x2beb06[_0x397983[_0x0f8c('0x27')]]={'$like':'%'+_0xb45d99[_0x0f8c('0x31')][_0x0f8c('0x3f')]+'%'};return _0x2beb06;}})});}_0x150ad1=_[_0x0f8c('0x3d')]({},_0x150ad1,_0xb45d99['options']);var _0x52ce6d={'where':_0x150ad1['where']};return db[_0x0f8c('0x2b')][_0x0f8c('0x1c')](_0x52ce6d)['then'](function(_0x5cea1a){_0x286d5a[_0x0f8c('0x1c')]=_0x5cea1a;if(_0xb45d99[_0x0f8c('0x31')]['includeAll']){_0x150ad1[_0x0f8c('0x40')]=[{'all':!![]}];}return db[_0x0f8c('0x2b')][_0x0f8c('0x41')](_0x150ad1);})[_0x0f8c('0x23')](function(_0x4ed93d){_0x286d5a[_0x0f8c('0x42')]=_0x4ed93d;return _0x286d5a;})['then'](respondWithFilteredResult(_0x2c336b,_0x150ad1))['catch'](handleError(_0x2c336b,null));};exports['show']=function(_0x50158d,_0x28c718){var _0xaadcd5={'raw':!![],'where':{'id':_0x50158d[_0x0f8c('0x43')]['id']}},_0x29cdcf={};_0x29cdcf[_0x0f8c('0x2f')]=_[_0x0f8c('0x30')](db['MemberReport'][_0x0f8c('0x2c')]);_0x29cdcf[_0x0f8c('0x31')]=_[_0x0f8c('0x30')](_0x50158d['query']);_0x29cdcf[_0x0f8c('0x32')]=_[_0x0f8c('0x33')](_0x29cdcf[_0x0f8c('0x2f')],_0x29cdcf[_0x0f8c('0x31')]);_0xaadcd5[_0x0f8c('0x34')]=_[_0x0f8c('0x33')](_0x29cdcf['model'],qs[_0x0f8c('0x35')](_0x50158d[_0x0f8c('0x31')][_0x0f8c('0x35')]));_0xaadcd5['attributes']=_0xaadcd5['attributes']['length']?_0xaadcd5[_0x0f8c('0x34')]:_0x29cdcf['model'];if(_0x50158d['query'][_0x0f8c('0x44')]){_0xaadcd5[_0x0f8c('0x40')]=[{'all':!![]}];}_0xaadcd5=_[_0x0f8c('0x3d')]({},_0xaadcd5,_0x50158d[_0x0f8c('0x45')]);return db['MemberReport'][_0x0f8c('0x46')](_0xaadcd5)[_0x0f8c('0x23')](handleEntityNotFound(_0x28c718,null))[_0x0f8c('0x23')](respondWithResult(_0x28c718,null))['catch'](handleError(_0x28c718,null));};exports['create']=function(_0x4dfd31,_0x2bd31e){return db[_0x0f8c('0x2b')][_0x0f8c('0x47')](_0x4dfd31[_0x0f8c('0x48')],{})['then'](respondWithResult(_0x2bd31e,0xc9))[_0x0f8c('0x49')](handleError(_0x2bd31e,null));};exports[_0x0f8c('0x22')]=function(_0x41f287,_0x417e56){if(_0x41f287['body']['id']){delete _0x41f287[_0x0f8c('0x48')]['id'];}return db[_0x0f8c('0x2b')][_0x0f8c('0x46')]({'where':{'id':_0x41f287['params']['id']}})[_0x0f8c('0x23')](handleEntityNotFound(_0x417e56,null))[_0x0f8c('0x23')](saveUpdates(_0x41f287[_0x0f8c('0x48')],null))[_0x0f8c('0x23')](respondWithResult(_0x417e56,null))[_0x0f8c('0x49')](handleError(_0x417e56,null));};exports[_0x0f8c('0x24')]=function(_0x21e7ca,_0x44c9ee){return db['MemberReport'][_0x0f8c('0x46')]({'where':{'id':_0x21e7ca[_0x0f8c('0x43')]['id']}})[_0x0f8c('0x23')](handleEntityNotFound(_0x44c9ee,null))['then'](removeEntity(_0x44c9ee,null))[_0x0f8c('0x49')](handleError(_0x44c9ee,null));};exports[_0x0f8c('0x4a')]=function(_0x37d9ab,_0x3f8aaf){return db[_0x0f8c('0x2b')][_0x0f8c('0x4a')]()[_0x0f8c('0x23')](respondWithResult(_0x3f8aaf,null))[_0x0f8c('0x49')](handleError(_0x3f8aaf,null));}; \ No newline at end of file +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 diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index e4caf30..f6b719e 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 _0xe4b5=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','report_member','membername'];(function(_0x1093dc,_0xa31577){var _0x53bdb3=function(_0x3bc20a){while(--_0x3bc20a){_0x1093dc['push'](_0x1093dc['shift']());}};_0x53bdb3(++_0xa31577);}(_0xe4b5,0x1ef));var _0x5e4b=function(_0x2db445,_0xb0f6be){_0x2db445=_0x2db445-0x0;var _0x57f988=_0xe4b5[_0x2db445];return _0x57f988;};'use strict';var _=require(_0x5e4b('0x0'));var util=require(_0x5e4b('0x1'));var logger=require(_0x5e4b('0x2'))(_0x5e4b('0x3'));var moment=require(_0x5e4b('0x4'));var BPromise=require(_0x5e4b('0x5'));var rp=require(_0x5e4b('0x6'));var fs=require('fs');var path=require(_0x5e4b('0x7'));var rimraf=require(_0x5e4b('0x8'));var config=require(_0x5e4b('0x9'));var attributes=require(_0x5e4b('0xa'));module[_0x5e4b('0xb')]=function(_0x483952,_0x2a4eef){return _0x483952[_0x5e4b('0xc')]('MemberReport',attributes,{'tableName':_0x5e4b('0xd'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x5e4b('0xe'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 8fd9d9e..91879f6 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 _0xbbe9=['body','UpdateMemberReport','update','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','include','model','map','stringify','CreateMemberReport','create'];(function(_0x1b88a4,_0x4a704e){var _0x405068=function(_0x48c3c9){while(--_0x48c3c9){_0x1b88a4['push'](_0x1b88a4['shift']());}};_0x405068(++_0x4a704e);}(_0xbbe9,0x16b));var _0x9bbe=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0xbbe9[_0x474bc0];return _0x4b24cf;};'use strict';var _=require('lodash');var util=require(_0x9bbe('0x0'));var moment=require(_0x9bbe('0x1'));var BPromise=require(_0x9bbe('0x2'));var rs=require(_0x9bbe('0x3'));var fs=require('fs');var Redis=require(_0x9bbe('0x4'));var db=require(_0x9bbe('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9bbe('0x6'))(_0x9bbe('0x7'));var config=require(_0x9bbe('0x8'));var jayson=require(_0x9bbe('0x9'));var client=jayson['client'][_0x9bbe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb2883f,_0x3b2ab5,_0x51cf42){return new BPromise(function(_0x47b6a3,_0x36799d){return client[_0x9bbe('0xb')](_0xb2883f,_0x51cf42)[_0x9bbe('0xc')](function(_0x5ab2e3){logger[_0x9bbe('0xd')](_0x9bbe('0xe'),_0x3b2ab5,_0x9bbe('0xf'));logger[_0x9bbe('0x10')](_0x9bbe('0x11'),_0x3b2ab5,_0x9bbe('0xf'),JSON['stringify'](_0x5ab2e3));if(_0x5ab2e3[_0x9bbe('0x12')]){if(_0x5ab2e3['error'][_0x9bbe('0x13')]===0x1f4){logger[_0x9bbe('0x12')](_0x9bbe('0xe'),_0x3b2ab5,_0x5ab2e3[_0x9bbe('0x12')]['message']);return _0x36799d(_0x5ab2e3[_0x9bbe('0x12')][_0x9bbe('0x14')]);}logger[_0x9bbe('0x12')](_0x9bbe('0xe'),_0x3b2ab5,_0x5ab2e3['error'][_0x9bbe('0x14')]);return _0x47b6a3(_0x5ab2e3[_0x9bbe('0x12')][_0x9bbe('0x14')]);}else{logger[_0x9bbe('0xd')](_0x9bbe('0xe'),_0x3b2ab5,'request\x20sent');_0x47b6a3(_0x5ab2e3[_0x9bbe('0x15')][_0x9bbe('0x14')]);}})[_0x9bbe('0x16')](function(_0x187fa6){logger[_0x9bbe('0x12')]('MemberReport,\x20%s,\x20%s',_0x3b2ab5,_0x187fa6);_0x36799d(_0x187fa6);});});}exports[_0x9bbe('0x17')]=function(_0x13f42c){var _0x4f5982=this;return new Promise(function(_0x171f80,_0x24cc61){return db[_0x9bbe('0x18')][_0x9bbe('0x19')]({'raw':_0x13f42c['options']?_0x13f42c[_0x9bbe('0x1a')][_0x9bbe('0x1b')]===undefined?!![]:![]:!![],'where':_0x13f42c[_0x9bbe('0x1a')]?_0x13f42c[_0x9bbe('0x1a')][_0x9bbe('0x1c')]||null:null,'attributes':_0x13f42c[_0x9bbe('0x1a')]?_0x13f42c['options'][_0x9bbe('0x1d')]||null:null,'limit':_0x13f42c[_0x9bbe('0x1a')]?_0x13f42c[_0x9bbe('0x1a')][_0x9bbe('0x1e')]||null:null,'include':_0x13f42c[_0x9bbe('0x1a')]?_0x13f42c[_0x9bbe('0x1a')][_0x9bbe('0x1f')]?_['map'](_0x13f42c['options'][_0x9bbe('0x1f')],function(_0x25310c){return{'model':db[_0x25310c[_0x9bbe('0x20')]],'as':_0x25310c['as'],'attributes':_0x25310c[_0x9bbe('0x1d')],'include':_0x25310c['include']?_[_0x9bbe('0x21')](_0x25310c[_0x9bbe('0x1f')],function(_0x48156e){return{'model':db[_0x48156e[_0x9bbe('0x20')]],'as':_0x48156e['as'],'attributes':_0x48156e[_0x9bbe('0x1d')],'include':_0x48156e[_0x9bbe('0x1f')]?_[_0x9bbe('0x21')](_0x48156e['include'],function(_0x496b2c){return{'model':db[_0x496b2c[_0x9bbe('0x20')]],'as':_0x496b2c['as'],'attributes':_0x496b2c['attributes']};}):[]};}):[]};}):[]:[]})[_0x9bbe('0xc')](function(_0x2984be){logger[_0x9bbe('0xd')](_0x9bbe('0x17'),_0x13f42c);logger['debug'](_0x9bbe('0x17'),_0x13f42c,JSON[_0x9bbe('0x22')](_0x2984be));_0x171f80(_0x2984be);})[_0x9bbe('0x16')](function(_0xf0a58b){logger['error'](_0x9bbe('0x17'),_0xf0a58b['message'],_0x13f42c);_0x24cc61(_0x4f5982[_0x9bbe('0x12')](0x1f4,_0xf0a58b[_0x9bbe('0x14')]));});});};exports[_0x9bbe('0x23')]=function(_0x296cf1){var _0xcbe47b=this;return new Promise(function(_0x8f66aa,_0xfeaf9d){return db[_0x9bbe('0x18')][_0x9bbe('0x24')](_0x296cf1[_0x9bbe('0x25')],{'raw':_0x296cf1[_0x9bbe('0x1a')]?_0x296cf1['options']['raw']===undefined?!![]:![]:!![]})[_0x9bbe('0xc')](function(_0x4cc036){logger[_0x9bbe('0xd')]('CreateMemberReport',_0x296cf1);logger[_0x9bbe('0x10')](_0x9bbe('0x23'),_0x296cf1,JSON['stringify'](_0x4cc036));_0x8f66aa(_0x4cc036);})[_0x9bbe('0x16')](function(_0x51e45b){logger[_0x9bbe('0x12')]('CreateMemberReport',_0x51e45b[_0x9bbe('0x14')],_0x296cf1);_0xfeaf9d(_0xcbe47b[_0x9bbe('0x12')](0x1f4,_0x51e45b[_0x9bbe('0x14')]));});});};exports[_0x9bbe('0x26')]=function(_0x4238d0){var _0x268550=this;return new Promise(function(_0x43b3b7,_0x15f44d){return db[_0x9bbe('0x18')][_0x9bbe('0x27')](_0x4238d0['body'],{'raw':_0x4238d0[_0x9bbe('0x1a')]?_0x4238d0[_0x9bbe('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4238d0[_0x9bbe('0x1a')]?_0x4238d0['options'][_0x9bbe('0x1c')]||null:null,'attributes':_0x4238d0[_0x9bbe('0x1a')]?_0x4238d0[_0x9bbe('0x1a')]['attributes']||null:null,'limit':_0x4238d0[_0x9bbe('0x1a')]?_0x4238d0[_0x9bbe('0x1a')][_0x9bbe('0x1e')]||null:null})[_0x9bbe('0xc')](function(_0x5d2004){logger[_0x9bbe('0xd')](_0x9bbe('0x26'),_0x4238d0);logger['debug'](_0x9bbe('0x26'),_0x4238d0,JSON[_0x9bbe('0x22')](_0x5d2004));_0x43b3b7(_0x5d2004);})[_0x9bbe('0x16')](function(_0x2d05b3){logger[_0x9bbe('0x12')]('UpdateMemberReport',_0x2d05b3[_0x9bbe('0x14')],_0x4238d0);_0x15f44d(_0x268550[_0x9bbe('0x12')](0x1f4,_0x2d05b3[_0x9bbe('0x14')]));});});}; \ No newline at end of file +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 diff --git a/server/api/migration/index.js b/server/api/migration/index.js index a563701..014dac1 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 _0x04b8=['index','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./migration.controller','get'];(function(_0x513254,_0x1305ca){var _0x384c92=function(_0xb22823){while(--_0xb22823){_0x513254['push'](_0x513254['shift']());}};_0x384c92(++_0x1305ca);}(_0x04b8,0x159));var _0x804b=function(_0xa955,_0x212db5){_0xa955=_0xa955-0x0;var _0x265199=_0x04b8[_0xa955];return _0x265199;};'use strict';var multer=require('multer');var util=require(_0x804b('0x0'));var path=require('path');var timeout=require(_0x804b('0x1'));var express=require(_0x804b('0x2'));var router=express['Router']();var auth=require(_0x804b('0x3'));var interaction=require(_0x804b('0x4'));var config=require('../../config/environment');var controller=require(_0x804b('0x5'));router[_0x804b('0x6')]('/',controller[_0x804b('0x7')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 9248879..73cd903 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 _0x6eb9=['sequelize','STRING'];(function(_0x31044e,_0x1da12d){var _0x3fd475=function(_0x1dbd45){while(--_0x1dbd45){_0x31044e['push'](_0x31044e['shift']());}};_0x3fd475(++_0x1da12d);}(_0x6eb9,0x116));var _0x96eb=function(_0x11343c,_0x12857d){_0x11343c=_0x11343c-0x0;var _0x5603b2=_0x6eb9[_0x11343c];return _0x5603b2;};'use strict';var Sequelize=require(_0x96eb('0x0'));module['exports']={'version':{'type':Sequelize[_0x96eb('0x1')],'unique':'version'}}; \ No newline at end of file +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 diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index aa16634..c113cdf 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 _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(_0x2946e4,_0x6fba63){var _0x266909=function(_0x3f0407){while(--_0x3f0407){_0x2946e4['push'](_0x2946e4['shift']());}};_0x266909(++_0x6fba63);}(_0xb10b,0x12a));var _0xbb10=function(_0xf53937,_0x2bf512){_0xf53937=_0xf53937-0x0;var _0x33b67b=_0xb10b[_0xf53937];return _0x33b67b;};'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 +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 diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 6cfe76a..16a6772 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 _0xdad1=['request-promise','path','./migration.attributes','exports','define','Migration','migrations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2ef8f1,_0x1280a3){var _0x17498d=function(_0xd20876){while(--_0xd20876){_0x2ef8f1['push'](_0x2ef8f1['shift']());}};_0x17498d(++_0x1280a3);}(_0xdad1,0x6f));var _0x1dad=function(_0x1f07c7,_0x2beeeb){_0x1f07c7=_0x1f07c7-0x0;var _0x52af89=_0xdad1[_0x1f07c7];return _0x52af89;};'use strict';var _=require(_0x1dad('0x0'));var util=require(_0x1dad('0x1'));var logger=require(_0x1dad('0x2'))(_0x1dad('0x3'));var moment=require(_0x1dad('0x4'));var BPromise=require(_0x1dad('0x5'));var rp=require(_0x1dad('0x6'));var fs=require('fs');var path=require(_0x1dad('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1dad('0x8'));module[_0x1dad('0x9')]=function(_0x4d340f,_0x397ff8){return _0x4d340f[_0x1dad('0xa')](_0x1dad('0xb'),attributes,{'tableName':_0x1dad('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 0829636..e980cce 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 _0x5458=['rpc','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x15e17c,_0x39f6c8){var _0x55d8c7=function(_0x3d3313){while(--_0x3d3313){_0x15e17c['push'](_0x15e17c['shift']());}};_0x55d8c7(++_0x39f6c8);}(_0x5458,0x1c7));var _0x8545=function(_0x1f1c92,_0x22f29a){_0x1f1c92=_0x1f1c92-0x0;var _0x2768c8=_0x5458[_0x1f1c92];return _0x2768c8;};'use strict';var _=require(_0x8545('0x0'));var util=require(_0x8545('0x1'));var moment=require(_0x8545('0x2'));var BPromise=require('bluebird');var rs=require(_0x8545('0x3'));var fs=require('fs');var Redis=require(_0x8545('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8545('0x5'));var logger=require(_0x8545('0x6'))(_0x8545('0x7'));var config=require('../../config/environment');var jayson=require(_0x8545('0x8'));var client=jayson[_0x8545('0x9')][_0x8545('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x359d01,_0x5062c7,_0x291bc9){return new BPromise(function(_0x507ed8,_0x2cc4f4){return client[_0x8545('0xb')](_0x359d01,_0x291bc9)[_0x8545('0xc')](function(_0x10931d){logger[_0x8545('0xd')](_0x8545('0xe'),_0x5062c7,_0x8545('0xf'));logger[_0x8545('0x10')]('Migration,\x20%s,\x20%s,\x20%s',_0x5062c7,_0x8545('0xf'),JSON[_0x8545('0x11')](_0x10931d));if(_0x10931d[_0x8545('0x12')]){if(_0x10931d['error'][_0x8545('0x13')]===0x1f4){logger[_0x8545('0x12')](_0x8545('0xe'),_0x5062c7,_0x10931d[_0x8545('0x12')][_0x8545('0x14')]);return _0x2cc4f4(_0x10931d[_0x8545('0x12')][_0x8545('0x14')]);}logger[_0x8545('0x12')](_0x8545('0xe'),_0x5062c7,_0x10931d['error'][_0x8545('0x14')]);return _0x507ed8(_0x10931d[_0x8545('0x12')]['message']);}else{logger[_0x8545('0xd')](_0x8545('0xe'),_0x5062c7,_0x8545('0xf'));_0x507ed8(_0x10931d['result'][_0x8545('0x14')]);}})[_0x8545('0x15')](function(_0x3374f7){logger['error']('Migration,\x20%s,\x20%s',_0x5062c7,_0x3374f7);_0x2cc4f4(_0x3374f7);});});} \ No newline at end of file +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 diff --git a/server/api/network/index.js b/server/api/network/index.js index 7ef1010..16db883 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 _0xe982=['../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x3b5915,_0x50ac3c){var _0x19525d=function(_0x1beba5){while(--_0x1beba5){_0x3b5915['push'](_0x3b5915['shift']());}};_0x19525d(++_0x50ac3c);}(_0xe982,0x112));var _0x2e98=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe982[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x2e98('0x0'));var util=require(_0x2e98('0x1'));var path=require(_0x2e98('0x2'));var timeout=require('connect-timeout');var express=require(_0x2e98('0x3'));var router=express[_0x2e98('0x4')]();var auth=require(_0x2e98('0x5'));var interaction=require(_0x2e98('0x6'));var config=require(_0x2e98('0x7'));var controller=require(_0x2e98('0x8'));router[_0x2e98('0x9')]('/',auth[_0x2e98('0xa')](),controller['index']);router[_0x2e98('0x9')]('/:id',auth[_0x2e98('0xa')](),controller[_0x2e98('0xb')]);router[_0x2e98('0xc')]('/',auth['isAuthenticated'](),controller[_0x2e98('0xd')]);router[_0x2e98('0xe')](_0x2e98('0xf'),auth[_0x2e98('0xa')](),controller[_0x2e98('0x10')]);router[_0x2e98('0x11')](_0x2e98('0xf'),auth['isAuthenticated'](),controller[_0x2e98('0x12')]);module[_0x2e98('0x13')]=router; \ No newline at end of file +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 diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 3e1f145..d8f1bd1 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(_0x541c1f,_0x3e8ab0){var _0x308419=function(_0x23ec37){while(--_0x23ec37){_0x541c1f['push'](_0x541c1f['shift']());}};_0x308419(++_0x3e8ab0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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(_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 diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 23c80c2..6e27bdc 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 _0x2e80=['json','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','Network','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','create','sequelize','transaction','body','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','TURN','join','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','jayson/promise','client','test','Sequelize','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end'];(function(_0x235b0b,_0x480df1){var _0x414ae2=function(_0x276a17){while(--_0x276a17){_0x235b0b['push'](_0x235b0b['shift']());}};_0x414ae2(++_0x480df1);}(_0x2e80,0x18f));var _0x02e8=function(_0x310a1b,_0x4c9129){_0x310a1b=_0x310a1b-0x0;var _0xdea206=_0x2e80[_0x310a1b];return _0xdea206;};'use strict';var pdf=require(_0x02e8('0x0'));var emlformat=require(_0x02e8('0x1'));var rimraf=require(_0x02e8('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x02e8('0x3'));var rp=require(_0x02e8('0x4'));var moment=require(_0x02e8('0x5'));var BPromise=require(_0x02e8('0x6'));var Mustache=require(_0x02e8('0x7'));var util=require(_0x02e8('0x8'));var path=require(_0x02e8('0x9'));var sox=require('sox');var csv=require(_0x02e8('0xa'));var ejs=require(_0x02e8('0xb'));var fs=require('fs');var _=require(_0x02e8('0xc'));var squel=require(_0x02e8('0xd'));var crypto=require(_0x02e8('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x02e8('0xa'));var querystring=require(_0x02e8('0xf'));var Papa=require(_0x02e8('0x10'));var Redis=require('ioredis');var authService=require(_0x02e8('0x11'));var qs=require(_0x02e8('0x12'));var as=require(_0x02e8('0x13'));var hardwareService=require(_0x02e8('0x14'));var logger=require(_0x02e8('0x15'))('api');var utils=require(_0x02e8('0x16'));var config=require(_0x02e8('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x02e8('0x18'));var client=jayson[_0x02e8('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x32520f,_0x353700,_0x537394){if(_0x537394){var _0xbce08a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xbce08a[_0x02e8('0x1a')](_0x353700)){return _0x32520f;}else{throw new db[(_0x02e8('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 _0x32520f;}}function respondWithRpcPromise(_0x4ec2d4,_0x426aaa,_0x23c654,_0x346c3e){return new BPromise(function(_0x1bd86b,_0x19931d){var _0x513c4f=_0x346c3e||client;return _0x513c4f['request'](_0x4ec2d4,_0x23c654)[_0x02e8('0x1c')](function(_0x42b293){logger[_0x02e8('0x1d')](_0x02e8('0x1e'),_0x426aaa,_0x02e8('0x1f'));logger[_0x02e8('0x20')](_0x02e8('0x21'),_0x426aaa,'request\x20sent',JSON[_0x02e8('0x22')](_0x42b293));if(_0x42b293['error']){if(_0x42b293[_0x02e8('0x23')][_0x02e8('0x24')]===0x1f4){logger[_0x02e8('0x23')](_0x02e8('0x1e'),_0x426aaa,_0x42b293[_0x02e8('0x23')][_0x02e8('0x25')]);return _0x19931d(_0x42b293['error'][_0x02e8('0x25')]);}logger[_0x02e8('0x23')](_0x02e8('0x1e'),_0x426aaa,_0x42b293['error']['message']);return _0x1bd86b(_0x42b293['error']['message']);}else{logger['info']('Network,\x20%s,\x20%s',_0x426aaa,'request\x20sent');_0x1bd86b(_0x42b293['result'][_0x02e8('0x25')]);}})['catch'](function(_0x1bb894){logger[_0x02e8('0x23')](_0x02e8('0x1e'),_0x426aaa,_0x1bb894);_0x19931d(_0x1bb894);});});}function respondWithStatusCode(_0x24c086,_0x3c1bef){_0x3c1bef=_0x3c1bef||0xcc;return function(_0x504a8d){if(_0x504a8d){return _0x24c086[_0x02e8('0x26')](_0x3c1bef);}return _0x24c086[_0x02e8('0x27')](_0x3c1bef)[_0x02e8('0x28')]();};}function respondWithResult(_0x4197cb,_0x319f71){_0x319f71=_0x319f71||0xc8;return function(_0x518fb7){if(_0x518fb7){return _0x4197cb[_0x02e8('0x27')](_0x319f71)[_0x02e8('0x29')](_0x518fb7);}};}function respondWithFilteredResult(_0x2ac9ec,_0x39bfe3){return function(_0x31dbb6){if(_0x31dbb6){var _0x36f306=_0x31dbb6[_0x02e8('0x2a')],_0x408af5=_0x39bfe3['offset'],_0x292ad7=_0x39bfe3[_0x02e8('0x2b')]+_0x39bfe3['limit'],_0x35a08a;if(_0x292ad7>=_0x36f306){_0x292ad7=_0x36f306;_0x35a08a=0xc8;}else{_0x35a08a=0xce;}_0x2ac9ec[_0x02e8('0x27')](_0x35a08a);return _0x2ac9ec[_0x02e8('0x2c')](_0x02e8('0x2d'),_0x408af5+'-'+_0x292ad7+'/'+_0x36f306)[_0x02e8('0x29')](_0x31dbb6);}return null;};}function patchUpdates(_0x3df28d){return function(_0x34cde6){try{jsonpatch[_0x02e8('0x2e')](_0x34cde6,_0x3df28d,!![]);}catch(_0xde2e7d){return BPromise[_0x02e8('0x2f')](_0xde2e7d);}return _0x34cde6[_0x02e8('0x30')]();};}function saveUpdates(_0x374aaa,_0x60705){return function(_0x211056){if(_0x211056){return _0x211056[_0x02e8('0x31')](_0x374aaa)['then'](function(_0x4bd74b){return _0x4bd74b;});}return null;};}function removeEntity(_0x3ce893,_0x2d7b5e){return function(_0x113c0b){if(_0x113c0b){return _0x113c0b[_0x02e8('0x32')]()[_0x02e8('0x1c')](function(){_0x3ce893['status'](0xcc)[_0x02e8('0x28')]();});}};}function handleEntityNotFound(_0xf9f897,_0x59493d){return function(_0x4df6da){if(!_0x4df6da){_0xf9f897[_0x02e8('0x26')](0x194);}return _0x4df6da;};}function handleError(_0xa51b55,_0x30ce48){_0x30ce48=_0x30ce48||0x1f4;return function(_0xfd4218){logger[_0x02e8('0x23')](_0xfd4218[_0x02e8('0x33')]);if(_0xfd4218['name']){delete _0xfd4218[_0x02e8('0x34')];}_0xa51b55[_0x02e8('0x27')](_0x30ce48)[_0x02e8('0x35')](_0xfd4218);};}exports['index']=function(_0x39e397,_0x34a8e1){var _0xd200d0={},_0x5e92e3={},_0x4d2558={'count':0x0,'rows':[]};var _0x5e407b=_[_0x02e8('0x36')](db[_0x02e8('0x37')][_0x02e8('0x38')],function(_0x319992){return{'name':_0x319992[_0x02e8('0x39')],'type':_0x319992[_0x02e8('0x3a')][_0x02e8('0x3b')]};});_0x5e92e3[_0x02e8('0x3c')]=_[_0x02e8('0x36')](_0x5e407b,'name');_0x5e92e3[_0x02e8('0x3d')]=_[_0x02e8('0x3e')](_0x39e397['query']);_0x5e92e3[_0x02e8('0x3f')]=_[_0x02e8('0x40')](_0x5e92e3[_0x02e8('0x3c')],_0x5e92e3['query']);_0xd200d0['attributes']=_[_0x02e8('0x40')](_0x5e92e3['model'],qs['fields'](_0x39e397[_0x02e8('0x3d')][_0x02e8('0x41')]));_0xd200d0[_0x02e8('0x42')]=_0xd200d0[_0x02e8('0x42')][_0x02e8('0x43')]?_0xd200d0['attributes']:_0x5e92e3[_0x02e8('0x3c')];if(!_0x39e397['query'][_0x02e8('0x44')](_0x02e8('0x45'))){_0xd200d0['limit']=qs['limit'](_0x39e397['query'][_0x02e8('0x46')]);_0xd200d0['offset']=qs[_0x02e8('0x2b')](_0x39e397[_0x02e8('0x3d')]['offset']);}_0xd200d0[_0x02e8('0x47')]=qs[_0x02e8('0x48')](_0x39e397[_0x02e8('0x3d')]['sort']);_0xd200d0[_0x02e8('0x49')]=qs[_0x02e8('0x3f')](_[_0x02e8('0x4a')](_0x39e397[_0x02e8('0x3d')],_0x5e92e3[_0x02e8('0x3f')]));if(_0x39e397[_0x02e8('0x3d')][_0x02e8('0x4b')]){_0xd200d0[_0x02e8('0x49')]=_[_0x02e8('0x4c')](_0xd200d0[_0x02e8('0x49')],{'$or':_[_0x02e8('0x36')](_0x5e407b,function(_0x5aea0d){if(_0x5aea0d[_0x02e8('0x3a')]!==_0x02e8('0x4d')){var _0x2e3d6c={};_0x2e3d6c[_0x5aea0d['name']]={'$like':'%'+_0x39e397[_0x02e8('0x3d')][_0x02e8('0x4b')]+'%'};return _0x2e3d6c;}})});}_0xd200d0=_[_0x02e8('0x4c')]({},_0xd200d0,_0x39e397[_0x02e8('0x4e')]);var _0x5f338a={'where':_0xd200d0[_0x02e8('0x49')]};return db['Network'][_0x02e8('0x2a')](_0x5f338a)[_0x02e8('0x1c')](function(_0x28be65){_0x4d2558['count']=_0x28be65;if(_0x39e397[_0x02e8('0x3d')][_0x02e8('0x4f')]){_0xd200d0['include']=[{'all':!![]}];}return db[_0x02e8('0x37')][_0x02e8('0x50')](_0xd200d0);})[_0x02e8('0x1c')](function(_0x381298){_0x4d2558['rows']=_0x381298;return _0x4d2558;})[_0x02e8('0x1c')](respondWithFilteredResult(_0x34a8e1,_0xd200d0))[_0x02e8('0x51')](handleError(_0x34a8e1,null));};exports[_0x02e8('0x52')]=function(_0xf744fe,_0x374df6){var _0x4e5ccd={'raw':!![],'where':{'id':_0xf744fe[_0x02e8('0x53')]['id']}},_0x596fec={};_0x596fec[_0x02e8('0x3c')]=_[_0x02e8('0x3e')](db[_0x02e8('0x37')][_0x02e8('0x38')]);_0x596fec['query']=_[_0x02e8('0x3e')](_0xf744fe['query']);_0x596fec[_0x02e8('0x3f')]=_['intersection'](_0x596fec['model'],_0x596fec[_0x02e8('0x3d')]);_0x4e5ccd[_0x02e8('0x42')]=_[_0x02e8('0x40')](_0x596fec[_0x02e8('0x3c')],qs['fields'](_0xf744fe[_0x02e8('0x3d')][_0x02e8('0x41')]));_0x4e5ccd[_0x02e8('0x42')]=_0x4e5ccd[_0x02e8('0x42')]['length']?_0x4e5ccd[_0x02e8('0x42')]:_0x596fec[_0x02e8('0x3c')];if(_0xf744fe['query'][_0x02e8('0x4f')]){_0x4e5ccd[_0x02e8('0x54')]=[{'all':!![]}];}_0x4e5ccd=_[_0x02e8('0x4c')]({},_0x4e5ccd,_0xf744fe[_0x02e8('0x4e')]);return db[_0x02e8('0x37')][_0x02e8('0x55')](_0x4e5ccd)[_0x02e8('0x1c')](handleEntityNotFound(_0x374df6,null))[_0x02e8('0x1c')](respondWithResult(_0x374df6,null))[_0x02e8('0x51')](handleError(_0x374df6,null));};exports[_0x02e8('0x56')]=function(_0x5f358d,_0xd7209a,_0x3d47a3){var _0x4e8af2;return db[_0x02e8('0x57')][_0x02e8('0x58')](function(_0x273c91){return db[_0x02e8('0x37')][_0x02e8('0x56')](_0x5f358d[_0x02e8('0x59')],{'raw':!![]})[_0x02e8('0x1c')](function(_0x358e24){_0x4e8af2=_0x358e24;return db[_0x02e8('0x37')][_0x02e8('0x50')]({'where':{'type':_0x5f358d[_0x02e8('0x59')]['type']},'raw':!![]});})[_0x02e8('0x1c')](function(_0x3a0006){if(_0x4e8af2[_0x02e8('0x3a')][_0x02e8('0x5a')]()==_0x02e8('0x5b')){var _0x1c5973=fs[_0x02e8('0x5c')](path['join'](config[_0x02e8('0x5d')],_0x02e8('0x5e')),_0x02e8('0x5f'));var _0x41055e=ejs[_0x02e8('0x60')](_0x1c5973,{'networks':_0x3a0006||[]});fs[_0x02e8('0x61')](_0x02e8('0x62'),_0x41055e);return respondWithRpcPromise(_0x02e8('0x63'),_0x02e8('0x56'),{'module':'res_stun_monitor.so'});}else if(_0x4e8af2['type'][_0x02e8('0x5a')]()==_0x02e8('0x64')){var _0x31fd5a=fs[_0x02e8('0x5c')](path[_0x02e8('0x65')](config['root'],_0x02e8('0x66')),_0x02e8('0x5f'));var _0x276a66=ejs[_0x02e8('0x60')](_0x31fd5a,{'networks':_0x3a0006||[]});fs[_0x02e8('0x61')](_0x02e8('0x67'),_0x276a66);return respondWithRpcPromise('Reload',_0x02e8('0x56'),{'module':_0x02e8('0x68')});}else{var _0x319674=fs['readFileSync'](path['join'](config[_0x02e8('0x5d')],_0x02e8('0x69')),_0x02e8('0x5f'));var _0x2b1cc3=ejs[_0x02e8('0x60')](_0x319674,{'networks':_0x3a0006||[]});fs[_0x02e8('0x61')](util[_0x02e8('0x6a')](_0x02e8('0x6b'),_0x5f358d[_0x02e8('0x59')][_0x02e8('0x3a')][_0x02e8('0x6c')]()),_0x2b1cc3);return respondWithRpcPromise(_0x02e8('0x63'),_0x02e8('0x56'),{'module':_0x02e8('0x6d')});}return null;})[_0x02e8('0x1c')](function(){return _0x4e8af2;});})[_0x02e8('0x1c')](respondWithResult(_0xd7209a,0xc9))[_0x02e8('0x51')](handleError(_0xd7209a,null));};exports['update']=function(_0x2a50c9,_0x2e1971,_0x427f70){var _0x50c9ac;return db[_0x02e8('0x57')][_0x02e8('0x58')](function(_0x59be6e){return db['Network'][_0x02e8('0x55')]({'where':{'id':_0x2a50c9[_0x02e8('0x53')]['id']}})['then'](handleEntityNotFound(_0x2e1971,null))['then'](saveUpdates(_0x2a50c9['body'],null))[_0x02e8('0x1c')](function(_0x676427){if(_0x676427){_0x50c9ac=_0x676427;return db['Network'][_0x02e8('0x50')]({'where':{'type':_0x50c9ac[_0x02e8('0x3a')]},'raw':!![]});}return null;})[_0x02e8('0x1c')](function(_0x59caa7){if(_0x50c9ac[_0x02e8('0x3a')][_0x02e8('0x5a')]()==_0x02e8('0x5b')){var _0x591329=fs[_0x02e8('0x5c')](path[_0x02e8('0x65')](config[_0x02e8('0x5d')],_0x02e8('0x5e')),'utf8');var _0x665e5c=ejs[_0x02e8('0x60')](_0x591329,{'networks':_0x59caa7||[]});fs[_0x02e8('0x61')](_0x02e8('0x62'),_0x665e5c);return respondWithRpcPromise(_0x02e8('0x63'),_0x02e8('0x31'),{'module':_0x02e8('0x68')});}else if(_0x50c9ac['type'][_0x02e8('0x5a')]()=='TURN'){var _0x1fc925=fs[_0x02e8('0x5c')](path[_0x02e8('0x65')](config['root'],_0x02e8('0x66')),'utf8');var _0x4a3378=ejs[_0x02e8('0x60')](_0x1fc925,{'networks':_0x59caa7||[]});fs[_0x02e8('0x61')](_0x02e8('0x67'),_0x4a3378);return respondWithRpcPromise(_0x02e8('0x63'),_0x02e8('0x31'),{'module':_0x02e8('0x68')});}else{var _0x37012a=fs[_0x02e8('0x5c')](path['join'](config[_0x02e8('0x5d')],_0x02e8('0x69')),_0x02e8('0x5f'));var _0x2fb8a0=ejs[_0x02e8('0x60')](_0x37012a,{'networks':_0x59caa7||[]});fs[_0x02e8('0x61')](util[_0x02e8('0x6a')](_0x02e8('0x6b'),_0x2a50c9['body'][_0x02e8('0x3a')][_0x02e8('0x6c')]()),_0x2fb8a0);return respondWithRpcPromise(_0x02e8('0x63'),_0x02e8('0x31'),{'module':_0x02e8('0x6d')});}return null;})[_0x02e8('0x1c')](function(_0xcea2ec){if(_0xcea2ec){return _0x50c9ac;}return null;});})[_0x02e8('0x1c')](respondWithResult(_0x2e1971,null))[_0x02e8('0x51')](handleError(_0x2e1971,null));};exports['destroy']=function(_0x122934,_0x48604f,_0x83517f){var _0x34b06e;return db[_0x02e8('0x37')][_0x02e8('0x55')]({'where':{'id':_0x122934[_0x02e8('0x53')]['id']}})[_0x02e8('0x1c')](function(_0x52edd8){_0x34b06e=_0x52edd8;return _0x52edd8;})[_0x02e8('0x1c')](handleEntityNotFound(_0x48604f,null))[_0x02e8('0x1c')](removeEntity(_0x48604f,null))[_0x02e8('0x1c')](function(){if(_0x34b06e){return db[_0x02e8('0x37')]['findAll']({'where':{'type':_0x34b06e['type']},'raw':!![]});}})['then'](function(_0x9be814){if(_0x34b06e[_0x02e8('0x3a')]['toUpperCase']()==_0x02e8('0x5b')){var _0x1a00e5=fs[_0x02e8('0x5c')](path[_0x02e8('0x65')](config[_0x02e8('0x5d')],_0x02e8('0x5e')),_0x02e8('0x5f'));var _0x262350=ejs[_0x02e8('0x60')](_0x1a00e5,{'networks':_0x9be814||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x262350);return respondWithRpcPromise('Reload',_0x02e8('0x32'),{'module':'res_stun_monitor.so'});}else if(_0x34b06e[_0x02e8('0x3a')][_0x02e8('0x5a')]()==_0x02e8('0x64')){var _0x276187=fs[_0x02e8('0x5c')](path[_0x02e8('0x65')](config['root'],_0x02e8('0x66')),_0x02e8('0x5f'));var _0x1748ed=ejs[_0x02e8('0x60')](_0x276187,{'networks':_0x9be814||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x1748ed);return respondWithRpcPromise('Reload',_0x02e8('0x32'),{'module':_0x02e8('0x68')});}else{var _0x55de1b=fs[_0x02e8('0x5c')](path[_0x02e8('0x65')](config[_0x02e8('0x5d')],_0x02e8('0x69')),_0x02e8('0x5f'));var _0x30f24f=ejs[_0x02e8('0x60')](_0x55de1b,{'networks':_0x9be814||[]});fs[_0x02e8('0x61')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x122934[_0x02e8('0x59')][_0x02e8('0x3a')][_0x02e8('0x6c')]()),_0x30f24f);return respondWithRpcPromise('Reload',_0x02e8('0x32'),{'module':_0x02e8('0x6d')});}return null;})[_0x02e8('0x51')](handleError(_0x48604f,null));}; \ No newline at end of file +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 diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index f0b9aed..e734e24 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 _0xe548=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','Network','network','lodash'];(function(_0x1738d9,_0x386f60){var _0xcb4fc0=function(_0x54f046){while(--_0x54f046){_0x1738d9['push'](_0x1738d9['shift']());}};_0xcb4fc0(++_0x386f60);}(_0xe548,0xef));var _0x8e54=function(_0x42a44a,_0x15ca12){_0x42a44a=_0x42a44a-0x0;var _0x1e6ab6=_0xe548[_0x42a44a];return _0x1e6ab6;};'use strict';var _=require(_0x8e54('0x0'));var util=require(_0x8e54('0x1'));var logger=require(_0x8e54('0x2'))(_0x8e54('0x3'));var moment=require(_0x8e54('0x4'));var BPromise=require(_0x8e54('0x5'));var rp=require(_0x8e54('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8e54('0x7'));var config=require(_0x8e54('0x8'));var attributes=require('./network.attributes');module['exports']=function(_0x405c6f,_0x15bc03){return _0x405c6f[_0x8e54('0x9')](_0x8e54('0xa'),attributes,{'tableName':_0x8e54('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index f0a67bb..5427319 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 _0x2e53=['Network,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2e53,0x125));var _0x32e5=function(_0x2e14bf,_0x3af516){_0x2e14bf=_0x2e14bf-0x0;var _0x1f7d7b=_0x2e53[_0x2e14bf];return _0x1f7d7b;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x32e5('0x0'));var rs=require(_0x32e5('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x32e5('0x2'))['db'];var utils=require(_0x32e5('0x3'));var logger=require(_0x32e5('0x4'))(_0x32e5('0x5'));var config=require(_0x32e5('0x6'));var jayson=require(_0x32e5('0x7'));var client=jayson[_0x32e5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x159603,_0x44f128,_0x82aab7){return new BPromise(function(_0x6b0d1e,_0x183670){return client[_0x32e5('0x9')](_0x159603,_0x82aab7)[_0x32e5('0xa')](function(_0x5acab3){logger[_0x32e5('0xb')](_0x32e5('0xc'),_0x44f128,_0x32e5('0xd'));logger[_0x32e5('0xe')](_0x32e5('0xf'),_0x44f128,'request\x20sent',JSON[_0x32e5('0x10')](_0x5acab3));if(_0x5acab3['error']){if(_0x5acab3['error'][_0x32e5('0x11')]===0x1f4){logger['error'](_0x32e5('0xc'),_0x44f128,_0x5acab3[_0x32e5('0x12')][_0x32e5('0x13')]);return _0x183670(_0x5acab3['error']['message']);}logger[_0x32e5('0x12')](_0x32e5('0xc'),_0x44f128,_0x5acab3[_0x32e5('0x12')][_0x32e5('0x13')]);return _0x6b0d1e(_0x5acab3[_0x32e5('0x12')]['message']);}else{logger[_0x32e5('0xb')]('Network,\x20%s,\x20%s',_0x44f128,_0x32e5('0xd'));_0x6b0d1e(_0x5acab3[_0x32e5('0x14')]['message']);}})[_0x32e5('0x15')](function(_0x583f5b){logger[_0x32e5('0x12')]('Network,\x20%s,\x20%s',_0x44f128,_0x583f5b);_0x183670(_0x583f5b);});});} \ No newline at end of file +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 diff --git a/server/api/notification/index.js b/server/api/notification/index.js index 47f269a..f2007d1 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 _0x5040=['../../components/interaction/service','../../config/environment','./notification.controller','post','isAuthenticated','sendNotification','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x1cd8ed,_0x16aed0){var _0x259a1d=function(_0x3bcb0e){while(--_0x3bcb0e){_0x1cd8ed['push'](_0x1cd8ed['shift']());}};_0x259a1d(++_0x16aed0);}(_0x5040,0xd2));var _0x0504=function(_0x58bdaa,_0x4891f3){_0x58bdaa=_0x58bdaa-0x0;var _0x4d7547=_0x5040[_0x58bdaa];return _0x4d7547;};'use strict';var multer=require('multer');var util=require(_0x0504('0x0'));var path=require(_0x0504('0x1'));var timeout=require(_0x0504('0x2'));var express=require(_0x0504('0x3'));var router=express[_0x0504('0x4')]();var auth=require(_0x0504('0x5'));var interaction=require(_0x0504('0x6'));var config=require(_0x0504('0x7'));var controller=require(_0x0504('0x8'));router[_0x0504('0x9')]('/',auth[_0x0504('0xa')](),controller[_0x0504('0xb')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index fbc7523..8b15b2c 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 _0x879c=['STRING','sequelize','TEXT'];(function(_0x55d9f8,_0x32dfd4){var _0x4be05d=function(_0xfed9a2){while(--_0xfed9a2){_0x55d9f8['push'](_0x55d9f8['shift']());}};_0x4be05d(++_0x32dfd4);}(_0x879c,0x112));var _0xc879=function(_0x31e2a0,_0x3ddfaa){_0x31e2a0=_0x31e2a0-0x0;var _0x1e9de2=_0x879c[_0x31e2a0];return _0x1e9de2;};'use strict';var Sequelize=require(_0xc879('0x0'));module['exports']={'body':{'type':Sequelize[_0xc879('0x1')]},'senderName':{'type':Sequelize[_0xc879('0x2')]},'recipientsId':{'type':Sequelize[_0xc879('0x1')]},'recipientsDescription':{'type':Sequelize[_0xc879('0x2')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +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 diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index 03afbf9..b18b31c 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 _0x1797=['end','status','json','count','offset','set','Content-Range','apply','reject','save','then','error','name','body','hasOwnProperty','text','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','ValidationError','Sequelize','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','isEmpty','beep','recipientsId','join','sequelize','transaction','Notification','create','recipient','emit','Template','findOne','html','render','view','catch','forEach','startCase','User','replace','queue','Queue','ids','all','union','flatten','getAgents','map','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus'];(function(_0x5bc28b,_0x5bf1a0){var _0x27a1d9=function(_0x383423){while(--_0x383423){_0x5bc28b['push'](_0x5bc28b['shift']());}};_0x27a1d9(++_0x5bf1a0);}(_0x1797,0xa5));var _0x7179=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x1797[_0x580576];return _0x3f55a0;};'use strict';var pdf=require(_0x7179('0x0'));var emlformat=require(_0x7179('0x1'));var rimraf=require(_0x7179('0x2'));var zipdir=require(_0x7179('0x3'));var jsonpatch=require(_0x7179('0x4'));var rp=require(_0x7179('0x5'));var moment=require('moment');var BPromise=require(_0x7179('0x6'));var Mustache=require('mustache');var util=require(_0x7179('0x7'));var path=require(_0x7179('0x8'));var sox=require(_0x7179('0x9'));var csv=require(_0x7179('0xa'));var ejs=require(_0x7179('0xb'));var fs=require('fs');var _=require(_0x7179('0xc'));var squel=require(_0x7179('0xd'));var crypto=require(_0x7179('0xe'));var jsforce=require(_0x7179('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7179('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7179('0x10'));var authService=require(_0x7179('0x11'));var qs=require(_0x7179('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7179('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x7179('0x14'));var config=require(_0x7179('0x15'));var db=require(_0x7179('0x16'))['db'];config[_0x7179('0x17')]=_[_0x7179('0x18')](config[_0x7179('0x17')],{'host':_0x7179('0x19'),'port':0x18eb});var socket=require(_0x7179('0x1a'))(new Redis(config[_0x7179('0x17')]));require('./notification.socket')[_0x7179('0x1b')](socket);function respondWithStatusCode(_0x4298d1,_0x4bd262){_0x4bd262=_0x4bd262||0xcc;return function(_0x45aecd){if(_0x45aecd){return _0x4298d1[_0x7179('0x1c')](_0x4bd262);}return _0x4298d1['status'](_0x4bd262)[_0x7179('0x1d')]();};}function respondWithResult(_0x1c9ec9,_0x367446){_0x367446=_0x367446||0xc8;return function(_0x22b7cc){if(_0x22b7cc){return _0x1c9ec9[_0x7179('0x1e')](_0x367446)[_0x7179('0x1f')](_0x22b7cc);}};}function respondWithFilteredResult(_0x12ccf2,_0x3751d9){return function(_0x15f83c){if(_0x15f83c){var _0x55cc0b=_0x15f83c[_0x7179('0x20')],_0x38b9a6=_0x3751d9[_0x7179('0x21')],_0x393895=_0x3751d9[_0x7179('0x21')]+_0x3751d9['limit'],_0x194bc0;if(_0x393895>=_0x55cc0b){_0x393895=_0x55cc0b;_0x194bc0=0xc8;}else{_0x194bc0=0xce;}_0x12ccf2[_0x7179('0x1e')](_0x194bc0);return _0x12ccf2[_0x7179('0x22')](_0x7179('0x23'),_0x38b9a6+'-'+_0x393895+'/'+_0x55cc0b)[_0x7179('0x1f')](_0x15f83c);}return null;};}function patchUpdates(_0xf898e0){return function(_0x40d099){try{jsonpatch[_0x7179('0x24')](_0x40d099,_0xf898e0,!![]);}catch(_0x5e4560){return BPromise[_0x7179('0x25')](_0x5e4560);}return _0x40d099[_0x7179('0x26')]();};}function saveUpdates(_0x193bcb,_0x36865d){return function(_0x193899){if(_0x193899){return _0x193899['update'](_0x193bcb)[_0x7179('0x27')](function(_0x3b72ed){return _0x3b72ed;});}return null;};}function removeEntity(_0x3b6d1f,_0x5e4af3){return function(_0x3adb0d){if(_0x3adb0d){return _0x3adb0d['destroy']()[_0x7179('0x27')](function(){_0x3b6d1f[_0x7179('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x190d2a,_0x204c84){return function(_0x1dcb0d){if(!_0x1dcb0d){_0x190d2a[_0x7179('0x1c')](0x194);}return _0x1dcb0d;};}function handleError(_0x2d85f1,_0x53d7d0){_0x53d7d0=_0x53d7d0||0x1f4;return function(_0x12862e){logger[_0x7179('0x28')](_0x12862e['stack']);if(_0x12862e[_0x7179('0x29')]){delete _0x12862e[_0x7179('0x29')];}_0x2d85f1[_0x7179('0x1e')](_0x53d7d0)['send'](_0x12862e);};}exports['sendNotification']=function(_0x2955c8,_0xe18885,_0x53ae32){if(!_0x2955c8[_0x7179('0x2a')][_0x7179('0x2b')](_0x7179('0x2c'))&&!_0x2955c8['body'][_0x7179('0x2b')]('TemplateId')){throw new db['Sequelize']['ValidationError'](_0x7179('0x2d'));}else{if(_0x2955c8['body'][_0x7179('0x2b')](_0x7179('0x2e'))&&!_0x2955c8[_0x7179('0x2a')][_0x7179('0x2b')]('view')){throw new db['Sequelize'][(_0x7179('0x2f'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x2955c8[_0x7179('0x2a')][_0x7179('0x2b')]('recipients')){throw new db[(_0x7179('0x30'))][(_0x7179('0x2f'))](_0x7179('0x31'));}else{try{var _0x121646=JSON[_0x7179('0x32')](_0x2955c8[_0x7179('0x2a')][_0x7179('0x33')]);}catch(_0x1c9873){logger[_0x7179('0x28')](_0x1c9873);throw new db[(_0x7179('0x30'))][(_0x7179('0x2f'))](_0x7179('0x34'));}var _0x4889c3=[_0x7179('0x35'),_0x7179('0x36'),_0x7179('0x37'),_0x7179('0x38'),_0x7179('0x39'),_0x7179('0x3a'),_0x7179('0x3b'),_0x7179('0x3c'),'user'];if(_[_0x7179('0x3d')](_0x121646,function(_0x49139c){return!_[_0x7179('0x3e')](_0x4889c3,_0x49139c[_0x7179('0x3f')]['toLowerCase']());})){throw new db['Sequelize'][(_0x7179('0x2f'))](_0x7179('0x40'));}}}var _0x2601cf={};_0x2601cf[_0x7179('0x41')]=_0x2955c8['body'][_0x7179('0x2b')](_0x7179('0x41'))?_0x2955c8[_0x7179('0x2a')][_0x7179('0x41')]:_0x2955c8[_0x7179('0x42')][_0x7179('0x43')];_0x2601cf[_0x7179('0x44')]=_[_0x7179('0x45')](_0x2955c8['body'][_0x7179('0x44')])?null:_0x2955c8[_0x7179('0x2a')]['recipientsDescription'];_0x2601cf[_0x7179('0x46')]=_0x2955c8['body'][_0x7179('0x46')]||![];_0x2601cf['SenderId']=_0x2955c8[_0x7179('0x42')]['id'];return getContent(_0x2955c8[_0x7179('0x2a')])[_0x7179('0x27')](function(_0x560aef){_0x2601cf[_0x7179('0x2a')]=_0x560aef;return getRecipients(_0x121646);})[_0x7179('0x27')](function(_0x44d6a2){_0x2601cf[_0x7179('0x47')]=_['sortBy'](_0x44d6a2)[_0x7179('0x48')](',');return db[_0x7179('0x49')][_0x7179('0x4a')](function(_0x1ea1f3){return db[_0x7179('0x4b')][_0x7179('0x4c')](_0x2601cf,{'raw':!![],'transaction':_0x1ea1f3})['then'](function(_0x192160){var _0x1bff9c={'sender':_0x2601cf[_0x7179('0x41')],'description':_0x2601cf[_0x7179('0x44')],'content':_0x2601cf[_0x7179('0x2a')],'beep':_0x2601cf[_0x7179('0x46')]};_0x44d6a2['forEach'](function(_0x2d20ce){_0x1bff9c[_0x7179('0x4d')]=_0x2d20ce;socket[_0x7179('0x4e')]('notification:send',_0x1bff9c);});return _0x192160;});});})[_0x7179('0x27')](respondWithResult(_0xe18885,0xc9))['catch'](handleError(_0xe18885,null));};function getContent(_0x3e2f6c){return new BPromise(function(_0x3376bb,_0x248f93){if(_0x3e2f6c[_0x7179('0x2c')]){_0x3376bb(_0x3e2f6c[_0x7179('0x2c')]);return;}return db[_0x7179('0x4f')][_0x7179('0x50')]({'attributes':[_0x7179('0x51')],'where':{'id':_0x3e2f6c[_0x7179('0x2e')]},'raw':!![]})[_0x7179('0x27')](function(_0x41af26){if(!_0x41af26)throw new db['Sequelize'][(_0x7179('0x2f'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x17b3d7=Mustache[_0x7179('0x52')](_0x41af26[_0x7179('0x51')],_0x3e2f6c[_0x7179('0x53')]);_0x3376bb(_0x17b3d7);})[_0x7179('0x54')](function(_0x8cc26e){_0x248f93(_0x8cc26e);});});}function getRecipients(_0x30332c){return new BPromise(function(_0x2c9e90,_0x2db15e){var _0x53276a=[];var _0x4c916b=[];_0x30332c[_0x7179('0x55')](function(_0x473d06){var _0x2fbf32=_[_0x7179('0x56')](_0x473d06[_0x7179('0x3f')]['toLowerCase']());if(_0x2fbf32===_0x7179('0x57')){_0x53276a=_['union'](_0x53276a,_0x473d06['ids']);}else{if(_[_0x7179('0x3e')](_0x2fbf32,'queue'))_0x2fbf32=_0x2fbf32[_0x7179('0x58')](_0x7179('0x59'),_0x7179('0x5a'));_0x473d06[_0x7179('0x5b')][_0x7179('0x55')](function(_0x183165){_0x4c916b['push'](getAgents(_0x2fbf32,_0x183165));});}});return BPromise[_0x7179('0x5c')](_0x4c916b)['then'](function(_0x16c6a8){_0x53276a=_[_0x7179('0x5d')](_0x53276a,_[_0x7179('0x5e')](_0x16c6a8));_0x2c9e90(_0x53276a);})['catch'](function(_0x1028d7){_0x2db15e(_0x1028d7);});});}function getAgents(_0x3aac6c,_0x3cf0b9){return new BPromise(function(_0x31b155,_0x2c316f){return db[_0x3aac6c][_0x7179('0x50')]({'where':{'id':_0x3cf0b9}})[_0x7179('0x27')](function(_0x1d5448){return _0x1d5448[_0x7179('0x5f')]({'attributes':['id'],'raw':!![]})[_0x7179('0x27')](function(_0x3ccaaf){var _0x4efdc4=_[_0x7179('0x60')](_0x3ccaaf,'id');_0x31b155(_0x4efdc4);});})[_0x7179('0x54')](function(_0x24520a){_0x2c316f(_0x24520a);});});} \ No newline at end of file +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 diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index 4d5d7e7..2a45b10 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(_0x1a8ff3,_0xf5dbee){var _0x16278b=function(_0x5c17a0){while(--_0x5c17a0){_0x1a8ff3['push'](_0x1a8ff3['shift']());}};_0x16278b(++_0xf5dbee);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x5f66[_0x5d4607];return _0x5e4a86;};'use strict';var EventEmitter=require('events');var Notification=require(_0x65f6('0x0'))['db']['Notification'];var NotificationEvents=new EventEmitter();NotificationEvents[_0x65f6('0x1')](0x0);var events={'afterCreate':_0x65f6('0x2'),'afterUpdate':_0x65f6('0x3'),'afterDestroy':_0x65f6('0x4')};function emitEvent(_0x1a330c){return function(_0x5eb9ad,_0x3c5029,_0x5150c8){NotificationEvents[_0x65f6('0x5')](_0x1a330c+':'+_0x5eb9ad['id'],_0x5eb9ad);NotificationEvents[_0x65f6('0x5')](_0x1a330c,_0x5eb9ad);_0x5150c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Notification['hook'](e,emitEvent(event));}}module[_0x65f6('0x6')]=NotificationEvents; \ No newline at end of file +var _0x5f66=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_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 diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index 3174a22..f01b31f 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 _0x2fcb=['./notification.attributes','exports','Notification','notifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x175d8a,_0x146a89){var _0x408dfc=function(_0x358323){while(--_0x358323){_0x175d8a['push'](_0x175d8a['shift']());}};_0x408dfc(++_0x146a89);}(_0x2fcb,0x180));var _0xb2fc=function(_0x20aaef,_0x1e9eb8){_0x20aaef=_0x20aaef-0x0;var _0x1cca9d=_0x2fcb[_0x20aaef];return _0x1cca9d;};'use strict';var _=require(_0xb2fc('0x0'));var util=require(_0xb2fc('0x1'));var logger=require(_0xb2fc('0x2'))(_0xb2fc('0x3'));var moment=require('moment');var BPromise=require(_0xb2fc('0x4'));var rp=require(_0xb2fc('0x5'));var fs=require('fs');var path=require(_0xb2fc('0x6'));var rimraf=require(_0xb2fc('0x7'));var config=require('../../config/environment');var attributes=require(_0xb2fc('0x8'));module[_0xb2fc('0x9')]=function(_0x53aebc,_0x10b2bd){return _0x53aebc['define'](_0xb2fc('0xa'),attributes,{'tableName':_0xb2fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb2fc('0xc'),'collate':_0xb2fc('0xd')});}; \ No newline at end of file +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 diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index 436fcfa..b4f38fb 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 _0x4022=['randomstring','../../mysqldb','../../config/utils','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./notification.socket','request','then','Notification,\x20%s,\x20%s','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x72bd5e,_0x3cddb8){var _0x19d8ad=function(_0x3ea5f2){while(--_0x3ea5f2){_0x72bd5e['push'](_0x72bd5e['shift']());}};_0x19d8ad(++_0x3cddb8);}(_0x4022,0x134));var _0x2402=function(_0xb1afd3,_0x225f25){_0xb1afd3=_0xb1afd3-0x0;var _0x159a52=_0x4022[_0xb1afd3];return _0x159a52;};'use strict';var _=require(_0x2402('0x0'));var util=require(_0x2402('0x1'));var moment=require(_0x2402('0x2'));var BPromise=require(_0x2402('0x3'));var rs=require(_0x2402('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2402('0x5'))['db'];var utils=require(_0x2402('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x2402('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2402('0x8')]['http']({'port':0x232a});config[_0x2402('0x9')]=_[_0x2402('0xa')](config[_0x2402('0x9')],{'host':_0x2402('0xb'),'port':0x18eb});var socket=require(_0x2402('0xc'))(new Redis(config['redis']));require(_0x2402('0xd'))['register'](socket);function respondWithRpcPromise(_0x418cd3,_0x53e697,_0x4dd8c2){return new BPromise(function(_0x19ac51,_0x3321c1){return client[_0x2402('0xe')](_0x418cd3,_0x4dd8c2)[_0x2402('0xf')](function(_0x5a7c96){logger['info'](_0x2402('0x10'),_0x53e697,_0x2402('0x11'));logger[_0x2402('0x12')](_0x2402('0x13'),_0x53e697,'request\x20sent',JSON[_0x2402('0x14')](_0x5a7c96));if(_0x5a7c96['error']){if(_0x5a7c96['error'][_0x2402('0x15')]===0x1f4){logger[_0x2402('0x16')](_0x2402('0x10'),_0x53e697,_0x5a7c96[_0x2402('0x16')][_0x2402('0x17')]);return _0x3321c1(_0x5a7c96[_0x2402('0x16')][_0x2402('0x17')]);}logger[_0x2402('0x16')]('Notification,\x20%s,\x20%s',_0x53e697,_0x5a7c96[_0x2402('0x16')][_0x2402('0x17')]);return _0x19ac51(_0x5a7c96['error'][_0x2402('0x17')]);}else{logger['info']('Notification,\x20%s,\x20%s',_0x53e697,_0x2402('0x11'));_0x19ac51(_0x5a7c96[_0x2402('0x18')][_0x2402('0x17')]);}})[_0x2402('0x19')](function(_0x3d60c7){logger['error'](_0x2402('0x10'),_0x53e697,_0x3d60c7);_0x3321c1(_0x3d60c7);});});} \ No newline at end of file +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 diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index e76d8f5..ccc1c42 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 _0x464a=['save','remove','update','emit','removeListener','length','notification:'];(function(_0x58a918,_0x2d59ef){var _0x1f4cc3=function(_0x517d9c){while(--_0x517d9c){_0x58a918['push'](_0x58a918['shift']());}};_0x1f4cc3(++_0x2d59ef);}(_0x464a,0x16c));var _0xa464=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x464a[_0x501510];return _0x1e6ee5;};'use strict';var NotificationEvents=require('./notification.events');var events=[_0xa464('0x0'),_0xa464('0x1'),_0xa464('0x2')];function createListener(_0xc6873d,_0xe2d25a){return function(_0x29f1d6){_0xe2d25a[_0xa464('0x3')](_0xc6873d,_0x29f1d6);};}function removeListener(_0x11e9a3,_0x4b0ba8){return function(){NotificationEvents[_0xa464('0x4')](_0x11e9a3,_0x4b0ba8);};}exports['register']=function(_0x47b760){for(var _0x5f1c68=0x0,_0x26c722=events[_0xa464('0x5')];_0x5f1c68<_0x26c722;_0x5f1c68++){var _0x21bc2b=events[_0x5f1c68];var _0x4ce557=createListener(_0xa464('0x6')+_0x21bc2b,_0x47b760);NotificationEvents['on'](_0x21bc2b,_0x4ce557);}}; \ No newline at end of file +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 diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 7fee47b..832606c 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 _0x5e91=['getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','/:id/notify','notify','/:id/applications','addApplications','/:id/users','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions'];(function(_0x158269,_0x1d5a13){var _0x48fd39=function(_0x36072c){while(--_0x36072c){_0x158269['push'](_0x158269['shift']());}};_0x48fd39(++_0x1d5a13);}(_0x5e91,0x16a));var _0x15e9=function(_0x42c56b,_0x58ae76){_0x42c56b=_0x42c56b-0x0;var _0x13f59d=_0x5e91[_0x42c56b];return _0x13f59d;};'use strict';var multer=require(_0x15e9('0x0'));var util=require('util');var path=require(_0x15e9('0x1'));var timeout=require(_0x15e9('0x2'));var express=require(_0x15e9('0x3'));var router=express['Router']();var auth=require(_0x15e9('0x4'));var interaction=require(_0x15e9('0x5'));var config=require(_0x15e9('0x6'));var controller=require('./openchannelAccount.controller');router[_0x15e9('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x15e9('0x7')](_0x15e9('0x8'),auth[_0x15e9('0x9')](),controller[_0x15e9('0xa')]);router['get'](_0x15e9('0xb'),auth[_0x15e9('0x9')](),controller['show']);router['get']('/:id/dispositions',auth[_0x15e9('0x9')](),controller[_0x15e9('0xc')]);router[_0x15e9('0x7')](_0x15e9('0xd'),auth[_0x15e9('0x9')](),controller[_0x15e9('0xe')]);router[_0x15e9('0x7')]('/:id/applications',auth[_0x15e9('0x9')](),controller[_0x15e9('0xf')]);router[_0x15e9('0x7')](_0x15e9('0x10'),auth[_0x15e9('0x9')](),controller[_0x15e9('0x11')]);router[_0x15e9('0x7')]('/:id/users',auth[_0x15e9('0x9')](),controller[_0x15e9('0x12')]);router[_0x15e9('0x13')]('/',auth['isAuthenticated'](),controller[_0x15e9('0x14')]);router['post'](_0x15e9('0x15'),auth[_0x15e9('0x9')](),controller[_0x15e9('0x16')]);router[_0x15e9('0x13')](_0x15e9('0xd'),auth[_0x15e9('0x9')](),controller[_0x15e9('0x17')]);router[_0x15e9('0x13')](_0x15e9('0x18'),controller[_0x15e9('0x19')]);router['post'](_0x15e9('0x1a'),auth['isAuthenticated'](),controller[_0x15e9('0x1b')]);router[_0x15e9('0x13')](_0x15e9('0x1c'),auth[_0x15e9('0x9')](),controller[_0x15e9('0x1d')]);router[_0x15e9('0x13')]('/:id/send',auth['isAuthenticated'](),controller['send']);router[_0x15e9('0x1e')]('/:id',auth[_0x15e9('0x9')](),controller[_0x15e9('0x1f')]);router['delete'](_0x15e9('0xb'),auth[_0x15e9('0x9')](),controller[_0x15e9('0x20')]);router[_0x15e9('0x21')](_0x15e9('0x15'),auth[_0x15e9('0x9')](),controller[_0x15e9('0x22')]);router['delete'](_0x15e9('0xd'),auth[_0x15e9('0x9')](),controller[_0x15e9('0x23')]);router[_0x15e9('0x21')]('/:id/users',auth[_0x15e9('0x9')](),controller[_0x15e9('0x24')]);module[_0x15e9('0x25')]=router; \ No newline at end of file +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 diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index ba1cd57..73b652f 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 _0xceee=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','name','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x47cb0a,_0x55c798){var _0x1ba111=function(_0x384ae6){while(--_0x384ae6){_0x47cb0a['push'](_0x47cb0a['shift']());}};_0x1ba111(++_0x55c798);}(_0xceee,0x9e));var _0xecee=function(_0x14306a,_0x1fcadd){_0x14306a=_0x14306a-0x0;var _0x5b2329=_0xceee[_0x14306a];return _0x5b2329;};'use strict';var Sequelize=require(_0xecee('0x0'));var rs=require(_0xecee('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xecee('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xecee('0x3')],'defaultValue':function(){return rs[_0xecee('0x4')]();}},'replyUri':{'type':Sequelize[_0xecee('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xecee('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xecee('0x5')],'defaultValue':function(){return _0xecee('0x6');}},'notificationSound':{'type':Sequelize[_0xecee('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xecee('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xecee('0x3')]},'queueTransfer':{'type':Sequelize[_0xecee('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xecee('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xecee('0x9'),'set':function(_0x58eb73){if(!_0x58eb73)this[_0xecee('0xa')](_0xecee('0xb'),null);this[_0xecee('0xa')](_0xecee('0xc'),_0x58eb73);}}}; \ No newline at end of file +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 diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 4da938c..f636e18 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 _0xf0da=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','describe','addDisposition','Disposition','findOne','fields','nolimit','pick','OpenchannelAccountId','findAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','notify','openchannel','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','isNil','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','List','Contacts','DESC','OpenchannelApplication','account','applications','Applications','list','priority','ListId','contact','firstName','threadId','externalUrl','OpenchannelInteraction','spread','lastName','messageId','interaction','push','close','*,*,*,*','OpenchannelMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','bulkCreate','findAndCountAll','getApplications','getInteractions','Owner','fullname','Tag','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','send','body\x20is\x20mandatory\x20and\x20not\x20empty','out','dataValues','Messages','html-pdf','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','client','http','test','Sequelize','ValidationError','request','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','Content-Range','apply','update','then','end','name','mandatoryDispositionPause','rawAttributes','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','limit','order','sort','where','filter','merge','map','type','VIRTUAL','options','OpenchannelAccount','includeAll','include','show','params','Pause','find','create','user','get'];(function(_0xd0265,_0x5172fa){var _0x58e79c=function(_0x133167){while(--_0x133167){_0xd0265['push'](_0xd0265['shift']());}};_0x58e79c(++_0x5172fa);}(_0xf0da,0x114));var _0xaf0d=function(_0xcb15ef,_0x3355b0){_0xcb15ef=_0xcb15ef-0x0;var _0x214428=_0xf0da[_0xcb15ef];return _0x214428;};'use strict';var pdf=require(_0xaf0d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xaf0d('0x1'));var zipdir=require(_0xaf0d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf0d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xaf0d('0x4'));var util=require(_0xaf0d('0x5'));var path=require(_0xaf0d('0x6'));var sox=require(_0xaf0d('0x7'));var csv=require(_0xaf0d('0x8'));var ejs=require(_0xaf0d('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xaf0d('0xa'));var crypto=require(_0xaf0d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xaf0d('0xc'));var toCsv=require(_0xaf0d('0x8'));var querystring=require(_0xaf0d('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaf0d('0xe'));var qs=require(_0xaf0d('0xf'));var as=require(_0xaf0d('0x10'));var hardwareService=require(_0xaf0d('0x11'));var logger=require(_0xaf0d('0x12'))(_0xaf0d('0x13'));var utils=require(_0xaf0d('0x14'));var config=require(_0xaf0d('0x15'));var db=require(_0xaf0d('0x16'))['db'];config[_0xaf0d('0x17')]=_[_0xaf0d('0x18')](config[_0xaf0d('0x17')],{'host':_0xaf0d('0x19'),'port':0x18eb});var socket=require(_0xaf0d('0x1a'))(new Redis(config[_0xaf0d('0x17')]));require(_0xaf0d('0x1b'))[_0xaf0d('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xaf0d('0x1d')][_0xaf0d('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x2fe8f3,_0x4d83de,_0x4a7d46){if(_0x4a7d46){var _0x340a7a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x340a7a[_0xaf0d('0x1f')](_0x4d83de)){return _0x2fe8f3;}else{throw new db[(_0xaf0d('0x20'))][(_0xaf0d('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 _0x2fe8f3;}}function respondWithRpcPromise(_0x5da501,_0xae1047,_0x4e0db7,_0x2b16ec){return new BPromise(function(_0x575d87,_0x3dffe7){var _0x12d769=_0x2b16ec||client;return _0x12d769[_0xaf0d('0x22')](_0x5da501,_0x4e0db7)['then'](function(_0x5ca016){logger[_0xaf0d('0x23')](_0xaf0d('0x24'),_0xae1047,'request\x20sent');logger[_0xaf0d('0x25')](_0xaf0d('0x26'),_0xae1047,_0xaf0d('0x27'),JSON[_0xaf0d('0x28')](_0x5ca016));if(_0x5ca016[_0xaf0d('0x29')]){if(_0x5ca016[_0xaf0d('0x29')][_0xaf0d('0x2a')]===0x1f4){logger[_0xaf0d('0x29')](_0xaf0d('0x24'),_0xae1047,_0x5ca016[_0xaf0d('0x29')]['message']);return _0x3dffe7(_0x5ca016['error']['message']);}logger[_0xaf0d('0x29')]('OpenchannelAccount,\x20%s,\x20%s',_0xae1047,_0x5ca016[_0xaf0d('0x29')][_0xaf0d('0x2b')]);return _0x575d87(_0x5ca016['error'][_0xaf0d('0x2b')]);}else{logger[_0xaf0d('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0xae1047,_0xaf0d('0x27'));_0x575d87(_0x5ca016[_0xaf0d('0x2c')][_0xaf0d('0x2b')]);}})[_0xaf0d('0x2d')](function(_0x16c9e3){logger[_0xaf0d('0x29')]('OpenchannelAccount,\x20%s,\x20%s',_0xae1047,_0x16c9e3);_0x3dffe7(_0x16c9e3);});});}function respondWithStatusCode(_0x25d960,_0x35382c){_0x35382c=_0x35382c||0xcc;return function(_0xd01cf8){if(_0xd01cf8){return _0x25d960[_0xaf0d('0x2e')](_0x35382c);}return _0x25d960['status'](_0x35382c)['end']();};}function respondWithResult(_0x2919a5,_0x51d32d){_0x51d32d=_0x51d32d||0xc8;return function(_0x268f8a){if(_0x268f8a){return _0x2919a5[_0xaf0d('0x2f')](_0x51d32d)[_0xaf0d('0x30')](_0x268f8a);}};}function respondWithFilteredResult(_0x241ca2,_0x1c23dc){return function(_0x5b17e1){if(_0x5b17e1){var _0xee7adb=_0x5b17e1[_0xaf0d('0x31')],_0x1e817c=_0x1c23dc[_0xaf0d('0x32')],_0x51aab0=_0x1c23dc[_0xaf0d('0x32')]+_0x1c23dc['limit'],_0x111932;if(_0x51aab0>=_0xee7adb){_0x51aab0=_0xee7adb;_0x111932=0xc8;}else{_0x111932=0xce;}_0x241ca2[_0xaf0d('0x2f')](_0x111932);return _0x241ca2['set'](_0xaf0d('0x33'),_0x1e817c+'-'+_0x51aab0+'/'+_0xee7adb)['json'](_0x5b17e1);}return null;};}function patchUpdates(_0x365f6a){return function(_0x37e05a){try{jsonpatch[_0xaf0d('0x34')](_0x37e05a,_0x365f6a,!![]);}catch(_0x1c6323){return BPromise['reject'](_0x1c6323);}return _0x37e05a['save']();};}function saveUpdates(_0x4d7dcf,_0x2c3ee0){return function(_0x2fdb15){if(_0x2fdb15){return _0x2fdb15[_0xaf0d('0x35')](_0x4d7dcf)['then'](function(_0x218b78){return _0x218b78;});}return null;};}function removeEntity(_0x53467b,_0x59f994){return function(_0x104ebb){if(_0x104ebb){return _0x104ebb['destroy']()['then'](function(){var _0x4063fe=_0x104ebb['get']({'plain':!![]});var _0x250a13='OpenchannelAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x250a13,'resourceId':_0x4063fe['id']}})[_0xaf0d('0x36')](function(){return _0x104ebb;});})['then'](function(){_0x53467b['status'](0xcc)[_0xaf0d('0x37')]();});}};}function handleEntityNotFound(_0x56665a,_0x1bab57){return function(_0x4e6aec){if(!_0x4e6aec){_0x56665a[_0xaf0d('0x2e')](0x194);}return _0x4e6aec;};}function handleError(_0x283bab,_0x509c01){_0x509c01=_0x509c01||0x1f4;return function(_0xe39e90){logger[_0xaf0d('0x29')](_0xe39e90['stack']);if(_0xe39e90[_0xaf0d('0x38')]){delete _0xe39e90[_0xaf0d('0x38')];}_0x283bab[_0xaf0d('0x2f')](_0x509c01)['send'](_0xe39e90);};}exports['index']=function(_0x423427,_0x197d5b){var _0x3e63c6={'include':[{'model':db['Pause'],'as':_0xaf0d('0x39')}]},_0xd101d5={},_0x5ce6b8={'count':0x0,'rows':[]};var _0x383e63=_['map'](db['OpenchannelAccount'][_0xaf0d('0x3a')],function(_0x57fbb3){return{'name':_0x57fbb3['fieldName'],'type':_0x57fbb3['type'][_0xaf0d('0x3b')]};});_0xd101d5[_0xaf0d('0x3c')]=_['map'](_0x383e63,_0xaf0d('0x38'));_0xd101d5['query']=_[_0xaf0d('0x3d')](_0x423427[_0xaf0d('0x3e')]);_0xd101d5[_0xaf0d('0x3f')]=_[_0xaf0d('0x40')](_0xd101d5[_0xaf0d('0x3c')],_0xd101d5['query']);_0x3e63c6[_0xaf0d('0x41')]=_['intersection'](_0xd101d5[_0xaf0d('0x3c')],qs['fields'](_0x423427['query']['fields']));_0x3e63c6[_0xaf0d('0x41')]=_0x3e63c6['attributes'][_0xaf0d('0x42')]?_0x3e63c6[_0xaf0d('0x41')]:_0xd101d5['model'];if(!_0x423427[_0xaf0d('0x3e')][_0xaf0d('0x43')]('nolimit')){_0x3e63c6['limit']=qs[_0xaf0d('0x44')](_0x423427['query'][_0xaf0d('0x44')]);_0x3e63c6[_0xaf0d('0x32')]=qs[_0xaf0d('0x32')](_0x423427['query'][_0xaf0d('0x32')]);}_0x3e63c6[_0xaf0d('0x45')]=qs[_0xaf0d('0x46')](_0x423427[_0xaf0d('0x3e')][_0xaf0d('0x46')]);_0x3e63c6[_0xaf0d('0x47')]=qs[_0xaf0d('0x3f')](_['pick'](_0x423427[_0xaf0d('0x3e')],_0xd101d5[_0xaf0d('0x3f')]));if(_0x423427[_0xaf0d('0x3e')][_0xaf0d('0x48')]){_0x3e63c6['where']=_[_0xaf0d('0x49')](_0x3e63c6[_0xaf0d('0x47')],{'$or':_[_0xaf0d('0x4a')](_0x383e63,function(_0xa93c6d){if(_0xa93c6d[_0xaf0d('0x4b')]!==_0xaf0d('0x4c')){var _0x50fade={};_0x50fade[_0xa93c6d[_0xaf0d('0x38')]]={'$like':'%'+_0x423427[_0xaf0d('0x3e')]['filter']+'%'};return _0x50fade;}})});}_0x3e63c6=_['merge']({},_0x3e63c6,_0x423427[_0xaf0d('0x4d')]);var _0x13522c={'where':_0x3e63c6[_0xaf0d('0x47')]};return db[_0xaf0d('0x4e')]['count'](_0x13522c)[_0xaf0d('0x36')](function(_0x13d1f1){_0x5ce6b8[_0xaf0d('0x31')]=_0x13d1f1;if(_0x423427['query'][_0xaf0d('0x4f')]){_0x3e63c6[_0xaf0d('0x50')]=[{'all':!![]}];}return db[_0xaf0d('0x4e')]['findAll'](_0x3e63c6);})['then'](function(_0x4031b0){_0x5ce6b8['rows']=_0x4031b0;return _0x5ce6b8;})[_0xaf0d('0x36')](respondWithFilteredResult(_0x197d5b,_0x3e63c6))['catch'](handleError(_0x197d5b,null));};exports[_0xaf0d('0x51')]=function(_0x1f5b3d,_0x3d55d0){var _0x2ea9bf={'raw':![],'where':{'id':_0x1f5b3d[_0xaf0d('0x52')]['id']},'include':[{'model':db[_0xaf0d('0x53')],'as':_0xaf0d('0x39')}]},_0x43dc81={};_0x43dc81['model']=_[_0xaf0d('0x3d')](db[_0xaf0d('0x4e')][_0xaf0d('0x3a')]);_0x43dc81[_0xaf0d('0x3e')]=_['keys'](_0x1f5b3d[_0xaf0d('0x3e')]);_0x43dc81['filters']=_['intersection'](_0x43dc81[_0xaf0d('0x3c')],_0x43dc81[_0xaf0d('0x3e')]);_0x2ea9bf[_0xaf0d('0x41')]=_[_0xaf0d('0x40')](_0x43dc81['model'],qs['fields'](_0x1f5b3d[_0xaf0d('0x3e')]['fields']));_0x2ea9bf[_0xaf0d('0x41')]=_0x2ea9bf[_0xaf0d('0x41')][_0xaf0d('0x42')]?_0x2ea9bf[_0xaf0d('0x41')]:_0x43dc81[_0xaf0d('0x3c')];if(_0x1f5b3d[_0xaf0d('0x3e')][_0xaf0d('0x4f')]){_0x2ea9bf[_0xaf0d('0x50')]=[{'all':!![]}];}_0x2ea9bf=_['merge']({},_0x2ea9bf,_0x1f5b3d[_0xaf0d('0x4d')]);return db[_0xaf0d('0x4e')][_0xaf0d('0x54')](_0x2ea9bf)[_0xaf0d('0x36')](handleEntityNotFound(_0x3d55d0,null))[_0xaf0d('0x36')](respondWithResult(_0x3d55d0,null))[_0xaf0d('0x2d')](handleError(_0x3d55d0,null));};exports[_0xaf0d('0x55')]=function(_0x3af1f4,_0x5a514c){return db['OpenchannelAccount'][_0xaf0d('0x55')](_0x3af1f4['body'],{})[_0xaf0d('0x36')](function(_0x45eb5d){var _0x232f5f=_0x3af1f4[_0xaf0d('0x56')][_0xaf0d('0x57')]({'plain':!![]});if(!_0x232f5f)throw new Error(_0xaf0d('0x58'));if(_0x232f5f[_0xaf0d('0x59')]===_0xaf0d('0x56')){var _0x40e3df=_0x45eb5d['get']({'plain':!![]});var _0x30a1c4=_0xaf0d('0x5a');return db['UserProfileSection'][_0xaf0d('0x54')]({'where':{'name':_0x30a1c4,'userProfileId':_0x232f5f[_0xaf0d('0x5b')]},'raw':!![]})['then'](function(_0x119994){if(_0x119994&&_0x119994[_0xaf0d('0x5c')]===0x0){return db[_0xaf0d('0x5d')]['create']({'name':_0x40e3df['name'],'resourceId':_0x40e3df['id'],'type':_0x119994[_0xaf0d('0x38')],'sectionId':_0x119994['id']},{})['then'](function(){return _0x45eb5d;});}else{return _0x45eb5d;}})[_0xaf0d('0x2d')](function(_0x58b3e5){logger[_0xaf0d('0x29')](_0xaf0d('0x5e'),_0x58b3e5);throw _0x58b3e5;});}return _0x45eb5d;})[_0xaf0d('0x36')](respondWithResult(_0x5a514c,0xc9))[_0xaf0d('0x2d')](handleError(_0x5a514c,null));};exports[_0xaf0d('0x35')]=function(_0x2406bb,_0x172ea3){if(_0x2406bb[_0xaf0d('0x5f')]['id']){delete _0x2406bb[_0xaf0d('0x5f')]['id'];}return db[_0xaf0d('0x4e')][_0xaf0d('0x54')]({'where':{'id':_0x2406bb[_0xaf0d('0x52')]['id']},'include':[{'model':db[_0xaf0d('0x53')],'as':_0xaf0d('0x39')}]})[_0xaf0d('0x36')](handleEntityNotFound(_0x172ea3,null))[_0xaf0d('0x36')](saveUpdates(_0x2406bb['body'],null))[_0xaf0d('0x36')](respondWithResult(_0x172ea3,null))['catch'](handleError(_0x172ea3,null));};exports[_0xaf0d('0x60')]=function(_0x48a04d,_0xc36068){return db['OpenchannelAccount'][_0xaf0d('0x54')]({'where':{'id':_0x48a04d['params']['id']}})[_0xaf0d('0x36')](handleEntityNotFound(_0xc36068,null))['then'](removeEntity(_0xc36068,null))[_0xaf0d('0x2d')](handleError(_0xc36068,null));};exports[_0xaf0d('0x61')]=function(_0x8a8771,_0x11b7ed){return db[_0xaf0d('0x4e')][_0xaf0d('0x61')]()[_0xaf0d('0x36')](respondWithResult(_0x11b7ed,null))['catch'](handleError(_0x11b7ed,null));};exports[_0xaf0d('0x62')]=function(_0x49e539,_0x327b0a,_0x185a2b){if(_0x49e539[_0xaf0d('0x5f')]['id']){delete _0x49e539['body']['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x49e539['params']['id']}})[_0xaf0d('0x36')](handleEntityNotFound(_0x327b0a,null))[_0xaf0d('0x36')](function(_0x31c2cc){if(_0x31c2cc){_0x49e539['body']['OpnechannelAccountId']=_0x31c2cc['id'];return db[_0xaf0d('0x63')][_0xaf0d('0x55')](_0x49e539['body']);}})[_0xaf0d('0x36')](respondWithResult(_0x327b0a,null))[_0xaf0d('0x2d')](handleError(_0x327b0a,null));};exports['getDispositions']=function(_0x20e60e,_0x36c77b,_0x2879fd){var _0x218e39={'raw':![],'where':{}};var _0x8e71f2={};var _0x4cb2a0={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xaf0d('0x64')]({'where':{'id':_0x20e60e['params']['id']}})['then'](handleEntityNotFound(_0x36c77b,null))[_0xaf0d('0x36')](function(_0x32bb79){if(_0x32bb79){_0x8e71f2[_0xaf0d('0x3c')]=_[_0xaf0d('0x3d')](db[_0xaf0d('0x63')][_0xaf0d('0x3a')]);_0x8e71f2[_0xaf0d('0x3e')]=_[_0xaf0d('0x3d')](_0x20e60e[_0xaf0d('0x3e')]);_0x8e71f2['filters']=_[_0xaf0d('0x40')](_0x8e71f2[_0xaf0d('0x3c')],_0x8e71f2[_0xaf0d('0x3e')]);_0x218e39['attributes']=_['intersection'](_0x8e71f2['model'],qs[_0xaf0d('0x65')](_0x20e60e[_0xaf0d('0x3e')][_0xaf0d('0x65')]));_0x218e39[_0xaf0d('0x41')]=_0x218e39[_0xaf0d('0x41')]['length']?_0x218e39[_0xaf0d('0x41')]:_0x8e71f2[_0xaf0d('0x3c')];if(!_0x20e60e[_0xaf0d('0x3e')][_0xaf0d('0x43')](_0xaf0d('0x66'))){_0x218e39[_0xaf0d('0x44')]=qs[_0xaf0d('0x44')](_0x20e60e[_0xaf0d('0x3e')][_0xaf0d('0x44')]);_0x218e39[_0xaf0d('0x32')]=qs[_0xaf0d('0x32')](_0x20e60e[_0xaf0d('0x3e')][_0xaf0d('0x32')]);}_0x218e39[_0xaf0d('0x45')]=qs[_0xaf0d('0x46')](_0x20e60e[_0xaf0d('0x3e')][_0xaf0d('0x46')]);_0x218e39[_0xaf0d('0x47')]=qs[_0xaf0d('0x3f')](_[_0xaf0d('0x67')](_0x20e60e[_0xaf0d('0x3e')],_0x8e71f2[_0xaf0d('0x3f')]));_0x218e39[_0xaf0d('0x47')][_0xaf0d('0x68')]=_0x32bb79['id'];if(_0x20e60e[_0xaf0d('0x3e')][_0xaf0d('0x48')]){_0x218e39[_0xaf0d('0x47')]=_[_0xaf0d('0x49')](_0x218e39[_0xaf0d('0x47')],{'$or':_[_0xaf0d('0x4a')](_0x218e39[_0xaf0d('0x41')],function(_0xc57a12){var _0x347955={};_0x347955[_0xc57a12]={'$like':'%'+_0x20e60e[_0xaf0d('0x3e')][_0xaf0d('0x48')]+'%'};return _0x347955;})});}_0x218e39=_['merge']({},_0x218e39,_0x20e60e[_0xaf0d('0x4d')]);return db['Disposition']['count']({'where':_0x218e39['where']})['then'](function(_0x583594){_0x4cb2a0['count']=_0x583594;if(_0x20e60e[_0xaf0d('0x3e')][_0xaf0d('0x4f')]){_0x218e39[_0xaf0d('0x50')]=[{'all':!![]}];}return db[_0xaf0d('0x63')][_0xaf0d('0x69')](_0x218e39);})[_0xaf0d('0x36')](function(_0x547f6c){_0x4cb2a0[_0xaf0d('0x6a')]=_0x547f6c;return _0x4cb2a0;});}})[_0xaf0d('0x36')](respondWithFilteredResult(_0x36c77b,_0x218e39))['catch'](handleError(_0x36c77b,null));};exports['removeDispositions']=function(_0x4b303b,_0x25395f,_0x1d19e7){return db[_0xaf0d('0x4e')][_0xaf0d('0x54')]({'where':{'id':_0x4b303b['params']['id']}})[_0xaf0d('0x36')](handleEntityNotFound(_0x25395f,null))[_0xaf0d('0x36')](function(_0x20aae4){if(_0x20aae4){return _0x20aae4[_0xaf0d('0x6b')](_0x4b303b['query'][_0xaf0d('0x6c')]);}})[_0xaf0d('0x36')](respondWithStatusCode(_0x25395f,null))[_0xaf0d('0x2d')](handleError(_0x25395f,null));};exports[_0xaf0d('0x6d')]=function(_0x254a2d,_0x750dc3,_0x698002){if(_0x254a2d[_0xaf0d('0x5f')]['id']){delete _0x254a2d[_0xaf0d('0x5f')]['id'];}return db[_0xaf0d('0x4e')][_0xaf0d('0x54')]({'where':{'id':_0x254a2d['params']['id']}})[_0xaf0d('0x36')](handleEntityNotFound(_0x750dc3,null))['then'](function(_0xb1ad1a){if(_0xb1ad1a){_0x254a2d['body'][_0xaf0d('0x68')]=_0xb1ad1a['id'];return db[_0xaf0d('0x6e')]['create'](_0x254a2d[_0xaf0d('0x5f')]);}})[_0xaf0d('0x36')](respondWithResult(_0x750dc3,null))['catch'](handleError(_0x750dc3,null));};exports[_0xaf0d('0x6f')]=function(_0x15d748,_0xba137b,_0x4eef80){var _0x1ba6da={'raw':![],'where':{}};var _0x55f04a={};var _0x374717={'count':0x0,'rows':[]};return db[_0xaf0d('0x4e')]['findOne']({'where':{'id':_0x15d748['params']['id']}})['then'](handleEntityNotFound(_0xba137b,null))[_0xaf0d('0x36')](function(_0xd390d0){if(_0xd390d0){_0x55f04a[_0xaf0d('0x3c')]=_['keys'](db[_0xaf0d('0x6e')][_0xaf0d('0x3a')]);_0x55f04a['query']=_['keys'](_0x15d748[_0xaf0d('0x3e')]);_0x55f04a['filters']=_[_0xaf0d('0x40')](_0x55f04a['model'],_0x55f04a['query']);_0x1ba6da[_0xaf0d('0x41')]=_['intersection'](_0x55f04a[_0xaf0d('0x3c')],qs[_0xaf0d('0x65')](_0x15d748['query'][_0xaf0d('0x65')]));_0x1ba6da[_0xaf0d('0x41')]=_0x1ba6da[_0xaf0d('0x41')][_0xaf0d('0x42')]?_0x1ba6da[_0xaf0d('0x41')]:_0x55f04a[_0xaf0d('0x3c')];if(!_0x15d748['query'][_0xaf0d('0x43')](_0xaf0d('0x66'))){_0x1ba6da['limit']=qs['limit'](_0x15d748['query'][_0xaf0d('0x44')]);_0x1ba6da[_0xaf0d('0x32')]=qs[_0xaf0d('0x32')](_0x15d748[_0xaf0d('0x3e')][_0xaf0d('0x32')]);}_0x1ba6da[_0xaf0d('0x45')]=qs['sort'](_0x15d748[_0xaf0d('0x3e')][_0xaf0d('0x46')]);_0x1ba6da[_0xaf0d('0x47')]=qs[_0xaf0d('0x3f')](_[_0xaf0d('0x67')](_0x15d748['query'],_0x55f04a[_0xaf0d('0x3f')]));_0x1ba6da['where'][_0xaf0d('0x68')]=_0xd390d0['id'];if(_0x15d748[_0xaf0d('0x3e')][_0xaf0d('0x48')]){_0x1ba6da[_0xaf0d('0x47')]=_[_0xaf0d('0x49')](_0x1ba6da['where'],{'$or':_[_0xaf0d('0x4a')](_0x1ba6da['attributes'],function(_0x3566b1){var _0x3dfbe0={};_0x3dfbe0[_0x3566b1]={'$like':'%'+_0x15d748[_0xaf0d('0x3e')]['filter']+'%'};return _0x3dfbe0;})});}_0x1ba6da=_['merge']({},_0x1ba6da,_0x15d748[_0xaf0d('0x4d')]);return db['CannedAnswer']['count']({'where':_0x1ba6da['where']})[_0xaf0d('0x36')](function(_0x555a51){_0x374717[_0xaf0d('0x31')]=_0x555a51;if(_0x15d748[_0xaf0d('0x3e')][_0xaf0d('0x4f')]){_0x1ba6da[_0xaf0d('0x50')]=[{'all':!![]}];}return db[_0xaf0d('0x6e')][_0xaf0d('0x69')](_0x1ba6da);})[_0xaf0d('0x36')](function(_0x60359b){_0x374717[_0xaf0d('0x6a')]=_0x60359b;return _0x374717;});}})[_0xaf0d('0x36')](respondWithFilteredResult(_0xba137b,_0x1ba6da))[_0xaf0d('0x2d')](handleError(_0xba137b,null));};exports['removeAnswers']=function(_0x5a3167,_0x2c821a,_0x2462c7){return db[_0xaf0d('0x4e')]['find']({'where':{'id':_0x5a3167['params']['id']}})[_0xaf0d('0x36')](handleEntityNotFound(_0x2c821a,null))[_0xaf0d('0x36')](function(_0x56dfca){if(_0x56dfca){return _0x56dfca['removeAnswers'](_0x5a3167[_0xaf0d('0x3e')][_0xaf0d('0x6c')]);}})[_0xaf0d('0x36')](respondWithStatusCode(_0x2c821a,null))[_0xaf0d('0x2d')](handleError(_0x2c821a,null));};exports[_0xaf0d('0x70')]=function(_0x2410c1,_0x34dd6d,_0x17b2f6){var _0x55c278={'body':_0x2410c1[_0xaf0d('0x5f')],'channel':_0xaf0d('0x71')};var _0xb952=[];var _0x3b981f=[];var _0x29fb16={};var _0x1fc97b=![];return db[_0xaf0d('0x72')]['describe']()[_0xaf0d('0x36')](function(_0x288c28){if(!_0x288c28){throw new db['Sequelize'][(_0xaf0d('0x21'))](_0xaf0d('0x73'));}_0xb952=_[_0xaf0d('0x74')](_['keys'](_0x288c28),[_0xaf0d('0x75'),_0xaf0d('0x76')]);_0x3b981f=_[_0xaf0d('0x74')](_[_0xaf0d('0x3d')](_0x288c28),[_0xaf0d('0x75'),_0xaf0d('0x76'),_0xaf0d('0x77'),'ListId']);if(_0x2410c1[_0xaf0d('0x5f')]['id']){delete _0x2410c1[_0xaf0d('0x5f')]['id'];}if(_[_0xaf0d('0x78')](_0x2410c1[_0xaf0d('0x5f')]['from'])){throw new db[(_0xaf0d('0x20'))][(_0xaf0d('0x21'))](_0xaf0d('0x79'));}if(_['isNil'](_0x2410c1[_0xaf0d('0x5f')]['body'])||_0x2410c1[_0xaf0d('0x5f')]['body']===''){throw new db['Sequelize'][(_0xaf0d('0x21'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xaf0d('0x78')](_0x2410c1[_0xaf0d('0x5f')][_0xaf0d('0x7a')])){throw new db['Sequelize'][(_0xaf0d('0x21'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3b981f);}if(!_[_0xaf0d('0x7b')](_0x3b981f,_0x2410c1[_0xaf0d('0x5f')][_0xaf0d('0x7a')])){throw new db[(_0xaf0d('0x20'))][(_0xaf0d('0x21'))](_0xaf0d('0x7c')+_0x3b981f);}_0x29fb16[_0x2410c1['body'][_0xaf0d('0x7a')]]=_0x2410c1[_0xaf0d('0x5f')][_0xaf0d('0x7d')];})[_0xaf0d('0x36')](function(){return db['OpenchannelAccount'][_0xaf0d('0x54')]({'where':{'id':_0x2410c1[_0xaf0d('0x52')]['id']},'include':[{'model':db['CmList'],'as':_0xaf0d('0x7e'),'include':[{'model':db[_0xaf0d('0x72')],'as':_0xaf0d('0x7f'),'where':_0x29fb16,'limit':0x1,'order':[[_0xaf0d('0x76'),_0xaf0d('0x80')]]}]},{'model':db[_0xaf0d('0x81')],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x34dd6d,null))[_0xaf0d('0x36')](function(_0x50fcb8){if(_0x50fcb8&&_0x50fcb8[_0xaf0d('0x7e')]){_0x55c278[_0xaf0d('0x82')]=_0x50fcb8;_0x55c278[_0xaf0d('0x83')]=_0x50fcb8[_0xaf0d('0x84')];_0x55c278[_0xaf0d('0x85')]=_0x50fcb8[_0xaf0d('0x7e')];_0x55c278[_0xaf0d('0x83')]=_['orderBy'](_0x55c278[_0xaf0d('0x83')],[_0xaf0d('0x86')],['asc']);if(_0x55c278[_0xaf0d('0x82')][_0xaf0d('0x84')]){delete _0x55c278[_0xaf0d('0x82')]['Applications'];}if(_0x55c278['account'][_0xaf0d('0x7e')]&&_0x55c278[_0xaf0d('0x82')][_0xaf0d('0x7e')][_0xaf0d('0x7f')][_0xaf0d('0x42')]){return _0x55c278['account'][_0xaf0d('0x7e')][_0xaf0d('0x7f')][0x0];}var _0x3bc129=_[_0xaf0d('0x18')](_0x2410c1[_0xaf0d('0x5f')],{'firstName':_0x2410c1['body'][_0xaf0d('0x7d')],'ListId':_0x50fcb8[_0xaf0d('0x87')]});_0x3bc129[_0x2410c1['body'][_0xaf0d('0x7a')]]=_0x2410c1['body'][_0xaf0d('0x7d')];return db[_0xaf0d('0x72')][_0xaf0d('0x55')](_0x3bc129,{'fields':_0xb952,'raw':!![]});}})[_0xaf0d('0x36')](handleEntityNotFound(_0x34dd6d,null))[_0xaf0d('0x36')](function(_0x461573){_0x55c278[_0xaf0d('0x88')]=_0x461573;if(_0x461573){var _0x4789c8={'ContactId':_0x461573['id'],'OpenchannelAccountId':_0x2410c1[_0xaf0d('0x52')]['id'],'from':(_0x461573[_0xaf0d('0x89')]||'')+'\x20'+(_0x461573['lastName']||'')};var _0x2082f5={'OpenchannelAccountId':_0x2410c1['params']['id'],'closed':![]};if(_0x2410c1[_0xaf0d('0x5f')][_0xaf0d('0x8a')]){_0x2082f5['threadId']=_0x2410c1[_0xaf0d('0x5f')][_0xaf0d('0x8a')];return db['OpenchannelInteraction']['find']({'where':_0x2082f5})['then'](function(_0x4d2ef8){if(_0x4d2ef8){return[_0x4d2ef8,![]];}_0x4789c8[_0xaf0d('0x8a')]=_0x2410c1['body'][_0xaf0d('0x8a')];_0x4789c8['externalUrl']=_0x2410c1[_0xaf0d('0x5f')][_0xaf0d('0x8b')];return db[_0xaf0d('0x8c')][_0xaf0d('0x55')](_0x4789c8)[_0xaf0d('0x36')](function(_0x8ab065){return[_0x8ab065,!![]];});});}else{_0x2082f5[_0xaf0d('0x8a')]=null;}_0x2082f5['ContactId']=_0x461573['id'];return db[_0xaf0d('0x8c')][_0xaf0d('0x54')]({'where':_0x2082f5})[_0xaf0d('0x36')](function(_0x369f0d){if(_0x369f0d){return[_0x369f0d,![]];}return db['OpenchannelInteraction'][_0xaf0d('0x55')](_0x4789c8)['then'](function(_0x15c8b3){return[_0x15c8b3,!![]];});});}})[_0xaf0d('0x8d')](function(_0x178b79,_0x5e51c7){if(_0x178b79){_0x1fc97b=_0x5e51c7;if(!_0x5e51c7){var _0x5eede6={'from':(_0x55c278[_0xaf0d('0x88')][_0xaf0d('0x89')]||'')+'\x20'+(_0x55c278['contact'][_0xaf0d('0x8e')]||'')};if(_0x2410c1[_0xaf0d('0x5f')]['threadId']&&_0x2410c1[_0xaf0d('0x5f')][_0xaf0d('0x8f')]&&_0x2410c1[_0xaf0d('0x5f')][_0xaf0d('0x8a')]!=_0x2410c1[_0xaf0d('0x5f')][_0xaf0d('0x8f')]){_0x5eede6[_0xaf0d('0x8a')]=_0x2410c1[_0xaf0d('0x5f')]['messageId'];}return _0x178b79[_0xaf0d('0x35')](_0x5eede6);}else{return _0x178b79;}}})[_0xaf0d('0x36')](function(_0x2a2991){_0x55c278[_0xaf0d('0x90')]=_0x2a2991[_0xaf0d('0x57')]({'plain':!![]});_0x55c278['interaction']['created']=_0x1fc97b;if(_0x55c278[_0xaf0d('0x90')]['created']){if(_0x55c278['account']['autoclose']){_0x55c278[_0xaf0d('0x83')][_0xaf0d('0x91')]({'id':0x0,'priority':_0x55c278['applications'][_0xaf0d('0x42')]+0x1,'app':_0xaf0d('0x92'),'appdata':'unmanaged','interval':_0xaf0d('0x93')});}}return db[_0xaf0d('0x94')][_0xaf0d('0x55')]({'body':_0x2410c1['body'][_0xaf0d('0x5f')],'OpenchannelAccountId':_0x2410c1[_0xaf0d('0x52')]['id'],'OpenchannelInteractionId':_0x2a2991['id'],'direction':'in','ContactId':_0x55c278[_0xaf0d('0x88')]['id'],'AttachmentId':_0x2410c1['body'][_0xaf0d('0x95')]});})[_0xaf0d('0x36')](function(_0x38984c){_0x55c278[_0xaf0d('0x2b')]=_0x38984c;if(_0x55c278[_0xaf0d('0x90')]['UserId']){return db[_0xaf0d('0x96')][_0xaf0d('0x54')]({'attributes':['id',_0xaf0d('0x38')],'where':{'id':_0x55c278['interaction'][_0xaf0d('0x97')]}})['then'](function(_0x4e6620){if(_0x4e6620){_0x55c278[_0xaf0d('0x83')][_0xaf0d('0x98')]({'id':0x0,'priority':0x0,'app':_0xaf0d('0x99'),'appdata':_0x4e6620[_0xaf0d('0x38')]+','+(_0x55c278[_0xaf0d('0x82')][_0xaf0d('0x9a')]||0xa),'interval':_0xaf0d('0x93')});_0x55c278[_0xaf0d('0x9b')]=![];}return respondWithRpcPromise(_0xaf0d('0x9c'),_0xaf0d('0x9d'),_0x55c278);});}return respondWithRpcPromise(_0xaf0d('0x9c'),_0xaf0d('0x9d'),_0x55c278);})['then'](function(_0xacb6da){respondWithRpcPromise(_0xaf0d('0x9e'),_0xaf0d('0x9e'),{'event':_0xaf0d('0x70'),'message':_0xacb6da},client9002);return _0xacb6da;})[_0xaf0d('0x36')](respondWithResult(_0x34dd6d,null))[_0xaf0d('0x2d')](handleError(_0x34dd6d,null));};exports[_0xaf0d('0x9f')]=function(_0x57fabb,_0x360bbb,_0x2be408){return db[_0xaf0d('0x4e')][_0xaf0d('0x64')]({'where':{'id':_0x57fabb['params']['id']}})['then'](handleEntityNotFound(_0x360bbb,null))[_0xaf0d('0x36')](function(_0x1ca241){if(_0x1ca241){return db['sequelize']['transaction'](function(_0x4dc11f){return db[_0xaf0d('0x81')][_0xaf0d('0x60')]({'where':{'OpenchannelAccountId':_0x57fabb[_0xaf0d('0x52')]['id']},'transaction':_0x4dc11f})[_0xaf0d('0x36')](function(_0x2b08ba){var _0x172e7d=_['map'](_0x57fabb['body'],function(_0x23aec6){_0x23aec6[_0xaf0d('0x68')]=_0x57fabb['params']['id'];return _0x23aec6;});return db[_0xaf0d('0x81')][_0xaf0d('0xa0')](_0x172e7d,{'transaction':_0x4dc11f});});})[_0xaf0d('0x36')](function(){return db[_0xaf0d('0x81')][_0xaf0d('0xa1')]({'where':{'OpenchannelAccountId':_0x57fabb[_0xaf0d('0x52')]['id']},'order':'priority'});});}})[_0xaf0d('0x36')](respondWithResult(_0x360bbb,null))[_0xaf0d('0x2d')](handleError(_0x360bbb,null));};exports[_0xaf0d('0xa2')]=function(_0x543fd5,_0x339476,_0x359554){var _0xd6c60a={};var _0xb13a85={};var _0x373929;var _0x189760;return db[_0xaf0d('0x4e')]['findOne']({'where':{'id':_0x543fd5[_0xaf0d('0x52')]['id']}})[_0xaf0d('0x36')](handleEntityNotFound(_0x339476,null))[_0xaf0d('0x36')](function(_0x3889ab){if(_0x3889ab){_0x373929=_0x3889ab;_0xb13a85['model']=_[_0xaf0d('0x3d')](db[_0xaf0d('0x81')][_0xaf0d('0x3a')]);_0xb13a85[_0xaf0d('0x3e')]=_[_0xaf0d('0x3d')](_0x543fd5[_0xaf0d('0x3e')]);_0xb13a85['filters']=_[_0xaf0d('0x40')](_0xb13a85[_0xaf0d('0x3c')],_0xb13a85[_0xaf0d('0x3e')]);_0xd6c60a['attributes']=_[_0xaf0d('0x40')](_0xb13a85['model'],qs['fields'](_0x543fd5[_0xaf0d('0x3e')][_0xaf0d('0x65')]));_0xd6c60a['attributes']=_0xd6c60a[_0xaf0d('0x41')][_0xaf0d('0x42')]?_0xd6c60a[_0xaf0d('0x41')]:_0xb13a85[_0xaf0d('0x3c')];_0xd6c60a['order']=qs[_0xaf0d('0x46')](_0x543fd5[_0xaf0d('0x3e')][_0xaf0d('0x46')]);_0xd6c60a[_0xaf0d('0x47')]=qs[_0xaf0d('0x3f')](_['pick'](_0x543fd5[_0xaf0d('0x3e')],_0xb13a85['filters']));if(_0x543fd5[_0xaf0d('0x3e')]['filter']){_0xd6c60a[_0xaf0d('0x47')]=_[_0xaf0d('0x49')](_0xd6c60a[_0xaf0d('0x47')],{'$or':_['map'](_0xd6c60a['attributes'],function(_0x1a58bc){var _0xc43af7={};_0xc43af7[_0x1a58bc]={'$like':'%'+_0x543fd5[_0xaf0d('0x3e')]['filter']+'%'};return _0xc43af7;})});}_0xd6c60a=_[_0xaf0d('0x49')]({},_0xd6c60a,_0x543fd5[_0xaf0d('0x4d')]);return _0x373929[_0xaf0d('0xa2')](_0xd6c60a);}})[_0xaf0d('0x36')](function(_0x7418fb){if(_0x7418fb){_0x189760=_0x7418fb[_0xaf0d('0x42')];if(!_0x543fd5[_0xaf0d('0x3e')]['hasOwnProperty'](_0xaf0d('0x66'))){_0xd6c60a[_0xaf0d('0x44')]=qs[_0xaf0d('0x44')](_0x543fd5['query'][_0xaf0d('0x44')]);_0xd6c60a['offset']=qs[_0xaf0d('0x32')](_0x543fd5['query'][_0xaf0d('0x32')]);}return _0x373929['getApplications'](_0xd6c60a);}})[_0xaf0d('0x36')](function(_0x29269e){if(_0x29269e){return _0x29269e?{'count':_0x189760,'rows':_0x29269e}:null;}})['then'](respondWithResult(_0x339476,null))[_0xaf0d('0x2d')](handleError(_0x339476,null));};exports[_0xaf0d('0xa3')]=function(_0xf89d40,_0x5db4b0,_0x473fe1){var _0xd02142={'raw':![],'where':{}};var _0x1bc03b={};var _0x3b1cf6={'count':0x0,'rows':[]};return db[_0xaf0d('0x4e')][_0xaf0d('0x64')]({'where':{'id':_0xf89d40[_0xaf0d('0x52')]['id']}})[_0xaf0d('0x36')](handleEntityNotFound(_0x5db4b0,null))[_0xaf0d('0x36')](function(_0x54a5c9){if(_0x54a5c9){_0x1bc03b[_0xaf0d('0x3c')]=_[_0xaf0d('0x3d')](db[_0xaf0d('0x8c')][_0xaf0d('0x3a')]);_0x1bc03b['query']=_[_0xaf0d('0x3d')](_0xf89d40[_0xaf0d('0x3e')]);_0x1bc03b['filters']=_[_0xaf0d('0x40')](_0x1bc03b[_0xaf0d('0x3c')],_0x1bc03b[_0xaf0d('0x3e')]);_0xd02142[_0xaf0d('0x41')]=_[_0xaf0d('0x40')](_0x1bc03b[_0xaf0d('0x3c')],qs['fields'](_0xf89d40[_0xaf0d('0x3e')][_0xaf0d('0x65')]));_0xd02142[_0xaf0d('0x41')]=_0xd02142['attributes'][_0xaf0d('0x42')]?_0xd02142['attributes']:_0x1bc03b[_0xaf0d('0x3c')];if(!_0xf89d40[_0xaf0d('0x3e')][_0xaf0d('0x43')](_0xaf0d('0x66'))){_0xd02142['limit']=qs[_0xaf0d('0x44')](_0xf89d40['query'][_0xaf0d('0x44')]);_0xd02142[_0xaf0d('0x32')]=qs['offset'](_0xf89d40[_0xaf0d('0x3e')][_0xaf0d('0x32')]);}_0xd02142['order']=qs[_0xaf0d('0x46')](_0xf89d40[_0xaf0d('0x3e')][_0xaf0d('0x46')]);_0xd02142[_0xaf0d('0x47')]=qs[_0xaf0d('0x3f')](_['pick'](_0xf89d40[_0xaf0d('0x3e')],_0x1bc03b[_0xaf0d('0x3f')]));_0xd02142[_0xaf0d('0x47')][_0xaf0d('0x68')]=_0x54a5c9['id'];if(_0xf89d40[_0xaf0d('0x3e')][_0xaf0d('0x48')]){_0xd02142['where']=_[_0xaf0d('0x49')](_0xd02142[_0xaf0d('0x47')],{'$or':_[_0xaf0d('0x4a')](_0xd02142[_0xaf0d('0x41')],function(_0x1bec3c){var _0x56b886={};_0x56b886[_0x1bec3c]={'$like':'%'+_0xf89d40[_0xaf0d('0x3e')][_0xaf0d('0x48')]+'%'};return _0x56b886;})});}_0xd02142=_[_0xaf0d('0x49')]({},_0xd02142,_0xf89d40[_0xaf0d('0x4d')]);return db[_0xaf0d('0x8c')][_0xaf0d('0x31')]({'where':_0xd02142[_0xaf0d('0x47')]})['then'](function(_0x476b45){_0x3b1cf6['count']=_0x476b45;if(_0xf89d40[_0xaf0d('0x3e')][_0xaf0d('0x4f')]){_0xd02142[_0xaf0d('0x50')]=[{'model':db[_0xaf0d('0x72')],'as':'Contact','required':![]},{'model':db[_0xaf0d('0x96')],'as':_0xaf0d('0xa4'),'attributes':['name',_0xaf0d('0xa5'),'internal'],'required':![]},{'model':db[_0xaf0d('0xa6')],'as':'Tags','attributes':['id',_0xaf0d('0x38'),_0xaf0d('0xa7')],'where':_0xf89d40[_0xaf0d('0x3e')][_0xaf0d('0xa8')]?{'id':_0xf89d40['query'][_0xaf0d('0xa8')]}:undefined,'required':_0xf89d40[_0xaf0d('0x3e')][_0xaf0d('0xa8')]?!![]:![]}];}return db[_0xaf0d('0x8c')][_0xaf0d('0x69')](_0xd02142);})[_0xaf0d('0x36')](function(_0x7d7746){_0x3b1cf6[_0xaf0d('0x6a')]=_0x7d7746;return _0x3b1cf6;});}})[_0xaf0d('0x36')](respondWithFilteredResult(_0x5db4b0,_0xd02142))[_0xaf0d('0x2d')](handleError(_0x5db4b0,null));};exports[_0xaf0d('0xa9')]=function(_0x174b17,_0x9f51bc,_0x2fb6d5){return db[_0xaf0d('0x4e')]['find']({'where':{'id':_0x174b17[_0xaf0d('0x52')]['id']}})[_0xaf0d('0x36')](handleEntityNotFound(_0x9f51bc,null))[_0xaf0d('0x36')](function(_0x30ea80){if(_0x30ea80){return _0x30ea80[_0xaf0d('0xa9')](_0x174b17[_0xaf0d('0x5f')][_0xaf0d('0x6c')],_[_0xaf0d('0xaa')](_0x174b17[_0xaf0d('0x5f')],[_0xaf0d('0x6c'),'id'])||{})['spread'](function(_0x3aefa7){for(var _0x5f54a9=0x0;_0x5f54a9<_0x174b17['body'][_0xaf0d('0x6c')][_0xaf0d('0x42')];_0x5f54a9+=0x1){socket[_0xaf0d('0xab')](_0xaf0d('0xac'),{'UserId':_0x174b17[_0xaf0d('0x5f')][_0xaf0d('0x6c')][_0x5f54a9],'OpenchannelAccountId':_0x174b17[_0xaf0d('0x52')]['id']});}return _0x3aefa7;});}})['then'](respondWithResult(_0x9f51bc,null))['catch'](handleError(_0x9f51bc,null));};exports['removeAgents']=function(_0xa69e54,_0x48be67,_0x41c2a3){return db[_0xaf0d('0x4e')]['find']({'where':{'id':_0xa69e54['params']['id']}})[_0xaf0d('0x36')](handleEntityNotFound(_0x48be67,null))['then'](function(_0x374b07){if(_0x374b07){return _0x374b07[_0xaf0d('0xad')](_0xa69e54['query']['ids'])[_0xaf0d('0x36')](function(){if(_[_0xaf0d('0xae')](_0xa69e54[_0xaf0d('0x3e')][_0xaf0d('0x6c')])){for(var _0x25db3f=0x0;_0x25db3f<_0xa69e54[_0xaf0d('0x3e')][_0xaf0d('0x6c')][_0xaf0d('0x42')];_0x25db3f+=0x1){socket[_0xaf0d('0xab')](_0xaf0d('0xaf'),{'UserId':Number(_0xa69e54[_0xaf0d('0x3e')]['ids'][_0x25db3f]),'OpenchannelAccountId':Number(_0xa69e54[_0xaf0d('0x52')]['id'])});}}else{socket['emit'](_0xaf0d('0xaf'),{'UserId':Number(_0xa69e54[_0xaf0d('0x3e')]['ids']),'OpenchannelAccountId':Number(_0xa69e54[_0xaf0d('0x52')]['id'])});}});}})[_0xaf0d('0x36')](respondWithStatusCode(_0x48be67,null))['catch'](handleError(_0x48be67,null));};exports['getAgents']=function(_0x296161,_0x928506,_0xba2184){var _0x256a65={};var _0x5a68f6={};var _0x968f73;var _0x32db73;return db[_0xaf0d('0x4e')]['findOne']({'where':{'id':_0x296161[_0xaf0d('0x52')]['id']}})[_0xaf0d('0x36')](handleEntityNotFound(_0x928506,null))[_0xaf0d('0x36')](function(_0x18a6c3){if(_0x18a6c3){_0x968f73=_0x18a6c3;_0x5a68f6[_0xaf0d('0x3c')]=_[_0xaf0d('0x3d')](db[_0xaf0d('0x96')][_0xaf0d('0x3a')]);_0x5a68f6[_0xaf0d('0x3e')]=_[_0xaf0d('0x3d')](_0x296161[_0xaf0d('0x3e')]);_0x5a68f6['filters']=_[_0xaf0d('0x40')](_0x5a68f6[_0xaf0d('0x3c')],_0x5a68f6['query']);_0x256a65[_0xaf0d('0x41')]=_[_0xaf0d('0x40')](_0x5a68f6[_0xaf0d('0x3c')],qs[_0xaf0d('0x65')](_0x296161[_0xaf0d('0x3e')][_0xaf0d('0x65')]));_0x256a65[_0xaf0d('0x41')]=_0x256a65[_0xaf0d('0x41')][_0xaf0d('0x42')]?_0x256a65[_0xaf0d('0x41')]:_0x5a68f6[_0xaf0d('0x3c')];_0x256a65['order']=qs[_0xaf0d('0x46')](_0x296161[_0xaf0d('0x3e')]['sort']);_0x256a65['where']=qs[_0xaf0d('0x3f')](_['pick'](_0x296161[_0xaf0d('0x3e')],_0x5a68f6[_0xaf0d('0x3f')]));if(_0x296161[_0xaf0d('0x3e')][_0xaf0d('0x48')]){_0x256a65[_0xaf0d('0x47')]=_[_0xaf0d('0x49')](_0x256a65[_0xaf0d('0x47')],{'$or':_['map'](_0x256a65[_0xaf0d('0x41')],function(_0x5dc372){var _0x1da9cd={};_0x1da9cd[_0x5dc372]={'$like':'%'+_0x296161[_0xaf0d('0x3e')][_0xaf0d('0x48')]+'%'};return _0x1da9cd;})});}_0x256a65=_[_0xaf0d('0x49')]({},_0x256a65,_0x296161[_0xaf0d('0x4d')]);return _0x968f73[_0xaf0d('0xb0')](_0x256a65);}})[_0xaf0d('0x36')](function(_0x288879){if(_0x288879){_0x32db73=_0x288879[_0xaf0d('0x42')];if(!_0x296161[_0xaf0d('0x3e')][_0xaf0d('0x43')](_0xaf0d('0x66'))){_0x256a65['limit']=qs[_0xaf0d('0x44')](_0x296161[_0xaf0d('0x3e')]['limit']);_0x256a65[_0xaf0d('0x32')]=qs[_0xaf0d('0x32')](_0x296161[_0xaf0d('0x3e')][_0xaf0d('0x32')]);}return _0x968f73[_0xaf0d('0xb0')](_0x256a65);}})['then'](function(_0x2996a7){if(_0x2996a7){return _0x2996a7?{'count':_0x32db73,'rows':_0x2996a7}:null;}})[_0xaf0d('0x36')](respondWithResult(_0x928506,null))['catch'](handleError(_0x928506,null));};exports[_0xaf0d('0xb1')]=function(_0x4a2895,_0x391fb7,_0x59f499){var _0x39ad63,_0x33144a,_0x5e8934;if(_['isNil'](_0x4a2895['body'][_0xaf0d('0x5f')])||_0x4a2895[_0xaf0d('0x5f')][_0xaf0d('0x5f')]===''){throw new db['Sequelize'][(_0xaf0d('0x21'))](_0xaf0d('0xb2'));}if(_[_0xaf0d('0x78')](_0x4a2895['body']['to'])){}_0x39ad63=_0x4a2895[_0xaf0d('0x5f')]['to'];return db[_0xaf0d('0x4e')]['findOne']({'where':{'id':_0x4a2895[_0xaf0d('0x52')]['id']}})[_0xaf0d('0x36')](handleEntityNotFound(_0x391fb7,null))[_0xaf0d('0x36')](function(_0x4c40ad){if(_0x4c40ad){return db['OpenchannelAccount'][_0xaf0d('0x54')]({'where':{'id':_0x4c40ad['id']},'include':[{'model':db['CmList'],'as':_0xaf0d('0x7e'),'include':[{'model':db[_0xaf0d('0x72')],'as':_0xaf0d('0x7f'),'where':{[_0x4c40ad[_0xaf0d('0x7a')]]:_0x39ad63},'limit':0x1,'order':[['updatedAt',_0xaf0d('0x80')]]}]}]})[_0xaf0d('0x36')](handleEntityNotFound(_0x391fb7,null))[_0xaf0d('0x36')](function(_0x28a792){if(_0x28a792&&_0x28a792[_0xaf0d('0x7e')]){_0x33144a=_0x28a792[_0xaf0d('0x57')]({'plain':!![]});if(_0x33144a['List']&&_0x33144a[_0xaf0d('0x7e')][_0xaf0d('0x7f')][_0xaf0d('0x42')]){return _0x33144a[_0xaf0d('0x7e')][_0xaf0d('0x7f')][0x0];}return db[_0xaf0d('0x72')][_0xaf0d('0x55')](_[_0xaf0d('0x18')](_0x4a2895[_0xaf0d('0x5f')],{'firstName':_0x39ad63,[_0x28a792['mapKey']]:_0x39ad63,'phone':_0x39ad63,'ListId':_0x33144a[_0xaf0d('0x87')]}));}})['then'](handleEntityNotFound(_0x391fb7,null))[_0xaf0d('0x36')](function(_0x4138a3){if(_0x4138a3){_0x5e8934=_0x4138a3;return db[_0xaf0d('0x8c')]['find']({'where':{'ContactId':_0x5e8934['id'],'closed':![],'OpenchannelAccountId':_0x33144a['id']}})[_0xaf0d('0x36')](function(_0x100857){if(_0x100857){return[_0x100857,![]];}return db[_0xaf0d('0x8c')]['create']({'UserId':_0x4a2895['user']['id'],'ContactId':_0x5e8934['id'],'OpenchannelAccountId':_0x33144a['id'],'lastMsgDirection':_0xaf0d('0xb3'),'Messages':[_[_0xaf0d('0x49')](_0x4a2895[_0xaf0d('0x5f')],{'read':![],'body':_0x4a2895[_0xaf0d('0x5f')][_0xaf0d('0x5f')],'OpenchannelAccountId':_0x33144a['id'],'UserId':_0x4a2895[_0xaf0d('0x56')]['id'],'ContactId':_0x5e8934['id']})]},{'include':[{'model':db[_0xaf0d('0x94')],'as':'Messages'}]})['then'](function(_0xa7eec9){return[_0xa7eec9,!![]];});});}})[_0xaf0d('0x8d')](function(_0x188449,_0x2bf994){if(_0x2bf994){return _0x188449;}return db['OpenchannelMessage'][_0xaf0d('0x55')](_['merge'](_0x4a2895['body'],{'read':![],'body':_0x4a2895[_0xaf0d('0x5f')][_0xaf0d('0x5f')],'OpenchannelAccountId':_0x33144a['id'],'OpenchannelInteractionId':_0x188449['id'],'UserId':_0x4a2895[_0xaf0d('0x56')]['id'],'ContactId':_0x5e8934['id']}))[_0xaf0d('0x36')](function(_0x379115){_0x188449['dataValues']['Messages']=[];_0x188449[_0xaf0d('0xb4')][_0xaf0d('0xb5')][_0xaf0d('0x91')](_0x379115[_0xaf0d('0xb4')]);return _0x188449;});});}})[_0xaf0d('0x36')](respondWithResult(_0x391fb7,null))[_0xaf0d('0x2d')](handleError(_0x391fb7,null));}; \ No newline at end of file +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 diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index d6ae135..a6f7f87 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 _0xf685=['hasOwnProperty','exports','../../mysqldb','OpenchannelAccount','setMaxListeners','save','remove','emit'];(function(_0x2ff238,_0x1811d2){var _0x204a56=function(_0x5bf2e1){while(--_0x5bf2e1){_0x2ff238['push'](_0x2ff238['shift']());}};_0x204a56(++_0x1811d2);}(_0xf685,0xe2));var _0x5f68=function(_0x253fb4,_0x4577f9){_0x253fb4=_0x253fb4-0x0;var _0x511284=_0xf685[_0x253fb4];return _0x511284;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x5f68('0x0'))['db'][_0x5f68('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x5f68('0x2')](0x0);var events={'afterCreate':_0x5f68('0x3'),'afterUpdate':'update','afterDestroy':_0x5f68('0x4')};function emitEvent(_0x67f438){return function(_0x18a555,_0x4ddde9,_0x1cf2c4){OpenchannelAccountEvents[_0x5f68('0x5')](_0x67f438+':'+_0x18a555['id'],_0x18a555);OpenchannelAccountEvents[_0x5f68('0x5')](_0x67f438,_0x18a555);_0x1cf2c4(null);};}for(var e in events){if(events[_0x5f68('0x6')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x5f68('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +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 diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index da7fbed..33e991b 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 _0xb5ff=['./openchannelAccount.attributes','exports','define','openchannel_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x4bdb2e,_0x53ae98){var _0x372646=function(_0x23b355){while(--_0x23b355){_0x4bdb2e['push'](_0x4bdb2e['shift']());}};_0x372646(++_0x53ae98);}(_0xb5ff,0x6c));var _0xfb5f=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0xb5ff[_0xa8883];return _0x479426;};'use strict';var _=require(_0xfb5f('0x0'));var util=require(_0xfb5f('0x1'));var logger=require(_0xfb5f('0x2'))(_0xfb5f('0x3'));var moment=require(_0xfb5f('0x4'));var BPromise=require('bluebird');var rp=require(_0xfb5f('0x5'));var fs=require('fs');var path=require(_0xfb5f('0x6'));var rimraf=require(_0xfb5f('0x7'));var config=require(_0xfb5f('0x8'));var attributes=require(_0xfb5f('0x9'));module[_0xfb5f('0xa')]=function(_0x53d886,_0x1c3754){return _0x53d886[_0xfb5f('0xb')]('OpenchannelAccount',attributes,{'tableName':_0xfb5f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index 8fce6b0..df1a904 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 _0x9533=['OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','info'];(function(_0x5741bc,_0x33c588){var _0x1a57d2=function(_0x58caa8){while(--_0x58caa8){_0x5741bc['push'](_0x5741bc['shift']());}};_0x1a57d2(++_0x33c588);}(_0x9533,0x1d2));var _0x3953=function(_0x4d05dd,_0x258cdd){_0x4d05dd=_0x4d05dd-0x0;var _0x1c5226=_0x9533[_0x4d05dd];return _0x1c5226;};'use strict';var _=require('lodash');var util=require(_0x3953('0x0'));var moment=require(_0x3953('0x1'));var BPromise=require('bluebird');var rs=require(_0x3953('0x2'));var fs=require('fs');var Redis=require(_0x3953('0x3'));var db=require(_0x3953('0x4'))['db'];var utils=require(_0x3953('0x5'));var logger=require(_0x3953('0x6'))(_0x3953('0x7'));var config=require(_0x3953('0x8'));var jayson=require(_0x3953('0x9'));var client=jayson[_0x3953('0xa')][_0x3953('0xb')]({'port':0x232a});config[_0x3953('0xc')]=_[_0x3953('0xd')](config['redis'],{'host':_0x3953('0xe'),'port':0x18eb});var socket=require(_0x3953('0xf'))(new Redis(config[_0x3953('0xc')]));require(_0x3953('0x10'))[_0x3953('0x11')](socket);function respondWithRpcPromise(_0x3974d3,_0x11ae8d,_0x2f85cb){return new BPromise(function(_0x31c8b5,_0x3d1883){return client[_0x3953('0x12')](_0x3974d3,_0x2f85cb)['then'](function(_0x459b81){logger[_0x3953('0x13')](_0x3953('0x14'),_0x11ae8d,_0x3953('0x15'));logger[_0x3953('0x16')](_0x3953('0x17'),_0x11ae8d,_0x3953('0x15'),JSON['stringify'](_0x459b81));if(_0x459b81['error']){if(_0x459b81[_0x3953('0x18')][_0x3953('0x19')]===0x1f4){logger[_0x3953('0x18')](_0x3953('0x14'),_0x11ae8d,_0x459b81[_0x3953('0x18')][_0x3953('0x1a')]);return _0x3d1883(_0x459b81[_0x3953('0x18')][_0x3953('0x1a')]);}logger[_0x3953('0x18')](_0x3953('0x14'),_0x11ae8d,_0x459b81['error'][_0x3953('0x1a')]);return _0x31c8b5(_0x459b81['error']['message']);}else{logger[_0x3953('0x13')](_0x3953('0x14'),_0x11ae8d,'request\x20sent');_0x31c8b5(_0x459b81['result'][_0x3953('0x1a')]);}})['catch'](function(_0x5a5d95){logger['error'](_0x3953('0x14'),_0x11ae8d,_0x5a5d95);_0x3d1883(_0x5a5d95);});});} \ No newline at end of file +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 diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 186e6e1..59befbd 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 _0x9a5e=['emit','register','length','openchannelAccount:','./openchannelAccount.events','save','remove'];(function(_0x39c597,_0x4e08a6){var _0x410a93=function(_0x239739){while(--_0x239739){_0x39c597['push'](_0x39c597['shift']());}};_0x410a93(++_0x4e08a6);}(_0x9a5e,0x1b6));var _0xe9a5=function(_0x46e88c,_0xc26c61){_0x46e88c=_0x46e88c-0x0;var _0x557f2e=_0x9a5e[_0x46e88c];return _0x557f2e;};'use strict';var OpenchannelAccountEvents=require(_0xe9a5('0x0'));var events=[_0xe9a5('0x1'),_0xe9a5('0x2'),'update'];function createListener(_0xa0ed04,_0xc0afbc){return function(_0x443176){_0xc0afbc[_0xe9a5('0x3')](_0xa0ed04,_0x443176);};}function removeListener(_0x457e76,_0x250fa7){return function(){OpenchannelAccountEvents['removeListener'](_0x457e76,_0x250fa7);};}exports[_0xe9a5('0x4')]=function(_0x46b26e){for(var _0x39cad7=0x0,_0x40a57d=events[_0xe9a5('0x5')];_0x39cad7<_0x40a57d;_0x39cad7++){var _0x5eecdf=events[_0x39cad7];var _0x15650d=createListener(_0xe9a5('0x6')+_0x5eecdf,_0x46b26e);OpenchannelAccountEvents['on'](_0x5eecdf,_0x15650d);}}; \ No newline at end of file +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 diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 3b56dbc..28d9b17 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 _0x39ae=['get','isAuthenticated','index','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./openchannelApplication.controller'];(function(_0x42e7d2,_0xbf13db){var _0x5352a5=function(_0x4fe5e3){while(--_0x4fe5e3){_0x42e7d2['push'](_0x42e7d2['shift']());}};_0x5352a5(++_0xbf13db);}(_0x39ae,0x92));var _0xe39a=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x39ae[_0x82129b];return _0x2ae5dc;};'use strict';var multer=require(_0xe39a('0x0'));var util=require(_0xe39a('0x1'));var path=require(_0xe39a('0x2'));var timeout=require(_0xe39a('0x3'));var express=require('express');var router=express[_0xe39a('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xe39a('0x5'));var config=require('../../config/environment');var controller=require(_0xe39a('0x6'));router[_0xe39a('0x7')]('/',auth[_0xe39a('0x8')](),controller[_0xe39a('0x9')]);router[_0xe39a('0x7')](_0xe39a('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xe39a('0xb')]('/',auth[_0xe39a('0x8')](),controller[_0xe39a('0xc')]);router['put'](_0xe39a('0xa'),auth['isAuthenticated'](),controller[_0xe39a('0xd')]);router[_0xe39a('0xe')](_0xe39a('0xa'),auth[_0xe39a('0x8')](),controller[_0xe39a('0xf')]);module[_0xe39a('0x10')]=router; \ No newline at end of file +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 diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 19ffe93..652c80e 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 _0xb0d2=['*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x238b75,_0x185e8d){var _0x7b0fe4=function(_0x2e571b){while(--_0x2e571b){_0x238b75['push'](_0x238b75['shift']());}};_0x7b0fe4(++_0x185e8d);}(_0xb0d2,0x1b4));var _0x2b0d=function(_0x103ac4,_0x137d0c){_0x103ac4=_0x103ac4-0x0;var _0x39d4c0=_0xb0d2[_0x103ac4];return _0x39d4c0;};'use strict';var Sequelize=require(_0x2b0d('0x0'));module['exports']={'priority':{'type':Sequelize[_0x2b0d('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x2b0d('0x2')],'allowNull':![],'defaultValue':_0x2b0d('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x2b0d('0x2')]},'interval':{'type':Sequelize[_0x2b0d('0x2')],'defaultValue':_0x2b0d('0x4')}}; \ No newline at end of file +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 diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index aecf209..af46c91 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 _0xf895=['destroy','sendStatus','error','stack','name','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../mysqldb','status','end','count','offset','Content-Range','reject','update','then'];(function(_0x1f9a95,_0x4445de){var _0x266700=function(_0x202f35){while(--_0x202f35){_0x1f9a95['push'](_0x1f9a95['shift']());}};_0x266700(++_0x4445de);}(_0xf895,0x6f));var _0x5f89=function(_0x48270b,_0x1dca9e){_0x48270b=_0x48270b-0x0;var _0x5e396d=_0xf895[_0x48270b];return _0x5e396d;};'use strict';var pdf=require(_0x5f89('0x0'));var emlformat=require(_0x5f89('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5f89('0x2'));var jsonpatch=require(_0x5f89('0x3'));var rp=require(_0x5f89('0x4'));var moment=require(_0x5f89('0x5'));var BPromise=require(_0x5f89('0x6'));var Mustache=require(_0x5f89('0x7'));var util=require(_0x5f89('0x8'));var path=require(_0x5f89('0x9'));var sox=require(_0x5f89('0xa'));var csv=require(_0x5f89('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5f89('0xc'));var squel=require(_0x5f89('0xd'));var crypto=require(_0x5f89('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5f89('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5f89('0x10'));var Redis=require(_0x5f89('0x11'));var authService=require(_0x5f89('0x12'));var qs=require(_0x5f89('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5f89('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x5f89('0x15'));var config=require('../../config/environment');var db=require(_0x5f89('0x16'))['db'];function respondWithStatusCode(_0x4ec0c3,_0x521a7b){_0x521a7b=_0x521a7b||0xcc;return function(_0x4d89e4){if(_0x4d89e4){return _0x4ec0c3['sendStatus'](_0x521a7b);}return _0x4ec0c3[_0x5f89('0x17')](_0x521a7b)[_0x5f89('0x18')]();};}function respondWithResult(_0x7186e,_0x3b9fb9){_0x3b9fb9=_0x3b9fb9||0xc8;return function(_0xe968e){if(_0xe968e){return _0x7186e[_0x5f89('0x17')](_0x3b9fb9)['json'](_0xe968e);}};}function respondWithFilteredResult(_0x4b18ab,_0x4f4b26){return function(_0x166247){if(_0x166247){var _0x23adf4=_0x166247[_0x5f89('0x19')],_0x57c81a=_0x4f4b26[_0x5f89('0x1a')],_0x17185b=_0x4f4b26[_0x5f89('0x1a')]+_0x4f4b26['limit'],_0x4d3cec;if(_0x17185b>=_0x23adf4){_0x17185b=_0x23adf4;_0x4d3cec=0xc8;}else{_0x4d3cec=0xce;}_0x4b18ab[_0x5f89('0x17')](_0x4d3cec);return _0x4b18ab['set'](_0x5f89('0x1b'),_0x57c81a+'-'+_0x17185b+'/'+_0x23adf4)['json'](_0x166247);}return null;};}function patchUpdates(_0x2bd1f1){return function(_0x3fd26f){try{jsonpatch['apply'](_0x3fd26f,_0x2bd1f1,!![]);}catch(_0x57d31c){return BPromise[_0x5f89('0x1c')](_0x57d31c);}return _0x3fd26f['save']();};}function saveUpdates(_0x54cccd,_0x402be2){return function(_0x519dac){if(_0x519dac){return _0x519dac[_0x5f89('0x1d')](_0x54cccd)[_0x5f89('0x1e')](function(_0x7e3729){return _0x7e3729;});}return null;};}function removeEntity(_0x3f09af,_0x4f3075){return function(_0x53d455){if(_0x53d455){return _0x53d455[_0x5f89('0x1f')]()['then'](function(){_0x3f09af['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x267b33,_0x50bdb9){return function(_0x1159e8){if(!_0x1159e8){_0x267b33[_0x5f89('0x20')](0x194);}return _0x1159e8;};}function handleError(_0x244359,_0x30faad){_0x30faad=_0x30faad||0x1f4;return function(_0x14c64f){logger[_0x5f89('0x21')](_0x14c64f[_0x5f89('0x22')]);if(_0x14c64f[_0x5f89('0x23')]){delete _0x14c64f[_0x5f89('0x23')];}_0x244359[_0x5f89('0x17')](_0x30faad)['send'](_0x14c64f);};}exports[_0x5f89('0x24')]=function(_0xb7d7da,_0x6b7339){var _0x3ed38a={},_0x50b327={},_0x1925ef={'count':0x0,'rows':[]};var _0x239556=_[_0x5f89('0x25')](db[_0x5f89('0x26')][_0x5f89('0x27')],function(_0x2f30e4){return{'name':_0x2f30e4[_0x5f89('0x28')],'type':_0x2f30e4[_0x5f89('0x29')][_0x5f89('0x2a')]};});_0x50b327[_0x5f89('0x2b')]=_[_0x5f89('0x25')](_0x239556,_0x5f89('0x23'));_0x50b327[_0x5f89('0x2c')]=_[_0x5f89('0x2d')](_0xb7d7da[_0x5f89('0x2c')]);_0x50b327[_0x5f89('0x2e')]=_[_0x5f89('0x2f')](_0x50b327[_0x5f89('0x2b')],_0x50b327[_0x5f89('0x2c')]);_0x3ed38a['attributes']=_[_0x5f89('0x2f')](_0x50b327[_0x5f89('0x2b')],qs['fields'](_0xb7d7da['query'][_0x5f89('0x30')]));_0x3ed38a[_0x5f89('0x31')]=_0x3ed38a[_0x5f89('0x31')][_0x5f89('0x32')]?_0x3ed38a[_0x5f89('0x31')]:_0x50b327[_0x5f89('0x2b')];if(!_0xb7d7da[_0x5f89('0x2c')][_0x5f89('0x33')](_0x5f89('0x34'))){_0x3ed38a[_0x5f89('0x35')]=qs[_0x5f89('0x35')](_0xb7d7da[_0x5f89('0x2c')][_0x5f89('0x35')]);_0x3ed38a[_0x5f89('0x1a')]=qs[_0x5f89('0x1a')](_0xb7d7da[_0x5f89('0x2c')][_0x5f89('0x1a')]);}_0x3ed38a[_0x5f89('0x36')]=qs['sort'](_0xb7d7da[_0x5f89('0x2c')][_0x5f89('0x37')]);_0x3ed38a[_0x5f89('0x38')]=qs[_0x5f89('0x2e')](_[_0x5f89('0x39')](_0xb7d7da[_0x5f89('0x2c')],_0x50b327[_0x5f89('0x2e')]));if(_0xb7d7da['query'][_0x5f89('0x3a')]){_0x3ed38a[_0x5f89('0x38')]=_[_0x5f89('0x3b')](_0x3ed38a[_0x5f89('0x38')],{'$or':_[_0x5f89('0x25')](_0x239556,function(_0x2de276){if(_0x2de276[_0x5f89('0x29')]!==_0x5f89('0x3c')){var _0x44f4f6={};_0x44f4f6[_0x2de276['name']]={'$like':'%'+_0xb7d7da['query'][_0x5f89('0x3a')]+'%'};return _0x44f4f6;}})});}_0x3ed38a=_[_0x5f89('0x3b')]({},_0x3ed38a,_0xb7d7da[_0x5f89('0x3d')]);var _0x40c7c2={'where':_0x3ed38a[_0x5f89('0x38')]};return db['OpenchannelApplication'][_0x5f89('0x19')](_0x40c7c2)[_0x5f89('0x1e')](function(_0x12a94b){_0x1925ef[_0x5f89('0x19')]=_0x12a94b;if(_0xb7d7da[_0x5f89('0x2c')][_0x5f89('0x3e')]){_0x3ed38a[_0x5f89('0x3f')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x5f89('0x40')](_0x3ed38a);})[_0x5f89('0x1e')](function(_0x357985){_0x1925ef[_0x5f89('0x41')]=_0x357985;return _0x1925ef;})[_0x5f89('0x1e')](respondWithFilteredResult(_0x6b7339,_0x3ed38a))[_0x5f89('0x42')](handleError(_0x6b7339,null));};exports['show']=function(_0xd114b1,_0x4afd61){var _0x3bd931={'raw':!![],'where':{'id':_0xd114b1['params']['id']}},_0x1e92bb={};_0x1e92bb[_0x5f89('0x2b')]=_[_0x5f89('0x2d')](db[_0x5f89('0x26')][_0x5f89('0x27')]);_0x1e92bb[_0x5f89('0x2c')]=_[_0x5f89('0x2d')](_0xd114b1[_0x5f89('0x2c')]);_0x1e92bb[_0x5f89('0x2e')]=_['intersection'](_0x1e92bb['model'],_0x1e92bb[_0x5f89('0x2c')]);_0x3bd931[_0x5f89('0x31')]=_['intersection'](_0x1e92bb[_0x5f89('0x2b')],qs[_0x5f89('0x30')](_0xd114b1['query'][_0x5f89('0x30')]));_0x3bd931[_0x5f89('0x31')]=_0x3bd931[_0x5f89('0x31')][_0x5f89('0x32')]?_0x3bd931['attributes']:_0x1e92bb[_0x5f89('0x2b')];if(_0xd114b1[_0x5f89('0x2c')][_0x5f89('0x3e')]){_0x3bd931[_0x5f89('0x3f')]=[{'all':!![]}];}_0x3bd931=_[_0x5f89('0x3b')]({},_0x3bd931,_0xd114b1[_0x5f89('0x3d')]);return db[_0x5f89('0x26')][_0x5f89('0x43')](_0x3bd931)['then'](handleEntityNotFound(_0x4afd61,null))['then'](respondWithResult(_0x4afd61,null))[_0x5f89('0x42')](handleError(_0x4afd61,null));};exports[_0x5f89('0x44')]=function(_0x526e2d,_0xc5e0d6){return db[_0x5f89('0x26')]['create'](_0x526e2d['body'],{})['then'](respondWithResult(_0xc5e0d6,0xc9))[_0x5f89('0x42')](handleError(_0xc5e0d6,null));};exports[_0x5f89('0x1d')]=function(_0x2cdc9a,_0x594f5c){if(_0x2cdc9a[_0x5f89('0x45')]['id']){delete _0x2cdc9a[_0x5f89('0x45')]['id'];}return db[_0x5f89('0x26')][_0x5f89('0x43')]({'where':{'id':_0x2cdc9a[_0x5f89('0x46')]['id']}})[_0x5f89('0x1e')](handleEntityNotFound(_0x594f5c,null))[_0x5f89('0x1e')](saveUpdates(_0x2cdc9a[_0x5f89('0x45')],null))[_0x5f89('0x1e')](respondWithResult(_0x594f5c,null))['catch'](handleError(_0x594f5c,null));};exports[_0x5f89('0x1f')]=function(_0x3de319,_0x43ceeb){return db[_0x5f89('0x26')][_0x5f89('0x43')]({'where':{'id':_0x3de319['params']['id']}})['then'](handleEntityNotFound(_0x43ceeb,null))[_0x5f89('0x1e')](removeEntity(_0x43ceeb,null))[_0x5f89('0x42')](handleError(_0x43ceeb,null));}; \ No newline at end of file +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 diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index f9e550b..116e858 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 _0x2fa7=['../../config/environment','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2fa7,0x165));var _0x72fa=function(_0x1e24af,_0x3b1044){_0x1e24af=_0x1e24af-0x0;var _0x42cb51=_0x2fa7[_0x1e24af];return _0x42cb51;};'use strict';var _=require('lodash');var util=require(_0x72fa('0x0'));var logger=require(_0x72fa('0x1'))(_0x72fa('0x2'));var moment=require(_0x72fa('0x3'));var BPromise=require(_0x72fa('0x4'));var rp=require(_0x72fa('0x5'));var fs=require('fs');var path=require(_0x72fa('0x6'));var rimraf=require('rimraf');var config=require(_0x72fa('0x7'));var attributes=require('./openchannelApplication.attributes');module[_0x72fa('0x8')]=function(_0x22ea13,_0x2b40f7){return _0x22ea13[_0x72fa('0x9')](_0x72fa('0xa'),attributes,{'tableName':_0x72fa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x72fa('0xc'),'collate':_0x72fa('0xd')});}; \ No newline at end of file +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 diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index b44a994..a1021cd 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(_0x3d6192,_0x1b9c39){var _0x38e61e=function(_0x5420b8){while(--_0x5420b8){_0x3d6192['push'](_0x3d6192['shift']());}};_0x38e61e(++_0x1b9c39);}(_0xb10b,0x12a));var _0xbb10=function(_0xe4e303,_0x8f9657){_0xe4e303=_0xe4e303-0x0;var _0x39021e=_0xb10b[_0xe4e303];return _0x39021e;};'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(_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 diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 8c7e118..fcfcc30 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 _0xcd0d=['addTags','put','/:id','tracked','openchannelinteraction:update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','show','/:id/messages','getMessages','/:id/download','download','create','addMessage','post','/:id/tags','openchannel','openchannelinteraction:addtags'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xcd0d,0x1ea));var _0xdcd0=function(_0x20f3bc,_0x34c2fd){_0x20f3bc=_0x20f3bc-0x0;var _0x2e0502=_0xcd0d[_0x20f3bc];return _0x2e0502;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xdcd0('0x0'));var express=require(_0xdcd0('0x1'));var router=express[_0xdcd0('0x2')]();var auth=require(_0xdcd0('0x3'));var interaction=require(_0xdcd0('0x4'));var config=require(_0xdcd0('0x5'));var controller=require(_0xdcd0('0x6'));router[_0xdcd0('0x7')]('/',auth[_0xdcd0('0x8')](),controller[_0xdcd0('0x9')]);router[_0xdcd0('0x7')](_0xdcd0('0xa'),auth[_0xdcd0('0x8')](),controller['describe']);router['get']('/:id',auth[_0xdcd0('0x8')](),controller[_0xdcd0('0xb')]);router[_0xdcd0('0x7')](_0xdcd0('0xc'),auth['isAuthenticated'](),controller[_0xdcd0('0xd')]);router[_0xdcd0('0x7')](_0xdcd0('0xe'),auth[_0xdcd0('0x8')](),controller[_0xdcd0('0xf')]);router['post']('/',auth[_0xdcd0('0x8')](),controller[_0xdcd0('0x10')]);router['post'](_0xdcd0('0xc'),auth['isAuthenticated'](),controller[_0xdcd0('0x11')]);router[_0xdcd0('0x12')](_0xdcd0('0x13'),auth[_0xdcd0('0x8')](),interaction['tracked'](_0xdcd0('0x14'),_0xdcd0('0x15')),controller[_0xdcd0('0x16')]);router[_0xdcd0('0x17')](_0xdcd0('0x18'),auth['isAuthenticated'](),interaction[_0xdcd0('0x19')]('openchannel',_0xdcd0('0x1a')),controller['update']);router[_0xdcd0('0x1b')](_0xdcd0('0x18'),auth['isAuthenticated'](),interaction[_0xdcd0('0x19')](_0xdcd0('0x14'),_0xdcd0('0x1c')),controller[_0xdcd0('0x1d')]);router[_0xdcd0('0x1b')](_0xdcd0('0x13'),auth[_0xdcd0('0x8')](),controller[_0xdcd0('0x1e')]);module[_0xdcd0('0x1f')]=router; \ No newline at end of file +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 diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index bc8f565..cdd822f 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 _0x037c=['sequelize','exports','DATE','STRING','ENUM','out'];(function(_0x535f67,_0x37a28f){var _0x58410e=function(_0x17c733){while(--_0x17c733){_0x535f67['push'](_0x535f67['shift']());}};_0x58410e(++_0x37a28f);}(_0x037c,0x9c));var _0xc037=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x037c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc037('0x0'));module[_0xc037('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc037('0x2')]},'disposition':{'type':Sequelize[_0xc037('0x3')]},'note':{'type':Sequelize[_0xc037('0x3')]},'read1stAt':{'type':Sequelize[_0xc037('0x2')]},'threadId':{'type':Sequelize[_0xc037('0x3')]},'externalUrl':{'type':Sequelize[_0xc037('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xc037('0x4')]('in',_0xc037('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xc037('0x3')]}}; \ No newline at end of file +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 diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index fd2811c..2faeaa3 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 _0x624e=['basename','existsSync','pipe','createWriteStream','System','out','renderFile','views','downloadInteraction.html','toFile','transcript-','download','err','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','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','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','end','error','stack','name','Users','map','fullname','TagIds','Tags','split','push','catch','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','select','field','color','from','tools_tags','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','openchannel_interactions','cm_contacts','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','start','Tag','forEach','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','compact','isEmpty','OpenchannelAccountId','where','i.OpenchannelAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','OpenchannelInteraction','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','all','rows','show','keys','includeAll','include','options','create','body','params','destroy','describe','addMessage','OpenchannelMessage','omit','ids','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','openchannelInteractionTags:save','removeTags','join','server','files','tmp','root','attachments','CmContact','firstName','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','Owner','get','10px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','format','%s\x20#%d','Openchannel','Account','N.A.','createdAt','closed','closedAt','Private'];(function(_0xb6b94c,_0x3537c0){var _0x27e459=function(_0x5bcd31){while(--_0x5bcd31){_0xb6b94c['push'](_0xb6b94c['shift']());}};_0x27e459(++_0x3537c0);}(_0x624e,0xf9));var _0xe624=function(_0x2a16a8,_0xced6ae){_0x2a16a8=_0x2a16a8-0x0;var _0x5e5123=_0x624e[_0x2a16a8];return _0x5e5123;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe624('0x0'));var zipdir=require(_0xe624('0x1'));var jsonpatch=require(_0xe624('0x2'));var rp=require(_0xe624('0x3'));var moment=require(_0xe624('0x4'));var BPromise=require(_0xe624('0x5'));var Mustache=require(_0xe624('0x6'));var util=require('util');var path=require(_0xe624('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe624('0x8'));var fs=require('fs');var _=require(_0xe624('0x9'));var squel=require(_0xe624('0xa'));var crypto=require('crypto');var jsforce=require(_0xe624('0xb'));var deskjs=require(_0xe624('0xc'));var toCsv=require(_0xe624('0xd'));var querystring=require(_0xe624('0xe'));var Papa=require(_0xe624('0xf'));var Redis=require(_0xe624('0x10'));var authService=require(_0xe624('0x11'));var qs=require(_0xe624('0x12'));var as=require(_0xe624('0x13'));var hardwareService=require(_0xe624('0x14'));var logger=require(_0xe624('0x15'))(_0xe624('0x16'));var utils=require(_0xe624('0x17'));var config=require(_0xe624('0x18'));var db=require(_0xe624('0x19'))['db'];config['redis']=_['defaults'](config[_0xe624('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xe624('0x1b'))(new Redis(config[_0xe624('0x1a')]));require('./openchannelInteraction.socket')[_0xe624('0x1c')](socket);function respondWithStatusCode(_0x28db45,_0x45a4c5){_0x45a4c5=_0x45a4c5||0xcc;return function(_0x2ed932){if(_0x2ed932){return _0x28db45[_0xe624('0x1d')](_0x45a4c5);}return _0x28db45[_0xe624('0x1e')](_0x45a4c5)['end']();};}function respondWithResult(_0x809f80,_0x2d586f){_0x2d586f=_0x2d586f||0xc8;return function(_0x1336d0){if(_0x1336d0){return _0x809f80[_0xe624('0x1e')](_0x2d586f)[_0xe624('0x1f')](_0x1336d0);}};}function respondWithFilteredResult(_0x22ad47,_0x2b8239){return function(_0x55020d){if(_0x55020d){var _0xdde7d7=_0x55020d[_0xe624('0x20')],_0x1b49a9=_0x2b8239[_0xe624('0x21')],_0x4c1dbf=_0x2b8239[_0xe624('0x21')]+_0x2b8239[_0xe624('0x22')],_0x386b23;if(_0x4c1dbf>=_0xdde7d7){_0x4c1dbf=_0xdde7d7;_0x386b23=0xc8;}else{_0x386b23=0xce;}_0x22ad47[_0xe624('0x1e')](_0x386b23);return _0x22ad47['set'](_0xe624('0x23'),_0x1b49a9+'-'+_0x4c1dbf+'/'+_0xdde7d7)['json'](_0x55020d);}return null;};}function patchUpdates(_0x444a81){return function(_0xbd6151){try{jsonpatch[_0xe624('0x24')](_0xbd6151,_0x444a81,!![]);}catch(_0x53101d){return BPromise[_0xe624('0x25')](_0x53101d);}return _0xbd6151[_0xe624('0x26')]();};}function saveUpdates(_0xc44d63,_0x2e5cd6){return function(_0x3d5642){if(_0x3d5642){return _0x3d5642[_0xe624('0x27')](_0xc44d63)['then'](function(_0x4289c6){return _0x4289c6;});}return null;};}function removeEntity(_0x1f0e1d,_0x168e8c){return function(_0x404657){if(_0x404657){return _0x404657['destroy']()[_0xe624('0x28')](function(){_0x1f0e1d[_0xe624('0x1e')](0xcc)[_0xe624('0x29')]();});}};}function handleEntityNotFound(_0x1e72c0,_0xd0701a){return function(_0x77b975){if(!_0x77b975){_0x1e72c0[_0xe624('0x1d')](0x194);}return _0x77b975;};}function handleError(_0x3d4f45,_0x2e6046){_0x2e6046=_0x2e6046||0x1f4;return function(_0x309009){logger[_0xe624('0x2a')](_0x309009[_0xe624('0x2b')]);if(_0x309009[_0xe624('0x2c')]){delete _0x309009[_0xe624('0x2c')];}_0x3d4f45[_0xe624('0x1e')](_0x2e6046)['send'](_0x309009);};}function getInteractionUsers(_0x1432d3,_0x3a59a9){return new BPromise(function(_0x3f6e2e,_0x1f63f0){try{if(_0x3a59a9[_0x1432d3['id']]){_0x1432d3[_0xe624('0x2d')]=_[_0xe624('0x2e')](_0x3a59a9[_0x1432d3['id']],function(_0x13da45){return{'id':_0x13da45['id'],'fullname':_0x13da45[_0xe624('0x2f')]};});}}catch(_0x53786a){_0x1f63f0(_0x53786a);}_0x3f6e2e(_0x1432d3);});}function getInteractionTags(_0x1f7a65,_0x272941){return new BPromise(function(_0x132b93,_0x557bb8){try{if(_0x1f7a65[_0xe624('0x30')]){_0x1f7a65[_0xe624('0x31')]=[];_0x1f7a65[_0xe624('0x30')][_0xe624('0x32')](',')['forEach'](function(_0x337819){_0x1f7a65[_0xe624('0x31')][_0xe624('0x33')](_0x272941[_0x337819]);});}delete _0x1f7a65['TagIds'];}catch(_0x1bb5fc){_0x557bb8(_0x1bb5fc);}_0x132b93(_0x1f7a65);});}function updateOpenchannelInteraction(_0x46f83f,_0x4f7d1b,_0x401eb1){return new BPromise(function(_0x525ef3,_0x34f49d){return getInteractionUsers(_0x46f83f,_0x401eb1)[_0xe624('0x28')](function(_0x41e08a){return getInteractionTags(_0x41e08a,_0x4f7d1b);})[_0xe624('0x28')](function(_0x5a6927){_0x525ef3(_0x5a6927);})[_0xe624('0x34')](function(_0x589fd0){_0x34f49d(_0x589fd0);});});}exports['index']=function(_0x36a2ca,_0x18d716){var _0x95237e={},_0x5098fc={},_0x4ac0d5={'count':0x0,'rows':[]};var _0x4186c8=_[_0xe624('0x2e')](db['OpenchannelInteraction'][_0xe624('0x35')],function(_0x2b9f7f){return{'name':_0x2b9f7f['fieldName'],'type':_0x2b9f7f[_0xe624('0x36')][_0xe624('0x37')]};});_0x5098fc['model']=_[_0xe624('0x2e')](_0x4186c8,_0xe624('0x2c'));_0x5098fc[_0xe624('0x38')]=_['keys'](_0x36a2ca[_0xe624('0x38')]);_0x5098fc[_0xe624('0x39')]=_[_0xe624('0x3a')](_0x5098fc[_0xe624('0x3b')],_0x5098fc[_0xe624('0x38')]);_0x95237e[_0xe624('0x3c')]=_[_0xe624('0x3a')](_0x5098fc[_0xe624('0x3b')],qs[_0xe624('0x3d')](_0x36a2ca[_0xe624('0x38')]['fields']));_0x95237e[_0xe624('0x3c')]=_0x95237e[_0xe624('0x3c')][_0xe624('0x3e')]?_0x95237e['attributes']:_0x5098fc[_0xe624('0x3b')];if(!_0x36a2ca['query'][_0xe624('0x3f')](_0xe624('0x40'))){_0x95237e['limit']=qs['limit'](_0x36a2ca['query'][_0xe624('0x22')]);_0x95237e[_0xe624('0x21')]=qs[_0xe624('0x21')](_0x36a2ca[_0xe624('0x38')][_0xe624('0x21')]);}_0x95237e[_0xe624('0x41')]=qs[_0xe624('0x42')](_0x36a2ca['query'][_0xe624('0x42')]);_0x95237e['where']=qs['filters'](_[_0xe624('0x43')](_0x36a2ca[_0xe624('0x38')],_0x5098fc[_0xe624('0x39')]));var _0x423e23=[];var _0x55da15=squel[_0xe624('0x44')]()['field']('id')[_0xe624('0x45')](_0xe624('0x2c'))[_0xe624('0x45')](_0xe624('0x46'))[_0xe624('0x47')](_0xe624('0x48'));var _0x39cfa2=squel['select']()[_0xe624('0x45')]('u.id')[_0xe624('0x45')](_0xe624('0x49'))[_0xe624('0x45')](_0xe624('0x4a'))[_0xe624('0x47')](_0xe624('0x4b'),'ui')[_0xe624('0x4c')](_0xe624('0x4d'),'u','u.id\x20=\x20ui.UserId');var _0x445111=squel['select']()['from'](_0xe624('0x4e'),'i')[_0xe624('0x4c')](_0xe624('0x4f'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xe624('0x4c')]('users','o',_0xe624('0x50'))[_0xe624('0x4c')](_0xe624('0x51'),'a',_0xe624('0x52'))[_0xe624('0x4c')](_0xe624('0x53'),'me',_0xe624('0x54'))[_0xe624('0x4c')]('openchannel_interaction_has_tags','it','it.OpenchannelInteractionId\x20=\x20i.id')[_0xe624('0x4c')](_0xe624('0x48'),'t','t.id\x20=\x20it.TagId');var _0x1591ac=squel[_0xe624('0x55')]();var _0x537a0c=[];var _0x1f4282=squel['expr']();var _0x4f3cf3;if(_0x36a2ca[_0xe624('0x38')][_0xe624('0x56')]){_0x4f3cf3=as[_0xe624('0x57')](_0x36a2ca[_0xe624('0x38')][_0xe624('0x56')]);var _0x30abf0=_0x4f3cf3[_0xe624('0x58')];for(var _0x14ebe1=0x0;_0x14ebe1<_0x4f3cf3[_0xe624('0x59')][_0xe624('0x3e')];_0x14ebe1++){var _0x58caff=_0x4f3cf3['conditions'][_0x14ebe1];var _0x59f2de='i';var _0x1ee307=_[_0xe624('0x5a')](_0x4186c8,[_0xe624('0x2c'),_0x58caff[_0xe624('0x45')]]);if(!_0x1ee307){switch(_0x58caff['field']){case _0xe624('0x5b'):if(_0x58caff[_0xe624('0x5c')]==0x1){_0x445111[_0xe624('0x5d')]('`'+_0x58caff[_0xe624('0x45')]+'`\x20=\x200');}else{_0x445111[_0xe624('0x5d')]('`'+_0x58caff[_0xe624('0x45')]+_0xe624('0x5e'));}break;case _0xe624('0x5f'):if(_0x58caff[_0xe624('0x60')]==='$substring'){if(_0x58caff[_0xe624('0x5c')][_0xe624('0x32')]('\x20')[_0xe624('0x3e')]>0x1){_0x1591ac[_0x30abf0](_0xe624('0x61'),qs[_0xe624('0x62')](_0x58caff[_0xe624('0x5c')]),null);}else{var _0x3ad4e7='%'+_0x58caff[_0xe624('0x5c')]+'%';_0x1591ac[_0x30abf0]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3ad4e7,_0x3ad4e7,_0x3ad4e7);}}else{_0x1ee307=_['find'](_0x4186c8,[_0xe624('0x2c'),_0xe624('0x63')]);_0x58caff[_0xe624('0x45')]=_0xe624('0x63');_0x3c5e60=as[_0xe624('0x64')](_0x59f2de,_0x1ee307[_0xe624('0x36')],_0x58caff);_0x1591ac[_0x30abf0](_0x3c5e60['text'],_0x3c5e60[_0xe624('0x5c')][_0xe624('0x65')],_0x3c5e60['value'][_0xe624('0x29')]);}break;case _0xe624('0x66'):var _0x257f84=_0x58caff[_0xe624('0x5c')]['split'](',')[_0xe624('0x2e')](function(_0x3c3234){return Number(_0x3c3234);});_0x257f84[_0xe624('0x67')](function(_0x36ebae){_0x1f4282['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x36ebae+',%');});_0x537a0c=_[_0xe624('0x68')](_0x537a0c,_0x257f84);break;case _0xe624('0x69'):if(_0x58caff[_0xe624('0x60')]===_0xe624('0x6a')){_0x1591ac[_0x30abf0](_0xe624('0x6b'),'%'+_0x58caff[_0xe624('0x5c')]+'%',null);}else{_0x1ee307=_[_0xe624('0x5a')](_0x4186c8,['name','UserId']);_0x58caff[_0xe624('0x45')]='UserId';_0x3c5e60=as[_0xe624('0x64')](_0x59f2de,_0x1ee307['type'],_0x58caff);_0x1591ac[_0x30abf0](_0x3c5e60[_0xe624('0x6c')],_0x3c5e60[_0xe624('0x5c')][_0xe624('0x65')],_0x3c5e60[_0xe624('0x5c')][_0xe624('0x29')]);}break;case'body':_0x3c5e60=as[_0xe624('0x64')]('me',null,_0x58caff);_0x1591ac[_0x30abf0](_0x3c5e60[_0xe624('0x6c')],_0x3c5e60[_0xe624('0x5c')]['start'],_0x3c5e60['value']['end']);break;}}else{var _0x3c5e60=as['buildExpression'](_0x59f2de,_0x1ee307[_0xe624('0x36')],_0x58caff);_0x1591ac[_0x30abf0](_0x3c5e60[_0xe624('0x6c')],_0x3c5e60[_0xe624('0x5c')][_0xe624('0x65')],_0x3c5e60[_0xe624('0x5c')][_0xe624('0x29')]);}}}else{var _0x430fe8=_(_0x36a2ca[_0xe624('0x38')])['keys']()[_0xe624('0x2e')](function(_0xf432fd){return _['some'](_0x4186c8,['name',_0xf432fd])?_0xf432fd:undefined;})[_0xe624('0x6d')]()[_0xe624('0x5c')]();if(!_[_0xe624('0x6e')](_0x430fe8)){_0x430fe8['forEach'](function(_0x390c49){if(_0x390c49===_0xe624('0x6f')){_0x445111[_0xe624('0x70')](_0xe624('0x71'),[][_0xe624('0x72')](_0x36a2ca[_0xe624('0x38')][_0x390c49]));}else if(_0x390c49==='createdAt'){var _0x22fda7=JSON[_0xe624('0x73')](_0x36a2ca[_0xe624('0x38')][_0x390c49])[_0xe624('0x74')];var _0x5359d3=JSON['parse'](_0x36a2ca[_0xe624('0x38')][_0x390c49])[_0xe624('0x75')];_0x445111[_0xe624('0x70')](_0xe624('0x76'),_0x22fda7,_0x5359d3);}else{if(_0x36a2ca[_0xe624('0x38')][_0x390c49]==='null'){_0x445111[_0xe624('0x70')]('i.'+_0x390c49+_0xe624('0x77'));}else{_0x445111[_0xe624('0x70')]('i.'+_0x390c49+_0xe624('0x78'),_0x36a2ca['query'][_0x390c49]);}}});}if(_0x36a2ca[_0xe624('0x38')]['read']){if(_0x36a2ca[_0xe624('0x38')][_0xe624('0x79')]==0x1){_0x445111[_0xe624('0x5d')](_0xe624('0x7a'));}else{_0x445111[_0xe624('0x5d')](_0xe624('0x7b'));}}if(_0x36a2ca[_0xe624('0x38')][_0xe624('0x7c')]){_0x537a0c=_[_0xe624('0x7d')](_0x36a2ca[_0xe624('0x38')][_0xe624('0x7c')])?_0x36a2ca['query']['tag']:new Array(_0x36a2ca[_0xe624('0x38')]['tag']);_0x537a0c[_0xe624('0x67')](function(_0x10c360){_0x1f4282['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x10c360+',%');});}if(_0x36a2ca[_0xe624('0x38')][_0xe624('0x7e')]){var _0x5d2975=_0x36a2ca['query'][_0xe624('0x7e')]['replace']('\x5c','\x5c\x5c')[_0xe624('0x7f')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0xe624('0x80')](_0x5d2975)){_0x1591ac['or'](_0xe624('0x81'),_0x5d2975+'%');}else{_0x1591ac['or'](_0xe624('0x82'),qs[_0xe624('0x62')](_0x5d2975))['or']('i.from\x20LIKE\x20?',_0x5d2975+'%')['or'](_0xe624('0x83'),_0x5d2975+'%');}}}_0x445111[_0xe624('0x70')](_0x1591ac);_0x445111[_0xe624('0x84')](_0xe624('0x85'));var _0x7b4072={'type':db['Sequelize']['QueryTypes'][_0xe624('0x86')],'raw':!![]};var _0x275a84=_0x445111[_0xe624('0x87')]();_0x275a84[_0xe624('0x45')](_0xe624('0x85'));_0x275a84[_0xe624('0x45')](_0xe624('0x88'),'unreadMessages');if(_0x95237e['order']){_0x95237e[_0xe624('0x41')]['forEach'](function(_0x7925fa){_0x445111[_0xe624('0x41')]('i.'+_0x7925fa[0x0],_0x7925fa[0x1]===_0xe624('0x89')?![]:!![]);});}if(!_[_0xe624('0x6e')](_0x537a0c)){_0x445111['having'](_0x1f4282);_0x275a84[_0xe624('0x70')](_0xe624('0x8a'),_0x537a0c);}BPromise[_0xe624('0x8b')]()[_0xe624('0x28')](function(){if(!_0x4f3cf3){if(_0x36a2ca[_0xe624('0x38')][_0xe624('0x6f')]||_0x36a2ca['query'][_0xe624('0x8c')])return;_0x275a84['where'](_0xe624('0x8d'));_0x445111[_0xe624('0x70')](_0xe624('0x8d'));return;}return _0x36a2ca[_0xe624('0x8e')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0xe624('0x28')](function(_0x2a64b8){if(_[_0xe624('0x6e')](_0x2a64b8)){_0x275a84[_0xe624('0x70')](_0xe624('0x8f'));_0x445111[_0xe624('0x70')](_0xe624('0x8f'));}else{_0x275a84[_0xe624('0x70')](_0xe624('0x71'),_[_0xe624('0x2e')](_0x2a64b8,'id'));_0x445111[_0xe624('0x70')](_0xe624('0x71'),_[_0xe624('0x2e')](_0x2a64b8,'id'));}});})[_0xe624('0x28')](function(){db[_0xe624('0x90')][_0xe624('0x38')](_0x275a84[_0xe624('0x91')](),_0x7b4072)[_0xe624('0x28')](function(_0x346767){_0x4ac0d5['count']=_0x346767['length'];if(_0x4ac0d5[_0xe624('0x20')]===0x0)return[];return db[_0xe624('0x90')][_0xe624('0x38')](_0x55da15['toString'](),_0x7b4072)[_0xe624('0x28')](function(_0xfd5e0e){_0x423e23=_[_0xe624('0x92')](_0xfd5e0e,'id');_0x7b4072=_[_0xe624('0x93')](_0x7b4072,{'model':db[_0xe624('0x94')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x36a2ca[_0xe624('0x38')][_0xe624('0x3d')]){_0x95237e[_0xe624('0x3c')]['forEach'](function(_0x3061c2){_0x445111['field']('i.'+_0x3061c2);});}else{_0x445111[_0xe624('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xe624('0x5b'));_0x445111[_0xe624('0x45')](_0xe624('0x95'),'Account.key');_0x445111[_0xe624('0x45')](_0xe624('0x96'),_0xe624('0x97'));_0x445111[_0xe624('0x45')](_0xe624('0x98'));_0x445111[_0xe624('0x45')](_0xe624('0x99'),_0xe624('0x9a'));_0x445111[_0xe624('0x45')]('c.lastName','Contact.lastName');_0x445111[_0xe624('0x45')](_0xe624('0x9b'),_0xe624('0x9c'));_0x445111[_0xe624('0x45')](_0xe624('0x9d'),_0xe624('0x9e'));_0x445111[_0xe624('0x45')](_0xe624('0x9f'),_0xe624('0xa0'));_0x445111[_0xe624('0x45')](_0xe624('0xa1'),_0xe624('0xa2'));_0x445111['field'](_0xe624('0xa3'),_0xe624('0xa4'));_0x445111[_0xe624('0x45')](_0xe624('0xa5'),_0xe624('0xa6'));_0x445111[_0xe624('0x45')](_0xe624('0xa7'),'TagIds');}_0x445111[_0xe624('0x22')](_0x95237e[_0xe624('0x22')]);_0x445111['offset'](_0x95237e[_0xe624('0x21')]);return db[_0xe624('0x90')][_0xe624('0x38')](_0x445111[_0xe624('0x91')](),_0x7b4072);})[_0xe624('0x28')](function(_0x3a075d){_0x39cfa2[_0xe624('0x70')](_0xe624('0xa8'),_[_0xe624('0x2e')](_0x3a075d,'id'));return db[_0xe624('0x90')]['query'](_0x39cfa2['toString'](),_0x7b4072)[_0xe624('0x28')](function(_0x4da37a){var _0x431b32=_['groupBy'](_0x4da37a,_0xe624('0xa9'));var _0x3aad7b=[];_0x3a075d[_0xe624('0x67')](function(_0x2f0407){_0x3aad7b[_0xe624('0x33')](updateOpenchannelInteraction(_0x2f0407,_0x423e23,_0x431b32));});return BPromise[_0xe624('0xaa')](_0x3aad7b);});});})['then'](function(_0x118c21){_0x4ac0d5[_0xe624('0xab')]=_0x118c21;return _0x4ac0d5;})[_0xe624('0x28')](respondWithFilteredResult(_0x18d716,_0x95237e));})[_0xe624('0x34')](handleError(_0x18d716,null));};exports[_0xe624('0xac')]=function(_0x19ea38,_0x1d3278){var _0x4cf9d3={'raw':![],'where':{'id':_0x19ea38['params']['id']}},_0x312ec2={};_0x312ec2[_0xe624('0x3b')]=_[_0xe624('0xad')](db[_0xe624('0x94')][_0xe624('0x35')]);_0x312ec2[_0xe624('0x38')]=_[_0xe624('0xad')](_0x19ea38[_0xe624('0x38')]);_0x312ec2[_0xe624('0x39')]=_[_0xe624('0x3a')](_0x312ec2[_0xe624('0x3b')],_0x312ec2[_0xe624('0x38')]);_0x4cf9d3[_0xe624('0x3c')]=_[_0xe624('0x3a')](_0x312ec2[_0xe624('0x3b')],qs[_0xe624('0x3d')](_0x19ea38['query'][_0xe624('0x3d')]));_0x4cf9d3[_0xe624('0x3c')]=_0x4cf9d3[_0xe624('0x3c')]['length']?_0x4cf9d3['attributes']:_0x312ec2[_0xe624('0x3b')];if(_0x19ea38[_0xe624('0x38')][_0xe624('0xae')]){_0x4cf9d3[_0xe624('0xaf')]=[{'all':!![]}];}_0x4cf9d3=_[_0xe624('0x93')]({},_0x4cf9d3,_0x19ea38[_0xe624('0xb0')]);return db[_0xe624('0x94')][_0xe624('0x5a')](_0x4cf9d3)[_0xe624('0x28')](handleEntityNotFound(_0x1d3278,null))[_0xe624('0x28')](respondWithResult(_0x1d3278,null))[_0xe624('0x34')](handleError(_0x1d3278,null));};exports[_0xe624('0xb1')]=function(_0x46829d,_0x4d41f8){return db[_0xe624('0x94')][_0xe624('0xb1')](_0x46829d[_0xe624('0xb2')],{})[_0xe624('0x28')](respondWithResult(_0x4d41f8,0xc9))['catch'](handleError(_0x4d41f8,null));};exports[_0xe624('0x27')]=function(_0x2203c2,_0x2cc269){if(_0x2203c2['body']['id']){delete _0x2203c2[_0xe624('0xb2')]['id'];}return db[_0xe624('0x94')]['find']({'where':{'id':_0x2203c2[_0xe624('0xb3')]['id']}})[_0xe624('0x28')](handleEntityNotFound(_0x2cc269,null))[_0xe624('0x28')](saveUpdates(_0x2203c2[_0xe624('0xb2')],null))['then'](respondWithResult(_0x2cc269,null))[_0xe624('0x34')](handleError(_0x2cc269,null));};exports[_0xe624('0xb4')]=function(_0x6cdbc,_0x395cfc){return db[_0xe624('0x94')]['find']({'where':{'id':_0x6cdbc[_0xe624('0xb3')]['id']}})[_0xe624('0x28')](handleEntityNotFound(_0x395cfc,null))[_0xe624('0x28')](removeEntity(_0x395cfc,null))['catch'](handleError(_0x395cfc,null));};exports[_0xe624('0xb5')]=function(_0x5996b0,_0xc7cc20){return db[_0xe624('0x94')][_0xe624('0xb5')]()['then'](respondWithResult(_0xc7cc20,null))[_0xe624('0x34')](handleError(_0xc7cc20,null));};exports[_0xe624('0xb6')]=function(_0x29fd54,_0x41536d,_0x578e5d){return db[_0xe624('0xb7')][_0xe624('0x5a')]({'where':{'id':_0x29fd54[_0xe624('0xb3')]['id']}})[_0xe624('0x28')](handleEntityNotFound(_0x41536d,null))[_0xe624('0x28')](function(_0x330bf8){if(_0x330bf8){return _0x330bf8['addMessage'](_0x29fd54[_0xe624('0xb2')]['ids'],_[_0xe624('0xb8')](_0x29fd54['body'],[_0xe624('0xb9'),'id'])||{});}})[_0xe624('0x28')](respondWithResult(_0x41536d,null))['catch'](handleError(_0x41536d,null));};exports[_0xe624('0xba')]=function(_0x4c0a86,_0x426739,_0x1eecfb){var _0xbb3359={'raw':![],'where':{}};var _0x2a4e67={};var _0x521e66={'count':0x0,'rows':[]};return db[_0xe624('0x94')][_0xe624('0xbb')]({'where':{'id':_0x4c0a86['params']['id']}})[_0xe624('0x28')](handleEntityNotFound(_0x426739,null))['then'](function(_0x1f9203){if(_0x1f9203){_0x2a4e67[_0xe624('0x3b')]=_[_0xe624('0xad')](db['OpenchannelMessage'][_0xe624('0x35')]);_0x2a4e67[_0xe624('0x38')]=_[_0xe624('0xad')](_0x4c0a86[_0xe624('0x38')]);_0x2a4e67[_0xe624('0x39')]=_[_0xe624('0x3a')](_0x2a4e67[_0xe624('0x3b')],_0x2a4e67[_0xe624('0x38')]);_0xbb3359['attributes']=_[_0xe624('0x3a')](_0x2a4e67[_0xe624('0x3b')],qs[_0xe624('0x3d')](_0x4c0a86['query'][_0xe624('0x3d')]));_0xbb3359['attributes']=_0xbb3359['attributes'][_0xe624('0x3e')]?_0xbb3359['attributes']:_0x2a4e67[_0xe624('0x3b')];if(!_0x4c0a86[_0xe624('0x38')][_0xe624('0x3f')](_0xe624('0x40'))){_0xbb3359['limit']=qs[_0xe624('0x22')](_0x4c0a86[_0xe624('0x38')][_0xe624('0x22')]);_0xbb3359[_0xe624('0x21')]=qs[_0xe624('0x21')](_0x4c0a86[_0xe624('0x38')]['offset']);}_0xbb3359[_0xe624('0x41')]=qs[_0xe624('0x42')](_0x4c0a86[_0xe624('0x38')][_0xe624('0x42')]);_0xbb3359[_0xe624('0x70')]=qs[_0xe624('0x39')](_[_0xe624('0x43')](_0x4c0a86[_0xe624('0x38')],_0x2a4e67['filters']));_0xbb3359[_0xe624('0x70')]['OpenchannelInteractionId']=_0x1f9203['id'];if(_0x4c0a86['query'][_0xe624('0x7e')]){_0xbb3359[_0xe624('0x70')]=_[_0xe624('0x93')](_0xbb3359[_0xe624('0x70')],{'$or':_[_0xe624('0x2e')](_0xbb3359['attributes'],function(_0x1f7e4a){var _0x23abed={};_0x23abed[_0x1f7e4a]={'$like':'%'+_0x4c0a86[_0xe624('0x38')][_0xe624('0x7e')]+'%'};return _0x23abed;})});}if(_0x4c0a86['query'][_0xe624('0x74')]){var _0xa4bd9e=_0x4c0a86['query'][_0xe624('0x74')][_0xe624('0x32')](',');var _0x511c56={};_0x511c56[_0xa4bd9e[0x0]]={'$gte':moment(_0xa4bd9e[0x1])['format'](_0xe624('0xbc'))};_0xbb3359[_0xe624('0x70')]=_[_0xe624('0x93')](_0xbb3359[_0xe624('0x70')],_0x511c56);}_0xbb3359=_[_0xe624('0x93')]({},_0xbb3359,_0x4c0a86[_0xe624('0xb0')]);return db['OpenchannelMessage'][_0xe624('0x20')]({'where':_0xbb3359[_0xe624('0x70')]})['then'](function(_0x59015e){_0x521e66[_0xe624('0x20')]=_0x59015e;if(_0x4c0a86['query'][_0xe624('0xae')]){_0xbb3359[_0xe624('0xaf')]=[{'all':!![]}];}return db[_0xe624('0xb7')][_0xe624('0xbd')](_0xbb3359);})[_0xe624('0x28')](function(_0x55846f){_0x521e66['rows']=_0x55846f;return _0x521e66;});}})['then'](respondWithFilteredResult(_0x426739,_0xbb3359))[_0xe624('0x34')](handleError(_0x426739,null));};exports[_0xe624('0xbe')]=function(_0x464dcb,_0x3c8335,_0x17ddab){return db[_0xe624('0x94')]['find']({'where':{'id':_0x464dcb[_0xe624('0xb3')]['id']}})[_0xe624('0x28')](handleEntityNotFound(_0x3c8335,null))['then'](function(_0x28dd6c){if(_0x28dd6c){return _0x28dd6c[_0xe624('0xbf')](_0x464dcb[_0xe624('0xb2')][_0xe624('0xb9')],_['omit'](_0x464dcb['body'],[_0xe624('0xb9'),'id'])||{})[_0xe624('0xc0')](function(){return db[_0xe624('0x66')][_0xe624('0xbd')]({'attributes':['id',_0xe624('0x2c'),'color'],'where':{'id':_0x464dcb[_0xe624('0xb2')][_0xe624('0xb9')]}});})['then'](function(_0x5a8bc5){socket['emit'](_0xe624('0xc1'),{'id':Number(_0x464dcb[_0xe624('0xb3')]['id']),'tags':_0x5a8bc5||[]});return{'id':Number(_0x464dcb[_0xe624('0xb3')]['id']),'tags':_0x5a8bc5||[]};});}})[_0xe624('0x28')](respondWithResult(_0x3c8335,null))[_0xe624('0x34')](handleError(_0x3c8335,null));};exports[_0xe624('0xc2')]=function(_0x52daf9,_0x31f113,_0x3d20d0){return db[_0xe624('0x94')]['find']({'where':{'id':_0x52daf9['params']['id']}})[_0xe624('0x28')](handleEntityNotFound(_0x31f113,null))[_0xe624('0x28')](function(_0x26122a){if(_0x26122a){return _0x26122a[_0xe624('0xc2')](_0x52daf9[_0xe624('0x38')][_0xe624('0xb9')]);}})[_0xe624('0x28')](respondWithStatusCode(_0x31f113,null))[_0xe624('0x34')](handleError(_0x31f113,null));};exports['download']=function(_0x16d071,_0x2f2133){var _0x4c5d57=moment()['unix']()[_0xe624('0x91')]();var _0x3252fb=path[_0xe624('0xc3')](config['root'],_0xe624('0xc4'),_0xe624('0xc5'),_0xe624('0xc6'));var _0x3e3192=path[_0xe624('0xc3')](config[_0xe624('0xc7')],_0xe624('0xc4'),_0xe624('0xc5'),_0xe624('0xc8'));var _0x4bb9bb=path[_0xe624('0xc3')](_0x3252fb,_0x4c5d57);var _0x49bd0c=util['format']('transcript-%d-%s.zip',_0x16d071[_0xe624('0xb3')]['id'],_0x4c5d57);var _0x50eb14=path[_0xe624('0xc3')](_0x3252fb,_0x49bd0c);var _0x4e1b94=[];_0x4e1b94['push']({'model':db['User'],'as':'User','attributes':['id',_0xe624('0x2f')],'raw':!![]});_0x4e1b94['push']({'model':db[_0xe624('0xc9')],'as':_0xe624('0x5f'),'attributes':['id',_0xe624('0xca'),_0xe624('0xcb')],'raw':!![]});if(_0x16d071['query'][_0xe624('0xc8')]){_0x4e1b94[_0xe624('0x33')]({'model':db[_0xe624('0xcc')],'as':_0xe624('0xcc'),'raw':!![]});}var _0x478206=[{'model':db[_0xe624('0xb7')],'as':_0xe624('0xcd'),'attributes':['id',_0xe624('0xb2'),'createdAt',_0xe624('0xce'),_0xe624('0xcf'),_0xe624('0x79')],'include':_0x4e1b94}];_0x478206['push']({'model':db[_0xe624('0xd0')],'as':'Account','attributes':['id',_0xe624('0x2c')]});_0x478206[_0xe624('0x33')]({'model':db[_0xe624('0x69')],'as':_0xe624('0xd1'),'attributes':['id',_0xe624('0x2f')]});return db[_0xe624('0x94')][_0xe624('0x5a')]({'where':{'id':_0x16d071['params']['id']},'include':_0x478206})[_0xe624('0x28')](handleEntityNotFound(_0x2f2133,null))['then'](function(_0x37fe73){if(_0x37fe73){var _0x3d09f6=_0x37fe73[_0xe624('0xd2')]({'plain':!![]});fs['mkdirSync'](_0x4bb9bb);var _0x2d1b3f={'format':'A4','border':_0xe624('0xd3'),'header':{'height':'40px','contents':{'first':_0xe624('0xd4')}},'footer':{'height':'30px','contents':{'default':util['format'](_0xe624('0xd5'),util[_0xe624('0xd6')](_0xe624('0xd7'),_0xe624('0xd8'),_0x3d09f6['id']),moment()[_0xe624('0xd6')]('YYYY-MM-DD')[_0xe624('0x91')]())}}};var _0x574d9d={'channel':_0xe624('0xd8'),'account':_0x3d09f6[_0xe624('0xd9')][_0xe624('0x2c')],'agent':_0x3d09f6[_0xe624('0xd1')]?_0x3d09f6[_0xe624('0xd1')]['fullname']:_0xe624('0xda'),'createdAt':moment(_0x3d09f6[_0xe624('0xdb')])[_0xe624('0xd6')](_0xe624('0xbc'))[_0xe624('0x91')](),'closedAt':_0x3d09f6[_0xe624('0xdc')]?moment(_0x3d09f6[_0xe624('0xdd')])[_0xe624('0xd6')](_0xe624('0xbc'))[_0xe624('0x91')]():'','disposition':_0x3d09f6['disposition'],'visibility':_0x3d09f6['threadId']?'Public':_0xe624('0xde'),'messages':_(_0x3d09f6['Messages'])[_0xe624('0x7e')]({'secret':![]})[_0xe624('0x2e')](function(_0x337115){if(_0x337115['Attachment']){var _0x43c8fd=path[_0xe624('0xc3')](_0x3e3192,_0x337115[_0xe624('0xcc')][_0xe624('0xdf')]);if(fs[_0xe624('0xe0')](_0x43c8fd)){fs['createReadStream'](_0x43c8fd)[_0xe624('0xe1')](fs[_0xe624('0xe2')](path[_0xe624('0xc3')](_0x4bb9bb,_0x337115['Attachment']['basename'])));}}return{'date':moment(_0x337115['createdAt'])[_0xe624('0xd6')](_0xe624('0xbc'))[_0xe624('0x91')](),'sender':_0x337115['direction']==='out'?_0x337115[_0xe624('0x69')]?_0x337115[_0xe624('0x69')]['fullname']:_0xe624('0xe3'):_0x337115[_0xe624('0x5f')][_0xe624('0xca')]+(_0x337115['Contact'][_0xe624('0xcb')]?'\x20'+_0x337115[_0xe624('0x5f')]['lastName']:''),'body':_0x337115[_0xe624('0xcc')]?_0x337115['Attachment'][_0xe624('0xdf')]:_0x337115[_0xe624('0xb2')],'direction':_0x337115[_0xe624('0xce')]===_0xe624('0xe4')?'A':'C','secret':_0x337115[_0xe624('0xcf')],'read':_0x337115[_0xe624('0x79')],'attachment':_0x337115[_0xe624('0xcc')]};})[_0xe624('0x5c')]()};return ejs[_0xe624('0xe5')](path[_0xe624('0xc3')](config['root'],_0xe624('0xc4'),_0xe624('0xe6'),_0xe624('0xe7')),{'interaction':_0x574d9d})['then'](function(_0x3b92d9){return new BPromise(function(_0x3b9e29,_0x1c134d){pdf[_0xe624('0xb1')](_0x3b92d9,_0x2d1b3f)[_0xe624('0xe8')](path[_0xe624('0xc3')](_0x4bb9bb,_0xe624('0xe9')+_0x3d09f6['id']+'-'+_0x4c5d57+'.pdf'),function(_0x55cd5c,_0xe3715d){if(_0x55cd5c)return _0x1c134d(_0x55cd5c);_0x3b9e29(_0xe3715d);});});})[_0xe624('0x28')](function(){return new BPromise(function(_0x58a7ba,_0x4d09de){zipdir(_0x4bb9bb,{'saveTo':_0x50eb14},function(_0x5cf2a4,_0xe85d0e){if(_0x5cf2a4)return _0x4d09de(_0x5cf2a4);return _0x58a7ba(_0xe85d0e);});})[_0xe624('0x28')](function(){return new BPromise(function(_0x13fa90,_0x51bda7){rimraf(_0x4bb9bb,function(_0x53d925){if(_0x53d925)_0x51bda7(_0x53d925);return _0x13fa90();});});})[_0xe624('0x28')](function(){return _0x2f2133[_0xe624('0xea')](_0x50eb14,_0x49bd0c,function(_0x41efb9){if(_0x41efb9){console['log'](_0xe624('0xeb'),_0x41efb9);}else{fs['unlinkSync'](_0x50eb14);}});});});}else{return _0x2f2133[_0xe624('0x1d')](0xc8);}})[_0xe624('0x34')](handleError(_0x2f2133,null));}; \ No newline at end of file +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 diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 9de67dc..c88b2bc 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 _0xe797=['unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','OpenchannelInteraction','setMaxListeners','update','getUsers','then','setDataValue','Users','map','findAll'];(function(_0x515283,_0x813dea){var _0x38f836=function(_0x40c8f4){while(--_0x40c8f4){_0x515283['push'](_0x515283['shift']());}};_0x38f836(++_0x813dea);}(_0xe797,0x8e));var _0x7e79=function(_0x2ab11e,_0x232cb5){_0x2ab11e=_0x2ab11e-0x0;var _0x2b0133=_0xe797[_0x2ab11e];return _0x2b0133;};'use strict';var EventEmitter=require(_0x7e79('0x0'));var OpenchannelInteraction=require(_0x7e79('0x1'))['db'][_0x7e79('0x2')];var OpenchannelMessage=require(_0x7e79('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x7e79('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7e79('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5e1067){return function(_0x329b29,_0x48807a,_0x2deddf){_0x329b29[_0x7e79('0x5')]({'attributes':['id'],'raw':!![]})[_0x7e79('0x6')](function(_0x34a0af){_0x329b29[_0x7e79('0x7')](_0x7e79('0x8'),_0x34a0af[_0x7e79('0x9')](function(_0x4e1d24){return{'id':_0x4e1d24['id']};}));return OpenchannelMessage[_0x7e79('0xa')]({'where':{'OpenchannelInteractionId':_0x329b29['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7e79('0x6')](function(_0x5b5016){_0x329b29[_0x7e79('0x7')](_0x7e79('0xb'),_0x5b5016[_0x7e79('0xc')]);OpenchannelInteractionEvents[_0x7e79('0xd')](_0x5e1067+':'+_0x329b29['id'],_0x329b29);OpenchannelInteractionEvents[_0x7e79('0xd')](_0x5e1067,_0x329b29);_0x2deddf(null);})[_0x7e79('0xe')](_0x2deddf(null));};}for(var e in events){if(events[_0x7e79('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x7e79('0x10')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +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 diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index a32e6f9..3e6aa1e 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 _0xe015=['changed','closed','format','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./openchannelInteraction.attributes','openchannel_interactions'];(function(_0x5a99db,_0x1cece5){var _0x3aad62=function(_0x334cb7){while(--_0x334cb7){_0x5a99db['push'](_0x5a99db['shift']());}};_0x3aad62(++_0x1cece5);}(_0xe015,0x13b));var _0x5e01=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xe015[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x5e01('0x0'));var util=require(_0x5e01('0x1'));var logger=require(_0x5e01('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5e01('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e01('0x4'));var rimraf=require(_0x5e01('0x5'));var config=require(_0x5e01('0x6'));var attributes=require(_0x5e01('0x7'));module['exports']=function(_0x1814cb,_0x3d2da2){return _0x1814cb['define']('OpenchannelInteraction',attributes,{'tableName':_0x5e01('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3aeaef,_0x1420c2,_0x40d31f){if(_0x3aeaef[_0x5e01('0x9')](_0x5e01('0xa'))){_0x3aeaef['closedAt']=moment()[_0x5e01('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x40d31f(null,_0x3aeaef);}}});}; \ No newline at end of file +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 diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 30a849b..e5962ad 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 _0x3fd0=['defaults','localhost','./openchannelInteraction.socket','register','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','raw','attributes','limit','AddTagsToOpenchannelInteraction','find','addTags','omit','AddTags','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x5f139c,_0x34abe0){var _0xd3bd61=function(_0x918abc){while(--_0x918abc){_0x5f139c['push'](_0x5f139c['shift']());}};_0xd3bd61(++_0x34abe0);}(_0x3fd0,0x70));var _0x03fd=function(_0x21025b,_0x3d28c1){_0x21025b=_0x21025b-0x0;var _0x52ec4d=_0x3fd0[_0x21025b];return _0x52ec4d;};'use strict';var _=require(_0x03fd('0x0'));var util=require(_0x03fd('0x1'));var moment=require(_0x03fd('0x2'));var BPromise=require('bluebird');var rs=require(_0x03fd('0x3'));var fs=require('fs');var Redis=require(_0x03fd('0x4'));var db=require(_0x03fd('0x5'))['db'];var utils=require(_0x03fd('0x6'));var logger=require(_0x03fd('0x7'))(_0x03fd('0x8'));var config=require(_0x03fd('0x9'));var jayson=require(_0x03fd('0xa'));var client=jayson[_0x03fd('0xb')][_0x03fd('0xc')]({'port':0x232a});config[_0x03fd('0xd')]=_[_0x03fd('0xe')](config[_0x03fd('0xd')],{'host':_0x03fd('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x03fd('0xd')]));require(_0x03fd('0x10'))[_0x03fd('0x11')](socket);function respondWithRpcPromise(_0x1ed18c,_0x37720b,_0x355ae2){return new BPromise(function(_0x182290,_0x102844){return client[_0x03fd('0x12')](_0x1ed18c,_0x355ae2)[_0x03fd('0x13')](function(_0x231b3e){logger['info'](_0x03fd('0x14'),_0x37720b,_0x03fd('0x15'));logger[_0x03fd('0x16')](_0x03fd('0x17'),_0x37720b,'request\x20sent',JSON[_0x03fd('0x18')](_0x231b3e));if(_0x231b3e[_0x03fd('0x19')]){if(_0x231b3e[_0x03fd('0x19')]['code']===0x1f4){logger[_0x03fd('0x19')](_0x03fd('0x14'),_0x37720b,_0x231b3e[_0x03fd('0x19')][_0x03fd('0x1a')]);return _0x102844(_0x231b3e[_0x03fd('0x19')]['message']);}logger[_0x03fd('0x19')](_0x03fd('0x14'),_0x37720b,_0x231b3e[_0x03fd('0x19')][_0x03fd('0x1a')]);return _0x182290(_0x231b3e['error'][_0x03fd('0x1a')]);}else{logger[_0x03fd('0x1b')](_0x03fd('0x14'),_0x37720b,_0x03fd('0x15'));_0x182290(_0x231b3e[_0x03fd('0x1c')][_0x03fd('0x1a')]);}})['catch'](function(_0x380e91){logger[_0x03fd('0x19')](_0x03fd('0x14'),_0x37720b,_0x380e91);_0x102844(_0x380e91);});});}exports[_0x03fd('0x1d')]=function(_0x55de11){var _0x4cb898=this;return new Promise(function(_0x23a84a,_0x602010){return db[_0x03fd('0x1e')]['update'](_0x55de11[_0x03fd('0x1f')],{'raw':_0x55de11['options']?_0x55de11[_0x03fd('0x20')][_0x03fd('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55de11[_0x03fd('0x20')]?_0x55de11[_0x03fd('0x20')]['where']||null:null,'attributes':_0x55de11[_0x03fd('0x20')]?_0x55de11[_0x03fd('0x20')][_0x03fd('0x22')]||null:null,'limit':_0x55de11[_0x03fd('0x20')]?_0x55de11[_0x03fd('0x20')][_0x03fd('0x23')]||null:null})[_0x03fd('0x13')](function(_0x5879e5){logger[_0x03fd('0x1b')](_0x03fd('0x1d'),_0x55de11);logger[_0x03fd('0x16')](_0x03fd('0x1d'),_0x55de11,JSON[_0x03fd('0x18')](_0x5879e5));_0x23a84a(_0x5879e5);})['catch'](function(_0x2677ad){logger['error'](_0x03fd('0x1d'),_0x2677ad['message'],_0x55de11);_0x602010(_0x4cb898[_0x03fd('0x19')](0x1f4,_0x2677ad[_0x03fd('0x1a')]));});});};exports[_0x03fd('0x24')]=function(_0x9aeb2b){return new Promise(function(_0x5c3d79,_0x1fad92){return db[_0x03fd('0x1e')][_0x03fd('0x25')]({'where':_0x9aeb2b['options']?_0x9aeb2b['options']['where']||null:null})[_0x03fd('0x13')](function(_0x40d03f){if(_0x40d03f){return _0x40d03f[_0x03fd('0x26')](_0x9aeb2b[_0x03fd('0x1f')]['ids'],_[_0x03fd('0x27')](_0x9aeb2b['body'],['ids','id'])||{});}})['spread'](function(_0x194512){logger[_0x03fd('0x1b')](_0x03fd('0x28'),_0x9aeb2b);logger[_0x03fd('0x16')](_0x03fd('0x28'),_0x9aeb2b,JSON[_0x03fd('0x18')](_0x194512));_0x5c3d79(_0x194512);})[_0x03fd('0x29')](function(_0x10500b){logger['error'](_0x03fd('0x28'),_0x10500b[_0x03fd('0x1a')],_0x9aeb2b);_0x1fad92(_this[_0x03fd('0x19')](0x1f4,_0x10500b['message']));});});}; \ No newline at end of file +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 diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 7d6e237..5fd0a8c 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 _0xe9a5=['remove','emit','removeListener','length','openchannelInteraction:','./openchannelInteraction.events','save'];(function(_0x5bfd65,_0x417862){var _0x164a2e=function(_0x1d2035){while(--_0x1d2035){_0x5bfd65['push'](_0x5bfd65['shift']());}};_0x164a2e(++_0x417862);}(_0xe9a5,0x116));var _0x5e9a=function(_0x535048,_0x33c722){_0x535048=_0x535048-0x0;var _0x3060bb=_0xe9a5[_0x535048];return _0x3060bb;};'use strict';var OpenchannelInteractionEvents=require(_0x5e9a('0x0'));var events=[_0x5e9a('0x1'),_0x5e9a('0x2'),'update'];function createListener(_0x1775aa,_0x37185a){return function(_0x5c4495){_0x37185a[_0x5e9a('0x3')](_0x1775aa,_0x5c4495);};}function removeListener(_0x3346bd,_0x1d9fa2){return function(){OpenchannelInteractionEvents[_0x5e9a('0x4')](_0x3346bd,_0x1d9fa2);};}exports['register']=function(_0x50eeb1){for(var _0x3e057a=0x0,_0x7bce5d=events[_0x5e9a('0x5')];_0x3e057a<_0x7bce5d;_0x3e057a++){var _0x34aa89=events[_0x3e057a];var _0x3a2631=createListener(_0x5e9a('0x6')+_0x34aa89,_0x50eeb1);OpenchannelInteractionEvents['on'](_0x34aa89,_0x3a2631);}}; \ No newline at end of file +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 diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 75ab120..d43da50 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 _0x560a=['show','post','tracked','openchannel','openchannelmessage:create','create','put','accept','/:id/reject','delete','destroy','exports','multer','path','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x560a,0x8a));var _0xa560=function(_0x5897fc,_0x9bbad6){_0x5897fc=_0x5897fc-0x0;var _0x292681=_0x560a[_0x5897fc];return _0x292681;};'use strict';var multer=require(_0xa560('0x0'));var util=require('util');var path=require(_0xa560('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa560('0x2'));var controller=require('./openchannelMessage.controller');router[_0xa560('0x3')]('/',auth['isAuthenticated'](),controller[_0xa560('0x4')]);router[_0xa560('0x3')](_0xa560('0x5'),auth[_0xa560('0x6')](),controller[_0xa560('0x7')]);router[_0xa560('0x3')](_0xa560('0x8'),auth[_0xa560('0x6')](),controller[_0xa560('0x9')]);router[_0xa560('0xa')]('/',auth[_0xa560('0x6')](),interaction[_0xa560('0xb')](_0xa560('0xc'),_0xa560('0xd')),controller[_0xa560('0xe')]);router[_0xa560('0xf')]('/:id',auth[_0xa560('0x6')](),controller['update']);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0xa560('0x10')]);router[_0xa560('0xf')](_0xa560('0x11'),auth[_0xa560('0x6')](),controller['reject']);router[_0xa560('0x12')](_0xa560('0x8'),auth[_0xa560('0x6')](),controller[_0xa560('0x13')]);module[_0xa560('0x14')]=router; \ No newline at end of file +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 diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 456ac84..eb0f649 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 _0x4fd1=['out','DATE','sequelize','medium','BOOLEAN'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4fd1,0x1ab));var _0x14fd=function(_0x58a29a,_0x4541a2){_0x58a29a=_0x58a29a-0x0;var _0x43d432=_0x4fd1[_0x58a29a];return _0x43d432;};'use strict';var Sequelize=require(_0x14fd('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x14fd('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x14fd('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x14fd('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0x14fd('0x4')]}}; \ No newline at end of file +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 diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 839913e..f3cec46 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 _0x429c=['jsforce','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./openchannelMessage.socket','register','test','Sequelize','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','offset','Content-Range','json','apply','reject','update','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','type','VIRTUAL','options','count','includeAll','OpenchannelMessage','include','create','body','params','destroy','describe','../../config/logger','openchannel-interactions','accept','openchannel','read','format','UserId','user','find','Contact','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','RejectMessage','rejectMessage','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','to-csv','ejs','lodash','squel','crypto'];(function(_0x35f7f5,_0x4e2ee1){var _0x5567a4=function(_0x3e5df0){while(--_0x3e5df0){_0x35f7f5['push'](_0x35f7f5['shift']());}};_0x5567a4(++_0x4e2ee1);}(_0x429c,0x143));var _0xc429=function(_0x5caf24,_0x17ff8f){_0x5caf24=_0x5caf24-0x0;var _0x437ac2=_0x429c[_0x5caf24];return _0x437ac2;};'use strict';var pdf=require(_0xc429('0x0'));var emlformat=require(_0xc429('0x1'));var rimraf=require(_0xc429('0x2'));var zipdir=require(_0xc429('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc429('0x4'));var moment=require('moment');var BPromise=require(_0xc429('0x5'));var Mustache=require('mustache');var util=require(_0xc429('0x6'));var path=require(_0xc429('0x7'));var sox=require('sox');var csv=require(_0xc429('0x8'));var ejs=require(_0xc429('0x9'));var fs=require('fs');var _=require(_0xc429('0xa'));var squel=require(_0xc429('0xb'));var crypto=require(_0xc429('0xc'));var jsforce=require(_0xc429('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc429('0xe'));var Papa=require(_0xc429('0xf'));var Redis=require(_0xc429('0x10'));var authService=require(_0xc429('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc429('0x12'));var utils=require(_0xc429('0x13'));var config=require(_0xc429('0x14'));var db=require(_0xc429('0x15'))['db'];config[_0xc429('0x16')]=_['defaults'](config[_0xc429('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xc429('0x17'))(new Redis(config[_0xc429('0x16')]));require(_0xc429('0x18'))[_0xc429('0x19')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x22a585,_0x5a0d10,_0x476a02){if(_0x476a02){var _0x7b169b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x7b169b[_0xc429('0x1a')](_0x5a0d10)){return _0x22a585;}else{throw new db[(_0xc429('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 _0x22a585;}}function respondWithRpcPromise(_0x466e9b,_0x5d6e9b,_0x56aba5,_0x466a30){return new BPromise(function(_0x465a90,_0x471356){var _0x21af81=_0x466a30||client;return _0x21af81['request'](_0x466e9b,_0x56aba5)[_0xc429('0x1c')](function(_0x3dbbd1){logger[_0xc429('0x1d')](_0xc429('0x1e'),_0x5d6e9b,_0xc429('0x1f'));logger['debug'](_0xc429('0x20'),_0x5d6e9b,_0xc429('0x1f'),JSON[_0xc429('0x21')](_0x3dbbd1));if(_0x3dbbd1[_0xc429('0x22')]){if(_0x3dbbd1[_0xc429('0x22')][_0xc429('0x23')]===0x1f4){logger['error'](_0xc429('0x1e'),_0x5d6e9b,_0x3dbbd1[_0xc429('0x22')][_0xc429('0x24')]);return _0x471356(_0x3dbbd1[_0xc429('0x22')][_0xc429('0x24')]);}logger[_0xc429('0x22')](_0xc429('0x1e'),_0x5d6e9b,_0x3dbbd1[_0xc429('0x22')]['message']);return _0x465a90(_0x3dbbd1['error'][_0xc429('0x24')]);}else{logger[_0xc429('0x1d')]('OpenchannelMessage,\x20%s,\x20%s',_0x5d6e9b,_0xc429('0x1f'));_0x465a90(_0x3dbbd1[_0xc429('0x25')][_0xc429('0x24')]);}})[_0xc429('0x26')](function(_0x2d3dd7){logger[_0xc429('0x22')](_0xc429('0x1e'),_0x5d6e9b,_0x2d3dd7);_0x471356(_0x2d3dd7);});});}function respondWithStatusCode(_0xc0af4f,_0x61f2a6){_0x61f2a6=_0x61f2a6||0xcc;return function(_0x2b0192){if(_0x2b0192){return _0xc0af4f['sendStatus'](_0x61f2a6);}return _0xc0af4f[_0xc429('0x27')](_0x61f2a6)[_0xc429('0x28')]();};}function respondWithResult(_0x5b3ae2,_0x4854a4){_0x4854a4=_0x4854a4||0xc8;return function(_0x1debcb){if(_0x1debcb){return _0x5b3ae2['status'](_0x4854a4)['json'](_0x1debcb);}};}function respondWithFilteredResult(_0x26b9bd,_0x46599b){return function(_0x6cdbaa){if(_0x6cdbaa){var _0x5d1589=_0x6cdbaa['count'],_0x13f049=_0x46599b[_0xc429('0x29')],_0x38f11c=_0x46599b[_0xc429('0x29')]+_0x46599b['limit'],_0xe27c1c;if(_0x38f11c>=_0x5d1589){_0x38f11c=_0x5d1589;_0xe27c1c=0xc8;}else{_0xe27c1c=0xce;}_0x26b9bd[_0xc429('0x27')](_0xe27c1c);return _0x26b9bd['set'](_0xc429('0x2a'),_0x13f049+'-'+_0x38f11c+'/'+_0x5d1589)[_0xc429('0x2b')](_0x6cdbaa);}return null;};}function patchUpdates(_0x143cb1){return function(_0x12830f){try{jsonpatch[_0xc429('0x2c')](_0x12830f,_0x143cb1,!![]);}catch(_0x2c479b){return BPromise[_0xc429('0x2d')](_0x2c479b);}return _0x12830f['save']();};}function saveUpdates(_0x1a0783,_0x3f2e7e){return function(_0x5dcc05){if(_0x5dcc05){return _0x5dcc05[_0xc429('0x2e')](_0x1a0783)[_0xc429('0x1c')](function(_0x589b17){return _0x589b17;});}return null;};}function removeEntity(_0x270b0a,_0x24b5d){return function(_0x39d2f7){if(_0x39d2f7){return _0x39d2f7['destroy']()[_0xc429('0x1c')](function(){_0x270b0a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x17f06b,_0x4a34d0){return function(_0x25f800){if(!_0x25f800){_0x17f06b['sendStatus'](0x194);}return _0x25f800;};}function handleError(_0x57edac,_0x3efef0){_0x3efef0=_0x3efef0||0x1f4;return function(_0xab69dd){logger[_0xc429('0x22')](_0xab69dd[_0xc429('0x2f')]);if(_0xab69dd['name']){delete _0xab69dd[_0xc429('0x30')];}_0x57edac[_0xc429('0x27')](_0x3efef0)[_0xc429('0x31')](_0xab69dd);};}exports['index']=function(_0x27e248,_0x5de2d4){var _0x39e338={},_0x54af73={},_0x19b2fb={'count':0x0,'rows':[]};var _0x57a215=_[_0xc429('0x32')](db['OpenchannelMessage'][_0xc429('0x33')],function(_0x3f6323){return{'name':_0x3f6323[_0xc429('0x34')],'type':_0x3f6323['type'][_0xc429('0x35')]};});_0x54af73[_0xc429('0x36')]=_[_0xc429('0x32')](_0x57a215,_0xc429('0x30'));_0x54af73[_0xc429('0x37')]=_[_0xc429('0x38')](_0x27e248['query']);_0x54af73[_0xc429('0x39')]=_[_0xc429('0x3a')](_0x54af73[_0xc429('0x36')],_0x54af73[_0xc429('0x37')]);_0x39e338[_0xc429('0x3b')]=_['intersection'](_0x54af73['model'],qs[_0xc429('0x3c')](_0x27e248[_0xc429('0x37')][_0xc429('0x3c')]));_0x39e338[_0xc429('0x3b')]=_0x39e338[_0xc429('0x3b')][_0xc429('0x3d')]?_0x39e338['attributes']:_0x54af73[_0xc429('0x36')];if(!_0x27e248['query'][_0xc429('0x3e')](_0xc429('0x3f'))){_0x39e338['limit']=qs[_0xc429('0x40')](_0x27e248[_0xc429('0x37')][_0xc429('0x40')]);_0x39e338['offset']=qs[_0xc429('0x29')](_0x27e248[_0xc429('0x37')][_0xc429('0x29')]);}_0x39e338['order']=qs[_0xc429('0x41')](_0x27e248[_0xc429('0x37')][_0xc429('0x41')]);_0x39e338['where']=qs[_0xc429('0x39')](_[_0xc429('0x42')](_0x27e248[_0xc429('0x37')],_0x54af73[_0xc429('0x39')]));if(_0x27e248[_0xc429('0x37')][_0xc429('0x43')]){_0x39e338[_0xc429('0x44')]=_[_0xc429('0x45')](_0x39e338[_0xc429('0x44')],{'$or':_[_0xc429('0x32')](_0x57a215,function(_0x28b593){if(_0x28b593[_0xc429('0x46')]!==_0xc429('0x47')){var _0x55b881={};_0x55b881[_0x28b593[_0xc429('0x30')]]={'$like':'%'+_0x27e248[_0xc429('0x37')][_0xc429('0x43')]+'%'};return _0x55b881;}})});}_0x39e338=_[_0xc429('0x45')]({},_0x39e338,_0x27e248[_0xc429('0x48')]);var _0x19effd={'where':_0x39e338[_0xc429('0x44')]};return db['OpenchannelMessage'][_0xc429('0x49')](_0x19effd)[_0xc429('0x1c')](function(_0x3bb233){_0x19b2fb['count']=_0x3bb233;if(_0x27e248['query'][_0xc429('0x4a')]){_0x39e338['include']=[{'all':!![]}];}return db[_0xc429('0x4b')]['findAll'](_0x39e338);})[_0xc429('0x1c')](function(_0x24e199){_0x19b2fb['rows']=_0x24e199;return _0x19b2fb;})[_0xc429('0x1c')](respondWithFilteredResult(_0x5de2d4,_0x39e338))['catch'](handleError(_0x5de2d4,null));};exports['show']=function(_0x47553b,_0x38bee4){var _0xbf6bfa={'raw':!![],'where':{'id':_0x47553b['params']['id']}},_0xfd8120={};_0xfd8120[_0xc429('0x36')]=_[_0xc429('0x38')](db[_0xc429('0x4b')][_0xc429('0x33')]);_0xfd8120[_0xc429('0x37')]=_['keys'](_0x47553b[_0xc429('0x37')]);_0xfd8120[_0xc429('0x39')]=_['intersection'](_0xfd8120[_0xc429('0x36')],_0xfd8120[_0xc429('0x37')]);_0xbf6bfa[_0xc429('0x3b')]=_[_0xc429('0x3a')](_0xfd8120[_0xc429('0x36')],qs[_0xc429('0x3c')](_0x47553b['query'][_0xc429('0x3c')]));_0xbf6bfa['attributes']=_0xbf6bfa['attributes']['length']?_0xbf6bfa[_0xc429('0x3b')]:_0xfd8120[_0xc429('0x36')];if(_0x47553b[_0xc429('0x37')]['includeAll']){_0xbf6bfa[_0xc429('0x4c')]=[{'all':!![]}];}_0xbf6bfa=_[_0xc429('0x45')]({},_0xbf6bfa,_0x47553b[_0xc429('0x48')]);return db[_0xc429('0x4b')]['find'](_0xbf6bfa)[_0xc429('0x1c')](handleEntityNotFound(_0x38bee4,null))[_0xc429('0x1c')](respondWithResult(_0x38bee4,null))[_0xc429('0x26')](handleError(_0x38bee4,null));};exports[_0xc429('0x4d')]=function(_0x2a349a,_0x250be3){return db[_0xc429('0x4b')]['create'](_0x2a349a[_0xc429('0x4e')],{})[_0xc429('0x1c')](respondWithResult(_0x250be3,0xc9))[_0xc429('0x26')](handleError(_0x250be3,null));};exports[_0xc429('0x2e')]=function(_0x2b32ed,_0x39f231){if(_0x2b32ed[_0xc429('0x4e')]['id']){delete _0x2b32ed[_0xc429('0x4e')]['id'];}return db[_0xc429('0x4b')]['find']({'where':{'id':_0x2b32ed[_0xc429('0x4f')]['id']}})[_0xc429('0x1c')](handleEntityNotFound(_0x39f231,null))[_0xc429('0x1c')](saveUpdates(_0x2b32ed['body'],null))[_0xc429('0x1c')](respondWithResult(_0x39f231,null))[_0xc429('0x26')](handleError(_0x39f231,null));};exports[_0xc429('0x50')]=function(_0x121e9a,_0x46ef6f){return db[_0xc429('0x4b')]['find']({'where':{'id':_0x121e9a[_0xc429('0x4f')]['id']}})[_0xc429('0x1c')](handleEntityNotFound(_0x46ef6f,null))['then'](removeEntity(_0x46ef6f,null))['catch'](handleError(_0x46ef6f,null));};exports[_0xc429('0x51')]=function(_0x16c04a,_0x2c7e8a){return db[_0xc429('0x4b')]['describe']()[_0xc429('0x1c')](respondWithResult(_0x2c7e8a,null))[_0xc429('0x26')](handleError(_0x2c7e8a,null));};var interaction_log=require(_0xc429('0x52'))(_0xc429('0x53'));exports[_0xc429('0x54')]=function(_0x5d1b8f,_0x5cec11,_0x3c6344){var _0x5072a9={'channel':_0xc429('0x55')};if(_0x5d1b8f[_0xc429('0x4e')]['id']){delete _0x5d1b8f[_0xc429('0x4e')]['id'];}_0x5d1b8f[_0xc429('0x4e')][_0xc429('0x56')]=!![];_0x5d1b8f[_0xc429('0x4e')]['readAt']=moment()[_0xc429('0x57')]('YYYY-MM-DD\x20HH:mm:ss');_0x5d1b8f[_0xc429('0x4e')][_0xc429('0x58')]=_0x5d1b8f[_0xc429('0x4e')][_0xc429('0x58')]||_0x5d1b8f[_0xc429('0x59')]['id'];return db[_0xc429('0x4b')][_0xc429('0x5a')]({'where':{'id':_0x5d1b8f[_0xc429('0x4f')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xc429('0x5b')}]})[_0xc429('0x1c')](handleEntityNotFound(_0x5cec11,null))[_0xc429('0x1c')](saveUpdates(_0x5d1b8f[_0xc429('0x4e')],null))[_0xc429('0x1c')](function(_0x37da25){if(_0x37da25){_0x5072a9[_0xc429('0x24')]=_0x37da25['get']({'plain':!![]});return db[_0xc429('0x5c')][_0xc429('0x5a')]({'where':{'id':_0x37da25[_0xc429('0x5d')]}});}return null;})['then'](handleEntityNotFound(_0x5cec11,null))['then'](function(_0x330927){if(_0x330927){return _0x330927[_0xc429('0x2e')]({'UserId':_0x5d1b8f['body'][_0xc429('0x58')],'read1stAt':_[_0xc429('0x5e')](_0x330927[_0xc429('0x5f')])?moment()[_0xc429('0x57')](_0xc429('0x60')):undefined});}return null;})[_0xc429('0x1c')](function(_0x1cbafb){if(_0x1cbafb){_0x5072a9[_0xc429('0x61')]=_0x1cbafb[_0xc429('0x62')]({'plain':!![]});interaction_log[_0xc429('0x1d')](_0xc429('0x63'),_0x5d1b8f[_0xc429('0x59')]['id'],_0x5d1b8f['user']['name'],_0x5d1b8f['user']['role'],_0x5072a9[_0xc429('0x61')]['id'],_0x5d1b8f[_0xc429('0x4e')]?JSON[_0xc429('0x21')](_0x5d1b8f[_0xc429('0x4e')]):_0xc429('0x64'));return respondWithRpcPromise(_0xc429('0x65'),'acceptMessage',_0x5072a9);}return null;})[_0xc429('0x1c')](function(_0x5c0efa){if(_0x5c0efa){if(_0x5d1b8f[_0xc429('0x4e')][_0xc429('0x66')]){_0x5072a9[_0xc429('0x24')][_0xc429('0x67')]=util[_0xc429('0x57')](_0xc429('0x68'),_0x5d1b8f['user']['name']);_0x5072a9[_0xc429('0x24')][_0xc429('0x69')]=_0x5072a9[_0xc429('0x69')];_0x5072a9[_0xc429('0x24')][_0xc429('0x6a')]=_0xc429('0x54');return respondWithRpcPromise('EventManager',_0xc429('0x6b'),{'event':_0xc429('0x6c'),'message':_0x5072a9[_0xc429('0x24')]},client9002)['then'](function(){return _0x5072a9;});}return _0x5072a9;}return null;})['then'](respondWithResult(_0x5cec11,null))[_0xc429('0x26')](handleError(_0x5cec11,null));};var interaction_log=require(_0xc429('0x52'))(_0xc429('0x53'));exports[_0xc429('0x2d')]=function(_0x3f6676,_0x4dfb8c,_0x36a22a){var _0x5e7c07={'agent':{},'channel':_0xc429('0x55')};if(_0x3f6676[_0xc429('0x4e')]['id']){delete _0x3f6676['body']['id'];}_0x3f6676[_0xc429('0x4e')]['UserId']=_0x3f6676[_0xc429('0x4e')][_0xc429('0x58')]||_0x3f6676[_0xc429('0x59')]['id'];_0x5e7c07['agent']['id']=_0x3f6676['body'][_0xc429('0x58')];return db['OpenchannelMessage'][_0xc429('0x5a')]({'where':{'id':_0x3f6676[_0xc429('0x4f')]['id'],'UserId':null}})[_0xc429('0x1c')](handleEntityNotFound(_0x4dfb8c,null))['then'](function(_0x6f0166){if(_0x6f0166){_0x5e7c07[_0xc429('0x24')]=_0x6f0166[_0xc429('0x62')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x6f0166[_0xc429('0x5d')]}});}return null;})[_0xc429('0x1c')](handleEntityNotFound(_0x4dfb8c,null))[_0xc429('0x1c')](function(_0x908089){if(_0x908089){_0x5e7c07[_0xc429('0x61')]=_0x908089['get']({'plain':!![]});interaction_log[_0xc429('0x1d')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3f6676['user']['id'],_0x3f6676[_0xc429('0x59')][_0xc429('0x30')],_0x3f6676[_0xc429('0x59')]['role'],_0x5e7c07['interaction']['id'],_0x3f6676[_0xc429('0x4e')]?JSON['stringify'](_0x3f6676[_0xc429('0x4e')]):_0xc429('0x64'));return respondWithRpcPromise(_0xc429('0x6d'),_0xc429('0x6e'),_0x5e7c07);}return null;})['then'](function(_0x98fc30){if(_0x98fc30){_0x98fc30[_0xc429('0x24')][_0xc429('0x67')]=util[_0xc429('0x57')](_0xc429('0x68'),_0x3f6676[_0xc429('0x59')]['name']);_0x98fc30['message'][_0xc429('0x69')]=_0x5e7c07['channel'];_0x98fc30['message'][_0xc429('0x6a')]=_0xc429('0x2d');respondWithRpcPromise(_0xc429('0x6b'),_0xc429('0x6b'),{'event':_0xc429('0x6f'),'message':_0x98fc30[_0xc429('0x24')]},client9002);return _0x5e7c07;}return null;})['then'](respondWithResult(_0x4dfb8c,null))['catch'](handleError(_0x4dfb8c,null));}; \ No newline at end of file +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 diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 1564e5e..856cec4 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 _0xbdf9=['hook','events','../../mysqldb','setMaxListeners','update','remove','emit'];(function(_0x101a17,_0x5d047a){var _0x3b76ee=function(_0x89be1b){while(--_0x89be1b){_0x101a17['push'](_0x101a17['shift']());}};_0x3b76ee(++_0x5d047a);}(_0xbdf9,0x1b3));var _0x9bdf=function(_0x53a7af,_0x1408a5){_0x53a7af=_0x53a7af-0x0;var _0x3cc7f6=_0xbdf9[_0x53a7af];return _0x3cc7f6;};'use strict';var EventEmitter=require(_0x9bdf('0x0'));var OpenchannelMessage=require(_0x9bdf('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x9bdf('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9bdf('0x3'),'afterDestroy':_0x9bdf('0x4')};function emitEvent(_0x178fb1){return function(_0x49e11d,_0xd0a5d0,_0x4dcf0d){OpenchannelMessageEvents[_0x9bdf('0x5')](_0x178fb1+':'+_0x49e11d['id'],_0x49e11d);OpenchannelMessageEvents[_0x9bdf('0x5')](_0x178fb1,_0x49e11d);_0x4dcf0d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x9bdf('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +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 diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 65918b2..709e26d 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 _0x9fd3=['length','omit','POST','method','GET','afterCreate','update','threadId','Interaction','error','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','direction','out','secret','isNil','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','createdAt','toLowerCase','catch','CmContact','describe','OpenchannelAccount','OpenchannelAccountId','Interactions','Contact','keys','get','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri'];(function(_0x450e81,_0x10a9b0){var _0x3599cc=function(_0x281496){while(--_0x281496){_0x450e81['push'](_0x450e81['shift']());}};_0x3599cc(++_0x10a9b0);}(_0x9fd3,0x1b5));var _0x39fd=function(_0x2c92f1,_0x35de77){_0x2c92f1=_0x2c92f1-0x0;var _0x25ee5a=_0x9fd3[_0x2c92f1];return _0x25ee5a;};'use strict';var _=require('lodash');var util=require(_0x39fd('0x0'));var logger=require(_0x39fd('0x1'))(_0x39fd('0x2'));var moment=require(_0x39fd('0x3'));var BPromise=require('bluebird');var rp=require(_0x39fd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x39fd('0x5'));var config=require(_0x39fd('0x6'));var attributes=require(_0x39fd('0x7'));module[_0x39fd('0x8')]=function(_0x3983a5,_0x27dd60){return _0x3983a5[_0x39fd('0x9')](_0x39fd('0xa'),attributes,{'tableName':_0x39fd('0xb'),'paranoid':![],'indexes':[{'name':_0x39fd('0xc'),'fields':[_0x39fd('0xd')],'type':_0x39fd('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4ae19d,_0x322f37,_0x19b7ff){var _0x57120e=_0x3983a5[_0x39fd('0xf')];var _0x1ef629=_0x4ae19d['get']({'plain':!![]});if(_0x1ef629['direction']['toLowerCase']()==='in'||_0x1ef629[_0x39fd('0x10')]['toLowerCase']()===_0x39fd('0x11')&&!_0x1ef629[_0x39fd('0x12')]&&!_[_0x39fd('0x13')](_0x1ef629['UserId'])){_0x57120e[_0x39fd('0x14')][_0x39fd('0x15')]({'where':{'id':_0x1ef629[_0x39fd('0x16')]}})[_0x39fd('0x17')](function(_0x38062e){if(_0x38062e){_0x38062e['update']({'lastMsgAt':_0x1ef629[_0x39fd('0x18')],'lastMsgDirection':_0x1ef629['direction'][_0x39fd('0x19')]()});}})[_0x39fd('0x1a')](function(_0x442192){console['error'](_0x442192);});}if(_0x1ef629['direction']===_0x39fd('0x11')&&!_0x1ef629[_0x39fd('0x12')]){var _0x351bbb;_0x57120e[_0x39fd('0x1b')][_0x39fd('0x1c')]()[_0x39fd('0x17')](function(_0x1324c3){return _0x57120e[_0x39fd('0x1d')]['find']({'where':{'id':_0x1ef629[_0x39fd('0x1e')]},'include':[{'model':_0x57120e['OpenchannelInteraction'],'as':_0x39fd('0x1f'),'where':{'id':_0x1ef629['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x57120e[_0x39fd('0x1b')],'as':_0x39fd('0x20'),'attributes':_[_0x39fd('0x21')](_0x1324c3)}]}]});})[_0x39fd('0x17')](function(_0x4dcccf){_0x351bbb=_0x4dcccf[_0x39fd('0x22')]({'plain':!![]});if(_0x351bbb&&_0x351bbb['replyUri']){logger[_0x39fd('0x23')](_0x39fd('0x24'),'afterCreate',util[_0x39fd('0x25')](_0x39fd('0x26'),_0x1ef629['id'],_0x351bbb[_0x39fd('0x27')]));if(_0x351bbb[_0x39fd('0x1f')]&&_0x351bbb[_0x39fd('0x1f')][_0x39fd('0x28')]){_0x1ef629['Interaction']=_[_0x39fd('0x29')](_0x351bbb[_0x39fd('0x1f')][0x0],_0x39fd('0x20'));_0x1ef629['Contact']=_0x351bbb['Interactions'][0x0][_0x39fd('0x20')];}var _0x322f37={'method':_0x39fd('0x2a'),'uri':encodeURI(_0x351bbb[_0x39fd('0x27')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x322f37[_0x39fd('0x2b')]){case _0x39fd('0x2c'):_0x322f37['qs']=_0x1ef629;break;case _0x39fd('0x2a'):_0x322f37['body']=_0x1ef629;break;}return rp(_0x322f37)[_0x39fd('0x17')](function(_0x366f68){logger[_0x39fd('0x23')](_0x39fd('0x24'),_0x39fd('0x2d'),util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x1ef629['id'],_0x351bbb['replyUri']));if(_0x366f68[_0x39fd('0xd')]['threadId']&&_0x366f68['body']['threadId']!=_0x1ef629['Interaction']['threadId']){return _0x57120e[_0x39fd('0x14')][_0x39fd('0x2e')]({'threadId':_0x366f68['body'][_0x39fd('0x2f')]},{'logging':!![],'where':{'id':_0x1ef629[_0x39fd('0x30')]['id']}});}else{return;}})[_0x39fd('0x17')](function(){return _0x4ae19d[_0x39fd('0x2e')]({'read':!![]});})[_0x39fd('0x1a')](function(_0xd65fb7){logger[_0x39fd('0x31')]('OpenchannelMessage,\x20%s,\x20%s',_0x39fd('0x2d'),util['inspect'](_0xd65fb7,{'showHidden':![],'depth':null}));_0x19b7ff();});}else{_0x19b7ff();}})[_0x39fd('0x32')](function(){_0x19b7ff();});}else{_0x19b7ff();}}},'charset':_0x39fd('0x33'),'collate':_0x39fd('0x34')});}; \ No newline at end of file +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 diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index f7ac61a..b3624ee 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 _0x0424=['info','request\x20sent','debug','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','./openchannelMessage.socket','register','request','then'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x0424,0x159));var _0x4042=function(_0x2d5887,_0xace828){_0x2d5887=_0x2d5887-0x0;var _0x257084=_0x0424[_0x2d5887];return _0x257084;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4042('0x0'));var BPromise=require(_0x4042('0x1'));var rs=require(_0x4042('0x2'));var fs=require('fs');var Redis=require(_0x4042('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4042('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4042('0x5'));var jayson=require(_0x4042('0x6'));var client=jayson[_0x4042('0x7')][_0x4042('0x8')]({'port':0x232a});config[_0x4042('0x9')]=_[_0x4042('0xa')](config[_0x4042('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4042('0x9')]));require(_0x4042('0xb'))[_0x4042('0xc')](socket);function respondWithRpcPromise(_0x4b92d2,_0x341152,_0x11c0f7){return new BPromise(function(_0x2376a4,_0x2cbc75){return client[_0x4042('0xd')](_0x4b92d2,_0x11c0f7)[_0x4042('0xe')](function(_0x380aa0){logger[_0x4042('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x341152,_0x4042('0x10'));logger[_0x4042('0x11')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x341152,_0x4042('0x10'),JSON[_0x4042('0x12')](_0x380aa0));if(_0x380aa0[_0x4042('0x13')]){if(_0x380aa0[_0x4042('0x13')][_0x4042('0x14')]===0x1f4){logger[_0x4042('0x13')](_0x4042('0x15'),_0x341152,_0x380aa0['error'][_0x4042('0x16')]);return _0x2cbc75(_0x380aa0[_0x4042('0x13')]['message']);}logger[_0x4042('0x13')](_0x4042('0x15'),_0x341152,_0x380aa0[_0x4042('0x13')][_0x4042('0x16')]);return _0x2376a4(_0x380aa0[_0x4042('0x13')][_0x4042('0x16')]);}else{logger[_0x4042('0xf')](_0x4042('0x15'),_0x341152,_0x4042('0x10'));_0x2376a4(_0x380aa0['result'][_0x4042('0x16')]);}})['catch'](function(_0x9c8357){logger['error'](_0x4042('0x15'),_0x341152,_0x9c8357);_0x2cbc75(_0x9c8357);});});}exports[_0x4042('0x17')]=function(_0x212520){var _0x2cd5ca=this;return new Promise(function(_0x52af14,_0xb72021){return db[_0x4042('0x18')][_0x4042('0x19')](_0x212520[_0x4042('0x1a')],{'raw':_0x212520['options']?_0x212520[_0x4042('0x1b')][_0x4042('0x1c')]===undefined?!![]:![]:!![]})[_0x4042('0xe')](function(_0x83ce71){logger[_0x4042('0xf')]('CreateOpenchannelMessage',_0x212520);logger[_0x4042('0x11')](_0x4042('0x17'),_0x212520,JSON['stringify'](_0x83ce71));_0x52af14(_0x83ce71);})[_0x4042('0x1d')](function(_0x5877d3){logger[_0x4042('0x13')](_0x4042('0x17'),_0x5877d3[_0x4042('0x16')],_0x212520);_0xb72021(_0x2cd5ca['error'](0x1f4,_0x5877d3[_0x4042('0x16')]));});});}; \ No newline at end of file +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 diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 846cfea..b7f027d 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 _0xa9e0=['register','length','openchannelMessage:','./openchannelMessage.events','save','remove','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var OpenchannelMessageEvents=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(){OpenchannelMessageEvents[_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);OpenchannelMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +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 diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index c26d506..697c84d 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 _0xf435=['../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addAgents','put','update','delete','destroy','removeTeams','removeAgents','util','path','connect-timeout','express','Router'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xf435,0x174));var _0x5f43=function(_0x32b5b1,_0x1367d2){_0x32b5b1=_0x32b5b1-0x0;var _0x33a289=_0xf435[_0x32b5b1];return _0x33a289;};'use strict';var multer=require('multer');var util=require(_0x5f43('0x0'));var path=require(_0x5f43('0x1'));var timeout=require(_0x5f43('0x2'));var express=require(_0x5f43('0x3'));var router=express[_0x5f43('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x5f43('0x5'));var config=require(_0x5f43('0x6'));var controller=require(_0x5f43('0x7'));router[_0x5f43('0x8')]('/',auth['isAuthenticated'](),controller[_0x5f43('0x9')]);router[_0x5f43('0x8')](_0x5f43('0xa'),auth['isAuthenticated'](),controller[_0x5f43('0xb')]);router[_0x5f43('0x8')](_0x5f43('0xc'),auth[_0x5f43('0xd')](),controller[_0x5f43('0xe')]);router[_0x5f43('0x8')](_0x5f43('0xf'),auth[_0x5f43('0xd')](),controller[_0x5f43('0x10')]);router[_0x5f43('0x8')](_0x5f43('0x11'),auth['isAuthenticated'](),controller['getTeams']);router[_0x5f43('0x8')](_0x5f43('0x12'),auth[_0x5f43('0xd')](),controller[_0x5f43('0x13')]);router[_0x5f43('0x14')]('/',auth[_0x5f43('0xd')](),controller[_0x5f43('0x15')]);router[_0x5f43('0x14')]('/:id/teams',auth[_0x5f43('0xd')](),controller['addTeams']);router[_0x5f43('0x14')]('/:id/users',auth[_0x5f43('0xd')](),controller[_0x5f43('0x16')]);router[_0x5f43('0x17')](_0x5f43('0xc'),auth['isAuthenticated'](),controller[_0x5f43('0x18')]);router[_0x5f43('0x19')](_0x5f43('0xc'),auth['isAuthenticated'](),controller[_0x5f43('0x1a')]);router[_0x5f43('0x19')](_0x5f43('0x11'),auth[_0x5f43('0xd')](),controller[_0x5f43('0x1b')]);router[_0x5f43('0x19')]('/:id/users',auth[_0x5f43('0xd')](),controller[_0x5f43('0x1c')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index af34a4e..133b388 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 _0x160f=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf160('0x0'));module[_0xf160('0x1')]={'name':{'type':Sequelize[_0xf160('0x2')],'unique':_0xf160('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xf160('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf160('0x5')](_0xf160('0x6'),_0xf160('0x7'),_0xf160('0x8'))}}; \ No newline at end of file +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 diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index e013368..bc80c82 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 _0x46e9=['toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','spread','getAgents','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelQueue.socket','register','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','update','destroy','then','OpenchannelQueues','UserProfileResource','error','stack','send','index','map','OpenchannelQueue','rawAttributes','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','VIRTUAL','filter','merge','options','where','count','includeAll','include','findAll','rows','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserOpenchannelQueue','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','format','%s/%s','SIP','createdAt','updatedAt','getTeams','findOne','Team','addTeams','Agents','online','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userOpenchannelQueue:save','ids','select','field','team_has_openchannel_queues','join','user_has_teams','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push'];(function(_0xafe766,_0x26e3fa){var _0x162d4a=function(_0x40c8a8){while(--_0x40c8a8){_0xafe766['push'](_0xafe766['shift']());}};_0x162d4a(++_0x26e3fa);}(_0x46e9,0x9b));var _0x946e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x46e9[_0x5b644e];return _0x49c6bf;};'use strict';var pdf=require(_0x946e('0x0'));var emlformat=require(_0x946e('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x946e('0x2'));var rp=require(_0x946e('0x3'));var moment=require(_0x946e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x946e('0x5'));var util=require(_0x946e('0x6'));var path=require(_0x946e('0x7'));var sox=require(_0x946e('0x8'));var csv=require(_0x946e('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x946e('0xa'));var squel=require(_0x946e('0xb'));var crypto=require(_0x946e('0xc'));var jsforce=require(_0x946e('0xd'));var deskjs=require(_0x946e('0xe'));var toCsv=require(_0x946e('0x9'));var querystring=require('querystring');var Papa=require(_0x946e('0xf'));var Redis=require(_0x946e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x946e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x946e('0x12'));var logger=require('../../config/logger')(_0x946e('0x13'));var utils=require(_0x946e('0x14'));var config=require(_0x946e('0x15'));var db=require(_0x946e('0x16'))['db'];config[_0x946e('0x17')]=_[_0x946e('0x18')](config[_0x946e('0x17')],{'host':_0x946e('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x946e('0x1a'))[_0x946e('0x1b')](socket);function respondWithStatusCode(_0x28bb72,_0x437e08){_0x437e08=_0x437e08||0xcc;return function(_0x173009){if(_0x173009){return _0x28bb72[_0x946e('0x1c')](_0x437e08);}return _0x28bb72[_0x946e('0x1d')](_0x437e08)['end']();};}function respondWithResult(_0x57cc39,_0x2971e8){_0x2971e8=_0x2971e8||0xc8;return function(_0x2ed4cf){if(_0x2ed4cf){return _0x57cc39[_0x946e('0x1d')](_0x2971e8)[_0x946e('0x1e')](_0x2ed4cf);}};}function respondWithFilteredResult(_0x170bc9,_0x826978){return function(_0x5b42c4){if(_0x5b42c4){var _0x2d2d9e=_0x5b42c4['count'],_0x44488c=_0x826978[_0x946e('0x1f')],_0x6a023e=_0x826978[_0x946e('0x1f')]+_0x826978[_0x946e('0x20')],_0x5bdfc3;if(_0x6a023e>=_0x2d2d9e){_0x6a023e=_0x2d2d9e;_0x5bdfc3=0xc8;}else{_0x5bdfc3=0xce;}_0x170bc9['status'](_0x5bdfc3);return _0x170bc9[_0x946e('0x21')](_0x946e('0x22'),_0x44488c+'-'+_0x6a023e+'/'+_0x2d2d9e)['json'](_0x5b42c4);}return null;};}function patchUpdates(_0xd3cb20){return function(_0x2f2a42){try{jsonpatch['apply'](_0x2f2a42,_0xd3cb20,!![]);}catch(_0x5dbdcd){return BPromise[_0x946e('0x23')](_0x5dbdcd);}return _0x2f2a42[_0x946e('0x24')]();};}function saveUpdates(_0x317d94,_0x52be0d){return function(_0x1dc832){if(_0x1dc832){return _0x1dc832[_0x946e('0x25')](_0x317d94)['then'](function(_0x4e271c){return _0x4e271c;});}return null;};}function removeEntity(_0xed5ce7,_0x514db6){return function(_0x3c054a){if(_0x3c054a){return _0x3c054a[_0x946e('0x26')]()[_0x946e('0x27')](function(){var _0x5d28c1=_0x3c054a['get']({'plain':!![]});var _0xda8663=_0x946e('0x28');return db[_0x946e('0x29')][_0x946e('0x26')]({'where':{'type':_0xda8663,'resourceId':_0x5d28c1['id']}})[_0x946e('0x27')](function(){return _0x3c054a;});})[_0x946e('0x27')](function(){_0xed5ce7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x254821,_0x327dd3){return function(_0x4ca14a){if(!_0x4ca14a){_0x254821[_0x946e('0x1c')](0x194);}return _0x4ca14a;};}function handleError(_0x160875,_0x55c9ef){_0x55c9ef=_0x55c9ef||0x1f4;return function(_0x3e30de){logger[_0x946e('0x2a')](_0x3e30de[_0x946e('0x2b')]);if(_0x3e30de['name']){delete _0x3e30de['name'];}_0x160875[_0x946e('0x1d')](_0x55c9ef)[_0x946e('0x2c')](_0x3e30de);};}exports[_0x946e('0x2d')]=function(_0x215b1a,_0x426df7){var _0x1235b1={},_0x18f9ab={},_0x2717e4={'count':0x0,'rows':[]};var _0x5739e4=_[_0x946e('0x2e')](db[_0x946e('0x2f')][_0x946e('0x30')],function(_0x5d556e){return{'name':_0x5d556e['fieldName'],'type':_0x5d556e['type'][_0x946e('0x31')]};});_0x18f9ab[_0x946e('0x32')]=_[_0x946e('0x2e')](_0x5739e4,_0x946e('0x33'));_0x18f9ab[_0x946e('0x34')]=_[_0x946e('0x35')](_0x215b1a[_0x946e('0x34')]);_0x18f9ab['filters']=_[_0x946e('0x36')](_0x18f9ab[_0x946e('0x32')],_0x18f9ab[_0x946e('0x34')]);_0x1235b1[_0x946e('0x37')]=_[_0x946e('0x36')](_0x18f9ab[_0x946e('0x32')],qs[_0x946e('0x38')](_0x215b1a[_0x946e('0x34')]['fields']));_0x1235b1[_0x946e('0x37')]=_0x1235b1[_0x946e('0x37')][_0x946e('0x39')]?_0x1235b1['attributes']:_0x18f9ab[_0x946e('0x32')];if(!_0x215b1a[_0x946e('0x34')][_0x946e('0x3a')](_0x946e('0x3b'))){_0x1235b1[_0x946e('0x20')]=qs['limit'](_0x215b1a[_0x946e('0x34')][_0x946e('0x20')]);_0x1235b1[_0x946e('0x1f')]=qs['offset'](_0x215b1a[_0x946e('0x34')][_0x946e('0x1f')]);}_0x1235b1[_0x946e('0x3c')]=qs[_0x946e('0x3d')](_0x215b1a['query'][_0x946e('0x3d')]);_0x1235b1['where']=qs[_0x946e('0x3e')](_[_0x946e('0x3f')](_0x215b1a[_0x946e('0x34')],_0x18f9ab[_0x946e('0x3e')]));if(_0x215b1a[_0x946e('0x34')]['filter']){_0x1235b1['where']=_['merge'](_0x1235b1['where'],{'$or':_['map'](_0x5739e4,function(_0x56ab87){if(_0x56ab87['type']!==_0x946e('0x40')){var _0x3bfb20={};_0x3bfb20[_0x56ab87[_0x946e('0x33')]]={'$like':'%'+_0x215b1a[_0x946e('0x34')][_0x946e('0x41')]+'%'};return _0x3bfb20;}})});}_0x1235b1=_[_0x946e('0x42')]({},_0x1235b1,_0x215b1a[_0x946e('0x43')]);var _0xdb7dcd={'where':_0x1235b1[_0x946e('0x44')]};return db['OpenchannelQueue']['count'](_0xdb7dcd)[_0x946e('0x27')](function(_0x333241){_0x2717e4[_0x946e('0x45')]=_0x333241;if(_0x215b1a[_0x946e('0x34')][_0x946e('0x46')]){_0x1235b1[_0x946e('0x47')]=[{'all':!![]}];}return db[_0x946e('0x2f')][_0x946e('0x48')](_0x1235b1);})[_0x946e('0x27')](function(_0x4ef827){_0x2717e4[_0x946e('0x49')]=_0x4ef827;return _0x2717e4;})['then'](respondWithFilteredResult(_0x426df7,_0x1235b1))['catch'](handleError(_0x426df7,null));};exports[_0x946e('0x4a')]=function(_0x1c5fef,_0x1a0513){var _0x381d84={'raw':!![],'where':{'id':_0x1c5fef[_0x946e('0x4b')]['id']}},_0x27ae83={};_0x27ae83['model']=_[_0x946e('0x35')](db[_0x946e('0x2f')]['rawAttributes']);_0x27ae83[_0x946e('0x34')]=_[_0x946e('0x35')](_0x1c5fef['query']);_0x27ae83[_0x946e('0x3e')]=_[_0x946e('0x36')](_0x27ae83['model'],_0x27ae83['query']);_0x381d84[_0x946e('0x37')]=_['intersection'](_0x27ae83['model'],qs[_0x946e('0x38')](_0x1c5fef[_0x946e('0x34')][_0x946e('0x38')]));_0x381d84[_0x946e('0x37')]=_0x381d84[_0x946e('0x37')][_0x946e('0x39')]?_0x381d84[_0x946e('0x37')]:_0x27ae83[_0x946e('0x32')];if(_0x1c5fef['query'][_0x946e('0x46')]){_0x381d84[_0x946e('0x47')]=[{'all':!![]}];}_0x381d84=_['merge']({},_0x381d84,_0x1c5fef[_0x946e('0x43')]);return db[_0x946e('0x2f')][_0x946e('0x4c')](_0x381d84)[_0x946e('0x27')](handleEntityNotFound(_0x1a0513,null))['then'](respondWithResult(_0x1a0513,null))['catch'](handleError(_0x1a0513,null));};exports['create']=function(_0x51706b,_0x2a722a){return db[_0x946e('0x2f')][_0x946e('0x4d')](_0x51706b[_0x946e('0x4e')],{})[_0x946e('0x27')](function(_0x2276a1){var _0xf8b460=_0x51706b[_0x946e('0x4f')][_0x946e('0x50')]({'plain':!![]});if(!_0xf8b460)throw new Error(_0x946e('0x51'));if(_0xf8b460[_0x946e('0x52')]===_0x946e('0x4f')){var _0x31f61e=_0x2276a1[_0x946e('0x50')]({'plain':!![]});var _0x3d1067='OpenchannelQueues';return db[_0x946e('0x53')][_0x946e('0x4c')]({'where':{'name':_0x3d1067,'userProfileId':_0xf8b460['userProfileId']},'raw':!![]})['then'](function(_0x1a65ba){if(_0x1a65ba&&_0x1a65ba['autoAssociation']===0x0){return db[_0x946e('0x29')]['create']({'name':_0x31f61e['name'],'resourceId':_0x31f61e['id'],'type':_0x1a65ba[_0x946e('0x33')],'sectionId':_0x1a65ba['id']},{})[_0x946e('0x27')](function(){return _0x2276a1;});}else{return _0x2276a1;}})[_0x946e('0x54')](function(_0x5de092){logger[_0x946e('0x2a')](_0x946e('0x55'),_0x5de092);throw _0x5de092;});}return _0x2276a1;})['then'](respondWithResult(_0x2a722a,0xc9))[_0x946e('0x54')](handleError(_0x2a722a,null));};exports[_0x946e('0x25')]=function(_0xbb6d33,_0x2297ff){if(_0xbb6d33['body']['id']){delete _0xbb6d33['body']['id'];}return db[_0x946e('0x2f')][_0x946e('0x4c')]({'where':{'id':_0xbb6d33[_0x946e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2297ff,null))[_0x946e('0x27')](saveUpdates(_0xbb6d33['body'],null))['then'](respondWithResult(_0x2297ff,null))[_0x946e('0x54')](handleError(_0x2297ff,null));};exports[_0x946e('0x26')]=function(_0x3b1688,_0x194d8f){return db[_0x946e('0x2f')][_0x946e('0x4c')]({'where':{'id':_0x3b1688[_0x946e('0x4b')]['id']}})[_0x946e('0x27')](handleEntityNotFound(_0x194d8f,null))['then'](removeEntity(_0x194d8f,null))[_0x946e('0x54')](handleError(_0x194d8f,null));};exports[_0x946e('0x56')]=function(_0x3f0d2b,_0x3bfe7a){return db[_0x946e('0x2f')][_0x946e('0x56')]()[_0x946e('0x27')](respondWithResult(_0x3bfe7a,null))[_0x946e('0x54')](handleError(_0x3bfe7a,null));};exports[_0x946e('0x57')]=function(_0xe31cee,_0x363674,_0x34b782){var _0x944a4f={'raw':!![],'where':{}},_0x45d54b={},_0x5ac67;return db[_0x946e('0x2f')]['findOne']({'where':{'id':_0xe31cee[_0x946e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x363674,null))[_0x946e('0x27')](function(_0x497dd0){if(_0x497dd0){_0x5ac67=_0x497dd0[_0x946e('0x50')]({'plain':!![]});_0x45d54b[_0x946e('0x32')]=_[_0x946e('0x35')](db[_0x946e('0x58')][_0x946e('0x30')]);_0x45d54b[_0x946e('0x34')]=_['keys'](_0xe31cee[_0x946e('0x34')]);_0x45d54b[_0x946e('0x3e')]=_[_0x946e('0x36')](_0x45d54b[_0x946e('0x32')],_0x45d54b[_0x946e('0x34')]);_0x944a4f[_0x946e('0x37')]=_[_0x946e('0x36')](_0x45d54b['model'],qs[_0x946e('0x38')](_0xe31cee[_0x946e('0x34')][_0x946e('0x38')]));_0x944a4f[_0x946e('0x37')]=_0x944a4f[_0x946e('0x37')][_0x946e('0x39')]?_0x944a4f[_0x946e('0x37')]:_0x45d54b[_0x946e('0x32')];if(!_0xe31cee[_0x946e('0x34')][_0x946e('0x3a')]('nolimit')){_0x944a4f[_0x946e('0x20')]=qs['limit'](_0xe31cee[_0x946e('0x34')][_0x946e('0x20')]);_0x944a4f[_0x946e('0x1f')]=qs[_0x946e('0x1f')](_0xe31cee[_0x946e('0x34')][_0x946e('0x1f')]);}_0x944a4f['order']=qs[_0x946e('0x3d')](_0xe31cee['query']['sort']);_0x944a4f['where']=qs[_0x946e('0x3e')](_['pick'](_0xe31cee['query'],_0x45d54b[_0x946e('0x3e')]));_0x944a4f[_0x946e('0x44')][_0x946e('0x59')]=_0x497dd0['id'];if(_0xe31cee[_0x946e('0x34')][_0x946e('0x41')]){_0x944a4f['where']=_[_0x946e('0x42')](_0x944a4f[_0x946e('0x44')],{'$or':_['map'](_0x944a4f['attributes'],function(_0x55fa9f){var _0x1436d4={};_0x1436d4[_0x55fa9f]={'$like':'%'+_0xe31cee[_0x946e('0x34')][_0x946e('0x41')]+'%'};return _0x1436d4;})});}_0x944a4f=_['merge']({},_0x944a4f,_0xe31cee[_0x946e('0x43')]);return db[_0x946e('0x58')][_0x946e('0x48')](_0x944a4f);}})[_0x946e('0x27')](function(_0x539686){if(_0x539686){return db[_0x946e('0x5a')][_0x946e('0x5b')]({'where':{'id':_['map'](_0x539686,_0x946e('0x5c')),'role':_0x946e('0x5d')},'attributes':['id','name',_0x946e('0x5e'),'updatedAt','createdAt']});}})[_0x946e('0x27')](function(_0x3cd640){if(_0x3cd640){return{'count':_0x3cd640[_0x946e('0x45')],'rows':_[_0x946e('0x2e')](_0x3cd640[_0x946e('0x49')],function(_0x5e1c10){return{'membername':_0x5e1c10[_0x946e('0x33')],'UserId':_0x5e1c10['id'],'queue_name':_0x5ac67[_0x946e('0x33')],'OpenchannelQueueId':_0x5ac67['id'],'interface':util[_0x946e('0x5f')](_0x946e('0x60'),_0x946e('0x61'),_0x5e1c10[_0x946e('0x33')]),'penalty':0x0,'paused':_0x5e1c10['openchannelPause'],'createdAt':_0x5e1c10[_0x946e('0x62')],'updatedAt':_0x5e1c10[_0x946e('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x946e('0x27')](respondWithFilteredResult(_0x363674,_0x944a4f))[_0x946e('0x54')](handleError(_0x363674,null));};exports[_0x946e('0x64')]=function(_0x9b0d11,_0x63a2de,_0x35406a){var _0x4978dc={};var _0xd91d97={};var _0x226ab5;var _0x37d5e0;return db[_0x946e('0x2f')][_0x946e('0x65')]({'where':{'id':_0x9b0d11[_0x946e('0x4b')]['id']}})[_0x946e('0x27')](handleEntityNotFound(_0x63a2de,null))[_0x946e('0x27')](function(_0x271a57){if(_0x271a57){_0x226ab5=_0x271a57;_0xd91d97['model']=_[_0x946e('0x35')](db[_0x946e('0x66')][_0x946e('0x30')]);_0xd91d97[_0x946e('0x34')]=_[_0x946e('0x35')](_0x9b0d11[_0x946e('0x34')]);_0xd91d97[_0x946e('0x3e')]=_[_0x946e('0x36')](_0xd91d97['model'],_0xd91d97['query']);_0x4978dc[_0x946e('0x37')]=_['intersection'](_0xd91d97[_0x946e('0x32')],qs[_0x946e('0x38')](_0x9b0d11[_0x946e('0x34')][_0x946e('0x38')]));_0x4978dc[_0x946e('0x37')]=_0x4978dc[_0x946e('0x37')]['length']?_0x4978dc[_0x946e('0x37')]:_0xd91d97[_0x946e('0x32')];_0x4978dc['order']=qs[_0x946e('0x3d')](_0x9b0d11[_0x946e('0x34')]['sort']);_0x4978dc['where']=qs[_0x946e('0x3e')](_['pick'](_0x9b0d11[_0x946e('0x34')],_0xd91d97[_0x946e('0x3e')]));if(_0x9b0d11[_0x946e('0x34')][_0x946e('0x41')]){_0x4978dc['where']=_[_0x946e('0x42')](_0x4978dc[_0x946e('0x44')],{'$or':_[_0x946e('0x2e')](_0x4978dc[_0x946e('0x37')],function(_0x464300){var _0x242a26={};_0x242a26[_0x464300]={'$like':'%'+_0x9b0d11[_0x946e('0x34')][_0x946e('0x41')]+'%'};return _0x242a26;})});}_0x4978dc=_[_0x946e('0x42')]({},_0x4978dc,_0x9b0d11[_0x946e('0x43')]);return _0x226ab5['getTeams'](_0x4978dc);}})[_0x946e('0x27')](function(_0x18c96d){if(_0x18c96d){_0x37d5e0=_0x18c96d[_0x946e('0x39')];if(!_0x9b0d11[_0x946e('0x34')][_0x946e('0x3a')]('nolimit')){_0x4978dc['limit']=qs[_0x946e('0x20')](_0x9b0d11['query'][_0x946e('0x20')]);_0x4978dc[_0x946e('0x1f')]=qs[_0x946e('0x1f')](_0x9b0d11[_0x946e('0x34')][_0x946e('0x1f')]);}return _0x226ab5['getTeams'](_0x4978dc);}})[_0x946e('0x27')](function(_0x44b503){if(_0x44b503){return _0x44b503?{'count':_0x37d5e0,'rows':_0x44b503}:null;}})['then'](respondWithResult(_0x63a2de,null))[_0x946e('0x54')](handleError(_0x63a2de,null));};exports[_0x946e('0x67')]=function(_0x1235e1,_0x4b9dae,_0x512a50){var _0x41271=_0x1235e1['body']['ids'];return db[_0x946e('0x66')][_0x946e('0x48')]({'where':{'id':_0x41271},'attributes':['id'],'include':[{'model':db[_0x946e('0x5a')],'as':_0x946e('0x68'),'attributes':['id','name',_0x946e('0x69'),'voicePause',_0x946e('0x6a')],'raw':!![]}]})[_0x946e('0x27')](function(_0x10e15e){if(_0x10e15e){var _0x16bc48=_[_0x946e('0x6b')](_0x10e15e,function(_0x54dbbd){var _0xfe2963=_0x54dbbd[_0x946e('0x50')]({'plain':!![]});return _0xfe2963[_0x946e('0x68')];});return db[_0x946e('0x2f')]['find']({'where':{'id':_0x1235e1[_0x946e('0x4b')]['id']}})[_0x946e('0x27')](function(_0x4ae767){return db[_0x946e('0x6c')][_0x946e('0x6d')](function(_0x1070c3){return _0x4ae767[_0x946e('0x67')](_0x41271,{'transaction':_0x1070c3})['then'](function(){return BPromise['each'](_0x16bc48,function(_0x59617c){return db[_0x946e('0x58')][_0x946e('0x6e')]({'where':{'UserId':_0x59617c['id'],'OpenchannelQueueId':_0x1235e1[_0x946e('0x4b')]['id']},'transaction':_0x1070c3});});})[_0x946e('0x27')](function(){_0x16bc48[_0x946e('0x6f')](function(_0x32af7f){socket[_0x946e('0x70')](_0x946e('0x71'),{'UserId':_0x32af7f['id'],'OpenchannelQueueId':_0x4ae767['id']});});});});});}})[_0x946e('0x27')](respondWithStatusCode(_0x4b9dae,null))[_0x946e('0x54')](handleError(_0x4b9dae,null));};exports['removeTeams']=function(_0x10f3bf,_0x13ead8,_0x4489fb){return db['Team'][_0x946e('0x48')]({'where':{'id':_0x10f3bf['query'][_0x946e('0x72')]},'attributes':['id'],'include':[{'model':db[_0x946e('0x5a')],'as':_0x946e('0x68'),'attributes':['id'],'raw':!![]}]})[_0x946e('0x27')](handleEntityNotFound(_0x13ead8,null))[_0x946e('0x27')](function(_0x168973){var _0x1bc759=_[_0x946e('0x2e')](_0x168973,'id');var _0x2db59e=[];var _0x28ec90=[];var _0x13ddef=squel[_0x946e('0x73')]();_0x13ddef[_0x946e('0x74')]('tq.TeamId')['from'](_0x946e('0x75'),'tq')[_0x946e('0x76')](_0x946e('0x77'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x946e('0x78'),_0x10f3bf['params']['id']);for(var _0x4c88bc=0x0;_0x4c88bc<_0x168973['length'];_0x4c88bc+=0x1){let _0x26d5ad=_0x168973[_0x4c88bc];for(var _0x4967a4=0x0;_0x4967a4<_0x26d5ad[_0x946e('0x68')][_0x946e('0x39')];_0x4967a4+=0x1){let _0x229baf=_0x26d5ad[_0x946e('0x68')][_0x4967a4];var _0x270ec3=_0x13ddef['clone']();_0x270ec3[_0x946e('0x44')](_0x946e('0x79'),_0x229baf['id']);_0x28ec90[_0x946e('0x7a')](db[_0x946e('0x6c')][_0x946e('0x34')](_0x270ec3[_0x946e('0x7b')](),{'type':db['sequelize'][_0x946e('0x7c')][_0x946e('0x7d')]})[_0x946e('0x27')](function(_0x23921c){if(_0x23921c[_0x946e('0x39')]===0x1){return _0x229baf['id'];}else{var _0x1dc873=_['every'](_['map'](_0x23921c,_0x946e('0x7e')),function(_0x1c351a){return _[_0x946e('0x7f')](_0x1bc759,_0x1c351a);});if(_0x1dc873){return _0x229baf['id'];}}}));}}return BPromise[_0x946e('0x80')](_0x28ec90)[_0x946e('0x27')](function(_0x6251db){_0x2db59e=_(_0x2db59e)[_0x946e('0x81')](_0x6251db)[_0x946e('0x82')]()[_0x946e('0x83')]();return db[_0x946e('0x2f')][_0x946e('0x4c')]({'where':{'id':_0x10f3bf['params']['id']}})[_0x946e('0x27')](function(_0x4641fc){return db[_0x946e('0x6c')][_0x946e('0x6d')](function(_0x5806c4){return _0x4641fc[_0x946e('0x84')](_0x10f3bf['query']['ids'],{'transaction':_0x5806c4})[_0x946e('0x27')](function(){if(!_[_0x946e('0x85')](_0x2db59e)){return _0x4641fc[_0x946e('0x86')](_0x2db59e,{'transaction':_0x5806c4});}})[_0x946e('0x27')](function(){_0x2db59e[_0x946e('0x6f')](function(_0x4158a3){socket[_0x946e('0x70')](_0x946e('0x87'),{'UserId':_0x4158a3,'OpenchannelQueueId':_0x4641fc['id']});});});});});});})['then'](respondWithStatusCode(_0x13ead8,null))[_0x946e('0x54')](handleError(_0x13ead8,null));};exports['addAgents']=function(_0x12b91a,_0x55c7d5,_0x22dddc){return db['OpenchannelQueue'][_0x946e('0x4c')]({'where':{'id':_0x12b91a[_0x946e('0x4b')]['id']}})[_0x946e('0x27')](handleEntityNotFound(_0x55c7d5,null))[_0x946e('0x27')](function(_0x296c9e){if(_0x296c9e){return _0x296c9e[_0x946e('0x88')](_0x12b91a[_0x946e('0x4e')][_0x946e('0x72')],_['omit'](_0x12b91a['body'],[_0x946e('0x72'),'id'])||{})[_0x946e('0x89')](function(_0x1caaed){for(var _0x31e53b=0x0;_0x31e53b<_0x12b91a[_0x946e('0x4e')][_0x946e('0x72')]['length'];_0x31e53b+=0x1){socket[_0x946e('0x70')](_0x946e('0x71'),{'UserId':_0x12b91a['body'][_0x946e('0x72')][_0x31e53b],'OpenchannelQueueId':_0x12b91a[_0x946e('0x4b')]['id']});}return _0x1caaed;});}})[_0x946e('0x27')](respondWithResult(_0x55c7d5,null))['catch'](handleError(_0x55c7d5,null));};exports['removeAgents']=function(_0x5c2e02,_0xe079d4,_0x4bf923){return db['OpenchannelQueue'][_0x946e('0x4c')]({'where':{'id':_0x5c2e02[_0x946e('0x4b')]['id']}})[_0x946e('0x27')](handleEntityNotFound(_0xe079d4,null))['then'](function(_0x133f91){if(_0x133f91){return _0x133f91['removeAgents'](_0x5c2e02[_0x946e('0x34')][_0x946e('0x72')])[_0x946e('0x27')](function(){if(_['isArray'](_0x5c2e02[_0x946e('0x34')][_0x946e('0x72')])){for(var _0x37ae07=0x0;_0x37ae07<_0x5c2e02[_0x946e('0x34')]['ids']['length'];_0x37ae07+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x5c2e02[_0x946e('0x34')]['ids'][_0x37ae07]),'OpenchannelQueueId':Number(_0x5c2e02['params']['id'])});}}else{socket['emit'](_0x946e('0x87'),{'UserId':Number(_0x5c2e02['query']['ids']),'OpenchannelQueueId':Number(_0x5c2e02['params']['id'])});}});}})[_0x946e('0x27')](respondWithStatusCode(_0xe079d4,null))[_0x946e('0x54')](handleError(_0xe079d4,null));};exports['getAgents']=function(_0x3b61d6,_0x2eac23,_0xe8bdd4){var _0x339ba5={};var _0x4b3bf2={};var _0x3cfa67;var _0x201cd2;return db[_0x946e('0x2f')][_0x946e('0x65')]({'where':{'id':_0x3b61d6['params']['id']}})[_0x946e('0x27')](handleEntityNotFound(_0x2eac23,null))['then'](function(_0x9f0234){if(_0x9f0234){_0x3cfa67=_0x9f0234;_0x4b3bf2[_0x946e('0x32')]=_[_0x946e('0x35')](db['User']['rawAttributes']);_0x4b3bf2[_0x946e('0x34')]=_[_0x946e('0x35')](_0x3b61d6[_0x946e('0x34')]);_0x4b3bf2[_0x946e('0x3e')]=_[_0x946e('0x36')](_0x4b3bf2[_0x946e('0x32')],_0x4b3bf2[_0x946e('0x34')]);_0x339ba5[_0x946e('0x37')]=_['intersection'](_0x4b3bf2['model'],qs[_0x946e('0x38')](_0x3b61d6['query'][_0x946e('0x38')]));_0x339ba5['attributes']=_0x339ba5['attributes'][_0x946e('0x39')]?_0x339ba5[_0x946e('0x37')]:_0x4b3bf2['model'];_0x339ba5[_0x946e('0x3c')]=qs[_0x946e('0x3d')](_0x3b61d6[_0x946e('0x34')][_0x946e('0x3d')]);_0x339ba5[_0x946e('0x44')]=qs[_0x946e('0x3e')](_['pick'](_0x3b61d6['query'],_0x4b3bf2['filters']));if(_0x3b61d6[_0x946e('0x34')][_0x946e('0x41')]){_0x339ba5[_0x946e('0x44')]=_[_0x946e('0x42')](_0x339ba5[_0x946e('0x44')],{'$or':_[_0x946e('0x2e')](_0x339ba5[_0x946e('0x37')],function(_0x31607d){var _0x1d1b05={};_0x1d1b05[_0x31607d]={'$like':'%'+_0x3b61d6[_0x946e('0x34')][_0x946e('0x41')]+'%'};return _0x1d1b05;})});}_0x339ba5=_[_0x946e('0x42')]({},_0x339ba5,_0x3b61d6[_0x946e('0x43')]);return _0x3cfa67[_0x946e('0x8a')](_0x339ba5);}})['then'](function(_0x18f66f){if(_0x18f66f){_0x201cd2=_0x18f66f[_0x946e('0x39')];if(!_0x3b61d6[_0x946e('0x34')][_0x946e('0x3a')](_0x946e('0x3b'))){_0x339ba5[_0x946e('0x20')]=qs[_0x946e('0x20')](_0x3b61d6[_0x946e('0x34')][_0x946e('0x20')]);_0x339ba5[_0x946e('0x1f')]=qs['offset'](_0x3b61d6[_0x946e('0x34')][_0x946e('0x1f')]);}return _0x3cfa67[_0x946e('0x8a')](_0x339ba5);}})['then'](function(_0x462f92){if(_0x462f92){return _0x462f92?{'count':_0x201cd2,'rows':_0x462f92}:null;}})[_0x946e('0x27')](respondWithResult(_0x2eac23,null))['catch'](handleError(_0x2eac23,null));}; \ No newline at end of file +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 diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 4da3b1f..551648a 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 _0xf4d4=['hasOwnProperty','hook','exports','events','OpenchannelQueue','update','emit'];(function(_0x2b2b17,_0x6422c7){var _0x328457=function(_0x851eda){while(--_0x851eda){_0x2b2b17['push'](_0x2b2b17['shift']());}};_0x328457(++_0x6422c7);}(_0xf4d4,0x17d));var _0x4f4d=function(_0x7128a2,_0x2ad19b){_0x7128a2=_0x7128a2-0x0;var _0xb9030a=_0xf4d4[_0x7128a2];return _0xb9030a;};'use strict';var EventEmitter=require(_0x4f4d('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x4f4d('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4f4d('0x2'),'afterDestroy':'remove'};function emitEvent(_0x499cba){return function(_0x378eff,_0x658041,_0x496b55){OpenchannelQueueEvents['emit'](_0x499cba+':'+_0x378eff['id'],_0x378eff);OpenchannelQueueEvents[_0x4f4d('0x3')](_0x499cba,_0x378eff);_0x496b55(null);};}for(var e in events){if(events[_0x4f4d('0x4')](e)){var event=events[e];OpenchannelQueue[_0x4f4d('0x5')](e,emitEvent(event));}}module[_0x4f4d('0x6')]=OpenchannelQueueEvents; \ No newline at end of file +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 diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 2842cba..f45b4fe 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 _0xc3be=['exports','define','openchannel_queues','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueue.attributes'];(function(_0x2b3d84,_0x27582a){var _0x2aed47=function(_0x3252bd){while(--_0x3252bd){_0x2b3d84['push'](_0x2b3d84['shift']());}};_0x2aed47(++_0x27582a);}(_0xc3be,0x7b));var _0xec3b=function(_0xf9f831,_0x53f4e2){_0xf9f831=_0xf9f831-0x0;var _0xd0cac7=_0xc3be[_0xf9f831];return _0xd0cac7;};'use strict';var _=require(_0xec3b('0x0'));var util=require(_0xec3b('0x1'));var logger=require('../../config/logger')(_0xec3b('0x2'));var moment=require(_0xec3b('0x3'));var BPromise=require(_0xec3b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec3b('0x5'));var rimraf=require(_0xec3b('0x6'));var config=require(_0xec3b('0x7'));var attributes=require(_0xec3b('0x8'));module[_0xec3b('0x9')]=function(_0x3391ca,_0x257ea6){return _0x3391ca[_0xec3b('0xa')]('OpenchannelQueue',attributes,{'tableName':_0xec3b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index f37752e..86a1734 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 _0xa2d2=['redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','findAll','options','where','attributes','include','map','model','GetOpenchannelQueue','ShowOpenchannelQueue','OpenchannelQueue','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x512277,_0x171e0b){var _0x5bbc59=function(_0x175f81){while(--_0x175f81){_0x512277['push'](_0x512277['shift']());}};_0x5bbc59(++_0x171e0b);}(_0xa2d2,0x16d));var _0x2a2d=function(_0x3ce115,_0x379401){_0x3ce115=_0x3ce115-0x0;var _0x2fac90=_0xa2d2[_0x3ce115];return _0x2fac90;};'use strict';var _=require('lodash');var util=require(_0x2a2d('0x0'));var moment=require(_0x2a2d('0x1'));var BPromise=require(_0x2a2d('0x2'));var rs=require(_0x2a2d('0x3'));var fs=require('fs');var Redis=require(_0x2a2d('0x4'));var db=require(_0x2a2d('0x5'))['db'];var utils=require(_0x2a2d('0x6'));var logger=require(_0x2a2d('0x7'))(_0x2a2d('0x8'));var config=require(_0x2a2d('0x9'));var jayson=require(_0x2a2d('0xa'));var client=jayson[_0x2a2d('0xb')][_0x2a2d('0xc')]({'port':0x232a});config[_0x2a2d('0xd')]=_['defaults'](config[_0x2a2d('0xd')],{'host':_0x2a2d('0xe'),'port':0x18eb});var socket=require(_0x2a2d('0xf'))(new Redis(config['redis']));require(_0x2a2d('0x10'))[_0x2a2d('0x11')](socket);function respondWithRpcPromise(_0x1eed31,_0x2ac023,_0x44ef1f){return new BPromise(function(_0x2b3c57,_0xa45f7){return client['request'](_0x1eed31,_0x44ef1f)[_0x2a2d('0x12')](function(_0x1eaa0a){logger['info'](_0x2a2d('0x13'),_0x2ac023,_0x2a2d('0x14'));logger[_0x2a2d('0x15')](_0x2a2d('0x16'),_0x2ac023,_0x2a2d('0x14'),JSON[_0x2a2d('0x17')](_0x1eaa0a));if(_0x1eaa0a[_0x2a2d('0x18')]){if(_0x1eaa0a['error'][_0x2a2d('0x19')]===0x1f4){logger[_0x2a2d('0x18')](_0x2a2d('0x13'),_0x2ac023,_0x1eaa0a[_0x2a2d('0x18')]['message']);return _0xa45f7(_0x1eaa0a[_0x2a2d('0x18')][_0x2a2d('0x1a')]);}logger[_0x2a2d('0x18')](_0x2a2d('0x13'),_0x2ac023,_0x1eaa0a[_0x2a2d('0x18')][_0x2a2d('0x1a')]);return _0x2b3c57(_0x1eaa0a[_0x2a2d('0x18')][_0x2a2d('0x1a')]);}else{logger[_0x2a2d('0x1b')](_0x2a2d('0x13'),_0x2ac023,'request\x20sent');_0x2b3c57(_0x1eaa0a[_0x2a2d('0x1c')][_0x2a2d('0x1a')]);}})[_0x2a2d('0x1d')](function(_0x1f90a0){logger[_0x2a2d('0x18')](_0x2a2d('0x13'),_0x2ac023,_0x1f90a0);_0xa45f7(_0x1f90a0);});});}exports['GetOpenchannelQueue']=function(_0xc2aae2){var _0x5942aa=this;return new Promise(function(_0x311f02,_0x5d2529){return db['OpenchannelQueue'][_0x2a2d('0x1e')]({'raw':_0xc2aae2[_0x2a2d('0x1f')]?_0xc2aae2[_0x2a2d('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0xc2aae2[_0x2a2d('0x1f')]?_0xc2aae2[_0x2a2d('0x1f')][_0x2a2d('0x20')]||null:null,'attributes':_0xc2aae2[_0x2a2d('0x1f')]?_0xc2aae2[_0x2a2d('0x1f')][_0x2a2d('0x21')]||null:null,'limit':_0xc2aae2['options']?_0xc2aae2[_0x2a2d('0x1f')]['limit']||null:null,'include':_0xc2aae2[_0x2a2d('0x1f')]?_0xc2aae2[_0x2a2d('0x1f')][_0x2a2d('0x22')]?_[_0x2a2d('0x23')](_0xc2aae2[_0x2a2d('0x1f')][_0x2a2d('0x22')],function(_0x40eec6){return{'model':db[_0x40eec6[_0x2a2d('0x24')]],'as':_0x40eec6['as'],'attributes':_0x40eec6[_0x2a2d('0x21')],'include':_0x40eec6['include']?_[_0x2a2d('0x23')](_0x40eec6['include'],function(_0x30340c){return{'model':db[_0x30340c['model']],'as':_0x30340c['as'],'attributes':_0x30340c['attributes'],'include':_0x30340c[_0x2a2d('0x22')]?_['map'](_0x30340c[_0x2a2d('0x22')],function(_0x4a0e10){return{'model':db[_0x4a0e10[_0x2a2d('0x24')]],'as':_0x4a0e10['as'],'attributes':_0x4a0e10[_0x2a2d('0x21')]};}):[]};}):[]};}):[]:[]})[_0x2a2d('0x12')](function(_0x51bed8){logger[_0x2a2d('0x1b')](_0x2a2d('0x25'),_0xc2aae2);logger[_0x2a2d('0x15')](_0x2a2d('0x25'),_0xc2aae2,JSON[_0x2a2d('0x17')](_0x51bed8));_0x311f02(_0x51bed8);})['catch'](function(_0x45ebec){logger[_0x2a2d('0x18')]('GetOpenchannelQueue',_0x45ebec[_0x2a2d('0x1a')],_0xc2aae2);_0x5d2529(_0x5942aa[_0x2a2d('0x18')](0x1f4,_0x45ebec[_0x2a2d('0x1a')]));});});};exports[_0x2a2d('0x26')]=function(_0x13e1bb){var _0x1ac9d0=this;return new Promise(function(_0x419f72,_0x2faa7a){return db[_0x2a2d('0x27')][_0x2a2d('0x28')]({'raw':_0x13e1bb['options']?_0x13e1bb['options'][_0x2a2d('0x29')]===undefined?!![]:![]:!![],'where':_0x13e1bb[_0x2a2d('0x1f')]?_0x13e1bb['options'][_0x2a2d('0x20')]||null:null,'attributes':_0x13e1bb[_0x2a2d('0x1f')]?_0x13e1bb[_0x2a2d('0x1f')][_0x2a2d('0x21')]||null:null,'include':_0x13e1bb[_0x2a2d('0x1f')]?_0x13e1bb[_0x2a2d('0x1f')][_0x2a2d('0x22')]?_[_0x2a2d('0x23')](_0x13e1bb[_0x2a2d('0x1f')][_0x2a2d('0x22')],function(_0x5c3f63){return{'model':db[_0x5c3f63[_0x2a2d('0x24')]],'as':_0x5c3f63['as'],'attributes':_0x5c3f63['attributes'],'include':_0x5c3f63['include']?_[_0x2a2d('0x23')](_0x5c3f63[_0x2a2d('0x22')],function(_0x29dc28){return{'model':db[_0x29dc28[_0x2a2d('0x24')]],'as':_0x29dc28['as'],'attributes':_0x29dc28['attributes'],'include':_0x29dc28[_0x2a2d('0x22')]?_[_0x2a2d('0x23')](_0x29dc28[_0x2a2d('0x22')],function(_0x1e6b6d){return{'model':db[_0x1e6b6d[_0x2a2d('0x24')]],'as':_0x1e6b6d['as'],'attributes':_0x1e6b6d[_0x2a2d('0x21')]};}):[]};}):[]};}):[]:[]})[_0x2a2d('0x12')](function(_0x3e94d5){logger['info'](_0x2a2d('0x26'),_0x13e1bb);logger[_0x2a2d('0x15')]('ShowOpenchannelQueue',_0x13e1bb,JSON[_0x2a2d('0x17')](_0x3e94d5));_0x419f72(_0x3e94d5);})['catch'](function(_0x46610a){logger[_0x2a2d('0x18')](_0x2a2d('0x26'),_0x46610a[_0x2a2d('0x1a')],_0x13e1bb);_0x2faa7a(_0x1ac9d0['error'](0x1f4,_0x46610a[_0x2a2d('0x1a')]));});});}; \ No newline at end of file +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 diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index dad88f5..b138217 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 _0x4ccf=['removeListener','register','length','openchannelQueue:','save','remove','update'];(function(_0x3a2f65,_0x3a1bf3){var _0xd344ea=function(_0x568720){while(--_0x568720){_0x3a2f65['push'](_0x3a2f65['shift']());}};_0xd344ea(++_0x3a1bf3);}(_0x4ccf,0x170));var _0xf4cc=function(_0x550cc6,_0x25187f){_0x550cc6=_0x550cc6-0x0;var _0x3d23e0=_0x4ccf[_0x550cc6];return _0x3d23e0;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0xf4cc('0x0'),_0xf4cc('0x1'),_0xf4cc('0x2')];function createListener(_0x42bd9a,_0x58d91c){return function(_0x3edc4d){_0x58d91c['emit'](_0x42bd9a,_0x3edc4d);};}function removeListener(_0x8cb2dc,_0x12d823){return function(){OpenchannelQueueEvents[_0xf4cc('0x3')](_0x8cb2dc,_0x12d823);};}exports[_0xf4cc('0x4')]=function(_0x1d8da7){for(var _0x3c7c53=0x0,_0x234ff6=events[_0xf4cc('0x5')];_0x3c7c53<_0x234ff6;_0x3c7c53++){var _0x4b0a29=events[_0x3c7c53];var _0x392fda=createListener(_0xf4cc('0x6')+_0x4b0a29,_0x1d8da7);OpenchannelQueueEvents['on'](_0x4b0a29,_0x392fda);}}; \ No newline at end of file +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 diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 78293ee..ddc3651 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 _0x67cb=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','post','create','put','/:id','update','delete','exports'];(function(_0x3c73cb,_0x4b9aa6){var _0x3898ae=function(_0x1f54a9){while(--_0x1f54a9){_0x3c73cb['push'](_0x3c73cb['shift']());}};_0x3898ae(++_0x4b9aa6);}(_0x67cb,0x84));var _0xb67c=function(_0x3c504b,_0x437693){_0x3c504b=_0x3c504b-0x0;var _0x2e5354=_0x67cb[_0x3c504b];return _0x2e5354;};'use strict';var multer=require(_0xb67c('0x0'));var util=require(_0xb67c('0x1'));var path=require(_0xb67c('0x2'));var timeout=require(_0xb67c('0x3'));var express=require(_0xb67c('0x4'));var router=express[_0xb67c('0x5')]();var auth=require(_0xb67c('0x6'));var interaction=require(_0xb67c('0x7'));var config=require(_0xb67c('0x8'));var controller=require('./openchannelQueueReport.controller');router[_0xb67c('0x9')]('/',auth['isAuthenticated'](),controller[_0xb67c('0xa')]);router['get'](_0xb67c('0xb'),auth[_0xb67c('0xc')](),controller[_0xb67c('0xd')]);router[_0xb67c('0x9')]('/:id',auth[_0xb67c('0xc')](),controller[_0xb67c('0xe')]);router[_0xb67c('0xf')]('/',auth['isAuthenticated'](),controller[_0xb67c('0x10')]);router[_0xb67c('0x11')](_0xb67c('0x12'),auth[_0xb67c('0xc')](),controller[_0xb67c('0x13')]);router[_0xb67c('0x14')](_0xb67c('0x12'),auth[_0xb67c('0xc')](),controller['destroy']);module[_0xb67c('0x15')]=router; \ No newline at end of file +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 diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 9953c04..0cbd209 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 _0x0bff=['sequelize','STRING','DATE','moment'];(function(_0xbe40ad,_0x44343c){var _0x50fac9=function(_0xdaed07){while(--_0xdaed07){_0xbe40ad['push'](_0xbe40ad['shift']());}};_0x50fac9(++_0x44343c);}(_0x0bff,0x157));var _0xf0bf=function(_0x3ff855,_0x58f7bf){_0x3ff855=_0x3ff855-0x0;var _0x2aecb4=_0x0bff[_0x3ff855];return _0x2aecb4;};'use strict';var moment=require(_0xf0bf('0x0'));var Sequelize=require(_0xf0bf('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xf0bf('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xf0bf('0x3')]},'acceptAt':{'type':Sequelize[_0xf0bf('0x3')]},'exitAt':{'type':Sequelize[_0xf0bf('0x3')]},'reason':{'type':Sequelize[_0xf0bf('0x2')]}}; \ No newline at end of file +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 diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 6adeec7..f47bc02 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 _0x160f=['intersection','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','name','index','rawAttributes','fieldName','type','key','query','filters','model','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','OpenchannelQueueReport','includeAll','include','findAll','rows','catch','show','params','keys'];(function(_0x4b26b5,_0x4f71fd){var _0x4dec71=function(_0x184329){while(--_0x184329){_0x4b26b5['push'](_0x4b26b5['shift']());}};_0x4dec71(++_0x4f71fd);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xf160('0x0'));var emlformat=require(_0xf160('0x1'));var rimraf=require(_0xf160('0x2'));var zipdir=require(_0xf160('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf160('0x4'));var moment=require(_0xf160('0x5'));var BPromise=require(_0xf160('0x6'));var Mustache=require(_0xf160('0x7'));var util=require(_0xf160('0x8'));var path=require(_0xf160('0x9'));var sox=require('sox');var csv=require(_0xf160('0xa'));var ejs=require(_0xf160('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf160('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf160('0xd'));var Papa=require(_0xf160('0xe'));var Redis=require(_0xf160('0xf'));var authService=require(_0xf160('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf160('0x11'));var logger=require(_0xf160('0x12'))(_0xf160('0x13'));var utils=require('../../config/utils');var config=require(_0xf160('0x14'));var db=require(_0xf160('0x15'))['db'];function respondWithStatusCode(_0x25866c,_0x3b09ea){_0x3b09ea=_0x3b09ea||0xcc;return function(_0x2d8854){if(_0x2d8854){return _0x25866c['sendStatus'](_0x3b09ea);}return _0x25866c[_0xf160('0x16')](_0x3b09ea)['end']();};}function respondWithResult(_0x1496b6,_0x26951a){_0x26951a=_0x26951a||0xc8;return function(_0x12549a){if(_0x12549a){return _0x1496b6[_0xf160('0x16')](_0x26951a)[_0xf160('0x17')](_0x12549a);}};}function respondWithFilteredResult(_0x31f7ae,_0x2643ba){return function(_0x172337){if(_0x172337){var _0x1396ba=_0x172337[_0xf160('0x18')],_0x59ac02=_0x2643ba[_0xf160('0x19')],_0x477e4d=_0x2643ba['offset']+_0x2643ba[_0xf160('0x1a')],_0x400bda;if(_0x477e4d>=_0x1396ba){_0x477e4d=_0x1396ba;_0x400bda=0xc8;}else{_0x400bda=0xce;}_0x31f7ae['status'](_0x400bda);return _0x31f7ae[_0xf160('0x1b')](_0xf160('0x1c'),_0x59ac02+'-'+_0x477e4d+'/'+_0x1396ba)[_0xf160('0x17')](_0x172337);}return null;};}function patchUpdates(_0x1e09f3){return function(_0x19299b){try{jsonpatch[_0xf160('0x1d')](_0x19299b,_0x1e09f3,!![]);}catch(_0x156dca){return BPromise[_0xf160('0x1e')](_0x156dca);}return _0x19299b[_0xf160('0x1f')]();};}function saveUpdates(_0x4a58d9,_0x40ccf0){return function(_0xa20d5a){if(_0xa20d5a){return _0xa20d5a[_0xf160('0x20')](_0x4a58d9)['then'](function(_0x435572){return _0x435572;});}return null;};}function removeEntity(_0xff0491,_0x454e63){return function(_0x36d0cb){if(_0x36d0cb){return _0x36d0cb[_0xf160('0x21')]()[_0xf160('0x22')](function(){_0xff0491[_0xf160('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d1f6c,_0x28bf27){return function(_0x305f6a){if(!_0x305f6a){_0x3d1f6c[_0xf160('0x23')](0x194);}return _0x305f6a;};}function handleError(_0x578f7d,_0x42458c){_0x42458c=_0x42458c||0x1f4;return function(_0x46d45a){logger['error'](_0x46d45a['stack']);if(_0x46d45a[_0xf160('0x24')]){delete _0x46d45a[_0xf160('0x24')];}_0x578f7d[_0xf160('0x16')](_0x42458c)['send'](_0x46d45a);};}exports[_0xf160('0x25')]=function(_0x73851f,_0x2851e8){var _0x2e2b00={},_0x135e0f={},_0x193e1e={'count':0x0,'rows':[]};var _0x5d0cc8=_['map'](db['OpenchannelQueueReport'][_0xf160('0x26')],function(_0x16a5fa){return{'name':_0x16a5fa[_0xf160('0x27')],'type':_0x16a5fa[_0xf160('0x28')][_0xf160('0x29')]};});_0x135e0f['model']=_['map'](_0x5d0cc8,_0xf160('0x24'));_0x135e0f['query']=_['keys'](_0x73851f[_0xf160('0x2a')]);_0x135e0f[_0xf160('0x2b')]=_['intersection'](_0x135e0f[_0xf160('0x2c')],_0x135e0f[_0xf160('0x2a')]);_0x2e2b00['attributes']=_['intersection'](_0x135e0f['model'],qs['fields'](_0x73851f[_0xf160('0x2a')][_0xf160('0x2d')]));_0x2e2b00[_0xf160('0x2e')]=_0x2e2b00[_0xf160('0x2e')][_0xf160('0x2f')]?_0x2e2b00[_0xf160('0x2e')]:_0x135e0f['model'];if(!_0x73851f['query']['hasOwnProperty'](_0xf160('0x30'))){_0x2e2b00['limit']=qs['limit'](_0x73851f[_0xf160('0x2a')][_0xf160('0x1a')]);_0x2e2b00['offset']=qs[_0xf160('0x19')](_0x73851f[_0xf160('0x2a')][_0xf160('0x19')]);}_0x2e2b00[_0xf160('0x31')]=qs[_0xf160('0x32')](_0x73851f['query'][_0xf160('0x32')]);_0x2e2b00[_0xf160('0x33')]=qs[_0xf160('0x2b')](_['pick'](_0x73851f[_0xf160('0x2a')],_0x135e0f[_0xf160('0x2b')]));if(_0x73851f[_0xf160('0x2a')][_0xf160('0x34')]){_0x2e2b00[_0xf160('0x33')]=_[_0xf160('0x35')](_0x2e2b00['where'],{'$or':_['map'](_0x5d0cc8,function(_0x36d21b){if(_0x36d21b[_0xf160('0x28')]!==_0xf160('0x36')){var _0x1ca3bd={};_0x1ca3bd[_0x36d21b[_0xf160('0x24')]]={'$like':'%'+_0x73851f[_0xf160('0x2a')][_0xf160('0x34')]+'%'};return _0x1ca3bd;}})});}_0x2e2b00=_[_0xf160('0x35')]({},_0x2e2b00,_0x73851f[_0xf160('0x37')]);var _0x346706={'where':_0x2e2b00[_0xf160('0x33')]};return db[_0xf160('0x38')][_0xf160('0x18')](_0x346706)[_0xf160('0x22')](function(_0x2e7a32){_0x193e1e[_0xf160('0x18')]=_0x2e7a32;if(_0x73851f[_0xf160('0x2a')][_0xf160('0x39')]){_0x2e2b00[_0xf160('0x3a')]=[{'all':!![]}];}return db[_0xf160('0x38')][_0xf160('0x3b')](_0x2e2b00);})[_0xf160('0x22')](function(_0x39706e){_0x193e1e[_0xf160('0x3c')]=_0x39706e;return _0x193e1e;})['then'](respondWithFilteredResult(_0x2851e8,_0x2e2b00))[_0xf160('0x3d')](handleError(_0x2851e8,null));};exports[_0xf160('0x3e')]=function(_0x2cfec0,_0x412e66){var _0x3d273d={'raw':!![],'where':{'id':_0x2cfec0[_0xf160('0x3f')]['id']}},_0xed8784={};_0xed8784['model']=_[_0xf160('0x40')](db['OpenchannelQueueReport'][_0xf160('0x26')]);_0xed8784[_0xf160('0x2a')]=_['keys'](_0x2cfec0[_0xf160('0x2a')]);_0xed8784[_0xf160('0x2b')]=_[_0xf160('0x41')](_0xed8784[_0xf160('0x2c')],_0xed8784[_0xf160('0x2a')]);_0x3d273d[_0xf160('0x2e')]=_[_0xf160('0x41')](_0xed8784['model'],qs[_0xf160('0x2d')](_0x2cfec0[_0xf160('0x2a')][_0xf160('0x2d')]));_0x3d273d[_0xf160('0x2e')]=_0x3d273d[_0xf160('0x2e')][_0xf160('0x2f')]?_0x3d273d[_0xf160('0x2e')]:_0xed8784[_0xf160('0x2c')];if(_0x2cfec0[_0xf160('0x2a')][_0xf160('0x39')]){_0x3d273d[_0xf160('0x3a')]=[{'all':!![]}];}_0x3d273d=_['merge']({},_0x3d273d,_0x2cfec0['options']);return db[_0xf160('0x38')][_0xf160('0x42')](_0x3d273d)[_0xf160('0x22')](handleEntityNotFound(_0x412e66,null))[_0xf160('0x22')](respondWithResult(_0x412e66,null))[_0xf160('0x3d')](handleError(_0x412e66,null));};exports[_0xf160('0x43')]=function(_0x4a542f,_0xb3bc25){return db['OpenchannelQueueReport']['create'](_0x4a542f[_0xf160('0x44')],{})[_0xf160('0x22')](respondWithResult(_0xb3bc25,0xc9))['catch'](handleError(_0xb3bc25,null));};exports['update']=function(_0x2f1648,_0x2681f2){if(_0x2f1648[_0xf160('0x44')]['id']){delete _0x2f1648[_0xf160('0x44')]['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x2f1648['params']['id']}})['then'](handleEntityNotFound(_0x2681f2,null))[_0xf160('0x22')](saveUpdates(_0x2f1648['body'],null))[_0xf160('0x22')](respondWithResult(_0x2681f2,null))[_0xf160('0x3d')](handleError(_0x2681f2,null));};exports[_0xf160('0x21')]=function(_0x3bdfdb,_0x4f2e23){return db[_0xf160('0x38')][_0xf160('0x42')]({'where':{'id':_0x3bdfdb[_0xf160('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4f2e23,null))[_0xf160('0x22')](removeEntity(_0x4f2e23,null))[_0xf160('0x3d')](handleError(_0x4f2e23,null));};exports[_0xf160('0x45')]=function(_0x5c3cee,_0x2dba32){return db[_0xf160('0x38')][_0xf160('0x45')]()[_0xf160('0x22')](respondWithResult(_0x2dba32,null))[_0xf160('0x3d')](handleError(_0x2dba32,null));}; \ No newline at end of file +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 diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index ab8ae32..8767ffb 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 _0x5977=['path','../../config/environment','exports','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x5977,0xeb));var _0x7597=function(_0x433210,_0x3c50ac){_0x433210=_0x433210-0x0;var _0x99f7af=_0x5977[_0x433210];return _0x99f7af;};'use strict';var _=require(_0x7597('0x0'));var util=require(_0x7597('0x1'));var logger=require(_0x7597('0x2'))('api');var moment=require(_0x7597('0x3'));var BPromise=require(_0x7597('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7597('0x5'));var rimraf=require('rimraf');var config=require(_0x7597('0x6'));var attributes=require('./openchannelQueueReport.attributes');module[_0x7597('0x7')]=function(_0x3875e1,_0x5302c6){return _0x3875e1['define']('OpenchannelQueueReport',attributes,{'tableName':_0x7597('0x8'),'paranoid':![],'indexes':[{'name':_0x7597('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 679332b..d910f1e 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 _0xbd8e=['then','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','raw','info','UpdateOpenchannelQueueReport','update','attributes','limit','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x444e22,_0x57c00b){var _0x5103d7=function(_0x736b9a){while(--_0x736b9a){_0x444e22['push'](_0x444e22['shift']());}};_0x5103d7(++_0x57c00b);}(_0xbd8e,0x1b5));var _0xebd8=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xbd8e[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xebd8('0x0'));var util=require(_0xebd8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xebd8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xebd8('0x3'))['db'];var utils=require(_0xebd8('0x4'));var logger=require(_0xebd8('0x5'))(_0xebd8('0x6'));var config=require(_0xebd8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xebd8('0x8')][_0xebd8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f2b2e,_0x3740bd,_0x3b92b9){return new BPromise(function(_0x4ac0d0,_0x19c8ee){return client[_0xebd8('0xa')](_0x3f2b2e,_0x3b92b9)[_0xebd8('0xb')](function(_0x13afa5){logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x3740bd,'request\x20sent');logger[_0xebd8('0xc')](_0xebd8('0xd'),_0x3740bd,_0xebd8('0xe'),JSON[_0xebd8('0xf')](_0x13afa5));if(_0x13afa5[_0xebd8('0x10')]){if(_0x13afa5['error'][_0xebd8('0x11')]===0x1f4){logger['error'](_0xebd8('0x12'),_0x3740bd,_0x13afa5[_0xebd8('0x10')]['message']);return _0x19c8ee(_0x13afa5[_0xebd8('0x10')][_0xebd8('0x13')]);}logger[_0xebd8('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3740bd,_0x13afa5[_0xebd8('0x10')]['message']);return _0x4ac0d0(_0x13afa5[_0xebd8('0x10')]['message']);}else{logger['info'](_0xebd8('0x12'),_0x3740bd,_0xebd8('0xe'));_0x4ac0d0(_0x13afa5[_0xebd8('0x14')][_0xebd8('0x13')]);}})[_0xebd8('0x15')](function(_0x2b6ac4){logger[_0xebd8('0x10')](_0xebd8('0x12'),_0x3740bd,_0x2b6ac4);_0x19c8ee(_0x2b6ac4);});});}exports[_0xebd8('0x16')]=function(_0x3e0293){var _0x22152a=this;return new Promise(function(_0x46a956,_0x204593){return db[_0xebd8('0x17')]['create'](_0x3e0293[_0xebd8('0x18')],{'raw':_0x3e0293[_0xebd8('0x19')]?_0x3e0293[_0xebd8('0x19')][_0xebd8('0x1a')]===undefined?!![]:![]:!![]})[_0xebd8('0xb')](function(_0x24be02){logger[_0xebd8('0x1b')](_0xebd8('0x16'),_0x3e0293);logger[_0xebd8('0xc')]('CreateOpenchannelQueueReport',_0x3e0293,JSON[_0xebd8('0xf')](_0x24be02));_0x46a956(_0x24be02);})[_0xebd8('0x15')](function(_0x26aff8){logger[_0xebd8('0x10')](_0xebd8('0x16'),_0x26aff8[_0xebd8('0x13')],_0x3e0293);_0x204593(_0x22152a[_0xebd8('0x10')](0x1f4,_0x26aff8[_0xebd8('0x13')]));});});};exports[_0xebd8('0x1c')]=function(_0x228411){var _0x3728a6=this;return new Promise(function(_0x1d7e25,_0xa64ff5){return db['OpenchannelQueueReport'][_0xebd8('0x1d')](_0x228411['body'],{'raw':_0x228411[_0xebd8('0x19')]?_0x228411[_0xebd8('0x19')][_0xebd8('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x228411[_0xebd8('0x19')]?_0x228411['options']['where']||null:null,'attributes':_0x228411[_0xebd8('0x19')]?_0x228411[_0xebd8('0x19')][_0xebd8('0x1e')]||null:null,'limit':_0x228411[_0xebd8('0x19')]?_0x228411[_0xebd8('0x19')][_0xebd8('0x1f')]||null:null})[_0xebd8('0xb')](function(_0x5b0db9){logger['info'](_0xebd8('0x1c'),_0x228411);logger['debug'](_0xebd8('0x1c'),_0x228411,JSON['stringify'](_0x5b0db9));_0x1d7e25(_0x5b0db9);})[_0xebd8('0x15')](function(_0x2830fe){logger['error'](_0xebd8('0x1c'),_0x2830fe['message'],_0x228411);_0xa64ff5(_0x3728a6[_0xebd8('0x10')](0x1f4,_0x2830fe[_0xebd8('0x13')]));});});}; \ No newline at end of file +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 diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 013890d..805925a 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(_0x2de020,_0x252df0){var _0x182b7c=function(_0xcbcdaa){while(--_0xcbcdaa){_0x2de020['push'](_0x2de020['shift']());}};_0x182b7c(++_0x252df0);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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(_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 diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index f24249b..5bce98c 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 _0x2fb9=['queue','DATE','exports','STRING','account','agent'];(function(_0x124b8e,_0x528a27){var _0x4faccf=function(_0x4f5af5){while(--_0x4f5af5){_0x124b8e['push'](_0x124b8e['shift']());}};_0x4faccf(++_0x528a27);}(_0x2fb9,0x1e2));var _0x92fb=function(_0x1fa54a,_0x2b0d44){_0x1fa54a=_0x1fa54a-0x0;var _0x76b6bc=_0x2fb9[_0x1fa54a];return _0x76b6bc;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x92fb('0x0')]={'uniqueid':{'type':Sequelize[_0x92fb('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x92fb('0x2'),_0x92fb('0x3'),_0x92fb('0x4')),'allowNull':![],'defaultValue':_0x92fb('0x4')},'transferredAt':{'type':Sequelize[_0x92fb('0x5')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +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 diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 4330d7d..3cfb00f 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 _0x4223=['sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','fields','merge','find','create','body','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','set','Content-Range','json','reject','save','update','then','error','name','send','map','OpenchannelTransferReport','rawAttributes','fieldName','type','intersection','query','attributes','model','length','hasOwnProperty','nolimit','limit','offset','order'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x4223,0xa8));var _0x3422=function(_0x27f761,_0x3a3ee8){_0x27f761=_0x27f761-0x0;var _0x544376=_0x4223[_0x27f761];return _0x544376;};'use strict';var pdf=require(_0x3422('0x0'));var emlformat=require(_0x3422('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3422('0x2'));var jsonpatch=require(_0x3422('0x3'));var rp=require(_0x3422('0x4'));var moment=require(_0x3422('0x5'));var BPromise=require(_0x3422('0x6'));var Mustache=require('mustache');var util=require(_0x3422('0x7'));var path=require(_0x3422('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3422('0x9'));var fs=require('fs');var _=require(_0x3422('0xa'));var squel=require(_0x3422('0xb'));var crypto=require(_0x3422('0xc'));var jsforce=require(_0x3422('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3422('0xe'));var querystring=require(_0x3422('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3422('0x10'));var qs=require(_0x3422('0x11'));var as=require(_0x3422('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3422('0x13'));var utils=require('../../config/utils');var config=require(_0x3422('0x14'));var db=require(_0x3422('0x15'))['db'];function respondWithStatusCode(_0x4a1727,_0x8a0d04){_0x8a0d04=_0x8a0d04||0xcc;return function(_0x319a3){if(_0x319a3){return _0x4a1727[_0x3422('0x16')](_0x8a0d04);}return _0x4a1727[_0x3422('0x17')](_0x8a0d04)[_0x3422('0x18')]();};}function respondWithResult(_0x45b933,_0x4d38b5){_0x4d38b5=_0x4d38b5||0xc8;return function(_0x167cf6){if(_0x167cf6){return _0x45b933['status'](_0x4d38b5)['json'](_0x167cf6);}};}function respondWithFilteredResult(_0x21edd2,_0xc1b440){return function(_0x3fdc3e){if(_0x3fdc3e){var _0x1911e1=_0x3fdc3e[_0x3422('0x19')],_0x3e6665=_0xc1b440['offset'],_0x47defe=_0xc1b440['offset']+_0xc1b440['limit'],_0x66dfc;if(_0x47defe>=_0x1911e1){_0x47defe=_0x1911e1;_0x66dfc=0xc8;}else{_0x66dfc=0xce;}_0x21edd2[_0x3422('0x17')](_0x66dfc);return _0x21edd2[_0x3422('0x1a')](_0x3422('0x1b'),_0x3e6665+'-'+_0x47defe+'/'+_0x1911e1)[_0x3422('0x1c')](_0x3fdc3e);}return null;};}function patchUpdates(_0x8770f2){return function(_0x3f5ae2){try{jsonpatch['apply'](_0x3f5ae2,_0x8770f2,!![]);}catch(_0x3274fe){return BPromise[_0x3422('0x1d')](_0x3274fe);}return _0x3f5ae2[_0x3422('0x1e')]();};}function saveUpdates(_0xaaae4f,_0x33037e){return function(_0x2fc970){if(_0x2fc970){return _0x2fc970[_0x3422('0x1f')](_0xaaae4f)[_0x3422('0x20')](function(_0x408370){return _0x408370;});}return null;};}function removeEntity(_0x16791e,_0x5ca59f){return function(_0x268198){if(_0x268198){return _0x268198['destroy']()['then'](function(){_0x16791e[_0x3422('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cee8c,_0x8200ae){return function(_0x1c13a9){if(!_0x1c13a9){_0x3cee8c['sendStatus'](0x194);}return _0x1c13a9;};}function handleError(_0x3d00ee,_0x3401f8){_0x3401f8=_0x3401f8||0x1f4;return function(_0x1bb8ff){logger[_0x3422('0x21')](_0x1bb8ff['stack']);if(_0x1bb8ff[_0x3422('0x22')]){delete _0x1bb8ff['name'];}_0x3d00ee['status'](_0x3401f8)[_0x3422('0x23')](_0x1bb8ff);};}exports['index']=function(_0x5d1805,_0x45f7d4){var _0x47ba1d={},_0x4d980d={},_0xda1688={'count':0x0,'rows':[]};var _0x38982f=_[_0x3422('0x24')](db[_0x3422('0x25')][_0x3422('0x26')],function(_0x101a51){return{'name':_0x101a51[_0x3422('0x27')],'type':_0x101a51[_0x3422('0x28')]['key']};});_0x4d980d['model']=_['map'](_0x38982f,_0x3422('0x22'));_0x4d980d['query']=_['keys'](_0x5d1805['query']);_0x4d980d['filters']=_[_0x3422('0x29')](_0x4d980d['model'],_0x4d980d[_0x3422('0x2a')]);_0x47ba1d[_0x3422('0x2b')]=_[_0x3422('0x29')](_0x4d980d[_0x3422('0x2c')],qs['fields'](_0x5d1805[_0x3422('0x2a')]['fields']));_0x47ba1d[_0x3422('0x2b')]=_0x47ba1d[_0x3422('0x2b')][_0x3422('0x2d')]?_0x47ba1d['attributes']:_0x4d980d[_0x3422('0x2c')];if(!_0x5d1805[_0x3422('0x2a')][_0x3422('0x2e')](_0x3422('0x2f'))){_0x47ba1d[_0x3422('0x30')]=qs['limit'](_0x5d1805[_0x3422('0x2a')][_0x3422('0x30')]);_0x47ba1d[_0x3422('0x31')]=qs[_0x3422('0x31')](_0x5d1805[_0x3422('0x2a')][_0x3422('0x31')]);}_0x47ba1d[_0x3422('0x32')]=qs[_0x3422('0x33')](_0x5d1805[_0x3422('0x2a')]['sort']);_0x47ba1d[_0x3422('0x34')]=qs[_0x3422('0x35')](_[_0x3422('0x36')](_0x5d1805[_0x3422('0x2a')],_0x4d980d[_0x3422('0x35')]));if(_0x5d1805[_0x3422('0x2a')][_0x3422('0x37')]){_0x47ba1d[_0x3422('0x34')]=_['merge'](_0x47ba1d[_0x3422('0x34')],{'$or':_[_0x3422('0x24')](_0x38982f,function(_0x2c0baa){if(_0x2c0baa['type']!==_0x3422('0x38')){var _0x56d0f4={};_0x56d0f4[_0x2c0baa['name']]={'$like':'%'+_0x5d1805[_0x3422('0x2a')][_0x3422('0x37')]+'%'};return _0x56d0f4;}})});}_0x47ba1d=_['merge']({},_0x47ba1d,_0x5d1805[_0x3422('0x39')]);var _0x186dbd={'where':_0x47ba1d[_0x3422('0x34')]};return db['OpenchannelTransferReport'][_0x3422('0x19')](_0x186dbd)[_0x3422('0x20')](function(_0x326a3f){_0xda1688[_0x3422('0x19')]=_0x326a3f;if(_0x5d1805['query'][_0x3422('0x3a')]){_0x47ba1d[_0x3422('0x3b')]=[{'all':!![]}];}return db[_0x3422('0x25')][_0x3422('0x3c')](_0x47ba1d);})['then'](function(_0x2f9dc7){_0xda1688[_0x3422('0x3d')]=_0x2f9dc7;return _0xda1688;})[_0x3422('0x20')](respondWithFilteredResult(_0x45f7d4,_0x47ba1d))[_0x3422('0x3e')](handleError(_0x45f7d4,null));};exports[_0x3422('0x3f')]=function(_0x5dddc8,_0x2cc940){var _0x137230={'raw':!![],'where':{'id':_0x5dddc8[_0x3422('0x40')]['id']}},_0x59cfca={};_0x59cfca[_0x3422('0x2c')]=_[_0x3422('0x41')](db[_0x3422('0x25')][_0x3422('0x26')]);_0x59cfca[_0x3422('0x2a')]=_[_0x3422('0x41')](_0x5dddc8[_0x3422('0x2a')]);_0x59cfca[_0x3422('0x35')]=_['intersection'](_0x59cfca['model'],_0x59cfca[_0x3422('0x2a')]);_0x137230[_0x3422('0x2b')]=_[_0x3422('0x29')](_0x59cfca[_0x3422('0x2c')],qs[_0x3422('0x42')](_0x5dddc8[_0x3422('0x2a')][_0x3422('0x42')]));_0x137230['attributes']=_0x137230['attributes'][_0x3422('0x2d')]?_0x137230[_0x3422('0x2b')]:_0x59cfca[_0x3422('0x2c')];if(_0x5dddc8[_0x3422('0x2a')]['includeAll']){_0x137230[_0x3422('0x3b')]=[{'all':!![]}];}_0x137230=_[_0x3422('0x43')]({},_0x137230,_0x5dddc8['options']);return db[_0x3422('0x25')][_0x3422('0x44')](_0x137230)['then'](handleEntityNotFound(_0x2cc940,null))[_0x3422('0x20')](respondWithResult(_0x2cc940,null))['catch'](handleError(_0x2cc940,null));};exports['create']=function(_0x5eaa91,_0x149b27){return db['OpenchannelTransferReport'][_0x3422('0x45')](_0x5eaa91['body'],{})[_0x3422('0x20')](respondWithResult(_0x149b27,0xc9))['catch'](handleError(_0x149b27,null));};exports[_0x3422('0x1f')]=function(_0x1e6e54,_0x13a602){if(_0x1e6e54[_0x3422('0x46')]['id']){delete _0x1e6e54[_0x3422('0x46')]['id'];}return db[_0x3422('0x25')][_0x3422('0x44')]({'where':{'id':_0x1e6e54[_0x3422('0x40')]['id']}})[_0x3422('0x20')](handleEntityNotFound(_0x13a602,null))['then'](saveUpdates(_0x1e6e54[_0x3422('0x46')],null))[_0x3422('0x20')](respondWithResult(_0x13a602,null))[_0x3422('0x3e')](handleError(_0x13a602,null));};exports[_0x3422('0x47')]=function(_0x252ad8,_0x31bc9c){return db[_0x3422('0x25')][_0x3422('0x44')]({'where':{'id':_0x252ad8[_0x3422('0x40')]['id']}})[_0x3422('0x20')](handleEntityNotFound(_0x31bc9c,null))[_0x3422('0x20')](removeEntity(_0x31bc9c,null))['catch'](handleError(_0x31bc9c,null));};exports[_0x3422('0x48')]=function(_0x491d7d,_0xb83116){return db[_0x3422('0x25')][_0x3422('0x48')]()['then'](respondWithResult(_0xb83116,null))['catch'](handleError(_0xb83116,null));}; \ No newline at end of file +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 diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index a6efda4..75892d6 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 _0x63a4=['moment','bluebird','request-promise','path','../../config/environment','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','../../config/logger','api'];(function(_0x4c3ac3,_0x7177d8){var _0xd7ff02=function(_0x5b9ac8){while(--_0x5b9ac8){_0x4c3ac3['push'](_0x4c3ac3['shift']());}};_0xd7ff02(++_0x7177d8);}(_0x63a4,0x1ad));var _0x463a=function(_0x382c73,_0x199cab){_0x382c73=_0x382c73-0x0;var _0x1dd0bf=_0x63a4[_0x382c73];return _0x1dd0bf;};'use strict';var _=require(_0x463a('0x0'));var util=require('util');var logger=require(_0x463a('0x1'))(_0x463a('0x2'));var moment=require(_0x463a('0x3'));var BPromise=require(_0x463a('0x4'));var rp=require(_0x463a('0x5'));var fs=require('fs');var path=require(_0x463a('0x6'));var rimraf=require('rimraf');var config=require(_0x463a('0x7'));var attributes=require('./openchannelTransferReport.attributes');module['exports']=function(_0x4f7c8e,_0x443eb1){return _0x4f7c8e[_0x463a('0x8')](_0x463a('0x9'),attributes,{'tableName':_0x463a('0xa'),'paranoid':![],'indexes':[{'name':_0x463a('0xb'),'fields':[_0x463a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 61264de..a1d128d 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 _0xee10=['rpc','../../config/environment','jayson/promise','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x179b2c,_0x328626){var _0x982a85=function(_0x3a9e93){while(--_0x3a9e93){_0x179b2c['push'](_0x179b2c['shift']());}};_0x982a85(++_0x328626);}(_0xee10,0x66));var _0x0ee1=function(_0x429692,_0x13189d){_0x429692=_0x429692-0x0;var _0xc9a0a4=_0xee10[_0x429692];return _0xc9a0a4;};'use strict';var _=require(_0x0ee1('0x0'));var util=require('util');var moment=require(_0x0ee1('0x1'));var BPromise=require(_0x0ee1('0x2'));var rs=require(_0x0ee1('0x3'));var fs=require('fs');var Redis=require(_0x0ee1('0x4'));var db=require(_0x0ee1('0x5'))['db'];var utils=require(_0x0ee1('0x6'));var logger=require(_0x0ee1('0x7'))(_0x0ee1('0x8'));var config=require(_0x0ee1('0x9'));var jayson=require(_0x0ee1('0xa'));var client=jayson['client'][_0x0ee1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3edcc7,_0x494ef0,_0x20d244){return new BPromise(function(_0x4f6c84,_0xa373e6){return client[_0x0ee1('0xc')](_0x3edcc7,_0x20d244)[_0x0ee1('0xd')](function(_0x43d3f5){logger[_0x0ee1('0xe')](_0x0ee1('0xf'),_0x494ef0,_0x0ee1('0x10'));logger['debug'](_0x0ee1('0x11'),_0x494ef0,_0x0ee1('0x10'),JSON[_0x0ee1('0x12')](_0x43d3f5));if(_0x43d3f5[_0x0ee1('0x13')]){if(_0x43d3f5[_0x0ee1('0x13')]['code']===0x1f4){logger['error'](_0x0ee1('0xf'),_0x494ef0,_0x43d3f5[_0x0ee1('0x13')][_0x0ee1('0x14')]);return _0xa373e6(_0x43d3f5[_0x0ee1('0x13')][_0x0ee1('0x14')]);}logger[_0x0ee1('0x13')](_0x0ee1('0xf'),_0x494ef0,_0x43d3f5[_0x0ee1('0x13')][_0x0ee1('0x14')]);return _0x4f6c84(_0x43d3f5[_0x0ee1('0x13')][_0x0ee1('0x14')]);}else{logger[_0x0ee1('0xe')](_0x0ee1('0xf'),_0x494ef0,_0x0ee1('0x10'));_0x4f6c84(_0x43d3f5['result'][_0x0ee1('0x14')]);}})[_0x0ee1('0x15')](function(_0x4add07){logger[_0x0ee1('0x13')](_0x0ee1('0xf'),_0x494ef0,_0x4add07);_0xa373e6(_0x4add07);});});} \ No newline at end of file +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 diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 75ced9b..ea2560e 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 _0xcfad=['exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy'];(function(_0x5df5fa,_0x36ccac){var _0x513f68=function(_0x34505b){while(--_0x34505b){_0x5df5fa['push'](_0x5df5fa['shift']());}};_0x513f68(++_0x36ccac);}(_0xcfad,0xa1));var _0xdcfa=function(_0x4f1873,_0x35c3e1){_0x4f1873=_0x4f1873-0x0;var _0x19985c=_0xcfad[_0x4f1873];return _0x19985c;};'use strict';var multer=require(_0xdcfa('0x0'));var util=require(_0xdcfa('0x1'));var path=require(_0xdcfa('0x2'));var timeout=require('connect-timeout');var express=require(_0xdcfa('0x3'));var router=express[_0xdcfa('0x4')]();var auth=require(_0xdcfa('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdcfa('0x6'));var controller=require(_0xdcfa('0x7'));router[_0xdcfa('0x8')]('/',auth[_0xdcfa('0x9')](),controller[_0xdcfa('0xa')]);router[_0xdcfa('0x8')](_0xdcfa('0xb'),auth[_0xdcfa('0x9')](),controller[_0xdcfa('0xc')]);router[_0xdcfa('0xd')]('/',auth[_0xdcfa('0x9')](),controller[_0xdcfa('0xe')]);router[_0xdcfa('0xf')]('/:id',auth[_0xdcfa('0x9')](),controller[_0xdcfa('0x10')]);router[_0xdcfa('0x11')](_0xdcfa('0xb'),auth[_0xdcfa('0x9')](),controller[_0xdcfa('0x12')]);module[_0xdcfa('0x13')]=router; \ No newline at end of file +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 diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 43eb065..60e3b50 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 _0x0d5d=['name','STRING','exports'];(function(_0x344d26,_0x85649){var _0x53b837=function(_0xd8d880){while(--_0xd8d880){_0x344d26['push'](_0x344d26['shift']());}};_0x53b837(++_0x85649);}(_0x0d5d,0x125));var _0xd0d5=function(_0x175c66,_0x72f40e){_0x175c66=_0x175c66-0x0;var _0x135a23=_0x0d5d[_0x175c66];return _0x135a23;};'use strict';var Sequelize=require('sequelize');module[_0xd0d5('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xd0d5('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xd0d5('0x2')]}}; \ No newline at end of file +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 diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index ad2d383..d66ce29 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 _0xf549=['set','apply','reject','save','update','destroy','then','get','Pauses','UserProfileResource','end','stack','name','send','index','map','Pause','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','params','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit'];(function(_0x13f591,_0x7ea21){var _0x7591c1=function(_0x2fd789){while(--_0x2fd789){_0x13f591['push'](_0x13f591['shift']());}};_0x7591c1(++_0x7ea21);}(_0xf549,0x12a));var _0x9f54=function(_0x1096f3,_0x4a7d3d){_0x1096f3=_0x1096f3-0x0;var _0x15727d=_0xf549[_0x1096f3];return _0x15727d;};'use strict';var pdf=require(_0x9f54('0x0'));var emlformat=require(_0x9f54('0x1'));var rimraf=require(_0x9f54('0x2'));var zipdir=require(_0x9f54('0x3'));var jsonpatch=require(_0x9f54('0x4'));var rp=require('request-promise');var moment=require(_0x9f54('0x5'));var BPromise=require(_0x9f54('0x6'));var Mustache=require(_0x9f54('0x7'));var util=require(_0x9f54('0x8'));var path=require('path');var sox=require(_0x9f54('0x9'));var csv=require(_0x9f54('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9f54('0xb'));var jsforce=require(_0x9f54('0xc'));var deskjs=require(_0x9f54('0xd'));var toCsv=require(_0x9f54('0xa'));var querystring=require('querystring');var Papa=require(_0x9f54('0xe'));var Redis=require(_0x9f54('0xf'));var authService=require(_0x9f54('0x10'));var qs=require(_0x9f54('0x11'));var as=require(_0x9f54('0x12'));var hardwareService=require(_0x9f54('0x13'));var logger=require(_0x9f54('0x14'))(_0x9f54('0x15'));var utils=require(_0x9f54('0x16'));var config=require('../../config/environment');var db=require(_0x9f54('0x17'))['db'];function respondWithStatusCode(_0x5ae770,_0x249376){_0x249376=_0x249376||0xcc;return function(_0x2c69a1){if(_0x2c69a1){return _0x5ae770[_0x9f54('0x18')](_0x249376);}return _0x5ae770[_0x9f54('0x19')](_0x249376)['end']();};}function respondWithResult(_0x44dfb9,_0x171dd0){_0x171dd0=_0x171dd0||0xc8;return function(_0x5d1ae0){if(_0x5d1ae0){return _0x44dfb9['status'](_0x171dd0)[_0x9f54('0x1a')](_0x5d1ae0);}};}function respondWithFilteredResult(_0x112279,_0x362eeb){return function(_0x1c4939){if(_0x1c4939){var _0x19df5c=_0x1c4939[_0x9f54('0x1b')],_0x5ea81b=_0x362eeb[_0x9f54('0x1c')],_0x336509=_0x362eeb['offset']+_0x362eeb[_0x9f54('0x1d')],_0x4e35de;if(_0x336509>=_0x19df5c){_0x336509=_0x19df5c;_0x4e35de=0xc8;}else{_0x4e35de=0xce;}_0x112279[_0x9f54('0x19')](_0x4e35de);return _0x112279[_0x9f54('0x1e')]('Content-Range',_0x5ea81b+'-'+_0x336509+'/'+_0x19df5c)['json'](_0x1c4939);}return null;};}function patchUpdates(_0x296947){return function(_0x5d683b){try{jsonpatch[_0x9f54('0x1f')](_0x5d683b,_0x296947,!![]);}catch(_0x2cfdc2){return BPromise[_0x9f54('0x20')](_0x2cfdc2);}return _0x5d683b[_0x9f54('0x21')]();};}function saveUpdates(_0xb204cc,_0x29689a){return function(_0x161f19){if(_0x161f19){return _0x161f19[_0x9f54('0x22')](_0xb204cc)['then'](function(_0x3631f1){return _0x3631f1;});}return null;};}function removeEntity(_0x2c7740,_0x3baa2f){return function(_0xf38dcd){if(_0xf38dcd){return _0xf38dcd[_0x9f54('0x23')]()[_0x9f54('0x24')](function(){var _0x5cb179=_0xf38dcd[_0x9f54('0x25')]({'plain':!![]});var _0xee5b58=_0x9f54('0x26');return db[_0x9f54('0x27')][_0x9f54('0x23')]({'where':{'type':_0xee5b58,'resourceId':_0x5cb179['id']}})[_0x9f54('0x24')](function(){return _0xf38dcd;});})[_0x9f54('0x24')](function(){_0x2c7740[_0x9f54('0x19')](0xcc)[_0x9f54('0x28')]();});}};}function handleEntityNotFound(_0x5cd2f7,_0x1b20e2){return function(_0x15e2a4){if(!_0x15e2a4){_0x5cd2f7[_0x9f54('0x18')](0x194);}return _0x15e2a4;};}function handleError(_0x2270cd,_0x2ddb25){_0x2ddb25=_0x2ddb25||0x1f4;return function(_0x3d8e53){logger['error'](_0x3d8e53[_0x9f54('0x29')]);if(_0x3d8e53[_0x9f54('0x2a')]){delete _0x3d8e53['name'];}_0x2270cd[_0x9f54('0x19')](_0x2ddb25)[_0x9f54('0x2b')](_0x3d8e53);};}exports[_0x9f54('0x2c')]=function(_0x108ae3,_0x1f61bc){var _0x9c26a6={},_0x5f0aab={},_0x4a50c0={'count':0x0,'rows':[]};var _0x463c46=_[_0x9f54('0x2d')](db[_0x9f54('0x2e')][_0x9f54('0x2f')],function(_0x163535){return{'name':_0x163535['fieldName'],'type':_0x163535[_0x9f54('0x30')][_0x9f54('0x31')]};});_0x5f0aab[_0x9f54('0x32')]=_[_0x9f54('0x2d')](_0x463c46,_0x9f54('0x2a'));_0x5f0aab[_0x9f54('0x33')]=_[_0x9f54('0x34')](_0x108ae3[_0x9f54('0x33')]);_0x5f0aab[_0x9f54('0x35')]=_['intersection'](_0x5f0aab[_0x9f54('0x32')],_0x5f0aab['query']);_0x9c26a6[_0x9f54('0x36')]=_[_0x9f54('0x37')](_0x5f0aab[_0x9f54('0x32')],qs[_0x9f54('0x38')](_0x108ae3[_0x9f54('0x33')][_0x9f54('0x38')]));_0x9c26a6['attributes']=_0x9c26a6['attributes']['length']?_0x9c26a6[_0x9f54('0x36')]:_0x5f0aab[_0x9f54('0x32')];if(!_0x108ae3[_0x9f54('0x33')][_0x9f54('0x39')](_0x9f54('0x3a'))){_0x9c26a6[_0x9f54('0x1d')]=qs[_0x9f54('0x1d')](_0x108ae3[_0x9f54('0x33')][_0x9f54('0x1d')]);_0x9c26a6[_0x9f54('0x1c')]=qs['offset'](_0x108ae3[_0x9f54('0x33')][_0x9f54('0x1c')]);}_0x9c26a6[_0x9f54('0x3b')]=qs[_0x9f54('0x3c')](_0x108ae3[_0x9f54('0x33')]['sort']);_0x9c26a6[_0x9f54('0x3d')]=qs['filters'](_[_0x9f54('0x3e')](_0x108ae3[_0x9f54('0x33')],_0x5f0aab[_0x9f54('0x35')]));if(_0x108ae3['query'][_0x9f54('0x3f')]){_0x9c26a6[_0x9f54('0x3d')]=_[_0x9f54('0x40')](_0x9c26a6[_0x9f54('0x3d')],{'$or':_[_0x9f54('0x2d')](_0x463c46,function(_0x4b8e97){if(_0x4b8e97[_0x9f54('0x30')]!=='VIRTUAL'){var _0x515493={};_0x515493[_0x4b8e97['name']]={'$like':'%'+_0x108ae3['query'][_0x9f54('0x3f')]+'%'};return _0x515493;}})});}_0x9c26a6=_['merge']({},_0x9c26a6,_0x108ae3[_0x9f54('0x41')]);var _0x53afaa={'where':_0x9c26a6[_0x9f54('0x3d')]};return db[_0x9f54('0x2e')][_0x9f54('0x1b')](_0x53afaa)['then'](function(_0x1dee95){_0x4a50c0[_0x9f54('0x1b')]=_0x1dee95;if(_0x108ae3[_0x9f54('0x33')][_0x9f54('0x42')]){_0x9c26a6[_0x9f54('0x43')]=[{'all':!![]}];}return db[_0x9f54('0x2e')]['findAll'](_0x9c26a6);})['then'](function(_0x334e95){_0x4a50c0[_0x9f54('0x44')]=_0x334e95;return _0x4a50c0;})[_0x9f54('0x24')](respondWithFilteredResult(_0x1f61bc,_0x9c26a6))['catch'](handleError(_0x1f61bc,null));};exports[_0x9f54('0x45')]=function(_0x588f6e,_0x36eeea){var _0x996654={'raw':!![],'where':{'id':_0x588f6e[_0x9f54('0x46')]['id']}},_0x591267={};_0x591267[_0x9f54('0x32')]=_[_0x9f54('0x34')](db['Pause'][_0x9f54('0x2f')]);_0x591267[_0x9f54('0x33')]=_['keys'](_0x588f6e[_0x9f54('0x33')]);_0x591267[_0x9f54('0x35')]=_['intersection'](_0x591267[_0x9f54('0x32')],_0x591267[_0x9f54('0x33')]);_0x996654['attributes']=_[_0x9f54('0x37')](_0x591267[_0x9f54('0x32')],qs[_0x9f54('0x38')](_0x588f6e[_0x9f54('0x33')]['fields']));_0x996654[_0x9f54('0x36')]=_0x996654[_0x9f54('0x36')][_0x9f54('0x47')]?_0x996654[_0x9f54('0x36')]:_0x591267[_0x9f54('0x32')];if(_0x588f6e[_0x9f54('0x33')][_0x9f54('0x42')]){_0x996654['include']=[{'all':!![]}];}_0x996654=_[_0x9f54('0x40')]({},_0x996654,_0x588f6e[_0x9f54('0x41')]);return db[_0x9f54('0x2e')][_0x9f54('0x48')](_0x996654)[_0x9f54('0x24')](handleEntityNotFound(_0x36eeea,null))['then'](respondWithResult(_0x36eeea,null))[_0x9f54('0x49')](handleError(_0x36eeea,null));};exports['create']=function(_0x58590f,_0x2674ca){return db[_0x9f54('0x2e')][_0x9f54('0x4a')](_0x58590f[_0x9f54('0x4b')],{})[_0x9f54('0x24')](function(_0x2c7b68){var _0x54c76b=_0x58590f[_0x9f54('0x4c')][_0x9f54('0x25')]({'plain':!![]});if(!_0x54c76b)throw new Error(_0x9f54('0x4d'));if(_0x54c76b[_0x9f54('0x4e')]===_0x9f54('0x4c')){var _0x13a9e9=_0x2c7b68[_0x9f54('0x25')]({'plain':!![]});var _0x27eb37=_0x9f54('0x26');return db[_0x9f54('0x4f')]['find']({'where':{'name':_0x27eb37,'userProfileId':_0x54c76b[_0x9f54('0x50')]},'raw':!![]})[_0x9f54('0x24')](function(_0x313e30){if(_0x313e30&&_0x313e30[_0x9f54('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x13a9e9[_0x9f54('0x2a')],'resourceId':_0x13a9e9['id'],'type':_0x313e30['name'],'sectionId':_0x313e30['id']},{})[_0x9f54('0x24')](function(){return _0x2c7b68;});}else{return _0x2c7b68;}})[_0x9f54('0x49')](function(_0x5bf8b0){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5bf8b0);throw _0x5bf8b0;});}return _0x2c7b68;})[_0x9f54('0x24')](respondWithResult(_0x2674ca,0xc9))[_0x9f54('0x49')](handleError(_0x2674ca,null));};exports[_0x9f54('0x22')]=function(_0x40caaf,_0xd79a37){if(_0x40caaf['body']['id']){delete _0x40caaf[_0x9f54('0x4b')]['id'];}return db['Pause']['find']({'where':{'id':_0x40caaf['params']['id']}})[_0x9f54('0x24')](handleEntityNotFound(_0xd79a37,null))[_0x9f54('0x24')](saveUpdates(_0x40caaf[_0x9f54('0x4b')],null))[_0x9f54('0x24')](respondWithResult(_0xd79a37,null))[_0x9f54('0x49')](handleError(_0xd79a37,null));};exports[_0x9f54('0x23')]=function(_0x462a2b,_0xaf3b3b){return db[_0x9f54('0x2e')][_0x9f54('0x48')]({'where':{'id':_0x462a2b['params']['id']}})[_0x9f54('0x24')](handleEntityNotFound(_0xaf3b3b,null))[_0x9f54('0x24')](removeEntity(_0xaf3b3b,null))[_0x9f54('0x49')](handleError(_0xaf3b3b,null));}; \ No newline at end of file +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 diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 284dc24..dc635c9 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 _0xa866=['Pause','tools_pauses','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./pause.attributes','exports','define'];(function(_0x30cee8,_0x500c76){var _0x452dd9=function(_0x1e0c1b){while(--_0x1e0c1b){_0x30cee8['push'](_0x30cee8['shift']());}};_0x452dd9(++_0x500c76);}(_0xa866,0x6a));var _0x6a86=function(_0x5056fd,_0x3d682b){_0x5056fd=_0x5056fd-0x0;var _0x53e0c6=_0xa866[_0x5056fd];return _0x53e0c6;};'use strict';var _=require(_0x6a86('0x0'));var util=require(_0x6a86('0x1'));var logger=require(_0x6a86('0x2'))(_0x6a86('0x3'));var moment=require(_0x6a86('0x4'));var BPromise=require('bluebird');var rp=require(_0x6a86('0x5'));var fs=require('fs');var path=require(_0x6a86('0x6'));var rimraf=require(_0x6a86('0x7'));var config=require('../../config/environment');var attributes=require(_0x6a86('0x8'));module[_0x6a86('0x9')]=function(_0xac49a,_0x5e7673){return _0xac49a[_0x6a86('0xa')](_0x6a86('0xb'),attributes,{'tableName':_0x6a86('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 27346f9..a018ebb 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 _0x3552=['catch','Pause','find','options','raw','where','attributes','include','model','map','ShowPause','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x112b66,_0x3e4edf){var _0x39f112=function(_0x5dba00){while(--_0x5dba00){_0x112b66['push'](_0x112b66['shift']());}};_0x39f112(++_0x3e4edf);}(_0x3552,0xd7));var _0x2355=function(_0x6b9266,_0x2afdb1){_0x6b9266=_0x6b9266-0x0;var _0x1ad2c1=_0x3552[_0x6b9266];return _0x1ad2c1;};'use strict';var _=require(_0x2355('0x0'));var util=require(_0x2355('0x1'));var moment=require(_0x2355('0x2'));var BPromise=require(_0x2355('0x3'));var rs=require(_0x2355('0x4'));var fs=require('fs');var Redis=require(_0x2355('0x5'));var db=require(_0x2355('0x6'))['db'];var utils=require(_0x2355('0x7'));var logger=require(_0x2355('0x8'))(_0x2355('0x9'));var config=require(_0x2355('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x2355('0xb')][_0x2355('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xaa094c,_0xb91698,_0x8c12c){return new BPromise(function(_0x508159,_0x93e362){return client[_0x2355('0xd')](_0xaa094c,_0x8c12c)[_0x2355('0xe')](function(_0x4de6e9){logger[_0x2355('0xf')](_0x2355('0x10'),_0xb91698,_0x2355('0x11'));logger[_0x2355('0x12')](_0x2355('0x13'),_0xb91698,_0x2355('0x11'),JSON['stringify'](_0x4de6e9));if(_0x4de6e9['error']){if(_0x4de6e9[_0x2355('0x14')][_0x2355('0x15')]===0x1f4){logger[_0x2355('0x14')](_0x2355('0x10'),_0xb91698,_0x4de6e9[_0x2355('0x14')][_0x2355('0x16')]);return _0x93e362(_0x4de6e9[_0x2355('0x14')][_0x2355('0x16')]);}logger[_0x2355('0x14')](_0x2355('0x10'),_0xb91698,_0x4de6e9[_0x2355('0x14')]['message']);return _0x508159(_0x4de6e9[_0x2355('0x14')]['message']);}else{logger['info'](_0x2355('0x10'),_0xb91698,_0x2355('0x11'));_0x508159(_0x4de6e9['result'][_0x2355('0x16')]);}})[_0x2355('0x17')](function(_0x4aa8f3){logger[_0x2355('0x14')](_0x2355('0x10'),_0xb91698,_0x4aa8f3);_0x93e362(_0x4aa8f3);});});}exports['ShowPause']=function(_0x17d2be){var _0x542f1e=this;return new Promise(function(_0x11b230,_0x14b533){return db[_0x2355('0x18')][_0x2355('0x19')]({'raw':_0x17d2be[_0x2355('0x1a')]?_0x17d2be[_0x2355('0x1a')][_0x2355('0x1b')]===undefined?!![]:![]:!![],'where':_0x17d2be[_0x2355('0x1a')]?_0x17d2be['options'][_0x2355('0x1c')]||null:null,'attributes':_0x17d2be[_0x2355('0x1a')]?_0x17d2be[_0x2355('0x1a')][_0x2355('0x1d')]||null:null,'include':_0x17d2be[_0x2355('0x1a')]?_0x17d2be[_0x2355('0x1a')][_0x2355('0x1e')]?_['map'](_0x17d2be[_0x2355('0x1a')][_0x2355('0x1e')],function(_0x418cf4){return{'model':db[_0x418cf4[_0x2355('0x1f')]],'as':_0x418cf4['as'],'attributes':_0x418cf4[_0x2355('0x1d')],'include':_0x418cf4[_0x2355('0x1e')]?_['map'](_0x418cf4['include'],function(_0x22cdef){return{'model':db[_0x22cdef[_0x2355('0x1f')]],'as':_0x22cdef['as'],'attributes':_0x22cdef[_0x2355('0x1d')],'include':_0x22cdef['include']?_[_0x2355('0x20')](_0x22cdef[_0x2355('0x1e')],function(_0x51a049){return{'model':db[_0x51a049[_0x2355('0x1f')]],'as':_0x51a049['as'],'attributes':_0x51a049[_0x2355('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2355('0xe')](function(_0x1116d5){logger[_0x2355('0xf')](_0x2355('0x21'),_0x17d2be);logger[_0x2355('0x12')](_0x2355('0x21'),_0x17d2be,JSON['stringify'](_0x1116d5));_0x11b230(_0x1116d5);})[_0x2355('0x17')](function(_0xf2eafd){logger[_0x2355('0x14')](_0x2355('0x21'),_0xf2eafd[_0x2355('0x16')],_0x17d2be);_0x14b533(_0x542f1e[_0x2355('0x14')](0x1f4,_0xf2eafd[_0x2355('0x16')]));});});}; \ No newline at end of file +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 diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 62dcdc7..edf2c25 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 _0xc423=['path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','download','diskStorage','join','root','originalname','replace','format','basename','extname','now','single','file','post','webhookPost','put','/:id','update','delete','multer','util'];(function(_0x1d55d5,_0x364c20){var _0x10e287=function(_0x12efe1){while(--_0x12efe1){_0x1d55d5['push'](_0x1d55d5['shift']());}};_0x10e287(++_0x364c20);}(_0xc423,0x1cf));var _0x3c42=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xc423[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0x3c42('0x0'));var util=require(_0x3c42('0x1'));var path=require(_0x3c42('0x2'));var timeout=require(_0x3c42('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x3c42('0x4'));var interaction=require(_0x3c42('0x5'));var config=require(_0x3c42('0x6'));var controller=require(_0x3c42('0x7'));router[_0x3c42('0x8')]('/',auth[_0x3c42('0x9')](),controller[_0x3c42('0xa')]);router['get'](_0x3c42('0xb'),controller[_0x3c42('0xc')]);router[_0x3c42('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x3c42('0x8')]('/:id/download',auth[_0x3c42('0x9')](),controller[_0x3c42('0xd')]);var upload=multer({'storage':multer[_0x3c42('0xe')]({'destination':function(_0xc34f07,_0x1ca5de,_0x1c8a81){_0x1c8a81(null,path[_0x3c42('0xf')](config[_0x3c42('0x10')],'server/files/plugins'));},'filename':function(_0x21f6c0,_0x538080,_0x1b37e2){_0x538080[_0x3c42('0x11')]=_0x538080[_0x3c42('0x11')][_0x3c42('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1b37e2(null,util[_0x3c42('0x13')]('%s-%s%s',path[_0x3c42('0x14')](_0x538080['originalname'],path[_0x3c42('0x15')](_0x538080[_0x3c42('0x11')])),Date[_0x3c42('0x16')](),path[_0x3c42('0x15')](_0x538080[_0x3c42('0x11')])));}})});router['post']('/',upload[_0x3c42('0x17')](_0x3c42('0x18')),controller['upload']);router[_0x3c42('0x19')](_0x3c42('0xb'),controller[_0x3c42('0x1a')]);router[_0x3c42('0x1b')](_0x3c42('0x1c'),auth[_0x3c42('0x9')](),controller[_0x3c42('0x1d')]);router[_0x3c42('0x1e')](_0x3c42('0x1c'),auth[_0x3c42('0x9')](),controller['delete']);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index b7d1bf2..0ed7bd5 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 _0x0394=['always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','ENUM','html','TEXT','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly'];(function(_0x680903,_0x2a7511){var _0x394009=function(_0x441079){while(--_0x441079){_0x680903['push'](_0x680903['shift']());}};_0x394009(++_0x2a7511);}(_0x0394,0xc1));var _0x4039=function(_0x2441f5,_0x5d77c2){_0x2441f5=_0x2441f5-0x0;var _0x51ccc9=_0x0394[_0x2441f5];return _0x51ccc9;};'use strict';var Sequelize=require('sequelize');module[_0x4039('0x0')]={'name':{'type':Sequelize[_0x4039('0x1')]},'type':{'type':Sequelize[_0x4039('0x2')](_0x4039('0x3'),'script')},'description':{'type':Sequelize[_0x4039('0x4')]},'version':{'type':Sequelize[_0x4039('0x4')]},'path':{'type':Sequelize['STRING'],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x4039('0x5')},'sidebar':{'type':Sequelize[_0x4039('0x2')]('adminOnly',_0x4039('0x6'),_0x4039('0x7'),_0x4039('0x8')),'defaultValue':_0x4039('0x7'),'comment':_0x4039('0x9')},'icon':{'type':Sequelize[_0x4039('0x1')]},'adminUrl':{'type':Sequelize[_0x4039('0x1')]},'agentUrl':{'type':Sequelize[_0x4039('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x4039('0x1')]}}; \ No newline at end of file +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 diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 230aeb0..0dc100a 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 _0x97c1=['./plugin.socket','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Plugins','UserProfileResource','sendStatus','error','stack','name','send','index','map','Plugin','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','**/*','join','dirname','finalize','existsSync','download','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','upload','filename','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','length','some','manifest.json','Plugin\x20manifest\x20missing','parse','undefined','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','scriptName','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','headers','content-length','content-type','endsWith','statusCode','webhookPost','method','%s%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter'];(function(_0x4c10fe,_0x19e0b2){var _0x5d4ffe=function(_0x219ac8){while(--_0x219ac8){_0x4c10fe['push'](_0x4c10fe['shift']());}};_0x5d4ffe(++_0x19e0b2);}(_0x97c1,0x91));var _0x197c=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x97c1[_0x4565bf];return _0x5610ba;};'use strict';var pdf=require(_0x197c('0x0'));var emlformat=require(_0x197c('0x1'));var rimraf=require(_0x197c('0x2'));var zipdir=require(_0x197c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x197c('0x4'));var moment=require(_0x197c('0x5'));var BPromise=require(_0x197c('0x6'));var Mustache=require(_0x197c('0x7'));var util=require(_0x197c('0x8'));var path=require(_0x197c('0x9'));var sox=require(_0x197c('0xa'));var csv=require('to-csv');var ejs=require(_0x197c('0xb'));var fs=require('fs');var _=require(_0x197c('0xc'));var squel=require(_0x197c('0xd'));var crypto=require('crypto');var jsforce=require(_0x197c('0xe'));var deskjs=require(_0x197c('0xf'));var toCsv=require(_0x197c('0x10'));var querystring=require(_0x197c('0x11'));var Papa=require(_0x197c('0x12'));var extract=require(_0x197c('0x13'));var rimraf=require(_0x197c('0x2'));var archiver=require('archiver');var Redis=require(_0x197c('0x14'));var authService=require(_0x197c('0x15'));var qs=require(_0x197c('0x16'));var as=require(_0x197c('0x17'));var hardwareService=require(_0x197c('0x18'));var logger=require(_0x197c('0x19'))('api');var utils=require(_0x197c('0x1a'));var config=require(_0x197c('0x1b'));var db=require(_0x197c('0x1c'))['db'];config['redis']=_[_0x197c('0x1d')](config[_0x197c('0x1e')],{'host':_0x197c('0x1f'),'port':0x18eb});var socket=require(_0x197c('0x20'))(new Redis(config[_0x197c('0x1e')]));require(_0x197c('0x21'))['register'](socket);function respondWithStatusCode(_0xfbb558,_0x13f1d8){_0x13f1d8=_0x13f1d8||0xcc;return function(_0x282399){if(_0x282399){return _0xfbb558['sendStatus'](_0x13f1d8);}return _0xfbb558[_0x197c('0x22')](_0x13f1d8)[_0x197c('0x23')]();};}function respondWithResult(_0x3e8d5f,_0x6ede7c){_0x6ede7c=_0x6ede7c||0xc8;return function(_0x254ed7){if(_0x254ed7){return _0x3e8d5f[_0x197c('0x22')](_0x6ede7c)[_0x197c('0x24')](_0x254ed7);}};}function respondWithFilteredResult(_0x44f1ea,_0x2f4641){return function(_0x3452d7){if(_0x3452d7){var _0xd29401=_0x3452d7[_0x197c('0x25')],_0x6d9fa5=_0x2f4641[_0x197c('0x26')],_0x5e2ff2=_0x2f4641[_0x197c('0x26')]+_0x2f4641['limit'],_0x5bcf5d;if(_0x5e2ff2>=_0xd29401){_0x5e2ff2=_0xd29401;_0x5bcf5d=0xc8;}else{_0x5bcf5d=0xce;}_0x44f1ea[_0x197c('0x22')](_0x5bcf5d);return _0x44f1ea[_0x197c('0x27')](_0x197c('0x28'),_0x6d9fa5+'-'+_0x5e2ff2+'/'+_0xd29401)[_0x197c('0x24')](_0x3452d7);}return null;};}function patchUpdates(_0x46db8e){return function(_0x3624c8){try{jsonpatch[_0x197c('0x29')](_0x3624c8,_0x46db8e,!![]);}catch(_0x37fee){return BPromise[_0x197c('0x2a')](_0x37fee);}return _0x3624c8[_0x197c('0x2b')]();};}function saveUpdates(_0x5625bb,_0x2e1d34){return function(_0x1d82d0){if(_0x1d82d0){return _0x1d82d0[_0x197c('0x2c')](_0x5625bb)[_0x197c('0x2d')](function(_0x4cad6d){return _0x4cad6d;});}return null;};}function removeEntity(_0x447d86,_0x2a0aba){return function(_0x4baa57){if(_0x4baa57){return _0x4baa57[_0x197c('0x2e')]()[_0x197c('0x2d')](function(){var _0x385055=_0x4baa57[_0x197c('0x2f')]({'plain':!![]});var _0x56d5a5=_0x197c('0x30');return db[_0x197c('0x31')][_0x197c('0x2e')]({'where':{'type':_0x56d5a5,'resourceId':_0x385055['id']}})[_0x197c('0x2d')](function(){return _0x4baa57;});})['then'](function(){_0x447d86[_0x197c('0x22')](0xcc)[_0x197c('0x23')]();});}};}function handleEntityNotFound(_0x574595,_0x17e38b){return function(_0x3ba870){if(!_0x3ba870){_0x574595[_0x197c('0x32')](0x194);}return _0x3ba870;};}function handleError(_0x4ef7d1,_0x1c66fd){_0x1c66fd=_0x1c66fd||0x1f4;return function(_0xd54770){logger[_0x197c('0x33')](_0xd54770[_0x197c('0x34')]);if(_0xd54770[_0x197c('0x35')]){delete _0xd54770[_0x197c('0x35')];}_0x4ef7d1[_0x197c('0x22')](_0x1c66fd)[_0x197c('0x36')](_0xd54770);};}exports[_0x197c('0x37')]=function(_0x2d2413,_0x1d417){var _0x40121d={},_0x38cb27={},_0xfb0292={'count':0x0,'rows':[]};var _0x47098d=_[_0x197c('0x38')](db[_0x197c('0x39')][_0x197c('0x3a')],function(_0x419849){return{'name':_0x419849['fieldName'],'type':_0x419849[_0x197c('0x3b')][_0x197c('0x3c')]};});_0x38cb27['model']=_[_0x197c('0x38')](_0x47098d,_0x197c('0x35'));_0x38cb27[_0x197c('0x3d')]=_['keys'](_0x2d2413[_0x197c('0x3d')]);_0x38cb27[_0x197c('0x3e')]=_[_0x197c('0x3f')](_0x38cb27[_0x197c('0x40')],_0x38cb27[_0x197c('0x3d')]);_0x40121d[_0x197c('0x41')]=_[_0x197c('0x3f')](_0x38cb27[_0x197c('0x40')],qs[_0x197c('0x42')](_0x2d2413['query'][_0x197c('0x42')]));_0x40121d[_0x197c('0x41')]=_0x40121d[_0x197c('0x41')]['length']?_0x40121d[_0x197c('0x41')]:_0x38cb27[_0x197c('0x40')];if(!_0x2d2413[_0x197c('0x3d')][_0x197c('0x43')](_0x197c('0x44'))){_0x40121d[_0x197c('0x45')]=qs[_0x197c('0x45')](_0x2d2413[_0x197c('0x3d')][_0x197c('0x45')]);_0x40121d[_0x197c('0x26')]=qs[_0x197c('0x26')](_0x2d2413[_0x197c('0x3d')][_0x197c('0x26')]);}_0x40121d[_0x197c('0x46')]=qs[_0x197c('0x47')](_0x2d2413['query'][_0x197c('0x47')]);_0x40121d[_0x197c('0x48')]=qs[_0x197c('0x3e')](_[_0x197c('0x49')](_0x2d2413[_0x197c('0x3d')],_0x38cb27[_0x197c('0x3e')]));if(_0x2d2413[_0x197c('0x3d')][_0x197c('0x4a')]){_0x40121d[_0x197c('0x48')]=_[_0x197c('0x4b')](_0x40121d[_0x197c('0x48')],{'$or':_[_0x197c('0x38')](_0x47098d,function(_0x912f9a){if(_0x912f9a['type']!==_0x197c('0x4c')){var _0x29fc16={};_0x29fc16[_0x912f9a[_0x197c('0x35')]]={'$like':'%'+_0x2d2413['query']['filter']+'%'};return _0x29fc16;}})});}_0x40121d=_['merge']({},_0x40121d,_0x2d2413[_0x197c('0x4d')]);var _0x1672cd={'where':_0x40121d[_0x197c('0x48')]};return db['Plugin'][_0x197c('0x25')](_0x1672cd)['then'](function(_0x23ad4e){_0xfb0292[_0x197c('0x25')]=_0x23ad4e;if(_0x2d2413[_0x197c('0x3d')][_0x197c('0x4e')]){_0x40121d[_0x197c('0x4f')]=[{'all':!![]}];}return db[_0x197c('0x39')][_0x197c('0x50')](_0x40121d);})[_0x197c('0x2d')](function(_0x2775ef){_0xfb0292[_0x197c('0x51')]=_0x2775ef;return _0xfb0292;})['then'](respondWithFilteredResult(_0x1d417,_0x40121d))['catch'](handleError(_0x1d417,null));};exports[_0x197c('0x52')]=function(_0x3c0c6b,_0x52edb2){var _0x414fd6={'raw':!![],'where':{'id':_0x3c0c6b[_0x197c('0x53')]['id']}},_0x957157={};_0x957157[_0x197c('0x40')]=_['keys'](db[_0x197c('0x39')][_0x197c('0x3a')]);_0x957157['query']=_[_0x197c('0x54')](_0x3c0c6b['query']);_0x957157[_0x197c('0x3e')]=_['intersection'](_0x957157[_0x197c('0x40')],_0x957157[_0x197c('0x3d')]);_0x414fd6['attributes']=_[_0x197c('0x3f')](_0x957157['model'],qs[_0x197c('0x42')](_0x3c0c6b[_0x197c('0x3d')][_0x197c('0x42')]));_0x414fd6[_0x197c('0x41')]=_0x414fd6[_0x197c('0x41')]['length']?_0x414fd6[_0x197c('0x41')]:_0x957157[_0x197c('0x40')];if(_0x3c0c6b[_0x197c('0x3d')][_0x197c('0x4e')]){_0x414fd6[_0x197c('0x4f')]=[{'all':!![]}];}_0x414fd6=_[_0x197c('0x4b')]({},_0x414fd6,_0x3c0c6b[_0x197c('0x4d')]);return db[_0x197c('0x39')][_0x197c('0x55')](_0x414fd6)[_0x197c('0x2d')](handleEntityNotFound(_0x52edb2,null))[_0x197c('0x2d')](respondWithResult(_0x52edb2,null))[_0x197c('0x56')](handleError(_0x52edb2,null));};exports['download']=function(_0x4b5871,_0x2ec92a,_0x4ebd4e){return db[_0x197c('0x39')][_0x197c('0x55')]({'where':{'id':_0x4b5871[_0x197c('0x53')]['id']},'attributes':[_0x197c('0x35'),_0x197c('0x9')],'raw':!![]})[_0x197c('0x2d')](handleEntityNotFound(_0x2ec92a,null))[_0x197c('0x2d')](function(_0x15827b){if(_0x15827b){var _0x396a31=path['join'](config[_0x197c('0x57')],_0x197c('0x58'),util[_0x197c('0x59')](_0x197c('0x5a'),path[_0x197c('0x5b')](_0x15827b['path'])));var _0x63d811=fs[_0x197c('0x5c')](_0x396a31);var _0x60b62f=archiver(_0x197c('0x5d'),{'zlib':{'level':0x9}});_0x60b62f['on'](_0x197c('0x5e'),function(_0x5aa2b5){if(_0x5aa2b5[_0x197c('0x5f')]===_0x197c('0x60')){logger[_0x197c('0x33')](_0x5aa2b5);}else{throw new db[(_0x197c('0x61'))][(_0x197c('0x62'))](_0x197c('0x63'));}});_0x60b62f['on'](_0x197c('0x33'),function(_0x14a662){throw new db[(_0x197c('0x61'))]['Error'](_0x197c('0x63'));});_0x60b62f['pipe'](_0x63d811);_0x60b62f['glob'](_0x197c('0x64'),{'cwd':path[_0x197c('0x65')](config['root'],_0x197c('0x58'),path[_0x197c('0x66')](_0x15827b[_0x197c('0x9')])),'ignore':[path[_0x197c('0x65')](path[_0x197c('0x5b')](_0x15827b[_0x197c('0x9')]),'node_modules/**/*'),path['join'](path['basename'](_0x15827b[_0x197c('0x9')]),'attachments/**/*')],'nodir':!![]})[_0x197c('0x67')]();_0x63d811['on']('close',function(){if(!fs[_0x197c('0x68')](_0x396a31)){throw new db[(_0x197c('0x61'))][(_0x197c('0x62'))]('Plugin\x20not\x20found');}return _0x2ec92a[_0x197c('0x69')](_0x396a31,util[_0x197c('0x59')](_0x197c('0x5a'),path[_0x197c('0x5b')](_0x15827b[_0x197c('0x9')])),function(_0x1ca33f){if(_0x1ca33f){throw new db[(_0x197c('0x61'))][(_0x197c('0x62'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x197c('0x6a')](_0x396a31);logger['info'](_0x197c('0x6b'));logger[_0x197c('0x6c')](_0x197c('0x6d'));});});}return null;})['catch'](handleError(_0x2ec92a,null));};exports[_0x197c('0x6e')]=function(_0xaffc6b,_0x2666d1,_0x1c91cd){var _0x2b439b=path[_0x197c('0x5b')](_0xaffc6b['file'][_0x197c('0x6f')],path['extname'](_0xaffc6b[_0x197c('0x70')]['filename']));var _0x246f92=path[_0x197c('0x65')](config['root'],_0x197c('0x58'),_0xaffc6b[_0x197c('0x70')][_0x197c('0x6f')]);var _0x29b44b=path[_0x197c('0x65')](config[_0x197c('0x57')],_0x197c('0x58'),_0x2b439b);logger[_0x197c('0x6c')](_0x197c('0x71'),_0x246f92);logger[_0x197c('0x6c')](_0x197c('0x72'),_0x29b44b);try{fs['chmodSync'](_0x246f92,parseInt(_0x197c('0x73'),0x8));extract(_0x246f92,{'dir':_0x29b44b},function(_0x566c45){if(_0x566c45){logger['error'](_0x566c45);handleError(_0x566c45,!![]);};var _0x445835=fs[_0x197c('0x74')](_0x29b44b);if(_0x445835['length']>0x1){removeReferences(_0x246f92,_0x29b44b);logger['error'](_0x197c('0x75'));return _0x1c91cd(new Error(_0x197c('0x75')));}var _0x3bd32d=fs[_0x197c('0x76')](path[_0x197c('0x65')](_0x29b44b,_0x445835[0x0]));if(_0x3bd32d[_0x197c('0x77')]()){removeReferences(_0x246f92,_0x29b44b);logger[_0x197c('0x33')]('Invalid\x20plugin\x20structure');return _0x1c91cd(new Error(_0x197c('0x75')));}if(_0x3bd32d[_0x197c('0x78')]()){var _0x57b77c=fs['readdirSync'](path[_0x197c('0x65')](_0x29b44b,_0x445835[0x0]));if(_0x57b77c[_0x197c('0x79')]===0x0){removeReferences(_0x246f92,_0x29b44b);logger[_0x197c('0x33')](_0x197c('0x75'));return _0x1c91cd(new Error(_0x197c('0x75')));}var _0x352b6c=_0x57b77c[_0x197c('0x7a')](function(_0x11511e){return _0x11511e===_0x197c('0x7b');});if(!_0x352b6c){return _0x1c91cd(new Error(_0x197c('0x7c')));}var _0x44c9cc=fs['readFileSync'](path[_0x197c('0x65')](_0x29b44b,_0x445835[0x0],_0x197c('0x7b')));var _0x4b40e2=JSON[_0x197c('0x7d')](_0x44c9cc);if(_0x197c('0x7e')==typeof _0x4b40e2[_0x197c('0x35')]){return _0x1c91cd(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x197c('0x7e')==typeof _0x4b40e2[_0x197c('0x3b')]){return _0x1c91cd(new Error(_0x197c('0x7f')));}if('undefined'==typeof _0x4b40e2[_0x197c('0x80')]){return _0x1c91cd(new Error(_0x197c('0x81')));}if('undefined'==typeof _0x4b40e2[_0x197c('0x82')]){return _0x1c91cd(new Error(_0x197c('0x83')));}if(_0x4b40e2[_0x197c('0x3b')]===_0x197c('0x84')){if(_0x197c('0x7e')==typeof _0x4b40e2[_0x197c('0x82')]['views']){return _0x1c91cd(new Error(_0x197c('0x85')));}if(_0x197c('0x7e')==typeof _0x4b40e2['parameters'][_0x197c('0x86')][_0x197c('0x87')]&&_0x197c('0x7e')==typeof _0x4b40e2[_0x197c('0x82')][_0x197c('0x86')][_0x197c('0x88')]){return _0x1c91cd(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x4b40e2[_0x197c('0x3b')]===_0x197c('0x89')){if('undefined'==typeof _0x4b40e2['parameters']['scriptName']){return _0x1c91cd(new Error(_0x197c('0x8a')));}if('undefined'==typeof _0x4b40e2['parameters'][_0x197c('0x8b')]){return _0x1c91cd(new Error(_0x197c('0x8c')));}}else{return _0x1c91cd(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0xb44dde=_0x4b40e2['name'];var _0xe16498=_0x4b40e2[_0x197c('0x8d')];var _0x173c9e=_0x4b40e2[_0x197c('0x3b')];var _0x1250af=_0x4b40e2[_0x197c('0x8e')]?_0x4b40e2[_0x197c('0x8e')]:_0x197c('0x8f');var _0x2d8364=_0x4b40e2[_0x197c('0x90')]?_0x4b40e2['icon']:_0x197c('0x91');var _0x33eec6='';var _0x2cd8cb='';var _0x22700a='';var _0x59332b='';var _0x553c16=_0x4b40e2['version'];if(_0x173c9e==='html'){if(_0x197c('0x7e')!=typeof _0x4b40e2[_0x197c('0x82')]['views'][_0x197c('0x87')]){var _0x3c85a3=_0x4b40e2[_0x197c('0x82')][_0x197c('0x86')][_0x197c('0x87')];if(!/^(f|ht)tps?:\/\//i[_0x197c('0x92')](_0x3c85a3)){_0x33eec6=path[_0x197c('0x65')](_0x197c('0x93'),_0x2b439b,_0x445835[0x0],_0x3c85a3);}else{_0x33eec6=_0x3c85a3;}}else{logger['info'](_0x197c('0x94'));}if(_0x197c('0x7e')!=typeof _0x4b40e2[_0x197c('0x82')][_0x197c('0x86')][_0x197c('0x88')]){var _0x38350a=_0x4b40e2[_0x197c('0x82')][_0x197c('0x86')][_0x197c('0x88')];if(!/^(f|ht)tps?:\/\//i['test'](_0x38350a)){_0x2cd8cb=path[_0x197c('0x65')](_0x197c('0x93'),_0x2b439b,_0x445835[0x0],_0x38350a);}else{_0x2cd8cb=_0x38350a;}}else{logger[_0x197c('0x6c')](_0x197c('0x95'));}}else if(_0x173c9e===_0x197c('0x89')){_0x22700a=_0x4b40e2['parameters'][_0x197c('0x96')];_0x59332b=_0x4b40e2['parameters']['scriptPath'];if(_0x197c('0x7e')!=typeof _0x4b40e2['parameters'][_0x197c('0x86')]){if('undefined'!=typeof _0x4b40e2[_0x197c('0x82')]['views'][_0x197c('0x87')]){var _0x3c85a3=_0x4b40e2[_0x197c('0x82')][_0x197c('0x86')][_0x197c('0x87')];if(!/^(f|ht)tps?:\/\//i[_0x197c('0x92')](_0x3c85a3)){_0x33eec6=path[_0x197c('0x65')](_0x197c('0x93'),_0x2b439b,_0x445835[0x0],_0x3c85a3);}else{_0x33eec6=_0x3c85a3;}}if(_0x197c('0x7e')!=typeof _0x4b40e2[_0x197c('0x82')]['views'][_0x197c('0x88')]){var _0x38350a=_0x4b40e2['parameters'][_0x197c('0x86')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x197c('0x92')](_0x38350a)){_0x2cd8cb=path[_0x197c('0x65')](_0x197c('0x93'),_0x2b439b,_0x445835[0x0],_0x38350a);}else{_0x2cd8cb=_0x38350a;}}}}var _0x4d4abb={'name':_0xb44dde,'description':_0xe16498,'path':path[_0x197c('0x65')](_0x2b439b,_0x445835[0x0]),'type':_0x173c9e,'sidebar':_0x1250af,'icon':_0x2d8364,'adminUrl':_0x33eec6,'agentUrl':_0x2cd8cb,'scriptName':_0x22700a,'scriptPath':_0x59332b,'version':_0x553c16};removeReferences(_0x246f92,null);return db[_0x197c('0x39')][_0x197c('0x97')](_0x4d4abb)[_0x197c('0x2d')](function(_0x314cb2){var _0x23d251={'role':_0xaffc6b[_0x197c('0x98')][_0x197c('0x99')],'userProfileId':_0xaffc6b[_0x197c('0x98')]['userProfileId']};if(!_0x23d251)throw new Error(_0x197c('0x9a'));if(_0x23d251['role']===_0x197c('0x9b')){var _0x1c5513=_0x314cb2[_0x197c('0x2f')]({'plain':!![]});return db[_0x197c('0x9c')][_0x197c('0x55')]({'where':{'name':_0x197c('0x30'),'userProfileId':_0x23d251['userProfileId']},'raw':!![]})[_0x197c('0x2d')](function(_0x4989d7){if(_0x4989d7&&_0x4989d7[_0x197c('0x9d')]===0x0){return db['UserProfileResource'][_0x197c('0x97')]({'name':_0x1c5513['name'],'resourceId':_0x1c5513['id'],'type':_0x4989d7[_0x197c('0x35')],'sectionId':_0x4989d7['id']},{})[_0x197c('0x2d')](function(){return _0x314cb2;});}else{return _0x314cb2;}})[_0x197c('0x56')](function(_0x1119f6){logger['error'](_0x197c('0x9e'),_0x1119f6);throw _0x1119f6;});}return _0x314cb2;})[_0x197c('0x2d')](respondWithResult(_0x2666d1,null))[_0x197c('0x56')](handleError(_0x2666d1,null));}});}catch(_0xa8a533){_0x2666d1[_0x197c('0x22')](0x1f4)[_0x197c('0x36')](_0xa8a533);}};function removeReferences(_0x573d2a,_0x56adcd){try{if(_0x573d2a){fs[_0x197c('0x6a')](_0x573d2a);logger[_0x197c('0x6c')](_0x197c('0x9f'));}if(_0x56adcd){rimraf(_0x56adcd,function(){});logger[_0x197c('0x6c')](_0x197c('0xa0'));}}catch(_0x1010fb){logger[_0x197c('0x33')](_0x1010fb);}}exports[_0x197c('0x2c')]=function(_0x6c7bde,_0x316484,_0x164a62){return db[_0x197c('0x39')][_0x197c('0x55')]({'where':{'id':_0x6c7bde['params']['id']}})[_0x197c('0x2d')](handleEntityNotFound(_0x316484,null))[_0x197c('0x2d')](saveUpdates(_0x6c7bde[_0x197c('0x98')],null))[_0x197c('0x2d')](respondWithResult(_0x316484,null))['catch'](handleError(_0x316484,null));};exports[_0x197c('0xa1')]=function(_0x9048ff,_0x41673c,_0x474f55){return db[_0x197c('0x39')][_0x197c('0x55')]({'where':{'id':_0x9048ff[_0x197c('0x53')]['id']}})[_0x197c('0x2d')](function(_0x20e065){if(_0x20e065){return _0x20e065['destroy']();}})[_0x197c('0x2d')](function(_0x34dcde){rimraf(path[_0x197c('0x65')](config[_0x197c('0x57')],_0x197c('0x58'),path[_0x197c('0x66')](_0x34dcde[_0x197c('0x9')])),function(){});return _0x34dcde;})[_0x197c('0x2d')](handleEntityNotFound(_0x41673c,null))[_0x197c('0x2d')](respondWithStatusCode(_0x41673c,null))['catch'](handleError(_0x41673c,null));};exports[_0x197c('0xa2')]=function(_0x5862d0,_0xbe8939,_0x3f1d0a){return BPromise[_0x197c('0xa3')]()[_0x197c('0x2d')](function(){if(!_0x5862d0[_0x197c('0x3d')][_0x197c('0x9')]){throw new Error(_0x197c('0xa4'));}if(!_0x5862d0['query'][_0x197c('0xa5')]){throw new Error(_0x197c('0xa6'));}var _0x4449d1=_0x5862d0[_0x197c('0x3d')][_0x197c('0xa7')]?_0x5862d0[_0x197c('0x3d')][_0x197c('0xa7')]+':'+_0x5862d0[_0x197c('0x3d')][_0x197c('0xa5')]:_0x197c('0xa8')+_0x5862d0[_0x197c('0x3d')][_0x197c('0xa5')];var _0x5824be=_0x5862d0[_0x197c('0x3d')][_0x197c('0x24')]?_0x5862d0[_0x197c('0x3d')][_0x197c('0x24')]:!![];var _0x3bef5b=_0x5862d0['query']['encoding']?_0x5862d0[_0x197c('0x3d')][_0x197c('0xa9')]:null;var _0x1cf154={'method':_0x5862d0['method'],'uri':util['format']('%s%s',_0x4449d1,_0x5862d0[_0x197c('0x3d')]['path']),'json':_0x5824be,'resolveWithFullResponse':!![],'encoding':_0x3bef5b,'qs':_0x5862d0[_0x197c('0x3d')]};if(_0x5862d0[_0x197c('0xaa')]){_0x1cf154['headers']=_0x5862d0[_0x197c('0xaa')];if(_0x1cf154[_0x197c('0xaa')][_0x197c('0xab')]){delete _0x1cf154[_0x197c('0xaa')][_0x197c('0xab')];}}if(_0x1cf154[_0x197c('0xaa')][_0x197c('0xac')]){delete _0x1cf154['headers']['content-type'];}return rp(_0x1cf154);})[_0x197c('0x2d')](function(_0x53e6c5){if(_0x53e6c5){_0xbe8939['set'](_0x53e6c5['headers']);logger[_0x197c('0x6c')](_0x53e6c5[_0x197c('0x98')]);if(_[_0x197c('0xad')](_0x5862d0[_0x197c('0x3d')][_0x197c('0x9')],_0x197c('0x69'))&&_0x53e6c5[_0x197c('0xae')]==0x1f4){return _0xbe8939['sendStatus'](_0x53e6c5['statusCode']);}else{return _0xbe8939[_0x197c('0x22')](_0x53e6c5[_0x197c('0xae')])['send'](_0x53e6c5[_0x197c('0x98')]);}}else{return _0xbe8939[_0x197c('0x32')](0xc8);}})[_0x197c('0x56')](handleError(_0xbe8939,null));};exports[_0x197c('0xaf')]=function(_0x5b36c6,_0x4acf2c,_0x177df5){return BPromise[_0x197c('0xa3')]()['then'](function(){if(!_0x5b36c6[_0x197c('0x3d')][_0x197c('0x9')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x5b36c6[_0x197c('0x3d')][_0x197c('0xa5')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x1e02e0=_0x5b36c6[_0x197c('0x3d')][_0x197c('0xa7')]?_0x5b36c6[_0x197c('0x3d')]['hostname']+':'+_0x5b36c6['query'][_0x197c('0xa5')]:'http://localhost:'+_0x5b36c6['query'][_0x197c('0xa5')];var _0x5ed643=_0x5b36c6[_0x197c('0x3d')][_0x197c('0x24')]?_0x5b36c6[_0x197c('0x3d')][_0x197c('0x24')]:!![];var _0x332e95=_0x5b36c6[_0x197c('0x3d')][_0x197c('0xa9')]?_0x5b36c6[_0x197c('0x3d')][_0x197c('0xa9')]:null;var _0x4d6e2f={'method':_0x5b36c6[_0x197c('0xb0')],'uri':util['format'](_0x197c('0xb1'),_0x1e02e0,_0x5b36c6[_0x197c('0x3d')][_0x197c('0x9')]),'json':_0x5ed643,'resolveWithFullResponse':!![],'encoding':_0x332e95,'body':_0x5b36c6['body']};if(_0x5b36c6['headers']){_0x4d6e2f[_0x197c('0xaa')]=_0x5b36c6[_0x197c('0xaa')];if(_0x4d6e2f[_0x197c('0xaa')]['content-length']){delete _0x4d6e2f[_0x197c('0xaa')][_0x197c('0xab')];}}if(_0x4d6e2f[_0x197c('0xaa')][_0x197c('0xac')]){delete _0x4d6e2f[_0x197c('0xaa')][_0x197c('0xac')];}return rp(_0x4d6e2f);})[_0x197c('0x2d')](function(_0x2cdf5a){if(_0x2cdf5a){_0x4acf2c['set'](_0x2cdf5a[_0x197c('0xaa')]);logger['info'](_0x2cdf5a[_0x197c('0x98')]);return _0x4acf2c[_0x197c('0x22')](_0x2cdf5a['statusCode'])[_0x197c('0x36')](_0x2cdf5a[_0x197c('0x98')]);}else{return _0x4acf2c[_0x197c('0x32')](0xc8);}})[_0x197c('0x56')](handleError(_0x4acf2c,null));}; \ No newline at end of file +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 diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index ada8c33..ed57607 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 _0x430c=['update','emit','hasOwnProperty','exports','events','setMaxListeners','save'];(function(_0x1a93cb,_0x1232f5){var _0x22dd8d=function(_0x41dfbe){while(--_0x41dfbe){_0x1a93cb['push'](_0x1a93cb['shift']());}};_0x22dd8d(++_0x1232f5);}(_0x430c,0x1a1));var _0xc430=function(_0x173113,_0x316a7c){_0x173113=_0x173113-0x0;var _0x3bea89=_0x430c[_0x173113];return _0x3bea89;};'use strict';var EventEmitter=require(_0xc430('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0xc430('0x1')](0x0);var events={'afterCreate':_0xc430('0x2'),'afterUpdate':_0xc430('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4f0118){return function(_0x5ccda6,_0x47d8b9,_0x338a82){PluginEvents[_0xc430('0x4')](_0x4f0118+':'+_0x5ccda6['id'],_0x5ccda6);PluginEvents['emit'](_0x4f0118,_0x5ccda6);_0x338a82(null);};}for(var e in events){if(events[_0xc430('0x5')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xc430('0x6')]=PluginEvents; \ No newline at end of file +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 diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 58b47d0..a349b44 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 _0x00bb=['util','../../config/logger','moment','request-promise','path','../../config/environment','./plugin.attributes','define','Plugin','plugins','lodash'];(function(_0x206a5c,_0x3a89b2){var _0x1c956f=function(_0x2aa6bb){while(--_0x2aa6bb){_0x206a5c['push'](_0x206a5c['shift']());}};_0x1c956f(++_0x3a89b2);}(_0x00bb,0x1d8));var _0xb00b=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x00bb[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var logger=require(_0xb00b('0x2'))('api');var moment=require(_0xb00b('0x3'));var BPromise=require('bluebird');var rp=require(_0xb00b('0x4'));var fs=require('fs');var path=require(_0xb00b('0x5'));var rimraf=require('rimraf');var config=require(_0xb00b('0x6'));var attributes=require(_0xb00b('0x7'));module['exports']=function(_0x574cf8,_0x532ffb){return _0x574cf8[_0xb00b('0x8')](_0xb00b('0x9'),attributes,{'tableName':_0xb00b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index d69bb8f..dd52023 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 _0xb746=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','Plugin','create','body','options','raw','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x727aeb,_0x349d86){var _0x35b0f4=function(_0x179e61){while(--_0x179e61){_0x727aeb['push'](_0x727aeb['shift']());}};_0x35b0f4(++_0x349d86);}(_0xb746,0x1e5));var _0x6b74=function(_0x1eb905,_0x34d994){_0x1eb905=_0x1eb905-0x0;var _0x10701b=_0xb746[_0x1eb905];return _0x10701b;};'use strict';var _=require(_0x6b74('0x0'));var util=require('util');var moment=require(_0x6b74('0x1'));var BPromise=require(_0x6b74('0x2'));var rs=require(_0x6b74('0x3'));var fs=require('fs');var Redis=require(_0x6b74('0x4'));var db=require(_0x6b74('0x5'))['db'];var utils=require(_0x6b74('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6b74('0x7'));var jayson=require(_0x6b74('0x8'));var client=jayson[_0x6b74('0x9')]['http']({'port':0x232a});config[_0x6b74('0xa')]=_[_0x6b74('0xb')](config[_0x6b74('0xa')],{'host':_0x6b74('0xc'),'port':0x18eb});var socket=require(_0x6b74('0xd'))(new Redis(config[_0x6b74('0xa')]));require(_0x6b74('0xe'))[_0x6b74('0xf')](socket);function respondWithRpcPromise(_0x3b0fb7,_0x5e7fd0,_0x260d4f){return new BPromise(function(_0xc21d57,_0x2fc343){return client[_0x6b74('0x10')](_0x3b0fb7,_0x260d4f)[_0x6b74('0x11')](function(_0x171c06){logger[_0x6b74('0x12')](_0x6b74('0x13'),_0x5e7fd0,_0x6b74('0x14'));logger[_0x6b74('0x15')](_0x6b74('0x16'),_0x5e7fd0,_0x6b74('0x14'),JSON[_0x6b74('0x17')](_0x171c06));if(_0x171c06[_0x6b74('0x18')]){if(_0x171c06[_0x6b74('0x18')][_0x6b74('0x19')]===0x1f4){logger[_0x6b74('0x18')](_0x6b74('0x13'),_0x5e7fd0,_0x171c06[_0x6b74('0x18')]['message']);return _0x2fc343(_0x171c06[_0x6b74('0x18')][_0x6b74('0x1a')]);}logger[_0x6b74('0x18')](_0x6b74('0x13'),_0x5e7fd0,_0x171c06[_0x6b74('0x18')]['message']);return _0xc21d57(_0x171c06[_0x6b74('0x18')][_0x6b74('0x1a')]);}else{logger[_0x6b74('0x12')](_0x6b74('0x13'),_0x5e7fd0,'request\x20sent');_0xc21d57(_0x171c06[_0x6b74('0x1b')][_0x6b74('0x1a')]);}})[_0x6b74('0x1c')](function(_0x19857e){logger['error']('Plugin,\x20%s,\x20%s',_0x5e7fd0,_0x19857e);_0x2fc343(_0x19857e);});});}exports[_0x6b74('0x1d')]=function(_0x5676b6){var _0x57ede8=this;return new Promise(function(_0x50eb32,_0x1e6021){return db[_0x6b74('0x1e')][_0x6b74('0x1f')](_0x5676b6[_0x6b74('0x20')],{'raw':_0x5676b6['options']?_0x5676b6[_0x6b74('0x21')][_0x6b74('0x22')]===undefined?!![]:![]:!![]})[_0x6b74('0x11')](function(_0x14a6a7){logger[_0x6b74('0x12')](_0x6b74('0x1d'),_0x5676b6);logger['debug']('CreatePlugin',_0x5676b6,JSON['stringify'](_0x14a6a7));_0x50eb32(_0x14a6a7);})[_0x6b74('0x1c')](function(_0x17aef6){logger[_0x6b74('0x18')]('CreatePlugin',_0x17aef6['message'],_0x5676b6);_0x1e6021(_0x57ede8[_0x6b74('0x18')](0x1f4,_0x17aef6[_0x6b74('0x1a')]));});});}; \ No newline at end of file +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 diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index ddabf80..dc899f8 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 _0xb455=['removeListener','register','length','plugin:','./plugin.events','save','remove','update'];(function(_0x332d0c,_0x59d5dc){var _0x2c7ab5=function(_0x99dd21){while(--_0x99dd21){_0x332d0c['push'](_0x332d0c['shift']());}};_0x2c7ab5(++_0x59d5dc);}(_0xb455,0x104));var _0x5b45=function(_0x246472,_0x2adac2){_0x246472=_0x246472-0x0;var _0x283ed7=_0xb455[_0x246472];return _0x283ed7;};'use strict';var PluginEvents=require(_0x5b45('0x0'));var events=[_0x5b45('0x1'),_0x5b45('0x2'),_0x5b45('0x3')];function createListener(_0x3b9f02,_0x547fe6){return function(_0x55d82b){_0x547fe6['emit'](_0x3b9f02,_0x55d82b);};}function removeListener(_0x9009dd,_0x3c7343){return function(){PluginEvents[_0x5b45('0x4')](_0x9009dd,_0x3c7343);};}exports[_0x5b45('0x5')]=function(_0x3321c2){for(var _0x41466c=0x0,_0x414c7d=events[_0x5b45('0x6')];_0x41466c<_0x414c7d;_0x41466c++){var _0x2e3618=events[_0x41466c];var _0xd51a90=createListener(_0x5b45('0x7')+_0x2e3618,_0x3321c2);PluginEvents['on'](_0x2e3618,_0xd51a90);}}; \ No newline at end of file +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 diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 8e37221..d099205 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 _0x44cc=['index','post','put','update','delete','exports','Router','../../components/auth/service','./pm2.controller','get','isAuthenticated'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x44cc,0x150));var _0xc44c=function(_0x2438b6,_0x23c935){_0x2438b6=_0x2438b6-0x0;var _0x4fc21e=_0x44cc[_0x2438b6];return _0x4fc21e;};'use strict';var express=require('express');var router=express[_0xc44c('0x0')]();var auth=require(_0xc44c('0x1'));var controller=require(_0xc44c('0x2'));router[_0xc44c('0x3')]('/',auth[_0xc44c('0x4')](),controller[_0xc44c('0x5')]);router[_0xc44c('0x3')]('/:id',auth[_0xc44c('0x4')](),controller['show']);router[_0xc44c('0x6')]('/',auth[_0xc44c('0x4')](),controller['create']);router[_0xc44c('0x7')]('/:id',auth[_0xc44c('0x4')](),controller[_0xc44c('0x8')]);router[_0xc44c('0x9')]('/:id',auth[_0xc44c('0x4')](),controller['destroy']);module[_0xc44c('0xa')]=router; \ No newline at end of file +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 diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 6ee2850..c3c704a 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 _0xcf38=['express','motion2','show','describe','params','catch','create','body','script','join','../../files/plugins','chdir','status','Missing\x20name\x20and/or\x20path','update','stop','hasOwnProperty','send','destroy','delete','dump','lodash','../../config/pm2','../../config/logger','path','child_process','exec','bluebird','sendStatus','stack','npm\x20install','info','index','then','reject','name'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xcf38,0x81));var _0x8cf3=function(_0x5ca851,_0x24a777){_0x5ca851=_0x5ca851-0x0;var _0x5bbd0c=_0xcf38[_0x5ca851];return _0x5bbd0c;};'use strict';var _=require(_0x8cf3('0x0'));var pm2=require(_0x8cf3('0x1'));var logger=require(_0x8cf3('0x2'))('api');var path=require(_0x8cf3('0x3'));var exec=require(_0x8cf3('0x4'))[_0x8cf3('0x5')];var BPromise=require(_0x8cf3('0x6'));function handleEntityNotFound(_0x10c68d,_0x2d0410){return function(_0x4a08fb){if(!_0x4a08fb){_0x10c68d[_0x8cf3('0x7')](0x194);;}return _0x4a08fb;};}function respondWithResult(_0x54097f,_0x4a1792){_0x4a1792=_0x4a1792||0xc8;return function(_0x480823){if(_0x480823){return _0x54097f['status'](_0x4a1792)['json'](_0x480823);}return null;};}function handleError(_0x371b05,_0xe4baa0){_0xe4baa0=_0xe4baa0||0x1f4;return function(_0x1c45af){logger['error'](_0x1c45af[_0x8cf3('0x8')]);if(_0x1c45af['name']){delete _0x1c45af['name'];}_0x371b05['status'](_0xe4baa0)['send'](_0x1c45af);};}function execChildProcess(){return new BPromise(function(_0x294750,_0x358d10){exec(_0x8cf3('0x9'),function(_0x22c732,_0x4c6d86,_0x5bffaf){logger['info'](_0x4c6d86);logger[_0x8cf3('0xa')](_0x5bffaf);if(_0x22c732){logger['error'](_0x22c732);return _0x358d10(_0x22c732);}return _0x294750(_0x4c6d86);});});}exports[_0x8cf3('0xb')]=function(_0x349f50,_0x18951b){return pm2['list']()[_0x8cf3('0xc')](function(_0x41f724){if(_0x41f724){var _0x17330c=_[_0x8cf3('0xd')](_0x41f724,function(_0x3b76ab){return _0x3b76ab[_0x8cf3('0xe')]===_0x8cf3('0xf')||_0x3b76ab[_0x8cf3('0xe')]===_0x8cf3('0x10');});return{'rows':_0x17330c,'count':_0x17330c['length']};}return null;})['then'](respondWithResult(_0x18951b,null))['catch'](handleError(_0x18951b,null));};exports[_0x8cf3('0x11')]=function(_0x2daf44,_0xee536c){return pm2[_0x8cf3('0x12')](_0x2daf44[_0x8cf3('0x13')]['id'])[_0x8cf3('0xc')](respondWithResult(_0xee536c,null))[_0x8cf3('0xc')](handleEntityNotFound(_0xee536c,null))[_0x8cf3('0x14')](handleError(_0xee536c,null));};exports[_0x8cf3('0x15')]=function(_0x308e41,_0x2668e0){if(_0x308e41[_0x8cf3('0x16')][_0x8cf3('0xe')]&&_0x308e41[_0x8cf3('0x16')][_0x8cf3('0x17')]){var _0x3d5778=path[_0x8cf3('0x18')](__dirname,_0x8cf3('0x19'),_0x308e41[_0x8cf3('0x16')][_0x8cf3('0x17')]);var _0x23a387=process['cwd']();process[_0x8cf3('0x1a')](path['dirname'](_0x3d5778));return execChildProcess()['then'](function(_0x1761c1){process[_0x8cf3('0x1a')](_0x23a387);return pm2['start']({'name':_0x308e41[_0x8cf3('0x16')][_0x8cf3('0xe')],'script':_0x3d5778});})[_0x8cf3('0xc')](function(_0x185a15){pm2['dump']();return _0x185a15[0x0];})['then'](respondWithResult(_0x2668e0,0xc9))[_0x8cf3('0x14')](handleError(_0x2668e0,null));}else{return _0x2668e0[_0x8cf3('0x1b')](0x1f4)['send']({'message':_0x8cf3('0x1c')});}};exports[_0x8cf3('0x1d')]=function(_0x1bdd3c,_0x13e94f){if(_0x1bdd3c[_0x8cf3('0x16')]['id']){delete _0x1bdd3c[_0x8cf3('0x16')]['id'];}var _0x4b2b43={'online':'restart','stopped':_0x8cf3('0x1e')};if(_0x4b2b43[_0x8cf3('0x1f')](_0x1bdd3c['body'][_0x8cf3('0x1b')])){return pm2[_0x4b2b43[_0x1bdd3c[_0x8cf3('0x16')][_0x8cf3('0x1b')]]](_0x1bdd3c[_0x8cf3('0x13')]['id'])[_0x8cf3('0xc')](respondWithResult(_0x13e94f,0xc8))['catch'](handleError(_0x13e94f,null));}else{return _0x13e94f[_0x8cf3('0x1b')](0x1f4)[_0x8cf3('0x20')]({'message':'Unknown\x20status'});}};exports[_0x8cf3('0x21')]=function(_0x1c778b,_0x45a8a0){if(_0x1c778b['body']['id']){delete _0x1c778b[_0x8cf3('0x16')]['id'];}if(_0x1c778b[_0x8cf3('0x13')]['id']){return pm2[_0x8cf3('0x22')](_0x1c778b[_0x8cf3('0x13')]['id'])[_0x8cf3('0xc')](function(_0x5ba587){pm2[_0x8cf3('0x23')]();return _0x5ba587[0x0];})[_0x8cf3('0xc')](respondWithResult(_0x45a8a0,null))[_0x8cf3('0x14')](handleError(_0x45a8a0,null));}else{return _0x45a8a0[_0x8cf3('0x1b')](0x1f4)[_0x8cf3('0x20')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +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 diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index b7a63e7..c3308bd 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 _0x1ef1=['../../components/interaction/service','../../config/environment','connect-timeout','express','Router','../../components/auth/service'];(function(_0x360eb9,_0x7389a9){var _0x11a2f4=function(_0x52808a){while(--_0x52808a){_0x360eb9['push'](_0x360eb9['shift']());}};_0x11a2f4(++_0x7389a9);}(_0x1ef1,0x1a6));var _0x11ef=function(_0x4cdba5,_0x5373a7){_0x4cdba5=_0x4cdba5-0x0;var _0x3be43d=_0x1ef1[_0x4cdba5];return _0x3be43d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x11ef('0x0'));var express=require(_0x11ef('0x1'));var router=express[_0x11ef('0x2')]();var auth=require(_0x11ef('0x3'));var interaction=require(_0x11ef('0x4'));var config=require(_0x11ef('0x5'));module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 33a319e..e5c4e03 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 _0xf83c=['DATE','INTEGER','sequelize','exports','STRING'];(function(_0x1d466f,_0x4e4c3e){var _0xf2ff3b=function(_0x10606d){while(--_0x10606d){_0x1d466f['push'](_0x1d466f['shift']());}};_0xf2ff3b(++_0x4e4c3e);}(_0xf83c,0x66));var _0xcf83=function(_0x118653,_0x50ef26){_0x118653=_0x118653-0x0;var _0xc11fa6=_0xf83c[_0x118653];return _0xc11fa6;};'use strict';var Sequelize=require(_0xcf83('0x0'));module[_0xcf83('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xcf83('0x2')]},'scheduledat':{'type':Sequelize[_0xcf83('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xcf83('0x3')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xcf83('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xcf83('0x2')]},'campaigntype':{'type':Sequelize[_0xcf83('0x2')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +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 diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index c8d107f..07d94ca 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 _0x6564=['../../config/logger','api','moment','bluebird','../../config/environment','ReportAgentPreview','report_agent_preview','lodash','util'];(function(_0xb47e3a,_0x2efd95){var _0x4025bd=function(_0x469455){while(--_0x469455){_0xb47e3a['push'](_0xb47e3a['shift']());}};_0x4025bd(++_0x2efd95);}(_0x6564,0xa9));var _0x4656=function(_0x29b25d,_0x7f7e39){_0x29b25d=_0x29b25d-0x0;var _0x164741=_0x6564[_0x29b25d];return _0x164741;};'use strict';var _=require(_0x4656('0x0'));var util=require(_0x4656('0x1'));var logger=require(_0x4656('0x2'))(_0x4656('0x3'));var moment=require(_0x4656('0x4'));var BPromise=require(_0x4656('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4656('0x6'));var attributes=require('./reportAgentPreview.attributes');module['exports']=function(_0x3438be,_0x3a7d15){return _0x3438be['define'](_0x4656('0x7'),attributes,{'tableName':_0x4656('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 3073728..349c352 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 _0x00a8=['request','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ReportAgentPreview','create','options','then','CreateReportAgentPreview','stringify','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http'];(function(_0x115621,_0x341cde){var _0x5ef5ce=function(_0x2ca3f2){while(--_0x2ca3f2){_0x115621['push'](_0x115621['shift']());}};_0x5ef5ce(++_0x341cde);}(_0x00a8,0x163));var _0x800a=function(_0x16d643,_0x361e45){_0x16d643=_0x16d643-0x0;var _0x5c2204=_0x00a8[_0x16d643];return _0x5c2204;};'use strict';var _=require(_0x800a('0x0'));var util=require('util');var moment=require(_0x800a('0x1'));var BPromise=require(_0x800a('0x2'));var rs=require(_0x800a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x800a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x800a('0x5'));var jayson=require(_0x800a('0x6'));var client=jayson[_0x800a('0x7')][_0x800a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x134b59,_0x2b8b5a,_0x3c8c71){return new BPromise(function(_0x5a8841,_0x1b701a){return client[_0x800a('0x9')](_0x134b59,_0x3c8c71)['then'](function(_0x18bcd9){logger[_0x800a('0xa')](_0x800a('0xb'),_0x2b8b5a,_0x800a('0xc'));logger[_0x800a('0xd')](_0x800a('0xe'),_0x2b8b5a,'request\x20sent',JSON['stringify'](_0x18bcd9));if(_0x18bcd9['error']){if(_0x18bcd9[_0x800a('0xf')][_0x800a('0x10')]===0x1f4){logger['error'](_0x800a('0xb'),_0x2b8b5a,_0x18bcd9[_0x800a('0xf')][_0x800a('0x11')]);return _0x1b701a(_0x18bcd9['error']['message']);}logger['error'](_0x800a('0xb'),_0x2b8b5a,_0x18bcd9['error'][_0x800a('0x11')]);return _0x5a8841(_0x18bcd9[_0x800a('0xf')]['message']);}else{logger['info'](_0x800a('0xb'),_0x2b8b5a,_0x800a('0xc'));_0x5a8841(_0x18bcd9[_0x800a('0x12')][_0x800a('0x11')]);}})[_0x800a('0x13')](function(_0x14eef3){logger[_0x800a('0xf')](_0x800a('0xb'),_0x2b8b5a,_0x14eef3);_0x1b701a(_0x14eef3);});});}exports['CreateReportAgentPreview']=function(_0x13551f){var _0x4e6102=this;return new Promise(function(_0x5594ba,_0xd2389c){return db[_0x800a('0x14')][_0x800a('0x15')](_0x13551f['body'],{'raw':_0x13551f[_0x800a('0x16')]?_0x13551f[_0x800a('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x800a('0x17')](function(_0x40d182){logger[_0x800a('0xa')](_0x800a('0x18'),_0x13551f);logger[_0x800a('0xd')](_0x800a('0x18'),_0x13551f,JSON[_0x800a('0x19')](_0x40d182));_0x5594ba(_0x40d182);})[_0x800a('0x13')](function(_0x207b4f){logger[_0x800a('0xf')](_0x800a('0x18'),_0x207b4f[_0x800a('0x11')],_0x13551f);_0xd2389c(_0x4e6102[_0x800a('0xf')](0x1f4,_0x207b4f[_0x800a('0x11')]));});});}; \ No newline at end of file +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 diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index be71f3d..48f5d96 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 _0x36ce=['/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound/channels','outboundChannels','/agents','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','showSmsQueues','/agents/:id/notify','agentNotify','exports','multer','path','express','Router','./rpc.controller','get','/voice/channels','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x36ce,0x11c));var _0xe36c=function(_0x4cb663,_0x57166e){_0x4cb663=_0x4cb663-0x0;var _0x9d862e=_0x36ce[_0x4cb663];return _0x9d862e;};'use strict';var multer=require(_0xe36c('0x0'));var util=require('util');var path=require(_0xe36c('0x1'));var express=require(_0xe36c('0x2'));var router=express[_0xe36c('0x3')]();var auth=require('../../components/auth/service');var controller=require(_0xe36c('0x4'));router[_0xe36c('0x5')](_0xe36c('0x6'),auth[_0xe36c('0x7')](),controller['voiceChannels']);router[_0xe36c('0x5')](_0xe36c('0x8'),auth[_0xe36c('0x7')](),controller[_0xe36c('0x9')]);router['get'](_0xe36c('0xa'),auth[_0xe36c('0x7')](),controller['voiceChannelStopMixMonitor']);router['get'](_0xe36c('0xb'),auth['isAuthenticated'](),controller[_0xe36c('0xc')]);router[_0xe36c('0x5')](_0xe36c('0xd'),auth[_0xe36c('0x7')](),controller[_0xe36c('0xe')]);router[_0xe36c('0x5')](_0xe36c('0xf'),auth[_0xe36c('0x7')](),controller[_0xe36c('0x10')]);router['get']('/mail/accounts',auth[_0xe36c('0x7')](),controller['mailAccounts']);router[_0xe36c('0x5')](_0xe36c('0x11'),auth[_0xe36c('0x7')](),controller[_0xe36c('0x12')]);router[_0xe36c('0x5')](_0xe36c('0x13'),auth[_0xe36c('0x7')](),controller[_0xe36c('0x14')]);router['get']('/fax/queues',auth[_0xe36c('0x7')](),controller['faxQueues']);router[_0xe36c('0x5')](_0xe36c('0x15'),auth[_0xe36c('0x7')](),controller[_0xe36c('0x16')]);router[_0xe36c('0x5')](_0xe36c('0x17'),auth[_0xe36c('0x7')](),controller['voiceQueuesChannels']);router[_0xe36c('0x5')](_0xe36c('0x18'),auth['isAuthenticated'](),controller[_0xe36c('0x19')]);router[_0xe36c('0x5')](_0xe36c('0x1a'),auth[_0xe36c('0x7')](),controller[_0xe36c('0x1b')]);router[_0xe36c('0x5')](_0xe36c('0x1c'),auth[_0xe36c('0x7')](),controller[_0xe36c('0x1d')]);router['get'](_0xe36c('0x1e'),auth[_0xe36c('0x7')](),controller[_0xe36c('0x1f')]);router[_0xe36c('0x5')]('/outbound',auth['isAuthenticated'](),controller['outbound']);router[_0xe36c('0x5')](_0xe36c('0x20'),auth[_0xe36c('0x7')](),controller[_0xe36c('0x21')]);router['get'](_0xe36c('0x22'),auth[_0xe36c('0x7')](),controller[_0xe36c('0x23')]);router[_0xe36c('0x24')](_0xe36c('0x25'),auth[_0xe36c('0x7')](),controller[_0xe36c('0x26')]);router[_0xe36c('0x5')](_0xe36c('0x27'),auth[_0xe36c('0x7')](),controller[_0xe36c('0x28')]);router[_0xe36c('0x5')](_0xe36c('0x29'),auth[_0xe36c('0x7')](),controller[_0xe36c('0x2a')]);router[_0xe36c('0x5')](_0xe36c('0x2b'),auth[_0xe36c('0x7')](),controller[_0xe36c('0x2c')]);router['get'](_0xe36c('0x2d'),auth[_0xe36c('0x7')](),controller[_0xe36c('0x2e')]);router[_0xe36c('0x5')](_0xe36c('0x2f'),auth[_0xe36c('0x7')](),controller['chatQueuesWaitingInteractions']);router[_0xe36c('0x5')]('/mail/queues/waitinginteractions',auth[_0xe36c('0x7')](),controller[_0xe36c('0x30')]);router[_0xe36c('0x5')]('/openchannel/queues/waitinginteractions',auth[_0xe36c('0x7')](),controller[_0xe36c('0x31')]);router[_0xe36c('0x5')]('/sms/queues/waitinginteractions',auth[_0xe36c('0x7')](),controller[_0xe36c('0x32')]);router[_0xe36c('0x5')](_0xe36c('0x33'),auth[_0xe36c('0x7')](),controller['faxQueuesWaitingInteractions']);router['post'](_0xe36c('0x34'),auth[_0xe36c('0x7')](),controller[_0xe36c('0x35')](_0xe36c('0x36')));router[_0xe36c('0x5')](_0xe36c('0x37'),auth[_0xe36c('0x7')](),controller[_0xe36c('0x38')]);router[_0xe36c('0x39')](_0xe36c('0x3a'),auth[_0xe36c('0x7')](),controller[_0xe36c('0x35')](_0xe36c('0x3b')));router[_0xe36c('0x5')](_0xe36c('0x3c'),auth[_0xe36c('0x7')](),controller[_0xe36c('0x3d')]);router[_0xe36c('0x39')](_0xe36c('0x3e'),auth[_0xe36c('0x7')](),controller[_0xe36c('0x35')]('fax'));router[_0xe36c('0x5')]('/fax/queues/:id',auth[_0xe36c('0x7')](),controller[_0xe36c('0x3f')]);router[_0xe36c('0x39')](_0xe36c('0x40'),auth['isAuthenticated'](),controller[_0xe36c('0x35')](_0xe36c('0x41')));router[_0xe36c('0x5')](_0xe36c('0x42'),auth[_0xe36c('0x7')](),controller['showOpenchannelQueues']);router[_0xe36c('0x39')](_0xe36c('0x43'),auth['isAuthenticated'](),controller[_0xe36c('0x35')](_0xe36c('0x44')));router[_0xe36c('0x5')]('/sms/queues/:id',auth[_0xe36c('0x7')](),controller[_0xe36c('0x45')]);router[_0xe36c('0x39')](_0xe36c('0x46'),auth[_0xe36c('0x7')](),controller[_0xe36c('0x47')]);module[_0xe36c('0x48')]=router; \ No newline at end of file +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 diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index d4b7658..eea20fa 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 _0x8ced=['Account','Message','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','Start','queueTransferTimeout','*,*,*,*','channel','findOne','Agent\x20not\x20found','create','agentTransferTimeout','bluebird','moment','lodash','util','../../config/logger','api','client','request','then','error','message','result','catch','status','sendStatus','stack','name','isNil','find','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','voiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','agents','Agents','body','interaction','user','hasOwnProperty','MemberReport','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','INTERACTION','interface','SIP/%s','agent','internal','AgentCapacity','capacity','Telephones','Trunks','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','showOpenchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website'];(function(_0x19ff6b,_0x84142a){var _0x522b2d=function(_0x31b41f){while(--_0x31b41f){_0x19ff6b['push'](_0x19ff6b['shift']());}};_0x522b2d(++_0x84142a);}(_0x8ced,0x1c7));var _0xd8ce=function(_0x2f8c05,_0x551e3d){_0x2f8c05=_0x2f8c05-0x0;var _0x14cfde=_0x8ced[_0x2f8c05];return _0x14cfde;};'use strict';var BPromise=require(_0xd8ce('0x0'));var moment=require(_0xd8ce('0x1'));var _=require(_0xd8ce('0x2'));var util=require(_0xd8ce('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xd8ce('0x4'))(_0xd8ce('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0xd8ce('0x6')]['http']({'port':0x232a});var mailClient=jayson[_0xd8ce('0x6')]['http']({'port':0x232b});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x12f634,_0x2820d5,_0x27cc93){return new BPromise(function(_0xe43fb3,_0x13d384){var _0x3cd627=_0x27cc93?_0x27cc93:amiClient;return _0x3cd627[_0xd8ce('0x7')](_0x12f634,_0x2820d5)[_0xd8ce('0x8')](function(_0x3cf71f){if(_0x3cf71f[_0xd8ce('0x9')]){if(_0x3cf71f['error']['code']===0x1f4){return _0x13d384(_0x3cf71f[_0xd8ce('0x9')][_0xd8ce('0xa')]);}return _0xe43fb3(_0x3cf71f[_0xd8ce('0x9')][_0xd8ce('0xa')]);}else{_0xe43fb3(_0x3cf71f[_0xd8ce('0xb')]);}})[_0xd8ce('0xc')](function(_0x33bc3a){_0x13d384(_0x33bc3a);});});}function respondWithResult(_0x4e13c7,_0x3f2f9e){_0x3f2f9e=_0x3f2f9e||0xc8;return function(_0x542ec7){if(_0x542ec7){return _0x4e13c7[_0xd8ce('0xd')](_0x3f2f9e)['json'](_0x542ec7);}return _0x4e13c7[_0xd8ce('0xe')](0x194);};}function handleError(_0x31c6f3,_0x5ad885){_0x5ad885=_0x5ad885||0x1f4;return function(_0x27723a){logger[_0xd8ce('0x9')](_0x27723a[_0xd8ce('0xf')]);if(_0x27723a[_0xd8ce('0x10')]){delete _0x27723a[_0xd8ce('0x10')];}_0x31c6f3[_0xd8ce('0xd')](_0x5ad885)['send'](_0x27723a);};}function findById(_0x470e27){return function(_0xb82183){if(!_[_0xd8ce('0x11')](_0x470e27)&&!_['isNil'](_0xb82183)&&!_[_0xd8ce('0x11')](_0xb82183['rows'])){return _[_0xd8ce('0x12')](_0xb82183[_0xd8ce('0x13')],function(_0x239405){return _0x239405['id']==_0x470e27;});}return null;};}exports[_0xd8ce('0x14')]=function(_0x5d50a0,_0x415ac3){return respondWithRpcPromise(_0xd8ce('0x15'),_0x5d50a0[_0xd8ce('0x16')])[_0xd8ce('0x8')](respondWithResult(_0x415ac3,null))[_0xd8ce('0xc')](handleError(_0x415ac3,null));};exports[_0xd8ce('0x17')]=function(_0x59d737,_0x30ade6){return respondWithRpcPromise(_0xd8ce('0x18'),_[_0xd8ce('0x19')](_0x59d737[_0xd8ce('0x16')],_0x59d737[_0xd8ce('0x1a')]))[_0xd8ce('0x8')](respondWithResult(_0x30ade6,null))['catch'](handleError(_0x30ade6,null));};exports[_0xd8ce('0x1b')]=function(_0x43a00b,_0x5c01fa){return respondWithRpcPromise(_0xd8ce('0x1c'),_[_0xd8ce('0x19')](_0x43a00b[_0xd8ce('0x16')],_0x43a00b[_0xd8ce('0x1a')]))[_0xd8ce('0x8')](respondWithResult(_0x5c01fa,null))[_0xd8ce('0xc')](handleError(_0x5c01fa,null));};exports[_0xd8ce('0x1d')]=function(_0x3a16e6,_0x36a2d8){return respondWithRpcPromise(_0xd8ce('0x1e'),_0x3a16e6[_0xd8ce('0x16')])[_0xd8ce('0x8')](respondWithResult(_0x36a2d8,null))['catch'](handleError(_0x36a2d8,null));};exports[_0xd8ce('0x1f')]=function(_0x54c306,_0x46a9cf){return respondWithRpcPromise(_0xd8ce('0x1e'),_0x54c306[_0xd8ce('0x16')])[_0xd8ce('0x8')](findById(_0x54c306['params']['id']))[_0xd8ce('0x8')](respondWithResult(_0x46a9cf,null))[_0xd8ce('0xc')](handleError(_0x46a9cf,null));};exports[_0xd8ce('0x20')]=function(_0x41b65b,_0x2273bc){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x41b65b['query'],_0x41b65b[_0xd8ce('0x1a')]))['then'](respondWithResult(_0x2273bc,null))['catch'](handleError(_0x2273bc,null));};exports[_0xd8ce('0x21')]=function(_0x46899a,_0x16d0eb){return respondWithRpcPromise('VoiceQueuesChannels',_0x46899a[_0xd8ce('0x16')])[_0xd8ce('0x8')](respondWithResult(_0x16d0eb,null))[_0xd8ce('0xc')](handleError(_0x16d0eb,null));};exports[_0xd8ce('0x22')]=function(_0x1df071,_0x2ad7ea){return respondWithRpcPromise(_0xd8ce('0x23'),_[_0xd8ce('0x19')](_0x1df071[_0xd8ce('0x16')],_0x1df071[_0xd8ce('0x1a')]))['then'](respondWithResult(_0x2ad7ea,null))['catch'](handleError(_0x2ad7ea,null));};exports[_0xd8ce('0x24')]=function(_0x378442,_0x20134f){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0xd8ce('0x19')](_0x378442[_0xd8ce('0x16')],_0x378442[_0xd8ce('0x1a')]))[_0xd8ce('0x8')](respondWithResult(_0x20134f,null))[_0xd8ce('0xc')](handleError(_0x20134f,null));};exports[_0xd8ce('0x25')]=function(_0x47ee0d,_0x3fbf36){return respondWithRpcPromise(_0xd8ce('0x26'),_[_0xd8ce('0x19')](_0x47ee0d[_0xd8ce('0x16')],_0x47ee0d[_0xd8ce('0x1a')]))['then'](respondWithResult(_0x3fbf36,null))['catch'](handleError(_0x3fbf36,null));};exports[_0xd8ce('0x27')]=function(_0x21b961,_0x4361ac){return respondWithRpcPromise('Outbound',_0x21b961[_0xd8ce('0x16')])[_0xd8ce('0x8')](respondWithResult(_0x4361ac,null))[_0xd8ce('0xc')](handleError(_0x4361ac,null));};exports[_0xd8ce('0x28')]=function(_0x1413cd,_0xb20adf){return respondWithRpcPromise(_0xd8ce('0x29'),_0x1413cd['query'])['then'](respondWithResult(_0xb20adf,null))[_0xd8ce('0xc')](handleError(_0xb20adf,null));};exports[_0xd8ce('0x2a')]=function(_0x29d012,_0x47141c){var _0x472384;return respondWithRpcPromise(_0xd8ce('0x2b'),_0x29d012[_0xd8ce('0x16')])[_0xd8ce('0x8')](function(_0x53618f){_0x472384=_0x53618f;return respondWithRpcPromise(_0xd8ce('0x2b'),_0x29d012[_0xd8ce('0x16')],routingClient);})['then'](function(_0x5d053b){return _[_0xd8ce('0x19')]({},_0x5d053b,_0x472384);})['then'](respondWithResult(_0x47141c,null))[_0xd8ce('0xc')](handleError(_0x47141c,null));};exports['agentCapacity']=function(_0x57d6af,_0x23c567){if(_0x57d6af[_0xd8ce('0x2c')]&&_0x57d6af[_0xd8ce('0x2c')][_0xd8ce('0x2d')]&&_0x57d6af[_0xd8ce('0x2e')]&&_0x57d6af[_0xd8ce('0x2e')][_0xd8ce('0x10')]){for(var _0x413683 in _0x57d6af[_0xd8ce('0x2c')][_0xd8ce('0x2d')]){if(_0x57d6af['body'][_0xd8ce('0x2d')][_0xd8ce('0x2f')](_0x413683)){db[_0xd8ce('0x30')]['findAll']({'where':{'channel':_0x413683,'membername':_0x57d6af[_0xd8ce('0x2e')][_0xd8ce('0x10')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x57d6af[_0xd8ce('0x2c')][_0xd8ce('0x2d')][_0x413683]&&_0x57d6af[_0xd8ce('0x2c')]['interaction'][_0x413683][_0xd8ce('0x31')]?{'$notIn':_0x57d6af[_0xd8ce('0x2c')][_0xd8ce('0x2d')][_0x413683]}:{'$ne':null}}})[_0xd8ce('0x8')](function(_0x43c079){var _0x162705=moment()[_0xd8ce('0x32')](_0xd8ce('0x33'));for(var _0xa4e65=0x0,_0x5cc995=_0x43c079['length'];_0xa4e65<_0x5cc995;_0xa4e65+=0x1){_0x43c079[_0xa4e65][_0xd8ce('0x34')]({'exitAt':_0x162705});}});for(var _0x56fc50=0x0;_0x56fc50<_0x57d6af['body']['interaction'][_0x413683][_0xd8ce('0x31')];_0x56fc50+=0x1){db[_0xd8ce('0x30')][_0xd8ce('0x35')]({'where':{'channel':_0x413683,'membername':_0x57d6af['user'][_0xd8ce('0x10')],'type':_0xd8ce('0x36'),'uniqueid':_0x57d6af[_0xd8ce('0x2c')][_0xd8ce('0x2d')][_0x413683][_0x56fc50],'exitAt':null},'defaults':{'channel':_0x413683,'membername':_0x57d6af[_0xd8ce('0x2e')][_0xd8ce('0x10')],'interface':_['isNil'](_0x57d6af[_0xd8ce('0x2e')][_0xd8ce('0x37')])?util[_0xd8ce('0x32')](_0xd8ce('0x38'),_0x57d6af[_0xd8ce('0x2e')][_0xd8ce('0x10')]):_0x57d6af['user']['interface'],'type':_0xd8ce('0x36'),'enterAt':moment()[_0xd8ce('0x32')](_0xd8ce('0x33')),'role':_0xd8ce('0x39'),'internal':_0x57d6af[_0xd8ce('0x2e')][_0xd8ce('0x3a')],'uniqueid':_0x57d6af[_0xd8ce('0x2c')][_0xd8ce('0x2d')][_0x413683][_0x56fc50]}});}}}}return respondWithRpcPromise(_0xd8ce('0x3b'),{'id':_0x57d6af[_0xd8ce('0x1a')]['id'],'capacity':_0x57d6af[_0xd8ce('0x2c')][_0xd8ce('0x3c')]},routingClient)[_0xd8ce('0x8')](respondWithResult(_0x23c567,null))[_0xd8ce('0xc')](handleError(_0x23c567,null));};exports['telephones']=function(_0x3701bb,_0x59e01b){return respondWithRpcPromise(_0xd8ce('0x3d'),_0x3701bb[_0xd8ce('0x16')])['then'](respondWithResult(_0x59e01b,null))[_0xd8ce('0xc')](handleError(_0x59e01b,null));};exports['trunks']=function(_0x2efb03,_0xe12e50){return respondWithRpcPromise(_0xd8ce('0x3e'),_0x2efb03[_0xd8ce('0x16')])[_0xd8ce('0x8')](respondWithResult(_0xe12e50,null))[_0xd8ce('0xc')](handleError(_0xe12e50,null));};exports['campaigns']=function(_0x5a1762,_0x53a4d3){return respondWithRpcPromise(_0xd8ce('0x3f'),_0x5a1762[_0xd8ce('0x16')])[_0xd8ce('0x8')](respondWithResult(_0x53a4d3,null))[_0xd8ce('0xc')](handleError(_0x53a4d3,null));};exports[_0xd8ce('0x40')]=function(_0x3bc8d2,_0x3f4af4){return respondWithRpcPromise(_0xd8ce('0x41'),_0x3bc8d2['query'],routingClient)[_0xd8ce('0x8')](respondWithResult(_0x3f4af4,null))[_0xd8ce('0xc')](handleError(_0x3f4af4,null));};exports['showChatQueues']=function(_0x45db65,_0x16d1f8){return respondWithRpcPromise(_0xd8ce('0x41'),_0x45db65[_0xd8ce('0x16')],routingClient)[_0xd8ce('0x8')](findById(_0x45db65[_0xd8ce('0x1a')]['id']))[_0xd8ce('0x8')](respondWithResult(_0x16d1f8,null))[_0xd8ce('0xc')](handleError(_0x16d1f8,null));};exports[_0xd8ce('0x42')]=function(_0x136574,_0x4abf01){return respondWithRpcPromise(_0xd8ce('0x43'),_0x136574[_0xd8ce('0x16')],routingClient)[_0xd8ce('0x8')](respondWithResult(_0x4abf01,null))[_0xd8ce('0xc')](handleError(_0x4abf01,null));};exports[_0xd8ce('0x44')]=function(_0x25aeaa,_0x1abf4a){return respondWithRpcPromise(_0xd8ce('0x43'),_0x25aeaa[_0xd8ce('0x16')],routingClient)['then'](findById(_0x25aeaa[_0xd8ce('0x1a')]['id']))[_0xd8ce('0x8')](respondWithResult(_0x1abf4a,null))[_0xd8ce('0xc')](handleError(_0x1abf4a,null));};exports[_0xd8ce('0x45')]=function(_0x52c866,_0x15aaf1){return respondWithRpcPromise('MailAccounts',_0x52c866[_0xd8ce('0x16')],mailClient)[_0xd8ce('0x8')](respondWithResult(_0x15aaf1,null))[_0xd8ce('0xc')](handleError(_0x15aaf1,null));};exports['openchannelQueues']=function(_0x59d0f7,_0x100014){return respondWithRpcPromise('OpenchannelQueues',_0x59d0f7[_0xd8ce('0x16')],routingClient)[_0xd8ce('0x8')](respondWithResult(_0x100014,null))[_0xd8ce('0xc')](handleError(_0x100014,null));};exports[_0xd8ce('0x46')]=function(_0x9c6297,_0x55fbaf){return respondWithRpcPromise(_0xd8ce('0x47'),_0x9c6297[_0xd8ce('0x16')],routingClient)[_0xd8ce('0x8')](findById(_0x9c6297[_0xd8ce('0x1a')]['id']))[_0xd8ce('0x8')](respondWithResult(_0x55fbaf,null))[_0xd8ce('0xc')](handleError(_0x55fbaf,null));};exports[_0xd8ce('0x48')]=function(_0x425899,_0x11fc3d){return respondWithRpcPromise('SmsQueues',_0x425899['query'],routingClient)[_0xd8ce('0x8')](respondWithResult(_0x11fc3d,null))[_0xd8ce('0xc')](handleError(_0x11fc3d,null));};exports[_0xd8ce('0x49')]=function(_0x2d3e14,_0x45bc56){return respondWithRpcPromise(_0xd8ce('0x4a'),_0x2d3e14[_0xd8ce('0x16')],routingClient)['then'](findById(_0x2d3e14[_0xd8ce('0x1a')]['id']))[_0xd8ce('0x8')](respondWithResult(_0x45bc56,null))[_0xd8ce('0xc')](handleError(_0x45bc56,null));};exports[_0xd8ce('0x4b')]=function(_0x32b680,_0x224de5){return respondWithRpcPromise('FaxQueues',_0x32b680[_0xd8ce('0x16')],routingClient)['then'](respondWithResult(_0x224de5,null))[_0xd8ce('0xc')](handleError(_0x224de5,null));};exports[_0xd8ce('0x4c')]=function(_0x369398,_0x12aeec){return respondWithRpcPromise(_0xd8ce('0x4d'),_0x369398[_0xd8ce('0x16')],routingClient)[_0xd8ce('0x8')](findById(_0x369398[_0xd8ce('0x1a')]['id']))[_0xd8ce('0x8')](respondWithResult(_0x12aeec,null))['catch'](handleError(_0x12aeec,null));};exports[_0xd8ce('0x4e')]=function(_0x93de9f,_0xd6bbc5){return respondWithRpcPromise('FaxAccounts',_0x93de9f['query'])[_0xd8ce('0x8')](respondWithResult(_0xd6bbc5,null))['catch'](handleError(_0xd6bbc5,null));};exports['chatQueuesWaitingInteractions']=function(_0x9ad784,_0x276130){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x9ad784[_0xd8ce('0x16')],routingClient)[_0xd8ce('0x8')](respondWithResult(_0x276130,null))[_0xd8ce('0xc')](handleError(_0x276130,null));};exports[_0xd8ce('0x4f')]=function(_0x1b83cd,_0x460e50){return respondWithRpcPromise(_0xd8ce('0x50'),_0x1b83cd[_0xd8ce('0x16')],routingClient)[_0xd8ce('0x8')](respondWithResult(_0x460e50,null))[_0xd8ce('0xc')](handleError(_0x460e50,null));};exports[_0xd8ce('0x51')]=function(_0x2e3440,_0x3f935a){return respondWithRpcPromise(_0xd8ce('0x52'),_0x2e3440['query'],routingClient)['then'](respondWithResult(_0x3f935a,null))[_0xd8ce('0xc')](handleError(_0x3f935a,null));};exports[_0xd8ce('0x53')]=function(_0x2cdb08,_0xb221a){return respondWithRpcPromise(_0xd8ce('0x54'),_0x2cdb08[_0xd8ce('0x16')],routingClient)[_0xd8ce('0x8')](respondWithResult(_0xb221a,null))[_0xd8ce('0xc')](handleError(_0xb221a,null));};exports[_0xd8ce('0x55')]=function(_0x252fbf,_0x270f7d){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x252fbf[_0xd8ce('0x16')],routingClient)[_0xd8ce('0x8')](respondWithResult(_0x270f7d,null))[_0xd8ce('0xc')](handleError(_0x270f7d,null));};exports[_0xd8ce('0x56')]=function(_0x19796d){return function(_0x1a59d5,_0x513f9a){var _0x37dbf6,_0xd9133f;var _0x412910=_[_0xd8ce('0x57')](_0x19796d);var _0x2ae52b=_0x19796d===_0xd8ce('0x58')?_0xd8ce('0x59'):_0xd8ce('0x5a');return db[_0x412910+'Queue']['findOne']({'raw':!![],'where':{'id':_0x1a59d5[_0xd8ce('0x1a')]['id']}})['then'](function(_0x2f84a2){if(_[_0xd8ce('0x11')](_0x2f84a2)){throw new Error(_0x412910+'\x20Queue\x20not\x20found');}_0x37dbf6=_0x2f84a2;return db[_0x412910+_0xd8ce('0x5b')]['findOne']({'where':{'id':_0x1a59d5[_0xd8ce('0x2c')]['messageId']},'include':[{'model':db[_0x412910+_0xd8ce('0x5c')],'as':'Interaction'},{'model':db[_0x412910+_0x2ae52b],'as':_0xd8ce('0x5a')}]});})[_0xd8ce('0x8')](function(_0x3e12cc){if(_['isNil'](_0x3e12cc)){throw new Error(_0x412910+_0xd8ce('0x5d'));}_0xd9133f=_0x3e12cc;return _0x3e12cc[_0xd8ce('0x5e')]({'read':0x0,'readAt':null,'UserId':null});})[_0xd8ce('0x8')](function(){var _0x984262={'uniqueid':_0x19796d+'.'+_0xd9133f['id']+'.'+_0xd9133f[_0xd8ce('0x5c')]['id'],'FromUserId':_0x1a59d5[_0xd8ce('0x2e')]['id'],'type':_0xd8ce('0x5f')};_0x984262[_0x412910+_0xd8ce('0x60')]=_0xd9133f['id'];_0x984262[_0x412910+_0xd8ce('0x61')]=_0xd9133f[_0xd8ce('0x5c')]['id'];_0x984262[_0xd8ce('0x62')+_0x412910+_0x2ae52b+'Id']=_0xd9133f[_0xd8ce('0x5a')]['id'];_0x984262['To'+_0x412910+_0xd8ce('0x63')]=_0x37dbf6['id'];return db[_0x412910+_0xd8ce('0x64')]['create'](_0x984262);})[_0xd8ce('0x8')](function(){return respondWithRpcPromise(_0xd8ce('0x65'),{'channel':_0x19796d,'interaction':_0xd9133f['Interaction'],'message':_0xd9133f,'account':_0xd9133f[_0xd8ce('0x5a')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x37dbf6[_0xd8ce('0x10')]+','+(_0xd9133f[_0xd8ce('0x5a')][_0xd8ce('0x66')]||0x12c),'interval':_0xd8ce('0x67')}]},routingClient);})['then'](respondWithResult(_0x513f9a,null))[_0xd8ce('0xc')](handleError(_0x513f9a,null));};};exports['agentNotify']=function(_0x3695e4,_0x478c36){var _0x3ba2a7,_0x46bf3e;if(_[_0xd8ce('0x11')](_0x3695e4['body'][_0xd8ce('0x68')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x5d0579=_0x3695e4[_0xd8ce('0x2c')][_0xd8ce('0x68')];var _0x34625e=_[_0xd8ce('0x57')](_0x5d0579);var _0x15a968=_0x5d0579===_0xd8ce('0x58')?_0xd8ce('0x59'):_0xd8ce('0x5a');return db['User'][_0xd8ce('0x69')]({'raw':!![],'where':{'id':_0x3695e4[_0xd8ce('0x1a')]['id'],'role':_0xd8ce('0x39')}})[_0xd8ce('0x8')](function(_0x1e4135){if(_[_0xd8ce('0x11')](_0x1e4135)){throw new Error(_0xd8ce('0x6a'));}_0x3ba2a7=_0x1e4135;return db[_0x34625e+_0xd8ce('0x5b')][_0xd8ce('0x69')]({'where':{'id':_0x3695e4['body']['messageId']},'include':[{'model':db[_0x34625e+_0xd8ce('0x5c')],'as':_0xd8ce('0x5c')},{'model':db[_0x34625e+_0x15a968],'as':'Account'}]});})[_0xd8ce('0x8')](function(_0x432b90){if(_['isNil'](_0x432b90)){throw new Error(_0x34625e+_0xd8ce('0x5d'));}_0x46bf3e=_0x432b90;return _0x432b90[_0xd8ce('0x5e')]({'read':0x0,'readAt':null,'UserId':null});})[_0xd8ce('0x8')](function(){var _0x5b97c0={'uniqueid':_0x5d0579+'.'+_0x46bf3e['id']+'.'+_0x46bf3e['Interaction']['id'],'FromUserId':_0x3695e4[_0xd8ce('0x2e')]['id'],'type':_0xd8ce('0x5f'),'ToUserId':_0x3ba2a7['id']};_0x5b97c0[_0x34625e+_0xd8ce('0x60')]=_0x46bf3e['id'];_0x5b97c0[_0x34625e+_0xd8ce('0x61')]=_0x46bf3e['Interaction']['id'];_0x5b97c0['From'+_0x34625e+_0x15a968+'Id']=_0x46bf3e[_0xd8ce('0x5a')]['id'];return db[_0x34625e+'TransferReport'][_0xd8ce('0x6b')](_0x5b97c0);})[_0xd8ce('0x8')](function(){return respondWithRpcPromise(_0xd8ce('0x65'),{'channel':_0x5d0579,'interaction':_0x46bf3e[_0xd8ce('0x5c')],'message':_0x46bf3e,'account':_0x46bf3e['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xd8ce('0x39'),'appdata':_0x3ba2a7[_0xd8ce('0x10')]+','+(_0x46bf3e[_0xd8ce('0x5a')][_0xd8ce('0x6c')]||0x12c),'interval':_0xd8ce('0x67')}]},routingClient);})[_0xd8ce('0x8')](respondWithResult(_0x478c36,null))[_0xd8ce('0xc')](handleError(_0x478c36,null));}; \ No newline at end of file +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 diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index e7aba99..87395b4 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 _0x42e8=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show','run','post','create','put','delete','exports','multer','util'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x42e8,0x18e));var _0x842e=function(_0x2f7aea,_0x2e60c2){_0x2f7aea=_0x2f7aea-0x0;var _0x17c57a=_0x42e8[_0x2f7aea];return _0x17c57a;};'use strict';var multer=require(_0x842e('0x0'));var util=require(_0x842e('0x1'));var path=require(_0x842e('0x2'));var timeout=require(_0x842e('0x3'));var express=require('express');var router=express[_0x842e('0x4')]();var auth=require(_0x842e('0x5'));var interaction=require(_0x842e('0x6'));var config=require(_0x842e('0x7'));var controller=require(_0x842e('0x8'));router[_0x842e('0x9')]('/',auth[_0x842e('0xa')](),controller[_0x842e('0xb')]);router[_0x842e('0x9')](_0x842e('0xc'),auth[_0x842e('0xa')](),controller[_0x842e('0xd')]);router[_0x842e('0x9')]('/:id/run',auth[_0x842e('0xa')](),controller[_0x842e('0xe')]);router[_0x842e('0xf')]('/',auth[_0x842e('0xa')](),controller[_0x842e('0x10')]);router[_0x842e('0x11')](_0x842e('0xc'),auth[_0x842e('0xa')](),controller['update']);router[_0x842e('0x12')](_0x842e('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x842e('0x13')]=router; \ No newline at end of file +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 diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index a279ff7..e8d61ea 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 _0xd9ef=['DATE','INTEGER','ENUM','years','quarters','months','weeks','days','hours','minutes','pdf','xlsx','custom','default','BOOLEAN','TEXT','sequelize','exports','STRING'];(function(_0x236c89,_0xd76ba9){var _0x3b2a15=function(_0x89e4f9){while(--_0x89e4f9){_0x236c89['push'](_0x236c89['shift']());}};_0x3b2a15(++_0xd76ba9);}(_0xd9ef,0x95));var _0xfd9e=function(_0x237f07,_0x2142a9){_0x237f07=_0x237f07-0x0;var _0x22c133=_0xd9ef[_0x237f07];return _0x22c133;};'use strict';var Sequelize=require(_0xfd9e('0x0'));module[_0xfd9e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xfd9e('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xfd9e('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0xfd9e('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xfd9e('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xfd9e('0x5')](_0xfd9e('0x6'),_0xfd9e('0x7'),_0xfd9e('0x8'),_0xfd9e('0x9'),_0xfd9e('0xa'),_0xfd9e('0xb'),_0xfd9e('0xc')),'allowNull':![],'defaultValue':_0xfd9e('0xa')},'output':{'type':Sequelize[_0xfd9e('0x5')]('csv',_0xfd9e('0xd'),_0xfd9e('0xe')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0xfd9e('0x5')](_0xfd9e('0xf'),_0xfd9e('0x10')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xfd9e('0x11')],'defaultValue':![]},'email':{'type':Sequelize[_0xfd9e('0x2')]},'cc':{'type':Sequelize[_0xfd9e('0x12')]},'bcc':{'type':Sequelize[_0xfd9e('0x12')]},'sendIfEmpty':{'type':Sequelize[_0xfd9e('0x11')],'defaultValue':!![]}}; \ No newline at end of file +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 diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index a6c62ed..1898f8e 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 _0x23a6=['get','Scheduler','UserProfileResource','error','stack','name','send','index','map','fieldName','type','key','model','filters','query','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','options','Schedule','count','include','findAll','catch','show','keys','rawAttributes','intersection','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','update','body','destroy','params','run','../../config/schedule','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','set','json','apply','reject','then'];(function(_0x473309,_0x4bd3f1){var _0x43a960=function(_0x3cb9ac){while(--_0x3cb9ac){_0x473309['push'](_0x473309['shift']());}};_0x43a960(++_0x4bd3f1);}(_0x23a6,0xdc));var _0x623a=function(_0x43aded,_0xd35150){_0x43aded=_0x43aded-0x0;var _0x4cb0c8=_0x23a6[_0x43aded];return _0x4cb0c8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x623a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x623a('0x1'));var jsonpatch=require(_0x623a('0x2'));var rp=require('request-promise');var moment=require(_0x623a('0x3'));var BPromise=require(_0x623a('0x4'));var Mustache=require(_0x623a('0x5'));var util=require(_0x623a('0x6'));var path=require(_0x623a('0x7'));var sox=require(_0x623a('0x8'));var csv=require(_0x623a('0x9'));var ejs=require(_0x623a('0xa'));var fs=require('fs');var _=require(_0x623a('0xb'));var squel=require(_0x623a('0xc'));var crypto=require(_0x623a('0xd'));var jsforce=require(_0x623a('0xe'));var deskjs=require(_0x623a('0xf'));var toCsv=require(_0x623a('0x9'));var querystring=require(_0x623a('0x10'));var Papa=require(_0x623a('0x11'));var Redis=require(_0x623a('0x12'));var authService=require(_0x623a('0x13'));var qs=require(_0x623a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x623a('0x15'))(_0x623a('0x16'));var utils=require(_0x623a('0x17'));var config=require(_0x623a('0x18'));var db=require(_0x623a('0x19'))['db'];function respondWithStatusCode(_0x254bdd,_0x134e12){_0x134e12=_0x134e12||0xcc;return function(_0x2c935d){if(_0x2c935d){return _0x254bdd[_0x623a('0x1a')](_0x134e12);}return _0x254bdd[_0x623a('0x1b')](_0x134e12)[_0x623a('0x1c')]();};}function respondWithResult(_0x6685ea,_0x3709da){_0x3709da=_0x3709da||0xc8;return function(_0x4bca91){if(_0x4bca91){return _0x6685ea[_0x623a('0x1b')](_0x3709da)['json'](_0x4bca91);}};}function respondWithFilteredResult(_0x5873d9,_0x16ac01){return function(_0x3a1268){if(_0x3a1268){var _0x100bb8=_0x3a1268['count'],_0x450779=_0x16ac01[_0x623a('0x1d')],_0x2a4429=_0x16ac01['offset']+_0x16ac01['limit'],_0xcb7f5e;if(_0x2a4429>=_0x100bb8){_0x2a4429=_0x100bb8;_0xcb7f5e=0xc8;}else{_0xcb7f5e=0xce;}_0x5873d9['status'](_0xcb7f5e);return _0x5873d9[_0x623a('0x1e')]('Content-Range',_0x450779+'-'+_0x2a4429+'/'+_0x100bb8)[_0x623a('0x1f')](_0x3a1268);}return null;};}function patchUpdates(_0x31c562){return function(_0x3830f9){try{jsonpatch[_0x623a('0x20')](_0x3830f9,_0x31c562,!![]);}catch(_0x402f01){return BPromise[_0x623a('0x21')](_0x402f01);}return _0x3830f9['save']();};}function saveUpdates(_0x4ea25a,_0x1e298d){return function(_0x145f7e){if(_0x145f7e){return _0x145f7e['update'](_0x4ea25a)[_0x623a('0x22')](function(_0xe086a1){return _0xe086a1;});}return null;};}function removeEntity(_0x27a7b9,_0x3702a7){return function(_0x44d5bf){if(_0x44d5bf){return _0x44d5bf['destroy']()[_0x623a('0x22')](function(){var _0x962f5e=_0x44d5bf[_0x623a('0x23')]({'plain':!![]});var _0x4203b0=_0x623a('0x24');return db[_0x623a('0x25')]['destroy']({'where':{'type':_0x4203b0,'resourceId':_0x962f5e['id']}})[_0x623a('0x22')](function(){return _0x44d5bf;});})[_0x623a('0x22')](function(){_0x27a7b9[_0x623a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46c4e1,_0x445eac){return function(_0x1c398f){if(!_0x1c398f){_0x46c4e1[_0x623a('0x1a')](0x194);}return _0x1c398f;};}function handleError(_0x186c3f,_0x277a94){_0x277a94=_0x277a94||0x1f4;return function(_0x262cc9){logger[_0x623a('0x26')](_0x262cc9[_0x623a('0x27')]);if(_0x262cc9[_0x623a('0x28')]){delete _0x262cc9[_0x623a('0x28')];}_0x186c3f[_0x623a('0x1b')](_0x277a94)[_0x623a('0x29')](_0x262cc9);};}exports[_0x623a('0x2a')]=function(_0x399410,_0x454bbf){var _0xf27c5d={},_0x350894={},_0x1c5809={'count':0x0,'rows':[]};var _0x36e189=_[_0x623a('0x2b')](db['Schedule']['rawAttributes'],function(_0x11e6cf){return{'name':_0x11e6cf[_0x623a('0x2c')],'type':_0x11e6cf[_0x623a('0x2d')][_0x623a('0x2e')]};});_0x350894[_0x623a('0x2f')]=_[_0x623a('0x2b')](_0x36e189,_0x623a('0x28'));_0x350894['query']=_['keys'](_0x399410['query']);_0x350894[_0x623a('0x30')]=_['intersection'](_0x350894['model'],_0x350894[_0x623a('0x31')]);_0xf27c5d['attributes']=_['intersection'](_0x350894['model'],qs[_0x623a('0x32')](_0x399410[_0x623a('0x31')][_0x623a('0x32')]));_0xf27c5d['attributes']=_0xf27c5d[_0x623a('0x33')][_0x623a('0x34')]?_0xf27c5d[_0x623a('0x33')]:_0x350894[_0x623a('0x2f')];if(!_0x399410[_0x623a('0x31')][_0x623a('0x35')](_0x623a('0x36'))){_0xf27c5d['limit']=qs[_0x623a('0x37')](_0x399410[_0x623a('0x31')]['limit']);_0xf27c5d[_0x623a('0x1d')]=qs[_0x623a('0x1d')](_0x399410['query'][_0x623a('0x1d')]);}_0xf27c5d[_0x623a('0x38')]=qs['sort'](_0x399410[_0x623a('0x31')][_0x623a('0x39')]);_0xf27c5d['where']=qs[_0x623a('0x30')](_['pick'](_0x399410[_0x623a('0x31')],_0x350894['filters']));if(_0x399410[_0x623a('0x31')][_0x623a('0x3a')]){_0xf27c5d[_0x623a('0x3b')]=_[_0x623a('0x3c')](_0xf27c5d['where'],{'$or':_[_0x623a('0x2b')](_0x36e189,function(_0x4c78ae){if(_0x4c78ae[_0x623a('0x2d')]!=='VIRTUAL'){var _0x518996={};_0x518996[_0x4c78ae['name']]={'$like':'%'+_0x399410['query']['filter']+'%'};return _0x518996;}})});}_0xf27c5d=_[_0x623a('0x3c')]({},_0xf27c5d,_0x399410[_0x623a('0x3d')]);var _0x33af6c={'where':_0xf27c5d['where']};return db[_0x623a('0x3e')]['count'](_0x33af6c)[_0x623a('0x22')](function(_0x233265){_0x1c5809[_0x623a('0x3f')]=_0x233265;if(_0x399410['query']['includeAll']){_0xf27c5d[_0x623a('0x40')]=[{'all':!![]}];}return db[_0x623a('0x3e')][_0x623a('0x41')](_0xf27c5d);})[_0x623a('0x22')](function(_0x272f4d){_0x1c5809['rows']=_0x272f4d;return _0x1c5809;})[_0x623a('0x22')](respondWithFilteredResult(_0x454bbf,_0xf27c5d))[_0x623a('0x42')](handleError(_0x454bbf,null));};exports[_0x623a('0x43')]=function(_0x5cf1b4,_0x25f58b){var _0x7e814a={'raw':![],'where':{'id':_0x5cf1b4['params']['id']}},_0x2a438d={};_0x2a438d[_0x623a('0x2f')]=_[_0x623a('0x44')](db[_0x623a('0x3e')][_0x623a('0x45')]);_0x2a438d[_0x623a('0x31')]=_['keys'](_0x5cf1b4[_0x623a('0x31')]);_0x2a438d['filters']=_['intersection'](_0x2a438d[_0x623a('0x2f')],_0x2a438d['query']);_0x7e814a[_0x623a('0x33')]=_[_0x623a('0x46')](_0x2a438d[_0x623a('0x2f')],qs[_0x623a('0x32')](_0x5cf1b4[_0x623a('0x31')][_0x623a('0x32')]));_0x7e814a[_0x623a('0x33')]=_0x7e814a[_0x623a('0x33')][_0x623a('0x34')]?_0x7e814a[_0x623a('0x33')]:_0x2a438d['model'];if(_0x5cf1b4[_0x623a('0x31')][_0x623a('0x47')]){_0x7e814a[_0x623a('0x40')]=[{'all':!![]}];}_0x7e814a=_[_0x623a('0x3c')]({},_0x7e814a,_0x5cf1b4[_0x623a('0x3d')]);return db[_0x623a('0x3e')][_0x623a('0x48')](_0x7e814a)[_0x623a('0x22')](handleEntityNotFound(_0x25f58b,null))[_0x623a('0x22')](respondWithResult(_0x25f58b,null))[_0x623a('0x42')](handleError(_0x25f58b,null));};exports['create']=function(_0x1b785b,_0x1dca4c){return db[_0x623a('0x3e')][_0x623a('0x49')](_0x1b785b['body'],{})[_0x623a('0x22')](function(_0xed5010){var _0x34e918=_0x1b785b[_0x623a('0x4a')][_0x623a('0x23')]({'plain':!![]});if(!_0x34e918)throw new Error(_0x623a('0x4b'));if(_0x34e918['role']==='user'){var _0x1139fb=_0xed5010['get']({'plain':!![]});var _0x1a5444=_0x623a('0x24');return db[_0x623a('0x4c')][_0x623a('0x48')]({'where':{'name':_0x1a5444,'userProfileId':_0x34e918[_0x623a('0x4d')]},'raw':!![]})[_0x623a('0x22')](function(_0x1522ec){if(_0x1522ec&&_0x1522ec[_0x623a('0x4e')]===0x0){return db['UserProfileResource'][_0x623a('0x49')]({'name':_0x1139fb[_0x623a('0x28')],'resourceId':_0x1139fb['id'],'type':_0x1522ec[_0x623a('0x28')],'sectionId':_0x1522ec['id']},{})['then'](function(){return _0xed5010;});}else{return _0xed5010;}})[_0x623a('0x42')](function(_0x1a2d86){logger[_0x623a('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a2d86);throw _0x1a2d86;});}return _0xed5010;})['then'](respondWithResult(_0x1dca4c,0xc9))['catch'](handleError(_0x1dca4c,null));};exports[_0x623a('0x4f')]=function(_0x50f641,_0x1a406d){if(_0x50f641[_0x623a('0x50')]['id']){delete _0x50f641[_0x623a('0x50')]['id'];}return db[_0x623a('0x3e')][_0x623a('0x48')]({'where':{'id':_0x50f641['params']['id']}})[_0x623a('0x22')](handleEntityNotFound(_0x1a406d,null))[_0x623a('0x22')](saveUpdates(_0x50f641['body'],null))[_0x623a('0x22')](respondWithResult(_0x1a406d,null))['catch'](handleError(_0x1a406d,null));};exports[_0x623a('0x51')]=function(_0x8f6618,_0x48c42e){return db[_0x623a('0x3e')][_0x623a('0x48')]({'where':{'id':_0x8f6618[_0x623a('0x52')]['id']}})[_0x623a('0x22')](handleEntityNotFound(_0x48c42e,null))[_0x623a('0x22')](removeEntity(_0x48c42e,null))[_0x623a('0x42')](handleError(_0x48c42e,null));};exports[_0x623a('0x53')]=function(_0xfd467d,_0x8b38d7,_0x68a375){var _0x3ca513=require(_0x623a('0x54'));return db[_0x623a('0x3e')][_0x623a('0x48')]({'where':{'id':_0xfd467d['params']['id']},'raw':!![]})[_0x623a('0x22')](handleEntityNotFound(_0x8b38d7,null))[_0x623a('0x22')](function(){_0x3ca513[_0x623a('0x53')](_0xfd467d[_0x623a('0x52')]['id']);})['then'](respondWithStatusCode(_0x8b38d7,null))[_0x623a('0x42')](handleError(_0x8b38d7,null));}; \ No newline at end of file +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 diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 3373576..f7214ed 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 _0xf4a8=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./schedule.attributes','define','Schedule','tools_schedules','lodash'];(function(_0x5820df,_0x24240a){var _0x7a47f1=function(_0x37410b){while(--_0x37410b){_0x5820df['push'](_0x5820df['shift']());}};_0x7a47f1(++_0x24240a);}(_0xf4a8,0x173));var _0x8f4a=function(_0x3d2012,_0x3d02b9){_0x3d2012=_0x3d2012-0x0;var _0x53d542=_0xf4a8[_0x3d2012];return _0x53d542;};'use strict';var _=require(_0x8f4a('0x0'));var util=require(_0x8f4a('0x1'));var logger=require(_0x8f4a('0x2'))(_0x8f4a('0x3'));var moment=require(_0x8f4a('0x4'));var BPromise=require('bluebird');var rp=require(_0x8f4a('0x5'));var fs=require('fs');var path=require(_0x8f4a('0x6'));var rimraf=require('rimraf');var config=require(_0x8f4a('0x7'));var attributes=require(_0x8f4a('0x8'));module['exports']=function(_0x41b275,_0x44790c){return _0x41b275[_0x8f4a('0x9')](_0x8f4a('0xa'),attributes,{'tableName':_0x8f4a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index cb4c4f0..c39a219 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 _0xc5d0=['Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3cb8c6,_0x5ce222){var _0x28d031=function(_0x2eaacb){while(--_0x2eaacb){_0x3cb8c6['push'](_0x3cb8c6['shift']());}};_0x28d031(++_0x5ce222);}(_0xc5d0,0x14f));var _0x0c5d=function(_0x321206,_0x22269d){_0x321206=_0x321206-0x0;var _0xb3746b=_0xc5d0[_0x321206];return _0xb3746b;};'use strict';var _=require(_0x0c5d('0x0'));var util=require(_0x0c5d('0x1'));var moment=require('moment');var BPromise=require(_0x0c5d('0x2'));var rs=require(_0x0c5d('0x3'));var fs=require('fs');var Redis=require(_0x0c5d('0x4'));var db=require(_0x0c5d('0x5'))['db'];var utils=require(_0x0c5d('0x6'));var logger=require(_0x0c5d('0x7'))(_0x0c5d('0x8'));var config=require(_0x0c5d('0x9'));var jayson=require(_0x0c5d('0xa'));var client=jayson[_0x0c5d('0xb')][_0x0c5d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x552725,_0x234e64,_0x1553b1){return new BPromise(function(_0x1c4a33,_0x30bd46){return client[_0x0c5d('0xd')](_0x552725,_0x1553b1)[_0x0c5d('0xe')](function(_0x3f57bd){logger['info'](_0x0c5d('0xf'),_0x234e64,_0x0c5d('0x10'));logger[_0x0c5d('0x11')](_0x0c5d('0x12'),_0x234e64,_0x0c5d('0x10'),JSON[_0x0c5d('0x13')](_0x3f57bd));if(_0x3f57bd[_0x0c5d('0x14')]){if(_0x3f57bd[_0x0c5d('0x14')][_0x0c5d('0x15')]===0x1f4){logger[_0x0c5d('0x14')]('Schedule,\x20%s,\x20%s',_0x234e64,_0x3f57bd[_0x0c5d('0x14')][_0x0c5d('0x16')]);return _0x30bd46(_0x3f57bd['error'][_0x0c5d('0x16')]);}logger['error'](_0x0c5d('0xf'),_0x234e64,_0x3f57bd[_0x0c5d('0x14')][_0x0c5d('0x16')]);return _0x1c4a33(_0x3f57bd[_0x0c5d('0x14')][_0x0c5d('0x16')]);}else{logger['info']('Schedule,\x20%s,\x20%s',_0x234e64,_0x0c5d('0x10'));_0x1c4a33(_0x3f57bd[_0x0c5d('0x17')][_0x0c5d('0x16')]);}})[_0x0c5d('0x18')](function(_0x4ea27d){logger[_0x0c5d('0x14')](_0x0c5d('0xf'),_0x234e64,_0x4ea27d);_0x30bd46(_0x4ea27d);});});} \ No newline at end of file +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 diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 39a47bd..976328d 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 _0xb7c1=['../../components/interaction/service','./screenRecording.controller','get','index','/describe','isAuthenticated','describe','show','/:id/download','download','post','put','/:id','update','destroy','exports','multer','connect-timeout','express','../../components/auth/service'];(function(_0x43b95f,_0x22f503){var _0x33c322=function(_0x355e3d){while(--_0x355e3d){_0x43b95f['push'](_0x43b95f['shift']());}};_0x33c322(++_0x22f503);}(_0xb7c1,0x74));var _0x1b7c=function(_0x41dc03,_0x171061){_0x41dc03=_0x41dc03-0x0;var _0x1c0d4a=_0xb7c1[_0x41dc03];return _0x1c0d4a;};'use strict';var multer=require(_0x1b7c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1b7c('0x1'));var express=require(_0x1b7c('0x2'));var router=express['Router']();var auth=require(_0x1b7c('0x3'));var interaction=require(_0x1b7c('0x4'));var config=require('../../config/environment');var controller=require(_0x1b7c('0x5'));router[_0x1b7c('0x6')]('/',auth['isAuthenticated'](),controller[_0x1b7c('0x7')]);router['get'](_0x1b7c('0x8'),auth[_0x1b7c('0x9')](),controller[_0x1b7c('0xa')]);router[_0x1b7c('0x6')]('/:id',auth[_0x1b7c('0x9')](),controller[_0x1b7c('0xb')]);router['get'](_0x1b7c('0xc'),auth[_0x1b7c('0x9')](),controller[_0x1b7c('0xd')]);router[_0x1b7c('0xe')]('/',auth[_0x1b7c('0x9')](),controller['create']);router[_0x1b7c('0xf')](_0x1b7c('0x10'),auth['isAuthenticated'](),controller[_0x1b7c('0x11')]);router['delete'](_0x1b7c('0x10'),auth[_0x1b7c('0x9')](),controller[_0x1b7c('0x12')]);module[_0x1b7c('0x13')]=router; \ No newline at end of file +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 diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 0580f1e..664b43d 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 _0x5636=['format','MM-DD-YYYY\x20HH:mm','toString','closedAt','createdAt','updatedAt','sequelize','moment','VIRTUAL','getDataValue','value','STRING','replace','setDataValue','INTEGER','subtract','DATE','startedAt'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5636,0x102));var _0x6563=function(_0x7e0934,_0x12ae86){_0x7e0934=_0x7e0934-0x0;var _0xc0d2e4=_0x5636[_0x7e0934];return _0xc0d2e4;};'use strict';var Sequelize=require(_0x6563('0x0'));var moment=require(_0x6563('0x1'));var path=require('path');var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize[_0x6563('0x2')],'get':function(){return this[_0x6563('0x3')](_0x6563('0x4'))?path['extname'](this[_0x6563('0x3')](_0x6563('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0x6563('0x5')]},'channel':{'type':Sequelize[_0x6563('0x5')]},'value':{'type':Sequelize[_0x6563('0x5')],'set':function(_0x193942){var _0x9884a9=_0x193942[_0x6563('0x6')](/\\/g,'/');this[_0x6563('0x7')](_0x6563('0x4'),_0x9884a9);}},'rating':{'type':Sequelize[_0x6563('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x6563('0x8')],'set':function(_0x3ccb4e){this['setDataValue']('startedAt',moment()[_0x6563('0x9')](_0x3ccb4e,'ms'));this[_0x6563('0x7')]('closedAt',moment());this['setDataValue']('duration',_0x3ccb4e);}},'startedAt':{'type':Sequelize[_0x6563('0xa')],'get':function(){return moment(this[_0x6563('0x3')](_0x6563('0xb')))[_0x6563('0xc')](_0x6563('0xd'))[_0x6563('0xe')]();}},'closedAt':{'type':Sequelize[_0x6563('0xa')],'get':function(){return moment(this[_0x6563('0x3')](_0x6563('0xf')))['format'](_0x6563('0xd'))['toString']();}},'createdAt':{'type':Sequelize[_0x6563('0xa')],'get':function(){return moment(this[_0x6563('0x3')](_0x6563('0x10')))[_0x6563('0xc')]('MM-DD-YYYY\x20HH:mm')[_0x6563('0xe')]();}},'updatedAt':{'type':Sequelize[_0x6563('0xa')],'get':function(){return moment(this[_0x6563('0x3')](_0x6563('0x11')))['format'](_0x6563('0xd'))['toString']();}}}; \ No newline at end of file +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 diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 0bb1883..3d3cfa6 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 _0x13d9=['Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','destroy','html-pdf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','save','update','then','error','name','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','create','body','duration','createdAt','closedAt','value','find','describe','download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','decryptFile','recording','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','message','send','Not\x20found'];(function(_0x14c875,_0x3beebe){var _0x593f50=function(_0x4a3d0d){while(--_0x4a3d0d){_0x14c875['push'](_0x14c875['shift']());}};_0x593f50(++_0x3beebe);}(_0x13d9,0xd8));var _0x913d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x13d9[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x913d('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x913d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x913d('0x2'));var moment=require('moment');var BPromise=require(_0x913d('0x3'));var Mustache=require(_0x913d('0x4'));var util=require(_0x913d('0x5'));var path=require(_0x913d('0x6'));var sox=require(_0x913d('0x7'));var csv=require(_0x913d('0x8'));var ejs=require(_0x913d('0x9'));var fs=require('fs');var _=require(_0x913d('0xa'));var squel=require(_0x913d('0xb'));var crypto=require(_0x913d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x913d('0xd'));var toCsv=require(_0x913d('0x8'));var querystring=require(_0x913d('0xe'));var Papa=require(_0x913d('0xf'));var Redis=require(_0x913d('0x10'));var authService=require(_0x913d('0x11'));var qs=require(_0x913d('0x12'));var as=require(_0x913d('0x13'));var hardwareService=require(_0x913d('0x14'));var logger=require(_0x913d('0x15'))('api');var utils=require(_0x913d('0x16'));var config=require(_0x913d('0x17'));var db=require(_0x913d('0x18'))['db'];function respondWithStatusCode(_0x1acc0f,_0x5d80b9){_0x5d80b9=_0x5d80b9||0xcc;return function(_0x3ed7b7){if(_0x3ed7b7){return _0x1acc0f[_0x913d('0x19')](_0x5d80b9);}return _0x1acc0f[_0x913d('0x1a')](_0x5d80b9)[_0x913d('0x1b')]();};}function respondWithResult(_0x290984,_0x511b42){_0x511b42=_0x511b42||0xc8;return function(_0x49fec9){if(_0x49fec9){return _0x290984[_0x913d('0x1a')](_0x511b42)['json'](_0x49fec9);}};}function respondWithFilteredResult(_0xf0cf07,_0x2b0698){return function(_0x10cacf){if(_0x10cacf){var _0x43590=_0x10cacf[_0x913d('0x1c')],_0x36e890=_0x2b0698[_0x913d('0x1d')],_0x5bd6e8=_0x2b0698['offset']+_0x2b0698[_0x913d('0x1e')],_0x5ec418;if(_0x5bd6e8>=_0x43590){_0x5bd6e8=_0x43590;_0x5ec418=0xc8;}else{_0x5ec418=0xce;}_0xf0cf07[_0x913d('0x1a')](_0x5ec418);return _0xf0cf07['set'](_0x913d('0x1f'),_0x36e890+'-'+_0x5bd6e8+'/'+_0x43590)[_0x913d('0x20')](_0x10cacf);}return null;};}function patchUpdates(_0x5ebebb){return function(_0x1758ac){try{jsonpatch[_0x913d('0x21')](_0x1758ac,_0x5ebebb,!![]);}catch(_0x4dbd00){return BPromise['reject'](_0x4dbd00);}return _0x1758ac[_0x913d('0x22')]();};}function saveUpdates(_0x5eb3b5,_0x2c0135){return function(_0x59caa0){if(_0x59caa0){return _0x59caa0[_0x913d('0x23')](_0x5eb3b5)[_0x913d('0x24')](function(_0x198f64){return _0x198f64;});}return null;};}function removeEntity(_0x33c079,_0x2c0482){return function(_0xc38c62){if(_0xc38c62){return _0xc38c62['destroy']()[_0x913d('0x24')](function(){_0x33c079[_0x913d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa8a13d,_0x3c5c6b){return function(_0xf66ca){if(!_0xf66ca){_0xa8a13d[_0x913d('0x19')](0x194);}return _0xf66ca;};}function handleError(_0x61dabb,_0x557855){_0x557855=_0x557855||0x1f4;return function(_0x4e16a6){logger[_0x913d('0x25')](_0x4e16a6['stack']);if(_0x4e16a6['name']){delete _0x4e16a6[_0x913d('0x26')];}_0x61dabb[_0x913d('0x1a')](_0x557855)['send'](_0x4e16a6);};}exports[_0x913d('0x27')]=function(_0x2770dd,_0x371d2d){var _0x491855={},_0x169f24={},_0x347991={'count':0x0,'rows':[]};var _0x5deedc=_[_0x913d('0x28')](db[_0x913d('0x29')][_0x913d('0x2a')],function(_0x5a6136){return{'name':_0x5a6136[_0x913d('0x2b')],'type':_0x5a6136[_0x913d('0x2c')][_0x913d('0x2d')]};});_0x169f24[_0x913d('0x2e')]=_[_0x913d('0x2f')](_[_0x913d('0x28')](_0x5deedc,_0x913d('0x26')),[_0x913d('0x30')]);_0x169f24[_0x913d('0x31')]=_[_0x913d('0x32')](_0x2770dd[_0x913d('0x31')]);_0x169f24[_0x913d('0x33')]=_[_0x913d('0x34')](_0x169f24[_0x913d('0x2e')],_0x169f24[_0x913d('0x31')]);_0x491855[_0x913d('0x35')]=_[_0x913d('0x34')](_0x169f24[_0x913d('0x2e')],qs[_0x913d('0x36')](_0x2770dd[_0x913d('0x31')][_0x913d('0x36')]));_0x491855['attributes']=_0x491855[_0x913d('0x35')][_0x913d('0x37')]?_0x491855[_0x913d('0x35')]:_0x169f24[_0x913d('0x2e')];if(!_0x2770dd[_0x913d('0x31')][_0x913d('0x38')](_0x913d('0x39'))){_0x491855[_0x913d('0x1e')]=qs['limit'](_0x2770dd['query'][_0x913d('0x1e')]);_0x491855[_0x913d('0x1d')]=qs[_0x913d('0x1d')](_0x2770dd[_0x913d('0x31')]['offset']);}_0x491855[_0x913d('0x3a')]=qs[_0x913d('0x3b')](_0x2770dd[_0x913d('0x31')][_0x913d('0x3b')]);_0x491855[_0x913d('0x3c')]=qs[_0x913d('0x33')](_[_0x913d('0x3d')](_0x2770dd['query'],_0x169f24[_0x913d('0x33')]));if(_0x2770dd[_0x913d('0x31')][_0x913d('0x3e')]){_0x491855['where']=_[_0x913d('0x3f')](_0x491855[_0x913d('0x3c')],{'$or':_['map'](_0x5deedc,function(_0x1c5e96){if(_0x1c5e96[_0x913d('0x2c')]!=='VIRTUAL'){var _0x45e827={};_0x45e827[_0x1c5e96[_0x913d('0x26')]]={'$like':'%'+_0x2770dd['query']['filter']+'%'};return _0x45e827;}})});}_0x491855=_[_0x913d('0x3f')]({},_0x491855,_0x2770dd[_0x913d('0x40')]);var _0x550895={'where':_0x491855[_0x913d('0x3c')]};return db[_0x913d('0x29')][_0x913d('0x1c')](_0x550895)[_0x913d('0x24')](function(_0x45f190){_0x347991['count']=_0x45f190;if(_0x2770dd[_0x913d('0x31')][_0x913d('0x41')]){_0x491855[_0x913d('0x42')]=[{'all':!![]}];}return db[_0x913d('0x29')][_0x913d('0x43')](_0x491855);})[_0x913d('0x24')](function(_0xa82454){_0x347991['rows']=_0xa82454;return _0x347991;})[_0x913d('0x24')](respondWithFilteredResult(_0x371d2d,_0x491855))[_0x913d('0x44')](handleError(_0x371d2d,null));};exports[_0x913d('0x45')]=function(_0x2c96b9,_0x21c9c8){var _0x5f49e5={'raw':![],'where':{'id':_0x2c96b9[_0x913d('0x46')]['id']}},_0x2679b6={};_0x2679b6['model']=_[_0x913d('0x32')](db[_0x913d('0x29')][_0x913d('0x2a')]);_0x2679b6[_0x913d('0x31')]=_[_0x913d('0x32')](_0x2c96b9[_0x913d('0x31')]);_0x2679b6[_0x913d('0x33')]=_[_0x913d('0x34')](_0x2679b6[_0x913d('0x2e')],_0x2679b6[_0x913d('0x31')]);_0x5f49e5[_0x913d('0x35')]=_[_0x913d('0x34')](_0x2679b6[_0x913d('0x2e')],qs['fields'](_0x2c96b9[_0x913d('0x31')][_0x913d('0x36')]));_0x5f49e5[_0x913d('0x35')]=_0x5f49e5[_0x913d('0x35')][_0x913d('0x37')]?_0x5f49e5[_0x913d('0x35')]:_0x2679b6['model'];if(_0x2c96b9[_0x913d('0x31')][_0x913d('0x41')]){_0x5f49e5[_0x913d('0x42')]=[{'all':!![]}];}_0x5f49e5=_[_0x913d('0x3f')]({},_0x5f49e5,_0x2c96b9[_0x913d('0x40')]);return db[_0x913d('0x29')]['find'](_0x5f49e5)[_0x913d('0x24')](handleEntityNotFound(_0x21c9c8,null))[_0x913d('0x24')](respondWithResult(_0x21c9c8,null))[_0x913d('0x44')](handleError(_0x21c9c8,null));};exports['create']=function(_0x1d8683,_0x5122d1){return db[_0x913d('0x29')][_0x913d('0x47')](_0x1d8683[_0x913d('0x48')],{})['then'](respondWithResult(_0x5122d1,0xc9))['catch'](handleError(_0x5122d1,null));};exports['update']=function(_0x1d698b,_0x2e0195){if(_0x1d698b[_0x913d('0x48')]['id']){delete _0x1d698b[_0x913d('0x48')]['id'];}delete _0x1d698b[_0x913d('0x48')][_0x913d('0x49')];delete _0x1d698b['body'][_0x913d('0x4a')];delete _0x1d698b['body'][_0x913d('0x4b')];delete _0x1d698b['body'][_0x913d('0x4c')];return db[_0x913d('0x29')][_0x913d('0x4d')]({'where':{'id':_0x1d698b['params']['id']}})[_0x913d('0x24')](handleEntityNotFound(_0x2e0195,null))[_0x913d('0x24')](saveUpdates(_0x1d698b[_0x913d('0x48')],null))[_0x913d('0x24')](respondWithResult(_0x2e0195,null))[_0x913d('0x44')](handleError(_0x2e0195,null));};exports[_0x913d('0x4e')]=function(_0x2d3a5c,_0x3d217e){return db[_0x913d('0x29')]['describe']()[_0x913d('0x24')](respondWithResult(_0x3d217e,null))[_0x913d('0x44')](handleError(_0x3d217e,null));};exports[_0x913d('0x4f')]=function(_0xb4eb18,_0x51ba7c,_0x34453b){var _0x5c9636=require('../../components/encryptor');var _0x1baf69=![];var _0x5f425f={};if(_0xb4eb18[_0x913d('0x31')][_0x913d('0x2c')]&&_0xb4eb18['query'][_0x913d('0x2c')]===_0x913d('0x50')){_0x5f425f[_0x913d('0x50')]=_0xb4eb18[_0x913d('0x46')]['id'];}else{_0x5f425f['id']=_0xb4eb18[_0x913d('0x46')]['id'];}return db[_0x913d('0x29')][_0x913d('0x4d')]({'where':_0x5f425f,'attributes':['id',_0x913d('0x4c')],'raw':!![]})[_0x913d('0x24')](handleEntityNotFound(_0x51ba7c,null))[_0x913d('0x24')](function(_0x556cad){if(_0x556cad){var _0x423712=path[_0x913d('0x51')](config[_0x913d('0x52')],_0x913d('0x53'),_0x556cad[_0x913d('0x4c')]);var _0x4b8a02=util[_0x913d('0x30')](_0x913d('0x54'),_0x423712);if(fs['existsSync'](_0x4b8a02)){_0x1baf69=!![];return _0x5c9636[_0x913d('0x55')](_0x4b8a02,_0x423712,config['secrets'][_0x913d('0x56')])[_0x913d('0x24')](function(){return _0x556cad;});}return _0x556cad;}})['then'](function(_0x2d06b9){if(_0x2d06b9){var _0x2e2935=path[_0x913d('0x51')](config[_0x913d('0x52')],_0x913d('0x53'),_0x2d06b9[_0x913d('0x4c')]);if(!fs[_0x913d('0x57')](_0x2e2935)){throw new db[(_0x913d('0x58'))][(_0x913d('0x59'))](_0x913d('0x5a'));}if(_0x2d06b9[_0x913d('0x5b')]){return _0x51ba7c[_0x913d('0x4f')](_0x2e2935,_0x2d06b9[_0x913d('0x5b')]+path['extname'](_0x2e2935),function(){if(_0x1baf69){fs[_0x913d('0x5c')](_0x2e2935);}});}else{return _0x51ba7c[_0x913d('0x4f')](_0x2e2935,function(_0x5a7669){if(_0x1baf69){fs[_0x913d('0x5c')](_0x2e2935);}});}}})[_0x913d('0x44')](function(_0x31fd4c){if(_0x31fd4c[_0x913d('0x5d')]===_0x913d('0x5a')){_0x51ba7c[_0x913d('0x1a')](0x194)[_0x913d('0x5e')](_0x913d('0x5f'));}else{return handleError(_0x51ba7c,null);}});};exports['destroy']=function(_0x11a35e,_0x248f75){return db[_0x913d('0x29')][_0x913d('0x4d')]({'where':{'id':_0x11a35e['params']['id']}})[_0x913d('0x24')](function(_0x571625){if(!_0x571625)throw new ReferenceError(_0x913d('0x60'));return _0x571625;})[_0x913d('0x24')](function(_0x183aaf){var _0x599ad5=path[_0x913d('0x51')](config['root'],_0x913d('0x53'),_0x183aaf[_0x913d('0x4c')]);logger[_0x913d('0x61')](_0x913d('0x62'),_0x599ad5);if(!_[_0x913d('0x63')](_0x183aaf[_0x913d('0x4c')])&&fs[_0x913d('0x57')](_0x599ad5)){logger[_0x913d('0x61')]('File:\x20\x22'+_0x599ad5+_0x913d('0x64'));fs[_0x913d('0x65')](_0x599ad5);}_0x599ad5=_0x599ad5+_0x913d('0x66');if(!_[_0x913d('0x63')](_0x183aaf[_0x913d('0x4c')])&&fs['existsSync'](_0x599ad5)){logger['info']('File:\x20\x22'+_0x599ad5+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x599ad5);}return _0x183aaf;})[_0x913d('0x24')](function(_0x60347f){if(!_0x60347f)throw new InternalError();return _0x60347f[_0x913d('0x67')]();})[_0x913d('0x24')](function(){_0x248f75['status'](0xcc)[_0x913d('0x1b')]();})[_0x913d('0x44')](handleError(_0x248f75,null));}; \ No newline at end of file +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 diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index af361ed..2c965dd 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 _0x4c3d=['define','screen_recordings','interactionid','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./screenRecording.attributes','exports'];(function(_0x3997b9,_0x2d3851){var _0x241991=function(_0xea3b4f){while(--_0xea3b4f){_0x3997b9['push'](_0x3997b9['shift']());}};_0x241991(++_0x2d3851);}(_0x4c3d,0x1f1));var _0xd4c3=function(_0x20217b,_0x2a3b71){_0x20217b=_0x20217b-0x0;var _0x5643d9=_0x4c3d[_0x20217b];return _0x5643d9;};'use strict';var _=require(_0xd4c3('0x0'));var util=require('util');var logger=require(_0xd4c3('0x1'))(_0xd4c3('0x2'));var moment=require(_0xd4c3('0x3'));var BPromise=require(_0xd4c3('0x4'));var rp=require(_0xd4c3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd4c3('0x6'));var config=require(_0xd4c3('0x7'));var attributes=require(_0xd4c3('0x8'));module[_0xd4c3('0x9')]=function(_0x2e13f7,_0xdf24b5){return _0x2e13f7[_0xd4c3('0xa')]('ScreenRecording',attributes,{'tableName':_0xd4c3('0xb'),'paranoid':![],'indexes':[{'name':_0xd4c3('0xc'),'fields':[_0xd4c3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index dc626f6..dbeebba 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(_0x578df8,_0x3db818){var _0x313696=function(_0x5b59da){while(--_0x5b59da){_0x578df8['push'](_0x578df8['shift']());}};_0x313696(++_0x3db818);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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(_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 diff --git a/server/api/setting/index.js b/server/api/setting/index.js index a54466f..ed61487 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 _0x7882=['root','server/files/images/logos/','format','%s%s','extname','originalname','post','single','file','addLogo','addLogoLogin','preferred','addPreferred','favicon','addFavicon','put','update','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./setting.controller','get','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','gdpr','/:id/preferred','getFavicon','diskStorage','join'];(function(_0x580b15,_0x28afa4){var _0x1adb1b=function(_0x47a01f){while(--_0x47a01f){_0x580b15['push'](_0x580b15['shift']());}};_0x1adb1b(++_0x28afa4);}(_0x7882,0x81));var _0x2788=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x7882[_0x4fde08];return _0x12e725;};'use strict';var multer=require(_0x2788('0x0'));var util=require('util');var path=require(_0x2788('0x1'));var timeout=require(_0x2788('0x2'));var express=require(_0x2788('0x3'));var router=express[_0x2788('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2788('0x5'));var config=require(_0x2788('0x6'));var controller=require(_0x2788('0x7'));router[_0x2788('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2788('0x8')](_0x2788('0x9'),controller['show']);router[_0x2788('0x8')](_0x2788('0xa'),controller[_0x2788('0xb')]);router[_0x2788('0x8')](_0x2788('0xc'),controller[_0x2788('0xd')]);router[_0x2788('0x8')]('/:id/gdpr',controller[_0x2788('0xe')]);router[_0x2788('0x8')](_0x2788('0xf'),controller['getPreferred']);router['get']('/:id/favicon',controller[_0x2788('0x10')]);var upload=multer({'storage':multer[_0x2788('0x11')]({'destination':function(_0x2ea4da,_0x5bf352,_0x38799a){_0x38799a(null,path[_0x2788('0x12')](config[_0x2788('0x13')],_0x2788('0x14')));},'filename':function(_0x5150c1,_0x198245,_0x319cba){_0x319cba(null,util[_0x2788('0x15')](_0x2788('0x16'),'logo',path[_0x2788('0x17')](_0x198245[_0x2788('0x18')])));}})});router[_0x2788('0x19')](_0x2788('0xa'),upload[_0x2788('0x1a')](_0x2788('0x1b')),controller[_0x2788('0x1c')]);var upload=multer({'storage':multer[_0x2788('0x11')]({'destination':function(_0x47c1a9,_0xda7af8,_0x60e7eb){_0x60e7eb(null,path[_0x2788('0x12')](config[_0x2788('0x13')],_0x2788('0x14')));},'filename':function(_0x4a3fd7,_0x478db6,_0x486164){_0x486164(null,util[_0x2788('0x15')]('%s%s','logologin',path[_0x2788('0x17')](_0x478db6[_0x2788('0x18')])));}})});router['post'](_0x2788('0xc'),upload[_0x2788('0x1a')]('file'),controller[_0x2788('0x1d')]);var upload=multer({'storage':multer[_0x2788('0x11')]({'destination':function(_0x365c04,_0x17bcd5,_0xc2f99c){_0xc2f99c(null,path[_0x2788('0x12')](config['root'],_0x2788('0x14')));},'filename':function(_0x40eee9,_0x8c30c3,_0x1d8b06){_0x1d8b06(null,util['format'](_0x2788('0x16'),_0x2788('0x1e'),path[_0x2788('0x17')](_0x8c30c3[_0x2788('0x18')])));}})});router['post'](_0x2788('0xf'),upload[_0x2788('0x1a')](_0x2788('0x1b')),controller[_0x2788('0x1f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x37ebe1,_0x1d9e9b,_0x458d87){_0x458d87(null,path[_0x2788('0x12')](config[_0x2788('0x13')],_0x2788('0x14')));},'filename':function(_0x3ab2e3,_0x3bbe32,_0x1be240){_0x1be240(null,util[_0x2788('0x15')]('%s%s',_0x2788('0x20'),path[_0x2788('0x17')](_0x3bbe32[_0x2788('0x18')])));}})});router[_0x2788('0x19')]('/:id/favicon',upload[_0x2788('0x1a')](_0x2788('0x1b')),controller[_0x2788('0x21')]);router[_0x2788('0x22')]('/:id',auth['isAuthenticated'](),controller[_0x2788('0x23')]);module[_0x2788('0x24')]=router; \ No newline at end of file +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 diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index d4275fb..0ce135e 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 _0x23cf=['INTEGER','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','sequelize','exports','min_internal'];(function(_0x212843,_0x2cab29){var _0x16d9fa=function(_0x431d57){while(--_0x431d57){_0x212843['push'](_0x212843['shift']());}};_0x16d9fa(++_0x2cab29);}(_0x23cf,0x189));var _0xf23c=function(_0xb312c3,_0x41b1e3){_0xb312c3=_0xb312c3-0x0;var _0x430be8=_0x23cf[_0xb312c3];return _0x430be8;};'use strict';var Sequelize=require(_0xf23c('0x0'));module[_0xf23c('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0xf23c('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xf23c('0x3')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xf23c('0x3')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xf23c('0x4')],'defaultValue':_0xf23c('0x5')},'logo':{'type':Sequelize[_0xf23c('0x4')]},'defaultLogo':{'type':Sequelize[_0xf23c('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xf23c('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xf23c('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xf23c('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xf23c('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0xf23c('0x4')]},'turnpassword':{'type':Sequelize[_0xf23c('0x4')]},'pageTitle':{'type':Sequelize[_0xf23c('0x4')]},'defaultPageTitle':{'type':Sequelize[_0xf23c('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xf23c('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xf23c('0x3')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xf23c('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xf23c('0x4')],'defaultValue':_0xf23c('0x7')},'enableEmailPreview':{'type':Sequelize[_0xf23c('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0xf23c('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xf23c('0x3')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xf23c('0x8')},'chatTimeout':{'type':Sequelize[_0xf23c('0x3')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xf23c('0x4')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xf23c('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xf23c('0x4')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xf23c('0x4')]},'defaultFavicon':{'type':Sequelize[_0xf23c('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xf23c('0x3')],'defaultValue':0xa,'validate':{'min':0xa}},'googleSsoEnabled':{'type':Sequelize[_0xf23c('0x6')],'defaultValue':![]}}; \ No newline at end of file +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 diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 3678881..1e06920 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 _0x3a09=['model','attributes','fields','length','order','sort','where','pick','filter','merge','include','findAll','rows','show','params','includeAll','body','find','addLogo','file','filename','logo','addLogoLogin','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.png','default','upperFirst','\x20not\x20found','download','getLogoLogin','defaultLogo','default_loginLogo.png','custom','gdpr','securePassword','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','html-pdf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../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','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','Setting','rawAttributes','key','query','keys','filters','intersection'];(function(_0x2c4b9b,_0x4926e0){var _0x14b5a7=function(_0x530f3a){while(--_0x530f3a){_0x2c4b9b['push'](_0x2c4b9b['shift']());}};_0x14b5a7(++_0x4926e0);}(_0x3a09,0xaa));var _0x93a0=function(_0x1d2997,_0x507c39){_0x1d2997=_0x1d2997-0x0;var _0x4a16b6=_0x3a09[_0x1d2997];return _0x4a16b6;};'use strict';var pdf=require(_0x93a0('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x93a0('0x1'));var jsonpatch=require(_0x93a0('0x2'));var rp=require(_0x93a0('0x3'));var moment=require(_0x93a0('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x93a0('0x5'));var path=require('path');var sox=require(_0x93a0('0x6'));var csv=require(_0x93a0('0x7'));var ejs=require(_0x93a0('0x8'));var fs=require('fs');var _=require(_0x93a0('0x9'));var squel=require(_0x93a0('0xa'));var crypto=require('crypto');var jsforce=require(_0x93a0('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x93a0('0x7'));var querystring=require(_0x93a0('0xc'));var Papa=require(_0x93a0('0xd'));var Redis=require('ioredis');var authService=require(_0x93a0('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x93a0('0xf'));var logger=require(_0x93a0('0x10'))(_0x93a0('0x11'));var utils=require(_0x93a0('0x12'));var config=require(_0x93a0('0x13'));var db=require(_0x93a0('0x14'))['db'];var jayson=require(_0x93a0('0x15'));var client=jayson[_0x93a0('0x16')][_0x93a0('0x17')]({'port':0x232a});function checkPasswordPattern(_0x10dd24,_0xa76c68,_0x1ddff9){if(_0x1ddff9){var _0x324502=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x324502[_0x93a0('0x18')](_0xa76c68)){return _0x10dd24;}else{throw new db[(_0x93a0('0x19'))][(_0x93a0('0x1a'))](_0x93a0('0x1b'));}}else{return _0x10dd24;}}function respondWithRpcPromise(_0x1cf264,_0x55355a,_0x46d399,_0x32fd16){return new BPromise(function(_0x499bad,_0x503e6d){var _0x150952=_0x32fd16||client;return _0x150952['request'](_0x1cf264,_0x46d399)[_0x93a0('0x1c')](function(_0x1e23c6){logger['info'](_0x93a0('0x1d'),_0x55355a,_0x93a0('0x1e'));logger[_0x93a0('0x1f')](_0x93a0('0x20'),_0x55355a,'request\x20sent',JSON[_0x93a0('0x21')](_0x1e23c6));if(_0x1e23c6[_0x93a0('0x22')]){if(_0x1e23c6[_0x93a0('0x22')][_0x93a0('0x23')]===0x1f4){logger[_0x93a0('0x22')]('Setting,\x20%s,\x20%s',_0x55355a,_0x1e23c6[_0x93a0('0x22')][_0x93a0('0x24')]);return _0x503e6d(_0x1e23c6[_0x93a0('0x22')]['message']);}logger[_0x93a0('0x22')](_0x93a0('0x1d'),_0x55355a,_0x1e23c6[_0x93a0('0x22')][_0x93a0('0x24')]);return _0x499bad(_0x1e23c6[_0x93a0('0x22')]['message']);}else{logger['info'](_0x93a0('0x1d'),_0x55355a,_0x93a0('0x1e'));_0x499bad(_0x1e23c6[_0x93a0('0x25')][_0x93a0('0x24')]);}})[_0x93a0('0x26')](function(_0x166006){logger['error'](_0x93a0('0x1d'),_0x55355a,_0x166006);_0x503e6d(_0x166006);});});}function respondWithStatusCode(_0x3f33f6,_0x6deb4b){_0x6deb4b=_0x6deb4b||0xcc;return function(_0x35c2f4){if(_0x35c2f4){return _0x3f33f6[_0x93a0('0x27')](_0x6deb4b);}return _0x3f33f6['status'](_0x6deb4b)[_0x93a0('0x28')]();};}function respondWithResult(_0x46ef59,_0x3b2f10){_0x3b2f10=_0x3b2f10||0xc8;return function(_0x33b51e){if(_0x33b51e){return _0x46ef59[_0x93a0('0x29')](_0x3b2f10)[_0x93a0('0x2a')](_0x33b51e);}};}function respondWithFilteredResult(_0x5168ea,_0x31b290){return function(_0x2ad330){if(_0x2ad330){var _0x53ba0a=_0x2ad330[_0x93a0('0x2b')],_0x52f18d=_0x31b290[_0x93a0('0x2c')],_0x55dd93=_0x31b290[_0x93a0('0x2c')]+_0x31b290[_0x93a0('0x2d')],_0x4946b0;if(_0x55dd93>=_0x53ba0a){_0x55dd93=_0x53ba0a;_0x4946b0=0xc8;}else{_0x4946b0=0xce;}_0x5168ea[_0x93a0('0x29')](_0x4946b0);return _0x5168ea[_0x93a0('0x2e')](_0x93a0('0x2f'),_0x52f18d+'-'+_0x55dd93+'/'+_0x53ba0a)[_0x93a0('0x2a')](_0x2ad330);}return null;};}function patchUpdates(_0x207811){return function(_0x5ea34b){try{jsonpatch[_0x93a0('0x30')](_0x5ea34b,_0x207811,!![]);}catch(_0x24f7d5){return BPromise[_0x93a0('0x31')](_0x24f7d5);}return _0x5ea34b[_0x93a0('0x32')]();};}function saveUpdates(_0x14744a,_0x377b64){return function(_0x3b7d27){if(_0x3b7d27){return _0x3b7d27[_0x93a0('0x33')](_0x14744a)[_0x93a0('0x1c')](function(_0x202391){return _0x202391;});}return null;};}function removeEntity(_0x5379eb,_0x49a957){return function(_0x4b3195){if(_0x4b3195){return _0x4b3195[_0x93a0('0x34')]()[_0x93a0('0x1c')](function(){_0x5379eb[_0x93a0('0x29')](0xcc)[_0x93a0('0x28')]();});}};}function handleEntityNotFound(_0x1056b7,_0x581b9a){return function(_0x2f3dff){if(!_0x2f3dff){_0x1056b7[_0x93a0('0x27')](0x194);}return _0x2f3dff;};}function handleError(_0x122b0a,_0x32caee){_0x32caee=_0x32caee||0x1f4;return function(_0x1fd141){logger[_0x93a0('0x22')](_0x1fd141[_0x93a0('0x35')]);if(_0x1fd141[_0x93a0('0x36')]){delete _0x1fd141[_0x93a0('0x36')];}_0x122b0a[_0x93a0('0x29')](_0x32caee)['send'](_0x1fd141);};}exports[_0x93a0('0x37')]=function(_0x2e7c15,_0x3fefd0){var _0x1cdbb7={},_0x1c461b={},_0x2c6164={'count':0x0,'rows':[]};var _0x34eca9=_[_0x93a0('0x38')](db[_0x93a0('0x39')][_0x93a0('0x3a')],function(_0x5ea30c){return{'name':_0x5ea30c['fieldName'],'type':_0x5ea30c['type'][_0x93a0('0x3b')]};});_0x1c461b['model']=_[_0x93a0('0x38')](_0x34eca9,_0x93a0('0x36'));_0x1c461b[_0x93a0('0x3c')]=_[_0x93a0('0x3d')](_0x2e7c15[_0x93a0('0x3c')]);_0x1c461b[_0x93a0('0x3e')]=_[_0x93a0('0x3f')](_0x1c461b[_0x93a0('0x40')],_0x1c461b[_0x93a0('0x3c')]);_0x1cdbb7[_0x93a0('0x41')]=_[_0x93a0('0x3f')](_0x1c461b[_0x93a0('0x40')],qs[_0x93a0('0x42')](_0x2e7c15[_0x93a0('0x3c')][_0x93a0('0x42')]));_0x1cdbb7[_0x93a0('0x41')]=_0x1cdbb7[_0x93a0('0x41')][_0x93a0('0x43')]?_0x1cdbb7[_0x93a0('0x41')]:_0x1c461b[_0x93a0('0x40')];if(!_0x2e7c15[_0x93a0('0x3c')]['hasOwnProperty']('nolimit')){_0x1cdbb7[_0x93a0('0x2d')]=qs['limit'](_0x2e7c15[_0x93a0('0x3c')][_0x93a0('0x2d')]);_0x1cdbb7[_0x93a0('0x2c')]=qs['offset'](_0x2e7c15[_0x93a0('0x3c')][_0x93a0('0x2c')]);}_0x1cdbb7[_0x93a0('0x44')]=qs[_0x93a0('0x45')](_0x2e7c15[_0x93a0('0x3c')][_0x93a0('0x45')]);_0x1cdbb7[_0x93a0('0x46')]=qs[_0x93a0('0x3e')](_[_0x93a0('0x47')](_0x2e7c15[_0x93a0('0x3c')],_0x1c461b[_0x93a0('0x3e')]));if(_0x2e7c15[_0x93a0('0x3c')][_0x93a0('0x48')]){_0x1cdbb7[_0x93a0('0x46')]=_['merge'](_0x1cdbb7[_0x93a0('0x46')],{'$or':_[_0x93a0('0x38')](_0x34eca9,function(_0x243c6d){if(_0x243c6d['type']!=='VIRTUAL'){var _0x55baae={};_0x55baae[_0x243c6d[_0x93a0('0x36')]]={'$like':'%'+_0x2e7c15[_0x93a0('0x3c')]['filter']+'%'};return _0x55baae;}})});}_0x1cdbb7=_[_0x93a0('0x49')]({},_0x1cdbb7,_0x2e7c15['options']);var _0xeb9ee5={'where':_0x1cdbb7[_0x93a0('0x46')]};return db[_0x93a0('0x39')][_0x93a0('0x2b')](_0xeb9ee5)['then'](function(_0x3d7045){_0x2c6164[_0x93a0('0x2b')]=_0x3d7045;if(_0x2e7c15[_0x93a0('0x3c')]['includeAll']){_0x1cdbb7[_0x93a0('0x4a')]=[{'all':!![]}];}return db['Setting'][_0x93a0('0x4b')](_0x1cdbb7);})[_0x93a0('0x1c')](function(_0x278d54){_0x2c6164[_0x93a0('0x4c')]=_0x278d54;return _0x2c6164;})[_0x93a0('0x1c')](respondWithFilteredResult(_0x3fefd0,_0x1cdbb7))['catch'](handleError(_0x3fefd0,null));};exports[_0x93a0('0x4d')]=function(_0x464533,_0x209d6b){var _0x33858a={'raw':![],'where':{'id':_0x464533[_0x93a0('0x4e')]['id']}},_0x1e1d88={};_0x1e1d88[_0x93a0('0x40')]=_['keys'](db['Setting'][_0x93a0('0x3a')]);_0x1e1d88['query']=_[_0x93a0('0x3d')](_0x464533[_0x93a0('0x3c')]);_0x1e1d88[_0x93a0('0x3e')]=_[_0x93a0('0x3f')](_0x1e1d88[_0x93a0('0x40')],_0x1e1d88[_0x93a0('0x3c')]);_0x33858a[_0x93a0('0x41')]=_[_0x93a0('0x3f')](_0x1e1d88[_0x93a0('0x40')],qs[_0x93a0('0x42')](_0x464533[_0x93a0('0x3c')][_0x93a0('0x42')]));_0x33858a['attributes']=_0x33858a[_0x93a0('0x41')][_0x93a0('0x43')]?_0x33858a[_0x93a0('0x41')]:_0x1e1d88['model'];if(_0x464533[_0x93a0('0x3c')][_0x93a0('0x4f')]){_0x33858a['include']=[{'all':!![]}];}_0x33858a=_[_0x93a0('0x49')]({},_0x33858a,_0x464533['options']);return db[_0x93a0('0x39')]['find'](_0x33858a)['then'](handleEntityNotFound(_0x209d6b,null))['then'](respondWithResult(_0x209d6b,null))[_0x93a0('0x26')](handleError(_0x209d6b,null));};exports[_0x93a0('0x33')]=function(_0x46e359,_0x4f057e){if(_0x46e359['body']['id']){delete _0x46e359[_0x93a0('0x50')]['id'];}return db[_0x93a0('0x39')][_0x93a0('0x51')]({'where':{'id':_0x46e359[_0x93a0('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4f057e,null))['then'](saveUpdates(_0x46e359[_0x93a0('0x50')],null))['then'](respondWithResult(_0x4f057e,null))[_0x93a0('0x26')](handleError(_0x4f057e,null));};exports[_0x93a0('0x52')]=function(_0x3ac313,_0x4a079d,_0x563b53){if(_0x3ac313[_0x93a0('0x53')]&&_0x3ac313[_0x93a0('0x53')][_0x93a0('0x54')]){_0x3ac313[_0x93a0('0x50')][_0x93a0('0x55')]=_0x3ac313[_0x93a0('0x53')][_0x93a0('0x54')];}return db[_0x93a0('0x39')][_0x93a0('0x51')]({'where':{'id':_0x3ac313['params']['id']}})['then'](handleEntityNotFound(_0x4a079d,null))[_0x93a0('0x1c')](saveUpdates(_0x3ac313[_0x93a0('0x50')],null))['then'](respondWithResult(_0x4a079d,null))[_0x93a0('0x26')](handleError(_0x4a079d,null));};exports[_0x93a0('0x56')]=function(_0x484a0a,_0x53c59c,_0x2af0c3){if(_0x484a0a[_0x93a0('0x53')]&&_0x484a0a['file'][_0x93a0('0x54')]){_0x484a0a['body'][_0x93a0('0x57')]=_0x484a0a[_0x93a0('0x53')]['filename'];}return db[_0x93a0('0x39')][_0x93a0('0x51')]({'where':{'id':_0x484a0a['params']['id']}})[_0x93a0('0x1c')](handleEntityNotFound(_0x53c59c,null))[_0x93a0('0x1c')](saveUpdates(_0x484a0a['body'],null))[_0x93a0('0x1c')](respondWithResult(_0x53c59c,null))[_0x93a0('0x26')](handleError(_0x53c59c,null));};var utilLicense=require(_0x93a0('0x58'));exports[_0x93a0('0x59')]=function(_0x22e27c,_0x116fd7,_0x18d6f6){var _0xaceb6b=_0x93a0('0x5a');var _0x5c50c9={'custom':![]};return utilLicense[_0x93a0('0x5b')]()[_0x93a0('0x1c')](function(_0x8a2ce2){if(_0x8a2ce2){_0x5c50c9=_0x8a2ce2;}return db[_0x93a0('0x39')][_0x93a0('0x51')]({'where':{'id':_0x22e27c['params']['id']},'attributes':[_0x93a0('0x55'),_0x93a0('0x57'),_0x93a0('0x5c'),_0x93a0('0x5d'),'defaultLogo',_0x93a0('0x5e'),_0x93a0('0x5f'),_0x93a0('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x116fd7,null))[_0x93a0('0x1c')](function(_0x4d5cd9){if(_0x4d5cd9){var _0x21489c=_0x4d5cd9[_0x93a0('0x55')]&&fs[_0x93a0('0x61')](path[_0x93a0('0x62')](config[_0x93a0('0x63')],_0xaceb6b,_[_0x93a0('0x64')](_0x4d5cd9[_0x93a0('0x55')])))?path['join'](config['root'],_0xaceb6b,_['toLower'](_0x4d5cd9[_0x93a0('0x55')])):path[_0x93a0('0x62')](config[_0x93a0('0x63')],_0xaceb6b,_[_0x93a0('0x64')](_0x93a0('0x65')));var _0x5a64f6=_0x93a0('0x66')+_[_0x93a0('0x67')](_0x93a0('0x55'));if(_0x4d5cd9[_0x5a64f6]||!_0x5c50c9['custom']){_0x21489c=path[_0x93a0('0x62')](config[_0x93a0('0x63')],_0xaceb6b,_[_0x93a0('0x64')](_0x93a0('0x65')));}if(!fs[_0x93a0('0x61')](_0x21489c)){throw new db[(_0x93a0('0x19'))][(_0x93a0('0x1a'))](_[_0x93a0('0x67')](_0x93a0('0x55'))+_0x93a0('0x68'));}return _0x116fd7[_0x93a0('0x69')](_0x21489c);}})[_0x93a0('0x26')](handleError(_0x116fd7,null));};var utilLicense=require(_0x93a0('0x58'));exports[_0x93a0('0x6a')]=function(_0xd8a68c,_0x3f2ceb,_0x531dae){var _0x24ea3c=_0x93a0('0x5a');var _0x418e85={'custom':![]};return utilLicense[_0x93a0('0x5b')]()['then'](function(_0x3c8e30){if(_0x3c8e30){_0x418e85=_0x3c8e30;}return db[_0x93a0('0x39')][_0x93a0('0x51')]({'where':{'id':_0xd8a68c[_0x93a0('0x4e')]['id']},'attributes':[_0x93a0('0x55'),_0x93a0('0x57'),'preferred','favicon',_0x93a0('0x6b'),_0x93a0('0x5e'),_0x93a0('0x5f'),'defaultFavicon'],'raw':!![]});})[_0x93a0('0x1c')](handleEntityNotFound(_0x3f2ceb,null))[_0x93a0('0x1c')](function(_0x506267){if(_0x506267){var _0xf3e666=_0x506267[_0x93a0('0x57')]&&fs[_0x93a0('0x61')](path[_0x93a0('0x62')](config['root'],_0x24ea3c,_[_0x93a0('0x64')](_0x506267[_0x93a0('0x57')])))?path['join'](config[_0x93a0('0x63')],_0x24ea3c,_[_0x93a0('0x64')](_0x506267[_0x93a0('0x57')])):path[_0x93a0('0x62')](config[_0x93a0('0x63')],_0x24ea3c,_['toLower'](_0x93a0('0x6c')));var _0x4bf798=_0x93a0('0x66')+_[_0x93a0('0x67')](_0x93a0('0x57'));if(_0x506267[_0x4bf798]||!_0x418e85[_0x93a0('0x6d')]){_0xf3e666=path[_0x93a0('0x62')](config[_0x93a0('0x63')],_0x24ea3c,_[_0x93a0('0x64')](_0x93a0('0x6c')));}if(!fs[_0x93a0('0x61')](_0xf3e666)){throw new db[(_0x93a0('0x19'))][(_0x93a0('0x1a'))](_[_0x93a0('0x67')](_0x93a0('0x57'))+_0x93a0('0x68'));}return _0x3f2ceb[_0x93a0('0x69')](_0xf3e666);}})['catch'](handleError(_0x3f2ceb,null));};exports[_0x93a0('0x6e')]=function(_0x28a01f,_0x2ec444){return db[_0x93a0('0x39')][_0x93a0('0x51')]({'where':{'id':_0x28a01f[_0x93a0('0x4e')]['id']},'attributes':[_0x93a0('0x6f')]})[_0x93a0('0x1c')](respondWithResult(_0x2ec444,null))[_0x93a0('0x26')](handleError(_0x2ec444,null));};exports['addPreferred']=function(_0x5101c3,_0xe54ba,_0x3a4552){if(_0x5101c3[_0x93a0('0x53')]&&_0x5101c3[_0x93a0('0x53')][_0x93a0('0x54')]){_0x5101c3[_0x93a0('0x50')][_0x93a0('0x5c')]=_0x5101c3[_0x93a0('0x53')]['filename'];}return db[_0x93a0('0x39')][_0x93a0('0x51')]({'where':{'id':_0x5101c3[_0x93a0('0x4e')]['id']}})[_0x93a0('0x1c')](handleEntityNotFound(_0xe54ba,null))[_0x93a0('0x1c')](saveUpdates(_0x5101c3[_0x93a0('0x50')],null))[_0x93a0('0x1c')](respondWithResult(_0xe54ba,null))[_0x93a0('0x26')](handleError(_0xe54ba,null));};var utilLicense=require(_0x93a0('0x58'));exports[_0x93a0('0x70')]=function(_0x200003,_0x56895d,_0x5b5736){var _0x5aa0f0=_0x93a0('0x5a');var _0x43cfff={'custom':![]};return utilLicense[_0x93a0('0x5b')]()[_0x93a0('0x1c')](function(_0x571c54){if(_0x571c54){_0x43cfff=_0x571c54;}return db['Setting'][_0x93a0('0x51')]({'where':{'id':_0x200003[_0x93a0('0x4e')]['id']},'attributes':[_0x93a0('0x55'),_0x93a0('0x57'),_0x93a0('0x5c'),_0x93a0('0x5d'),_0x93a0('0x6b'),_0x93a0('0x5e'),_0x93a0('0x5f'),_0x93a0('0x60')],'raw':!![]});})[_0x93a0('0x1c')](handleEntityNotFound(_0x56895d,null))['then'](function(_0x3b04f3){if(_0x3b04f3){var _0x1695a0=_0x3b04f3[_0x93a0('0x5c')]&&fs[_0x93a0('0x61')](path[_0x93a0('0x62')](config[_0x93a0('0x63')],_0x5aa0f0,_[_0x93a0('0x64')](_0x3b04f3[_0x93a0('0x5c')])))?path[_0x93a0('0x62')](config[_0x93a0('0x63')],_0x5aa0f0,_[_0x93a0('0x64')](_0x3b04f3['preferred'])):path[_0x93a0('0x62')](config[_0x93a0('0x63')],_0x5aa0f0,_['toLower'](_0x93a0('0x71')));var _0x3f8874='default'+_[_0x93a0('0x67')]('preferred');if(_0x3b04f3[_0x3f8874]||!_0x43cfff[_0x93a0('0x6d')]||!_0x43cfff[_0x93a0('0x5c')]){_0x1695a0=path[_0x93a0('0x62')](config[_0x93a0('0x63')],_0x5aa0f0,_[_0x93a0('0x64')](_0x93a0('0x71')));}if(!fs['existsSync'](_0x1695a0)){throw new db[(_0x93a0('0x19'))]['ValidationError'](_[_0x93a0('0x67')](_0x93a0('0x5c'))+_0x93a0('0x68'));}return _0x56895d['download'](_0x1695a0);}})[_0x93a0('0x26')](handleError(_0x56895d,null));};exports[_0x93a0('0x72')]=function(_0x55d657,_0x3a0311,_0x2d0519){if(_0x55d657[_0x93a0('0x53')]&&_0x55d657[_0x93a0('0x53')]['filename']){_0x55d657[_0x93a0('0x50')][_0x93a0('0x5d')]=_0x55d657[_0x93a0('0x53')][_0x93a0('0x54')];}return db['Setting'][_0x93a0('0x51')]({'where':{'id':_0x55d657[_0x93a0('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3a0311,null))[_0x93a0('0x1c')](saveUpdates(_0x55d657[_0x93a0('0x50')],null))[_0x93a0('0x1c')](respondWithResult(_0x3a0311,null))['catch'](handleError(_0x3a0311,null));};var utilLicense=require('../../config/license/util');exports[_0x93a0('0x73')]=function(_0x5e4f94,_0x31c0d2,_0x163e2b){var _0xc71587='server/files/images/logos';var _0x3260bb={'custom':![]};return utilLicense[_0x93a0('0x5b')]()[_0x93a0('0x1c')](function(_0x21b63e){if(_0x21b63e){_0x3260bb=_0x21b63e;}return db[_0x93a0('0x39')][_0x93a0('0x51')]({'where':{'id':_0x5e4f94['params']['id']},'attributes':[_0x93a0('0x55'),_0x93a0('0x57'),_0x93a0('0x5c'),_0x93a0('0x5d'),_0x93a0('0x6b'),_0x93a0('0x5e'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x93a0('0x1c')](handleEntityNotFound(_0x31c0d2,null))[_0x93a0('0x1c')](function(_0x3cf65b){if(_0x3cf65b){var _0x67adb9=_0x3cf65b[_0x93a0('0x5d')]&&fs[_0x93a0('0x61')](path[_0x93a0('0x62')](config[_0x93a0('0x63')],_0xc71587,_[_0x93a0('0x64')](_0x3cf65b[_0x93a0('0x5d')])))?path[_0x93a0('0x62')](config[_0x93a0('0x63')],_0xc71587,_[_0x93a0('0x64')](_0x3cf65b['favicon'])):path['join'](config[_0x93a0('0x63')],_0xc71587,_[_0x93a0('0x64')](_0x93a0('0x74')));var _0x141fe1=_0x93a0('0x66')+_[_0x93a0('0x67')](_0x93a0('0x5d'));if(_0x3cf65b[_0x141fe1]||!_0x3260bb[_0x93a0('0x6d')]){_0x67adb9=path[_0x93a0('0x62')](config['root'],_0xc71587,_[_0x93a0('0x64')](_0x93a0('0x74')));}if(!fs['existsSync'](_0x67adb9)){throw new db[(_0x93a0('0x19'))]['ValidationError'](_['upperFirst'](_0x93a0('0x5d'))+_0x93a0('0x68'));}return _0x31c0d2['download'](_0x67adb9);}})['catch'](handleError(_0x31c0d2,null));}; \ No newline at end of file +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 diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 61274bc..faccb48 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 _0x8d1f=['./setting.attributes','define','Setting','settings','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x509d2e,_0x307fde){var _0x292a85=function(_0x1e3731){while(--_0x1e3731){_0x509d2e['push'](_0x509d2e['shift']());}};_0x292a85(++_0x307fde);}(_0x8d1f,0x1d0));var _0xf8d1=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x8d1f[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf8d1('0x0'));var moment=require(_0xf8d1('0x1'));var BPromise=require(_0xf8d1('0x2'));var rp=require(_0xf8d1('0x3'));var fs=require('fs');var path=require(_0xf8d1('0x4'));var rimraf=require(_0xf8d1('0x5'));var config=require('../../config/environment');var attributes=require(_0xf8d1('0x6'));module['exports']=function(_0x536e91,_0x362044){return _0x536e91[_0xf8d1('0x7')](_0xf8d1('0x8'),attributes,{'tableName':_0xf8d1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 9a4c98a..e8c5a06 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 _0x106d=['Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x106d,0x103));var _0xd106=function(_0x3fd5f0,_0x552d48){_0x3fd5f0=_0x3fd5f0-0x0;var _0x5b14d0=_0x106d[_0x3fd5f0];return _0x5b14d0;};'use strict';var _=require('lodash');var util=require(_0xd106('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd106('0x1'));var fs=require('fs');var Redis=require(_0xd106('0x2'));var db=require(_0xd106('0x3'))['db'];var utils=require(_0xd106('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xd106('0x5'));var jayson=require(_0xd106('0x6'));var client=jayson[_0xd106('0x7')][_0xd106('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x422748,_0x11c102,_0x2ef7bb){return new BPromise(function(_0x24aa2e,_0x3772e5){return client[_0xd106('0x9')](_0x422748,_0x2ef7bb)[_0xd106('0xa')](function(_0x68ef2b){logger['info'](_0xd106('0xb'),_0x11c102,_0xd106('0xc'));logger[_0xd106('0xd')](_0xd106('0xe'),_0x11c102,'request\x20sent',JSON[_0xd106('0xf')](_0x68ef2b));if(_0x68ef2b[_0xd106('0x10')]){if(_0x68ef2b[_0xd106('0x10')][_0xd106('0x11')]===0x1f4){logger[_0xd106('0x10')](_0xd106('0xb'),_0x11c102,_0x68ef2b[_0xd106('0x10')][_0xd106('0x12')]);return _0x3772e5(_0x68ef2b['error'][_0xd106('0x12')]);}logger[_0xd106('0x10')](_0xd106('0xb'),_0x11c102,_0x68ef2b[_0xd106('0x10')][_0xd106('0x12')]);return _0x24aa2e(_0x68ef2b[_0xd106('0x10')][_0xd106('0x12')]);}else{logger[_0xd106('0x13')](_0xd106('0xb'),_0x11c102,'request\x20sent');_0x24aa2e(_0x68ef2b['result'][_0xd106('0x12')]);}})[_0xd106('0x14')](function(_0x7d37){logger[_0xd106('0x10')](_0xd106('0xb'),_0x11c102,_0x7d37);_0x3772e5(_0x7d37);});});} \ No newline at end of file +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 diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 8944d89..d9ba50b 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 _0xf920=['get','/:id','/:id/dispositions','getDispositions','/:id/applications','getApplications','/:id/interactions','/:id/status','/:id/users','getAgents','post','create','addAnswer','/:id/notify','notify','addApplications','/:id/send','status','put','update','delete','destroy','removeDispositions','/:id/canned_answers','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsAccount.controller','isAuthenticated'];(function(_0x1bc750,_0x23f442){var _0xcd51da=function(_0x323854){while(--_0x323854){_0x1bc750['push'](_0x1bc750['shift']());}};_0xcd51da(++_0x23f442);}(_0xf920,0x1a7));var _0x0f92=function(_0x3c7d53,_0x2826d0){_0x3c7d53=_0x3c7d53-0x0;var _0x2c8387=_0xf920[_0x3c7d53];return _0x2c8387;};'use strict';var multer=require('multer');var util=require(_0x0f92('0x0'));var path=require(_0x0f92('0x1'));var timeout=require(_0x0f92('0x2'));var express=require(_0x0f92('0x3'));var router=express[_0x0f92('0x4')]();var auth=require(_0x0f92('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0f92('0x6'));var controller=require(_0x0f92('0x7'));router['get']('/',auth[_0x0f92('0x8')](),controller['index']);router['get']('/describe',auth[_0x0f92('0x8')](),controller['describe']);router[_0x0f92('0x9')](_0x0f92('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0f92('0x9')](_0x0f92('0xb'),auth[_0x0f92('0x8')](),controller[_0x0f92('0xc')]);router['get']('/:id/canned_answers',auth[_0x0f92('0x8')](),controller['getAnswers']);router[_0x0f92('0x9')](_0x0f92('0xd'),auth[_0x0f92('0x8')](),controller[_0x0f92('0xe')]);router[_0x0f92('0x9')](_0x0f92('0xf'),auth[_0x0f92('0x8')](),controller['getInteractions']);router[_0x0f92('0x9')](_0x0f92('0x10'),controller['statusGet']);router[_0x0f92('0x9')](_0x0f92('0x11'),auth[_0x0f92('0x8')](),controller[_0x0f92('0x12')]);router[_0x0f92('0x13')]('/',auth[_0x0f92('0x8')](),controller[_0x0f92('0x14')]);router[_0x0f92('0x13')](_0x0f92('0xb'),auth[_0x0f92('0x8')](),controller['addDisposition']);router['post']('/:id/canned_answers',auth[_0x0f92('0x8')](),controller[_0x0f92('0x15')]);router[_0x0f92('0x13')](_0x0f92('0x16'),controller[_0x0f92('0x17')]);router[_0x0f92('0x13')](_0x0f92('0xd'),auth[_0x0f92('0x8')](),controller[_0x0f92('0x18')]);router[_0x0f92('0x13')](_0x0f92('0x19'),auth[_0x0f92('0x8')](),controller['send']);router['post']('/:id/status',controller[_0x0f92('0x1a')]);router[_0x0f92('0x13')](_0x0f92('0x11'),auth[_0x0f92('0x8')](),controller['addAgents']);router[_0x0f92('0x1b')]('/:id',auth[_0x0f92('0x8')](),controller[_0x0f92('0x1c')]);router[_0x0f92('0x1d')](_0x0f92('0xa'),auth['isAuthenticated'](),controller[_0x0f92('0x1e')]);router[_0x0f92('0x1d')](_0x0f92('0xb'),auth[_0x0f92('0x8')](),controller[_0x0f92('0x1f')]);router[_0x0f92('0x1d')](_0x0f92('0x20'),auth['isAuthenticated'](),controller[_0x0f92('0x21')]);router[_0x0f92('0x1d')]('/:id/users',auth[_0x0f92('0x8')](),controller[_0x0f92('0x22')]);module[_0x0f92('0x23')]=router; \ No newline at end of file +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 diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index b0d01be..4462490 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 _0xf658=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER'];(function(_0x4ba09d,_0x598d77){var _0x5c246a=function(_0xce4b54){while(--_0xce4b54){_0x4ba09d['push'](_0x4ba09d['shift']());}};_0x5c246a(++_0x598d77);}(_0xf658,0x1e8));var _0x8f65=function(_0x314412,_0x3b311a){_0x314412=_0x314412-0x0;var _0x75ab8b=_0xf658[_0x314412];return _0x75ab8b;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x8f65('0x0'));module[_0x8f65('0x1')]={'name':{'type':Sequelize[_0x8f65('0x2')],'unique':_0x8f65('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x8f65('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x8f65('0x2')],'defaultValue':function(){return rs[_0x8f65('0x4')]();}},'phone':{'type':Sequelize[_0x8f65('0x2')]},'type':{'type':Sequelize[_0x8f65('0x5')](_0x8f65('0x6'),_0x8f65('0x7'),_0x8f65('0x8'),_0x8f65('0x9'),_0x8f65('0xa'),'clickatell',_0x8f65('0xb'),_0x8f65('0xc'),_0x8f65('0xd'))},'accountSid':{'type':Sequelize[_0x8f65('0x2')]},'authId':{'type':Sequelize[_0x8f65('0x2')]},'authToken':{'type':Sequelize[_0x8f65('0x2')]},'smsMethod':{'type':Sequelize[_0x8f65('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x8f65('0x2')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x8f65('0x2')]},'senderString':{'type':Sequelize[_0x8f65('0x2')]},'deliveryReport':{'type':Sequelize[_0x8f65('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x8f65('0x2')]},'notificationTemplate':{'type':Sequelize[_0x8f65('0xf')],'defaultValue':function(){return _0x8f65('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8f65('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8f65('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8f65('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8f65('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x8f65('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x8f65('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x8f65('0xe')],'defaultValue':![],'comment':_0x8f65('0x13'),'set':function(_0xa19943){if(!_0xa19943)this[_0x8f65('0x14')](_0x8f65('0x15'),null);this[_0x8f65('0x14')](_0x8f65('0x16'),_0xa19943);}}}; \ No newline at end of file +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 diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 42462d6..ea975cb 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 _0x8603=['error','code','message','result','sendStatus','status','json','count','offset','Content-Range','apply','save','update','destroy','get','SmsAccounts','end','stack','name','send','index','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','map','options','includeAll','rows','catch','params','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Pause','describe','addDisposition','SmsAccountId','pick','Disposition','findAll','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','priority','asc','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','skebby','text','connectel','plivo','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','replyMessageId','intelepeer','refid','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','CmList','Contacts','list','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','\x0a','addApplications','sequelize','findAndCountAll','getApplications','getInteractions','Owner','fullname','Tag','Tags','tag','List','out','Messages','dataValues','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','clicksend','message_id','status_code','groupName','DELIVERED','redif','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','message-id','state','omit','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsAccount.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','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1499fd,_0x4fb2c1){var _0x2d5b2d=function(_0x47634a){while(--_0x47634a){_0x1499fd['push'](_0x1499fd['shift']());}};_0x2d5b2d(++_0x4fb2c1);}(_0x8603,0x190));var _0x3860=function(_0xf9c2d3,_0x207e2c){_0xf9c2d3=_0xf9c2d3-0x0;var _0xd6cd08=_0x8603[_0xf9c2d3];return _0xd6cd08;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3860('0x0'));var rimraf=require(_0x3860('0x1'));var zipdir=require(_0x3860('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3860('0x3'));var BPromise=require(_0x3860('0x4'));var Mustache=require(_0x3860('0x5'));var util=require('util');var path=require(_0x3860('0x6'));var sox=require('sox');var csv=require(_0x3860('0x7'));var ejs=require(_0x3860('0x8'));var fs=require('fs');var _=require(_0x3860('0x9'));var squel=require(_0x3860('0xa'));var crypto=require(_0x3860('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3860('0xc'));var Papa=require(_0x3860('0xd'));var Redis=require('ioredis');var authService=require(_0x3860('0xe'));var qs=require(_0x3860('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3860('0x10'));var logger=require(_0x3860('0x11'))('api');var utils=require(_0x3860('0x12'));var config=require(_0x3860('0x13'));var db=require('../../mysqldb')['db'];config[_0x3860('0x14')]=_[_0x3860('0x15')](config[_0x3860('0x14')],{'host':_0x3860('0x16'),'port':0x18eb});var socket=require(_0x3860('0x17'))(new Redis(config[_0x3860('0x14')]));require(_0x3860('0x18'))[_0x3860('0x19')](socket);var jayson=require(_0x3860('0x1a'));var client=jayson[_0x3860('0x1b')]['http']({'port':0x232c});function checkPasswordPattern(_0x3d861d,_0x21eaf1,_0x122e40){if(_0x122e40){var _0x37d9ab=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x37d9ab[_0x3860('0x1c')](_0x21eaf1)){return _0x3d861d;}else{throw new db[(_0x3860('0x1d'))][(_0x3860('0x1e'))](_0x3860('0x1f'));}}else{return _0x3d861d;}}function respondWithRpcPromise(_0x311fdb,_0x3c0d91,_0x3e51b4,_0x45b799){return new BPromise(function(_0x4b6b15,_0x4863bd){var _0x373b06=_0x45b799||client;return _0x373b06[_0x3860('0x20')](_0x311fdb,_0x3e51b4)[_0x3860('0x21')](function(_0x53fc63){logger[_0x3860('0x22')](_0x3860('0x23'),_0x3c0d91,_0x3860('0x24'));logger[_0x3860('0x25')](_0x3860('0x26'),_0x3c0d91,_0x3860('0x24'),JSON[_0x3860('0x27')](_0x53fc63));if(_0x53fc63[_0x3860('0x28')]){if(_0x53fc63[_0x3860('0x28')][_0x3860('0x29')]===0x1f4){logger[_0x3860('0x28')](_0x3860('0x23'),_0x3c0d91,_0x53fc63[_0x3860('0x28')][_0x3860('0x2a')]);return _0x4863bd(_0x53fc63[_0x3860('0x28')]['message']);}logger[_0x3860('0x28')](_0x3860('0x23'),_0x3c0d91,_0x53fc63[_0x3860('0x28')][_0x3860('0x2a')]);return _0x4b6b15(_0x53fc63[_0x3860('0x28')]['message']);}else{logger[_0x3860('0x22')]('SmsAccount,\x20%s,\x20%s',_0x3c0d91,'request\x20sent');_0x4b6b15(_0x53fc63[_0x3860('0x2b')][_0x3860('0x2a')]);}})['catch'](function(_0x4d9a90){logger['error'](_0x3860('0x23'),_0x3c0d91,_0x4d9a90);_0x4863bd(_0x4d9a90);});});}function respondWithStatusCode(_0x3ebc5b,_0xb25cc2){_0xb25cc2=_0xb25cc2||0xcc;return function(_0x371f3a){if(_0x371f3a){return _0x3ebc5b[_0x3860('0x2c')](_0xb25cc2);}return _0x3ebc5b[_0x3860('0x2d')](_0xb25cc2)['end']();};}function respondWithResult(_0x4c4314,_0x389bd0){_0x389bd0=_0x389bd0||0xc8;return function(_0x1f1809){if(_0x1f1809){return _0x4c4314['status'](_0x389bd0)[_0x3860('0x2e')](_0x1f1809);}};}function respondWithFilteredResult(_0x3d5143,_0x10d9e4){return function(_0x426e6c){if(_0x426e6c){var _0x3628f7=_0x426e6c[_0x3860('0x2f')],_0x4bbae9=_0x10d9e4['offset'],_0x36ae2b=_0x10d9e4[_0x3860('0x30')]+_0x10d9e4['limit'],_0xf624ba;if(_0x36ae2b>=_0x3628f7){_0x36ae2b=_0x3628f7;_0xf624ba=0xc8;}else{_0xf624ba=0xce;}_0x3d5143[_0x3860('0x2d')](_0xf624ba);return _0x3d5143['set'](_0x3860('0x31'),_0x4bbae9+'-'+_0x36ae2b+'/'+_0x3628f7)[_0x3860('0x2e')](_0x426e6c);}return null;};}function patchUpdates(_0x24cf39){return function(_0x47e350){try{jsonpatch[_0x3860('0x32')](_0x47e350,_0x24cf39,!![]);}catch(_0x451b0c){return BPromise['reject'](_0x451b0c);}return _0x47e350[_0x3860('0x33')]();};}function saveUpdates(_0x5a54a6,_0x2c0bf3){return function(_0x3a577a){if(_0x3a577a){return _0x3a577a[_0x3860('0x34')](_0x5a54a6)[_0x3860('0x21')](function(_0x30dc2a){return _0x30dc2a;});}return null;};}function removeEntity(_0x1b93f3,_0x1d3fd0){return function(_0x4d30bc){if(_0x4d30bc){return _0x4d30bc[_0x3860('0x35')]()[_0x3860('0x21')](function(){var _0x4d62e9=_0x4d30bc[_0x3860('0x36')]({'plain':!![]});var _0x398525=_0x3860('0x37');return db['UserProfileResource']['destroy']({'where':{'type':_0x398525,'resourceId':_0x4d62e9['id']}})[_0x3860('0x21')](function(){return _0x4d30bc;});})[_0x3860('0x21')](function(){_0x1b93f3[_0x3860('0x2d')](0xcc)[_0x3860('0x38')]();});}};}function handleEntityNotFound(_0x59271f,_0x4d6b1c){return function(_0x3ad0aa){if(!_0x3ad0aa){_0x59271f[_0x3860('0x2c')](0x194);}return _0x3ad0aa;};}function handleError(_0xc715a0,_0x1fa847){_0x1fa847=_0x1fa847||0x1f4;return function(_0x42f219){logger['error'](_0x42f219[_0x3860('0x39')]);if(_0x42f219[_0x3860('0x3a')]){delete _0x42f219['name'];}_0xc715a0['status'](_0x1fa847)[_0x3860('0x3b')](_0x42f219);};}exports[_0x3860('0x3c')]=function(_0x295752,_0x3423a1){var _0x2b35b2={'include':[{'model':db['Pause'],'as':_0x3860('0x3d')}]},_0x592311={},_0x28f04d={'count':0x0,'rows':[]};var _0x35bf7a=_['map'](db[_0x3860('0x3e')][_0x3860('0x3f')],function(_0x4f3303){return{'name':_0x4f3303[_0x3860('0x40')],'type':_0x4f3303[_0x3860('0x41')][_0x3860('0x42')]};});_0x592311[_0x3860('0x43')]=_['map'](_0x35bf7a,_0x3860('0x3a'));_0x592311[_0x3860('0x44')]=_[_0x3860('0x45')](_0x295752['query']);_0x592311[_0x3860('0x46')]=_['intersection'](_0x592311[_0x3860('0x43')],_0x592311[_0x3860('0x44')]);_0x2b35b2[_0x3860('0x47')]=_[_0x3860('0x48')](_0x592311[_0x3860('0x43')],qs[_0x3860('0x49')](_0x295752['query'][_0x3860('0x49')]));_0x2b35b2[_0x3860('0x47')]=_0x2b35b2['attributes']['length']?_0x2b35b2[_0x3860('0x47')]:_0x592311[_0x3860('0x43')];if(!_0x295752['query'][_0x3860('0x4a')](_0x3860('0x4b'))){_0x2b35b2['limit']=qs[_0x3860('0x4c')](_0x295752[_0x3860('0x44')][_0x3860('0x4c')]);_0x2b35b2[_0x3860('0x30')]=qs[_0x3860('0x30')](_0x295752[_0x3860('0x44')][_0x3860('0x30')]);}_0x2b35b2[_0x3860('0x4d')]=qs[_0x3860('0x4e')](_0x295752[_0x3860('0x44')][_0x3860('0x4e')]);_0x2b35b2[_0x3860('0x4f')]=qs[_0x3860('0x46')](_['pick'](_0x295752[_0x3860('0x44')],_0x592311['filters']));if(_0x295752[_0x3860('0x44')][_0x3860('0x50')]){_0x2b35b2[_0x3860('0x4f')]=_[_0x3860('0x51')](_0x2b35b2[_0x3860('0x4f')],{'$or':_[_0x3860('0x52')](_0x35bf7a,function(_0x2102f6){if(_0x2102f6[_0x3860('0x41')]!=='VIRTUAL'){var _0x3cd575={};_0x3cd575[_0x2102f6[_0x3860('0x3a')]]={'$like':'%'+_0x295752[_0x3860('0x44')]['filter']+'%'};return _0x3cd575;}})});}_0x2b35b2=_[_0x3860('0x51')]({},_0x2b35b2,_0x295752[_0x3860('0x53')]);var _0x188883={'where':_0x2b35b2[_0x3860('0x4f')]};return db['SmsAccount']['count'](_0x188883)[_0x3860('0x21')](function(_0x480a08){_0x28f04d[_0x3860('0x2f')]=_0x480a08;if(_0x295752[_0x3860('0x44')][_0x3860('0x54')]){_0x2b35b2['include']=[{'all':!![]}];}return db[_0x3860('0x3e')]['findAll'](_0x2b35b2);})[_0x3860('0x21')](function(_0x517fe6){_0x28f04d[_0x3860('0x55')]=_0x517fe6;return _0x28f04d;})[_0x3860('0x21')](respondWithFilteredResult(_0x3423a1,_0x2b35b2))[_0x3860('0x56')](handleError(_0x3423a1,null));};exports['show']=function(_0x4876ab,_0x4408b5){var _0x2de249={'raw':![],'where':{'id':_0x4876ab[_0x3860('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x3860('0x3d')}]},_0x478dd9={};_0x478dd9[_0x3860('0x43')]=_[_0x3860('0x45')](db[_0x3860('0x3e')][_0x3860('0x3f')]);_0x478dd9[_0x3860('0x44')]=_[_0x3860('0x45')](_0x4876ab['query']);_0x478dd9[_0x3860('0x46')]=_[_0x3860('0x48')](_0x478dd9[_0x3860('0x43')],_0x478dd9[_0x3860('0x44')]);_0x2de249[_0x3860('0x47')]=_[_0x3860('0x48')](_0x478dd9['model'],qs[_0x3860('0x49')](_0x4876ab[_0x3860('0x44')][_0x3860('0x49')]));_0x2de249[_0x3860('0x47')]=_0x2de249[_0x3860('0x47')][_0x3860('0x58')]?_0x2de249[_0x3860('0x47')]:_0x478dd9[_0x3860('0x43')];if(_0x4876ab['query'][_0x3860('0x54')]){_0x2de249[_0x3860('0x59')]=[{'all':!![]}];}_0x2de249=_['merge']({},_0x2de249,_0x4876ab[_0x3860('0x53')]);return db[_0x3860('0x3e')][_0x3860('0x5a')](_0x2de249)['then'](handleEntityNotFound(_0x4408b5,null))[_0x3860('0x21')](respondWithResult(_0x4408b5,null))['catch'](handleError(_0x4408b5,null));};exports[_0x3860('0x5b')]=function(_0x214a19,_0x13b978){return db[_0x3860('0x3e')][_0x3860('0x5b')](_0x214a19[_0x3860('0x5c')],{})[_0x3860('0x21')](function(_0x2c7218){var _0x67e6b8=_0x214a19[_0x3860('0x5d')][_0x3860('0x36')]({'plain':!![]});if(!_0x67e6b8)throw new Error(_0x3860('0x5e'));if(_0x67e6b8['role']==='user'){var _0x5111e0=_0x2c7218[_0x3860('0x36')]({'plain':!![]});var _0x572e29='SmsAccounts';return db[_0x3860('0x5f')][_0x3860('0x5a')]({'where':{'name':_0x572e29,'userProfileId':_0x67e6b8[_0x3860('0x60')]},'raw':!![]})[_0x3860('0x21')](function(_0x3d6c17){if(_0x3d6c17&&_0x3d6c17[_0x3860('0x61')]===0x0){return db['UserProfileResource']['create']({'name':_0x5111e0['name'],'resourceId':_0x5111e0['id'],'type':_0x3d6c17[_0x3860('0x3a')],'sectionId':_0x3d6c17['id']},{})[_0x3860('0x21')](function(){return _0x2c7218;});}else{return _0x2c7218;}})[_0x3860('0x56')](function(_0x5ec169){logger[_0x3860('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5ec169);throw _0x5ec169;});}return _0x2c7218;})[_0x3860('0x21')](respondWithResult(_0x13b978,0xc9))[_0x3860('0x56')](handleError(_0x13b978,null));};exports['update']=function(_0x3345e1,_0x6d2211){if(_0x3345e1[_0x3860('0x5c')]['id']){delete _0x3345e1[_0x3860('0x5c')]['id'];}return db['SmsAccount'][_0x3860('0x5a')]({'where':{'id':_0x3345e1[_0x3860('0x57')]['id']},'include':[{'model':db[_0x3860('0x62')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x6d2211,null))[_0x3860('0x21')](saveUpdates(_0x3345e1[_0x3860('0x5c')],null))[_0x3860('0x21')](respondWithResult(_0x6d2211,null))[_0x3860('0x56')](handleError(_0x6d2211,null));};exports[_0x3860('0x35')]=function(_0xbd8769,_0x5d0210){return db[_0x3860('0x3e')][_0x3860('0x5a')]({'where':{'id':_0xbd8769['params']['id']}})[_0x3860('0x21')](handleEntityNotFound(_0x5d0210,null))[_0x3860('0x21')](removeEntity(_0x5d0210,null))[_0x3860('0x56')](handleError(_0x5d0210,null));};exports[_0x3860('0x63')]=function(_0x36431e,_0x2ee555){return db['SmsAccount'][_0x3860('0x63')]()[_0x3860('0x21')](respondWithResult(_0x2ee555,null))[_0x3860('0x56')](handleError(_0x2ee555,null));};exports[_0x3860('0x64')]=function(_0x1478d9,_0x2a5c06,_0x5f2c66){if(_0x1478d9[_0x3860('0x5c')]['id']){delete _0x1478d9[_0x3860('0x5c')]['id'];}return db[_0x3860('0x3e')]['find']({'where':{'id':_0x1478d9['params']['id']}})[_0x3860('0x21')](handleEntityNotFound(_0x2a5c06,null))[_0x3860('0x21')](function(_0x11c2c8){if(_0x11c2c8){_0x1478d9[_0x3860('0x5c')][_0x3860('0x65')]=_0x11c2c8['id'];return db['Disposition']['create'](_0x1478d9[_0x3860('0x5c')]);}})[_0x3860('0x21')](respondWithResult(_0x2a5c06,null))['catch'](handleError(_0x2a5c06,null));};exports['getDispositions']=function(_0x2fd2ec,_0x38ad4e,_0x4ca6de){var _0x304b18={'raw':![],'where':{}};var _0x4124ce={};var _0x12913c={'count':0x0,'rows':[]};return db[_0x3860('0x3e')]['findOne']({'where':{'id':_0x2fd2ec[_0x3860('0x57')]['id']}})[_0x3860('0x21')](handleEntityNotFound(_0x38ad4e,null))['then'](function(_0x57e944){if(_0x57e944){_0x4124ce[_0x3860('0x43')]=_[_0x3860('0x45')](db['Disposition'][_0x3860('0x3f')]);_0x4124ce['query']=_[_0x3860('0x45')](_0x2fd2ec['query']);_0x4124ce['filters']=_[_0x3860('0x48')](_0x4124ce['model'],_0x4124ce[_0x3860('0x44')]);_0x304b18[_0x3860('0x47')]=_[_0x3860('0x48')](_0x4124ce[_0x3860('0x43')],qs[_0x3860('0x49')](_0x2fd2ec[_0x3860('0x44')]['fields']));_0x304b18[_0x3860('0x47')]=_0x304b18[_0x3860('0x47')][_0x3860('0x58')]?_0x304b18['attributes']:_0x4124ce[_0x3860('0x43')];if(!_0x2fd2ec['query'][_0x3860('0x4a')](_0x3860('0x4b'))){_0x304b18['limit']=qs[_0x3860('0x4c')](_0x2fd2ec[_0x3860('0x44')][_0x3860('0x4c')]);_0x304b18['offset']=qs['offset'](_0x2fd2ec['query']['offset']);}_0x304b18[_0x3860('0x4d')]=qs[_0x3860('0x4e')](_0x2fd2ec[_0x3860('0x44')][_0x3860('0x4e')]);_0x304b18['where']=qs['filters'](_[_0x3860('0x66')](_0x2fd2ec[_0x3860('0x44')],_0x4124ce[_0x3860('0x46')]));_0x304b18[_0x3860('0x4f')]['SmsAccountId']=_0x57e944['id'];if(_0x2fd2ec[_0x3860('0x44')][_0x3860('0x50')]){_0x304b18['where']=_['merge'](_0x304b18[_0x3860('0x4f')],{'$or':_[_0x3860('0x52')](_0x304b18[_0x3860('0x47')],function(_0x27894f){var _0x54739a={};_0x54739a[_0x27894f]={'$like':'%'+_0x2fd2ec['query'][_0x3860('0x50')]+'%'};return _0x54739a;})});}_0x304b18=_['merge']({},_0x304b18,_0x2fd2ec[_0x3860('0x53')]);return db[_0x3860('0x67')]['count']({'where':_0x304b18['where']})['then'](function(_0x2d6eab){_0x12913c[_0x3860('0x2f')]=_0x2d6eab;if(_0x2fd2ec['query'][_0x3860('0x54')]){_0x304b18[_0x3860('0x59')]=[{'all':!![]}];}return db[_0x3860('0x67')][_0x3860('0x68')](_0x304b18);})[_0x3860('0x21')](function(_0x481e20){_0x12913c[_0x3860('0x55')]=_0x481e20;return _0x12913c;});}})[_0x3860('0x21')](respondWithFilteredResult(_0x38ad4e,_0x304b18))[_0x3860('0x56')](handleError(_0x38ad4e,null));};exports[_0x3860('0x69')]=function(_0x355924,_0x4a98a0,_0x313366){return db[_0x3860('0x3e')][_0x3860('0x5a')]({'where':{'id':_0x355924[_0x3860('0x57')]['id']}})[_0x3860('0x21')](handleEntityNotFound(_0x4a98a0,null))['then'](function(_0x532370){if(_0x532370){return _0x532370[_0x3860('0x69')](_0x355924[_0x3860('0x44')][_0x3860('0x6a')]);}})[_0x3860('0x21')](respondWithStatusCode(_0x4a98a0,null))[_0x3860('0x56')](handleError(_0x4a98a0,null));};exports[_0x3860('0x6b')]=function(_0x182292,_0x532163,_0x458c1b){if(_0x182292[_0x3860('0x5c')]['id']){delete _0x182292['body']['id'];}return db[_0x3860('0x3e')][_0x3860('0x5a')]({'where':{'id':_0x182292[_0x3860('0x57')]['id']}})['then'](handleEntityNotFound(_0x532163,null))[_0x3860('0x21')](function(_0x4609e7){if(_0x4609e7){_0x182292['body'][_0x3860('0x65')]=_0x4609e7['id'];return db['CannedAnswer'][_0x3860('0x5b')](_0x182292[_0x3860('0x5c')]);}})['then'](respondWithResult(_0x532163,null))[_0x3860('0x56')](handleError(_0x532163,null));};exports[_0x3860('0x6c')]=function(_0x361113,_0x37b34a,_0x115d49){var _0x5d37e4={'raw':![],'where':{}};var _0x307d19={};var _0x15b0b0={'count':0x0,'rows':[]};return db[_0x3860('0x3e')][_0x3860('0x6d')]({'where':{'id':_0x361113[_0x3860('0x57')]['id']}})['then'](handleEntityNotFound(_0x37b34a,null))['then'](function(_0x170554){if(_0x170554){_0x307d19[_0x3860('0x43')]=_['keys'](db[_0x3860('0x6e')][_0x3860('0x3f')]);_0x307d19[_0x3860('0x44')]=_[_0x3860('0x45')](_0x361113['query']);_0x307d19[_0x3860('0x46')]=_['intersection'](_0x307d19[_0x3860('0x43')],_0x307d19[_0x3860('0x44')]);_0x5d37e4[_0x3860('0x47')]=_[_0x3860('0x48')](_0x307d19[_0x3860('0x43')],qs[_0x3860('0x49')](_0x361113[_0x3860('0x44')]['fields']));_0x5d37e4[_0x3860('0x47')]=_0x5d37e4[_0x3860('0x47')]['length']?_0x5d37e4['attributes']:_0x307d19['model'];if(!_0x361113['query'][_0x3860('0x4a')](_0x3860('0x4b'))){_0x5d37e4[_0x3860('0x4c')]=qs[_0x3860('0x4c')](_0x361113[_0x3860('0x44')][_0x3860('0x4c')]);_0x5d37e4['offset']=qs[_0x3860('0x30')](_0x361113['query'][_0x3860('0x30')]);}_0x5d37e4[_0x3860('0x4d')]=qs[_0x3860('0x4e')](_0x361113[_0x3860('0x44')][_0x3860('0x4e')]);_0x5d37e4[_0x3860('0x4f')]=qs[_0x3860('0x46')](_[_0x3860('0x66')](_0x361113[_0x3860('0x44')],_0x307d19[_0x3860('0x46')]));_0x5d37e4[_0x3860('0x4f')]['SmsAccountId']=_0x170554['id'];if(_0x361113[_0x3860('0x44')][_0x3860('0x50')]){_0x5d37e4[_0x3860('0x4f')]=_['merge'](_0x5d37e4[_0x3860('0x4f')],{'$or':_[_0x3860('0x52')](_0x5d37e4[_0x3860('0x47')],function(_0x3d4469){var _0x4a3e1a={};_0x4a3e1a[_0x3d4469]={'$like':'%'+_0x361113[_0x3860('0x44')][_0x3860('0x50')]+'%'};return _0x4a3e1a;})});}_0x5d37e4=_[_0x3860('0x51')]({},_0x5d37e4,_0x361113['options']);return db[_0x3860('0x6e')][_0x3860('0x2f')]({'where':_0x5d37e4[_0x3860('0x4f')]})['then'](function(_0x2f9470){_0x15b0b0[_0x3860('0x2f')]=_0x2f9470;if(_0x361113[_0x3860('0x44')]['includeAll']){_0x5d37e4[_0x3860('0x59')]=[{'all':!![]}];}return db[_0x3860('0x6e')][_0x3860('0x68')](_0x5d37e4);})['then'](function(_0x3c6005){_0x15b0b0[_0x3860('0x55')]=_0x3c6005;return _0x15b0b0;});}})[_0x3860('0x21')](respondWithFilteredResult(_0x37b34a,_0x5d37e4))['catch'](handleError(_0x37b34a,null));};exports[_0x3860('0x6f')]=function(_0x59a7c5,_0x2e836e,_0x581e7b){return db[_0x3860('0x3e')][_0x3860('0x5a')]({'where':{'id':_0x59a7c5[_0x3860('0x57')]['id']}})[_0x3860('0x21')](handleEntityNotFound(_0x2e836e,null))[_0x3860('0x21')](function(_0x28b55f){if(_0x28b55f){return _0x28b55f[_0x3860('0x6f')](_0x59a7c5[_0x3860('0x44')][_0x3860('0x6a')]);}})[_0x3860('0x21')](respondWithStatusCode(_0x2e836e,null))[_0x3860('0x56')](handleError(_0x2e836e,null));};exports[_0x3860('0x70')]=function(_0x300837,_0x192136,_0x24e374){var _0x186479={'channel':_0x3860('0x71')};var _0x7c4583=[];var _0x47ebbd=[];var _0x37575b={};return db[_0x3860('0x3e')][_0x3860('0x5a')]({'where':{'id':_0x300837[_0x3860('0x57')]['id']},'include':[{'model':db[_0x3860('0x72')],'as':_0x3860('0x73')}]})[_0x3860('0x21')](handleEntityNotFound(_0x192136,null))[_0x3860('0x21')](function(_0x222e5a){_0x186479[_0x3860('0x74')]=_0x222e5a;_0x186479[_0x3860('0x75')]=_['orderBy'](_0x222e5a[_0x3860('0x73')],[_0x3860('0x76')],[_0x3860('0x77')]);if(_0x186479[_0x3860('0x74')]['Applications']){delete _0x186479[_0x3860('0x74')][_0x3860('0x73')];}return db[_0x3860('0x78')][_0x3860('0x63')]();})['then'](function(_0x280747){if(!_0x280747){throw new db['Sequelize']['ValidationError'](_0x3860('0x79'));}_0x7c4583=_[_0x3860('0x7a')](_[_0x3860('0x45')](_0x280747),[_0x3860('0x7b'),_0x3860('0x7c')]);_0x47ebbd=_[_0x3860('0x7a')](_[_0x3860('0x45')](_0x280747),[_0x3860('0x7b'),_0x3860('0x7c'),_0x3860('0x7d'),_0x3860('0x7e')]);_0x186479[_0x3860('0x5c')]={'mapKey':_0x3860('0x7f')};if(_0x186479['account'][_0x3860('0x41')]){switch(_0x186479['account'][_0x3860('0x41')]){case _0x3860('0x80'):_0x186479['body'][_0x3860('0x81')]=_0x300837[_0x3860('0x5c')][_0x3860('0x82')];_0x186479[_0x3860('0x5c')][_0x3860('0x5c')]=_0x300837[_0x3860('0x5c')][_0x3860('0x83')];_0x186479['body'][_0x3860('0x84')]=_0x300837[_0x3860('0x5c')][_0x3860('0x85')];break;case _0x3860('0x86'):_0x186479[_0x3860('0x5c')]['from']='+'+_0x300837[_0x3860('0x5c')]['sender'];_0x186479['body']['body']=_0x300837[_0x3860('0x5c')][_0x3860('0x87')];break;case _0x3860('0x88'):_0x186479[_0x3860('0x5c')][_0x3860('0x81')]=_0x300837[_0x3860('0x5c')][_0x3860('0x81')];_0x186479[_0x3860('0x5c')]['body']=_0x300837[_0x3860('0x5c')][_0x3860('0x2a')];break;case'clicksend':_0x186479['body'][_0x3860('0x81')]=_0x300837[_0x3860('0x5c')][_0x3860('0x81')];_0x186479['body'][_0x3860('0x5c')]=_0x300837['body'][_0x3860('0x5c')];_0x186479['body'][_0x3860('0x84')]=_0x300837[_0x3860('0x5c')]['message_id'];break;case _0x3860('0x89'):_0x186479[_0x3860('0x5c')]['from']=_0x300837[_0x3860('0x5c')][_0x3860('0x82')];_0x186479[_0x3860('0x5c')]['body']=_0x300837[_0x3860('0x5c')]['Text'];_0x186479[_0x3860('0x5c')][_0x3860('0x84')]=_0x300837['body'][_0x3860('0x8a')];break;case _0x3860('0x8b'):_0x186479[_0x3860('0x5c')][_0x3860('0x81')]='+'+_0x300837[_0x3860('0x5c')]['results'][0x0][_0x3860('0x81')];_0x186479[_0x3860('0x5c')]['body']=_0x300837['body'][_0x3860('0x8c')][0x0]['text'];_0x186479[_0x3860('0x5c')][_0x3860('0x84')]=_0x300837['body'][_0x3860('0x8c')][0x0]['messageId'];break;case _0x3860('0x8d'):_0x186479['body'][_0x3860('0x81')]=_0x300837[_0x3860('0x5c')][_0x3860('0x8e')];_0x186479[_0x3860('0x5c')]['body']=_0x300837[_0x3860('0x5c')][_0x3860('0x8f')][_0x3860('0x2a')];break;case _0x3860('0x90'):_0x186479['body'][_0x3860('0x81')]=_0x300837[_0x3860('0x5c')]['fromNumber'];_0x186479[_0x3860('0x5c')][_0x3860('0x5c')]=_0x300837[_0x3860('0x5c')][_0x3860('0x87')];_0x186479['body'][_0x3860('0x84')]=_0x300837[_0x3860('0x5c')][_0x3860('0x91')];break;case _0x3860('0x92'):_0x186479['body'][_0x3860('0x81')]=_0x300837['body']['from'];_0x186479['body'][_0x3860('0x5c')]=_0x300837[_0x3860('0x5c')][_0x3860('0x2a')];_0x186479['body'][_0x3860('0x84')]=_0x300837['body'][_0x3860('0x93')];break;}}if(_0x186479[_0x3860('0x5c')]['id']){delete _0x186479[_0x3860('0x5c')]['id'];}if(_[_0x3860('0x94')](_0x186479['body'][_0x3860('0x81')])){throw new db[(_0x3860('0x1d'))][(_0x3860('0x1e'))]('from\x20is\x20mandatory');}if(_[_0x3860('0x94')](_0x186479[_0x3860('0x5c')]['body'])||_0x186479['body']['body']===''){throw new db['Sequelize'][(_0x3860('0x1e'))](_0x3860('0x95'));}if(_[_0x3860('0x94')](_0x186479[_0x3860('0x5c')][_0x3860('0x96')])){throw new db[(_0x3860('0x1d'))][(_0x3860('0x1e'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x47ebbd);}if(!_['includes'](_0x47ebbd,_0x186479['body'][_0x3860('0x96')])){throw new db[(_0x3860('0x1d'))][(_0x3860('0x1e'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x47ebbd);}_0x37575b[_0x186479[_0x3860('0x5c')]['mapKey']]=_0x186479['body']['from'];return db[_0x3860('0x97')]['find']({'where':{'id':_0x186479['account'][_0x3860('0x7e')]},'include':[{'model':db[_0x3860('0x78')],'as':_0x3860('0x98'),'where':_0x37575b,'limit':0x1,'order':[[_0x3860('0x7c'),'DESC']]}]});})['then'](handleEntityNotFound(_0x192136,null))['then'](function(_0x4bc171){if(_0x4bc171){_0x186479[_0x3860('0x99')]=_['omit'](_0x4bc171,['Contacts']);if(_0x4bc171[_0x3860('0x98')][_0x3860('0x58')]){return _0x4bc171[_0x3860('0x98')][0x0];}var _0x14db3e=_['defaults'](_0x186479[_0x3860('0x5c')],{'firstName':_0x186479[_0x3860('0x5c')][_0x3860('0x81')],'ListId':_0x4bc171['id']});_0x14db3e[_0x186479[_0x3860('0x5c')]['mapKey']]=_0x186479['body'][_0x3860('0x81')];return db['CmContact'][_0x3860('0x5b')](_0x14db3e,{'fields':_0x7c4583,'raw':!![]});}})['then'](handleEntityNotFound(_0x192136,null))[_0x3860('0x21')](function(_0x4423fc){if(_0x4423fc){_0x186479[_0x3860('0x9a')]=_0x4423fc;var _0x26b48c={'ContactId':_0x4423fc['id'],'phone':_0x186479[_0x3860('0x5c')]['from'],'SmsAccountId':_0x300837['params']['id']};var _0x5e3c54={'ContactId':_0x4423fc['id'],'SmsAccountId':_0x300837[_0x3860('0x57')]['id'],'closed':![]};return db[_0x3860('0x9b')][_0x3860('0x5a')]({'where':_0x5e3c54})[_0x3860('0x21')](function(_0x356ca7){if(_0x356ca7){return[_0x356ca7,![]];}return db['SmsInteraction'][_0x3860('0x5b')](_0x26b48c)[_0x3860('0x21')](function(_0x52ec1e){return[_0x52ec1e,!![]];});});}})[_0x3860('0x9c')](function(_0x5a66d5,_0x56d4fa){_0x186479[_0x3860('0x9d')]=_0x5a66d5['get']({'plain':!![]});_0x186479[_0x3860('0x9d')][_0x3860('0x9e')]=![];if(_0x56d4fa){if(_0x186479[_0x3860('0x74')][_0x3860('0x9f')]){_0x186479[_0x3860('0x75')][_0x3860('0xa0')]({'id':0x0,'priority':_0x186479[_0x3860('0x75')][_0x3860('0x58')]+0x1,'app':_0x3860('0xa1'),'appdata':_0x3860('0xa2'),'interval':_0x3860('0xa3')});}_0x186479[_0x3860('0x9d')]['created']=!![];}return db[_0x3860('0xa4')]['create']({'phone':_0x186479[_0x3860('0x5c')]['from'],'messageId':_0x186479[_0x3860('0x5c')]['messageId'],'body':_0x186479[_0x3860('0x5c')]['body'],'SmsAccountId':_0x300837['params']['id'],'SmsInteractionId':_0x5a66d5['id'],'direction':'in','ContactId':_0x5a66d5[_0x3860('0xa5')],'AttachmentId':_0x186479[_0x3860('0x5c')][_0x3860('0xa6')]});})[_0x3860('0x21')](function(_0x2d320a){_0x186479['message']=_0x2d320a;if(_0x186479[_0x3860('0x9d')][_0x3860('0xa7')]){return db[_0x3860('0xa8')][_0x3860('0x5a')]({'attributes':['id',_0x3860('0x3a')],'where':{'id':_0x186479[_0x3860('0x9d')]['UserId']}})[_0x3860('0x21')](function(_0x49a3ad){if(_0x49a3ad){_0x186479[_0x3860('0x75')][_0x3860('0xa9')]({'id':0x0,'priority':0x0,'app':_0x3860('0xaa'),'appdata':_0x49a3ad[_0x3860('0x3a')]+','+(_0x186479[_0x3860('0x74')][_0x3860('0xab')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x3860('0xac'),_0x3860('0xad'),_0x186479);});}return respondWithRpcPromise(_0x3860('0xac'),_0x3860('0xad'),_0x186479);})['then'](function(_0x32b4a1){if(_0x32b4a1){var _0x25812a=0xc8;var _0x882090=_0x3860('0xae');logger[_0x3860('0x22')](_0x3860('0x26'),_0x882090,_0x25812a,'entity\x20found');logger[_0x3860('0x25')](_0x3860('0xaf'),_0x882090,_0x25812a,_0x3860('0xb0'),JSON[_0x3860('0x27')](_0x32b4a1));if(_0x186479[_0x3860('0x74')][_0x3860('0x41')]==='twilio'){return _0x192136['status'](_0x25812a)['set'](_0x3860('0xb1'),_0x3860('0xb2'))['send'](_0x3860('0xb3'));}else{return _0x192136[_0x3860('0x2d')](_0x25812a)[_0x3860('0x2e')](_0x32b4a1);}}})[_0x3860('0x56')](handleError(_0x192136,null));};exports[_0x3860('0xb4')]=function(_0x1740d0,_0x7ed4b2,_0x3be188){return db[_0x3860('0x3e')][_0x3860('0x6d')]({'where':{'id':_0x1740d0[_0x3860('0x57')]['id']}})[_0x3860('0x21')](handleEntityNotFound(_0x7ed4b2,null))[_0x3860('0x21')](function(_0x3f6e74){if(_0x3f6e74){return db[_0x3860('0xb5')]['transaction'](function(_0x56566c){return db[_0x3860('0x72')][_0x3860('0x35')]({'where':{'SmsAccountId':_0x1740d0[_0x3860('0x57')]['id']},'transaction':_0x56566c})[_0x3860('0x21')](function(_0x2b1d03){var _0x34dbcd=_[_0x3860('0x52')](_0x1740d0[_0x3860('0x5c')],function(_0x59013c){_0x59013c[_0x3860('0x65')]=_0x1740d0[_0x3860('0x57')]['id'];return _0x59013c;});return db[_0x3860('0x72')]['bulkCreate'](_0x34dbcd,{'transaction':_0x56566c});});})[_0x3860('0x21')](function(){return db[_0x3860('0x72')][_0x3860('0xb6')]({'where':{'SmsAccountId':_0x1740d0[_0x3860('0x57')]['id']},'order':_0x3860('0x76')});});}})[_0x3860('0x21')](respondWithResult(_0x7ed4b2,null))[_0x3860('0x56')](handleError(_0x7ed4b2,null));};exports[_0x3860('0xb7')]=function(_0x2756b0,_0x563efd,_0x1df6e0){var _0xe76c32={};var _0x4a911f={};var _0x335644;var _0x220e19;return db[_0x3860('0x3e')]['findOne']({'where':{'id':_0x2756b0[_0x3860('0x57')]['id']}})[_0x3860('0x21')](handleEntityNotFound(_0x563efd,null))[_0x3860('0x21')](function(_0x365997){if(_0x365997){_0x335644=_0x365997;_0x4a911f['model']=_['keys'](db[_0x3860('0x72')]['rawAttributes']);_0x4a911f[_0x3860('0x44')]=_[_0x3860('0x45')](_0x2756b0[_0x3860('0x44')]);_0x4a911f[_0x3860('0x46')]=_[_0x3860('0x48')](_0x4a911f[_0x3860('0x43')],_0x4a911f[_0x3860('0x44')]);_0xe76c32[_0x3860('0x47')]=_['intersection'](_0x4a911f[_0x3860('0x43')],qs[_0x3860('0x49')](_0x2756b0['query']['fields']));_0xe76c32[_0x3860('0x47')]=_0xe76c32['attributes'][_0x3860('0x58')]?_0xe76c32[_0x3860('0x47')]:_0x4a911f[_0x3860('0x43')];_0xe76c32[_0x3860('0x4d')]=qs[_0x3860('0x4e')](_0x2756b0[_0x3860('0x44')][_0x3860('0x4e')]);_0xe76c32[_0x3860('0x4f')]=qs['filters'](_['pick'](_0x2756b0[_0x3860('0x44')],_0x4a911f['filters']));if(_0x2756b0[_0x3860('0x44')][_0x3860('0x50')]){_0xe76c32[_0x3860('0x4f')]=_[_0x3860('0x51')](_0xe76c32[_0x3860('0x4f')],{'$or':_[_0x3860('0x52')](_0xe76c32[_0x3860('0x47')],function(_0x56a058){var _0x4ae30c={};_0x4ae30c[_0x56a058]={'$like':'%'+_0x2756b0[_0x3860('0x44')][_0x3860('0x50')]+'%'};return _0x4ae30c;})});}_0xe76c32=_[_0x3860('0x51')]({},_0xe76c32,_0x2756b0['options']);return _0x335644[_0x3860('0xb7')](_0xe76c32);}})[_0x3860('0x21')](function(_0x12b5b0){if(_0x12b5b0){_0x220e19=_0x12b5b0['length'];if(!_0x2756b0[_0x3860('0x44')][_0x3860('0x4a')]('nolimit')){_0xe76c32['limit']=qs['limit'](_0x2756b0['query']['limit']);_0xe76c32[_0x3860('0x30')]=qs[_0x3860('0x30')](_0x2756b0[_0x3860('0x44')][_0x3860('0x30')]);}return _0x335644[_0x3860('0xb7')](_0xe76c32);}})['then'](function(_0x5ad108){if(_0x5ad108){return _0x5ad108?{'count':_0x220e19,'rows':_0x5ad108}:null;}})[_0x3860('0x21')](respondWithResult(_0x563efd,null))['catch'](handleError(_0x563efd,null));};exports[_0x3860('0xb8')]=function(_0x14ac68,_0x2c4523,_0x38cdf1){var _0x4ab7b2={'raw':![],'where':{}};var _0x4c8a10={};var _0x534237={'count':0x0,'rows':[]};return db[_0x3860('0x3e')]['findOne']({'where':{'id':_0x14ac68[_0x3860('0x57')]['id']}})[_0x3860('0x21')](handleEntityNotFound(_0x2c4523,null))[_0x3860('0x21')](function(_0x21f679){if(_0x21f679){_0x4c8a10[_0x3860('0x43')]=_[_0x3860('0x45')](db[_0x3860('0x9b')][_0x3860('0x3f')]);_0x4c8a10[_0x3860('0x44')]=_[_0x3860('0x45')](_0x14ac68[_0x3860('0x44')]);_0x4c8a10[_0x3860('0x46')]=_[_0x3860('0x48')](_0x4c8a10[_0x3860('0x43')],_0x4c8a10[_0x3860('0x44')]);_0x4ab7b2[_0x3860('0x47')]=_[_0x3860('0x48')](_0x4c8a10[_0x3860('0x43')],qs['fields'](_0x14ac68[_0x3860('0x44')]['fields']));_0x4ab7b2[_0x3860('0x47')]=_0x4ab7b2[_0x3860('0x47')][_0x3860('0x58')]?_0x4ab7b2[_0x3860('0x47')]:_0x4c8a10[_0x3860('0x43')];if(!_0x14ac68[_0x3860('0x44')][_0x3860('0x4a')](_0x3860('0x4b'))){_0x4ab7b2[_0x3860('0x4c')]=qs['limit'](_0x14ac68[_0x3860('0x44')][_0x3860('0x4c')]);_0x4ab7b2[_0x3860('0x30')]=qs[_0x3860('0x30')](_0x14ac68[_0x3860('0x44')][_0x3860('0x30')]);}_0x4ab7b2[_0x3860('0x4d')]=qs['sort'](_0x14ac68[_0x3860('0x44')][_0x3860('0x4e')]);_0x4ab7b2[_0x3860('0x4f')]=qs['filters'](_[_0x3860('0x66')](_0x14ac68[_0x3860('0x44')],_0x4c8a10[_0x3860('0x46')]));_0x4ab7b2['where']['SmsAccountId']=_0x21f679['id'];if(_0x14ac68[_0x3860('0x44')][_0x3860('0x50')]){_0x4ab7b2['where']=_[_0x3860('0x51')](_0x4ab7b2['where'],{'$or':_[_0x3860('0x52')](_0x4ab7b2[_0x3860('0x47')],function(_0x4fefbe){var _0x46e35a={};_0x46e35a[_0x4fefbe]={'$like':'%'+_0x14ac68['query'][_0x3860('0x50')]+'%'};return _0x46e35a;})});}_0x4ab7b2=_[_0x3860('0x51')]({},_0x4ab7b2,_0x14ac68[_0x3860('0x53')]);return db[_0x3860('0x9b')][_0x3860('0x2f')]({'where':_0x4ab7b2[_0x3860('0x4f')]})[_0x3860('0x21')](function(_0x57ec8a){_0x534237[_0x3860('0x2f')]=_0x57ec8a;if(_0x14ac68['query'][_0x3860('0x54')]){_0x4ab7b2[_0x3860('0x59')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x3860('0xa8')],'as':_0x3860('0xb9'),'attributes':[_0x3860('0x3a'),_0x3860('0xba'),'internal'],'required':![]},{'model':db[_0x3860('0xbb')],'as':_0x3860('0xbc'),'attributes':['id',_0x3860('0x3a'),'color'],'where':_0x14ac68[_0x3860('0x44')][_0x3860('0xbd')]?{'id':_0x14ac68['query'][_0x3860('0xbd')]}:undefined,'required':_0x14ac68[_0x3860('0x44')][_0x3860('0xbd')]?!![]:![]}];}return db[_0x3860('0x9b')][_0x3860('0x68')](_0x4ab7b2);})[_0x3860('0x21')](function(_0x2b93dc){_0x534237['rows']=_0x2b93dc;return _0x534237;});}})[_0x3860('0x21')](respondWithFilteredResult(_0x2c4523,_0x4ab7b2))[_0x3860('0x56')](handleError(_0x2c4523,null));};exports[_0x3860('0x3b')]=function(_0x8e89f,_0x22e031,_0x54ebd7){var _0x24b337,_0xc3350c,_0x378daf;if(_[_0x3860('0x94')](_0x8e89f[_0x3860('0x5c')][_0x3860('0x5c')])||_0x8e89f['body'][_0x3860('0x5c')]===''){throw new db[(_0x3860('0x1d'))][(_0x3860('0x1e'))](_0x3860('0x95'));}if(_[_0x3860('0x94')](_0x8e89f[_0x3860('0x5c')]['to'])){throw new db[(_0x3860('0x1d'))][(_0x3860('0x1e'))]('to\x20is\x20mandatory');}_0x24b337=_0x8e89f[_0x3860('0x5c')]['to'];return db[_0x3860('0x3e')][_0x3860('0x5a')]({'where':{'id':_0x8e89f[_0x3860('0x57')]['id']},'include':[{'model':db[_0x3860('0x97')],'as':_0x3860('0xbe'),'include':[{'model':db[_0x3860('0x78')],'as':_0x3860('0x98'),'where':{'mobile':_0x24b337},'limit':0x1,'order':[[_0x3860('0x7c'),'DESC']]}]}]})[_0x3860('0x21')](handleEntityNotFound(_0x22e031,null))[_0x3860('0x21')](function(_0x20ea3e){if(_0x20ea3e&&_0x20ea3e[_0x3860('0xbe')]){_0xc3350c=_0x20ea3e[_0x3860('0x36')]({'plain':!![]});if(_0xc3350c[_0x3860('0xbe')]&&_0xc3350c[_0x3860('0xbe')][_0x3860('0x98')][_0x3860('0x58')]){return _0xc3350c[_0x3860('0xbe')][_0x3860('0x98')][0x0];}return db[_0x3860('0x78')][_0x3860('0x5b')](_[_0x3860('0x15')](_0x8e89f[_0x3860('0x5c')],{'firstName':_0x24b337,'mobile':_0x24b337,'phone':_0x24b337,'ListId':_0xc3350c['ListId']}));}})[_0x3860('0x21')](handleEntityNotFound(_0x22e031,null))[_0x3860('0x21')](function(_0x2c5645){if(_0x2c5645){_0x378daf=_0x2c5645;return db[_0x3860('0x9b')][_0x3860('0x5a')]({'where':{'ContactId':_0x378daf['id'],'closed':![],'SmsAccountId':_0xc3350c['id']}})[_0x3860('0x21')](function(_0x3190d5){if(_0x3190d5){return[_0x3190d5,![]];}return db[_0x3860('0x9b')][_0x3860('0x5b')]({'UserId':_0x8e89f[_0x3860('0x5d')]['id'],'ContactId':_0x378daf['id'],'SmsAccountId':_0xc3350c['id'],'phone':_0x24b337,'firstMsgDirection':_0x3860('0xbf'),'Messages':[_[_0x3860('0x51')](_0x8e89f['body'],{'read':![],'body':_0x8e89f[_0x3860('0x5c')]['body'],'phone':_0x24b337,'SmsAccountId':_0xc3350c['id'],'UserId':_0x8e89f[_0x3860('0x5d')]['id'],'ContactId':_0x378daf['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x3860('0xc0')}]})['then'](function(_0x43f8f3){return[_0x43f8f3,!![]];});});}})[_0x3860('0x9c')](function(_0x55799e,_0x3334eb){if(_0x3334eb){return _0x55799e;}return db[_0x3860('0xa4')][_0x3860('0x5b')](_[_0x3860('0x51')](_0x8e89f[_0x3860('0x5c')],{'read':![],'body':_0x8e89f['body']['body'],'phone':_0x24b337,'SmsAccountId':_0xc3350c['id'],'SmsInteractionId':_0x55799e['id'],'UserId':_0x8e89f[_0x3860('0x5d')]['id'],'ContactId':_0x378daf['id']}))[_0x3860('0x21')](function(_0x1ecdef){_0x55799e[_0x3860('0xc1')][_0x3860('0xc0')]=[];_0x55799e[_0x3860('0xc1')][_0x3860('0xc0')]['push'](_0x1ecdef[_0x3860('0xc1')]);return _0x55799e;});})['then'](respondWithResult(_0x22e031,null))[_0x3860('0x56')](handleError(_0x22e031,null));};exports[_0x3860('0x2d')]=function(_0xe64842,_0x6b9417,_0x567675){if(_0xe64842[_0x3860('0x5c')]['id']){delete _0xe64842[_0x3860('0x5c')]['id'];}console['log'](_0x3860('0xc2'),_0xe64842['body']);var _0x3ab005,_0x25031a,_0x463b2a;return db[_0x3860('0x3e')][_0x3860('0x5a')]({'where':{'id':_0xe64842[_0x3860('0x57')]['id']}})[_0x3860('0x21')](handleEntityNotFound(_0x6b9417,null))[_0x3860('0x21')](function(_0x33504f){if(_0x33504f){_0x463b2a=_0x33504f;logger['debug'](_0x3860('0x26'),_0x3860('0x2d'),_0x3860('0xc3'),_0x33504f['type'],util['inspect'](_0xe64842['body'],{'showHidden':![],'depth':null}));switch(_0x33504f[_0x3860('0x41')]){case _0x3860('0x86'):if(_0xe64842[_0x3860('0x5c')][_0x3860('0xc4')]&&_0xe64842[_0x3860('0x5c')][_0x3860('0x2d')]){_0x25031a=_0xe64842[_0x3860('0x5c')]['status'];return db[_0x3860('0xa4')][_0x3860('0x5a')]({'where':{'messageId':_0xe64842[_0x3860('0x5c')][_0x3860('0xc4')]}});}break;case'connectel':if(_0xe64842[_0x3860('0x5c')][_0x3860('0xc5')]&&_0xe64842['body'][_0x3860('0xc6')]){_0x25031a=_0xe64842[_0x3860('0x5c')][_0x3860('0xc6')];return db[_0x3860('0xa4')][_0x3860('0x5a')]({'where':{'messageId':_0xe64842[_0x3860('0x5c')][_0x3860('0xc5')]}});}break;case _0x3860('0xc7'):if(_0xe64842[_0x3860('0x5c')][_0x3860('0xc8')]&&_0xe64842[_0x3860('0x5c')][_0x3860('0xc9')]){_0x25031a=_0xe64842['body']['status_code'];return db[_0x3860('0xa4')]['find']({'where':{'messageId':_0xe64842['body'][_0x3860('0xc8')]}});}break;case _0x3860('0x8b'):var _0x94a93f=_0xe64842[_0x3860('0x5c')][_0x3860('0x8c')][0x0];if(_0x94a93f[_0x3860('0x84')]&&_0x94a93f['status'][_0x3860('0xca')]===_0x3860('0xcb')){_0x25031a=_0x94a93f['status'][_0x3860('0xca')];return db['SmsMessage']['find']({'where':{'messageId':_0x94a93f['messageId']}});}break;case _0x3860('0x90'):if(_0xe64842[_0x3860('0x5c')][_0x3860('0x84')]&&_0xe64842[_0x3860('0x5c')][_0x3860('0x2d')]){_0x25031a=_0xe64842[_0x3860('0x5c')]['status'];return db[_0x3860('0xa4')][_0x3860('0x5a')]({'where':{'messageId':_0xe64842[_0x3860('0x5c')]['messageId']}});}break;case _0x3860('0x92'):if(_0xe64842[_0x3860('0x5c')][_0x3860('0xcc')]&&_0xe64842['body'][_0x3860('0x2d')]){_0x25031a=_0xe64842['body'][_0x3860('0x2d')];return db['SmsMessage'][_0x3860('0x5a')]({'where':{'messageId':_0xe64842[_0x3860('0x5c')][_0x3860('0xcc')]}});}break;}}})[_0x3860('0x21')](handleEntityNotFound(_0x6b9417,null))['then'](function(_0xb27305){if(_0xb27305){_0x3ab005=_0xb27305;switch(_0x463b2a['type']){case _0x3860('0x86'):if(_0x25031a===_0x3860('0xcb')){return _0x3ab005['update']({'read':!![]});}else{logger[_0x3860('0x28')](_0x3860('0x26'),'status',_0x3860('0x86'),util[_0x3860('0xcd')](_0xe64842[_0x3860('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x3860('0x88'):if(_0x25031a==='1'){return _0x3ab005[_0x3860('0x34')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3860('0x2d'),'skebby',util[_0x3860('0xcd')](_0xe64842[_0x3860('0x5c')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0xe64842[_0x3860('0x5c')][_0x3860('0xce')]&&_0x25031a>=0xc8&&_0x25031a<=0xce){return _0x3ab005[_0x3860('0x34')]({'read':!![]});}else{logger['error'](_0x3860('0x26'),'status','clicksend',util['inspect'](_0xe64842['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0xf7862a=_0xe64842[_0x3860('0x5c')]['results'][0x0];if(_0xf7862a[_0x3860('0x2d')][_0x3860('0xca')]===_0x3860('0xcb')){return _0x3ab005[_0x3860('0x34')]({'read':!![]});}else{logger[_0x3860('0x28')](_0x3860('0x26'),_0x3860('0x2d'),'infobip',util[_0x3860('0xcd')](_0xe64842['body'],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x25031a==_0x3860('0xcf')||_0x25031a==_0x3860('0xd0')){return _0x3ab005[_0x3860('0x34')]({'read':!![]});}else{logger[_0x3860('0x28')](_0x3860('0x26'),'status',_0x3860('0x90'),util['inspect'](_0xe64842[_0x3860('0x5c')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x25031a===_0x3860('0xd1')||_0x25031a===_0x3860('0xd2')){return _0x3ab005[_0x3860('0x34')]({'read':!![]});}else{logger[_0x3860('0x28')](_0x3860('0x26'),_0x3860('0x2d'),_0x3860('0x92'),util[_0x3860('0xcd')](_0xe64842[_0x3860('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x3ab005;}})['then'](respondWithResult(_0x6b9417,null))[_0x3860('0x56')](handleError(_0x6b9417,null));};exports[_0x3860('0xd3')]=function(_0x14a28b,_0x3433,_0xf02cb7){var _0x50bb3e,_0x304b48,_0x39d928;return db['SmsAccount']['find']({'where':{'id':_0x14a28b['params']['id']}})[_0x3860('0x21')](handleEntityNotFound(_0x3433,null))[_0x3860('0x21')](function(_0x171bfa){if(_0x171bfa){_0x39d928=_0x171bfa;logger[_0x3860('0x25')](_0x3860('0x26'),_0x3860('0x2d'),_0x3860('0xc3'),_0x171bfa[_0x3860('0x41')],util[_0x3860('0xcd')](_0x14a28b[_0x3860('0x44')],{'showHidden':![],'depth':null}));switch(_0x171bfa[_0x3860('0x41')]){case _0x3860('0x8d'):if(_0x14a28b[_0x3860('0x44')][_0x3860('0xd4')]&&_0x14a28b[_0x3860('0x44')][_0x3860('0xd5')]){_0x304b48=_0x14a28b[_0x3860('0x44')][_0x3860('0xd5')];return db[_0x3860('0xa4')]['find']({'where':{'messageId':_0x14a28b[_0x3860('0x44')][_0x3860('0xd4')]}});}break;}}})[_0x3860('0x21')](handleEntityNotFound(_0x3433,null))['then'](function(_0x3b2c53){if(_0x3b2c53){_0x50bb3e=_0x3b2c53;switch(_0x39d928[_0x3860('0x41')]){case'csc':if(_0x304b48==='2'||_0x304b48==='6'){return _0x50bb3e[_0x3860('0x34')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3860('0x2d'),_0x3860('0x8d'),util[_0x3860('0xcd')](_0x14a28b[_0x3860('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x50bb3e;}})[_0x3860('0x21')](respondWithResult(_0x3433,null))[_0x3860('0x56')](handleError(_0x3433,null));};exports['addAgents']=function(_0x1a0fb8,_0x322a8e,_0x3dd62e){return db['SmsAccount'][_0x3860('0x5a')]({'where':{'id':_0x1a0fb8[_0x3860('0x57')]['id']}})['then'](handleEntityNotFound(_0x322a8e,null))[_0x3860('0x21')](function(_0x5c5755){if(_0x5c5755){return _0x5c5755['addAgents'](_0x1a0fb8[_0x3860('0x5c')][_0x3860('0x6a')],_[_0x3860('0xd6')](_0x1a0fb8[_0x3860('0x5c')],['ids','id'])||{})[_0x3860('0x9c')](function(_0x5303fe){for(var _0x34ad82=0x0;_0x34ad82<_0x1a0fb8[_0x3860('0x5c')][_0x3860('0x6a')][_0x3860('0x58')];_0x34ad82+=0x1){socket['emit']('userSmsAccount:save',{'UserId':_0x1a0fb8['body'][_0x3860('0x6a')][_0x34ad82],'SmsAccountId':_0x1a0fb8[_0x3860('0x57')]['id']});}return _0x5303fe;});}})[_0x3860('0x21')](respondWithResult(_0x322a8e,null))[_0x3860('0x56')](handleError(_0x322a8e,null));};exports[_0x3860('0xd7')]=function(_0x13ff4d,_0x269ee4,_0x4ccd59){return db[_0x3860('0x3e')][_0x3860('0x5a')]({'where':{'id':_0x13ff4d[_0x3860('0x57')]['id']}})[_0x3860('0x21')](handleEntityNotFound(_0x269ee4,null))[_0x3860('0x21')](function(_0x7b5206){if(_0x7b5206){return _0x7b5206[_0x3860('0xd7')](_0x13ff4d['query'][_0x3860('0x6a')])['then'](function(){if(_[_0x3860('0xd8')](_0x13ff4d[_0x3860('0x44')]['ids'])){for(var _0xc043d3=0x0;_0xc043d3<_0x13ff4d[_0x3860('0x44')][_0x3860('0x6a')][_0x3860('0x58')];_0xc043d3+=0x1){socket[_0x3860('0xd9')](_0x3860('0xda'),{'UserId':Number(_0x13ff4d[_0x3860('0x44')][_0x3860('0x6a')][_0xc043d3]),'SmsAccountId':Number(_0x13ff4d[_0x3860('0x57')]['id'])});}}else{socket[_0x3860('0xd9')](_0x3860('0xda'),{'UserId':Number(_0x13ff4d['query'][_0x3860('0x6a')]),'SmsAccountId':Number(_0x13ff4d['params']['id'])});}});}})[_0x3860('0x21')](respondWithStatusCode(_0x269ee4,null))[_0x3860('0x56')](handleError(_0x269ee4,null));};exports[_0x3860('0xdb')]=function(_0x5d5376,_0x4b1382,_0xcfdf5e){var _0x283f6c={};var _0x4adab9={};var _0x2b7405;var _0x235859;return db[_0x3860('0x3e')][_0x3860('0x6d')]({'where':{'id':_0x5d5376[_0x3860('0x57')]['id']}})[_0x3860('0x21')](handleEntityNotFound(_0x4b1382,null))['then'](function(_0x4c4ccc){if(_0x4c4ccc){_0x2b7405=_0x4c4ccc;_0x4adab9['model']=_[_0x3860('0x45')](db['User']['rawAttributes']);_0x4adab9['query']=_[_0x3860('0x45')](_0x5d5376[_0x3860('0x44')]);_0x4adab9[_0x3860('0x46')]=_[_0x3860('0x48')](_0x4adab9[_0x3860('0x43')],_0x4adab9[_0x3860('0x44')]);_0x283f6c[_0x3860('0x47')]=_[_0x3860('0x48')](_0x4adab9['model'],qs['fields'](_0x5d5376[_0x3860('0x44')][_0x3860('0x49')]));_0x283f6c[_0x3860('0x47')]=_0x283f6c[_0x3860('0x47')][_0x3860('0x58')]?_0x283f6c[_0x3860('0x47')]:_0x4adab9[_0x3860('0x43')];_0x283f6c[_0x3860('0x4d')]=qs[_0x3860('0x4e')](_0x5d5376[_0x3860('0x44')][_0x3860('0x4e')]);_0x283f6c[_0x3860('0x4f')]=qs[_0x3860('0x46')](_[_0x3860('0x66')](_0x5d5376['query'],_0x4adab9['filters']));if(_0x5d5376['query'][_0x3860('0x50')]){_0x283f6c[_0x3860('0x4f')]=_[_0x3860('0x51')](_0x283f6c[_0x3860('0x4f')],{'$or':_[_0x3860('0x52')](_0x283f6c[_0x3860('0x47')],function(_0x1029c4){var _0x4d1794={};_0x4d1794[_0x1029c4]={'$like':'%'+_0x5d5376[_0x3860('0x44')][_0x3860('0x50')]+'%'};return _0x4d1794;})});}_0x283f6c=_['merge']({},_0x283f6c,_0x5d5376[_0x3860('0x53')]);return _0x2b7405[_0x3860('0xdb')](_0x283f6c);}})[_0x3860('0x21')](function(_0x3cbefd){if(_0x3cbefd){_0x235859=_0x3cbefd[_0x3860('0x58')];if(!_0x5d5376[_0x3860('0x44')][_0x3860('0x4a')](_0x3860('0x4b'))){_0x283f6c[_0x3860('0x4c')]=qs[_0x3860('0x4c')](_0x5d5376[_0x3860('0x44')]['limit']);_0x283f6c[_0x3860('0x30')]=qs[_0x3860('0x30')](_0x5d5376[_0x3860('0x44')][_0x3860('0x30')]);}return _0x2b7405[_0x3860('0xdb')](_0x283f6c);}})['then'](function(_0x425795){if(_0x425795){return _0x425795?{'count':_0x235859,'rows':_0x425795}:null;}})[_0x3860('0x21')](respondWithResult(_0x4b1382,null))[_0x3860('0x56')](handleError(_0x4b1382,null));}; \ No newline at end of file +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 diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index f662092..52222d9 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 _0x0031=['setMaxListeners','save','remove','emit','hook','exports','../../mysqldb','SmsAccount'];(function(_0x3c5d86,_0x567aac){var _0xae9403=function(_0x5f3a9c){while(--_0x5f3a9c){_0x3c5d86['push'](_0x3c5d86['shift']());}};_0xae9403(++_0x567aac);}(_0x0031,0x7e));var _0x1003=function(_0x2399ea,_0x1c9455){_0x2399ea=_0x2399ea-0x0;var _0x3b525d=_0x0031[_0x2399ea];return _0x3b525d;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x1003('0x0'))['db'][_0x1003('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x1003('0x2')](0x0);var events={'afterCreate':_0x1003('0x3'),'afterUpdate':'update','afterDestroy':_0x1003('0x4')};function emitEvent(_0x30896a){return function(_0x1b928f,_0x31afa3,_0x4b98b0){SmsAccountEvents[_0x1003('0x5')](_0x30896a+':'+_0x1b928f['id'],_0x1b928f);SmsAccountEvents[_0x1003('0x5')](_0x30896a,_0x1b928f);_0x4b98b0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x1003('0x6')](e,emitEvent(event));}}module[_0x1003('0x7')]=SmsAccountEvents; \ No newline at end of file +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 diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index b522763..a888fe2 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 _0x8ede=['lodash','util','moment','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','sms_accounts'];(function(_0x4d2263,_0x3fbf0d){var _0x24aba0=function(_0x389a59){while(--_0x389a59){_0x4d2263['push'](_0x4d2263['shift']());}};_0x24aba0(++_0x3fbf0d);}(_0x8ede,0x1ce));var _0xe8ed=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8ede[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe8ed('0x0'));var util=require(_0xe8ed('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe8ed('0x2'));var BPromise=require('bluebird');var rp=require(_0xe8ed('0x3'));var fs=require('fs');var path=require(_0xe8ed('0x4'));var rimraf=require(_0xe8ed('0x5'));var config=require(_0xe8ed('0x6'));var attributes=require(_0xe8ed('0x7'));module[_0xe8ed('0x8')]=function(_0x20a4fe,_0x7cddac){return _0x20a4fe[_0xe8ed('0x9')]('SmsAccount',attributes,{'tableName':_0xe8ed('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index b487203..157e3f8 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 _0xbf04=['defaults','socket.io-emitter','./smsAccount.socket','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsAccount','options','raw','where','attributes','map','model','include','ShowSmsAccount','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x153fb4,_0x2c3ead){var _0x3c25bc=function(_0x266d2d){while(--_0x266d2d){_0x153fb4['push'](_0x153fb4['shift']());}};_0x3c25bc(++_0x2c3ead);}(_0xbf04,0x139));var _0x4bf0=function(_0x3169cf,_0x9f2d16){_0x3169cf=_0x3169cf-0x0;var _0x588b09=_0xbf04[_0x3169cf];return _0x588b09;};'use strict';var _=require('lodash');var util=require(_0x4bf0('0x0'));var moment=require('moment');var BPromise=require(_0x4bf0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4bf0('0x2'));var db=require(_0x4bf0('0x3'))['db'];var utils=require(_0x4bf0('0x4'));var logger=require(_0x4bf0('0x5'))(_0x4bf0('0x6'));var config=require(_0x4bf0('0x7'));var jayson=require(_0x4bf0('0x8'));var client=jayson[_0x4bf0('0x9')]['http']({'port':0x232a});config[_0x4bf0('0xa')]=_[_0x4bf0('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4bf0('0xc'))(new Redis(config[_0x4bf0('0xa')]));require(_0x4bf0('0xd'))['register'](socket);function respondWithRpcPromise(_0x495e1b,_0x4d09c9,_0x2d4e5c){return new BPromise(function(_0x4153d0,_0x3c4c17){return client[_0x4bf0('0xe')](_0x495e1b,_0x2d4e5c)[_0x4bf0('0xf')](function(_0x50c77b){logger[_0x4bf0('0x10')](_0x4bf0('0x11'),_0x4d09c9,_0x4bf0('0x12'));logger[_0x4bf0('0x13')](_0x4bf0('0x14'),_0x4d09c9,_0x4bf0('0x12'),JSON[_0x4bf0('0x15')](_0x50c77b));if(_0x50c77b[_0x4bf0('0x16')]){if(_0x50c77b[_0x4bf0('0x16')][_0x4bf0('0x17')]===0x1f4){logger[_0x4bf0('0x16')](_0x4bf0('0x11'),_0x4d09c9,_0x50c77b[_0x4bf0('0x16')]['message']);return _0x3c4c17(_0x50c77b[_0x4bf0('0x16')]['message']);}logger[_0x4bf0('0x16')](_0x4bf0('0x11'),_0x4d09c9,_0x50c77b[_0x4bf0('0x16')][_0x4bf0('0x18')]);return _0x4153d0(_0x50c77b[_0x4bf0('0x16')]['message']);}else{logger[_0x4bf0('0x10')](_0x4bf0('0x11'),_0x4d09c9,'request\x20sent');_0x4153d0(_0x50c77b[_0x4bf0('0x19')]['message']);}})[_0x4bf0('0x1a')](function(_0x5bff48){logger['error'](_0x4bf0('0x11'),_0x4d09c9,_0x5bff48);_0x3c4c17(_0x5bff48);});});}exports['ShowSmsAccount']=function(_0x3f0cda){var _0x5e337f=this;return new Promise(function(_0x42106b,_0x546588){return db[_0x4bf0('0x1b')]['find']({'raw':_0x3f0cda[_0x4bf0('0x1c')]?_0x3f0cda['options'][_0x4bf0('0x1d')]===undefined?!![]:![]:!![],'where':_0x3f0cda[_0x4bf0('0x1c')]?_0x3f0cda[_0x4bf0('0x1c')][_0x4bf0('0x1e')]||null:null,'attributes':_0x3f0cda[_0x4bf0('0x1c')]?_0x3f0cda[_0x4bf0('0x1c')][_0x4bf0('0x1f')]||null:null,'include':_0x3f0cda[_0x4bf0('0x1c')]?_0x3f0cda[_0x4bf0('0x1c')]['include']?_[_0x4bf0('0x20')](_0x3f0cda[_0x4bf0('0x1c')]['include'],function(_0x84aa9b){return{'model':db[_0x84aa9b[_0x4bf0('0x21')]],'as':_0x84aa9b['as'],'attributes':_0x84aa9b[_0x4bf0('0x1f')],'include':_0x84aa9b[_0x4bf0('0x22')]?_[_0x4bf0('0x20')](_0x84aa9b[_0x4bf0('0x22')],function(_0x5e6238){return{'model':db[_0x5e6238[_0x4bf0('0x21')]],'as':_0x5e6238['as'],'attributes':_0x5e6238['attributes'],'include':_0x5e6238['include']?_[_0x4bf0('0x20')](_0x5e6238[_0x4bf0('0x22')],function(_0x3b1536){return{'model':db[_0x3b1536['model']],'as':_0x3b1536['as'],'attributes':_0x3b1536[_0x4bf0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4bf0('0xf')](function(_0x86e9a){logger['info'](_0x4bf0('0x23'),_0x3f0cda);logger['debug'](_0x4bf0('0x23'),_0x3f0cda,JSON[_0x4bf0('0x15')](_0x86e9a));_0x42106b(_0x86e9a);})[_0x4bf0('0x1a')](function(_0x1e20d2){logger[_0x4bf0('0x16')]('ShowSmsAccount',_0x1e20d2[_0x4bf0('0x18')],_0x3f0cda);_0x546588(_0x5e337f[_0x4bf0('0x16')](0x1f4,_0x1e20d2['message']));});});}; \ No newline at end of file +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 diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 0a8bd24..3526073 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 _0xc60c=['remove','update','emit','removeListener','register','smsAccount:','./smsAccount.events'];(function(_0x1cb1fe,_0x216fc8){var _0x52a813=function(_0x107a57){while(--_0x107a57){_0x1cb1fe['push'](_0x1cb1fe['shift']());}};_0x52a813(++_0x216fc8);}(_0xc60c,0x109));var _0xcc60=function(_0x44ab9d,_0x3d060c){_0x44ab9d=_0x44ab9d-0x0;var _0x279648=_0xc60c[_0x44ab9d];return _0x279648;};'use strict';var SmsAccountEvents=require(_0xcc60('0x0'));var events=['save',_0xcc60('0x1'),_0xcc60('0x2')];function createListener(_0x23802b,_0x2defd1){return function(_0x4b0516){_0x2defd1[_0xcc60('0x3')](_0x23802b,_0x4b0516);};}function removeListener(_0xba7797,_0x4e09f1){return function(){SmsAccountEvents[_0xcc60('0x4')](_0xba7797,_0x4e09f1);};}exports[_0xcc60('0x5')]=function(_0x45e676){for(var _0x3597e5=0x0,_0x5106f3=events['length'];_0x3597e5<_0x5106f3;_0x3597e5++){var _0x12e582=events[_0x3597e5];var _0x3d65af=createListener(_0xcc60('0x6')+_0x12e582,_0x45e676);SmsAccountEvents['on'](_0x12e582,_0x3d65af);}}; \ No newline at end of file +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 diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 3cdbcc1..9aaefc3 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 _0x7e90=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','post','create','put','delete','multer','util','path'];(function(_0x2d2ca2,_0x51873f){var _0x48489d=function(_0x1a2cf7){while(--_0x1a2cf7){_0x2d2ca2['push'](_0x2d2ca2['shift']());}};_0x48489d(++_0x51873f);}(_0x7e90,0x16d));var _0x07e9=function(_0x3f3ad0,_0x5d47bd){_0x3f3ad0=_0x3f3ad0-0x0;var _0x1d8185=_0x7e90[_0x3f3ad0];return _0x1d8185;};'use strict';var multer=require(_0x07e9('0x0'));var util=require(_0x07e9('0x1'));var path=require(_0x07e9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x07e9('0x3')]();var auth=require(_0x07e9('0x4'));var interaction=require(_0x07e9('0x5'));var config=require(_0x07e9('0x6'));var controller=require(_0x07e9('0x7'));router[_0x07e9('0x8')]('/',auth[_0x07e9('0x9')](),controller[_0x07e9('0xa')]);router[_0x07e9('0x8')](_0x07e9('0xb'),auth[_0x07e9('0x9')](),controller['show']);router[_0x07e9('0xc')]('/',auth['isAuthenticated'](),controller[_0x07e9('0xd')]);router[_0x07e9('0xe')](_0x07e9('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x07e9('0xf')](_0x07e9('0xb'),auth[_0x07e9('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 6fc6e97..cca5087 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 _0xc982=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x39dfaa,_0x319a6f){var _0x2f2744=function(_0x6c694c){while(--_0x6c694c){_0x39dfaa['push'](_0x39dfaa['shift']());}};_0x2f2744(++_0x319a6f);}(_0xc982,0x11d));var _0x2c98=function(_0x2eaa66,_0x2062c0){_0x2eaa66=_0x2eaa66-0x0;var _0x3b1dd3=_0xc982[_0x2eaa66];return _0x3b1dd3;};'use strict';var Sequelize=require(_0x2c98('0x0'));module[_0x2c98('0x1')]={'priority':{'type':Sequelize[_0x2c98('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2c98('0x3')],'allowNull':![],'defaultValue':_0x2c98('0x4')},'appdata':{'type':Sequelize[_0x2c98('0x5')]()},'description':{'type':Sequelize[_0x2c98('0x3')]},'interval':{'type':Sequelize[_0x2c98('0x3')],'defaultValue':_0x2c98('0x6')}}; \ No newline at end of file +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 diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 045e588..bf57b51 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 _0x444c=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','SmsApplication','rawAttributes','type','key','model','query','filters','intersection','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','fields','includeAll','find','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis'];(function(_0x422763,_0x46ee6e){var _0x5e39e1=function(_0x562b09){while(--_0x562b09){_0x422763['push'](_0x422763['shift']());}};_0x5e39e1(++_0x46ee6e);}(_0x444c,0x108));var _0xc444=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x444c[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc444('0x0'));var rimraf=require(_0xc444('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc444('0x2'));var rp=require('request-promise');var moment=require(_0xc444('0x3'));var BPromise=require(_0xc444('0x4'));var Mustache=require(_0xc444('0x5'));var util=require(_0xc444('0x6'));var path=require(_0xc444('0x7'));var sox=require('sox');var csv=require(_0xc444('0x8'));var ejs=require(_0xc444('0x9'));var fs=require('fs');var _=require(_0xc444('0xa'));var squel=require('squel');var crypto=require(_0xc444('0xb'));var jsforce=require(_0xc444('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc444('0x8'));var querystring=require(_0xc444('0xd'));var Papa=require(_0xc444('0xe'));var Redis=require(_0xc444('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc444('0x10'));var hardwareService=require(_0xc444('0x11'));var logger=require(_0xc444('0x12'))(_0xc444('0x13'));var utils=require(_0xc444('0x14'));var config=require(_0xc444('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x191559,_0x369caa){_0x369caa=_0x369caa||0xcc;return function(_0x4042ac){if(_0x4042ac){return _0x191559[_0xc444('0x16')](_0x369caa);}return _0x191559[_0xc444('0x17')](_0x369caa)[_0xc444('0x18')]();};}function respondWithResult(_0x2b32f6,_0x4e71dd){_0x4e71dd=_0x4e71dd||0xc8;return function(_0x6712c9){if(_0x6712c9){return _0x2b32f6['status'](_0x4e71dd)[_0xc444('0x19')](_0x6712c9);}};}function respondWithFilteredResult(_0x57b4cc,_0x3c8231){return function(_0x23cbe6){if(_0x23cbe6){var _0x499385=_0x23cbe6[_0xc444('0x1a')],_0x594596=_0x3c8231[_0xc444('0x1b')],_0x284416=_0x3c8231[_0xc444('0x1b')]+_0x3c8231[_0xc444('0x1c')],_0x4ad5e8;if(_0x284416>=_0x499385){_0x284416=_0x499385;_0x4ad5e8=0xc8;}else{_0x4ad5e8=0xce;}_0x57b4cc['status'](_0x4ad5e8);return _0x57b4cc['set'](_0xc444('0x1d'),_0x594596+'-'+_0x284416+'/'+_0x499385)['json'](_0x23cbe6);}return null;};}function patchUpdates(_0x245244){return function(_0x281f62){try{jsonpatch['apply'](_0x281f62,_0x245244,!![]);}catch(_0x311497){return BPromise[_0xc444('0x1e')](_0x311497);}return _0x281f62[_0xc444('0x1f')]();};}function saveUpdates(_0x44f8bf,_0x200b49){return function(_0x55b121){if(_0x55b121){return _0x55b121[_0xc444('0x20')](_0x44f8bf)[_0xc444('0x21')](function(_0x592fcc){return _0x592fcc;});}return null;};}function removeEntity(_0x2d0c02,_0x163788){return function(_0x52f29b){if(_0x52f29b){return _0x52f29b[_0xc444('0x22')]()['then'](function(){_0x2d0c02['status'](0xcc)[_0xc444('0x18')]();});}};}function handleEntityNotFound(_0x495975,_0x8f9c24){return function(_0x13288f){if(!_0x13288f){_0x495975['sendStatus'](0x194);}return _0x13288f;};}function handleError(_0x1eb121,_0x5ab1ea){_0x5ab1ea=_0x5ab1ea||0x1f4;return function(_0x3c29e5){logger[_0xc444('0x23')](_0x3c29e5['stack']);if(_0x3c29e5[_0xc444('0x24')]){delete _0x3c29e5[_0xc444('0x24')];}_0x1eb121[_0xc444('0x17')](_0x5ab1ea)[_0xc444('0x25')](_0x3c29e5);};}exports[_0xc444('0x26')]=function(_0x2a24cf,_0x15d6cd){var _0x1a058d={},_0x3614a0={},_0x37172a={'count':0x0,'rows':[]};var _0x198a13=_[_0xc444('0x27')](db[_0xc444('0x28')][_0xc444('0x29')],function(_0x5a1180){return{'name':_0x5a1180['fieldName'],'type':_0x5a1180[_0xc444('0x2a')][_0xc444('0x2b')]};});_0x3614a0[_0xc444('0x2c')]=_[_0xc444('0x27')](_0x198a13,_0xc444('0x24'));_0x3614a0[_0xc444('0x2d')]=_['keys'](_0x2a24cf['query']);_0x3614a0[_0xc444('0x2e')]=_[_0xc444('0x2f')](_0x3614a0[_0xc444('0x2c')],_0x3614a0[_0xc444('0x2d')]);_0x1a058d[_0xc444('0x30')]=_[_0xc444('0x2f')](_0x3614a0[_0xc444('0x2c')],qs['fields'](_0x2a24cf[_0xc444('0x2d')]['fields']));_0x1a058d[_0xc444('0x30')]=_0x1a058d[_0xc444('0x30')][_0xc444('0x31')]?_0x1a058d['attributes']:_0x3614a0[_0xc444('0x2c')];if(!_0x2a24cf[_0xc444('0x2d')]['hasOwnProperty'](_0xc444('0x32'))){_0x1a058d[_0xc444('0x1c')]=qs[_0xc444('0x1c')](_0x2a24cf[_0xc444('0x2d')][_0xc444('0x1c')]);_0x1a058d[_0xc444('0x1b')]=qs[_0xc444('0x1b')](_0x2a24cf[_0xc444('0x2d')]['offset']);}_0x1a058d[_0xc444('0x33')]=qs[_0xc444('0x34')](_0x2a24cf['query'][_0xc444('0x34')]);_0x1a058d[_0xc444('0x35')]=qs[_0xc444('0x2e')](_['pick'](_0x2a24cf['query'],_0x3614a0['filters']));if(_0x2a24cf[_0xc444('0x2d')][_0xc444('0x36')]){_0x1a058d[_0xc444('0x35')]=_[_0xc444('0x37')](_0x1a058d[_0xc444('0x35')],{'$or':_[_0xc444('0x27')](_0x198a13,function(_0x6a0de){if(_0x6a0de[_0xc444('0x2a')]!==_0xc444('0x38')){var _0x50f604={};_0x50f604[_0x6a0de['name']]={'$like':'%'+_0x2a24cf[_0xc444('0x2d')][_0xc444('0x36')]+'%'};return _0x50f604;}})});}_0x1a058d=_[_0xc444('0x37')]({},_0x1a058d,_0x2a24cf[_0xc444('0x39')]);var _0x4e5176={'where':_0x1a058d[_0xc444('0x35')]};return db[_0xc444('0x28')][_0xc444('0x1a')](_0x4e5176)[_0xc444('0x21')](function(_0x54c617){_0x37172a[_0xc444('0x1a')]=_0x54c617;if(_0x2a24cf[_0xc444('0x2d')]['includeAll']){_0x1a058d[_0xc444('0x3a')]=[{'all':!![]}];}return db[_0xc444('0x28')][_0xc444('0x3b')](_0x1a058d);})[_0xc444('0x21')](function(_0x198ac4){_0x37172a[_0xc444('0x3c')]=_0x198ac4;return _0x37172a;})[_0xc444('0x21')](respondWithFilteredResult(_0x15d6cd,_0x1a058d))[_0xc444('0x3d')](handleError(_0x15d6cd,null));};exports[_0xc444('0x3e')]=function(_0x4928a3,_0x25c72d){var _0x2c6eaf={'raw':!![],'where':{'id':_0x4928a3[_0xc444('0x3f')]['id']}},_0x2d91c6={};_0x2d91c6[_0xc444('0x2c')]=_[_0xc444('0x40')](db[_0xc444('0x28')]['rawAttributes']);_0x2d91c6['query']=_['keys'](_0x4928a3[_0xc444('0x2d')]);_0x2d91c6[_0xc444('0x2e')]=_['intersection'](_0x2d91c6['model'],_0x2d91c6[_0xc444('0x2d')]);_0x2c6eaf[_0xc444('0x30')]=_[_0xc444('0x2f')](_0x2d91c6[_0xc444('0x2c')],qs[_0xc444('0x41')](_0x4928a3[_0xc444('0x2d')][_0xc444('0x41')]));_0x2c6eaf['attributes']=_0x2c6eaf['attributes']['length']?_0x2c6eaf[_0xc444('0x30')]:_0x2d91c6[_0xc444('0x2c')];if(_0x4928a3[_0xc444('0x2d')][_0xc444('0x42')]){_0x2c6eaf[_0xc444('0x3a')]=[{'all':!![]}];}_0x2c6eaf=_['merge']({},_0x2c6eaf,_0x4928a3['options']);return db[_0xc444('0x28')][_0xc444('0x43')](_0x2c6eaf)[_0xc444('0x21')](handleEntityNotFound(_0x25c72d,null))[_0xc444('0x21')](respondWithResult(_0x25c72d,null))[_0xc444('0x3d')](handleError(_0x25c72d,null));};exports[_0xc444('0x44')]=function(_0xcd9fd,_0x4b1bff){return db[_0xc444('0x28')]['create'](_0xcd9fd[_0xc444('0x45')],{})[_0xc444('0x21')](respondWithResult(_0x4b1bff,0xc9))[_0xc444('0x3d')](handleError(_0x4b1bff,null));};exports[_0xc444('0x20')]=function(_0x48caad,_0x38ac37){if(_0x48caad[_0xc444('0x45')]['id']){delete _0x48caad['body']['id'];}return db['SmsApplication'][_0xc444('0x43')]({'where':{'id':_0x48caad[_0xc444('0x3f')]['id']}})[_0xc444('0x21')](handleEntityNotFound(_0x38ac37,null))[_0xc444('0x21')](saveUpdates(_0x48caad['body'],null))[_0xc444('0x21')](respondWithResult(_0x38ac37,null))[_0xc444('0x3d')](handleError(_0x38ac37,null));};exports['destroy']=function(_0xf7a058,_0x10e968){return db[_0xc444('0x28')][_0xc444('0x43')]({'where':{'id':_0xf7a058['params']['id']}})[_0xc444('0x21')](handleEntityNotFound(_0x10e968,null))[_0xc444('0x21')](removeEntity(_0x10e968,null))[_0xc444('0x3d')](handleError(_0x10e968,null));}; \ No newline at end of file +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 diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 8a5a071..609cbc0 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 _0x6e3c=['lodash','util','../../config/logger','moment','bluebird','path','rimraf','./smsApplication.attributes','define','utf8mb4','utf8mb4_unicode_ci'];(function(_0x299089,_0x3cff81){var _0x11c91f=function(_0x3e135b){while(--_0x3e135b){_0x299089['push'](_0x299089['shift']());}};_0x11c91f(++_0x3cff81);}(_0x6e3c,0xd1));var _0xc6e3=function(_0x1934fc,_0x437669){_0x1934fc=_0x1934fc-0x0;var _0x4c2de0=_0x6e3c[_0x1934fc];return _0x4c2de0;};'use strict';var _=require(_0xc6e3('0x0'));var util=require(_0xc6e3('0x1'));var logger=require(_0xc6e3('0x2'))('api');var moment=require(_0xc6e3('0x3'));var BPromise=require(_0xc6e3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc6e3('0x5'));var rimraf=require(_0xc6e3('0x6'));var config=require('../../config/environment');var attributes=require(_0xc6e3('0x7'));module['exports']=function(_0x3425a2,_0x595538){return _0x3425a2[_0xc6e3('0x8')]('SmsApplication',attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc6e3('0x9'),'collate':_0xc6e3('0xa')});}; \ No newline at end of file +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 diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 2112cfa..3cf33fc 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 _0x2e65=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','SmsApplication,\x20%s,\x20%s','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x556859,_0x3332c8){var _0x4a3aa5=function(_0x6052b8){while(--_0x6052b8){_0x556859['push'](_0x556859['shift']());}};_0x4a3aa5(++_0x3332c8);}(_0x2e65,0x193));var _0x52e6=function(_0x2e04ef,_0x31a596){_0x2e04ef=_0x2e04ef-0x0;var _0x5722b0=_0x2e65[_0x2e04ef];return _0x5722b0;};'use strict';var _=require(_0x52e6('0x0'));var util=require(_0x52e6('0x1'));var moment=require(_0x52e6('0x2'));var BPromise=require(_0x52e6('0x3'));var rs=require(_0x52e6('0x4'));var fs=require('fs');var Redis=require(_0x52e6('0x5'));var db=require(_0x52e6('0x6'))['db'];var utils=require(_0x52e6('0x7'));var logger=require('../../config/logger')(_0x52e6('0x8'));var config=require(_0x52e6('0x9'));var jayson=require(_0x52e6('0xa'));var client=jayson[_0x52e6('0xb')][_0x52e6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x116651,_0x15e4af,_0x1401a3){return new BPromise(function(_0x27f270,_0x2ab17e){return client['request'](_0x116651,_0x1401a3)[_0x52e6('0xd')](function(_0x1db169){logger['info'](_0x52e6('0xe'),_0x15e4af,'request\x20sent');logger['debug'](_0x52e6('0xf'),_0x15e4af,_0x52e6('0x10'),JSON[_0x52e6('0x11')](_0x1db169));if(_0x1db169[_0x52e6('0x12')]){if(_0x1db169[_0x52e6('0x12')][_0x52e6('0x13')]===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0x15e4af,_0x1db169[_0x52e6('0x12')][_0x52e6('0x14')]);return _0x2ab17e(_0x1db169['error'][_0x52e6('0x14')]);}logger[_0x52e6('0x12')](_0x52e6('0xe'),_0x15e4af,_0x1db169[_0x52e6('0x12')][_0x52e6('0x14')]);return _0x27f270(_0x1db169[_0x52e6('0x12')][_0x52e6('0x14')]);}else{logger[_0x52e6('0x15')](_0x52e6('0xe'),_0x15e4af,_0x52e6('0x10'));_0x27f270(_0x1db169[_0x52e6('0x16')][_0x52e6('0x14')]);}})[_0x52e6('0x17')](function(_0x5c275c){logger['error'](_0x52e6('0xe'),_0x15e4af,_0x5c275c);_0x2ab17e(_0x5c275c);});});} \ No newline at end of file +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 diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 3072eb4..fef577b 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 _0x2292=['describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe'];(function(_0x42de8c,_0x4fabac){var _0x6bb1d2=function(_0x235ecf){while(--_0x235ecf){_0x42de8c['push'](_0x42de8c['shift']());}};_0x6bb1d2(++_0x4fabac);}(_0x2292,0x11e));var _0x2229=function(_0x117395,_0x555417){_0x117395=_0x117395-0x0;var _0x4fc350=_0x2292[_0x117395];return _0x4fc350;};'use strict';var multer=require(_0x2229('0x0'));var util=require('util');var path=require(_0x2229('0x1'));var timeout=require(_0x2229('0x2'));var express=require(_0x2229('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2229('0x4'));var config=require(_0x2229('0x5'));var controller=require(_0x2229('0x6'));router[_0x2229('0x7')]('/',auth[_0x2229('0x8')](),controller[_0x2229('0x9')]);router[_0x2229('0x7')](_0x2229('0xa'),auth['isAuthenticated'](),controller[_0x2229('0xb')]);router[_0x2229('0x7')](_0x2229('0xc'),auth['isAuthenticated'](),controller[_0x2229('0xd')]);router[_0x2229('0x7')](_0x2229('0xe'),auth[_0x2229('0x8')](),controller[_0x2229('0xf')]);router[_0x2229('0x7')](_0x2229('0x10'),auth[_0x2229('0x8')](),controller[_0x2229('0x11')]);router['post']('/',auth[_0x2229('0x8')](),controller[_0x2229('0x12')]);router[_0x2229('0x13')](_0x2229('0xe'),auth[_0x2229('0x8')](),controller[_0x2229('0x14')]);router[_0x2229('0x13')](_0x2229('0x15'),auth[_0x2229('0x8')](),interaction[_0x2229('0x16')](_0x2229('0x17'),_0x2229('0x18')),controller[_0x2229('0x19')]);router['put'](_0x2229('0xc'),auth['isAuthenticated'](),interaction[_0x2229('0x16')]('sms',_0x2229('0x1a')),controller[_0x2229('0x1b')]);router[_0x2229('0x1c')](_0x2229('0xc'),auth['isAuthenticated'](),interaction[_0x2229('0x16')](_0x2229('0x17'),_0x2229('0x1d')),controller[_0x2229('0x1e')]);router[_0x2229('0x1c')](_0x2229('0x15'),auth[_0x2229('0x8')](),controller[_0x2229('0x1f')]);module[_0x2229('0x20')]=router; \ No newline at end of file +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 diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 82779b2..93675f8 100644 --- a/server/api/smsInteraction/smsInteraction.attributes.js +++ b/server/api/smsInteraction/smsInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['DATE','STRING','ENUM','out','exports','BOOLEAN'];(function(_0x134d5e,_0x2a47d8){var _0x1e166a=function(_0x53f10d){while(--_0x53f10d){_0x134d5e['push'](_0x134d5e['shift']());}};_0x1e166a(++_0x2a47d8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x3071('0x0')]={'closed':{'type':Sequelize[_0x3071('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3071('0x2')]},'disposition':{'type':Sequelize[_0x3071('0x3')]},'note':{'type':Sequelize[_0x3071('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x3071('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x3071('0x4')]('in',_0x3071('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3071('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x3071('0x4')]('in',_0x3071('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _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 diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index fadf8b6..35f2f05 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 _0x056b=['then','destroy','end','error','stack','name','Users','map','fullname','TagIds','Tags','split','forEach','push','index','SmsInteraction','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','u.fullname','user_has_sms_interactions','left_join','users','cm_contacts','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','sms_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','i.SmsAccountId\x20IN\x20?','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','i.phone\x20LIKE\x20?','Sequelize','clone','DESC','t.id\x20IN\x20?','resolve','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','merge','a.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','SmsInteractionId','all','params','rawAttributes','includeAll','include','create','catch','describe','addMessage','SmsMessage','ids','omit','findOne','fields','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','rows','addTags','setTags','emit','smsInteractionTags:save','removeTags','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','lastName','Messages','direction','Account','get','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','YYYY-MM-DD','Owner','N.A.','disposition','firstName','out','secret','renderFile','views','toFile','.pdf','log','err','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','update'];(function(_0x34c258,_0x3ceba6){var _0x39548e=function(_0xf7d7d4){while(--_0xf7d7d4){_0x34c258['push'](_0x34c258['shift']());}};_0x39548e(++_0x3ceba6);}(_0x056b,0xb6));var _0xb056=function(_0x321b98,_0x4c7b2b){_0x321b98=_0x321b98-0x0;var _0x22948f=_0x056b[_0x321b98];return _0x22948f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb056('0x0'));var rimraf=require(_0xb056('0x1'));var zipdir=require(_0xb056('0x2'));var jsonpatch=require(_0xb056('0x3'));var rp=require(_0xb056('0x4'));var moment=require(_0xb056('0x5'));var BPromise=require(_0xb056('0x6'));var Mustache=require(_0xb056('0x7'));var util=require(_0xb056('0x8'));var path=require(_0xb056('0x9'));var sox=require(_0xb056('0xa'));var csv=require('to-csv');var ejs=require(_0xb056('0xb'));var fs=require('fs');var _=require(_0xb056('0xc'));var squel=require(_0xb056('0xd'));var crypto=require(_0xb056('0xe'));var jsforce=require(_0xb056('0xf'));var deskjs=require(_0xb056('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb056('0x11'));var Redis=require(_0xb056('0x12'));var authService=require(_0xb056('0x13'));var qs=require(_0xb056('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb056('0x15'));var logger=require('../../config/logger')(_0xb056('0x16'));var utils=require(_0xb056('0x17'));var config=require(_0xb056('0x18'));var db=require(_0xb056('0x19'))['db'];config[_0xb056('0x1a')]=_['defaults'](config['redis'],{'host':_0xb056('0x1b'),'port':0x18eb});var socket=require(_0xb056('0x1c'))(new Redis(config['redis']));require(_0xb056('0x1d'))[_0xb056('0x1e')](socket);function respondWithStatusCode(_0xf1c2e9,_0x1197e5){_0x1197e5=_0x1197e5||0xcc;return function(_0x10dd19){if(_0x10dd19){return _0xf1c2e9[_0xb056('0x1f')](_0x1197e5);}return _0xf1c2e9[_0xb056('0x20')](_0x1197e5)['end']();};}function respondWithResult(_0x162146,_0x43565e){_0x43565e=_0x43565e||0xc8;return function(_0x9e2eed){if(_0x9e2eed){return _0x162146[_0xb056('0x20')](_0x43565e)['json'](_0x9e2eed);}};}function respondWithFilteredResult(_0x16085d,_0x4e501a){return function(_0x2daffc){if(_0x2daffc){var _0x311eb9=_0x2daffc[_0xb056('0x21')],_0x48e140=_0x4e501a[_0xb056('0x22')],_0x29c77e=_0x4e501a['offset']+_0x4e501a[_0xb056('0x23')],_0x4c57e6;if(_0x29c77e>=_0x311eb9){_0x29c77e=_0x311eb9;_0x4c57e6=0xc8;}else{_0x4c57e6=0xce;}_0x16085d['status'](_0x4c57e6);return _0x16085d[_0xb056('0x24')](_0xb056('0x25'),_0x48e140+'-'+_0x29c77e+'/'+_0x311eb9)[_0xb056('0x26')](_0x2daffc);}return null;};}function patchUpdates(_0x33dd35){return function(_0x4b254f){try{jsonpatch[_0xb056('0x27')](_0x4b254f,_0x33dd35,!![]);}catch(_0x5b481c){return BPromise[_0xb056('0x28')](_0x5b481c);}return _0x4b254f['save']();};}function saveUpdates(_0x324ce6,_0x40ac2d){return function(_0x1de11b){if(_0x1de11b){return _0x1de11b[_0xb056('0x29')](_0x324ce6)[_0xb056('0x2a')](function(_0x4bb6c0){return _0x4bb6c0;});}return null;};}function removeEntity(_0x4e66c3,_0x1016da){return function(_0x18a3f2){if(_0x18a3f2){return _0x18a3f2[_0xb056('0x2b')]()[_0xb056('0x2a')](function(){_0x4e66c3['status'](0xcc)[_0xb056('0x2c')]();});}};}function handleEntityNotFound(_0x10b9b3,_0x5c39db){return function(_0x6d0483){if(!_0x6d0483){_0x10b9b3[_0xb056('0x1f')](0x194);}return _0x6d0483;};}function handleError(_0x2ae873,_0x1d2c66){_0x1d2c66=_0x1d2c66||0x1f4;return function(_0x20a6c6){logger[_0xb056('0x2d')](_0x20a6c6[_0xb056('0x2e')]);if(_0x20a6c6[_0xb056('0x2f')]){delete _0x20a6c6['name'];}_0x2ae873[_0xb056('0x20')](_0x1d2c66)['send'](_0x20a6c6);};}function getInteractionUsers(_0x3d83d3,_0x9c6f4a){return new BPromise(function(_0x294874,_0x488185){try{if(_0x9c6f4a[_0x3d83d3['id']]){_0x3d83d3[_0xb056('0x30')]=_[_0xb056('0x31')](_0x9c6f4a[_0x3d83d3['id']],function(_0x4ba5f8){return{'id':_0x4ba5f8['id'],'fullname':_0x4ba5f8[_0xb056('0x32')]};});}}catch(_0x43aa63){_0x488185(_0x43aa63);}_0x294874(_0x3d83d3);});}function getInteractionTags(_0x329eaa,_0x1fad05){return new BPromise(function(_0x3ce984,_0x4ebca5){try{if(_0x329eaa[_0xb056('0x33')]){_0x329eaa[_0xb056('0x34')]=[];_0x329eaa[_0xb056('0x33')][_0xb056('0x35')](',')[_0xb056('0x36')](function(_0x559c34){_0x329eaa[_0xb056('0x34')][_0xb056('0x37')](_0x1fad05[_0x559c34]);});}delete _0x329eaa[_0xb056('0x33')];}catch(_0x3afb2c){_0x4ebca5(_0x3afb2c);}_0x3ce984(_0x329eaa);});}function updateSmsInteraction(_0x3e368d,_0x3b6b09,_0x19f277){return new BPromise(function(_0x4522ef,_0x54eda7){return getInteractionUsers(_0x3e368d,_0x19f277)[_0xb056('0x2a')](function(_0x59de9d){return getInteractionTags(_0x59de9d,_0x3b6b09);})[_0xb056('0x2a')](function(_0x4dffe5){_0x4522ef(_0x4dffe5);})['catch'](function(_0x2f8339){_0x54eda7(_0x2f8339);});});}exports[_0xb056('0x38')]=function(_0x13f9dc,_0x1b7934){var _0x2c5a2c={},_0x293f5c={},_0x32b332={'count':0x0,'rows':[]};var _0x4adf18=_[_0xb056('0x31')](db[_0xb056('0x39')]['rawAttributes'],function(_0x50d9c6){return{'name':_0x50d9c6[_0xb056('0x3a')],'type':_0x50d9c6[_0xb056('0x3b')][_0xb056('0x3c')]};});_0x293f5c['model']=_[_0xb056('0x31')](_0x4adf18,_0xb056('0x2f'));_0x293f5c[_0xb056('0x3d')]=_[_0xb056('0x3e')](_0x13f9dc[_0xb056('0x3d')]);_0x293f5c[_0xb056('0x3f')]=_[_0xb056('0x40')](_0x293f5c[_0xb056('0x41')],_0x293f5c[_0xb056('0x3d')]);_0x2c5a2c[_0xb056('0x42')]=_[_0xb056('0x40')](_0x293f5c[_0xb056('0x41')],qs['fields'](_0x13f9dc[_0xb056('0x3d')]['fields']));_0x2c5a2c[_0xb056('0x42')]=_0x2c5a2c[_0xb056('0x42')][_0xb056('0x43')]?_0x2c5a2c[_0xb056('0x42')]:_0x293f5c[_0xb056('0x41')];if(!_0x13f9dc[_0xb056('0x3d')][_0xb056('0x44')](_0xb056('0x45'))){_0x2c5a2c['limit']=qs[_0xb056('0x23')](_0x13f9dc[_0xb056('0x3d')][_0xb056('0x23')]);_0x2c5a2c[_0xb056('0x22')]=qs[_0xb056('0x22')](_0x13f9dc['query'][_0xb056('0x22')]);}_0x2c5a2c[_0xb056('0x46')]=qs[_0xb056('0x47')](_0x13f9dc[_0xb056('0x3d')][_0xb056('0x47')]);_0x2c5a2c[_0xb056('0x48')]=qs['filters'](_[_0xb056('0x49')](_0x13f9dc['query'],_0x293f5c[_0xb056('0x3f')]));var _0xc729f3=[];var _0x21d98e=squel[_0xb056('0x4a')]()[_0xb056('0x4b')]('id')[_0xb056('0x4b')](_0xb056('0x2f'))[_0xb056('0x4b')](_0xb056('0x4c'))[_0xb056('0x4d')]('tools_tags');var _0xd73c5=squel[_0xb056('0x4a')]()[_0xb056('0x4b')]('u.id')[_0xb056('0x4b')](_0xb056('0x4e'))['field']('ui.SmsInteractionId')[_0xb056('0x4d')](_0xb056('0x4f'),'ui')[_0xb056('0x50')](_0xb056('0x51'),'u','u.id\x20=\x20ui.UserId');var _0x4a1c68=squel['select']()['from']('sms_interactions','i')['left_join'](_0xb056('0x52'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xb056('0x50')](_0xb056('0x51'),'o',_0xb056('0x53'))[_0xb056('0x50')](_0xb056('0x54'),'a',_0xb056('0x55'))[_0xb056('0x50')](_0xb056('0x56'),'me','me.SmsInteractionId\x20=\x20i.id')[_0xb056('0x50')](_0xb056('0x57'),'it','it.SmsInteractionId\x20=\x20i.id')[_0xb056('0x50')](_0xb056('0x58'),'t',_0xb056('0x59'));var _0x2f2d22=squel[_0xb056('0x5a')]();var _0x1356d4=[];var _0x5ba227=squel[_0xb056('0x5a')]();var _0x5e2224;if(_0x13f9dc[_0xb056('0x3d')][_0xb056('0x5b')]){_0x5e2224=as[_0xb056('0x5c')](_0x13f9dc[_0xb056('0x3d')][_0xb056('0x5b')]);var _0x26cebb=_0x5e2224[_0xb056('0x5d')];for(var _0x25bb16=0x0;_0x25bb16<_0x5e2224['conditions'][_0xb056('0x43')];_0x25bb16++){var _0x472a91=_0x5e2224[_0xb056('0x5e')][_0x25bb16];var _0x26708f='i';var _0x2015b9=_[_0xb056('0x5f')](_0x4adf18,[_0xb056('0x2f'),_0x472a91[_0xb056('0x4b')]]);if(!_0x2015b9){switch(_0x472a91['field']){case _0xb056('0x60'):if(_0x472a91[_0xb056('0x61')]==0x1){_0x4a1c68[_0xb056('0x62')]('`'+_0x472a91[_0xb056('0x4b')]+_0xb056('0x63'));}else{_0x4a1c68[_0xb056('0x62')]('`'+_0x472a91['field']+_0xb056('0x64'));}break;case _0xb056('0x65'):if(_0x472a91[_0xb056('0x66')]==='$substring'){if(_0x472a91[_0xb056('0x61')]['split']('\x20')[_0xb056('0x43')]>0x1){_0x2f2d22[_0x26cebb](_0xb056('0x67'),qs[_0xb056('0x68')](_0x472a91[_0xb056('0x61')]),null);}else{var _0x58c533='%'+_0x472a91[_0xb056('0x61')]+'%';_0x2f2d22[_0x26cebb](_0xb056('0x69'),_0x58c533,_0x58c533,_0x58c533);}}else{_0x2015b9=_['find'](_0x4adf18,[_0xb056('0x2f'),_0xb056('0x6a')]);_0x472a91[_0xb056('0x4b')]=_0xb056('0x6a');_0x7471b3=as[_0xb056('0x6b')](_0x26708f,_0x2015b9['type'],_0x472a91);_0x2f2d22[_0x26cebb](_0x7471b3[_0xb056('0x6c')],_0x7471b3[_0xb056('0x61')][_0xb056('0x6d')],_0x7471b3[_0xb056('0x61')][_0xb056('0x2c')]);}break;case _0xb056('0x6e'):var _0x1725cb=_0x472a91[_0xb056('0x61')][_0xb056('0x35')](',')[_0xb056('0x31')](function(_0x1b4a0d){return Number(_0x1b4a0d);});_0x1725cb[_0xb056('0x36')](function(_0x2ab5a8){_0x5ba227['or'](_0xb056('0x6f'),'%,'+_0x2ab5a8+',%');});_0x1356d4=_[_0xb056('0x70')](_0x1356d4,_0x1725cb);break;case _0xb056('0x71'):if(_0x472a91[_0xb056('0x66')]===_0xb056('0x72')){_0x2f2d22[_0x26cebb](_0xb056('0x73'),'%'+_0x472a91[_0xb056('0x61')]+'%',null);}else{_0x2015b9=_[_0xb056('0x5f')](_0x4adf18,['name',_0xb056('0x74')]);_0x472a91[_0xb056('0x4b')]=_0xb056('0x74');_0x7471b3=as[_0xb056('0x6b')](_0x26708f,_0x2015b9[_0xb056('0x3b')],_0x472a91);_0x2f2d22[_0x26cebb](_0x7471b3[_0xb056('0x6c')],_0x7471b3[_0xb056('0x61')]['start'],_0x7471b3['value'][_0xb056('0x2c')]);}break;case _0xb056('0x75'):_0x7471b3=as[_0xb056('0x6b')]('me',null,_0x472a91);_0x2f2d22[_0x26cebb](_0x7471b3[_0xb056('0x6c')],_0x7471b3[_0xb056('0x61')]['start'],_0x7471b3[_0xb056('0x61')][_0xb056('0x2c')]);break;}}else{var _0x7471b3=as[_0xb056('0x6b')](_0x26708f,_0x2015b9['type'],_0x472a91);_0x2f2d22[_0x26cebb](_0x7471b3[_0xb056('0x6c')],_0x7471b3[_0xb056('0x61')][_0xb056('0x6d')],_0x7471b3['value'][_0xb056('0x2c')]);}}}else{var _0x2e02d5=_(_0x13f9dc[_0xb056('0x3d')])['keys']()[_0xb056('0x31')](function(_0x398f88){return _[_0xb056('0x76')](_0x4adf18,['name',_0x398f88])?_0x398f88:undefined;})[_0xb056('0x77')]()['value']();if(!_[_0xb056('0x78')](_0x2e02d5)){_0x2e02d5[_0xb056('0x36')](function(_0x103ff2){if(_0x103ff2==='SmsAccountId'){_0x4a1c68[_0xb056('0x48')](_0xb056('0x79'),[]['concat'](_0x13f9dc[_0xb056('0x3d')][_0x103ff2]));}else if(_0x103ff2===_0xb056('0x7a')){var _0x53f15f=JSON[_0xb056('0x7b')](_0x13f9dc[_0xb056('0x3d')][_0x103ff2])['$gte'];var _0x4c11ae=JSON[_0xb056('0x7b')](_0x13f9dc['query'][_0x103ff2])[_0xb056('0x7c')];_0x4a1c68['where'](_0xb056('0x7d'),_0x53f15f,_0x4c11ae);}else{if(_0x13f9dc[_0xb056('0x3d')][_0x103ff2]===_0xb056('0x7e')){_0x4a1c68[_0xb056('0x48')]('i.'+_0x103ff2+'\x20IS\x20NULL');}else{_0x4a1c68['where']('i.'+_0x103ff2+_0xb056('0x7f'),_0x13f9dc[_0xb056('0x3d')][_0x103ff2]);}}});}if(_0x13f9dc[_0xb056('0x3d')][_0xb056('0x80')]){if(_0x13f9dc['query'][_0xb056('0x80')]==0x1){_0x4a1c68['having'](_0xb056('0x81'));}else{_0x4a1c68['having'](_0xb056('0x82'));}}if(_0x13f9dc['query'][_0xb056('0x83')]){_0x1356d4=_[_0xb056('0x84')](_0x13f9dc[_0xb056('0x3d')][_0xb056('0x83')])?_0x13f9dc['query'][_0xb056('0x83')]:new Array(_0x13f9dc['query'][_0xb056('0x83')]);_0x1356d4[_0xb056('0x36')](function(_0x3673b9){_0x5ba227['or'](_0xb056('0x6f'),'%,'+_0x3673b9+',%');});}if(_0x13f9dc[_0xb056('0x3d')][_0xb056('0x85')]){var _0x19315b=_0x13f9dc[_0xb056('0x3d')][_0xb056('0x85')][_0xb056('0x86')]('\x5c','\x5c\x5c')[_0xb056('0x86')]('\x27\x27',_0xb056('0x87'));if(qs['isNumeric'](_0x19315b)){_0x2f2d22['or']('i.id\x20LIKE\x20?',_0x19315b+'%')['or'](_0xb056('0x88'),_0x19315b+'%');}else{_0x2f2d22['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb056('0x68')](_0x19315b))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x19315b+'%');}}}_0x4a1c68[_0xb056('0x48')](_0x2f2d22);_0x4a1c68['group']('i.id');var _0x583973={'type':db[_0xb056('0x89')]['QueryTypes']['SELECT'],'raw':!![]};var _0x3c9d5a=_0x4a1c68[_0xb056('0x8a')]();_0x3c9d5a[_0xb056('0x4b')]('i.id');_0x3c9d5a['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xb056('0x60'));if(_0x2c5a2c[_0xb056('0x46')]){_0x2c5a2c[_0xb056('0x46')][_0xb056('0x36')](function(_0x9185c){_0x4a1c68[_0xb056('0x46')]('i.'+_0x9185c[0x0],_0x9185c[0x1]===_0xb056('0x8b')?![]:!![]);});}if(!_[_0xb056('0x78')](_0x1356d4)){_0x4a1c68[_0xb056('0x62')](_0x5ba227);_0x3c9d5a[_0xb056('0x48')](_0xb056('0x8c'),_0x1356d4);}BPromise[_0xb056('0x8d')]()[_0xb056('0x2a')](function(){if(!_0x5e2224){if(_0x13f9dc[_0xb056('0x3d')]['SmsAccountId']||_0x13f9dc['query'][_0xb056('0x8e')])return;_0x3c9d5a['where'](_0xb056('0x8f'));_0x4a1c68[_0xb056('0x48')](_0xb056('0x8f'));return;}return _0x13f9dc[_0xb056('0x90')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x2e027a){if(_[_0xb056('0x78')](_0x2e027a)){_0x3c9d5a[_0xb056('0x48')]('i.SmsAccountId\x20IS\x20NULL');_0x4a1c68['where'](_0xb056('0x91'));}else{_0x3c9d5a[_0xb056('0x48')]('i.SmsAccountId\x20IN\x20?',_[_0xb056('0x31')](_0x2e027a,'id'));_0x4a1c68[_0xb056('0x48')](_0xb056('0x79'),_[_0xb056('0x31')](_0x2e027a,'id'));}});})[_0xb056('0x2a')](function(){db[_0xb056('0x92')][_0xb056('0x3d')](_0x3c9d5a[_0xb056('0x93')](),_0x583973)[_0xb056('0x2a')](function(_0x416d33){_0x32b332[_0xb056('0x21')]=_0x416d33['length'];if(_0x32b332[_0xb056('0x21')]===0x0)return[];return db[_0xb056('0x92')][_0xb056('0x3d')](_0x21d98e['toString'](),_0x583973)[_0xb056('0x2a')](function(_0x4dc495){_0xc729f3=_['keyBy'](_0x4dc495,'id');_0x583973=_[_0xb056('0x94')](_0x583973,{'model':db[_0xb056('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x13f9dc[_0xb056('0x3d')]['fields']){_0x2c5a2c['attributes'][_0xb056('0x36')](function(_0x2ae344){_0x4a1c68['field']('i.'+_0x2ae344);});}else{_0x4a1c68[_0xb056('0x4b')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xb056('0x60'));_0x4a1c68[_0xb056('0x4b')]('a.key','Account.key');_0x4a1c68[_0xb056('0x4b')](_0xb056('0x95'),'Account.mandatoryDisposition');_0x4a1c68[_0xb056('0x4b')]('i.*');_0x4a1c68['field'](_0xb056('0x96'),_0xb056('0x97'));_0x4a1c68[_0xb056('0x4b')](_0xb056('0x98'),_0xb056('0x99'));_0x4a1c68[_0xb056('0x4b')]('c.email',_0xb056('0x9a'));_0x4a1c68['field'](_0xb056('0x9b'),_0xb056('0x9c'));_0x4a1c68['field'](_0xb056('0x9d'),_0xb056('0x9e'));_0x4a1c68['field'](_0xb056('0x9f'),'Contact.fax');_0x4a1c68[_0xb056('0x4b')]('o.fullname',_0xb056('0xa0'));_0x4a1c68[_0xb056('0x4b')]('o.internal',_0xb056('0xa1'));_0x4a1c68['field'](_0xb056('0xa2'),_0xb056('0x33'));}_0x4a1c68[_0xb056('0x23')](_0x2c5a2c[_0xb056('0x23')]);_0x4a1c68[_0xb056('0x22')](_0x2c5a2c[_0xb056('0x22')]);return db[_0xb056('0x92')][_0xb056('0x3d')](_0x4a1c68['toString'](),_0x583973);})[_0xb056('0x2a')](function(_0x5b86df){_0xd73c5['where']('ui.SmsInteractionId\x20IN\x20?',_[_0xb056('0x31')](_0x5b86df,'id'));return db[_0xb056('0x92')][_0xb056('0x3d')](_0xd73c5[_0xb056('0x93')](),_0x583973)['then'](function(_0x46b6d4){var _0x1e8b6c=_[_0xb056('0xa3')](_0x46b6d4,_0xb056('0xa4'));var _0x24c08e=[];_0x5b86df['forEach'](function(_0x9257a8){_0x24c08e[_0xb056('0x37')](updateSmsInteraction(_0x9257a8,_0xc729f3,_0x1e8b6c));});return BPromise[_0xb056('0xa5')](_0x24c08e);});});})['then'](function(_0x526035){_0x32b332['rows']=_0x526035;return _0x32b332;})['then'](respondWithFilteredResult(_0x1b7934,_0x2c5a2c));})['catch'](handleError(_0x1b7934,null));};exports['show']=function(_0x41532c,_0x1f5c6d){var _0xd82e9={'raw':![],'where':{'id':_0x41532c[_0xb056('0xa6')]['id']}},_0x2b62f1={};_0x2b62f1[_0xb056('0x41')]=_['keys'](db[_0xb056('0x39')][_0xb056('0xa7')]);_0x2b62f1[_0xb056('0x3d')]=_[_0xb056('0x3e')](_0x41532c[_0xb056('0x3d')]);_0x2b62f1[_0xb056('0x3f')]=_[_0xb056('0x40')](_0x2b62f1[_0xb056('0x41')],_0x2b62f1[_0xb056('0x3d')]);_0xd82e9[_0xb056('0x42')]=_['intersection'](_0x2b62f1['model'],qs['fields'](_0x41532c[_0xb056('0x3d')]['fields']));_0xd82e9[_0xb056('0x42')]=_0xd82e9[_0xb056('0x42')][_0xb056('0x43')]?_0xd82e9[_0xb056('0x42')]:_0x2b62f1[_0xb056('0x41')];if(_0x41532c[_0xb056('0x3d')][_0xb056('0xa8')]){_0xd82e9[_0xb056('0xa9')]=[{'all':!![]}];}_0xd82e9=_[_0xb056('0x94')]({},_0xd82e9,_0x41532c['options']);return db[_0xb056('0x39')][_0xb056('0x5f')](_0xd82e9)[_0xb056('0x2a')](handleEntityNotFound(_0x1f5c6d,null))[_0xb056('0x2a')](respondWithResult(_0x1f5c6d,null))['catch'](handleError(_0x1f5c6d,null));};exports['create']=function(_0x14f382,_0x1c8e7b){return db[_0xb056('0x39')][_0xb056('0xaa')](_0x14f382[_0xb056('0x75')],{})[_0xb056('0x2a')](respondWithResult(_0x1c8e7b,0xc9))[_0xb056('0xab')](handleError(_0x1c8e7b,null));};exports['update']=function(_0x2b6ac8,_0x5e0d65){if(_0x2b6ac8[_0xb056('0x75')]['id']){delete _0x2b6ac8[_0xb056('0x75')]['id'];}return db['SmsInteraction'][_0xb056('0x5f')]({'where':{'id':_0x2b6ac8['params']['id']}})[_0xb056('0x2a')](handleEntityNotFound(_0x5e0d65,null))[_0xb056('0x2a')](saveUpdates(_0x2b6ac8[_0xb056('0x75')],null))[_0xb056('0x2a')](respondWithResult(_0x5e0d65,null))[_0xb056('0xab')](handleError(_0x5e0d65,null));};exports['destroy']=function(_0x3ee4f9,_0x42c752){return db[_0xb056('0x39')][_0xb056('0x5f')]({'where':{'id':_0x3ee4f9[_0xb056('0xa6')]['id']}})[_0xb056('0x2a')](handleEntityNotFound(_0x42c752,null))[_0xb056('0x2a')](removeEntity(_0x42c752,null))[_0xb056('0xab')](handleError(_0x42c752,null));};exports[_0xb056('0xac')]=function(_0x1a9c89,_0x62da08){return db[_0xb056('0x39')][_0xb056('0xac')]()[_0xb056('0x2a')](respondWithResult(_0x62da08,null))[_0xb056('0xab')](handleError(_0x62da08,null));};exports[_0xb056('0xad')]=function(_0x10e3b2,_0x5431a1,_0x1a8d5b){return db[_0xb056('0xae')]['find']({'where':{'id':_0x10e3b2[_0xb056('0xa6')]['id']}})[_0xb056('0x2a')](handleEntityNotFound(_0x5431a1,null))[_0xb056('0x2a')](function(_0x3de775){if(_0x3de775){return _0x3de775[_0xb056('0xad')](_0x10e3b2[_0xb056('0x75')][_0xb056('0xaf')],_[_0xb056('0xb0')](_0x10e3b2[_0xb056('0x75')],[_0xb056('0xaf'),'id'])||{});}})[_0xb056('0x2a')](respondWithResult(_0x5431a1,null))['catch'](handleError(_0x5431a1,null));};exports['getMessages']=function(_0x330dd3,_0x5e5b65,_0x643ba1){var _0x88e59f={'raw':![],'where':{}};var _0x2b36b0={};var _0x59ab30={'count':0x0,'rows':[]};return db[_0xb056('0x39')][_0xb056('0xb1')]({'where':{'id':_0x330dd3['params']['id']}})['then'](handleEntityNotFound(_0x5e5b65,null))[_0xb056('0x2a')](function(_0x3f80ab){if(_0x3f80ab){_0x2b36b0[_0xb056('0x41')]=_[_0xb056('0x3e')](db[_0xb056('0xae')]['rawAttributes']);_0x2b36b0['query']=_[_0xb056('0x3e')](_0x330dd3['query']);_0x2b36b0[_0xb056('0x3f')]=_[_0xb056('0x40')](_0x2b36b0[_0xb056('0x41')],_0x2b36b0[_0xb056('0x3d')]);_0x88e59f['attributes']=_[_0xb056('0x40')](_0x2b36b0[_0xb056('0x41')],qs[_0xb056('0xb2')](_0x330dd3[_0xb056('0x3d')][_0xb056('0xb2')]));_0x88e59f[_0xb056('0x42')]=_0x88e59f[_0xb056('0x42')]['length']?_0x88e59f[_0xb056('0x42')]:_0x2b36b0[_0xb056('0x41')];if(!_0x330dd3[_0xb056('0x3d')][_0xb056('0x44')](_0xb056('0x45'))){_0x88e59f[_0xb056('0x23')]=qs[_0xb056('0x23')](_0x330dd3['query'][_0xb056('0x23')]);_0x88e59f[_0xb056('0x22')]=qs[_0xb056('0x22')](_0x330dd3['query']['offset']);}_0x88e59f[_0xb056('0x46')]=qs['sort'](_0x330dd3['query'][_0xb056('0x47')]);_0x88e59f[_0xb056('0x48')]=qs[_0xb056('0x3f')](_[_0xb056('0x49')](_0x330dd3[_0xb056('0x3d')],_0x2b36b0[_0xb056('0x3f')]));_0x88e59f[_0xb056('0x48')][_0xb056('0xa4')]=_0x3f80ab['id'];if(_0x330dd3['query']['filter']){_0x88e59f[_0xb056('0x48')]=_[_0xb056('0x94')](_0x88e59f[_0xb056('0x48')],{'$or':_[_0xb056('0x31')](_0x88e59f[_0xb056('0x42')],function(_0x3e7c6f){var _0x5a7549={};_0x5a7549[_0x3e7c6f]={'$like':'%'+_0x330dd3['query']['filter']+'%'};return _0x5a7549;})});}if(_0x330dd3[_0xb056('0x3d')]['$gte']){var _0x1ddd50=_0x330dd3['query'][_0xb056('0xb3')][_0xb056('0x35')](',');var _0x257bbc={};_0x257bbc[_0x1ddd50[0x0]]={'$gte':moment(_0x1ddd50[0x1])[_0xb056('0xb4')](_0xb056('0xb5'))};_0x88e59f[_0xb056('0x48')]=_[_0xb056('0x94')](_0x88e59f['where'],_0x257bbc);}_0x88e59f=_[_0xb056('0x94')]({},_0x88e59f,_0x330dd3[_0xb056('0xb6')]);return db[_0xb056('0xae')][_0xb056('0x21')]({'where':_0x88e59f[_0xb056('0x48')]})['then'](function(_0x273621){_0x59ab30[_0xb056('0x21')]=_0x273621;if(_0x330dd3[_0xb056('0x3d')][_0xb056('0xa8')]){_0x88e59f[_0xb056('0xa9')]=[{'all':!![]}];}return db[_0xb056('0xae')][_0xb056('0xb7')](_0x88e59f);})[_0xb056('0x2a')](function(_0x12139){_0x59ab30[_0xb056('0xb8')]=_0x12139;return _0x59ab30;});}})[_0xb056('0x2a')](respondWithFilteredResult(_0x5e5b65,_0x88e59f))['catch'](handleError(_0x5e5b65,null));};exports[_0xb056('0xb9')]=function(_0x11ae6d,_0x54ef80,_0x5b9d42){return db['SmsInteraction']['find']({'where':{'id':_0x11ae6d[_0xb056('0xa6')]['id']}})[_0xb056('0x2a')](handleEntityNotFound(_0x54ef80,null))[_0xb056('0x2a')](function(_0x3f1caa){if(_0x3f1caa){return _0x3f1caa[_0xb056('0xba')](_0x11ae6d[_0xb056('0x75')][_0xb056('0xaf')],_['omit'](_0x11ae6d[_0xb056('0x75')],['ids','id'])||{})['spread'](function(){return db[_0xb056('0x6e')][_0xb056('0xb7')]({'attributes':['id',_0xb056('0x2f'),_0xb056('0x4c')],'where':{'id':_0x11ae6d[_0xb056('0x75')][_0xb056('0xaf')]}});})[_0xb056('0x2a')](function(_0x41c53){socket[_0xb056('0xbb')](_0xb056('0xbc'),{'id':Number(_0x11ae6d[_0xb056('0xa6')]['id']),'tags':_0x41c53||[]});return{'id':Number(_0x11ae6d['params']['id']),'tags':_0x41c53||[]};});}})['then'](respondWithResult(_0x54ef80,null))[_0xb056('0xab')](handleError(_0x54ef80,null));};exports[_0xb056('0xbd')]=function(_0x5cd1a6,_0x5130bf,_0x4a258d){return db['SmsInteraction'][_0xb056('0x5f')]({'where':{'id':_0x5cd1a6[_0xb056('0xa6')]['id']}})['then'](handleEntityNotFound(_0x5130bf,null))['then'](function(_0x287d56){if(_0x287d56){return _0x287d56[_0xb056('0xbd')](_0x5cd1a6[_0xb056('0x3d')]['ids']);}})[_0xb056('0x2a')](respondWithStatusCode(_0x5130bf,null))[_0xb056('0xab')](handleError(_0x5130bf,null));};exports[_0xb056('0xbe')]=function(_0x50b779,_0x551208){var _0x3ce669=moment()['unix']()[_0xb056('0x93')]();var _0x108166=path[_0xb056('0xbf')](config[_0xb056('0xc0')],_0xb056('0xc1'),_0xb056('0xc2'),_0xb056('0xc3'));var _0xdf40da=path[_0xb056('0xbf')](config[_0xb056('0xc0')],_0xb056('0xc1'),_0xb056('0xc2'),_0xb056('0xc4'));var _0xf5e39f=path[_0xb056('0xbf')](_0x108166,_0x3ce669);var _0x35dad0=util[_0xb056('0xb4')](_0xb056('0xc5'),_0x50b779[_0xb056('0xa6')]['id'],_0x3ce669);var _0x3e0b47=path[_0xb056('0xbf')](_0x108166,_0x35dad0);var _0x7aa04d=[];_0x7aa04d[_0xb056('0x37')]({'model':db[_0xb056('0x71')],'as':_0xb056('0x71'),'attributes':['id',_0xb056('0x32')],'raw':!![]});_0x7aa04d['push']({'model':db[_0xb056('0xc6')],'as':'Contact','attributes':['id','firstName',_0xb056('0xc7')],'raw':!![]});var _0x5779b7=[{'model':db['SmsMessage'],'as':_0xb056('0xc8'),'attributes':['id',_0xb056('0x75'),_0xb056('0x7a'),_0xb056('0xc9'),'secret',_0xb056('0x80')],'include':_0x7aa04d}];_0x5779b7[_0xb056('0x37')]({'model':db['SmsAccount'],'as':_0xb056('0xca'),'attributes':['id',_0xb056('0x2f')]});_0x5779b7[_0xb056('0x37')]({'model':db[_0xb056('0x71')],'as':'Owner','attributes':['id','fullname']});return db['SmsInteraction'][_0xb056('0x5f')]({'where':{'id':_0x50b779['params']['id']},'include':_0x5779b7})[_0xb056('0x2a')](handleEntityNotFound(_0x551208,null))['then'](function(_0x4d5c38){if(_0x4d5c38){var _0x5b38fd=_0x4d5c38[_0xb056('0xcb')]({'plain':!![]});fs['mkdirSync'](_0xf5e39f);var _0x223927={'format':'A4','border':_0xb056('0xcc'),'header':{'height':_0xb056('0xcd'),'contents':{'first':_0xb056('0xce')}},'footer':{'height':_0xb056('0xcf'),'contents':{'default':util[_0xb056('0xb4')](_0xb056('0xd0'),util[_0xb056('0xb4')](_0xb056('0xd1'),_0xb056('0xd2'),_0x5b38fd['id']),moment()[_0xb056('0xb4')](_0xb056('0xd3'))[_0xb056('0x93')]())}}};var _0x2612a8={'channel':_0xb056('0xd2'),'account':_0x5b38fd['Account'][_0xb056('0x2f')],'agent':_0x5b38fd[_0xb056('0xd4')]?_0x5b38fd['Owner']['fullname']:_0xb056('0xd5'),'createdAt':moment(_0x5b38fd[_0xb056('0x7a')])[_0xb056('0xb4')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb056('0x93')](),'closedAt':_0x5b38fd['closed']?moment(_0x5b38fd['closedAt'])['format'](_0xb056('0xb5'))['toString']():'','disposition':_0x5b38fd[_0xb056('0xd6')],'messages':_(_0x5b38fd['Messages'])[_0xb056('0x85')]({'secret':![]})[_0xb056('0x31')](function(_0x5e42ec){return{'date':moment(_0x5e42ec['createdAt'])[_0xb056('0xb4')](_0xb056('0xb5'))[_0xb056('0x93')](),'sender':_0x5e42ec['direction']==='out'?_0x5e42ec[_0xb056('0x71')]?_0x5e42ec[_0xb056('0x71')][_0xb056('0x32')]:'System':_0x5e42ec[_0xb056('0x65')][_0xb056('0xd7')]+(_0x5e42ec['Contact']['lastName']?'\x20'+_0x5e42ec['Contact']['lastName']:''),'body':_0x5e42ec['body'],'direction':_0x5e42ec['direction']===_0xb056('0xd8')?'A':'C','secret':_0x5e42ec[_0xb056('0xd9')],'read':_0x5e42ec[_0xb056('0x80')]};})[_0xb056('0x61')]()};return ejs[_0xb056('0xda')](path[_0xb056('0xbf')](config[_0xb056('0xc0')],_0xb056('0xc1'),_0xb056('0xdb'),'downloadInteraction.html'),{'interaction':_0x2612a8})[_0xb056('0x2a')](function(_0x32ac34){return new BPromise(function(_0x157c57,_0x19096d){pdf[_0xb056('0xaa')](_0x32ac34,_0x223927)[_0xb056('0xdc')](path[_0xb056('0xbf')](_0xf5e39f,'transcript-'+_0x5b38fd['id']+'-'+_0x3ce669+_0xb056('0xdd')),function(_0x317df4,_0x297a25){if(_0x317df4)return _0x19096d(_0x317df4);_0x157c57(_0x297a25);});});})['then'](function(){return new BPromise(function(_0x450e10,_0x3dc78d){zipdir(_0xf5e39f,{'saveTo':_0x3e0b47},function(_0x3b10ec,_0x39e10e){if(_0x3b10ec)return _0x3dc78d(_0x3b10ec);return _0x450e10(_0x39e10e);});})[_0xb056('0x2a')](function(){return new BPromise(function(_0x1bd4dd,_0x4ca7c8){rimraf(_0xf5e39f,function(_0x54fd0e){if(_0x54fd0e)_0x4ca7c8(_0x54fd0e);return _0x1bd4dd();});});})[_0xb056('0x2a')](function(){return _0x551208[_0xb056('0xbe')](_0x3e0b47,_0x35dad0,function(_0x2753d4){if(_0x2753d4){console[_0xb056('0xde')](_0xb056('0xdf'),_0x2753d4);}else{fs['unlinkSync'](_0x3e0b47);}});});});}else{return _0x551208['sendStatus'](0xc8);}})[_0xb056('0xab')](handleError(_0x551208,null));}; \ No newline at end of file +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 diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 573da37..190e8c1 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 _0xd0bb=['SmsInteraction','SmsMessage','save','update','getUsers','then','Users','map','findAll','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x19c7a8,_0x10508d){_0x19c7a8=_0x19c7a8-0x0;var _0x1462ce=_0xd0bb[_0x19c7a8];return _0x1462ce;};'use strict';var EventEmitter=require(_0xbd0b('0x0'));var SmsInteraction=require(_0xbd0b('0x1'))['db'][_0xbd0b('0x2')];var SmsMessage=require('../../mysqldb')['db'][_0xbd0b('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbd0b('0x4'),'afterUpdate':_0xbd0b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x432acf){return function(_0x508d53,_0x2236ce,_0x1b2499){_0x508d53[_0xbd0b('0x6')]({'attributes':['id'],'raw':!![]})[_0xbd0b('0x7')](function(_0x809599){_0x508d53['setDataValue'](_0xbd0b('0x8'),_0x809599[_0xbd0b('0x9')](function(_0x39c099){return{'id':_0x39c099['id']};}));return SmsMessage[_0xbd0b('0xa')]({'where':{'SmsInteractionId':_0x508d53['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbd0b('0x7')](function(_0x53d5e8){_0x508d53['setDataValue'](_0xbd0b('0xb'),_0x53d5e8[_0xbd0b('0xc')]);SmsInteractionEvents['emit'](_0x432acf+':'+_0x508d53['id'],_0x508d53);SmsInteractionEvents[_0xbd0b('0xd')](_0x432acf,_0x508d53);_0x1b2499(null);})[_0xbd0b('0xe')](_0x1b2499(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0xbd0b('0xf')](e,emitEvent(event));}}module[_0xbd0b('0x10')]=SmsInteractionEvents; \ No newline at end of file +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 diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 2f8db59..cdfebea 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 _0x3643=['request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','changed','closed','closedAt','format','lodash','util','api','bluebird'];(function(_0x1afce2,_0x29c086){var _0x2e3bb6=function(_0x5937a8){while(--_0x5937a8){_0x1afce2['push'](_0x1afce2['shift']());}};_0x2e3bb6(++_0x29c086);}(_0x3643,0xcc));var _0x3364=function(_0x45ac0f,_0x4b2bcf){_0x45ac0f=_0x45ac0f-0x0;var _0x4cd805=_0x3643[_0x45ac0f];return _0x4cd805;};'use strict';var _=require(_0x3364('0x0'));var util=require(_0x3364('0x1'));var logger=require('../../config/logger')(_0x3364('0x2'));var moment=require('moment');var BPromise=require(_0x3364('0x3'));var rp=require(_0x3364('0x4'));var fs=require('fs');var path=require(_0x3364('0x5'));var rimraf=require(_0x3364('0x6'));var config=require(_0x3364('0x7'));var attributes=require(_0x3364('0x8'));module[_0x3364('0x9')]=function(_0x2788aa,_0x5c0bde){return _0x2788aa['define'](_0x3364('0xa'),attributes,{'tableName':_0x3364('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x16bf77,_0x850ab3,_0x3a5805){if(_0x16bf77[_0x3364('0xc')](_0x3364('0xd'))){_0x16bf77[_0x3364('0xe')]=moment()[_0x3364('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3a5805(null,_0x16bf77);}}});}; \ No newline at end of file +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 diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 0a98c70..3a3f802 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 _0xd4fa=['catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit','then','debug','AddTagsToSmsInteraction','find','ids','omit','spread','AddTags','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','request','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','SmsInteraction,\x20%s,\x20%s','message','info','result'];(function(_0x2e28bf,_0x15f6a9){var _0x159286=function(_0x280695){while(--_0x280695){_0x2e28bf['push'](_0x2e28bf['shift']());}};_0x159286(++_0x15f6a9);}(_0xd4fa,0x15a));var _0xad4f=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xd4fa[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0xad4f('0x0'));var moment=require('moment');var BPromise=require(_0xad4f('0x1'));var rs=require(_0xad4f('0x2'));var fs=require('fs');var Redis=require(_0xad4f('0x3'));var db=require(_0xad4f('0x4'))['db'];var utils=require(_0xad4f('0x5'));var logger=require(_0xad4f('0x6'))('rpc');var config=require(_0xad4f('0x7'));var jayson=require(_0xad4f('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xad4f('0x9')]=_[_0xad4f('0xa')](config[_0xad4f('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xad4f('0xb'))(new Redis(config[_0xad4f('0x9')]));require(_0xad4f('0xc'))[_0xad4f('0xd')](socket);function respondWithRpcPromise(_0xa2ee92,_0x335b65,_0x34f332){return new BPromise(function(_0xaa6b68,_0x29a610){return client[_0xad4f('0xe')](_0xa2ee92,_0x34f332)['then'](function(_0x18dfc2){logger['info']('SmsInteraction,\x20%s,\x20%s',_0x335b65,_0xad4f('0xf'));logger['debug'](_0xad4f('0x10'),_0x335b65,_0xad4f('0xf'),JSON[_0xad4f('0x11')](_0x18dfc2));if(_0x18dfc2[_0xad4f('0x12')]){if(_0x18dfc2[_0xad4f('0x12')]['code']===0x1f4){logger[_0xad4f('0x12')](_0xad4f('0x13'),_0x335b65,_0x18dfc2[_0xad4f('0x12')][_0xad4f('0x14')]);return _0x29a610(_0x18dfc2[_0xad4f('0x12')]['message']);}logger[_0xad4f('0x12')](_0xad4f('0x13'),_0x335b65,_0x18dfc2[_0xad4f('0x12')][_0xad4f('0x14')]);return _0xaa6b68(_0x18dfc2[_0xad4f('0x12')][_0xad4f('0x14')]);}else{logger[_0xad4f('0x15')](_0xad4f('0x13'),_0x335b65,_0xad4f('0xf'));_0xaa6b68(_0x18dfc2[_0xad4f('0x16')][_0xad4f('0x14')]);}})[_0xad4f('0x17')](function(_0x15d166){logger[_0xad4f('0x12')](_0xad4f('0x13'),_0x335b65,_0x15d166);_0x29a610(_0x15d166);});});}exports[_0xad4f('0x18')]=function(_0x17eb44){var _0x598c10=this;return new Promise(function(_0x5e4bc0,_0x17c3e7){return db[_0xad4f('0x19')][_0xad4f('0x1a')](_0x17eb44[_0xad4f('0x1b')],{'raw':_0x17eb44[_0xad4f('0x1c')]?_0x17eb44['options'][_0xad4f('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17eb44['options']?_0x17eb44[_0xad4f('0x1c')][_0xad4f('0x1e')]||null:null,'attributes':_0x17eb44[_0xad4f('0x1c')]?_0x17eb44[_0xad4f('0x1c')][_0xad4f('0x1f')]||null:null,'limit':_0x17eb44['options']?_0x17eb44[_0xad4f('0x1c')][_0xad4f('0x20')]||null:null})[_0xad4f('0x21')](function(_0x2c480d){logger[_0xad4f('0x15')](_0xad4f('0x18'),_0x17eb44);logger[_0xad4f('0x22')](_0xad4f('0x18'),_0x17eb44,JSON[_0xad4f('0x11')](_0x2c480d));_0x5e4bc0(_0x2c480d);})['catch'](function(_0x203344){logger[_0xad4f('0x12')](_0xad4f('0x18'),_0x203344[_0xad4f('0x14')],_0x17eb44);_0x17c3e7(_0x598c10[_0xad4f('0x12')](0x1f4,_0x203344[_0xad4f('0x14')]));});});};exports[_0xad4f('0x23')]=function(_0x5428e3){return new Promise(function(_0x5efcb7,_0xe75358){return db[_0xad4f('0x19')][_0xad4f('0x24')]({'where':_0x5428e3[_0xad4f('0x1c')]?_0x5428e3[_0xad4f('0x1c')][_0xad4f('0x1e')]||null:null})['then'](function(_0x591891){if(_0x591891){return _0x591891['addTags'](_0x5428e3['body'][_0xad4f('0x25')],_[_0xad4f('0x26')](_0x5428e3[_0xad4f('0x1b')],['ids','id'])||{});}})[_0xad4f('0x27')](function(_0xda71ed){logger['info'](_0xad4f('0x28'),_0x5428e3);logger[_0xad4f('0x22')](_0xad4f('0x28'),_0x5428e3,JSON['stringify'](_0xda71ed));_0x5efcb7(_0xda71ed);})[_0xad4f('0x17')](function(_0x5410af){logger[_0xad4f('0x12')](_0xad4f('0x28'),_0x5410af[_0xad4f('0x14')],_0x5428e3);_0xe75358(_this[_0xad4f('0x12')](0x1f4,_0x5410af[_0xad4f('0x14')]));});});}; \ No newline at end of file +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 diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 362c67d..f0d681d 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 _0x757a=['save','remove','emit','removeListener','register','smsInteraction:'];(function(_0x3668c2,_0x1a5c07){var _0x4aa8f9=function(_0x4bf264){while(--_0x4bf264){_0x3668c2['push'](_0x3668c2['shift']());}};_0x4aa8f9(++_0x1a5c07);}(_0x757a,0xde));var _0xa757=function(_0xbd3963,_0x472905){_0xbd3963=_0xbd3963-0x0;var _0x3f77ec=_0x757a[_0xbd3963];return _0x3f77ec;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xa757('0x0'),_0xa757('0x1'),'update'];function createListener(_0x5c03c3,_0x5709ed){return function(_0x32be3b){_0x5709ed[_0xa757('0x2')](_0x5c03c3,_0x32be3b);};}function removeListener(_0x1c2932,_0x453d07){return function(){SmsInteractionEvents[_0xa757('0x3')](_0x1c2932,_0x453d07);};}exports[_0xa757('0x4')]=function(_0x5edca8){for(var _0xae0e7c=0x0,_0x4343b6=events['length'];_0xae0e7c<_0x4343b6;_0xae0e7c++){var _0x2930fa=events[_0xae0e7c];var _0x2f7793=createListener(_0xa757('0x5')+_0x2930fa,_0x5edca8);SmsInteractionEvents['on'](_0x2930fa,_0x2f7793);}}; \ No newline at end of file +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 diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 347cd08..9b75f7f 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 _0xa8f8=['smsmessage:create','create','put','update','/:id/accept','/:id/reject','reject','delete','multer','util','path','connect-timeout','Router','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','sms'];(function(_0x19712f,_0x377780){var _0x502589=function(_0x189049){while(--_0x189049){_0x19712f['push'](_0x19712f['shift']());}};_0x502589(++_0x377780);}(_0xa8f8,0x102));var _0x8a8f=function(_0x337ef8,_0x3971ab){_0x337ef8=_0x337ef8-0x0;var _0x585b75=_0xa8f8[_0x337ef8];return _0x585b75;};'use strict';var multer=require(_0x8a8f('0x0'));var util=require(_0x8a8f('0x1'));var path=require(_0x8a8f('0x2'));var timeout=require(_0x8a8f('0x3'));var express=require('express');var router=express[_0x8a8f('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8a8f('0x5'));var controller=require(_0x8a8f('0x6'));router[_0x8a8f('0x7')]('/',auth[_0x8a8f('0x8')](),controller[_0x8a8f('0x9')]);router[_0x8a8f('0x7')](_0x8a8f('0xa'),auth[_0x8a8f('0x8')](),controller[_0x8a8f('0xb')]);router[_0x8a8f('0x7')](_0x8a8f('0xc'),auth[_0x8a8f('0x8')](),controller[_0x8a8f('0xd')]);router[_0x8a8f('0xe')]('/',auth[_0x8a8f('0x8')](),interaction[_0x8a8f('0xf')](_0x8a8f('0x10'),_0x8a8f('0x11')),controller[_0x8a8f('0x12')]);router['post']('/:id/status',controller['status']);router[_0x8a8f('0x13')]('/:id',auth[_0x8a8f('0x8')](),controller[_0x8a8f('0x14')]);router[_0x8a8f('0x13')](_0x8a8f('0x15'),auth[_0x8a8f('0x8')](),controller['accept']);router[_0x8a8f('0x13')](_0x8a8f('0x16'),auth[_0x8a8f('0x8')](),controller[_0x8a8f('0x17')]);router[_0x8a8f('0x18')](_0x8a8f('0xc'),auth[_0x8a8f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 91491a5..2de22fd 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 _0xe9dd=['out','STRING','DATE','sequelize','exports','TEXT','BOOLEAN','ENUM'];(function(_0x48c478,_0x36057b){var _0x185b0c=function(_0x4495bb){while(--_0x4495bb){_0x48c478['push'](_0x48c478['shift']());}};_0x185b0c(++_0x36057b);}(_0xe9dd,0x8b));var _0xde9d=function(_0x209f5b,_0x2a407d){_0x209f5b=_0x209f5b-0x0;var _0x1619ea=_0xe9dd[_0x209f5b];return _0x1619ea;};'use strict';var Sequelize=require(_0xde9d('0x0'));module[_0xde9d('0x1')]={'body':{'type':Sequelize[_0xde9d('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xde9d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xde9d('0x4')]('in',_0xde9d('0x5')),'defaultValue':_0xde9d('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xde9d('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xde9d('0x7')]},'secret':{'type':Sequelize[_0xde9d('0x3')],'defaultValue':![]}}; \ No newline at end of file +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 diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 0252162..0da8cb4 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 _0xcafa=['sent','delivered','plivio','infobip','DELIVERED','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','redis','defaults','localhost','./smsMessage.socket','register','http','client','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','send','map','SmsMessage','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','create','body','find','describe','sms-interactions','accept','sms','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','Contact','get','SmsInteraction','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','acceptMessage','manual','channel','event','EventManager','acceptmessage','agent','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','RejectMessage','interface','SIP/%s','rejectmessage','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf'];(function(_0x1c5adf,_0x12a026){var _0x3dd9c2=function(_0x25e4d9){while(--_0x25e4d9){_0x1c5adf['push'](_0x1c5adf['shift']());}};_0x3dd9c2(++_0x12a026);}(_0xcafa,0x8f));var _0xacaf=function(_0x46449f,_0x2b2947){_0x46449f=_0x46449f-0x0;var _0x57a0bc=_0xcafa[_0x46449f];return _0x57a0bc;};'use strict';var pdf=require(_0xacaf('0x0'));var emlformat=require(_0xacaf('0x1'));var rimraf=require(_0xacaf('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xacaf('0x3'));var moment=require(_0xacaf('0x4'));var BPromise=require(_0xacaf('0x5'));var Mustache=require(_0xacaf('0x6'));var util=require('util');var path=require(_0xacaf('0x7'));var sox=require('sox');var csv=require(_0xacaf('0x8'));var ejs=require(_0xacaf('0x9'));var fs=require('fs');var _=require(_0xacaf('0xa'));var squel=require(_0xacaf('0xb'));var crypto=require(_0xacaf('0xc'));var jsforce=require(_0xacaf('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xacaf('0x8'));var querystring=require(_0xacaf('0xe'));var Papa=require(_0xacaf('0xf'));var Redis=require(_0xacaf('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xacaf('0x11'));var as=require(_0xacaf('0x12'));var hardwareService=require(_0xacaf('0x13'));var logger=require(_0xacaf('0x14'))(_0xacaf('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xacaf('0x16')]=_[_0xacaf('0x17')](config[_0xacaf('0x16')],{'host':_0xacaf('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xacaf('0x16')]));require(_0xacaf('0x19'))[_0xacaf('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xacaf('0x1b')]({'port':0x232c});var client9002=jayson[_0xacaf('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0x92afa,_0x10cfa2,_0x1f80c4){if(_0x1f80c4){var _0x1232f1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1232f1[_0xacaf('0x1d')](_0x10cfa2)){return _0x92afa;}else{throw new db[(_0xacaf('0x1e'))]['ValidationError'](_0xacaf('0x1f'));}}else{return _0x92afa;}}function respondWithRpcPromise(_0x32e99b,_0x4c25c8,_0x2e7131,_0x5f5a93){return new BPromise(function(_0x381490,_0x45b41b){var _0x156a08=_0x5f5a93||client;return _0x156a08[_0xacaf('0x20')](_0x32e99b,_0x2e7131)[_0xacaf('0x21')](function(_0x42c3ee){logger[_0xacaf('0x22')](_0xacaf('0x23'),_0x4c25c8,_0xacaf('0x24'));logger[_0xacaf('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4c25c8,'request\x20sent',JSON['stringify'](_0x42c3ee));if(_0x42c3ee[_0xacaf('0x26')]){if(_0x42c3ee[_0xacaf('0x26')][_0xacaf('0x27')]===0x1f4){logger[_0xacaf('0x26')](_0xacaf('0x23'),_0x4c25c8,_0x42c3ee[_0xacaf('0x26')][_0xacaf('0x28')]);return _0x45b41b(_0x42c3ee[_0xacaf('0x26')][_0xacaf('0x28')]);}logger[_0xacaf('0x26')](_0xacaf('0x23'),_0x4c25c8,_0x42c3ee[_0xacaf('0x26')]['message']);return _0x381490(_0x42c3ee[_0xacaf('0x26')][_0xacaf('0x28')]);}else{logger['info'](_0xacaf('0x23'),_0x4c25c8,_0xacaf('0x24'));_0x381490(_0x42c3ee['result'][_0xacaf('0x28')]);}})[_0xacaf('0x29')](function(_0x3733da){logger[_0xacaf('0x26')](_0xacaf('0x23'),_0x4c25c8,_0x3733da);_0x45b41b(_0x3733da);});});}function respondWithStatusCode(_0x16d763,_0x22fb1a){_0x22fb1a=_0x22fb1a||0xcc;return function(_0x53c182){if(_0x53c182){return _0x16d763[_0xacaf('0x2a')](_0x22fb1a);}return _0x16d763['status'](_0x22fb1a)[_0xacaf('0x2b')]();};}function respondWithResult(_0x3719ca,_0x2aabc8){_0x2aabc8=_0x2aabc8||0xc8;return function(_0x507d5d){if(_0x507d5d){return _0x3719ca[_0xacaf('0x2c')](_0x2aabc8)[_0xacaf('0x2d')](_0x507d5d);}};}function respondWithFilteredResult(_0x371fed,_0x1896b2){return function(_0x25ac3c){if(_0x25ac3c){var _0xbb2f5d=_0x25ac3c[_0xacaf('0x2e')],_0x4282a9=_0x1896b2[_0xacaf('0x2f')],_0x3d541a=_0x1896b2[_0xacaf('0x2f')]+_0x1896b2[_0xacaf('0x30')],_0x3e07fb;if(_0x3d541a>=_0xbb2f5d){_0x3d541a=_0xbb2f5d;_0x3e07fb=0xc8;}else{_0x3e07fb=0xce;}_0x371fed[_0xacaf('0x2c')](_0x3e07fb);return _0x371fed[_0xacaf('0x31')](_0xacaf('0x32'),_0x4282a9+'-'+_0x3d541a+'/'+_0xbb2f5d)[_0xacaf('0x2d')](_0x25ac3c);}return null;};}function patchUpdates(_0x37da4c){return function(_0x509ac5){try{jsonpatch[_0xacaf('0x33')](_0x509ac5,_0x37da4c,!![]);}catch(_0x23ba7f){return BPromise[_0xacaf('0x34')](_0x23ba7f);}return _0x509ac5[_0xacaf('0x35')]();};}function saveUpdates(_0x2ce68a,_0x3e2280){return function(_0x8a8a27){if(_0x8a8a27){return _0x8a8a27[_0xacaf('0x36')](_0x2ce68a)['then'](function(_0x5b290e){return _0x5b290e;});}return null;};}function removeEntity(_0x444270,_0x35085e){return function(_0xc2818b){if(_0xc2818b){return _0xc2818b[_0xacaf('0x37')]()[_0xacaf('0x21')](function(){_0x444270[_0xacaf('0x2c')](0xcc)[_0xacaf('0x2b')]();});}};}function handleEntityNotFound(_0xb66bbe,_0x52e439){return function(_0x354541){if(!_0x354541){_0xb66bbe['sendStatus'](0x194);}return _0x354541;};}function handleError(_0x2ce03a,_0x523f31){_0x523f31=_0x523f31||0x1f4;return function(_0x5ab4fc){logger[_0xacaf('0x26')](_0x5ab4fc['stack']);if(_0x5ab4fc['name']){delete _0x5ab4fc['name'];}_0x2ce03a[_0xacaf('0x2c')](_0x523f31)[_0xacaf('0x38')](_0x5ab4fc);};}exports['index']=function(_0xef6641,_0xd17517){var _0x32bf2f={},_0x293970={},_0x2df750={'count':0x0,'rows':[]};var _0x4c0ff5=_[_0xacaf('0x39')](db[_0xacaf('0x3a')][_0xacaf('0x3b')],function(_0x1306dd){return{'name':_0x1306dd[_0xacaf('0x3c')],'type':_0x1306dd[_0xacaf('0x3d')][_0xacaf('0x3e')]};});_0x293970[_0xacaf('0x3f')]=_[_0xacaf('0x39')](_0x4c0ff5,_0xacaf('0x40'));_0x293970[_0xacaf('0x41')]=_[_0xacaf('0x42')](_0xef6641[_0xacaf('0x41')]);_0x293970[_0xacaf('0x43')]=_[_0xacaf('0x44')](_0x293970[_0xacaf('0x3f')],_0x293970[_0xacaf('0x41')]);_0x32bf2f[_0xacaf('0x45')]=_[_0xacaf('0x44')](_0x293970[_0xacaf('0x3f')],qs[_0xacaf('0x46')](_0xef6641[_0xacaf('0x41')][_0xacaf('0x46')]));_0x32bf2f['attributes']=_0x32bf2f[_0xacaf('0x45')][_0xacaf('0x47')]?_0x32bf2f[_0xacaf('0x45')]:_0x293970['model'];if(!_0xef6641[_0xacaf('0x41')][_0xacaf('0x48')](_0xacaf('0x49'))){_0x32bf2f[_0xacaf('0x30')]=qs['limit'](_0xef6641[_0xacaf('0x41')][_0xacaf('0x30')]);_0x32bf2f['offset']=qs[_0xacaf('0x2f')](_0xef6641['query'][_0xacaf('0x2f')]);}_0x32bf2f[_0xacaf('0x4a')]=qs['sort'](_0xef6641[_0xacaf('0x41')][_0xacaf('0x4b')]);_0x32bf2f[_0xacaf('0x4c')]=qs['filters'](_['pick'](_0xef6641[_0xacaf('0x41')],_0x293970[_0xacaf('0x43')]));if(_0xef6641['query'][_0xacaf('0x4d')]){_0x32bf2f['where']=_[_0xacaf('0x4e')](_0x32bf2f['where'],{'$or':_['map'](_0x4c0ff5,function(_0x19c4cf){if(_0x19c4cf[_0xacaf('0x3d')]!==_0xacaf('0x4f')){var _0x56cf82={};_0x56cf82[_0x19c4cf[_0xacaf('0x40')]]={'$like':'%'+_0xef6641['query'][_0xacaf('0x4d')]+'%'};return _0x56cf82;}})});}_0x32bf2f=_[_0xacaf('0x4e')]({},_0x32bf2f,_0xef6641[_0xacaf('0x50')]);var _0x3d0298={'where':_0x32bf2f[_0xacaf('0x4c')]};return db[_0xacaf('0x3a')][_0xacaf('0x2e')](_0x3d0298)[_0xacaf('0x21')](function(_0x48e473){_0x2df750[_0xacaf('0x2e')]=_0x48e473;if(_0xef6641[_0xacaf('0x41')]['includeAll']){_0x32bf2f['include']=[{'all':!![]}];}return db[_0xacaf('0x3a')][_0xacaf('0x51')](_0x32bf2f);})[_0xacaf('0x21')](function(_0x337c89){_0x2df750[_0xacaf('0x52')]=_0x337c89;return _0x2df750;})[_0xacaf('0x21')](respondWithFilteredResult(_0xd17517,_0x32bf2f))[_0xacaf('0x29')](handleError(_0xd17517,null));};exports[_0xacaf('0x53')]=function(_0x5dc8f0,_0x3efebe){var _0x424332={'raw':!![],'where':{'id':_0x5dc8f0[_0xacaf('0x54')]['id']}},_0x2936a0={};_0x2936a0[_0xacaf('0x3f')]=_['keys'](db['SmsMessage'][_0xacaf('0x3b')]);_0x2936a0[_0xacaf('0x41')]=_[_0xacaf('0x42')](_0x5dc8f0[_0xacaf('0x41')]);_0x2936a0[_0xacaf('0x43')]=_['intersection'](_0x2936a0[_0xacaf('0x3f')],_0x2936a0[_0xacaf('0x41')]);_0x424332[_0xacaf('0x45')]=_[_0xacaf('0x44')](_0x2936a0['model'],qs[_0xacaf('0x46')](_0x5dc8f0[_0xacaf('0x41')]['fields']));_0x424332['attributes']=_0x424332[_0xacaf('0x45')]['length']?_0x424332[_0xacaf('0x45')]:_0x2936a0[_0xacaf('0x3f')];if(_0x5dc8f0[_0xacaf('0x41')][_0xacaf('0x55')]){_0x424332['include']=[{'all':!![]}];}_0x424332=_[_0xacaf('0x4e')]({},_0x424332,_0x5dc8f0[_0xacaf('0x50')]);return db[_0xacaf('0x3a')]['find'](_0x424332)[_0xacaf('0x21')](handleEntityNotFound(_0x3efebe,null))[_0xacaf('0x21')](respondWithResult(_0x3efebe,null))[_0xacaf('0x29')](handleError(_0x3efebe,null));};exports['create']=function(_0x5ec07d,_0x41fc6a){return db['SmsMessage'][_0xacaf('0x56')](_0x5ec07d['body'],{})[_0xacaf('0x21')](respondWithResult(_0x41fc6a,0xc9))[_0xacaf('0x29')](handleError(_0x41fc6a,null));};exports['update']=function(_0x3699c9,_0x1e56ea){if(_0x3699c9[_0xacaf('0x57')]['id']){delete _0x3699c9[_0xacaf('0x57')]['id'];}return db[_0xacaf('0x3a')]['find']({'where':{'id':_0x3699c9[_0xacaf('0x54')]['id']}})['then'](handleEntityNotFound(_0x1e56ea,null))[_0xacaf('0x21')](saveUpdates(_0x3699c9[_0xacaf('0x57')],null))['then'](respondWithResult(_0x1e56ea,null))[_0xacaf('0x29')](handleError(_0x1e56ea,null));};exports[_0xacaf('0x37')]=function(_0x3f24e2,_0x2194b0){return db[_0xacaf('0x3a')][_0xacaf('0x58')]({'where':{'id':_0x3f24e2[_0xacaf('0x54')]['id']}})[_0xacaf('0x21')](handleEntityNotFound(_0x2194b0,null))['then'](removeEntity(_0x2194b0,null))[_0xacaf('0x29')](handleError(_0x2194b0,null));};exports[_0xacaf('0x59')]=function(_0x51d429,_0x13df6e){return db['SmsMessage'][_0xacaf('0x59')]()[_0xacaf('0x21')](respondWithResult(_0x13df6e,null))[_0xacaf('0x29')](handleError(_0x13df6e,null));};var interaction_log=require(_0xacaf('0x14'))(_0xacaf('0x5a'));exports[_0xacaf('0x5b')]=function(_0x21b823,_0x2a508a,_0x427587){var _0xed3da4={'channel':_0xacaf('0x5c')};if(_0x21b823[_0xacaf('0x57')]['id']){delete _0x21b823['body']['id'];}_0x21b823[_0xacaf('0x57')]['read']=!![];_0x21b823[_0xacaf('0x57')][_0xacaf('0x5d')]=moment()[_0xacaf('0x5e')](_0xacaf('0x5f'));_0x21b823[_0xacaf('0x57')][_0xacaf('0x60')]=_0x21b823[_0xacaf('0x57')][_0xacaf('0x60')]||_0x21b823['user']['id'];return db[_0xacaf('0x3a')]['find']({'where':{'id':_0x21b823[_0xacaf('0x54')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xacaf('0x61')}]})[_0xacaf('0x21')](handleEntityNotFound(_0x2a508a,null))[_0xacaf('0x21')](saveUpdates(_0x21b823[_0xacaf('0x57')],null))[_0xacaf('0x21')](function(_0x4abebd){if(_0x4abebd){_0xed3da4[_0xacaf('0x28')]=_0x4abebd[_0xacaf('0x62')]({'plain':!![]});return db[_0xacaf('0x63')]['find']({'where':{'id':_0x4abebd['SmsInteractionId']}});}return null;})[_0xacaf('0x21')](handleEntityNotFound(_0x2a508a,null))[_0xacaf('0x21')](function(_0x145496){if(_0x145496){return _0x145496[_0xacaf('0x36')]({'UserId':_0x21b823[_0xacaf('0x57')][_0xacaf('0x60')],'read1stAt':_[_0xacaf('0x64')](_0x145496[_0xacaf('0x65')])?moment()[_0xacaf('0x5e')](_0xacaf('0x5f')):undefined});}return null;})[_0xacaf('0x21')](function(_0x3d7a80){if(_0x3d7a80){_0xed3da4[_0xacaf('0x66')]=_0x3d7a80[_0xacaf('0x62')]({'plain':!![]});interaction_log['info'](_0xacaf('0x67'),_0x21b823['user']['id'],_0x21b823[_0xacaf('0x68')][_0xacaf('0x40')],_0x21b823['user'][_0xacaf('0x69')],_0xed3da4[_0xacaf('0x66')]['id'],_0x21b823[_0xacaf('0x57')]?JSON['stringify'](_0x21b823[_0xacaf('0x57')]):_0xacaf('0x6a'));return respondWithRpcPromise('AcceptMessage',_0xacaf('0x6b'),_0xed3da4);}return null;})[_0xacaf('0x21')](function(_0x428ab7){if(_0x428ab7){if(_0x21b823[_0xacaf('0x57')][_0xacaf('0x6c')]){_0xed3da4['message']['interface']=util[_0xacaf('0x5e')]('SIP/%s',_0x21b823['user'][_0xacaf('0x40')]);_0xed3da4['message'][_0xacaf('0x6d')]=_0xed3da4[_0xacaf('0x6d')];_0xed3da4[_0xacaf('0x28')][_0xacaf('0x6e')]=_0xacaf('0x5b');return respondWithRpcPromise(_0xacaf('0x6f'),'EventManager',{'event':_0xacaf('0x70'),'message':_0xed3da4[_0xacaf('0x28')]},client9002)[_0xacaf('0x21')](function(){return _0xed3da4;});}return _0xed3da4;}return null;})['then'](respondWithResult(_0x2a508a,null))[_0xacaf('0x29')](handleError(_0x2a508a,null));};var interaction_log=require(_0xacaf('0x14'))(_0xacaf('0x5a'));exports[_0xacaf('0x34')]=function(_0x385cd9,_0x21a8eb,_0x554827){var _0x56d9b9={'agent':{},'channel':_0xacaf('0x5c')};if(_0x385cd9['body']['id']){delete _0x385cd9[_0xacaf('0x57')]['id'];}_0x385cd9[_0xacaf('0x57')][_0xacaf('0x60')]=_0x385cd9[_0xacaf('0x57')][_0xacaf('0x60')]||_0x385cd9[_0xacaf('0x68')]['id'];_0x56d9b9[_0xacaf('0x71')]['id']=_0x385cd9[_0xacaf('0x57')][_0xacaf('0x60')];return db['SmsMessage'][_0xacaf('0x58')]({'where':{'id':_0x385cd9[_0xacaf('0x54')]['id'],'UserId':null}})[_0xacaf('0x21')](handleEntityNotFound(_0x21a8eb,null))[_0xacaf('0x21')](function(_0x44d955){if(_0x44d955){_0x56d9b9[_0xacaf('0x28')]=_0x44d955[_0xacaf('0x62')]({'plain':!![]});return db[_0xacaf('0x63')][_0xacaf('0x58')]({'where':{'id':_0x44d955[_0xacaf('0x72')]}});}return null;})[_0xacaf('0x21')](handleEntityNotFound(_0x21a8eb,null))[_0xacaf('0x21')](function(_0x5a0b79){if(_0x5a0b79){_0x56d9b9[_0xacaf('0x66')]=_0x5a0b79['get']({'plain':!![]});interaction_log[_0xacaf('0x22')](_0xacaf('0x73'),_0x385cd9[_0xacaf('0x68')]['id'],_0x385cd9['user']['name'],_0x385cd9[_0xacaf('0x68')][_0xacaf('0x69')],_0x56d9b9[_0xacaf('0x66')]['id'],_0x385cd9[_0xacaf('0x57')]?JSON[_0xacaf('0x74')](_0x385cd9[_0xacaf('0x57')]):_0xacaf('0x6a'));return respondWithRpcPromise(_0xacaf('0x75'),'rejectMessage',_0x56d9b9);}return null;})[_0xacaf('0x21')](function(_0x2e87a1){if(_0x2e87a1){_0x2e87a1['message'][_0xacaf('0x76')]=util['format'](_0xacaf('0x77'),_0x385cd9[_0xacaf('0x68')][_0xacaf('0x40')]);_0x2e87a1[_0xacaf('0x28')][_0xacaf('0x6d')]=_0x56d9b9['channel'];_0x2e87a1[_0xacaf('0x28')]['event']=_0xacaf('0x34');respondWithRpcPromise(_0xacaf('0x6f'),_0xacaf('0x6f'),{'event':_0xacaf('0x78'),'message':_0x2e87a1[_0xacaf('0x28')]},client9002);return _0x56d9b9;}return null;})[_0xacaf('0x21')](respondWithResult(_0x21a8eb,null))[_0xacaf('0x29')](handleError(_0x21a8eb,null));};exports['status']=function(_0x4c814e,_0x337e14,_0x3c4c7e){if(_0x4c814e[_0xacaf('0x57')]['id']){delete _0x4c814e[_0xacaf('0x57')]['id'];}var _0x4b0dba;return db[_0xacaf('0x3a')]['find']({'where':{'id':_0x4c814e[_0xacaf('0x54')]['id']}})[_0xacaf('0x21')](handleEntityNotFound(_0x337e14,null))[_0xacaf('0x21')](function(_0x10166b){if(_0x10166b){_0x4b0dba=_0x10166b;return db[_0xacaf('0x79')][_0xacaf('0x58')]({'where':{'id':_0x10166b[_0xacaf('0x7a')]}});}})[_0xacaf('0x21')](handleEntityNotFound(_0x337e14,null))[_0xacaf('0x21')](function(_0x1fd52b){if(_0x1fd52b){logger[_0xacaf('0x25')](_0xacaf('0x7b'),_0xacaf('0x2c'),_0xacaf('0x7c'),_0x1fd52b['type'],util[_0xacaf('0x7d')](_0x4c814e[_0xacaf('0x57')],{'showHidden':![],'depth':null}));switch(_0x1fd52b['type']){case _0xacaf('0x7e'):if(_0x4c814e[_0xacaf('0x57')][_0xacaf('0x7f')]&&_0x4c814e[_0xacaf('0x57')][_0xacaf('0x7f')]===_0x4b0dba[_0xacaf('0x80')]){return _0x4b0dba[_0xacaf('0x36')]({'read':!![]});}else{logger[_0xacaf('0x26')](_0xacaf('0x81'),_0xacaf('0x2c'),_0xacaf('0x7e'),util['inspect'](_0x4c814e['body'],{'showHidden':![],'depth':null}));}break;case _0xacaf('0x82'):if(_0x4c814e[_0xacaf('0x57')]['MessageUUID']&&_0x4c814e[_0xacaf('0x57')][_0xacaf('0x83')]===_0x4b0dba[_0xacaf('0x80')]&&_[_0xacaf('0x84')]([_0xacaf('0x85'),_0xacaf('0x86')],_0x4c814e['body']['Status'])>=0x0){return _0x4b0dba[_0xacaf('0x36')]({'read':!![]});}else{logger['error'](_0xacaf('0x81'),_0xacaf('0x2c'),_0xacaf('0x87'),util[_0xacaf('0x7d')](_0x4c814e[_0xacaf('0x57')],{'showHidden':![],'depth':null}));}break;case _0xacaf('0x88'):var _0x448a11=_0x4c814e['body']['results'][0x0];if(_0x448a11[_0xacaf('0x2c')]['groupName']===_0xacaf('0x89')){return _0x4b0dba[_0xacaf('0x36')]({'read':!![]});}else{logger['error'](_0xacaf('0x81'),_0xacaf('0x2c'),'infobip',util[_0xacaf('0x7d')](_0x4c814e['body'],{'showHidden':![],'depth':null}));}break;}return _0x4b0dba;}})[_0xacaf('0x21')](respondWithResult(_0x337e14,null))[_0xacaf('0x29')](handleError(_0x337e14,null));}; \ No newline at end of file +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 diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index eeeeb7a..16759f9 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 _0x18fa=['../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x18fa,0xe0));var _0xa18f=function(_0x493bd2,_0x46baa1){_0x493bd2=_0x493bd2-0x0;var _0x55961b=_0x18fa[_0x493bd2];return _0x55961b;};'use strict';var EventEmitter=require(_0xa18f('0x0'));var SmsMessage=require(_0xa18f('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xa18f('0x2')](0x0);var events={'afterCreate':_0xa18f('0x3'),'afterUpdate':_0xa18f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x37f166){return function(_0x1d2dc2,_0x14b683,_0x5615a2){SmsMessageEvents[_0xa18f('0x5')](_0x37f166+':'+_0x1d2dc2['id'],_0x1d2dc2);SmsMessageEvents['emit'](_0x37f166,_0x1d2dc2);_0x5615a2(null);};}for(var e in events){if(events[_0xa18f('0x6')](e)){var event=events[e];SmsMessage[_0xa18f('0x7')](e,emitEvent(event));}}module[_0xa18f('0x8')]=SmsMessageEvents; \ No newline at end of file +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 diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 4ff735e..df59e40 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 _0x4d74=['password','smsMethod','sender','login?username=','username','&password=','GET','split','POST','user_key','session_key','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/send/','requestid','deliveryReport','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','messages','message_id','clickSend','plivo','authId','/api/sms/messages/','format','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','IBSSO\x20','token','Missing\x20parameters:\x20base_url','crypto','apiKey','login','text','timestamp','keys','md5','digest','/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','SmsInteraction','findOne','then','update','createdAt','catch','error','find','SmsAccountId','type','twilio','authToken','phone','accountSid','create','remote','/status?token=','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby','https://api.skebby.it/API/v1.0/REST/'];(function(_0x4b6a9b,_0x3fa1f3){var _0x5dc9a8=function(_0x554248){while(--_0x554248){_0x4b6a9b['push'](_0x4b6a9b['shift']());}};_0x5dc9a8(++_0x3fa1f3);}(_0x4d74,0x143));var _0x44d7=function(_0x2847d0,_0x10a787){_0x2847d0=_0x2847d0-0x0;var _0x1cc209=_0x4d74[_0x2847d0];return _0x1cc209;};'use strict';var _=require(_0x44d7('0x0'));var util=require(_0x44d7('0x1'));var logger=require(_0x44d7('0x2'))(_0x44d7('0x3'));var moment=require(_0x44d7('0x4'));var BPromise=require('bluebird');var rp=require(_0x44d7('0x5'));var fs=require('fs');var path=require(_0x44d7('0x6'));var rimraf=require(_0x44d7('0x7'));var config=require(_0x44d7('0x8'));var attributes=require(_0x44d7('0x9'));module[_0x44d7('0xa')]=function(_0x3115c8,_0x4856be){return _0x3115c8[_0x44d7('0xb')](_0x44d7('0xc'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x44d7('0xd'),'fields':[_0x44d7('0xd')]},{'name':_0x44d7('0xe'),'fields':[_0x44d7('0xf')],'type':_0x44d7('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xf11694,_0x1f5c2e,_0xed0b1b){var _0xa1418e=_0x3115c8[_0x44d7('0x11')];var _0x4e20ef=_0xf11694[_0x44d7('0x12')]({'plain':!![]});if(_0x4e20ef[_0x44d7('0x13')]['toLowerCase']()==='in'||_0x4e20ef[_0x44d7('0x13')][_0x44d7('0x14')]()===_0x44d7('0x15')&&!_0x4e20ef[_0x44d7('0x16')]&&!_['isNil'](_0x4e20ef[_0x44d7('0x17')])){_0xa1418e[_0x44d7('0x18')][_0x44d7('0x19')]({'where':{'id':_0x4e20ef['SmsInteractionId']}})[_0x44d7('0x1a')](function(_0x42f00f){if(_0x42f00f){_0x42f00f[_0x44d7('0x1b')]({'lastMsgAt':_0x4e20ef[_0x44d7('0x1c')],'lastMsgDirection':_0x4e20ef[_0x44d7('0x13')][_0x44d7('0x14')]()});}})[_0x44d7('0x1d')](function(_0x14a912){console[_0x44d7('0x1e')](_0x14a912);});}if(_0x4e20ef[_0x44d7('0x13')]===_0x44d7('0x15')&&!_0x4e20ef[_0x44d7('0x16')]){var _0x5e4a72;_0xa1418e['SmsAccount'][_0x44d7('0x1f')]({'where':{'id':_0x4e20ef[_0x44d7('0x20')]},'raw':!![]})[_0x44d7('0x1a')](function(_0x1e78a1){_0x5e4a72=_0x1e78a1;if(_0x5e4a72&&_0x5e4a72[_0x44d7('0x21')]){switch(_0x5e4a72['type']){case _0x44d7('0x22'):var _0xd40910=require(_0x44d7('0x22'));if(_0x5e4a72['accountSid']&&_0x5e4a72[_0x44d7('0x23')]&&_0x5e4a72[_0x44d7('0x24')]){var _0x186dc2=new _0xd40910(_0x5e4a72[_0x44d7('0x25')],_0x5e4a72[_0x44d7('0x23')]);_0x186dc2['messages'][_0x44d7('0x26')]({'body':_0x4e20ef[_0x44d7('0xf')],'to':_0x4e20ef[_0x44d7('0x24')],'from':_0x5e4a72[_0x44d7('0x24')],'statusCallback':_0x5e4a72[_0x44d7('0x27')]+'/api/sms/messages/'+_0x4e20ef['id']+_0x44d7('0x28')+_0x5e4a72['token']})[_0x44d7('0x1a')](function(_0x124ae3){if(_0x124ae3['sid']){return _0xf11694['update']({'messageId':_0x124ae3[_0x44d7('0x29')]});}})[_0x44d7('0x1d')](function(_0x5b0820){logger['error'](_0x44d7('0x2a'),_0x44d7('0x2b'),_0x44d7('0x22'),util['inspect'](_0x5b0820,{'showHidden':![],'depth':null}));});}else{logger[_0x44d7('0x1e')](_0x44d7('0x2a'),_0x44d7('0x2b'),_0x44d7('0x22'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x44d7('0x2c'):var _0x13ec5b=_0x44d7('0x2d');if(_0x5e4a72['username']&&_0x5e4a72[_0x44d7('0x2e')]){var _0x2a1f5d={'recipient':[_0x4e20ef['phone']],'message':_0x4e20ef['body'],'message_type':_0x5e4a72['smsMethod']};if(_0x5e4a72[_0x44d7('0x2f')]&&_0x5e4a72[_0x44d7('0x2f')]!=='SI'){_0x2a1f5d[_0x44d7('0x30')]=_0x5e4a72[_0x44d7('0x24')];}var _0x2c9b11={'url':_0x13ec5b+_0x44d7('0x31')+_0x5e4a72[_0x44d7('0x32')]+_0x44d7('0x33')+_0x5e4a72['password'],'method':_0x44d7('0x34')};rp(_0x2c9b11)[_0x44d7('0x1a')](function(_0x5a5288){var _0x125d41=_0x5a5288[_0x44d7('0x35')](';');var _0x484334={'user_key':_0x125d41[0x0],'session_key':_0x125d41[0x1]};_0x2c9b11={'url':_0x13ec5b+'sms','method':_0x44d7('0x36'),'headers':{'user_key':_0x484334[_0x44d7('0x37')],'Session_key':_0x484334[_0x44d7('0x38')]},'json':!![],'body':_0x2a1f5d};return rp(_0x2c9b11);})['then'](function(_0x38ece5){if(_0x38ece5['total_sent']>=0x1){var _0x4b308e={'messageId':_0x38ece5['internal_order_id']};if(_0x5e4a72['smsMethod']!=='GP'||!_0x5e4a72['deliveryReport']){_0x4b308e[_0x44d7('0x39')]=!![];}return _0xf11694['update'](_0x4b308e);}else{return logger['error'](_0x44d7('0x2a'),'afterCreate',_0x44d7('0x2c'),util[_0x44d7('0x3a')](_0x38ece5,{'showHidden':![],'depth':null}));}})[_0x44d7('0x1d')](function(_0x452504){return logger['error'](_0x44d7('0x2a'),_0x44d7('0x2b'),_0x44d7('0x2c'),util[_0x44d7('0x3a')](_0x452504,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x44d7('0x2b'),_0x44d7('0x2c'),_0x44d7('0x3b'));}break;case _0x44d7('0x3c'):if(_0x5e4a72[_0x44d7('0x23')]){var _0x5b093b={'recipient':_0x4e20ef[_0x44d7('0x24')],'message':_0x4e20ef[_0x44d7('0xf')],'sender':_0x5e4a72[_0x44d7('0x3d')]||_0x5e4a72[_0x44d7('0x24')],'authorization':_0x5e4a72['authToken']};var _0x1f5c2e={'method':_0x44d7('0x36'),'uri':_0x44d7('0x3e'),'body':_0x5b093b,'json':!![]};rp(_0x1f5c2e)[_0x44d7('0x1a')](function(_0x57a23f){var _0x3c232f={'messageId':_0x57a23f[_0x44d7('0x3f')]};if(!_0x5e4a72[_0x44d7('0x40')]){_0x3c232f['read']=!![];}return _0xf11694[_0x44d7('0x1b')](_0x3c232f);})[_0x44d7('0x1d')](function(_0x824116){logger[_0x44d7('0x1e')](_0x44d7('0x2a'),_0x44d7('0x2b'),_0x44d7('0x3c'),util[_0x44d7('0x3a')](_0x824116,{'showHidden':![],'depth':null}));});}else{logger[_0x44d7('0x1e')](_0x44d7('0x2a'),_0x44d7('0x2b'),_0x44d7('0x3c'),_0x44d7('0x41'));}break;case _0x44d7('0x42'):if(_0x5e4a72[_0x44d7('0x32')]&&_0x5e4a72[_0x44d7('0x2e')]){var _0x5b093b={'messages':[{'source':_0x44d7('0x43'),'to':_0x4e20ef[_0x44d7('0x24')],'body':_0x4e20ef['body'],'from':_0x5e4a72[_0x44d7('0x3d')]||_0x5e4a72[_0x44d7('0x24')]}]};var _0x205224=util['format'](_0x44d7('0x44'),_0x5e4a72['username'],_0x5e4a72[_0x44d7('0x2e')]);var _0x1f5c2e={'method':_0x44d7('0x36'),'uri':_0x44d7('0x45'),'body':_0x5b093b,'headers':{'Authorization':util['format'](_0x44d7('0x46'),new Buffer(_0x205224)[_0x44d7('0x47')](_0x44d7('0x48')))},'json':!![]};rp(_0x1f5c2e)[_0x44d7('0x1a')](function(_0x4407d8){if(_0x4407d8[_0x44d7('0x49')]>=0xc8&&_0x4407d8['http_code']<=0xce){if(_0x4407d8['data']&&_0x4407d8[_0x44d7('0x4a')][_0x44d7('0x4b')]>0x0){var _0x3f472d=_[_0x44d7('0x4c')](_0x4407d8[_0x44d7('0x4a')][_0x44d7('0x4d')]);var _0x4560b6={'messageId':_0x3f472d[_0x44d7('0x4e')]};if(!_0x5e4a72[_0x44d7('0x40')]){_0x4560b6[_0x44d7('0x39')]=!![];}return _0xf11694['update'](_0x4560b6);}else{logger[_0x44d7('0x1e')](_0x44d7('0x2a'),_0x44d7('0x2b'),_0x44d7('0x4f'),util[_0x44d7('0x3a')](_0x4407d8,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x44d7('0x2a'),'afterCreate','clickSend',util[_0x44d7('0x3a')](_0x4407d8,{'showHidden':![],'depth':null}));}})[_0x44d7('0x1d')](function(_0x1e4ac1){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x44d7('0x2b'),_0x44d7('0x4f'),util['inspect'](_0x1e4ac1,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x44d7('0x2a'),'afterCreate',_0x44d7('0x4f'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x44d7('0x50'):if(_0x5e4a72[_0x44d7('0x51')]&&_0x5e4a72[_0x44d7('0x23')]){var _0x5b093b={'dst':_0x4e20ef[_0x44d7('0x24')],'text':_0x4e20ef[_0x44d7('0xf')],'src':_0x5e4a72[_0x44d7('0x3d')]||_0x5e4a72[_0x44d7('0x24')],'url':_0x5e4a72[_0x44d7('0x27')]+_0x44d7('0x52')+_0x4e20ef['id']+'/status?token='+_0x5e4a72['token']};var _0x205224=util[_0x44d7('0x53')](_0x44d7('0x44'),_0x5e4a72['authId'],_0x5e4a72[_0x44d7('0x23')]);var _0x1f5c2e={'method':'POST','uri':util[_0x44d7('0x53')](_0x44d7('0x54'),_0x5e4a72[_0x44d7('0x51')]),'body':_0x5b093b,'headers':{'Authorization':util[_0x44d7('0x53')](_0x44d7('0x46'),new Buffer(_0x205224)[_0x44d7('0x47')]('base64'))},'json':!![]};rp(_0x1f5c2e)['then'](function(_0x14db14){var _0x1694fd={'messageId':_0x14db14[_0x44d7('0x55')][0x0]};return _0xf11694['update'](_0x1694fd);})[_0x44d7('0x1d')](function(_0x42e0ee){logger[_0x44d7('0x1e')](_0x44d7('0x2a'),_0x44d7('0x2b'),'plivo',util['inspect'](_0x42e0ee,{'showHidden':![],'depth':null}));});}else{logger[_0x44d7('0x1e')](_0x44d7('0x2a'),_0x44d7('0x2b'),_0x44d7('0x50'),_0x44d7('0x56'));}break;case _0x44d7('0x57'):if(_0x5e4a72[_0x44d7('0x32')]&&_0x5e4a72['password']){if(_0x5e4a72[_0x44d7('0x58')]){var _0x10e24e={'method':_0x44d7('0x36'),'uri':_0x5e4a72['baseUrl']+_0x44d7('0x59'),'body':{'username':_0x5e4a72[_0x44d7('0x32')],'password':_0x5e4a72['password']},'json':!![]};return rp(_0x10e24e)[_0x44d7('0x1a')](function(_0x28ad68){var _0x381500={'method':'POST','uri':_0x5e4a72['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x5e4a72[_0x44d7('0x24')],'destinations':[{'to':_0x4e20ef[_0x44d7('0x24')]}],'text':_0x4e20ef[_0x44d7('0xf')],'notifyUrl':_0x5e4a72[_0x44d7('0x27')]+_0x44d7('0x52')+_0x4e20ef['id']+'/status?token='+_0x5e4a72['token'],'notifyContentType':'application/json','callbackData':_0x5e4a72[_0x44d7('0x24')]+';'+_0x4e20ef[_0x44d7('0xf')]}]},'headers':{'Authorization':_0x44d7('0x5a')+_0x28ad68[_0x44d7('0x5b')]},'json':!![]};return rp(_0x381500)[_0x44d7('0x1a')](function(_0xac6290){if(_0xac6290[_0x44d7('0x4d')]){var _0x10c2de={'messageId':_0xac6290[_0x44d7('0x4d')][0x0][_0x44d7('0xd')]};if(!_0x5e4a72['deliveryReport']){_0x10c2de[_0x44d7('0x39')]=!![];}return _0xf11694['update'](_0x10c2de);}else{return logger['error'](_0x44d7('0x2a'),_0x44d7('0x2b'),_0x44d7('0x57'),util[_0x44d7('0x3a')](_0xac6290,{'showHidden':![],'depth':null}));}});})[_0x44d7('0x1d')](function(_0x227f52){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x44d7('0x2b'),_0x44d7('0x57'),util['inspect'](_0x227f52,{'showHidden':![],'depth':null}));});}else{logger[_0x44d7('0x1e')](_0x44d7('0x2a'),_0x44d7('0x2b'),_0x44d7('0x57'),_0x44d7('0x5c'));}}else{logger[_0x44d7('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x44d7('0x57'),_0x44d7('0x3b'));}break;case'csc':var _0x834ce6=require(_0x44d7('0x5d'));if(_0x5e4a72[_0x44d7('0x5e')]){var _0x7161ee={};_0x7161ee[_0x44d7('0x5f')]=_0x5e4a72[_0x44d7('0x32')];_0x7161ee['phone']=_0x4e20ef[_0x44d7('0x24')];_0x7161ee[_0x44d7('0x30')]=_0x5e4a72[_0x44d7('0x24')];_0x7161ee[_0x44d7('0x60')]=_0x4e20ef[_0x44d7('0xf')];_0x7161ee[_0x44d7('0x61')]=+new Date();var _0xbe95c9='';var _0x1d410a='';var _0x3abe56=Object[_0x44d7('0x62')](_0x7161ee);_0x3abe56['sort']();for(var _0x12a37f=0x0;_0x12a37f<_0x3abe56['length'];_0x12a37f++){if(_0xbe95c9!=''){_0xbe95c9+='&';}_0xbe95c9+=_0x3abe56[_0x12a37f]+'='+encodeURIComponent(_0x7161ee[_0x3abe56[_0x12a37f]]);_0x1d410a+=_0x7161ee[_0x3abe56[_0x12a37f]];}_0x1d410a+=_0x5e4a72[_0x44d7('0x5e')];_0x1d410a=_0x834ce6['createHash'](_0x44d7('0x63'))[_0x44d7('0x1b')](_0x1d410a)[_0x44d7('0x64')]('hex');if(_0xbe95c9!==''){_0xbe95c9+='&';}_0xbe95c9+='signature='+_0x1d410a;var _0x2c9b11={'method':_0x44d7('0x34'),'uri':_0x5e4a72[_0x44d7('0x58')]+_0x44d7('0x65')+_0xbe95c9,'json':!![]};return rp(_0x2c9b11)['then'](function(_0x369c53){var _0x23386f=Object[_0x44d7('0x62')](_0x369c53);if(_0x369c53[_0x23386f[0x0]][_0x44d7('0x1e')]&&parseInt(_0x369c53[_0x23386f[0x0]][_0x44d7('0x1e')])===0x0){var _0x366453={'messageId':_0x369c53[_0x23386f[0x0]][_0x44d7('0x66')]};if(!_0x5e4a72['deliveryReport']){_0x366453['read']=!![];}return _0xf11694[_0x44d7('0x1b')](_0x366453);}else{return logger[_0x44d7('0x1e')](_0x44d7('0x2a'),_0x44d7('0x2b'),_0x44d7('0x67'),util['inspect'](_0x369c53[_0x44d7('0x1e')],{'showHidden':![],'depth':null}));}})[_0x44d7('0x1d')](function(_0x3c78b2){return logger[_0x44d7('0x1e')](_0x44d7('0x2a'),'afterCreate',_0x44d7('0x67'),util[_0x44d7('0x3a')](_0x3c78b2,{'showHidden':![],'depth':null}));});}else{logger[_0x44d7('0x1e')](_0x44d7('0x2a'),_0x44d7('0x2b'),_0x44d7('0x67'),_0x44d7('0x68'));}break;case _0x44d7('0x69'):if(_0x5e4a72[_0x44d7('0x5e')]){var _0x37391c={'method':'POST','uri':_0x44d7('0x6a'),'headers':{'Authorization':_0x5e4a72[_0x44d7('0x5e')]},'body':{'content':_0x4e20ef[_0x44d7('0xf')],'to':[_0x4e20ef['phone']],'from':_0x5e4a72[_0x44d7('0x24')],'binary':![],'clientMessageId':_0x44d7('0x6b'),'charset':_0x44d7('0x6c')},'json':!![]};rp(_0x37391c)[_0x44d7('0x1a')](function(_0x4a5e3a){if(!_0x4a5e3a['error']){var _0x2bb305={'messageId':_0x4a5e3a[_0x44d7('0x4d')][0x0][_0x44d7('0x6d')]};if(!_0x5e4a72['deliveryReport']){_0x2bb305[_0x44d7('0x39')]=!![];}return _0xf11694[_0x44d7('0x1b')](_0x2bb305);}else{return logger[_0x44d7('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickatell',util[_0x44d7('0x3a')](_0x4a5e3a[_0x44d7('0x1e')],{'showHidden':![],'depth':null}));}})[_0x44d7('0x1d')](function(_0x14c269){return logger['error'](_0x44d7('0x2a'),'afterCreate',_0x44d7('0x69'),util[_0x44d7('0x3a')](_0x14c269,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x44d7('0x2a'),_0x44d7('0x2b'),'clickatell',_0x44d7('0x68'));}break;case _0x44d7('0x6e'):if(_0x5e4a72[_0x44d7('0x5e')]){var _0xd355ca={};var _0x2c9b11={'method':'POST','uri':_0x44d7('0x6f'),'headers':{'Authorization':_0x44d7('0x70')+_0x5e4a72[_0x44d7('0x5e')],'Content-Type':_0x44d7('0x71')},'body':{'from':_0x5e4a72[_0x44d7('0x24')],'to':_0x4e20ef[_0x44d7('0x24')],'text':_0x4e20ef[_0x44d7('0xf')]},'json':!![]};return rp(_0x2c9b11)[_0x44d7('0x1a')](function(_0x4f81f8){if(_0x4f81f8[_0x44d7('0x72')]==0xca){_0xd355ca[_0x44d7('0x73')]=_0x4f81f8;var _0x31c5a4={'method':_0x44d7('0x36'),'uri':_0x44d7('0x74'),'headers':{'Authorization':_0x44d7('0x70')+_0x5e4a72[_0x44d7('0x5e')],'Content-Type':'application/json'},'body':{'refid':_0xd355ca[_0x44d7('0x73')][_0x44d7('0x75')]},'json':!![]};return rp(_0x31c5a4)[_0x44d7('0x1a')](function(_0x1e79c0){_0xd355ca[_0x44d7('0x76')]=_0x1e79c0;var _0x2e7976={'messageId':_0xd355ca['message'][_0x44d7('0x75')],'read':!![]};return _0xf11694[_0x44d7('0x1b')](_0x2e7976);});}else{return logger[_0x44d7('0x1e')](_0x44d7('0x2a'),_0x44d7('0x2b'),_0x44d7('0x6e'),util[_0x44d7('0x3a')](_0x4f81f8,{'showHidden':![],'depth':null}));}})['catch'](function(_0x55049a){return logger[_0x44d7('0x1e')](_0x44d7('0x2a'),'afterCreate',_0x44d7('0x6e'),util[_0x44d7('0x3a')](_0x55049a,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x44d7('0x2a'),'afterCreate',_0x44d7('0x6e'),_0x44d7('0x77'));}break;}}})[_0x44d7('0x78')](function(){_0xed0b1b();});}else{_0xed0b1b();}}},'charset':_0x44d7('0x79'),'collate':_0x44d7('0x7a')});}; \ No newline at end of file +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 diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 2aab480..6dbfc28 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 _0x5eb8=['client','http','defaults','redis','localhost','register','request','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','SmsMessage,\x20%s,\x20%s','message','result','catch','options','raw','then','stringify','CreateSmsMessage','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x38d31d,_0x290993){var _0x2766f2=function(_0x5ca9b9){while(--_0x5ca9b9){_0x38d31d['push'](_0x38d31d['shift']());}};_0x2766f2(++_0x290993);}(_0x5eb8,0xb0));var _0x85eb=function(_0x4843f9,_0x4af459){_0x4843f9=_0x4843f9-0x0;var _0x193c6a=_0x5eb8[_0x4843f9];return _0x193c6a;};'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});config['redis']=_[_0x85eb('0xc')](config[_0x85eb('0xd')],{'host':_0x85eb('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x85eb('0xd')]));require('./smsMessage.socket')[_0x85eb('0xf')](socket);function respondWithRpcPromise(_0x40d6b6,_0x673228,_0x29030b){return new BPromise(function(_0x1dacf2,_0x73e6d0){return client[_0x85eb('0x10')](_0x40d6b6,_0x29030b)['then'](function(_0x163f32){logger[_0x85eb('0x11')]('SmsMessage,\x20%s,\x20%s',_0x673228,_0x85eb('0x12'));logger[_0x85eb('0x13')](_0x85eb('0x14'),_0x673228,_0x85eb('0x12'),JSON['stringify'](_0x163f32));if(_0x163f32['error']){if(_0x163f32[_0x85eb('0x15')]['code']===0x1f4){logger[_0x85eb('0x15')](_0x85eb('0x16'),_0x673228,_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);return _0x73e6d0(_0x163f32[_0x85eb('0x15')]['message']);}logger[_0x85eb('0x15')]('SmsMessage,\x20%s,\x20%s',_0x673228,_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);return _0x1dacf2(_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x673228,'request\x20sent');_0x1dacf2(_0x163f32[_0x85eb('0x18')][_0x85eb('0x17')]);}})[_0x85eb('0x19')](function(_0x2e986c){logger[_0x85eb('0x15')](_0x85eb('0x16'),_0x673228,_0x2e986c);_0x73e6d0(_0x2e986c);});});}exports['CreateSmsMessage']=function(_0x24cf28){var _0x7244fc=this;return new Promise(function(_0xd9f06d,_0x4e8041){return db['SmsMessage']['create'](_0x24cf28['body'],{'raw':_0x24cf28[_0x85eb('0x1a')]?_0x24cf28[_0x85eb('0x1a')][_0x85eb('0x1b')]===undefined?!![]:![]:!![]})[_0x85eb('0x1c')](function(_0x465c74){logger[_0x85eb('0x11')]('CreateSmsMessage',_0x24cf28);logger['debug']('CreateSmsMessage',_0x24cf28,JSON[_0x85eb('0x1d')](_0x465c74));_0xd9f06d(_0x465c74);})[_0x85eb('0x19')](function(_0x3f7a4d){logger[_0x85eb('0x15')](_0x85eb('0x1e'),_0x3f7a4d[_0x85eb('0x17')],_0x24cf28);_0x4e8041(_0x7244fc['error'](0x1f4,_0x3f7a4d[_0x85eb('0x17')]));});});}; \ No newline at end of file +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 diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 9d1e751..a149a53 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 _0x4c4d=['emit','removeListener','length','smsMessage:','save','remove','update'];(function(_0x862c70,_0x5ca798){var _0x423b3d=function(_0x11d549){while(--_0x11d549){_0x862c70['push'](_0x862c70['shift']());}};_0x423b3d(++_0x5ca798);}(_0x4c4d,0x12a));var _0xd4c4=function(_0x37715d,_0xdb0d52){_0x37715d=_0x37715d-0x0;var _0x2caac8=_0x4c4d[_0x37715d];return _0x2caac8;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xd4c4('0x0'),_0xd4c4('0x1'),_0xd4c4('0x2')];function createListener(_0x567194,_0x5eb944){return function(_0x235217){_0x5eb944[_0xd4c4('0x3')](_0x567194,_0x235217);};}function removeListener(_0x1541cf,_0x10f79f){return function(){SmsMessageEvents[_0xd4c4('0x4')](_0x1541cf,_0x10f79f);};}exports['register']=function(_0x33b961){for(var _0xa093d1=0x0,_0x3b435b=events[_0xd4c4('0x5')];_0xa093d1<_0x3b435b;_0xa093d1++){var _0x1b6be3=events[_0xa093d1];var _0x5b4753=createListener(_0xd4c4('0x6')+_0x1b6be3,_0x33b961);SmsMessageEvents['on'](_0x1b6be3,_0x5b4753);}}; \ No newline at end of file +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 diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 570b0cc..a8c6296 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 _0x3646=['get','isAuthenticated','index','/describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3646,0x15f));var _0x6364=function(_0x49a2d8,_0x23a72d){_0x49a2d8=_0x49a2d8-0x0;var _0x23c39f=_0x3646[_0x49a2d8];return _0x23c39f;};'use strict';var multer=require(_0x6364('0x0'));var util=require(_0x6364('0x1'));var path=require(_0x6364('0x2'));var timeout=require(_0x6364('0x3'));var express=require('express');var router=express[_0x6364('0x4')]();var auth=require(_0x6364('0x5'));var interaction=require(_0x6364('0x6'));var config=require(_0x6364('0x7'));var controller=require(_0x6364('0x8'));router[_0x6364('0x9')]('/',auth[_0x6364('0xa')](),controller[_0x6364('0xb')]);router[_0x6364('0x9')](_0x6364('0xc'),auth[_0x6364('0xa')](),controller['describe']);router[_0x6364('0x9')](_0x6364('0xd'),auth[_0x6364('0xa')](),controller[_0x6364('0xe')]);router['get']('/:id/members',auth['isAuthenticated'](),controller[_0x6364('0xf')]);router[_0x6364('0x9')](_0x6364('0x10'),auth[_0x6364('0xa')](),controller[_0x6364('0x11')]);router[_0x6364('0x9')](_0x6364('0x12'),auth['isAuthenticated'](),controller[_0x6364('0x13')]);router[_0x6364('0x14')]('/',auth[_0x6364('0xa')](),controller['create']);router[_0x6364('0x14')](_0x6364('0x10'),auth[_0x6364('0xa')](),controller[_0x6364('0x15')]);router['post'](_0x6364('0x12'),auth['isAuthenticated'](),controller[_0x6364('0x16')]);router[_0x6364('0x17')](_0x6364('0xd'),auth['isAuthenticated'](),controller[_0x6364('0x18')]);router[_0x6364('0x19')](_0x6364('0xd'),auth[_0x6364('0xa')](),controller[_0x6364('0x1a')]);router[_0x6364('0x19')](_0x6364('0x10'),auth['isAuthenticated'](),controller[_0x6364('0x1b')]);router['delete'](_0x6364('0x12'),auth[_0x6364('0xa')](),controller[_0x6364('0x1c')]);module[_0x6364('0x1d')]=router; \ No newline at end of file +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 diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index b15727b..66c6958 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 _0xbe0c=['STRING','INTEGER','ENUM','rrmemory','beepall','sequelize','exports','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbe0c,0x155));var _0xcbe0=function(_0xe33b12,_0x2a9761){_0xe33b12=_0xe33b12-0x0;var _0x30699d=_0xbe0c[_0xe33b12];return _0x30699d;};'use strict';var Sequelize=require(_0xcbe0('0x0'));module[_0xcbe0('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xcbe0('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xcbe0('0x3')]},'timeout':{'type':Sequelize[_0xcbe0('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcbe0('0x5')](_0xcbe0('0x6'),_0xcbe0('0x7'),'roundrobin')}}; \ No newline at end of file +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 diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 7486072..8a62efb 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 _0x1a85=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','save','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','hasOwnProperty','order','where','filters','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','keys','length','options','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','UserSmsQueue','sort','User','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','nolimit','addTeams','ids','Team','Agents','online','sequelize','transaction','each','findOrCreate','forEach','removeTeams','select','field','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','all','union','compact','value','removeAgents','emit','userSmsQueue:remove','addAgents','userSmsQueue:save','isArray','getAgents','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x5aba28,_0x1cac8d){var _0x48a9c5=function(_0x51bc0c){while(--_0x51bc0c){_0x5aba28['push'](_0x5aba28['shift']());}};_0x48a9c5(++_0x1cac8d);}(_0x1a85,0x178));var _0x51a8=function(_0x216bb8,_0x103b3b){_0x216bb8=_0x216bb8-0x0;var _0x5756ad=_0x1a85[_0x216bb8];return _0x5756ad;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x51a8('0x0'));var zipdir=require(_0x51a8('0x1'));var jsonpatch=require(_0x51a8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x51a8('0x3'));var Mustache=require(_0x51a8('0x4'));var util=require(_0x51a8('0x5'));var path=require('path');var sox=require(_0x51a8('0x6'));var csv=require('to-csv');var ejs=require(_0x51a8('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x51a8('0x8'));var crypto=require(_0x51a8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x51a8('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x51a8('0xb'));var Redis=require(_0x51a8('0xc'));var authService=require(_0x51a8('0xd'));var qs=require(_0x51a8('0xe'));var as=require(_0x51a8('0xf'));var hardwareService=require(_0x51a8('0x10'));var logger=require(_0x51a8('0x11'))(_0x51a8('0x12'));var utils=require(_0x51a8('0x13'));var config=require(_0x51a8('0x14'));var db=require(_0x51a8('0x15'))['db'];config[_0x51a8('0x16')]=_[_0x51a8('0x17')](config[_0x51a8('0x16')],{'host':_0x51a8('0x18'),'port':0x18eb});var socket=require(_0x51a8('0x19'))(new Redis(config[_0x51a8('0x16')]));require('./smsQueue.socket')[_0x51a8('0x1a')](socket);function respondWithStatusCode(_0x7a4c36,_0xaec066){_0xaec066=_0xaec066||0xcc;return function(_0x50d992){if(_0x50d992){return _0x7a4c36[_0x51a8('0x1b')](_0xaec066);}return _0x7a4c36['status'](_0xaec066)[_0x51a8('0x1c')]();};}function respondWithResult(_0x2b8d37,_0x39cd45){_0x39cd45=_0x39cd45||0xc8;return function(_0x2b0521){if(_0x2b0521){return _0x2b8d37[_0x51a8('0x1d')](_0x39cd45)[_0x51a8('0x1e')](_0x2b0521);}};}function respondWithFilteredResult(_0x1f49ee,_0x516abc){return function(_0x1c2f25){if(_0x1c2f25){var _0x45a433=_0x1c2f25[_0x51a8('0x1f')],_0xd52230=_0x516abc['offset'],_0x23539e=_0x516abc[_0x51a8('0x20')]+_0x516abc[_0x51a8('0x21')],_0x3bc1a2;if(_0x23539e>=_0x45a433){_0x23539e=_0x45a433;_0x3bc1a2=0xc8;}else{_0x3bc1a2=0xce;}_0x1f49ee[_0x51a8('0x1d')](_0x3bc1a2);return _0x1f49ee[_0x51a8('0x22')](_0x51a8('0x23'),_0xd52230+'-'+_0x23539e+'/'+_0x45a433)[_0x51a8('0x1e')](_0x1c2f25);}return null;};}function patchUpdates(_0x28aea0){return function(_0x3bf5b6){try{jsonpatch['apply'](_0x3bf5b6,_0x28aea0,!![]);}catch(_0xf80fa9){return BPromise['reject'](_0xf80fa9);}return _0x3bf5b6[_0x51a8('0x24')]();};}function saveUpdates(_0x12c029,_0x8bda40){return function(_0x3759d6){if(_0x3759d6){return _0x3759d6['update'](_0x12c029)[_0x51a8('0x25')](function(_0x4b9cdd){return _0x4b9cdd;});}return null;};}function removeEntity(_0x47f063,_0x23d26a){return function(_0x52e503){if(_0x52e503){return _0x52e503[_0x51a8('0x26')]()[_0x51a8('0x25')](function(){var _0x20ef8b=_0x52e503[_0x51a8('0x27')]({'plain':!![]});var _0x157554=_0x51a8('0x28');return db[_0x51a8('0x29')][_0x51a8('0x26')]({'where':{'type':_0x157554,'resourceId':_0x20ef8b['id']}})['then'](function(){return _0x52e503;});})[_0x51a8('0x25')](function(){_0x47f063[_0x51a8('0x1d')](0xcc)[_0x51a8('0x1c')]();});}};}function handleEntityNotFound(_0x3da187,_0x1c150d){return function(_0x11aefc){if(!_0x11aefc){_0x3da187[_0x51a8('0x1b')](0x194);}return _0x11aefc;};}function handleError(_0x2742f5,_0xec08ae){_0xec08ae=_0xec08ae||0x1f4;return function(_0x4b5cda){logger[_0x51a8('0x2a')](_0x4b5cda[_0x51a8('0x2b')]);if(_0x4b5cda['name']){delete _0x4b5cda[_0x51a8('0x2c')];}_0x2742f5['status'](_0xec08ae)[_0x51a8('0x2d')](_0x4b5cda);};}exports[_0x51a8('0x2e')]=function(_0x143f46,_0x41df56){var _0x2136b4={},_0x4ea271={},_0x10c19b={'count':0x0,'rows':[]};var _0x4c67ff=_[_0x51a8('0x2f')](db[_0x51a8('0x30')][_0x51a8('0x31')],function(_0x4b19c8){return{'name':_0x4b19c8[_0x51a8('0x32')],'type':_0x4b19c8['type'][_0x51a8('0x33')]};});_0x4ea271[_0x51a8('0x34')]=_[_0x51a8('0x2f')](_0x4c67ff,_0x51a8('0x2c'));_0x4ea271[_0x51a8('0x35')]=_['keys'](_0x143f46[_0x51a8('0x35')]);_0x4ea271['filters']=_[_0x51a8('0x36')](_0x4ea271[_0x51a8('0x34')],_0x4ea271[_0x51a8('0x35')]);_0x2136b4['attributes']=_[_0x51a8('0x36')](_0x4ea271[_0x51a8('0x34')],qs[_0x51a8('0x37')](_0x143f46[_0x51a8('0x35')][_0x51a8('0x37')]));_0x2136b4['attributes']=_0x2136b4['attributes']['length']?_0x2136b4[_0x51a8('0x38')]:_0x4ea271[_0x51a8('0x34')];if(!_0x143f46['query'][_0x51a8('0x39')]('nolimit')){_0x2136b4[_0x51a8('0x21')]=qs[_0x51a8('0x21')](_0x143f46[_0x51a8('0x35')][_0x51a8('0x21')]);_0x2136b4[_0x51a8('0x20')]=qs[_0x51a8('0x20')](_0x143f46['query']['offset']);}_0x2136b4[_0x51a8('0x3a')]=qs['sort'](_0x143f46['query']['sort']);_0x2136b4[_0x51a8('0x3b')]=qs[_0x51a8('0x3c')](_[_0x51a8('0x3d')](_0x143f46['query'],_0x4ea271[_0x51a8('0x3c')]));if(_0x143f46[_0x51a8('0x35')][_0x51a8('0x3e')]){_0x2136b4[_0x51a8('0x3b')]=_['merge'](_0x2136b4[_0x51a8('0x3b')],{'$or':_[_0x51a8('0x2f')](_0x4c67ff,function(_0x1b0333){if(_0x1b0333['type']!==_0x51a8('0x3f')){var _0x51d7bd={};_0x51d7bd[_0x1b0333[_0x51a8('0x2c')]]={'$like':'%'+_0x143f46[_0x51a8('0x35')][_0x51a8('0x3e')]+'%'};return _0x51d7bd;}})});}_0x2136b4=_[_0x51a8('0x40')]({},_0x2136b4,_0x143f46['options']);var _0x8e248={'where':_0x2136b4[_0x51a8('0x3b')]};return db[_0x51a8('0x30')][_0x51a8('0x1f')](_0x8e248)[_0x51a8('0x25')](function(_0x35c1c9){_0x10c19b[_0x51a8('0x1f')]=_0x35c1c9;if(_0x143f46[_0x51a8('0x35')][_0x51a8('0x41')]){_0x2136b4['include']=[{'all':!![]}];}return db[_0x51a8('0x30')][_0x51a8('0x42')](_0x2136b4);})['then'](function(_0x53409d){_0x10c19b[_0x51a8('0x43')]=_0x53409d;return _0x10c19b;})[_0x51a8('0x25')](respondWithFilteredResult(_0x41df56,_0x2136b4))[_0x51a8('0x44')](handleError(_0x41df56,null));};exports[_0x51a8('0x45')]=function(_0x311574,_0x157a51){var _0x28f5b3={'raw':!![],'where':{'id':_0x311574[_0x51a8('0x46')]['id']}},_0x18c697={};_0x18c697[_0x51a8('0x34')]=_['keys'](db[_0x51a8('0x30')][_0x51a8('0x31')]);_0x18c697[_0x51a8('0x35')]=_[_0x51a8('0x47')](_0x311574[_0x51a8('0x35')]);_0x18c697[_0x51a8('0x3c')]=_['intersection'](_0x18c697[_0x51a8('0x34')],_0x18c697['query']);_0x28f5b3[_0x51a8('0x38')]=_[_0x51a8('0x36')](_0x18c697[_0x51a8('0x34')],qs[_0x51a8('0x37')](_0x311574[_0x51a8('0x35')]['fields']));_0x28f5b3['attributes']=_0x28f5b3[_0x51a8('0x38')][_0x51a8('0x48')]?_0x28f5b3[_0x51a8('0x38')]:_0x18c697[_0x51a8('0x34')];if(_0x311574[_0x51a8('0x35')]['includeAll']){_0x28f5b3['include']=[{'all':!![]}];}_0x28f5b3=_[_0x51a8('0x40')]({},_0x28f5b3,_0x311574[_0x51a8('0x49')]);return db[_0x51a8('0x30')][_0x51a8('0x4a')](_0x28f5b3)[_0x51a8('0x25')](handleEntityNotFound(_0x157a51,null))[_0x51a8('0x25')](respondWithResult(_0x157a51,null))[_0x51a8('0x44')](handleError(_0x157a51,null));};exports[_0x51a8('0x4b')]=function(_0x301578,_0x4d29ab){return db['SmsQueue']['create'](_0x301578[_0x51a8('0x4c')],{})[_0x51a8('0x25')](function(_0x103897){var _0x5259f3=_0x301578[_0x51a8('0x4d')][_0x51a8('0x27')]({'plain':!![]});if(!_0x5259f3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5259f3[_0x51a8('0x4e')]==='user'){var _0x50a2f8=_0x103897[_0x51a8('0x27')]({'plain':!![]});var _0x4393c9=_0x51a8('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x4393c9,'userProfileId':_0x5259f3[_0x51a8('0x4f')]},'raw':!![]})['then'](function(_0x21c4da){if(_0x21c4da&&_0x21c4da[_0x51a8('0x50')]===0x0){return db[_0x51a8('0x29')][_0x51a8('0x4b')]({'name':_0x50a2f8[_0x51a8('0x2c')],'resourceId':_0x50a2f8['id'],'type':_0x21c4da[_0x51a8('0x2c')],'sectionId':_0x21c4da['id']},{})[_0x51a8('0x25')](function(){return _0x103897;});}else{return _0x103897;}})[_0x51a8('0x44')](function(_0x29d31e){logger['error'](_0x51a8('0x51'),_0x29d31e);throw _0x29d31e;});}return _0x103897;})[_0x51a8('0x25')](respondWithResult(_0x4d29ab,0xc9))[_0x51a8('0x44')](handleError(_0x4d29ab,null));};exports[_0x51a8('0x52')]=function(_0x533cfa,_0x13b7ba){if(_0x533cfa['body']['id']){delete _0x533cfa[_0x51a8('0x4c')]['id'];}return db[_0x51a8('0x30')]['find']({'where':{'id':_0x533cfa['params']['id']}})[_0x51a8('0x25')](handleEntityNotFound(_0x13b7ba,null))[_0x51a8('0x25')](saveUpdates(_0x533cfa[_0x51a8('0x4c')],null))[_0x51a8('0x25')](respondWithResult(_0x13b7ba,null))[_0x51a8('0x44')](handleError(_0x13b7ba,null));};exports['destroy']=function(_0x43b79a,_0xd1ddd5){return db[_0x51a8('0x30')][_0x51a8('0x4a')]({'where':{'id':_0x43b79a[_0x51a8('0x46')]['id']}})['then'](handleEntityNotFound(_0xd1ddd5,null))[_0x51a8('0x25')](removeEntity(_0xd1ddd5,null))[_0x51a8('0x44')](handleError(_0xd1ddd5,null));};exports[_0x51a8('0x53')]=function(_0x3e43cc,_0x62966a){return db[_0x51a8('0x30')]['describe']()['then'](respondWithResult(_0x62966a,null))['catch'](handleError(_0x62966a,null));};exports['getMembers']=function(_0x2048c6,_0x1df9cc,_0x51f9f7){var _0x7ac0ae={'raw':!![],'where':{}},_0x56d3d7={},_0x41cc00;return db['SmsQueue'][_0x51a8('0x54')]({'where':{'id':_0x2048c6[_0x51a8('0x46')]['id']}})['then'](handleEntityNotFound(_0x1df9cc,null))['then'](function(_0x5eb540){if(_0x5eb540){_0x41cc00=_0x5eb540[_0x51a8('0x27')]({'plain':!![]});_0x56d3d7[_0x51a8('0x34')]=_[_0x51a8('0x47')](db[_0x51a8('0x55')][_0x51a8('0x31')]);_0x56d3d7[_0x51a8('0x35')]=_[_0x51a8('0x47')](_0x2048c6[_0x51a8('0x35')]);_0x56d3d7['filters']=_[_0x51a8('0x36')](_0x56d3d7[_0x51a8('0x34')],_0x56d3d7['query']);_0x7ac0ae[_0x51a8('0x38')]=_[_0x51a8('0x36')](_0x56d3d7[_0x51a8('0x34')],qs[_0x51a8('0x37')](_0x2048c6[_0x51a8('0x35')][_0x51a8('0x37')]));_0x7ac0ae['attributes']=_0x7ac0ae['attributes'][_0x51a8('0x48')]?_0x7ac0ae['attributes']:_0x56d3d7['model'];if(!_0x2048c6['query']['hasOwnProperty']('nolimit')){_0x7ac0ae[_0x51a8('0x21')]=qs['limit'](_0x2048c6[_0x51a8('0x35')][_0x51a8('0x21')]);_0x7ac0ae[_0x51a8('0x20')]=qs[_0x51a8('0x20')](_0x2048c6[_0x51a8('0x35')][_0x51a8('0x20')]);}_0x7ac0ae[_0x51a8('0x3a')]=qs[_0x51a8('0x56')](_0x2048c6[_0x51a8('0x35')][_0x51a8('0x56')]);_0x7ac0ae['where']=qs[_0x51a8('0x3c')](_[_0x51a8('0x3d')](_0x2048c6[_0x51a8('0x35')],_0x56d3d7['filters']));_0x7ac0ae['where']['SmsQueueId']=_0x5eb540['id'];if(_0x2048c6[_0x51a8('0x35')][_0x51a8('0x3e')]){_0x7ac0ae[_0x51a8('0x3b')]=_[_0x51a8('0x40')](_0x7ac0ae[_0x51a8('0x3b')],{'$or':_[_0x51a8('0x2f')](_0x7ac0ae[_0x51a8('0x38')],function(_0x418445){var _0x2813eb={};_0x2813eb[_0x418445]={'$like':'%'+_0x2048c6[_0x51a8('0x35')][_0x51a8('0x3e')]+'%'};return _0x2813eb;})});}_0x7ac0ae=_[_0x51a8('0x40')]({},_0x7ac0ae,_0x2048c6[_0x51a8('0x49')]);return db['UserSmsQueue'][_0x51a8('0x42')](_0x7ac0ae);}})[_0x51a8('0x25')](function(_0x52077e){if(_0x52077e){return db[_0x51a8('0x57')]['findAndCountAll']({'where':{'id':_['map'](_0x52077e,'UserId'),'role':_0x51a8('0x58')},'attributes':['id',_0x51a8('0x2c'),_0x51a8('0x59'),_0x51a8('0x5a'),_0x51a8('0x5b')]});}})[_0x51a8('0x25')](function(_0x8fe514){if(_0x8fe514){return{'count':_0x8fe514['count'],'rows':_['map'](_0x8fe514['rows'],function(_0x44e496){return{'membername':_0x44e496[_0x51a8('0x2c')],'UserId':_0x44e496['id'],'queue_name':_0x41cc00[_0x51a8('0x2c')],'SmsQueueId':_0x41cc00['id'],'interface':util[_0x51a8('0x5c')](_0x51a8('0x5d'),_0x51a8('0x5e'),_0x44e496['name']),'penalty':0x0,'paused':_0x44e496[_0x51a8('0x59')],'createdAt':_0x44e496['createdAt'],'updatedAt':_0x44e496[_0x51a8('0x5a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x51a8('0x25')](respondWithFilteredResult(_0x1df9cc,_0x7ac0ae))[_0x51a8('0x44')](handleError(_0x1df9cc,null));};exports[_0x51a8('0x5f')]=function(_0x149a40,_0x3aca4a,_0x895b42){var _0xc751c3={};var _0x3540cd={};var _0x39fcef;var _0x2289d9;return db['SmsQueue']['findOne']({'where':{'id':_0x149a40[_0x51a8('0x46')]['id']}})[_0x51a8('0x25')](handleEntityNotFound(_0x3aca4a,null))[_0x51a8('0x25')](function(_0x226ca4){if(_0x226ca4){_0x39fcef=_0x226ca4;_0x3540cd['model']=_[_0x51a8('0x47')](db['Team'][_0x51a8('0x31')]);_0x3540cd[_0x51a8('0x35')]=_[_0x51a8('0x47')](_0x149a40[_0x51a8('0x35')]);_0x3540cd[_0x51a8('0x3c')]=_[_0x51a8('0x36')](_0x3540cd[_0x51a8('0x34')],_0x3540cd[_0x51a8('0x35')]);_0xc751c3[_0x51a8('0x38')]=_['intersection'](_0x3540cd[_0x51a8('0x34')],qs[_0x51a8('0x37')](_0x149a40[_0x51a8('0x35')][_0x51a8('0x37')]));_0xc751c3['attributes']=_0xc751c3['attributes'][_0x51a8('0x48')]?_0xc751c3['attributes']:_0x3540cd['model'];_0xc751c3['order']=qs[_0x51a8('0x56')](_0x149a40['query']['sort']);_0xc751c3[_0x51a8('0x3b')]=qs[_0x51a8('0x3c')](_[_0x51a8('0x3d')](_0x149a40['query'],_0x3540cd[_0x51a8('0x3c')]));if(_0x149a40[_0x51a8('0x35')][_0x51a8('0x3e')]){_0xc751c3['where']=_[_0x51a8('0x40')](_0xc751c3[_0x51a8('0x3b')],{'$or':_[_0x51a8('0x2f')](_0xc751c3[_0x51a8('0x38')],function(_0xac2108){var _0x30dd7b={};_0x30dd7b[_0xac2108]={'$like':'%'+_0x149a40[_0x51a8('0x35')][_0x51a8('0x3e')]+'%'};return _0x30dd7b;})});}_0xc751c3=_[_0x51a8('0x40')]({},_0xc751c3,_0x149a40['options']);return _0x39fcef[_0x51a8('0x5f')](_0xc751c3);}})[_0x51a8('0x25')](function(_0x4e2c5d){if(_0x4e2c5d){_0x2289d9=_0x4e2c5d[_0x51a8('0x48')];if(!_0x149a40[_0x51a8('0x35')]['hasOwnProperty'](_0x51a8('0x60'))){_0xc751c3[_0x51a8('0x21')]=qs[_0x51a8('0x21')](_0x149a40[_0x51a8('0x35')][_0x51a8('0x21')]);_0xc751c3['offset']=qs[_0x51a8('0x20')](_0x149a40[_0x51a8('0x35')][_0x51a8('0x20')]);}return _0x39fcef[_0x51a8('0x5f')](_0xc751c3);}})['then'](function(_0x3db2b8){if(_0x3db2b8){return _0x3db2b8?{'count':_0x2289d9,'rows':_0x3db2b8}:null;}})[_0x51a8('0x25')](respondWithResult(_0x3aca4a,null))[_0x51a8('0x44')](handleError(_0x3aca4a,null));};exports[_0x51a8('0x61')]=function(_0x6cd464,_0x1f0587,_0xf718e){var _0xd22e7b=_0x6cd464['body'][_0x51a8('0x62')];return db[_0x51a8('0x63')]['findAll']({'where':{'id':_0xd22e7b},'attributes':['id'],'include':[{'model':db[_0x51a8('0x57')],'as':_0x51a8('0x64'),'attributes':['id','name',_0x51a8('0x65'),'voicePause','interface'],'raw':!![]}]})[_0x51a8('0x25')](function(_0xf2325b){if(_0xf2325b){var _0x41e0b9=_['flatMap'](_0xf2325b,function(_0x585d4e){var _0x73ecd7=_0x585d4e['get']({'plain':!![]});return _0x73ecd7[_0x51a8('0x64')];});return db[_0x51a8('0x30')][_0x51a8('0x4a')]({'where':{'id':_0x6cd464[_0x51a8('0x46')]['id']}})[_0x51a8('0x25')](function(_0x28acb8){return db[_0x51a8('0x66')][_0x51a8('0x67')](function(_0x23d98c){return _0x28acb8[_0x51a8('0x61')](_0xd22e7b,{'transaction':_0x23d98c})[_0x51a8('0x25')](function(){return BPromise[_0x51a8('0x68')](_0x41e0b9,function(_0x1b7381){return db[_0x51a8('0x55')][_0x51a8('0x69')]({'where':{'UserId':_0x1b7381['id'],'SmsQueueId':_0x6cd464['params']['id']},'transaction':_0x23d98c});});})['then'](function(){_0x41e0b9[_0x51a8('0x6a')](function(_0x4e25d7){socket['emit']('userSmsQueue:save',{'UserId':_0x4e25d7['id'],'SmsQueueId':_0x28acb8['id']});});});});});}})[_0x51a8('0x25')](respondWithStatusCode(_0x1f0587,null))[_0x51a8('0x44')](handleError(_0x1f0587,null));};exports[_0x51a8('0x6b')]=function(_0x125a28,_0x4d5f37,_0x975b8){return db[_0x51a8('0x63')]['findAll']({'where':{'id':_0x125a28[_0x51a8('0x35')][_0x51a8('0x62')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x51a8('0x25')](handleEntityNotFound(_0x4d5f37,null))[_0x51a8('0x25')](function(_0x8587b9){var _0x429363=_[_0x51a8('0x2f')](_0x8587b9,'id');var _0x1c7691=[];var _0x4e566a=[];var _0x13dab3=squel[_0x51a8('0x6c')]();_0x13dab3[_0x51a8('0x6d')]('tq.TeamId')[_0x51a8('0x6e')](_0x51a8('0x6f'),'tq')[_0x51a8('0x70')]('user_has_teams','ut',_0x51a8('0x71'))[_0x51a8('0x3b')]('SmsQueueId\x20=\x20?',_0x125a28[_0x51a8('0x46')]['id']);for(var _0x529916=0x0;_0x529916<_0x8587b9[_0x51a8('0x48')];_0x529916+=0x1){let _0x2d4c2b=_0x8587b9[_0x529916];for(var _0xfb059=0x0;_0xfb059<_0x2d4c2b[_0x51a8('0x64')][_0x51a8('0x48')];_0xfb059+=0x1){let _0x700df1=_0x2d4c2b[_0x51a8('0x64')][_0xfb059];var _0x42d0ad=_0x13dab3['clone']();_0x42d0ad[_0x51a8('0x3b')](_0x51a8('0x72'),_0x700df1['id']);_0x4e566a[_0x51a8('0x73')](db[_0x51a8('0x66')][_0x51a8('0x35')](_0x42d0ad['toString'](),{'type':db['sequelize'][_0x51a8('0x74')][_0x51a8('0x75')]})[_0x51a8('0x25')](function(_0x2e354f){if(_0x2e354f[_0x51a8('0x48')]===0x1){return _0x700df1['id'];}else{var _0x54ef0e=_[_0x51a8('0x76')](_['map'](_0x2e354f,_0x51a8('0x77')),function(_0x1a0f3f){return _['includes'](_0x429363,_0x1a0f3f);});if(_0x54ef0e){return _0x700df1['id'];}}}));}}return BPromise[_0x51a8('0x78')](_0x4e566a)['then'](function(_0x3b7e30){_0x1c7691=_(_0x1c7691)[_0x51a8('0x79')](_0x3b7e30)[_0x51a8('0x7a')]()[_0x51a8('0x7b')]();return db[_0x51a8('0x30')]['find']({'where':{'id':_0x125a28[_0x51a8('0x46')]['id']}})[_0x51a8('0x25')](function(_0x5d00c3){return db[_0x51a8('0x66')][_0x51a8('0x67')](function(_0x54e006){return _0x5d00c3['removeTeams'](_0x125a28[_0x51a8('0x35')][_0x51a8('0x62')],{'transaction':_0x54e006})[_0x51a8('0x25')](function(){if(!_['isEmpty'](_0x1c7691)){return _0x5d00c3[_0x51a8('0x7c')](_0x1c7691,{'transaction':_0x54e006});}})[_0x51a8('0x25')](function(){_0x1c7691[_0x51a8('0x6a')](function(_0x11aab9){socket[_0x51a8('0x7d')](_0x51a8('0x7e'),{'UserId':_0x11aab9,'SmsQueueId':_0x5d00c3['id']});});});});});});})[_0x51a8('0x25')](respondWithStatusCode(_0x4d5f37,null))['catch'](handleError(_0x4d5f37,null));};exports[_0x51a8('0x7f')]=function(_0xa5074c,_0xa29735,_0x3f97bd){return db['SmsQueue']['find']({'where':{'id':_0xa5074c[_0x51a8('0x46')]['id']}})[_0x51a8('0x25')](handleEntityNotFound(_0xa29735,null))['then'](function(_0x4ea00f){if(_0x4ea00f){return _0x4ea00f['addAgents'](_0xa5074c[_0x51a8('0x4c')]['ids'],_['omit'](_0xa5074c['body'],[_0x51a8('0x62'),'id'])||{})['spread'](function(_0x2cea3f){for(var _0x2d820c=0x0;_0x2d820c<_0xa5074c['body']['ids'][_0x51a8('0x48')];_0x2d820c+=0x1){socket['emit'](_0x51a8('0x80'),{'UserId':_0xa5074c[_0x51a8('0x4c')]['ids'][_0x2d820c],'SmsQueueId':_0xa5074c[_0x51a8('0x46')]['id']});}return _0x2cea3f;});}})[_0x51a8('0x25')](respondWithResult(_0xa29735,null))['catch'](handleError(_0xa29735,null));};exports[_0x51a8('0x7c')]=function(_0x3bcc82,_0x223bd7,_0x5d2e4f){return db[_0x51a8('0x30')][_0x51a8('0x4a')]({'where':{'id':_0x3bcc82[_0x51a8('0x46')]['id']}})['then'](handleEntityNotFound(_0x223bd7,null))['then'](function(_0x1a64f4){if(_0x1a64f4){return _0x1a64f4[_0x51a8('0x7c')](_0x3bcc82[_0x51a8('0x35')][_0x51a8('0x62')])[_0x51a8('0x25')](function(){if(_[_0x51a8('0x81')](_0x3bcc82[_0x51a8('0x35')][_0x51a8('0x62')])){for(var _0x1482ff=0x0;_0x1482ff<_0x3bcc82[_0x51a8('0x35')][_0x51a8('0x62')][_0x51a8('0x48')];_0x1482ff+=0x1){socket[_0x51a8('0x7d')]('userSmsQueue:remove',{'UserId':Number(_0x3bcc82['query'][_0x51a8('0x62')][_0x1482ff]),'SmsQueueId':Number(_0x3bcc82[_0x51a8('0x46')]['id'])});}}else{socket[_0x51a8('0x7d')](_0x51a8('0x7e'),{'UserId':Number(_0x3bcc82[_0x51a8('0x35')]['ids']),'SmsQueueId':Number(_0x3bcc82['params']['id'])});}});}})[_0x51a8('0x25')](respondWithStatusCode(_0x223bd7,null))[_0x51a8('0x44')](handleError(_0x223bd7,null));};exports['getAgents']=function(_0x682828,_0x2e1d8e,_0x2bb024){var _0x19ffd8={};var _0x121944={};var _0x4ee800;var _0x4df6b7;return db[_0x51a8('0x30')]['findOne']({'where':{'id':_0x682828[_0x51a8('0x46')]['id']}})['then'](handleEntityNotFound(_0x2e1d8e,null))[_0x51a8('0x25')](function(_0xcc76ac){if(_0xcc76ac){_0x4ee800=_0xcc76ac;_0x121944['model']=_[_0x51a8('0x47')](db[_0x51a8('0x57')][_0x51a8('0x31')]);_0x121944[_0x51a8('0x35')]=_['keys'](_0x682828['query']);_0x121944[_0x51a8('0x3c')]=_[_0x51a8('0x36')](_0x121944[_0x51a8('0x34')],_0x121944[_0x51a8('0x35')]);_0x19ffd8['attributes']=_[_0x51a8('0x36')](_0x121944['model'],qs[_0x51a8('0x37')](_0x682828['query'][_0x51a8('0x37')]));_0x19ffd8[_0x51a8('0x38')]=_0x19ffd8[_0x51a8('0x38')][_0x51a8('0x48')]?_0x19ffd8['attributes']:_0x121944[_0x51a8('0x34')];_0x19ffd8['order']=qs[_0x51a8('0x56')](_0x682828[_0x51a8('0x35')][_0x51a8('0x56')]);_0x19ffd8['where']=qs[_0x51a8('0x3c')](_[_0x51a8('0x3d')](_0x682828[_0x51a8('0x35')],_0x121944['filters']));if(_0x682828['query'][_0x51a8('0x3e')]){_0x19ffd8[_0x51a8('0x3b')]=_[_0x51a8('0x40')](_0x19ffd8[_0x51a8('0x3b')],{'$or':_['map'](_0x19ffd8['attributes'],function(_0x46c310){var _0x4f0b3b={};_0x4f0b3b[_0x46c310]={'$like':'%'+_0x682828[_0x51a8('0x35')][_0x51a8('0x3e')]+'%'};return _0x4f0b3b;})});}_0x19ffd8=_[_0x51a8('0x40')]({},_0x19ffd8,_0x682828[_0x51a8('0x49')]);return _0x4ee800[_0x51a8('0x82')](_0x19ffd8);}})[_0x51a8('0x25')](function(_0x2b0888){if(_0x2b0888){_0x4df6b7=_0x2b0888['length'];if(!_0x682828['query']['hasOwnProperty'](_0x51a8('0x60'))){_0x19ffd8[_0x51a8('0x21')]=qs[_0x51a8('0x21')](_0x682828[_0x51a8('0x35')][_0x51a8('0x21')]);_0x19ffd8['offset']=qs[_0x51a8('0x20')](_0x682828['query'][_0x51a8('0x20')]);}return _0x4ee800[_0x51a8('0x82')](_0x19ffd8);}})[_0x51a8('0x25')](function(_0xb9dad5){if(_0xb9dad5){return _0xb9dad5?{'count':_0x4df6b7,'rows':_0xb9dad5}:null;}})['then'](respondWithResult(_0x2e1d8e,null))['catch'](handleError(_0x2e1d8e,null));}; \ No newline at end of file +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 diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index a80df5b..21140a0 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 _0x14f6=['save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','SmsQueue'];(function(_0x2af47e,_0x1d2a86){var _0x5bca26=function(_0x4ba3db){while(--_0x4ba3db){_0x2af47e['push'](_0x2af47e['shift']());}};_0x5bca26(++_0x1d2a86);}(_0x14f6,0x1b6));var _0x614f=function(_0x44836c,_0x3471d0){_0x44836c=_0x44836c-0x0;var _0x2a61fe=_0x14f6[_0x44836c];return _0x2a61fe;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x614f('0x0'))['db'][_0x614f('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x614f('0x2'),'afterUpdate':_0x614f('0x3'),'afterDestroy':_0x614f('0x4')};function emitEvent(_0x18d19a){return function(_0x1d8619,_0x5883ee,_0x59d2a7){SmsQueueEvents[_0x614f('0x5')](_0x18d19a+':'+_0x1d8619['id'],_0x1d8619);SmsQueueEvents[_0x614f('0x5')](_0x18d19a,_0x1d8619);_0x59d2a7(null);};}for(var e in events){if(events[_0x614f('0x6')](e)){var event=events[e];SmsQueue[_0x614f('0x7')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +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 diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 139f59d..4d0b6ee 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 _0xfb82=['../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x4473a4,_0x404d7d){var _0x5d51cb=function(_0x5a6a54){while(--_0x5a6a54){_0x4473a4['push'](_0x4473a4['shift']());}};_0x5d51cb(++_0x404d7d);}(_0xfb82,0x17f));var _0x2fb8=function(_0x41a691,_0x442b74){_0x41a691=_0x41a691-0x0;var _0x4c7855=_0xfb82[_0x41a691];return _0x4c7855;};'use strict';var _=require(_0x2fb8('0x0'));var util=require(_0x2fb8('0x1'));var logger=require(_0x2fb8('0x2'))('api');var moment=require(_0x2fb8('0x3'));var BPromise=require(_0x2fb8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2fb8('0x5'));var rimraf=require(_0x2fb8('0x6'));var config=require(_0x2fb8('0x7'));var attributes=require(_0x2fb8('0x8'));module[_0x2fb8('0x9')]=function(_0xe9a5b5,_0x3e6900){return _0xe9a5b5[_0x2fb8('0xa')](_0x2fb8('0xb'),attributes,{'tableName':_0x2fb8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index f2f4566..5d349a3 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 _0x7b4d=['attributes','limit','include','map','ShowSmsQueue','find','model','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSmsQueue','SmsQueue','options','raw','where'];(function(_0xf896bd,_0x2dcdd1){var _0x201b55=function(_0x38e22d){while(--_0x38e22d){_0xf896bd['push'](_0xf896bd['shift']());}};_0x201b55(++_0x2dcdd1);}(_0x7b4d,0x1a9));var _0xd7b4=function(_0xb4cc12,_0x41436e){_0xb4cc12=_0xb4cc12-0x0;var _0x8593b5=_0x7b4d[_0xb4cc12];return _0x8593b5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd7b4('0x0'));var BPromise=require('bluebird');var rs=require(_0xd7b4('0x1'));var fs=require('fs');var Redis=require(_0xd7b4('0x2'));var db=require(_0xd7b4('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd7b4('0x4'));var config=require(_0xd7b4('0x5'));var jayson=require(_0xd7b4('0x6'));var client=jayson['client'][_0xd7b4('0x7')]({'port':0x232a});config[_0xd7b4('0x8')]=_[_0xd7b4('0x9')](config[_0xd7b4('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xd7b4('0xa'))(new Redis(config[_0xd7b4('0x8')]));require(_0xd7b4('0xb'))[_0xd7b4('0xc')](socket);function respondWithRpcPromise(_0x93ba,_0x15662a,_0x6e48a4){return new BPromise(function(_0x391c7f,_0x46ce81){return client[_0xd7b4('0xd')](_0x93ba,_0x6e48a4)[_0xd7b4('0xe')](function(_0x47f0ac){logger[_0xd7b4('0xf')](_0xd7b4('0x10'),_0x15662a,_0xd7b4('0x11'));logger[_0xd7b4('0x12')](_0xd7b4('0x13'),_0x15662a,_0xd7b4('0x11'),JSON[_0xd7b4('0x14')](_0x47f0ac));if(_0x47f0ac[_0xd7b4('0x15')]){if(_0x47f0ac[_0xd7b4('0x15')][_0xd7b4('0x16')]===0x1f4){logger[_0xd7b4('0x15')]('SmsQueue,\x20%s,\x20%s',_0x15662a,_0x47f0ac[_0xd7b4('0x15')][_0xd7b4('0x17')]);return _0x46ce81(_0x47f0ac['error']['message']);}logger[_0xd7b4('0x15')](_0xd7b4('0x10'),_0x15662a,_0x47f0ac[_0xd7b4('0x15')][_0xd7b4('0x17')]);return _0x391c7f(_0x47f0ac[_0xd7b4('0x15')]['message']);}else{logger[_0xd7b4('0xf')](_0xd7b4('0x10'),_0x15662a,_0xd7b4('0x11'));_0x391c7f(_0x47f0ac[_0xd7b4('0x18')]['message']);}})[_0xd7b4('0x19')](function(_0x418857){logger[_0xd7b4('0x15')]('SmsQueue,\x20%s,\x20%s',_0x15662a,_0x418857);_0x46ce81(_0x418857);});});}exports[_0xd7b4('0x1a')]=function(_0x5275a8){var _0x17ee35=this;return new Promise(function(_0xb9f86f,_0x48367d){return db[_0xd7b4('0x1b')]['findAll']({'raw':_0x5275a8[_0xd7b4('0x1c')]?_0x5275a8['options'][_0xd7b4('0x1d')]===undefined?!![]:![]:!![],'where':_0x5275a8['options']?_0x5275a8[_0xd7b4('0x1c')][_0xd7b4('0x1e')]||null:null,'attributes':_0x5275a8[_0xd7b4('0x1c')]?_0x5275a8['options'][_0xd7b4('0x1f')]||null:null,'limit':_0x5275a8[_0xd7b4('0x1c')]?_0x5275a8['options'][_0xd7b4('0x20')]||null:null,'include':_0x5275a8[_0xd7b4('0x1c')]?_0x5275a8[_0xd7b4('0x1c')][_0xd7b4('0x21')]?_[_0xd7b4('0x22')](_0x5275a8[_0xd7b4('0x1c')][_0xd7b4('0x21')],function(_0x201041){return{'model':db[_0x201041['model']],'as':_0x201041['as'],'attributes':_0x201041[_0xd7b4('0x1f')],'include':_0x201041[_0xd7b4('0x21')]?_['map'](_0x201041[_0xd7b4('0x21')],function(_0x5cceef){return{'model':db[_0x5cceef['model']],'as':_0x5cceef['as'],'attributes':_0x5cceef[_0xd7b4('0x1f')],'include':_0x5cceef[_0xd7b4('0x21')]?_['map'](_0x5cceef['include'],function(_0x4bd98a){return{'model':db[_0x4bd98a['model']],'as':_0x4bd98a['as'],'attributes':_0x4bd98a[_0xd7b4('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd7b4('0xe')](function(_0x29b20a){logger[_0xd7b4('0xf')]('GetSmsQueue',_0x5275a8);logger[_0xd7b4('0x12')](_0xd7b4('0x1a'),_0x5275a8,JSON[_0xd7b4('0x14')](_0x29b20a));_0xb9f86f(_0x29b20a);})[_0xd7b4('0x19')](function(_0x2908e8){logger['error'](_0xd7b4('0x1a'),_0x2908e8['message'],_0x5275a8);_0x48367d(_0x17ee35[_0xd7b4('0x15')](0x1f4,_0x2908e8['message']));});});};exports[_0xd7b4('0x23')]=function(_0x1846bf){var _0x1cae88=this;return new Promise(function(_0x47c495,_0x335246){return db[_0xd7b4('0x1b')][_0xd7b4('0x24')]({'raw':_0x1846bf[_0xd7b4('0x1c')]?_0x1846bf[_0xd7b4('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x1846bf[_0xd7b4('0x1c')]?_0x1846bf[_0xd7b4('0x1c')][_0xd7b4('0x1e')]||null:null,'attributes':_0x1846bf[_0xd7b4('0x1c')]?_0x1846bf['options'][_0xd7b4('0x1f')]||null:null,'include':_0x1846bf[_0xd7b4('0x1c')]?_0x1846bf['options'][_0xd7b4('0x21')]?_[_0xd7b4('0x22')](_0x1846bf['options'][_0xd7b4('0x21')],function(_0x1d43b9){return{'model':db[_0x1d43b9[_0xd7b4('0x25')]],'as':_0x1d43b9['as'],'attributes':_0x1d43b9['attributes'],'include':_0x1d43b9['include']?_['map'](_0x1d43b9['include'],function(_0x3f70){return{'model':db[_0x3f70['model']],'as':_0x3f70['as'],'attributes':_0x3f70[_0xd7b4('0x1f')],'include':_0x3f70[_0xd7b4('0x21')]?_[_0xd7b4('0x22')](_0x3f70['include'],function(_0x5537ce){return{'model':db[_0x5537ce[_0xd7b4('0x25')]],'as':_0x5537ce['as'],'attributes':_0x5537ce[_0xd7b4('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd7b4('0xe')](function(_0x5ade0e){logger['info']('ShowSmsQueue',_0x1846bf);logger['debug'](_0xd7b4('0x23'),_0x1846bf,JSON[_0xd7b4('0x14')](_0x5ade0e));_0x47c495(_0x5ade0e);})[_0xd7b4('0x19')](function(_0xadfe5b){logger['error']('ShowSmsQueue',_0xadfe5b[_0xd7b4('0x17')],_0x1846bf);_0x335246(_0x1cae88[_0xd7b4('0x15')](0x1f4,_0xadfe5b[_0xd7b4('0x17')]));});});}; \ No newline at end of file +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 diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 86b7e7e..becf97c 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 _0x561d=['update','emit','removeListener','length','smsQueue:','./smsQueue.events','save','remove'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x561d,0x6d));var _0xd561=function(_0x4750ad,_0x533b89){_0x4750ad=_0x4750ad-0x0;var _0x4782b1=_0x561d[_0x4750ad];return _0x4782b1;};'use strict';var SmsQueueEvents=require(_0xd561('0x0'));var events=[_0xd561('0x1'),_0xd561('0x2'),_0xd561('0x3')];function createListener(_0x46a825,_0xd964c5){return function(_0x4ce01b){_0xd964c5[_0xd561('0x4')](_0x46a825,_0x4ce01b);};}function removeListener(_0x2a42b6,_0x37242a){return function(){SmsQueueEvents[_0xd561('0x5')](_0x2a42b6,_0x37242a);};}exports['register']=function(_0x4d5a73){for(var _0xb3ae40=0x0,_0x132924=events[_0xd561('0x6')];_0xb3ae40<_0x132924;_0xb3ae40++){var _0x643ea0=events[_0xb3ae40];var _0x539f10=createListener(_0xd561('0x7')+_0x643ea0,_0x4d5a73);SmsQueueEvents['on'](_0x643ea0,_0x539f10);}}; \ No newline at end of file +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 diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index bdadae1..487c215 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 _0x99e7=['express','../../components/auth/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','exports','multer','path','connect-timeout'];(function(_0x4d1e1f,_0x257a69){var _0x1fd04e=function(_0x74bec1){while(--_0x74bec1){_0x4d1e1f['push'](_0x4d1e1f['shift']());}};_0x1fd04e(++_0x257a69);}(_0x99e7,0x96));var _0x799e=function(_0x401ccd,_0x140815){_0x401ccd=_0x401ccd-0x0;var _0x5a57ad=_0x99e7[_0x401ccd];return _0x5a57ad;};'use strict';var multer=require(_0x799e('0x0'));var util=require('util');var path=require(_0x799e('0x1'));var timeout=require(_0x799e('0x2'));var express=require(_0x799e('0x3'));var router=express['Router']();var auth=require(_0x799e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x799e('0x5'));var controller=require(_0x799e('0x6'));router[_0x799e('0x7')]('/',auth[_0x799e('0x8')](),controller[_0x799e('0x9')]);router['get'](_0x799e('0xa'),auth['isAuthenticated'](),controller[_0x799e('0xb')]);router[_0x799e('0x7')](_0x799e('0xc'),auth[_0x799e('0x8')](),controller[_0x799e('0xd')]);router['post']('/',auth[_0x799e('0x8')](),controller['create']);router[_0x799e('0xe')](_0x799e('0xc'),auth[_0x799e('0x8')](),controller[_0x799e('0xf')]);router['delete']('/:id',auth[_0x799e('0x8')](),controller['destroy']);module[_0x799e('0x10')]=router; \ No newline at end of file +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 diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 318fa9f..bcbdded 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 _0xb77a=['moment','sequelize','STRING','DATE'];(function(_0x29ab0b,_0x6686db){var _0x58bdbe=function(_0x21b4b0){while(--_0x21b4b0){_0x29ab0b['push'](_0x29ab0b['shift']());}};_0x58bdbe(++_0x6686db);}(_0xb77a,0x118));var _0xab77=function(_0x2b206d,_0x1cd42){_0x2b206d=_0x2b206d-0x0;var _0x327722=_0xb77a[_0x2b206d];return _0x327722;};'use strict';var moment=require(_0xab77('0x0'));var Sequelize=require(_0xab77('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xab77('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xab77('0x2')]},'joinAt':{'type':Sequelize[_0xab77('0x3')]},'leaveAt':{'type':Sequelize[_0xab77('0x3')]},'acceptAt':{'type':Sequelize[_0xab77('0x3')]},'exitAt':{'type':Sequelize[_0xab77('0x3')]},'reason':{'type':Sequelize[_0xab77('0x2')]}}; \ No newline at end of file +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 diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 9d5ed1d..6e7458c 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 _0xa37f=['SmsQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','count','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','ejs','squel','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map'];(function(_0x4f3b2d,_0x3bbf46){var _0x3dddfa=function(_0xb8179a){while(--_0xb8179a){_0x4f3b2d['push'](_0x4f3b2d['shift']());}};_0x3dddfa(++_0x3bbf46);}(_0xa37f,0x14d));var _0xfa37=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa37f[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfa37('0x0'));var rimraf=require(_0xfa37('0x1'));var zipdir=require(_0xfa37('0x2'));var jsonpatch=require(_0xfa37('0x3'));var rp=require(_0xfa37('0x4'));var moment=require(_0xfa37('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfa37('0x6'));var util=require('util');var path=require('path');var sox=require(_0xfa37('0x7'));var csv=require('to-csv');var ejs=require(_0xfa37('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfa37('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfa37('0xa'));var querystring=require(_0xfa37('0xb'));var Papa=require(_0xfa37('0xc'));var Redis=require(_0xfa37('0xd'));var authService=require(_0xfa37('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xfa37('0xf'));var hardwareService=require(_0xfa37('0x10'));var logger=require('../../config/logger')(_0xfa37('0x11'));var utils=require('../../config/utils');var config=require(_0xfa37('0x12'));var db=require(_0xfa37('0x13'))['db'];function respondWithStatusCode(_0x5e6267,_0x159d11){_0x159d11=_0x159d11||0xcc;return function(_0x30d988){if(_0x30d988){return _0x5e6267[_0xfa37('0x14')](_0x159d11);}return _0x5e6267[_0xfa37('0x15')](_0x159d11)[_0xfa37('0x16')]();};}function respondWithResult(_0x2b1ff6,_0x5951f7){_0x5951f7=_0x5951f7||0xc8;return function(_0x16b006){if(_0x16b006){return _0x2b1ff6[_0xfa37('0x15')](_0x5951f7)[_0xfa37('0x17')](_0x16b006);}};}function respondWithFilteredResult(_0x3d4143,_0x326af3){return function(_0x3da465){if(_0x3da465){var _0x5f0036=_0x3da465['count'],_0x47b89a=_0x326af3[_0xfa37('0x18')],_0x4eefae=_0x326af3[_0xfa37('0x18')]+_0x326af3['limit'],_0x5d3235;if(_0x4eefae>=_0x5f0036){_0x4eefae=_0x5f0036;_0x5d3235=0xc8;}else{_0x5d3235=0xce;}_0x3d4143['status'](_0x5d3235);return _0x3d4143[_0xfa37('0x19')](_0xfa37('0x1a'),_0x47b89a+'-'+_0x4eefae+'/'+_0x5f0036)[_0xfa37('0x17')](_0x3da465);}return null;};}function patchUpdates(_0x3634e1){return function(_0x9ad162){try{jsonpatch[_0xfa37('0x1b')](_0x9ad162,_0x3634e1,!![]);}catch(_0x2f2e34){return BPromise[_0xfa37('0x1c')](_0x2f2e34);}return _0x9ad162[_0xfa37('0x1d')]();};}function saveUpdates(_0x524b87,_0x5350b2){return function(_0x5c3e7e){if(_0x5c3e7e){return _0x5c3e7e['update'](_0x524b87)[_0xfa37('0x1e')](function(_0x259d29){return _0x259d29;});}return null;};}function removeEntity(_0x19ffe3,_0x44b71c){return function(_0x4d65f7){if(_0x4d65f7){return _0x4d65f7['destroy']()[_0xfa37('0x1e')](function(){_0x19ffe3[_0xfa37('0x15')](0xcc)[_0xfa37('0x16')]();});}};}function handleEntityNotFound(_0x4d515c,_0x1f08bb){return function(_0x2b5282){if(!_0x2b5282){_0x4d515c['sendStatus'](0x194);}return _0x2b5282;};}function handleError(_0x49b22b,_0x3f986e){_0x3f986e=_0x3f986e||0x1f4;return function(_0x2c3afd){logger[_0xfa37('0x1f')](_0x2c3afd[_0xfa37('0x20')]);if(_0x2c3afd[_0xfa37('0x21')]){delete _0x2c3afd[_0xfa37('0x21')];}_0x49b22b[_0xfa37('0x15')](_0x3f986e)[_0xfa37('0x22')](_0x2c3afd);};}exports[_0xfa37('0x23')]=function(_0x136c68,_0x2b4ca0){var _0x2b1fe1={},_0x2781b3={},_0x2912da={'count':0x0,'rows':[]};var _0x3ae646=_[_0xfa37('0x24')](db[_0xfa37('0x25')][_0xfa37('0x26')],function(_0x1d0f9c){return{'name':_0x1d0f9c[_0xfa37('0x27')],'type':_0x1d0f9c[_0xfa37('0x28')][_0xfa37('0x29')]};});_0x2781b3[_0xfa37('0x2a')]=_['map'](_0x3ae646,_0xfa37('0x21'));_0x2781b3[_0xfa37('0x2b')]=_[_0xfa37('0x2c')](_0x136c68[_0xfa37('0x2b')]);_0x2781b3[_0xfa37('0x2d')]=_['intersection'](_0x2781b3['model'],_0x2781b3[_0xfa37('0x2b')]);_0x2b1fe1[_0xfa37('0x2e')]=_[_0xfa37('0x2f')](_0x2781b3[_0xfa37('0x2a')],qs['fields'](_0x136c68[_0xfa37('0x2b')][_0xfa37('0x30')]));_0x2b1fe1[_0xfa37('0x2e')]=_0x2b1fe1[_0xfa37('0x2e')][_0xfa37('0x31')]?_0x2b1fe1[_0xfa37('0x2e')]:_0x2781b3[_0xfa37('0x2a')];if(!_0x136c68['query'][_0xfa37('0x32')](_0xfa37('0x33'))){_0x2b1fe1[_0xfa37('0x34')]=qs[_0xfa37('0x34')](_0x136c68['query'][_0xfa37('0x34')]);_0x2b1fe1[_0xfa37('0x18')]=qs['offset'](_0x136c68[_0xfa37('0x2b')][_0xfa37('0x18')]);}_0x2b1fe1[_0xfa37('0x35')]=qs[_0xfa37('0x36')](_0x136c68['query']['sort']);_0x2b1fe1['where']=qs[_0xfa37('0x2d')](_[_0xfa37('0x37')](_0x136c68[_0xfa37('0x2b')],_0x2781b3[_0xfa37('0x2d')]));if(_0x136c68[_0xfa37('0x2b')][_0xfa37('0x38')]){_0x2b1fe1['where']=_[_0xfa37('0x39')](_0x2b1fe1[_0xfa37('0x3a')],{'$or':_['map'](_0x3ae646,function(_0x368f09){if(_0x368f09['type']!=='VIRTUAL'){var _0x414ce0={};_0x414ce0[_0x368f09[_0xfa37('0x21')]]={'$like':'%'+_0x136c68[_0xfa37('0x2b')][_0xfa37('0x38')]+'%'};return _0x414ce0;}})});}_0x2b1fe1=_[_0xfa37('0x39')]({},_0x2b1fe1,_0x136c68['options']);var _0x235a59={'where':_0x2b1fe1[_0xfa37('0x3a')]};return db[_0xfa37('0x25')]['count'](_0x235a59)[_0xfa37('0x1e')](function(_0x13a6d0){_0x2912da[_0xfa37('0x3b')]=_0x13a6d0;if(_0x136c68[_0xfa37('0x2b')][_0xfa37('0x3c')]){_0x2b1fe1['include']=[{'all':!![]}];}return db[_0xfa37('0x25')][_0xfa37('0x3d')](_0x2b1fe1);})[_0xfa37('0x1e')](function(_0x515cb2){_0x2912da[_0xfa37('0x3e')]=_0x515cb2;return _0x2912da;})['then'](respondWithFilteredResult(_0x2b4ca0,_0x2b1fe1))[_0xfa37('0x3f')](handleError(_0x2b4ca0,null));};exports[_0xfa37('0x40')]=function(_0x1fec96,_0x423593){var _0x47dbc8={'raw':!![],'where':{'id':_0x1fec96[_0xfa37('0x41')]['id']}},_0x14ff6e={};_0x14ff6e['model']=_[_0xfa37('0x2c')](db[_0xfa37('0x25')][_0xfa37('0x26')]);_0x14ff6e[_0xfa37('0x2b')]=_[_0xfa37('0x2c')](_0x1fec96[_0xfa37('0x2b')]);_0x14ff6e['filters']=_[_0xfa37('0x2f')](_0x14ff6e[_0xfa37('0x2a')],_0x14ff6e['query']);_0x47dbc8[_0xfa37('0x2e')]=_['intersection'](_0x14ff6e[_0xfa37('0x2a')],qs[_0xfa37('0x30')](_0x1fec96[_0xfa37('0x2b')][_0xfa37('0x30')]));_0x47dbc8['attributes']=_0x47dbc8[_0xfa37('0x2e')][_0xfa37('0x31')]?_0x47dbc8[_0xfa37('0x2e')]:_0x14ff6e[_0xfa37('0x2a')];if(_0x1fec96['query']['includeAll']){_0x47dbc8[_0xfa37('0x42')]=[{'all':!![]}];}_0x47dbc8=_[_0xfa37('0x39')]({},_0x47dbc8,_0x1fec96[_0xfa37('0x43')]);return db['SmsQueueReport'][_0xfa37('0x44')](_0x47dbc8)[_0xfa37('0x1e')](handleEntityNotFound(_0x423593,null))[_0xfa37('0x1e')](respondWithResult(_0x423593,null))[_0xfa37('0x3f')](handleError(_0x423593,null));};exports[_0xfa37('0x45')]=function(_0x692459,_0x5acd24){return db[_0xfa37('0x25')][_0xfa37('0x45')](_0x692459[_0xfa37('0x46')],{})[_0xfa37('0x1e')](respondWithResult(_0x5acd24,0xc9))['catch'](handleError(_0x5acd24,null));};exports[_0xfa37('0x47')]=function(_0x275a82,_0x5d3668){if(_0x275a82[_0xfa37('0x46')]['id']){delete _0x275a82[_0xfa37('0x46')]['id'];}return db[_0xfa37('0x25')][_0xfa37('0x44')]({'where':{'id':_0x275a82['params']['id']}})[_0xfa37('0x1e')](handleEntityNotFound(_0x5d3668,null))[_0xfa37('0x1e')](saveUpdates(_0x275a82[_0xfa37('0x46')],null))[_0xfa37('0x1e')](respondWithResult(_0x5d3668,null))['catch'](handleError(_0x5d3668,null));};exports[_0xfa37('0x48')]=function(_0xe0c08a,_0x1565ae){return db[_0xfa37('0x25')][_0xfa37('0x44')]({'where':{'id':_0xe0c08a[_0xfa37('0x41')]['id']}})[_0xfa37('0x1e')](handleEntityNotFound(_0x1565ae,null))[_0xfa37('0x1e')](removeEntity(_0x1565ae,null))['catch'](handleError(_0x1565ae,null));};exports[_0xfa37('0x49')]=function(_0x48bfc9,_0x46e091){return db[_0xfa37('0x25')][_0xfa37('0x49')]()[_0xfa37('0x1e')](respondWithResult(_0x46e091,null))[_0xfa37('0x3f')](handleError(_0x46e091,null));}; \ No newline at end of file +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 diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 845fff5..9ccb753 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 _0xd5fe=['bluebird','rimraf','../../config/environment','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util','api'];(function(_0x591fe2,_0xfc5782){var _0x359564=function(_0x34aeaa){while(--_0x34aeaa){_0x591fe2['push'](_0x591fe2['shift']());}};_0x359564(++_0xfc5782);}(_0xd5fe,0x1ab));var _0xed5f=function(_0x28c7a7,_0x55a356){_0x28c7a7=_0x28c7a7-0x0;var _0x50610f=_0xd5fe[_0x28c7a7];return _0x50610f;};'use strict';var _=require(_0xed5f('0x0'));var util=require(_0xed5f('0x1'));var logger=require('../../config/logger')(_0xed5f('0x2'));var moment=require('moment');var BPromise=require(_0xed5f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xed5f('0x4'));var config=require(_0xed5f('0x5'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x467a03,_0x20a6b9){return _0x467a03[_0xed5f('0x6')](_0xed5f('0x7'),attributes,{'tableName':_0xed5f('0x8'),'paranoid':![],'indexes':[{'name':_0xed5f('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index ba208ec..12bda97 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 _0xa3f1=['message','result','catch','CreateSmsQueueReport','create','body','options','raw','UpdateSmsQueueReport','SmsQueueReport','update','where','attributes','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x191a0a,_0x35012c){var _0x3b15f7=function(_0x3196a1){while(--_0x3196a1){_0x191a0a['push'](_0x191a0a['shift']());}};_0x3b15f7(++_0x35012c);}(_0xa3f1,0x13f));var _0x1a3f=function(_0x267480,_0x1bf513){_0x267480=_0x267480-0x0;var _0x8df2ea=_0xa3f1[_0x267480];return _0x8df2ea;};'use strict';var _=require('lodash');var util=require(_0x1a3f('0x0'));var moment=require(_0x1a3f('0x1'));var BPromise=require(_0x1a3f('0x2'));var rs=require(_0x1a3f('0x3'));var fs=require('fs');var Redis=require(_0x1a3f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1a3f('0x5'));var logger=require(_0x1a3f('0x6'))(_0x1a3f('0x7'));var config=require(_0x1a3f('0x8'));var jayson=require(_0x1a3f('0x9'));var client=jayson[_0x1a3f('0xa')][_0x1a3f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27c024,_0x2d8f09,_0x3ebd57){return new BPromise(function(_0x342e29,_0x53aa98){return client[_0x1a3f('0xc')](_0x27c024,_0x3ebd57)[_0x1a3f('0xd')](function(_0xba001){logger[_0x1a3f('0xe')](_0x1a3f('0xf'),_0x2d8f09,_0x1a3f('0x10'));logger[_0x1a3f('0x11')](_0x1a3f('0x12'),_0x2d8f09,'request\x20sent',JSON['stringify'](_0xba001));if(_0xba001['error']){if(_0xba001[_0x1a3f('0x13')][_0x1a3f('0x14')]===0x1f4){logger[_0x1a3f('0x13')](_0x1a3f('0xf'),_0x2d8f09,_0xba001['error'][_0x1a3f('0x15')]);return _0x53aa98(_0xba001[_0x1a3f('0x13')][_0x1a3f('0x15')]);}logger[_0x1a3f('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x2d8f09,_0xba001[_0x1a3f('0x13')]['message']);return _0x342e29(_0xba001[_0x1a3f('0x13')][_0x1a3f('0x15')]);}else{logger[_0x1a3f('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x2d8f09,_0x1a3f('0x10'));_0x342e29(_0xba001[_0x1a3f('0x16')]['message']);}})[_0x1a3f('0x17')](function(_0x5b4dbf){logger['error'](_0x1a3f('0xf'),_0x2d8f09,_0x5b4dbf);_0x53aa98(_0x5b4dbf);});});}exports[_0x1a3f('0x18')]=function(_0x586f32){var _0x3d0fc4=this;return new Promise(function(_0x52a0f7,_0x14cfe8){return db['SmsQueueReport'][_0x1a3f('0x19')](_0x586f32[_0x1a3f('0x1a')],{'raw':_0x586f32[_0x1a3f('0x1b')]?_0x586f32[_0x1a3f('0x1b')][_0x1a3f('0x1c')]===undefined?!![]:![]:!![]})[_0x1a3f('0xd')](function(_0x30336d){logger[_0x1a3f('0xe')](_0x1a3f('0x18'),_0x586f32);logger[_0x1a3f('0x11')](_0x1a3f('0x18'),_0x586f32,JSON['stringify'](_0x30336d));_0x52a0f7(_0x30336d);})['catch'](function(_0x2bd66a){logger[_0x1a3f('0x13')]('CreateSmsQueueReport',_0x2bd66a['message'],_0x586f32);_0x14cfe8(_0x3d0fc4[_0x1a3f('0x13')](0x1f4,_0x2bd66a['message']));});});};exports[_0x1a3f('0x1d')]=function(_0x478be4){var _0x1ec985=this;return new Promise(function(_0xd375c4,_0x531f4e){return db[_0x1a3f('0x1e')][_0x1a3f('0x1f')](_0x478be4[_0x1a3f('0x1a')],{'raw':_0x478be4[_0x1a3f('0x1b')]?_0x478be4[_0x1a3f('0x1b')][_0x1a3f('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x478be4[_0x1a3f('0x1b')]?_0x478be4[_0x1a3f('0x1b')][_0x1a3f('0x20')]||null:null,'attributes':_0x478be4[_0x1a3f('0x1b')]?_0x478be4[_0x1a3f('0x1b')][_0x1a3f('0x21')]||null:null,'limit':_0x478be4[_0x1a3f('0x1b')]?_0x478be4[_0x1a3f('0x1b')]['limit']||null:null})[_0x1a3f('0xd')](function(_0x1f5a59){logger[_0x1a3f('0xe')](_0x1a3f('0x1d'),_0x478be4);logger[_0x1a3f('0x11')](_0x1a3f('0x1d'),_0x478be4,JSON['stringify'](_0x1f5a59));_0xd375c4(_0x1f5a59);})[_0x1a3f('0x17')](function(_0x1df4b9){logger[_0x1a3f('0x13')](_0x1a3f('0x1d'),_0x1df4b9['message'],_0x478be4);_0x531f4e(_0x1ec985[_0x1a3f('0x13')](0x1f4,_0x1df4b9[_0x1a3f('0x15')]));});});}; \ No newline at end of file +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 diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 98c4813..bbf9f55 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 _0xdd4f=['isAuthenticated','index','get','/describe','show','post','create','/:id','update','delete','destroy','exports','multer','express','Router','../../components/interaction/service','../../config/environment','./smsTransferReport.controller'];(function(_0x40b189,_0x50f8cc){var _0x17886c=function(_0x6ac7a4){while(--_0x6ac7a4){_0x40b189['push'](_0x40b189['shift']());}};_0x17886c(++_0x50f8cc);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x4ea2f1,_0x552f47){_0x4ea2f1=_0x4ea2f1-0x0;var _0x316eff=_0xdd4f[_0x4ea2f1];return _0x316eff;};'use strict';var multer=require(_0xfdd4('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfdd4('0x1'));var router=express[_0xfdd4('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xfdd4('0x3'));var config=require(_0xfdd4('0x4'));var controller=require(_0xfdd4('0x5'));router['get']('/',auth[_0xfdd4('0x6')](),controller[_0xfdd4('0x7')]);router[_0xfdd4('0x8')](_0xfdd4('0x9'),auth[_0xfdd4('0x6')](),controller['describe']);router[_0xfdd4('0x8')]('/:id',auth[_0xfdd4('0x6')](),controller[_0xfdd4('0xa')]);router[_0xfdd4('0xb')]('/',auth['isAuthenticated'](),controller[_0xfdd4('0xc')]);router['put'](_0xfdd4('0xd'),auth[_0xfdd4('0x6')](),controller[_0xfdd4('0xe')]);router[_0xfdd4('0xf')](_0xfdd4('0xd'),auth[_0xfdd4('0x6')](),controller[_0xfdd4('0x10')]);module[_0xfdd4('0x11')]=router; \ No newline at end of file +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 diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 13e4789..b9bd013 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 _0xa337=['ENUM','account','queue','DATE','NOW','sequelize'];(function(_0x125f94,_0x193aa5){var _0x1beb66=function(_0x286d2d){while(--_0x286d2d){_0x125f94['push'](_0x125f94['shift']());}};_0x1beb66(++_0x193aa5);}(_0xa337,0x1bb));var _0x7a33=function(_0x269484,_0x578a1a){_0x269484=_0x269484-0x0;var _0x5d0278=_0xa337[_0x269484];return _0x5d0278;};'use strict';var moment=require('moment');var Sequelize=require(_0x7a33('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x7a33('0x1')](_0x7a33('0x2'),'agent',_0x7a33('0x3')),'allowNull':![],'defaultValue':_0x7a33('0x3')},'transferredAt':{'type':Sequelize[_0x7a33('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x7a33('0x5')]}}; \ No newline at end of file +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 diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 39978ec..75c467b 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 _0x3b62=['VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','error','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','length','attributes','hasOwnProperty','sort','where','filters','pick','filter'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x3b62,0x9a));var _0x23b6=function(_0x5b013d,_0xc7691c){_0x5b013d=_0x5b013d-0x0;var _0x2b6eef=_0x3b62[_0x5b013d];return _0x2b6eef;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x23b6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x23b6('0x1'));var rp=require(_0x23b6('0x2'));var moment=require(_0x23b6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x23b6('0x4'));var util=require('util');var path=require(_0x23b6('0x5'));var sox=require(_0x23b6('0x6'));var csv=require('to-csv');var ejs=require(_0x23b6('0x7'));var fs=require('fs');var _=require(_0x23b6('0x8'));var squel=require(_0x23b6('0x9'));var crypto=require(_0x23b6('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x23b6('0xb'));var querystring=require(_0x23b6('0xc'));var Papa=require('papaparse');var Redis=require(_0x23b6('0xd'));var authService=require(_0x23b6('0xe'));var qs=require(_0x23b6('0xf'));var as=require(_0x23b6('0x10'));var hardwareService=require(_0x23b6('0x11'));var logger=require(_0x23b6('0x12'))(_0x23b6('0x13'));var utils=require('../../config/utils');var config=require(_0x23b6('0x14'));var db=require(_0x23b6('0x15'))['db'];function respondWithStatusCode(_0x54491c,_0xe18c67){_0xe18c67=_0xe18c67||0xcc;return function(_0x4a4037){if(_0x4a4037){return _0x54491c[_0x23b6('0x16')](_0xe18c67);}return _0x54491c['status'](_0xe18c67)[_0x23b6('0x17')]();};}function respondWithResult(_0x162a7a,_0x3728b4){_0x3728b4=_0x3728b4||0xc8;return function(_0x4d476f){if(_0x4d476f){return _0x162a7a[_0x23b6('0x18')](_0x3728b4)['json'](_0x4d476f);}};}function respondWithFilteredResult(_0x318466,_0x5958bb){return function(_0x2d961a){if(_0x2d961a){var _0x48baf5=_0x2d961a[_0x23b6('0x19')],_0x1772ec=_0x5958bb[_0x23b6('0x1a')],_0x5f8d3c=_0x5958bb[_0x23b6('0x1a')]+_0x5958bb[_0x23b6('0x1b')],_0x45cfd8;if(_0x5f8d3c>=_0x48baf5){_0x5f8d3c=_0x48baf5;_0x45cfd8=0xc8;}else{_0x45cfd8=0xce;}_0x318466[_0x23b6('0x18')](_0x45cfd8);return _0x318466[_0x23b6('0x1c')](_0x23b6('0x1d'),_0x1772ec+'-'+_0x5f8d3c+'/'+_0x48baf5)[_0x23b6('0x1e')](_0x2d961a);}return null;};}function patchUpdates(_0x12d1dc){return function(_0x257554){try{jsonpatch['apply'](_0x257554,_0x12d1dc,!![]);}catch(_0x4eb96c){return BPromise[_0x23b6('0x1f')](_0x4eb96c);}return _0x257554[_0x23b6('0x20')]();};}function saveUpdates(_0xd3283a,_0x3261b5){return function(_0x16a26c){if(_0x16a26c){return _0x16a26c[_0x23b6('0x21')](_0xd3283a)[_0x23b6('0x22')](function(_0x293699){return _0x293699;});}return null;};}function removeEntity(_0x4246dd,_0x58d28c){return function(_0x38cbac){if(_0x38cbac){return _0x38cbac[_0x23b6('0x23')]()[_0x23b6('0x22')](function(){_0x4246dd[_0x23b6('0x18')](0xcc)[_0x23b6('0x17')]();});}};}function handleEntityNotFound(_0x198721,_0x1aeab4){return function(_0x58c530){if(!_0x58c530){_0x198721['sendStatus'](0x194);}return _0x58c530;};}function handleError(_0xbea173,_0x19c640){_0x19c640=_0x19c640||0x1f4;return function(_0x222054){logger[_0x23b6('0x24')](_0x222054['stack']);if(_0x222054[_0x23b6('0x25')]){delete _0x222054[_0x23b6('0x25')];}_0xbea173[_0x23b6('0x18')](_0x19c640)[_0x23b6('0x26')](_0x222054);};}exports[_0x23b6('0x27')]=function(_0x3a04cf,_0x3ea944){var _0x26951a={},_0x488b87={},_0x3cf3c4={'count':0x0,'rows':[]};var _0x1028cf=_[_0x23b6('0x28')](db[_0x23b6('0x29')][_0x23b6('0x2a')],function(_0xcdca3a){return{'name':_0xcdca3a[_0x23b6('0x2b')],'type':_0xcdca3a[_0x23b6('0x2c')][_0x23b6('0x2d')]};});_0x488b87[_0x23b6('0x2e')]=_[_0x23b6('0x28')](_0x1028cf,'name');_0x488b87['query']=_[_0x23b6('0x2f')](_0x3a04cf[_0x23b6('0x30')]);_0x488b87['filters']=_['intersection'](_0x488b87[_0x23b6('0x2e')],_0x488b87[_0x23b6('0x30')]);_0x26951a['attributes']=_[_0x23b6('0x31')](_0x488b87[_0x23b6('0x2e')],qs[_0x23b6('0x32')](_0x3a04cf[_0x23b6('0x30')][_0x23b6('0x32')]));_0x26951a['attributes']=_0x26951a['attributes'][_0x23b6('0x33')]?_0x26951a[_0x23b6('0x34')]:_0x488b87[_0x23b6('0x2e')];if(!_0x3a04cf['query'][_0x23b6('0x35')]('nolimit')){_0x26951a[_0x23b6('0x1b')]=qs[_0x23b6('0x1b')](_0x3a04cf[_0x23b6('0x30')]['limit']);_0x26951a[_0x23b6('0x1a')]=qs['offset'](_0x3a04cf[_0x23b6('0x30')][_0x23b6('0x1a')]);}_0x26951a['order']=qs['sort'](_0x3a04cf[_0x23b6('0x30')][_0x23b6('0x36')]);_0x26951a[_0x23b6('0x37')]=qs[_0x23b6('0x38')](_[_0x23b6('0x39')](_0x3a04cf[_0x23b6('0x30')],_0x488b87[_0x23b6('0x38')]));if(_0x3a04cf[_0x23b6('0x30')][_0x23b6('0x3a')]){_0x26951a[_0x23b6('0x37')]=_['merge'](_0x26951a[_0x23b6('0x37')],{'$or':_[_0x23b6('0x28')](_0x1028cf,function(_0x5f2504){if(_0x5f2504[_0x23b6('0x2c')]!==_0x23b6('0x3b')){var _0x38aca8={};_0x38aca8[_0x5f2504['name']]={'$like':'%'+_0x3a04cf[_0x23b6('0x30')][_0x23b6('0x3a')]+'%'};return _0x38aca8;}})});}_0x26951a=_['merge']({},_0x26951a,_0x3a04cf[_0x23b6('0x3c')]);var _0x321f41={'where':_0x26951a[_0x23b6('0x37')]};return db[_0x23b6('0x29')][_0x23b6('0x19')](_0x321f41)[_0x23b6('0x22')](function(_0x36ff95){_0x3cf3c4[_0x23b6('0x19')]=_0x36ff95;if(_0x3a04cf[_0x23b6('0x30')][_0x23b6('0x3d')]){_0x26951a[_0x23b6('0x3e')]=[{'all':!![]}];}return db[_0x23b6('0x29')][_0x23b6('0x3f')](_0x26951a);})['then'](function(_0x59deef){_0x3cf3c4['rows']=_0x59deef;return _0x3cf3c4;})[_0x23b6('0x22')](respondWithFilteredResult(_0x3ea944,_0x26951a))[_0x23b6('0x40')](handleError(_0x3ea944,null));};exports[_0x23b6('0x41')]=function(_0x9619a0,_0x435804){var _0x428d2a={'raw':!![],'where':{'id':_0x9619a0[_0x23b6('0x42')]['id']}},_0x42c222={};_0x42c222[_0x23b6('0x2e')]=_[_0x23b6('0x2f')](db[_0x23b6('0x29')]['rawAttributes']);_0x42c222[_0x23b6('0x30')]=_[_0x23b6('0x2f')](_0x9619a0[_0x23b6('0x30')]);_0x42c222[_0x23b6('0x38')]=_['intersection'](_0x42c222[_0x23b6('0x2e')],_0x42c222[_0x23b6('0x30')]);_0x428d2a[_0x23b6('0x34')]=_['intersection'](_0x42c222['model'],qs[_0x23b6('0x32')](_0x9619a0[_0x23b6('0x30')][_0x23b6('0x32')]));_0x428d2a['attributes']=_0x428d2a[_0x23b6('0x34')][_0x23b6('0x33')]?_0x428d2a[_0x23b6('0x34')]:_0x42c222['model'];if(_0x9619a0[_0x23b6('0x30')]['includeAll']){_0x428d2a[_0x23b6('0x3e')]=[{'all':!![]}];}_0x428d2a=_['merge']({},_0x428d2a,_0x9619a0[_0x23b6('0x3c')]);return db['SmsTransferReport'][_0x23b6('0x43')](_0x428d2a)[_0x23b6('0x22')](handleEntityNotFound(_0x435804,null))['then'](respondWithResult(_0x435804,null))['catch'](handleError(_0x435804,null));};exports[_0x23b6('0x44')]=function(_0xa485f5,_0x51a050){return db['SmsTransferReport']['create'](_0xa485f5['body'],{})[_0x23b6('0x22')](respondWithResult(_0x51a050,0xc9))[_0x23b6('0x40')](handleError(_0x51a050,null));};exports['update']=function(_0x3d800c,_0x468b95){if(_0x3d800c['body']['id']){delete _0x3d800c[_0x23b6('0x45')]['id'];}return db[_0x23b6('0x29')]['find']({'where':{'id':_0x3d800c[_0x23b6('0x42')]['id']}})[_0x23b6('0x22')](handleEntityNotFound(_0x468b95,null))[_0x23b6('0x22')](saveUpdates(_0x3d800c[_0x23b6('0x45')],null))[_0x23b6('0x22')](respondWithResult(_0x468b95,null))[_0x23b6('0x40')](handleError(_0x468b95,null));};exports[_0x23b6('0x23')]=function(_0x5a37f3,_0x417157){return db['SmsTransferReport'][_0x23b6('0x43')]({'where':{'id':_0x5a37f3['params']['id']}})[_0x23b6('0x22')](handleEntityNotFound(_0x417157,null))[_0x23b6('0x22')](removeEntity(_0x417157,null))[_0x23b6('0x40')](handleError(_0x417157,null));};exports[_0x23b6('0x46')]=function(_0x293966,_0x3b624b){return db[_0x23b6('0x29')][_0x23b6('0x46')]()[_0x23b6('0x22')](respondWithResult(_0x3b624b,null))[_0x23b6('0x40')](handleError(_0x3b624b,null));}; \ No newline at end of file +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 diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 64d8948..e913998 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 _0xcaf2=['./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0xee6a24,_0x51c1fd){var _0x31e566=function(_0x351076){while(--_0x351076){_0xee6a24['push'](_0xee6a24['shift']());}};_0x31e566(++_0x51c1fd);}(_0xcaf2,0x8a));var _0x2caf=function(_0xf8053,_0x4b5401){_0xf8053=_0xf8053-0x0;var _0x2fe82f=_0xcaf2[_0xf8053];return _0x2fe82f;};'use strict';var _=require(_0x2caf('0x0'));var util=require('util');var logger=require(_0x2caf('0x1'))(_0x2caf('0x2'));var moment=require('moment');var BPromise=require(_0x2caf('0x3'));var rp=require(_0x2caf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2caf('0x5'));var config=require('../../config/environment');var attributes=require(_0x2caf('0x6'));module[_0x2caf('0x7')]=function(_0x249a4b,_0x599ce7){return _0x249a4b[_0x2caf('0x8')](_0x2caf('0x9'),attributes,{'tableName':_0x2caf('0xa'),'paranoid':![],'indexes':[{'name':_0x2caf('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index ed3ceea..27defdd 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 _0xc23e=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util'];(function(_0x2f71f6,_0x3a1f4d){var _0x2b23ea=function(_0x285980){while(--_0x285980){_0x2f71f6['push'](_0x2f71f6['shift']());}};_0x2b23ea(++_0x3a1f4d);}(_0xc23e,0x1ae));var _0xec23=function(_0x501b5b,_0x58cd62){_0x501b5b=_0x501b5b-0x0;var _0x29861a=_0xc23e[_0x501b5b];return _0x29861a;};'use strict';var _=require(_0xec23('0x0'));var util=require(_0xec23('0x1'));var moment=require(_0xec23('0x2'));var BPromise=require(_0xec23('0x3'));var rs=require(_0xec23('0x4'));var fs=require('fs');var Redis=require(_0xec23('0x5'));var db=require(_0xec23('0x6'))['db'];var utils=require(_0xec23('0x7'));var logger=require(_0xec23('0x8'))(_0xec23('0x9'));var config=require(_0xec23('0xa'));var jayson=require(_0xec23('0xb'));var client=jayson[_0xec23('0xc')][_0xec23('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x55240e,_0x54e569,_0x3c2261){return new BPromise(function(_0xc5f0dd,_0x4151d3){return client[_0xec23('0xe')](_0x55240e,_0x3c2261)[_0xec23('0xf')](function(_0x265370){logger['info'](_0xec23('0x10'),_0x54e569,_0xec23('0x11'));logger[_0xec23('0x12')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x54e569,_0xec23('0x11'),JSON[_0xec23('0x13')](_0x265370));if(_0x265370[_0xec23('0x14')]){if(_0x265370[_0xec23('0x14')][_0xec23('0x15')]===0x1f4){logger[_0xec23('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x54e569,_0x265370[_0xec23('0x14')][_0xec23('0x16')]);return _0x4151d3(_0x265370[_0xec23('0x14')]['message']);}logger[_0xec23('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x54e569,_0x265370[_0xec23('0x14')][_0xec23('0x16')]);return _0xc5f0dd(_0x265370[_0xec23('0x14')]['message']);}else{logger['info'](_0xec23('0x10'),_0x54e569,_0xec23('0x11'));_0xc5f0dd(_0x265370[_0xec23('0x17')][_0xec23('0x16')]);}})['catch'](function(_0x5605d2){logger['error'](_0xec23('0x10'),_0x54e569,_0x5605d2);_0x4151d3(_0x5605d2);});});} \ No newline at end of file +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 diff --git a/server/api/sound/index.js b/server/api/sound/index.js index b264e20..053582c 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 _0x8277=['put','update','delete','exports','multer','util','connect-timeout','Router','./sound.controller','isAuthenticated','index','get','/:id','show','download','diskStorage','join','server/files/sounds/original/','replace','format','%s-%s%s','basename','originalname','extname','now','post','single','create'];(function(_0x1b70f7,_0xd1d2c8){var _0x18f09f=function(_0x2c4eac){while(--_0x2c4eac){_0x1b70f7['push'](_0x1b70f7['shift']());}};_0x18f09f(++_0xd1d2c8);}(_0x8277,0xc8));var _0x7827=function(_0x58ee19,_0xdf0765){_0x58ee19=_0x58ee19-0x0;var _0x49af25=_0x8277[_0x58ee19];return _0x49af25;};'use strict';var multer=require(_0x7827('0x0'));var util=require(_0x7827('0x1'));var path=require('path');var timeout=require(_0x7827('0x2'));var express=require('express');var router=express[_0x7827('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7827('0x4'));router['get']('/',auth[_0x7827('0x5')](),controller[_0x7827('0x6')]);router[_0x7827('0x7')](_0x7827('0x8'),auth[_0x7827('0x5')](),controller[_0x7827('0x9')]);router[_0x7827('0x7')]('/:id/download',auth[_0x7827('0x5')](),controller[_0x7827('0xa')]);var upload=multer({'storage':multer[_0x7827('0xb')]({'destination':function(_0x4f8bb3,_0x4e2b18,_0x5c78f1){_0x5c78f1(null,path[_0x7827('0xc')](config['root'],_0x7827('0xd')));},'filename':function(_0xb500bc,_0xf14e68,_0x17cda6){_0xf14e68['originalname']=_0xf14e68['originalname'][_0x7827('0xe')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x17cda6(null,util[_0x7827('0xf')](_0x7827('0x10'),path[_0x7827('0x11')](_0xf14e68[_0x7827('0x12')],path[_0x7827('0x13')](_0xf14e68['originalname'])),Date[_0x7827('0x14')](),path['extname'](_0xf14e68[_0x7827('0x12')])));}})});router[_0x7827('0x15')]('/',upload[_0x7827('0x16')]('file'),controller[_0x7827('0x17')]);router[_0x7827('0x18')](_0x7827('0x8'),auth[_0x7827('0x5')](),controller[_0x7827('0x19')]);router[_0x7827('0x1a')](_0x7827('0x8'),auth[_0x7827('0x5')](),controller['delete']);module[_0x7827('0x1b')]=router; \ No newline at end of file +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 diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index f742cec..f676b4f 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 _0x9d13=['sequelize','exports','STRING','name','BIGINT','FLOAT'];(function(_0x250514,_0x389eda){var _0x59c25b=function(_0x3ad38b){while(--_0x3ad38b){_0x250514['push'](_0x250514['shift']());}};_0x59c25b(++_0x389eda);}(_0x9d13,0x144));var _0x39d1=function(_0x57c10a,_0x141369){_0x57c10a=_0x57c10a-0x0;var _0x41e2d1=_0x9d13[_0x57c10a];return _0x41e2d1;};'use strict';var Sequelize=require(_0x39d1('0x0'));module[_0x39d1('0x1')]={'name':{'type':Sequelize[_0x39d1('0x2')],'unique':_0x39d1('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x39d1('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x39d1('0x2')]},'original_format':{'type':Sequelize[_0x39d1('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x39d1('0x4')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x39d1('0x4')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x39d1('0x2')]},'converted_duration':{'type':Sequelize[_0x39d1('0x5')]},'converted_sampleCount':{'type':Sequelize[_0x39d1('0x4')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +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 diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index e0a883c..c4dcde9 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 _0x9ce4=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','description','delete','server/files/sounds/original','original_format','html-pdf','rimraf','zip-dir','request-promise','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','limit','set','save','then','destroy','get','Sounds','UserProfileResource','end','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','type','VIRTUAL','options','Sound','count','includeAll','findAll','rows','show','params','include','find','catch','download','existsSync','join','root','server/files/sounds/converted','save_name','converted_format','ValidationError','Sound\x20not\x20found','%s.%s','format','file','originalname','extname','basename','filename','substring','wav','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','unlinkSync','send','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_sampleCount','converted_channelCount','create','role','body','user','UserProfileSection'];(function(_0x2347e7,_0x3e0f5c){var _0x11648a=function(_0x25eecb){while(--_0x25eecb){_0x2347e7['push'](_0x2347e7['shift']());}};_0x11648a(++_0x3e0f5c);}(_0x9ce4,0xff));var _0x49ce=function(_0x5a8269,_0xfb2f54){_0x5a8269=_0x5a8269-0x0;var _0x539ed7=_0x9ce4[_0x5a8269];return _0x539ed7;};'use strict';var pdf=require(_0x49ce('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x49ce('0x1'));var zipdir=require(_0x49ce('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x49ce('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x49ce('0x4'));var util=require(_0x49ce('0x5'));var path=require(_0x49ce('0x6'));var sox=require('sox');var csv=require(_0x49ce('0x7'));var ejs=require(_0x49ce('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x49ce('0x9'));var crypto=require(_0x49ce('0xa'));var jsforce=require(_0x49ce('0xb'));var deskjs=require(_0x49ce('0xc'));var toCsv=require(_0x49ce('0x7'));var querystring=require(_0x49ce('0xd'));var Papa=require(_0x49ce('0xe'));var Redis=require(_0x49ce('0xf'));var authService=require(_0x49ce('0x10'));var qs=require(_0x49ce('0x11'));var as=require(_0x49ce('0x12'));var hardwareService=require(_0x49ce('0x13'));var logger=require(_0x49ce('0x14'))(_0x49ce('0x15'));var utils=require(_0x49ce('0x16'));var config=require('../../config/environment');var db=require(_0x49ce('0x17'))['db'];function respondWithStatusCode(_0x458daf,_0x2a73b1){_0x2a73b1=_0x2a73b1||0xcc;return function(_0x46423c){if(_0x46423c){return _0x458daf['sendStatus'](_0x2a73b1);}return _0x458daf[_0x49ce('0x18')](_0x2a73b1)['end']();};}function respondWithResult(_0x3c84cc,_0x19fdaa){_0x19fdaa=_0x19fdaa||0xc8;return function(_0x324436){if(_0x324436){return _0x3c84cc[_0x49ce('0x18')](_0x19fdaa)[_0x49ce('0x19')](_0x324436);}};}function respondWithFilteredResult(_0x2e15b0,_0x556853){return function(_0x349a31){if(_0x349a31){var _0x2bbbe9=_0x349a31['count'],_0x1a4e1a=_0x556853[_0x49ce('0x1a')],_0x5b2a4d=_0x556853[_0x49ce('0x1a')]+_0x556853[_0x49ce('0x1b')],_0x3fdf0d;if(_0x5b2a4d>=_0x2bbbe9){_0x5b2a4d=_0x2bbbe9;_0x3fdf0d=0xc8;}else{_0x3fdf0d=0xce;}_0x2e15b0[_0x49ce('0x18')](_0x3fdf0d);return _0x2e15b0[_0x49ce('0x1c')]('Content-Range',_0x1a4e1a+'-'+_0x5b2a4d+'/'+_0x2bbbe9)[_0x49ce('0x19')](_0x349a31);}return null;};}function patchUpdates(_0xf646d9){return function(_0x1d89ee){try{jsonpatch['apply'](_0x1d89ee,_0xf646d9,!![]);}catch(_0x3902d4){return BPromise['reject'](_0x3902d4);}return _0x1d89ee[_0x49ce('0x1d')]();};}function saveUpdates(_0x4b69e2,_0x4fdf88){return function(_0x546538){if(_0x546538){return _0x546538['update'](_0x4b69e2)[_0x49ce('0x1e')](function(_0x308d38){return _0x308d38;});}return null;};}function removeEntity(_0x4280d8,_0x16a0cf){return function(_0x250eec){if(_0x250eec){return _0x250eec[_0x49ce('0x1f')]()[_0x49ce('0x1e')](function(){var _0x3777ad=_0x250eec[_0x49ce('0x20')]({'plain':!![]});var _0x454758=_0x49ce('0x21');return db[_0x49ce('0x22')][_0x49ce('0x1f')]({'where':{'type':_0x454758,'resourceId':_0x3777ad['id']}})[_0x49ce('0x1e')](function(){return _0x250eec;});})[_0x49ce('0x1e')](function(){_0x4280d8[_0x49ce('0x18')](0xcc)[_0x49ce('0x23')]();});}};}function handleEntityNotFound(_0x374f56,_0x3fe8c5){return function(_0x2ce4c7){if(!_0x2ce4c7){_0x374f56[_0x49ce('0x24')](0x194);}return _0x2ce4c7;};}function handleError(_0x4941c5,_0x3aece3){_0x3aece3=_0x3aece3||0x1f4;return function(_0x465d85){logger[_0x49ce('0x25')](_0x465d85[_0x49ce('0x26')]);if(_0x465d85[_0x49ce('0x27')]){delete _0x465d85[_0x49ce('0x27')];}_0x4941c5[_0x49ce('0x18')](_0x3aece3)['send'](_0x465d85);};}exports[_0x49ce('0x28')]=function(_0x5b007f,_0x2e7052){var _0xcf6e6={},_0x4a31ea={},_0x838d3b={'count':0x0,'rows':[]};var _0x586da7=_[_0x49ce('0x29')](db['Sound'][_0x49ce('0x2a')],function(_0x2c69b7){return{'name':_0x2c69b7[_0x49ce('0x2b')],'type':_0x2c69b7['type'][_0x49ce('0x2c')]};});_0x4a31ea[_0x49ce('0x2d')]=_[_0x49ce('0x29')](_0x586da7,_0x49ce('0x27'));_0x4a31ea[_0x49ce('0x2e')]=_[_0x49ce('0x2f')](_0x5b007f[_0x49ce('0x2e')]);_0x4a31ea[_0x49ce('0x30')]=_[_0x49ce('0x31')](_0x4a31ea['model'],_0x4a31ea['query']);_0xcf6e6[_0x49ce('0x32')]=_[_0x49ce('0x31')](_0x4a31ea['model'],qs['fields'](_0x5b007f[_0x49ce('0x2e')][_0x49ce('0x33')]));_0xcf6e6[_0x49ce('0x32')]=_0xcf6e6['attributes'][_0x49ce('0x34')]?_0xcf6e6['attributes']:_0x4a31ea[_0x49ce('0x2d')];if(!_0x5b007f[_0x49ce('0x2e')][_0x49ce('0x35')](_0x49ce('0x36'))){_0xcf6e6[_0x49ce('0x1b')]=qs[_0x49ce('0x1b')](_0x5b007f[_0x49ce('0x2e')][_0x49ce('0x1b')]);_0xcf6e6['offset']=qs['offset'](_0x5b007f['query'][_0x49ce('0x1a')]);}_0xcf6e6['order']=qs['sort'](_0x5b007f[_0x49ce('0x2e')]['sort']);_0xcf6e6[_0x49ce('0x37')]=qs[_0x49ce('0x30')](_[_0x49ce('0x38')](_0x5b007f[_0x49ce('0x2e')],_0x4a31ea[_0x49ce('0x30')]));if(_0x5b007f[_0x49ce('0x2e')][_0x49ce('0x39')]){_0xcf6e6[_0x49ce('0x37')]=_[_0x49ce('0x3a')](_0xcf6e6[_0x49ce('0x37')],{'$or':_[_0x49ce('0x29')](_0x586da7,function(_0x5251f){if(_0x5251f[_0x49ce('0x3b')]!==_0x49ce('0x3c')){var _0x16a124={};_0x16a124[_0x5251f['name']]={'$like':'%'+_0x5b007f[_0x49ce('0x2e')][_0x49ce('0x39')]+'%'};return _0x16a124;}})});}_0xcf6e6=_[_0x49ce('0x3a')]({},_0xcf6e6,_0x5b007f[_0x49ce('0x3d')]);var _0xfa583b={'where':_0xcf6e6['where']};return db[_0x49ce('0x3e')][_0x49ce('0x3f')](_0xfa583b)[_0x49ce('0x1e')](function(_0x200f01){_0x838d3b[_0x49ce('0x3f')]=_0x200f01;if(_0x5b007f['query'][_0x49ce('0x40')]){_0xcf6e6['include']=[{'all':!![]}];}return db['Sound'][_0x49ce('0x41')](_0xcf6e6);})[_0x49ce('0x1e')](function(_0x20efb0){_0x838d3b[_0x49ce('0x42')]=_0x20efb0;return _0x838d3b;})[_0x49ce('0x1e')](respondWithFilteredResult(_0x2e7052,_0xcf6e6))['catch'](handleError(_0x2e7052,null));};exports[_0x49ce('0x43')]=function(_0x26ec83,_0x357fe2){var _0x12ccab={'raw':!![],'where':{'id':_0x26ec83[_0x49ce('0x44')]['id']}},_0x24927c={};_0x24927c['model']=_[_0x49ce('0x2f')](db[_0x49ce('0x3e')][_0x49ce('0x2a')]);_0x24927c['query']=_['keys'](_0x26ec83['query']);_0x24927c[_0x49ce('0x30')]=_[_0x49ce('0x31')](_0x24927c[_0x49ce('0x2d')],_0x24927c['query']);_0x12ccab[_0x49ce('0x32')]=_[_0x49ce('0x31')](_0x24927c['model'],qs[_0x49ce('0x33')](_0x26ec83[_0x49ce('0x2e')]['fields']));_0x12ccab['attributes']=_0x12ccab['attributes'][_0x49ce('0x34')]?_0x12ccab[_0x49ce('0x32')]:_0x24927c['model'];if(_0x26ec83[_0x49ce('0x2e')]['includeAll']){_0x12ccab[_0x49ce('0x45')]=[{'all':!![]}];}_0x12ccab=_[_0x49ce('0x3a')]({},_0x12ccab,_0x26ec83[_0x49ce('0x3d')]);return db['Sound'][_0x49ce('0x46')](_0x12ccab)[_0x49ce('0x1e')](handleEntityNotFound(_0x357fe2,null))[_0x49ce('0x1e')](respondWithResult(_0x357fe2,null))[_0x49ce('0x47')](handleError(_0x357fe2,null));};exports[_0x49ce('0x48')]=function(_0x592c4e,_0x5b782a,_0x55cbda){return db['Sound'][_0x49ce('0x46')]({'where':{'id':_0x592c4e[_0x49ce('0x44')]['id']},'attributes':['name','save_name','converted_format'],'raw':!![]})[_0x49ce('0x1e')](handleEntityNotFound(_0x5b782a,null))[_0x49ce('0x1e')](function(_0x1682f6){if(_0x1682f6){if(!fs[_0x49ce('0x49')](path[_0x49ce('0x4a')](config[_0x49ce('0x4b')],_0x49ce('0x4c'),_0x1682f6[_0x49ce('0x4d')]+'.'+_0x1682f6[_0x49ce('0x4e')]))){throw new db['Sequelize'][(_0x49ce('0x4f'))](_0x49ce('0x50'));}return _0x5b782a[_0x49ce('0x48')](path[_0x49ce('0x4a')](config[_0x49ce('0x4b')],_0x49ce('0x4c'),util['format'](_0x49ce('0x51'),_0x1682f6[_0x49ce('0x4d')],_0x1682f6['converted_format'])),util[_0x49ce('0x52')](_0x49ce('0x51'),_0x1682f6[_0x49ce('0x27')],_0x1682f6[_0x49ce('0x4e')]));}return null;})[_0x49ce('0x47')](handleError(_0x5b782a,null));};exports['create']=function(_0x4009d2,_0x594490,_0x2c0929){var _0x284e68={'name':path['basename'](_0x4009d2[_0x49ce('0x53')][_0x49ce('0x54')],path[_0x49ce('0x55')](_0x4009d2[_0x49ce('0x53')][_0x49ce('0x54')])),'save_name':path[_0x49ce('0x56')](_0x4009d2[_0x49ce('0x53')]['filename'],path[_0x49ce('0x55')](_0x4009d2[_0x49ce('0x53')][_0x49ce('0x57')])),'original_format':path[_0x49ce('0x55')](_0x4009d2[_0x49ce('0x53')]['originalname'])[_0x49ce('0x58')](0x1),'converted_format':_0x49ce('0x59')};var _0x25b834=path['join'](config[_0x49ce('0x4b')],'server/files/sounds/original',_0x4009d2[_0x49ce('0x53')]['filename']);var _0x20b91b=path['join'](config[_0x49ce('0x4b')],_0x49ce('0x4c'),util[_0x49ce('0x52')](_0x49ce('0x51'),path[_0x49ce('0x56')](_0x4009d2[_0x49ce('0x53')][_0x49ce('0x57')],path[_0x49ce('0x55')](_0x4009d2[_0x49ce('0x53')][_0x49ce('0x57')])),_0x284e68[_0x49ce('0x4e')]));logger[_0x49ce('0x5a')](_0x49ce('0x5b'),_0x25b834);logger[_0x49ce('0x5a')](_0x49ce('0x5c'),_0x20b91b);try{fs[_0x49ce('0x5d')](_0x25b834,parseInt(_0x49ce('0x5e'),0x8));var _0x4feb90=sox['transcode'](_0x25b834,_0x20b91b,{'sampleRate':0x1f40,'format':_0x49ce('0x59'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4feb90['on'](_0x49ce('0x25'),function(_0xcb7cec){fs[_0x49ce('0x5f')](_0x25b834);_0x594490['status'](0x1f4)[_0x49ce('0x60')](_0xcb7cec);});_0x4feb90['on'](_0x49ce('0x61'),function(_0x122d2b){_0x284e68['original_duration']=isNaN(_0x122d2b[_0x49ce('0x62')])?null:_0x122d2b[_0x49ce('0x62')]*0x3e8;_0x284e68[_0x49ce('0x63')]=isNaN(_0x122d2b[_0x49ce('0x64')])?null:_0x122d2b[_0x49ce('0x64')];_0x284e68[_0x49ce('0x65')]=isNaN(_0x122d2b[_0x49ce('0x66')])?null:_0x122d2b[_0x49ce('0x66')];_0x284e68[_0x49ce('0x67')]=isNaN(_0x122d2b[_0x49ce('0x68')])?null:_0x122d2b['bitRate'];_0x284e68['original_sampleRate']=isNaN(_0x122d2b[_0x49ce('0x69')])?null:_0x122d2b[_0x49ce('0x69')];});_0x4feb90['on'](_0x49ce('0x6a'),function(_0x32e8c5){_0x284e68['converted_duration']=isNaN(_0x32e8c5[_0x49ce('0x62')])?null:_0x32e8c5[_0x49ce('0x62')]*0x3e8;_0x284e68[_0x49ce('0x6b')]=isNaN(_0x32e8c5[_0x49ce('0x64')])?null:_0x32e8c5[_0x49ce('0x64')];_0x284e68[_0x49ce('0x6c')]=isNaN(_0x32e8c5['channelCount'])?null:_0x32e8c5['channelCount'];_0x284e68['converted_bitRate']=isNaN(_0x32e8c5[_0x49ce('0x68')])?null:_0x32e8c5[_0x49ce('0x68')];_0x284e68['converted_sampleRate']=isNaN(_0x32e8c5[_0x49ce('0x69')])?null:_0x32e8c5[_0x49ce('0x69')];});_0x4feb90['on']('end',function(){fs[_0x49ce('0x5d')](_0x20b91b,parseInt(_0x49ce('0x5e'),0x8));return db[_0x49ce('0x3e')][_0x49ce('0x6d')](_0x284e68)['then'](function(_0x54469d){var _0x50a9c6={'role':_0x4009d2['body'][_0x49ce('0x6e')],'userProfileId':_0x4009d2[_0x49ce('0x6f')]['userProfileId']};if(!_0x50a9c6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x50a9c6[_0x49ce('0x6e')]===_0x49ce('0x70')){var _0x2e24d7=_0x54469d['get']({'plain':!![]});return db[_0x49ce('0x71')][_0x49ce('0x46')]({'where':{'name':_0x49ce('0x21'),'userProfileId':_0x50a9c6[_0x49ce('0x72')]},'raw':!![]})['then'](function(_0x31e95d){if(_0x31e95d&&_0x31e95d[_0x49ce('0x73')]===0x0){return db[_0x49ce('0x22')][_0x49ce('0x6d')]({'name':_0x2e24d7['name'],'resourceId':_0x2e24d7['id'],'type':_0x31e95d[_0x49ce('0x27')],'sectionId':_0x31e95d['id']},{})['then'](function(){return _0x54469d;});}else{return _0x54469d;}})[_0x49ce('0x47')](function(_0x3611f8){logger[_0x49ce('0x25')](_0x49ce('0x74'),_0x3611f8);throw _0x3611f8;});}return _0x54469d;})[_0x49ce('0x1e')](respondWithResult(_0x594490,null))[_0x49ce('0x47')](handleError(_0x594490,null));});_0x4feb90[_0x49ce('0x75')]();}catch(_0x1bb6fc){_0x594490[_0x49ce('0x18')](0x1f4)[_0x49ce('0x60')](_0x1bb6fc);}};exports[_0x49ce('0x76')]=function(_0x1e3096,_0x3ebcf2,_0x1214af){return db[_0x49ce('0x3e')][_0x49ce('0x46')]({'where':{'id':_0x1e3096['params']['id']}})['then'](handleEntityNotFound(_0x3ebcf2,null))[_0x49ce('0x1e')](saveUpdates(_[_0x49ce('0x38')](_0x1e3096[_0x49ce('0x6f')],['name',_0x49ce('0x77')]),null))['then'](respondWithResult(_0x3ebcf2,null))['catch'](handleError(_0x3ebcf2,null));};exports[_0x49ce('0x78')]=function(_0xbe8729,_0x361130,_0x496c53){return db['Sound'][_0x49ce('0x46')]({'where':{'id':_0xbe8729[_0x49ce('0x44')]['id']}})[_0x49ce('0x1e')](function(_0x2a88d7){if(_0x2a88d7){return _0x2a88d7[_0x49ce('0x1f')]();}})[_0x49ce('0x1e')](function(_0x156366){var _0x592015=path[_0x49ce('0x4a')](config[_0x49ce('0x4b')],_0x49ce('0x79'),util[_0x49ce('0x52')](_0x49ce('0x51'),_0x156366['save_name'],_0x156366[_0x49ce('0x7a')]));var _0x5049f8=path[_0x49ce('0x4a')](config['root'],_0x49ce('0x4c'),util[_0x49ce('0x52')](_0x49ce('0x51'),_0x156366['save_name'],_0x156366[_0x49ce('0x4e')]));fs['unlinkSync'](_0x592015);fs['unlinkSync'](_0x5049f8);return _0x156366;})[_0x49ce('0x1e')](function(_0x209714){if(_0x209714){return _0x361130[_0x49ce('0x18')](0xcc)[_0x49ce('0x23')]();}})[_0x49ce('0x1e')](handleEntityNotFound(_0x361130,null))[_0x49ce('0x47')](handleError(_0x361130,null));}; \ No newline at end of file +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 diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 5c61dd9..c576114 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 _0xfa7f=['Sound','tools_sounds','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./sound.attributes','define'];(function(_0x4a9ab1,_0x259073){var _0x3dda4e=function(_0x196d54){while(--_0x196d54){_0x4a9ab1['push'](_0x4a9ab1['shift']());}};_0x3dda4e(++_0x259073);}(_0xfa7f,0xec));var _0xffa7=function(_0x3c2a33,_0x4a5217){_0x3c2a33=_0x3c2a33-0x0;var _0x52d8d7=_0xfa7f[_0x3c2a33];return _0x52d8d7;};'use strict';var _=require(_0xffa7('0x0'));var util=require(_0xffa7('0x1'));var logger=require(_0xffa7('0x2'))(_0xffa7('0x3'));var moment=require(_0xffa7('0x4'));var BPromise=require('bluebird');var rp=require(_0xffa7('0x5'));var fs=require('fs');var path=require(_0xffa7('0x6'));var rimraf=require(_0xffa7('0x7'));var config=require(_0xffa7('0x8'));var attributes=require(_0xffa7('0x9'));module['exports']=function(_0x3b7e86,_0xf5f866){return _0x3b7e86[_0xffa7('0xa')](_0xffa7('0xb'),attributes,{'tableName':_0xffa7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 59f85e4..a63883e 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 _0xd3ed=['jayson/promise','client','request','then','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','error','message','info','catch','Sound','options','raw','attributes','include','model','map','ShowSound','debug','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x566258,_0x4fef85){var _0x326bb7=function(_0xe3283d){while(--_0xe3283d){_0x566258['push'](_0x566258['shift']());}};_0x326bb7(++_0x4fef85);}(_0xd3ed,0xe0));var _0xdd3e=function(_0x4a9383,_0x1204e8){_0x4a9383=_0x4a9383-0x0;var _0x518106=_0xd3ed[_0x4a9383];return _0x518106;};'use strict';var _=require(_0xdd3e('0x0'));var util=require(_0xdd3e('0x1'));var moment=require(_0xdd3e('0x2'));var BPromise=require('bluebird');var rs=require(_0xdd3e('0x3'));var fs=require('fs');var Redis=require(_0xdd3e('0x4'));var db=require(_0xdd3e('0x5'))['db'];var utils=require(_0xdd3e('0x6'));var logger=require('../../config/logger')(_0xdd3e('0x7'));var config=require('../../config/environment');var jayson=require(_0xdd3e('0x8'));var client=jayson[_0xdd3e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b8a81,_0x36d0f1,_0x5ebe52){return new BPromise(function(_0x4cd53d,_0x41d265){return client[_0xdd3e('0xa')](_0x1b8a81,_0x5ebe52)[_0xdd3e('0xb')](function(_0x3be5c2){logger['info'](_0xdd3e('0xc'),_0x36d0f1,_0xdd3e('0xd'));logger['debug'](_0xdd3e('0xe'),_0x36d0f1,_0xdd3e('0xd'),JSON['stringify'](_0x3be5c2));if(_0x3be5c2[_0xdd3e('0xf')]){if(_0x3be5c2['error']['code']===0x1f4){logger[_0xdd3e('0xf')]('Sound,\x20%s,\x20%s',_0x36d0f1,_0x3be5c2[_0xdd3e('0xf')][_0xdd3e('0x10')]);return _0x41d265(_0x3be5c2[_0xdd3e('0xf')][_0xdd3e('0x10')]);}logger[_0xdd3e('0xf')](_0xdd3e('0xc'),_0x36d0f1,_0x3be5c2[_0xdd3e('0xf')]['message']);return _0x4cd53d(_0x3be5c2['error'][_0xdd3e('0x10')]);}else{logger[_0xdd3e('0x11')](_0xdd3e('0xc'),_0x36d0f1,'request\x20sent');_0x4cd53d(_0x3be5c2['result']['message']);}})[_0xdd3e('0x12')](function(_0x543786){logger[_0xdd3e('0xf')](_0xdd3e('0xc'),_0x36d0f1,_0x543786);_0x41d265(_0x543786);});});}exports['ShowSound']=function(_0x6513a8){var _0x239f31=this;return new Promise(function(_0x4a1a7a,_0x307339){return db[_0xdd3e('0x13')]['find']({'raw':_0x6513a8['options']?_0x6513a8[_0xdd3e('0x14')][_0xdd3e('0x15')]===undefined?!![]:![]:!![],'where':_0x6513a8[_0xdd3e('0x14')]?_0x6513a8[_0xdd3e('0x14')]['where']||null:null,'attributes':_0x6513a8[_0xdd3e('0x14')]?_0x6513a8[_0xdd3e('0x14')][_0xdd3e('0x16')]||null:null,'include':_0x6513a8[_0xdd3e('0x14')]?_0x6513a8[_0xdd3e('0x14')]['include']?_['map'](_0x6513a8[_0xdd3e('0x14')][_0xdd3e('0x17')],function(_0xf109d0){return{'model':db[_0xf109d0[_0xdd3e('0x18')]],'as':_0xf109d0['as'],'attributes':_0xf109d0['attributes'],'include':_0xf109d0['include']?_[_0xdd3e('0x19')](_0xf109d0[_0xdd3e('0x17')],function(_0x253a69){return{'model':db[_0x253a69[_0xdd3e('0x18')]],'as':_0x253a69['as'],'attributes':_0x253a69['attributes'],'include':_0x253a69[_0xdd3e('0x17')]?_[_0xdd3e('0x19')](_0x253a69[_0xdd3e('0x17')],function(_0x2d43fe){return{'model':db[_0x2d43fe[_0xdd3e('0x18')]],'as':_0x2d43fe['as'],'attributes':_0x2d43fe[_0xdd3e('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c73c7){logger[_0xdd3e('0x11')](_0xdd3e('0x1a'),_0x6513a8);logger[_0xdd3e('0x1b')](_0xdd3e('0x1a'),_0x6513a8,JSON[_0xdd3e('0x1c')](_0x1c73c7));_0x4a1a7a(_0x1c73c7);})[_0xdd3e('0x12')](function(_0x5e842a){logger[_0xdd3e('0xf')](_0xdd3e('0x1a'),_0x5e842a[_0xdd3e('0x10')],_0x6513a8);_0x307339(_0x239f31['error'](0x1f4,_0x5e842a[_0xdd3e('0x10')]));});});}; \ No newline at end of file +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 diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index d126b8f..76055a5 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 _0x0f7e=['../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','create','put','update','destroy','exports','util','path','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x21353c,_0x2ea587){var _0xa99120=function(_0x557f33){while(--_0x557f33){_0x21353c['push'](_0x21353c['shift']());}};_0xa99120(++_0x2ea587);}(_0x0f7e,0x12d));var _0xe0f7=function(_0x32aafa,_0x101239){_0x32aafa=_0x32aafa-0x0;var _0x16e542=_0x0f7e[_0x32aafa];return _0x16e542;};'use strict';var multer=require('multer');var util=require(_0xe0f7('0x0'));var path=require(_0xe0f7('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe0f7('0x2')]();var auth=require(_0xe0f7('0x3'));var interaction=require(_0xe0f7('0x4'));var config=require(_0xe0f7('0x5'));var controller=require(_0xe0f7('0x6'));router[_0xe0f7('0x7')]('/',auth[_0xe0f7('0x8')](),controller[_0xe0f7('0x9')]);router[_0xe0f7('0x7')](_0xe0f7('0xa'),auth[_0xe0f7('0x8')](),controller[_0xe0f7('0xb')]);router['post']('/',auth[_0xe0f7('0x8')](),controller[_0xe0f7('0xc')]);router[_0xe0f7('0xd')]('/:id',auth[_0xe0f7('0x8')](),controller[_0xe0f7('0xe')]);router['delete']('/:id',auth[_0xe0f7('0x8')](),controller[_0xe0f7('0xf')]);module[_0xe0f7('0x10')]=router; \ No newline at end of file +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 diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 7958032..a739863 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 _0xb11b=['ENUM','out','sequelize','exports','STRING','TEXT','medium'];(function(_0x3d9639,_0x413c44){var _0x5264a1=function(_0x55be0a){while(--_0x55be0a){_0x3d9639['push'](_0x3d9639['shift']());}};_0x5264a1(++_0x413c44);}(_0xb11b,0xd4));var _0xbb11=function(_0x178f52,_0x5d9675){_0x178f52=_0x178f52-0x0;var _0x556f99=_0xb11b[_0x178f52];return _0x556f99;};'use strict';var Sequelize=require(_0xbb11('0x0'));module[_0xbb11('0x1')]={'uniqueid':{'type':Sequelize[_0xbb11('0x2')]},'body':{'type':Sequelize[_0xbb11('0x3')](_0xbb11('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0xbb11('0x5')]('in',_0xbb11('0x6')),'defaultValue':_0xbb11('0x6'),'allowNull':![]}}; \ No newline at end of file +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 diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index a841b2e..2a0b145 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 _0x29c1=['stack','name','send','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','create','body','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error'];(function(_0x22f3d5,_0x3f785b){var _0x14f9e9=function(_0x101625){while(--_0x101625){_0x22f3d5['push'](_0x22f3d5['shift']());}};_0x14f9e9(++_0x3f785b);}(_0x29c1,0x72));var _0x129c=function(_0x398ab6,_0x3213a1){_0x398ab6=_0x398ab6-0x0;var _0x1d514a=_0x29c1[_0x398ab6];return _0x1d514a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x129c('0x0'));var rimraf=require(_0x129c('0x1'));var zipdir=require(_0x129c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x129c('0x3'));var moment=require(_0x129c('0x4'));var BPromise=require(_0x129c('0x5'));var Mustache=require(_0x129c('0x6'));var util=require(_0x129c('0x7'));var path=require(_0x129c('0x8'));var sox=require(_0x129c('0x9'));var csv=require('to-csv');var ejs=require(_0x129c('0xa'));var fs=require('fs');var _=require(_0x129c('0xb'));var squel=require(_0x129c('0xc'));var crypto=require(_0x129c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x129c('0xe'));var toCsv=require(_0x129c('0xf'));var querystring=require(_0x129c('0x10'));var Papa=require('papaparse');var Redis=require(_0x129c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x129c('0x12'));var as=require(_0x129c('0x13'));var hardwareService=require(_0x129c('0x14'));var logger=require(_0x129c('0x15'))(_0x129c('0x16'));var utils=require(_0x129c('0x17'));var config=require(_0x129c('0x18'));var db=require(_0x129c('0x19'))['db'];function respondWithStatusCode(_0x20b2f4,_0x97ed02){_0x97ed02=_0x97ed02||0xcc;return function(_0x324107){if(_0x324107){return _0x20b2f4[_0x129c('0x1a')](_0x97ed02);}return _0x20b2f4[_0x129c('0x1b')](_0x97ed02)[_0x129c('0x1c')]();};}function respondWithResult(_0x35cbf6,_0x96621d){_0x96621d=_0x96621d||0xc8;return function(_0x58158b){if(_0x58158b){return _0x35cbf6['status'](_0x96621d)[_0x129c('0x1d')](_0x58158b);}};}function respondWithFilteredResult(_0x196789,_0x1bb403){return function(_0x7149a7){if(_0x7149a7){var _0x107c54=_0x7149a7[_0x129c('0x1e')],_0x5cb447=_0x1bb403[_0x129c('0x1f')],_0x1c9499=_0x1bb403[_0x129c('0x1f')]+_0x1bb403[_0x129c('0x20')],_0x4cf7a8;if(_0x1c9499>=_0x107c54){_0x1c9499=_0x107c54;_0x4cf7a8=0xc8;}else{_0x4cf7a8=0xce;}_0x196789['status'](_0x4cf7a8);return _0x196789[_0x129c('0x21')](_0x129c('0x22'),_0x5cb447+'-'+_0x1c9499+'/'+_0x107c54)['json'](_0x7149a7);}return null;};}function patchUpdates(_0x5cad3e){return function(_0x38e3a6){try{jsonpatch[_0x129c('0x23')](_0x38e3a6,_0x5cad3e,!![]);}catch(_0x4adfdb){return BPromise[_0x129c('0x24')](_0x4adfdb);}return _0x38e3a6[_0x129c('0x25')]();};}function saveUpdates(_0x3a18bc,_0xafe3ad){return function(_0x1c4086){if(_0x1c4086){return _0x1c4086[_0x129c('0x26')](_0x3a18bc)[_0x129c('0x27')](function(_0x2fc800){return _0x2fc800;});}return null;};}function removeEntity(_0x2eb239,_0x491bed){return function(_0x10ae7d){if(_0x10ae7d){return _0x10ae7d[_0x129c('0x28')]()[_0x129c('0x27')](function(){_0x2eb239[_0x129c('0x1b')](0xcc)[_0x129c('0x1c')]();});}};}function handleEntityNotFound(_0x463c47,_0x4e830e){return function(_0x492771){if(!_0x492771){_0x463c47[_0x129c('0x1a')](0x194);}return _0x492771;};}function handleError(_0x3b3020,_0xff129c){_0xff129c=_0xff129c||0x1f4;return function(_0x3c387b){logger[_0x129c('0x29')](_0x3c387b[_0x129c('0x2a')]);if(_0x3c387b['name']){delete _0x3c387b[_0x129c('0x2b')];}_0x3b3020[_0x129c('0x1b')](_0xff129c)[_0x129c('0x2c')](_0x3c387b);};}exports['index']=function(_0x30e546,_0x1aebc2){var _0xe1fbec={},_0x3707d5={},_0x247dc9={'count':0x0,'rows':[]};var _0x33b6e7=_[_0x129c('0x2d')](db[_0x129c('0x2e')][_0x129c('0x2f')],function(_0x4c211e){return{'name':_0x4c211e[_0x129c('0x30')],'type':_0x4c211e[_0x129c('0x31')][_0x129c('0x32')]};});_0x3707d5[_0x129c('0x33')]=_[_0x129c('0x2d')](_0x33b6e7,_0x129c('0x2b'));_0x3707d5[_0x129c('0x34')]=_[_0x129c('0x35')](_0x30e546['query']);_0x3707d5[_0x129c('0x36')]=_[_0x129c('0x37')](_0x3707d5[_0x129c('0x33')],_0x3707d5[_0x129c('0x34')]);_0xe1fbec[_0x129c('0x38')]=_[_0x129c('0x37')](_0x3707d5['model'],qs[_0x129c('0x39')](_0x30e546['query'][_0x129c('0x39')]));_0xe1fbec[_0x129c('0x38')]=_0xe1fbec[_0x129c('0x38')][_0x129c('0x3a')]?_0xe1fbec[_0x129c('0x38')]:_0x3707d5[_0x129c('0x33')];if(!_0x30e546[_0x129c('0x34')][_0x129c('0x3b')](_0x129c('0x3c'))){_0xe1fbec[_0x129c('0x20')]=qs[_0x129c('0x20')](_0x30e546[_0x129c('0x34')]['limit']);_0xe1fbec[_0x129c('0x1f')]=qs[_0x129c('0x1f')](_0x30e546[_0x129c('0x34')][_0x129c('0x1f')]);}_0xe1fbec[_0x129c('0x3d')]=qs[_0x129c('0x3e')](_0x30e546['query'][_0x129c('0x3e')]);_0xe1fbec[_0x129c('0x3f')]=qs[_0x129c('0x36')](_['pick'](_0x30e546[_0x129c('0x34')],_0x3707d5[_0x129c('0x36')]));if(_0x30e546[_0x129c('0x34')][_0x129c('0x40')]){_0xe1fbec[_0x129c('0x3f')]=_[_0x129c('0x41')](_0xe1fbec[_0x129c('0x3f')],{'$or':_[_0x129c('0x2d')](_0x33b6e7,function(_0x141d83){if(_0x141d83[_0x129c('0x31')]!==_0x129c('0x42')){var _0x22770c={};_0x22770c[_0x141d83[_0x129c('0x2b')]]={'$like':'%'+_0x30e546[_0x129c('0x34')][_0x129c('0x40')]+'%'};return _0x22770c;}})});}_0xe1fbec=_['merge']({},_0xe1fbec,_0x30e546[_0x129c('0x43')]);var _0xd3422f={'where':_0xe1fbec[_0x129c('0x3f')]};return db['SquareMessage'][_0x129c('0x1e')](_0xd3422f)[_0x129c('0x27')](function(_0x12f7e0){_0x247dc9['count']=_0x12f7e0;if(_0x30e546[_0x129c('0x34')][_0x129c('0x44')]){_0xe1fbec['include']=[{'all':!![]}];}return db[_0x129c('0x2e')][_0x129c('0x45')](_0xe1fbec);})[_0x129c('0x27')](function(_0xa766e4){_0x247dc9[_0x129c('0x46')]=_0xa766e4;return _0x247dc9;})[_0x129c('0x27')](respondWithFilteredResult(_0x1aebc2,_0xe1fbec))[_0x129c('0x47')](handleError(_0x1aebc2,null));};exports[_0x129c('0x48')]=function(_0x38180e,_0x58257b){var _0x4e4329={'raw':!![],'where':{'id':_0x38180e[_0x129c('0x49')]['id']}},_0x4a4b0c={};_0x4a4b0c[_0x129c('0x33')]=_[_0x129c('0x35')](db[_0x129c('0x2e')][_0x129c('0x2f')]);_0x4a4b0c[_0x129c('0x34')]=_['keys'](_0x38180e[_0x129c('0x34')]);_0x4a4b0c[_0x129c('0x36')]=_[_0x129c('0x37')](_0x4a4b0c['model'],_0x4a4b0c[_0x129c('0x34')]);_0x4e4329[_0x129c('0x38')]=_['intersection'](_0x4a4b0c['model'],qs[_0x129c('0x39')](_0x38180e[_0x129c('0x34')][_0x129c('0x39')]));_0x4e4329[_0x129c('0x38')]=_0x4e4329[_0x129c('0x38')][_0x129c('0x3a')]?_0x4e4329[_0x129c('0x38')]:_0x4a4b0c['model'];if(_0x38180e['query']['includeAll']){_0x4e4329[_0x129c('0x4a')]=[{'all':!![]}];}_0x4e4329=_[_0x129c('0x41')]({},_0x4e4329,_0x38180e[_0x129c('0x43')]);return db[_0x129c('0x2e')]['find'](_0x4e4329)[_0x129c('0x27')](handleEntityNotFound(_0x58257b,null))[_0x129c('0x27')](respondWithResult(_0x58257b,null))['catch'](handleError(_0x58257b,null));};exports[_0x129c('0x4b')]=function(_0x491731,_0x38f486){return db['SquareMessage'][_0x129c('0x4b')](_0x491731['body'],{})[_0x129c('0x27')](respondWithResult(_0x38f486,0xc9))[_0x129c('0x47')](handleError(_0x38f486,null));};exports[_0x129c('0x26')]=function(_0x380a17,_0x5743e5){if(_0x380a17[_0x129c('0x4c')]['id']){delete _0x380a17['body']['id'];}return db[_0x129c('0x2e')][_0x129c('0x4d')]({'where':{'id':_0x380a17['params']['id']}})['then'](handleEntityNotFound(_0x5743e5,null))[_0x129c('0x27')](saveUpdates(_0x380a17[_0x129c('0x4c')],null))[_0x129c('0x27')](respondWithResult(_0x5743e5,null))['catch'](handleError(_0x5743e5,null));};exports[_0x129c('0x28')]=function(_0x5ec0ae,_0x57ceec){return db['SquareMessage']['find']({'where':{'id':_0x5ec0ae[_0x129c('0x49')]['id']}})[_0x129c('0x27')](handleEntityNotFound(_0x57ceec,null))[_0x129c('0x27')](removeEntity(_0x57ceec,null))[_0x129c('0x47')](handleError(_0x57ceec,null));}; \ No newline at end of file +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 diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 93c56d3..5981f1e 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 _0xa652=['./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x99c2dd,_0x1d32eb){var _0x173349=function(_0x211a30){while(--_0x211a30){_0x99c2dd['push'](_0x99c2dd['shift']());}};_0x173349(++_0x1d32eb);}(_0xa652,0x1b2));var _0x2a65=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa652[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x2a65('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2a65('0x1'));var moment=require(_0x2a65('0x2'));var BPromise=require(_0x2a65('0x3'));var rp=require(_0x2a65('0x4'));var fs=require('fs');var path=require(_0x2a65('0x5'));var rimraf=require(_0x2a65('0x6'));var config=require(_0x2a65('0x7'));var attributes=require(_0x2a65('0x8'));module[_0x2a65('0x9')]=function(_0x5c99e8,_0x17259d){return _0x5c99e8[_0x2a65('0xa')](_0x2a65('0xb'),attributes,{'tableName':_0x2a65('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 93de353..5fe2f22 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 _0xa899=['stringify','error','SquareMessage,\x20%s,\x20%s','message','result','CreateSquareMessage','SquareMessage','create','options','raw','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s'];(function(_0x5dd1f6,_0x45a64e){var _0x57381b=function(_0x3fdab0){while(--_0x3fdab0){_0x5dd1f6['push'](_0x5dd1f6['shift']());}};_0x57381b(++_0x45a64e);}(_0xa899,0x155));var _0x9a89=function(_0x4b4f24,_0x5654a8){_0x4b4f24=_0x4b4f24-0x0;var _0x1c13d4=_0xa899[_0x4b4f24];return _0x1c13d4;};'use strict';var _=require(_0x9a89('0x0'));var util=require(_0x9a89('0x1'));var moment=require(_0x9a89('0x2'));var BPromise=require('bluebird');var rs=require(_0x9a89('0x3'));var fs=require('fs');var Redis=require(_0x9a89('0x4'));var db=require(_0x9a89('0x5'))['db'];var utils=require(_0x9a89('0x6'));var logger=require(_0x9a89('0x7'))(_0x9a89('0x8'));var config=require(_0x9a89('0x9'));var jayson=require(_0x9a89('0xa'));var client=jayson[_0x9a89('0xb')][_0x9a89('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x10fe5e,_0x995cf7,_0x5e5454){return new BPromise(function(_0x5ab174,_0x4d2b72){return client[_0x9a89('0xd')](_0x10fe5e,_0x5e5454)[_0x9a89('0xe')](function(_0x569b37){logger[_0x9a89('0xf')]('SquareMessage,\x20%s,\x20%s',_0x995cf7,_0x9a89('0x10'));logger[_0x9a89('0x11')](_0x9a89('0x12'),_0x995cf7,_0x9a89('0x10'),JSON[_0x9a89('0x13')](_0x569b37));if(_0x569b37[_0x9a89('0x14')]){if(_0x569b37[_0x9a89('0x14')]['code']===0x1f4){logger['error'](_0x9a89('0x15'),_0x995cf7,_0x569b37[_0x9a89('0x14')][_0x9a89('0x16')]);return _0x4d2b72(_0x569b37['error']['message']);}logger['error'](_0x9a89('0x15'),_0x995cf7,_0x569b37[_0x9a89('0x14')]['message']);return _0x5ab174(_0x569b37[_0x9a89('0x14')][_0x9a89('0x16')]);}else{logger[_0x9a89('0xf')](_0x9a89('0x15'),_0x995cf7,'request\x20sent');_0x5ab174(_0x569b37[_0x9a89('0x17')][_0x9a89('0x16')]);}})['catch'](function(_0x4fe73e){logger[_0x9a89('0x14')]('SquareMessage,\x20%s,\x20%s',_0x995cf7,_0x4fe73e);_0x4d2b72(_0x4fe73e);});});}exports[_0x9a89('0x18')]=function(_0x334725){var _0x53db7f=this;return new Promise(function(_0xdbb337,_0x5d8a62){return db[_0x9a89('0x19')][_0x9a89('0x1a')](_0x334725['body'],{'raw':_0x334725[_0x9a89('0x1b')]?_0x334725[_0x9a89('0x1b')][_0x9a89('0x1c')]===undefined?!![]:![]:!![]})[_0x9a89('0xe')](function(_0x66f8c7){logger[_0x9a89('0xf')](_0x9a89('0x18'),_0x334725);logger[_0x9a89('0x11')]('CreateSquareMessage',_0x334725,JSON['stringify'](_0x66f8c7));_0xdbb337(_0x66f8c7);})[_0x9a89('0x1d')](function(_0x330121){logger[_0x9a89('0x14')](_0x9a89('0x18'),_0x330121[_0x9a89('0x16')],_0x334725);_0x5d8a62(_0x53db7f[_0x9a89('0x14')](0x1f4,_0x330121['message']));});});}; \ No newline at end of file +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 diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 39b5705..5f9106c 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 _0x4a81=['util','path','connect-timeout','../../components/auth/service','../../config/environment','./squareOdbc.controller','index','/:id','show','get','/:id/test','isAuthenticated','15s','create','put','update','delete','destroy','exports','multer'];(function(_0x4702ee,_0xaf6a45){var _0x62ca7d=function(_0x5b3af7){while(--_0x5b3af7){_0x4702ee['push'](_0x4702ee['shift']());}};_0x62ca7d(++_0xaf6a45);}(_0x4a81,0x1b7));var _0x14a8=function(_0x5f216,_0x4d5290){_0x5f216=_0x5f216-0x0;var _0x2ed654=_0x4a81[_0x5f216];return _0x2ed654;};'use strict';var multer=require(_0x14a8('0x0'));var util=require(_0x14a8('0x1'));var path=require(_0x14a8('0x2'));var timeout=require(_0x14a8('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x14a8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x14a8('0x5'));var controller=require(_0x14a8('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x14a8('0x7')]);router['get'](_0x14a8('0x8'),auth['isAuthenticated'](),controller[_0x14a8('0x9')]);router[_0x14a8('0xa')](_0x14a8('0xb'),auth[_0x14a8('0xc')](),timeout(_0x14a8('0xd')),controller['test']);router['post']('/',auth[_0x14a8('0xc')](),controller[_0x14a8('0xe')]);router[_0x14a8('0xf')]('/:id',auth[_0x14a8('0xc')](),controller[_0x14a8('0x10')]);router[_0x14a8('0x11')](_0x14a8('0x8'),auth[_0x14a8('0xc')](),controller[_0x14a8('0x12')]);module[_0x14a8('0x13')]=router; \ No newline at end of file +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 diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 09412aa..b52be67 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 _0x0443=['STRING','name','sequelize','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x0443,0x1da));var _0x3044=function(_0x497c74,_0x34fb02){_0x497c74=_0x497c74-0x0;var _0x3c0690=_0x0443[_0x497c74];return _0x3c0690;};'use strict';var Sequelize=require(_0x3044('0x0'));module[_0x3044('0x1')]={'name':{'type':Sequelize[_0x3044('0x2')],'unique':_0x3044('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x3044('0x2')]},'description':{'type':Sequelize[_0x3044('0x2')]}}; \ No newline at end of file +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 diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 35b7697..90b9dc2 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 _0xf2ea=['../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','then','get','ODBC','UserProfileResource','destroy','error','name','send','map','SquareOdbc','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','count','include','rows','catch','show','params','rawAttributes','includeAll','options','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x2c0e70,_0x205459){var _0x470f57=function(_0x5268b3){while(--_0x5268b3){_0x2c0e70['push'](_0x2c0e70['shift']());}};_0x470f57(++_0x205459);}(_0xf2ea,0x1c1));var _0xaf2e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf2ea[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0xaf2e('0x0'));var emlformat=require(_0xaf2e('0x1'));var rimraf=require(_0xaf2e('0x2'));var zipdir=require(_0xaf2e('0x3'));var jsonpatch=require(_0xaf2e('0x4'));var rp=require(_0xaf2e('0x5'));var moment=require('moment');var BPromise=require(_0xaf2e('0x6'));var Mustache=require(_0xaf2e('0x7'));var util=require(_0xaf2e('0x8'));var path=require(_0xaf2e('0x9'));var sox=require('sox');var csv=require(_0xaf2e('0xa'));var ejs=require(_0xaf2e('0xb'));var fs=require('fs');var _=require(_0xaf2e('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xaf2e('0xd'));var toCsv=require(_0xaf2e('0xa'));var querystring=require('querystring');var Papa=require(_0xaf2e('0xe'));var Redis=require('ioredis');var authService=require(_0xaf2e('0xf'));var qs=require(_0xaf2e('0x10'));var as=require(_0xaf2e('0x11'));var hardwareService=require(_0xaf2e('0x12'));var logger=require(_0xaf2e('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xaf2e('0x14'));var db=require(_0xaf2e('0x15'))['db'];function respondWithStatusCode(_0x32f2bd,_0x48ee8a){_0x48ee8a=_0x48ee8a||0xcc;return function(_0x44dd63){if(_0x44dd63){return _0x32f2bd[_0xaf2e('0x16')](_0x48ee8a);}return _0x32f2bd[_0xaf2e('0x17')](_0x48ee8a)[_0xaf2e('0x18')]();};}function respondWithResult(_0x21cdf7,_0x36149f){_0x36149f=_0x36149f||0xc8;return function(_0x5e6ecb){if(_0x5e6ecb){return _0x21cdf7[_0xaf2e('0x17')](_0x36149f)[_0xaf2e('0x19')](_0x5e6ecb);}};}function respondWithFilteredResult(_0x403c28,_0xb35191){return function(_0x10621f){if(_0x10621f){var _0x5bd455=_0x10621f['count'],_0x142472=_0xb35191[_0xaf2e('0x1a')],_0x72d39=_0xb35191[_0xaf2e('0x1a')]+_0xb35191[_0xaf2e('0x1b')],_0x595608;if(_0x72d39>=_0x5bd455){_0x72d39=_0x5bd455;_0x595608=0xc8;}else{_0x595608=0xce;}_0x403c28[_0xaf2e('0x17')](_0x595608);return _0x403c28[_0xaf2e('0x1c')]('Content-Range',_0x142472+'-'+_0x72d39+'/'+_0x5bd455)[_0xaf2e('0x19')](_0x10621f);}return null;};}function patchUpdates(_0x9495ec){return function(_0x4775e4){try{jsonpatch[_0xaf2e('0x1d')](_0x4775e4,_0x9495ec,!![]);}catch(_0x15bd4d){return BPromise[_0xaf2e('0x1e')](_0x15bd4d);}return _0x4775e4[_0xaf2e('0x1f')]();};}function saveUpdates(_0x449192,_0x22caf1){return function(_0x2352ff){if(_0x2352ff){return _0x2352ff[_0xaf2e('0x20')](_0x449192)['then'](function(_0x311375){return _0x311375;});}return null;};}function removeEntity(_0x511dca,_0x35d50f){return function(_0x321245){if(_0x321245){return _0x321245['destroy']()[_0xaf2e('0x21')](function(){var _0x1f06bc=_0x321245[_0xaf2e('0x22')]({'plain':!![]});var _0x9cdeac=_0xaf2e('0x23');return db[_0xaf2e('0x24')][_0xaf2e('0x25')]({'where':{'type':_0x9cdeac,'resourceId':_0x1f06bc['id']}})[_0xaf2e('0x21')](function(){return _0x321245;});})[_0xaf2e('0x21')](function(){_0x511dca[_0xaf2e('0x17')](0xcc)[_0xaf2e('0x18')]();});}};}function handleEntityNotFound(_0x19ca3b,_0x5da59f){return function(_0x4fb430){if(!_0x4fb430){_0x19ca3b['sendStatus'](0x194);}return _0x4fb430;};}function handleError(_0x301838,_0x52fc83){_0x52fc83=_0x52fc83||0x1f4;return function(_0x4da775){logger[_0xaf2e('0x26')](_0x4da775['stack']);if(_0x4da775[_0xaf2e('0x27')]){delete _0x4da775[_0xaf2e('0x27')];}_0x301838[_0xaf2e('0x17')](_0x52fc83)[_0xaf2e('0x28')](_0x4da775);};}exports['index']=function(_0x4c9f05,_0x3ac385){var _0x1c6601={},_0x3a0057={},_0x250853={'count':0x0,'rows':[]};var _0x106e90=_[_0xaf2e('0x29')](db[_0xaf2e('0x2a')]['rawAttributes'],function(_0x8f1f0){return{'name':_0x8f1f0[_0xaf2e('0x2b')],'type':_0x8f1f0[_0xaf2e('0x2c')]['key']};});_0x3a0057[_0xaf2e('0x2d')]=_['map'](_0x106e90,_0xaf2e('0x27'));_0x3a0057['query']=_[_0xaf2e('0x2e')](_0x4c9f05[_0xaf2e('0x2f')]);_0x3a0057[_0xaf2e('0x30')]=_['intersection'](_0x3a0057['model'],_0x3a0057[_0xaf2e('0x2f')]);_0x1c6601[_0xaf2e('0x31')]=_[_0xaf2e('0x32')](_0x3a0057[_0xaf2e('0x2d')],qs[_0xaf2e('0x33')](_0x4c9f05['query']['fields']));_0x1c6601[_0xaf2e('0x31')]=_0x1c6601[_0xaf2e('0x31')][_0xaf2e('0x34')]?_0x1c6601[_0xaf2e('0x31')]:_0x3a0057['model'];if(!_0x4c9f05[_0xaf2e('0x2f')]['hasOwnProperty'](_0xaf2e('0x35'))){_0x1c6601[_0xaf2e('0x1b')]=qs[_0xaf2e('0x1b')](_0x4c9f05[_0xaf2e('0x2f')][_0xaf2e('0x1b')]);_0x1c6601[_0xaf2e('0x1a')]=qs[_0xaf2e('0x1a')](_0x4c9f05['query'][_0xaf2e('0x1a')]);}_0x1c6601['order']=qs['sort'](_0x4c9f05[_0xaf2e('0x2f')][_0xaf2e('0x36')]);_0x1c6601[_0xaf2e('0x37')]=qs[_0xaf2e('0x30')](_['pick'](_0x4c9f05[_0xaf2e('0x2f')],_0x3a0057[_0xaf2e('0x30')]));if(_0x4c9f05[_0xaf2e('0x2f')][_0xaf2e('0x38')]){_0x1c6601[_0xaf2e('0x37')]=_[_0xaf2e('0x39')](_0x1c6601[_0xaf2e('0x37')],{'$or':_[_0xaf2e('0x29')](_0x106e90,function(_0x2fd875){if(_0x2fd875['type']!==_0xaf2e('0x3a')){var _0x1e2808={};_0x1e2808[_0x2fd875['name']]={'$like':'%'+_0x4c9f05['query'][_0xaf2e('0x38')]+'%'};return _0x1e2808;}})});}_0x1c6601=_['merge']({},_0x1c6601,_0x4c9f05['options']);var _0x5a83d7={'where':_0x1c6601['where']};return db['SquareOdbc'][_0xaf2e('0x3b')](_0x5a83d7)[_0xaf2e('0x21')](function(_0x51a847){_0x250853[_0xaf2e('0x3b')]=_0x51a847;if(_0x4c9f05[_0xaf2e('0x2f')]['includeAll']){_0x1c6601[_0xaf2e('0x3c')]=[{'all':!![]}];}return db[_0xaf2e('0x2a')]['findAll'](_0x1c6601);})[_0xaf2e('0x21')](function(_0xe8c78b){_0x250853[_0xaf2e('0x3d')]=_0xe8c78b;return _0x250853;})[_0xaf2e('0x21')](respondWithFilteredResult(_0x3ac385,_0x1c6601))[_0xaf2e('0x3e')](handleError(_0x3ac385,null));};exports[_0xaf2e('0x3f')]=function(_0x146b3b,_0x4e571b){var _0x2a642f={'raw':!![],'where':{'id':_0x146b3b[_0xaf2e('0x40')]['id']}},_0x3ef0ee={};_0x3ef0ee[_0xaf2e('0x2d')]=_['keys'](db['SquareOdbc'][_0xaf2e('0x41')]);_0x3ef0ee[_0xaf2e('0x2f')]=_[_0xaf2e('0x2e')](_0x146b3b['query']);_0x3ef0ee[_0xaf2e('0x30')]=_[_0xaf2e('0x32')](_0x3ef0ee[_0xaf2e('0x2d')],_0x3ef0ee[_0xaf2e('0x2f')]);_0x2a642f[_0xaf2e('0x31')]=_['intersection'](_0x3ef0ee[_0xaf2e('0x2d')],qs[_0xaf2e('0x33')](_0x146b3b[_0xaf2e('0x2f')][_0xaf2e('0x33')]));_0x2a642f['attributes']=_0x2a642f['attributes'][_0xaf2e('0x34')]?_0x2a642f[_0xaf2e('0x31')]:_0x3ef0ee[_0xaf2e('0x2d')];if(_0x146b3b[_0xaf2e('0x2f')][_0xaf2e('0x42')]){_0x2a642f['include']=[{'all':!![]}];}_0x2a642f=_[_0xaf2e('0x39')]({},_0x2a642f,_0x146b3b[_0xaf2e('0x43')]);return db['SquareOdbc'][_0xaf2e('0x44')](_0x2a642f)[_0xaf2e('0x21')](handleEntityNotFound(_0x4e571b,null))[_0xaf2e('0x21')](respondWithResult(_0x4e571b,null))[_0xaf2e('0x3e')](handleError(_0x4e571b,null));};exports[_0xaf2e('0x45')]=function(_0x2569ab,_0xfaea84){return db[_0xaf2e('0x2a')]['create'](_0x2569ab[_0xaf2e('0x46')],{})[_0xaf2e('0x21')](function(_0x4b0c08){var _0xad092c=_0x2569ab[_0xaf2e('0x47')][_0xaf2e('0x22')]({'plain':!![]});if(!_0xad092c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xad092c['role']===_0xaf2e('0x47')){var _0x2a5c7a=_0x4b0c08['get']({'plain':!![]});var _0x373df7='ODBC';return db[_0xaf2e('0x48')]['find']({'where':{'name':_0x373df7,'userProfileId':_0xad092c[_0xaf2e('0x49')]},'raw':!![]})[_0xaf2e('0x21')](function(_0x168867){if(_0x168867&&_0x168867[_0xaf2e('0x4a')]===0x0){return db['UserProfileResource']['create']({'name':_0x2a5c7a['name'],'resourceId':_0x2a5c7a['id'],'type':_0x168867[_0xaf2e('0x27')],'sectionId':_0x168867['id']},{})['then'](function(){return _0x4b0c08;});}else{return _0x4b0c08;}})['catch'](function(_0x3d096e){logger[_0xaf2e('0x26')](_0xaf2e('0x4b'),_0x3d096e);throw _0x3d096e;});}return _0x4b0c08;})[_0xaf2e('0x21')](respondWithResult(_0xfaea84,0xc9))[_0xaf2e('0x3e')](handleError(_0xfaea84,null));};exports[_0xaf2e('0x20')]=function(_0x1d0e1d,_0x269f2a){if(_0x1d0e1d[_0xaf2e('0x46')]['id']){delete _0x1d0e1d['body']['id'];}return db[_0xaf2e('0x2a')]['find']({'where':{'id':_0x1d0e1d[_0xaf2e('0x40')]['id']}})[_0xaf2e('0x21')](handleEntityNotFound(_0x269f2a,null))[_0xaf2e('0x21')](saveUpdates(_0x1d0e1d['body'],null))[_0xaf2e('0x21')](respondWithResult(_0x269f2a,null))[_0xaf2e('0x3e')](handleError(_0x269f2a,null));};exports['destroy']=function(_0x2bd5e2,_0x18cc3c){return db[_0xaf2e('0x2a')][_0xaf2e('0x44')]({'where':{'id':_0x2bd5e2['params']['id']}})[_0xaf2e('0x21')](handleEntityNotFound(_0x18cc3c,null))[_0xaf2e('0x21')](removeEntity(_0x18cc3c,null))[_0xaf2e('0x3e')](handleError(_0x18cc3c,null));};exports[_0xaf2e('0x4c')]=function(_0xfc325b,_0x58734c,_0xdb3d28){var _0x57b63e;return db[_0xaf2e('0x2a')][_0xaf2e('0x44')]({'where':{'id':_0xfc325b[_0xaf2e('0x40')]['id']},'attributes':['id',_0xaf2e('0x4d')]})['then'](handleEntityNotFound(_0x58734c,null))['then'](function(_0x29465e){if(_0x29465e){var _0x5c4a87=require('odbc')();_0x5c4a87['openSync'](_0x29465e[_0xaf2e('0x4d')]);_0x5c4a87['closeSync']();return _0x29465e;}})[_0xaf2e('0x21')](respondWithResult(_0x58734c,null))[_0xaf2e('0x3e')](handleError(_0x58734c,null));}; \ No newline at end of file +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 diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index c4dbaf2..9b95988 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 _0x9e50=['rimraf','../../config/environment','square_odbc','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9e50,0xdf));var _0x09e5=function(_0x555cc3,_0x79e2d8){_0x555cc3=_0x555cc3-0x0;var _0x347a19=_0x9e50[_0x555cc3];return _0x347a19;};'use strict';var _=require(_0x09e5('0x0'));var util=require(_0x09e5('0x1'));var logger=require(_0x09e5('0x2'))(_0x09e5('0x3'));var moment=require(_0x09e5('0x4'));var BPromise=require(_0x09e5('0x5'));var rp=require(_0x09e5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x09e5('0x7'));var config=require(_0x09e5('0x8'));var attributes=require('./squareOdbc.attributes');module['exports']=function(_0x6796e2,_0x424961){return _0x6796e2['define']('SquareOdbc',attributes,{'tableName':_0x09e5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index b33e2fd..fc56009 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(_0x43f9fd,_0x3bb23c){var _0x15360e=function(_0x24b0d6){while(--_0x24b0d6){_0x43f9fd['push'](_0x43f9fd['shift']());}};_0x15360e(++_0x3bb23c);}(_0x3e74,0x175));var _0x43e7=function(_0x409ecd,_0x434d6f){_0x409ecd=_0x409ecd-0x0;var _0x5ace06=_0x3e74[_0x409ecd];return _0x5ace06;};'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 _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 diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 8e71183..2453d12 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 _0x351d=['index','get','show','/:id/users','post','addUsers','put','/:id','destroy','delete','removeUsers','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./squareProject.controller','isAuthenticated'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x351d,0x90));var _0xd351=function(_0x110c23,_0x1eb997){_0x110c23=_0x110c23-0x0;var _0x2a8608=_0x351d[_0x110c23];return _0x2a8608;};'use strict';var multer=require(_0xd351('0x0'));var util=require('util');var path=require(_0xd351('0x1'));var timeout=require(_0xd351('0x2'));var express=require(_0xd351('0x3'));var router=express['Router']();var auth=require(_0xd351('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd351('0x5'));var controller=require(_0xd351('0x6'));router['get']('/',auth[_0xd351('0x7')](),controller[_0xd351('0x8')]);router[_0xd351('0x9')]('/:id',auth[_0xd351('0x7')](),controller[_0xd351('0xa')]);router['get'](_0xd351('0xb'),auth[_0xd351('0x7')](),controller['getUsers']);router['post']('/',auth[_0xd351('0x7')](),controller['create']);router[_0xd351('0xc')](_0xd351('0xb'),auth['isAuthenticated'](),controller[_0xd351('0xd')]);router[_0xd351('0xe')]('/:id',auth[_0xd351('0x7')](),controller['update']);router['delete'](_0xd351('0xf'),auth[_0xd351('0x7')](),controller[_0xd351('0x10')]);router[_0xd351('0x11')]('/:id/users',auth[_0xd351('0x7')](),controller[_0xd351('0x12')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index ffba08a..6e3af25 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 _0xa34a=['sequelize','exports','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production'];(function(_0x5da90d,_0x1f29a5){var _0x5cf13f=function(_0x5963c3){while(--_0x5963c3){_0x5da90d['push'](_0x5da90d['shift']());}};_0x5cf13f(++_0x1f29a5);}(_0xa34a,0x198));var _0xaa34=function(_0x586e17,_0x13ba4d){_0x586e17=_0x586e17-0x0;var _0x2b1632=_0xa34a[_0x586e17];return _0x2b1632;};'use strict';var Sequelize=require(_0xaa34('0x0'));module[_0xaa34('0x1')]={'name':{'type':Sequelize[_0xaa34('0x2')],'unique':_0xaa34('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xaa34('0x2')]},'notes':{'type':Sequelize[_0xaa34('0x4')]},'preproduction':{'type':Sequelize[_0xaa34('0x5')](_0xaa34('0x6')),'get':function(){if(this[_0xaa34('0x7')](_0xaa34('0x8'))){return this['getDataValue'](_0xaa34('0x8'))[_0xaa34('0x9')](_0xaa34('0xa'));}}},'production':{'type':Sequelize[_0xaa34('0x5')](_0xaa34('0x6')),'get':function(){if(this['getDataValue'](_0xaa34('0xb'))){return this[_0xaa34('0x7')](_0xaa34('0xb'))[_0xaa34('0x9')](_0xaa34('0xa'));}}}}; \ No newline at end of file +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 diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index c35942d..1cf1476 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 _0x0bb5=['rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','count','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','SquareProjects','userProfileId','autoAssociation','destroy','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','User','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','sendStatus','end','status','offset','limit','set','json','reject','save','update','then','get','UserProfileResource','error','name','send','map','SquareProject'];(function(_0x2b583b,_0x322bc5){var _0x3986e2=function(_0x17d5bc){while(--_0x17d5bc){_0x2b583b['push'](_0x2b583b['shift']());}};_0x3986e2(++_0x322bc5);}(_0x0bb5,0x148));var _0x50bb=function(_0x4fc4d1,_0x51c3a3){_0x4fc4d1=_0x4fc4d1-0x0;var _0x2b4b1e=_0x0bb5[_0x4fc4d1];return _0x2b4b1e;};'use strict';var pdf=require(_0x50bb('0x0'));var emlformat=require(_0x50bb('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x50bb('0x2'));var rp=require(_0x50bb('0x3'));var moment=require(_0x50bb('0x4'));var BPromise=require(_0x50bb('0x5'));var Mustache=require(_0x50bb('0x6'));var util=require(_0x50bb('0x7'));var path=require(_0x50bb('0x8'));var sox=require(_0x50bb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x50bb('0xa'));var squel=require(_0x50bb('0xb'));var crypto=require(_0x50bb('0xc'));var jsforce=require(_0x50bb('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x50bb('0xe'));var Papa=require(_0x50bb('0xf'));var Redis=require(_0x50bb('0x10'));var authService=require(_0x50bb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x50bb('0x12'));var hardwareService=require(_0x50bb('0x13'));var logger=require(_0x50bb('0x14'))(_0x50bb('0x15'));var utils=require(_0x50bb('0x16'));var config=require(_0x50bb('0x17'));var db=require(_0x50bb('0x18'))['db'];config['redis']=_[_0x50bb('0x19')](config['redis'],{'host':_0x50bb('0x1a'),'port':0x18eb});var socket=require(_0x50bb('0x1b'))(new Redis(config[_0x50bb('0x1c')]));require('./squareProject.socket')[_0x50bb('0x1d')](socket);function respondWithStatusCode(_0x309986,_0x3094f2){_0x3094f2=_0x3094f2||0xcc;return function(_0x5244b0){if(_0x5244b0){return _0x309986[_0x50bb('0x1e')](_0x3094f2);}return _0x309986['status'](_0x3094f2)[_0x50bb('0x1f')]();};}function respondWithResult(_0x3e1a51,_0x253073){_0x253073=_0x253073||0xc8;return function(_0x42ffab){if(_0x42ffab){return _0x3e1a51[_0x50bb('0x20')](_0x253073)['json'](_0x42ffab);}};}function respondWithFilteredResult(_0x10a191,_0x174065){return function(_0x4b1f5f){if(_0x4b1f5f){var _0x24ba19=_0x4b1f5f['count'],_0x4796ec=_0x174065['offset'],_0x301f61=_0x174065[_0x50bb('0x21')]+_0x174065[_0x50bb('0x22')],_0x431ed4;if(_0x301f61>=_0x24ba19){_0x301f61=_0x24ba19;_0x431ed4=0xc8;}else{_0x431ed4=0xce;}_0x10a191[_0x50bb('0x20')](_0x431ed4);return _0x10a191[_0x50bb('0x23')]('Content-Range',_0x4796ec+'-'+_0x301f61+'/'+_0x24ba19)[_0x50bb('0x24')](_0x4b1f5f);}return null;};}function patchUpdates(_0x32bfc3){return function(_0x4020a0){try{jsonpatch['apply'](_0x4020a0,_0x32bfc3,!![]);}catch(_0x3104c8){return BPromise[_0x50bb('0x25')](_0x3104c8);}return _0x4020a0[_0x50bb('0x26')]();};}function saveUpdates(_0x4825f8,_0x1dbba2){return function(_0x4cc7f9){if(_0x4cc7f9){return _0x4cc7f9[_0x50bb('0x27')](_0x4825f8)[_0x50bb('0x28')](function(_0x1a2a0b){return _0x1a2a0b;});}return null;};}function removeEntity(_0x2ee87a,_0x846311){return function(_0x342078){if(_0x342078){return _0x342078['destroy']()[_0x50bb('0x28')](function(){var _0xee0af0=_0x342078[_0x50bb('0x29')]({'plain':!![]});var _0x3462c1='SquareProjects';return db[_0x50bb('0x2a')]['destroy']({'where':{'type':_0x3462c1,'resourceId':_0xee0af0['id']}})['then'](function(){return _0x342078;});})[_0x50bb('0x28')](function(){_0x2ee87a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x41fd89,_0x12ee2c){return function(_0x3004a3){if(!_0x3004a3){_0x41fd89[_0x50bb('0x1e')](0x194);}return _0x3004a3;};}function handleError(_0x17c158,_0x269479){_0x269479=_0x269479||0x1f4;return function(_0x41a8ad){logger[_0x50bb('0x2b')](_0x41a8ad['stack']);if(_0x41a8ad[_0x50bb('0x2c')]){delete _0x41a8ad[_0x50bb('0x2c')];}_0x17c158[_0x50bb('0x20')](_0x269479)[_0x50bb('0x2d')](_0x41a8ad);};}exports['index']=function(_0x13dc3c,_0x1a62fb){var _0xc38da5={},_0xb3c3ba={},_0x3fd5f6={'count':0x0,'rows':[]};var _0x3b0374=_[_0x50bb('0x2e')](db[_0x50bb('0x2f')][_0x50bb('0x30')],function(_0x3459e5){return{'name':_0x3459e5[_0x50bb('0x31')],'type':_0x3459e5[_0x50bb('0x32')]['key']};});_0xb3c3ba[_0x50bb('0x33')]=_[_0x50bb('0x2e')](_0x3b0374,_0x50bb('0x2c'));_0xb3c3ba[_0x50bb('0x34')]=_[_0x50bb('0x35')](_0x13dc3c[_0x50bb('0x34')]);_0xb3c3ba[_0x50bb('0x36')]=_[_0x50bb('0x37')](_0xb3c3ba[_0x50bb('0x33')],_0xb3c3ba[_0x50bb('0x34')]);_0xc38da5[_0x50bb('0x38')]=_['intersection'](_0xb3c3ba[_0x50bb('0x33')],qs[_0x50bb('0x39')](_0x13dc3c[_0x50bb('0x34')][_0x50bb('0x39')]));_0xc38da5[_0x50bb('0x38')]=_0xc38da5[_0x50bb('0x38')]['length']?_0xc38da5['attributes']:_0xb3c3ba[_0x50bb('0x33')];if(!_0x13dc3c['query'][_0x50bb('0x3a')](_0x50bb('0x3b'))){_0xc38da5[_0x50bb('0x22')]=qs[_0x50bb('0x22')](_0x13dc3c[_0x50bb('0x34')]['limit']);_0xc38da5[_0x50bb('0x21')]=qs['offset'](_0x13dc3c[_0x50bb('0x34')][_0x50bb('0x21')]);}_0xc38da5[_0x50bb('0x3c')]=qs['sort'](_0x13dc3c['query'][_0x50bb('0x3d')]);_0xc38da5[_0x50bb('0x3e')]=qs[_0x50bb('0x36')](_[_0x50bb('0x3f')](_0x13dc3c['query'],_0xb3c3ba[_0x50bb('0x36')]));if(_0x13dc3c['query']['filter']){_0xc38da5[_0x50bb('0x3e')]=_['merge'](_0xc38da5[_0x50bb('0x3e')],{'$or':_[_0x50bb('0x2e')](_0x3b0374,function(_0x1ef231){if(_0x1ef231[_0x50bb('0x32')]!==_0x50bb('0x40')){var _0x437524={};_0x437524[_0x1ef231[_0x50bb('0x2c')]]={'$like':'%'+_0x13dc3c[_0x50bb('0x34')][_0x50bb('0x41')]+'%'};return _0x437524;}})});}_0xc38da5=_[_0x50bb('0x42')]({},_0xc38da5,_0x13dc3c['options']);var _0x510532={'where':_0xc38da5[_0x50bb('0x3e')]};return db[_0x50bb('0x2f')][_0x50bb('0x43')](_0x510532)[_0x50bb('0x28')](function(_0x5e8085){_0x3fd5f6[_0x50bb('0x43')]=_0x5e8085;if(_0x13dc3c['query'][_0x50bb('0x44')]){_0xc38da5[_0x50bb('0x45')]=[{'all':!![]}];}return db[_0x50bb('0x2f')][_0x50bb('0x46')](_0xc38da5);})[_0x50bb('0x28')](function(_0x355726){_0x3fd5f6[_0x50bb('0x47')]=_0x355726;return _0x3fd5f6;})[_0x50bb('0x28')](respondWithFilteredResult(_0x1a62fb,_0xc38da5))[_0x50bb('0x48')](handleError(_0x1a62fb,null));};exports[_0x50bb('0x49')]=function(_0x349474,_0x24e375){var _0x85b0ff={'raw':![],'where':{'id':_0x349474[_0x50bb('0x4a')]['id']}},_0x1bbcbd={};_0x1bbcbd[_0x50bb('0x33')]=_['keys'](db[_0x50bb('0x2f')]['rawAttributes']);_0x1bbcbd[_0x50bb('0x34')]=_[_0x50bb('0x35')](_0x349474[_0x50bb('0x34')]);_0x1bbcbd[_0x50bb('0x36')]=_[_0x50bb('0x37')](_0x1bbcbd[_0x50bb('0x33')],_0x1bbcbd[_0x50bb('0x34')]);_0x85b0ff[_0x50bb('0x38')]=_[_0x50bb('0x37')](_0x1bbcbd[_0x50bb('0x33')],qs[_0x50bb('0x39')](_0x349474[_0x50bb('0x34')][_0x50bb('0x39')]));_0x85b0ff[_0x50bb('0x38')]=_0x85b0ff['attributes'][_0x50bb('0x4b')]?_0x85b0ff['attributes']:_0x1bbcbd[_0x50bb('0x33')];if(_0x349474[_0x50bb('0x34')][_0x50bb('0x44')]){_0x85b0ff[_0x50bb('0x45')]=[{'all':!![]}];}_0x85b0ff=_[_0x50bb('0x42')]({},_0x85b0ff,_0x349474[_0x50bb('0x4c')]);return db[_0x50bb('0x2f')][_0x50bb('0x4d')](_0x85b0ff)['then'](handleEntityNotFound(_0x24e375,null))[_0x50bb('0x28')](respondWithResult(_0x24e375,null))[_0x50bb('0x48')](handleError(_0x24e375,null));};exports[_0x50bb('0x4e')]=function(_0x13afe2,_0x3659c4){return db['SquareProject'][_0x50bb('0x4e')](_0x13afe2[_0x50bb('0x4f')],{})[_0x50bb('0x28')](function(_0x154ff8){var _0x77f534=_0x13afe2['user']['get']({'plain':!![]});if(!_0x77f534)throw new Error(_0x50bb('0x50'));if(_0x77f534['role']===_0x50bb('0x51')){var _0x57ee0e=_0x154ff8[_0x50bb('0x29')]({'plain':!![]});var _0x24c9f3=_0x50bb('0x52');return db['UserProfileSection'][_0x50bb('0x4d')]({'where':{'name':_0x24c9f3,'userProfileId':_0x77f534[_0x50bb('0x53')]},'raw':!![]})['then'](function(_0x184147){if(_0x184147&&_0x184147[_0x50bb('0x54')]===0x0){return db[_0x50bb('0x2a')][_0x50bb('0x4e')]({'name':_0x57ee0e['name'],'resourceId':_0x57ee0e['id'],'type':_0x184147[_0x50bb('0x2c')],'sectionId':_0x184147['id']},{})[_0x50bb('0x28')](function(){return _0x154ff8;});}else{return _0x154ff8;}})[_0x50bb('0x48')](function(_0x460d93){logger[_0x50bb('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x460d93);throw _0x460d93;});}return _0x154ff8;})[_0x50bb('0x28')](respondWithResult(_0x3659c4,0xc9))['catch'](handleError(_0x3659c4,null));};exports[_0x50bb('0x27')]=function(_0x50216f,_0x52ea86){if(_0x50216f[_0x50bb('0x4f')]['id']){delete _0x50216f['body']['id'];}return db['SquareProject'][_0x50bb('0x4d')]({'where':{'id':_0x50216f[_0x50bb('0x4a')]['id']}})[_0x50bb('0x28')](handleEntityNotFound(_0x52ea86,null))[_0x50bb('0x28')](saveUpdates(_0x50216f[_0x50bb('0x4f')],null))[_0x50bb('0x28')](respondWithResult(_0x52ea86,null))[_0x50bb('0x48')](handleError(_0x52ea86,null));};exports[_0x50bb('0x55')]=function(_0x57d749,_0x5abfc8){return db[_0x50bb('0x2f')][_0x50bb('0x4d')]({'where':{'id':_0x57d749[_0x50bb('0x4a')]['id']}})[_0x50bb('0x28')](handleEntityNotFound(_0x5abfc8,null))[_0x50bb('0x28')](removeEntity(_0x5abfc8,null))[_0x50bb('0x48')](handleError(_0x5abfc8,null));};exports[_0x50bb('0x56')]=function(_0x4bf426,_0x3be83b,_0x31cfca){return db[_0x50bb('0x2f')][_0x50bb('0x4d')]({'where':{'id':_0x4bf426[_0x50bb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3be83b,null))[_0x50bb('0x28')](function(_0x1d8b85){if(_0x1d8b85){return _0x1d8b85[_0x50bb('0x56')](_0x4bf426[_0x50bb('0x4f')][_0x50bb('0x57')],_['omit'](_0x4bf426[_0x50bb('0x4f')],['ids','id'])||{});}})['then'](respondWithResult(_0x3be83b,null))[_0x50bb('0x48')](handleError(_0x3be83b,null));};exports[_0x50bb('0x58')]=function(_0x25eeca,_0x3aba4e,_0x431d71){return db[_0x50bb('0x2f')][_0x50bb('0x4d')]({'where':{'id':_0x25eeca[_0x50bb('0x4a')]['id']}})[_0x50bb('0x28')](handleEntityNotFound(_0x3aba4e,null))[_0x50bb('0x28')](function(_0x38a239){if(_0x38a239){return _0x38a239['removeUsers'](_0x25eeca[_0x50bb('0x34')]['ids'])[_0x50bb('0x28')](function(){if(_[_0x50bb('0x59')](_0x25eeca['query'][_0x50bb('0x57')])){for(var _0x2dab90=0x0;_0x2dab90<_0x25eeca[_0x50bb('0x34')][_0x50bb('0x57')][_0x50bb('0x4b')];_0x2dab90+=0x1){socket[_0x50bb('0x5a')](_0x50bb('0x5b'),{'UserId':Number(_0x25eeca[_0x50bb('0x34')]['ids'][_0x2dab90]),'SquareProjectId':Number(_0x25eeca[_0x50bb('0x4a')]['id'])});}}else{socket[_0x50bb('0x5a')](_0x50bb('0x5b'),{'UserId':Number(_0x25eeca['query'][_0x50bb('0x57')]),'SquareProjectId':Number(_0x25eeca[_0x50bb('0x4a')]['id'])});}});}})[_0x50bb('0x28')](respondWithStatusCode(_0x3aba4e,null))[_0x50bb('0x48')](handleError(_0x3aba4e,null));};exports[_0x50bb('0x5c')]=function(_0x3ca1af,_0x4fc75c,_0xf47641){var _0x3d1839={};var _0x409082={};var _0x2d648f;var _0x9b8281;return db[_0x50bb('0x2f')]['findOne']({'where':{'id':_0x3ca1af[_0x50bb('0x4a')]['id']}})[_0x50bb('0x28')](handleEntityNotFound(_0x4fc75c,null))[_0x50bb('0x28')](function(_0x1700c4){if(_0x1700c4){_0x2d648f=_0x1700c4;_0x409082[_0x50bb('0x33')]=_[_0x50bb('0x35')](db[_0x50bb('0x5d')][_0x50bb('0x30')]);_0x409082[_0x50bb('0x34')]=_['keys'](_0x3ca1af[_0x50bb('0x34')]);_0x409082[_0x50bb('0x36')]=_[_0x50bb('0x37')](_0x409082[_0x50bb('0x33')],_0x409082[_0x50bb('0x34')]);_0x3d1839[_0x50bb('0x38')]=_[_0x50bb('0x37')](_0x409082[_0x50bb('0x33')],qs[_0x50bb('0x39')](_0x3ca1af['query']['fields']));_0x3d1839['attributes']=_0x3d1839[_0x50bb('0x38')]['length']?_0x3d1839['attributes']:_0x409082[_0x50bb('0x33')];_0x3d1839[_0x50bb('0x3c')]=qs[_0x50bb('0x3d')](_0x3ca1af[_0x50bb('0x34')]['sort']);_0x3d1839[_0x50bb('0x3e')]=qs[_0x50bb('0x36')](_['pick'](_0x3ca1af[_0x50bb('0x34')],_0x409082['filters']));if(_0x3ca1af[_0x50bb('0x34')][_0x50bb('0x41')]){_0x3d1839['where']=_[_0x50bb('0x42')](_0x3d1839['where'],{'$or':_[_0x50bb('0x2e')](_0x3d1839[_0x50bb('0x38')],function(_0x5aa043){var _0x3e22ea={};_0x3e22ea[_0x5aa043]={'$like':'%'+_0x3ca1af[_0x50bb('0x34')][_0x50bb('0x41')]+'%'};return _0x3e22ea;})});}_0x3d1839=_['merge']({},_0x3d1839,_0x3ca1af[_0x50bb('0x4c')]);return _0x2d648f[_0x50bb('0x5c')](_0x3d1839);}})[_0x50bb('0x28')](function(_0x31a583){if(_0x31a583){_0x9b8281=_0x31a583['length'];if(!_0x3ca1af[_0x50bb('0x34')][_0x50bb('0x3a')]('nolimit')){_0x3d1839['limit']=qs[_0x50bb('0x22')](_0x3ca1af[_0x50bb('0x34')]['limit']);_0x3d1839[_0x50bb('0x21')]=qs[_0x50bb('0x21')](_0x3ca1af[_0x50bb('0x34')][_0x50bb('0x21')]);}return _0x2d648f[_0x50bb('0x5c')](_0x3d1839);}})['then'](function(_0x480163){if(_0x480163){return _0x480163?{'count':_0x9b8281,'rows':_0x480163}:null;}})[_0x50bb('0x28')](respondWithResult(_0x4fc75c,null))[_0x50bb('0x48')](handleError(_0x4fc75c,null));}; \ No newline at end of file +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 diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index a8f30a2..b5eb46b 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 _0x3009=['hasOwnProperty','hook','events','../../mysqldb','SquareProject','setMaxListeners','save','emit'];(function(_0x504f08,_0x1186c2){var _0x4053be=function(_0x58ed12){while(--_0x58ed12){_0x504f08['push'](_0x504f08['shift']());}};_0x4053be(++_0x1186c2);}(_0x3009,0x152));var _0x9300=function(_0x197c74,_0x1713dc){_0x197c74=_0x197c74-0x0;var _0x282bea=_0x3009[_0x197c74];return _0x282bea;};'use strict';var EventEmitter=require(_0x9300('0x0'));var SquareProject=require(_0x9300('0x1'))['db'][_0x9300('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x9300('0x3')](0x0);var events={'afterCreate':_0x9300('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x574bae){return function(_0x2cdf09,_0x15d221,_0x3b0fa8){SquareProjectEvents[_0x9300('0x5')](_0x574bae+':'+_0x2cdf09['id'],_0x2cdf09);SquareProjectEvents[_0x9300('0x5')](_0x574bae,_0x2cdf09);_0x3b0fa8(null);};}for(var e in events){if(events[_0x9300('0x6')](e)){var event=events[e];SquareProject[_0x9300('0x7')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +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 diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 2bd89e7..05a7513 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 _0xc3e0=['./squareProject.attributes','exports','define','SquareProject','square_projects','lodash','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x39a64b,_0x488d76){var _0x6e75da=function(_0x37c967){while(--_0x37c967){_0x39a64b['push'](_0x39a64b['shift']());}};_0x6e75da(++_0x488d76);}(_0xc3e0,0x68));var _0x0c3e=function(_0x5266a1,_0x41d483){_0x5266a1=_0x5266a1-0x0;var _0x35ea75=_0xc3e0[_0x5266a1];return _0x35ea75;};'use strict';var _=require(_0x0c3e('0x0'));var util=require('util');var logger=require(_0x0c3e('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0c3e('0x2'));var rp=require(_0x0c3e('0x3'));var fs=require('fs');var path=require(_0x0c3e('0x4'));var rimraf=require(_0x0c3e('0x5'));var config=require('../../config/environment');var attributes=require(_0x0c3e('0x6'));module[_0x0c3e('0x7')]=function(_0x147d01,_0x332835){return _0x147d01[_0x0c3e('0x8')](_0x0c3e('0x9'),attributes,{'tableName':_0x0c3e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 4cff71a..a4a0f4b 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 _0xb7a0=['model','then','ShowSquareProject','debug','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','request','info','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareProject,\x20%s,\x20%s','message','result','SquareProject','find','options','raw','where','attributes','map','include'];(function(_0xbc6731,_0x2b0ef7){var _0x32deca=function(_0x34adad){while(--_0x34adad){_0xbc6731['push'](_0xbc6731['shift']());}};_0x32deca(++_0x2b0ef7);}(_0xb7a0,0xfb));var _0x0b7a=function(_0x89a0e4,_0x3783c9){_0x89a0e4=_0x89a0e4-0x0;var _0x5e5a3b=_0xb7a0[_0x89a0e4];return _0x5e5a3b;};'use strict';var _=require('lodash');var util=require(_0x0b7a('0x0'));var moment=require(_0x0b7a('0x1'));var BPromise=require(_0x0b7a('0x2'));var rs=require(_0x0b7a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b7a('0x4'))['db'];var utils=require(_0x0b7a('0x5'));var logger=require(_0x0b7a('0x6'))(_0x0b7a('0x7'));var config=require(_0x0b7a('0x8'));var jayson=require(_0x0b7a('0x9'));var client=jayson[_0x0b7a('0xa')][_0x0b7a('0xb')]({'port':0x232a});config[_0x0b7a('0xc')]=_[_0x0b7a('0xd')](config[_0x0b7a('0xc')],{'host':_0x0b7a('0xe'),'port':0x18eb});var socket=require(_0x0b7a('0xf'))(new Redis(config['redis']));require(_0x0b7a('0x10'))[_0x0b7a('0x11')](socket);function respondWithRpcPromise(_0x2ed99e,_0x109278,_0x2c4431){return new BPromise(function(_0x54a547,_0x161349){return client[_0x0b7a('0x12')](_0x2ed99e,_0x2c4431)['then'](function(_0x4f678e){logger[_0x0b7a('0x13')]('SquareProject,\x20%s,\x20%s',_0x109278,_0x0b7a('0x14'));logger['debug'](_0x0b7a('0x15'),_0x109278,_0x0b7a('0x14'),JSON[_0x0b7a('0x16')](_0x4f678e));if(_0x4f678e[_0x0b7a('0x17')]){if(_0x4f678e[_0x0b7a('0x17')][_0x0b7a('0x18')]===0x1f4){logger[_0x0b7a('0x17')](_0x0b7a('0x19'),_0x109278,_0x4f678e[_0x0b7a('0x17')][_0x0b7a('0x1a')]);return _0x161349(_0x4f678e['error'][_0x0b7a('0x1a')]);}logger[_0x0b7a('0x17')](_0x0b7a('0x19'),_0x109278,_0x4f678e[_0x0b7a('0x17')][_0x0b7a('0x1a')]);return _0x54a547(_0x4f678e[_0x0b7a('0x17')]['message']);}else{logger[_0x0b7a('0x13')](_0x0b7a('0x19'),_0x109278,_0x0b7a('0x14'));_0x54a547(_0x4f678e[_0x0b7a('0x1b')][_0x0b7a('0x1a')]);}})['catch'](function(_0x47c854){logger[_0x0b7a('0x17')](_0x0b7a('0x19'),_0x109278,_0x47c854);_0x161349(_0x47c854);});});}exports['ShowSquareProject']=function(_0x3293cb){var _0x2b5430=this;return new Promise(function(_0x53b802,_0x546539){return db[_0x0b7a('0x1c')][_0x0b7a('0x1d')]({'raw':_0x3293cb[_0x0b7a('0x1e')]?_0x3293cb[_0x0b7a('0x1e')][_0x0b7a('0x1f')]===undefined?!![]:![]:!![],'where':_0x3293cb[_0x0b7a('0x1e')]?_0x3293cb['options'][_0x0b7a('0x20')]||null:null,'attributes':_0x3293cb[_0x0b7a('0x1e')]?_0x3293cb[_0x0b7a('0x1e')][_0x0b7a('0x21')]||null:null,'include':_0x3293cb['options']?_0x3293cb[_0x0b7a('0x1e')]['include']?_[_0x0b7a('0x22')](_0x3293cb[_0x0b7a('0x1e')][_0x0b7a('0x23')],function(_0x218601){return{'model':db[_0x218601[_0x0b7a('0x24')]],'as':_0x218601['as'],'attributes':_0x218601[_0x0b7a('0x21')],'include':_0x218601['include']?_['map'](_0x218601['include'],function(_0xe980fc){return{'model':db[_0xe980fc[_0x0b7a('0x24')]],'as':_0xe980fc['as'],'attributes':_0xe980fc['attributes'],'include':_0xe980fc[_0x0b7a('0x23')]?_[_0x0b7a('0x22')](_0xe980fc['include'],function(_0x134b1a){return{'model':db[_0x134b1a['model']],'as':_0x134b1a['as'],'attributes':_0x134b1a['attributes']};}):[]};}):[]};}):[]:[]})[_0x0b7a('0x25')](function(_0x5826cd){logger['info'](_0x0b7a('0x26'),_0x3293cb);logger[_0x0b7a('0x27')](_0x0b7a('0x26'),_0x3293cb,JSON['stringify'](_0x5826cd));_0x53b802(_0x5826cd);})[_0x0b7a('0x28')](function(_0x211db1){logger['error'](_0x0b7a('0x26'),_0x211db1[_0x0b7a('0x1a')],_0x3293cb);_0x546539(_0x2b5430[_0x0b7a('0x17')](0x1f4,_0x211db1['message']));});});}; \ No newline at end of file +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 diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 7fc50ba..9be8e05 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 _0x1883=['./squareProject.events','save','remove','update','emit','removeListener','register','length','squareProject:'];(function(_0x27cea0,_0x3626d4){var _0x361084=function(_0x37325b){while(--_0x37325b){_0x27cea0['push'](_0x27cea0['shift']());}};_0x361084(++_0x3626d4);}(_0x1883,0xab));var _0x3188=function(_0x5e56e3,_0xf9b2a7){_0x5e56e3=_0x5e56e3-0x0;var _0x4bd80f=_0x1883[_0x5e56e3];return _0x4bd80f;};'use strict';var SquareProjectEvents=require(_0x3188('0x0'));var events=[_0x3188('0x1'),_0x3188('0x2'),_0x3188('0x3')];function createListener(_0x11e3bf,_0x7ce655){return function(_0x2551e5){_0x7ce655[_0x3188('0x4')](_0x11e3bf,_0x2551e5);};}function removeListener(_0x1c7c86,_0x44afb8){return function(){SquareProjectEvents[_0x3188('0x5')](_0x1c7c86,_0x44afb8);};}exports[_0x3188('0x6')]=function(_0x408ae0){for(var _0x33b62d=0x0,_0x24f2f1=events[_0x3188('0x7')];_0x33b62d<_0x24f2f1;_0x33b62d++){var _0x3e3afb=events[_0x33b62d];var _0x5c8f26=createListener(_0x3188('0x8')+_0x3e3afb,_0x408ae0);SquareProjectEvents['on'](_0x3e3afb,_0x5c8f26);}}; \ No newline at end of file +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 diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 3f9db74..31ef60f 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 _0xeec5=['/:id','update','delete','/:id/delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','show','post','create','put'];(function(_0x39c8f2,_0x23df6c){var _0x445526=function(_0x56376c){while(--_0x56376c){_0x39c8f2['push'](_0x39c8f2['shift']());}};_0x445526(++_0x23df6c);}(_0xeec5,0x1a4));var _0x5eec=function(_0x452ffc,_0x47114a){_0x452ffc=_0x452ffc-0x0;var _0x4c9629=_0xeec5[_0x452ffc];return _0x4c9629;};'use strict';var multer=require(_0x5eec('0x0'));var util=require(_0x5eec('0x1'));var path=require(_0x5eec('0x2'));var timeout=require(_0x5eec('0x3'));var express=require(_0x5eec('0x4'));var router=express[_0x5eec('0x5')]();var auth=require(_0x5eec('0x6'));var interaction=require(_0x5eec('0x7'));var config=require(_0x5eec('0x8'));var controller=require(_0x5eec('0x9'));router[_0x5eec('0xa')]('/',auth[_0x5eec('0xb')](),controller[_0x5eec('0xc')]);router[_0x5eec('0xa')]('/:id',auth[_0x5eec('0xb')](),controller[_0x5eec('0xd')]);router[_0x5eec('0xa')]('/:id/download',auth[_0x5eec('0xb')](),controller['download']);router[_0x5eec('0xe')]('/',auth[_0x5eec('0xb')](),controller[_0x5eec('0xf')]);router[_0x5eec('0x10')](_0x5eec('0x11'),auth[_0x5eec('0xb')](),controller[_0x5eec('0x12')]);router[_0x5eec('0x13')](_0x5eec('0x14'),auth[_0x5eec('0xb')](),controller[_0x5eec('0x15')]);module[_0x5eec('0x16')]=router; \ No newline at end of file +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 diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 8a2fa5e..3416296 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 _0x80e6=['getDataValue','savePath','substring','lastIndexOf','exports','STRING','VIRTUAL'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x80e6,0x1e7));var _0x680e=function(_0xa3f4fd,_0x167410){_0xa3f4fd=_0xa3f4fd-0x0;var _0xf51c=_0x80e6[_0xa3f4fd];return _0xf51c;};'use strict';var Sequelize=require('sequelize');module[_0x680e('0x0')]={'uniqueid':{'type':Sequelize[_0x680e('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x680e('0x1')]},'context':{'type':Sequelize[_0x680e('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x680e('0x1')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x680e('0x1')]},'projectName':{'type':Sequelize[_0x680e('0x1')]},'saveName':{'type':Sequelize[_0x680e('0x1')]},'filename':{'type':Sequelize[_0x680e('0x1')]},'savePath':{'type':Sequelize[_0x680e('0x1')]},'format':{'type':Sequelize[_0x680e('0x2')],'get':function(){var _0xd5da80='';var _0x2026f7=this[_0x680e('0x3')](_0x680e('0x4'));if(_0x2026f7){_0xd5da80=_0x2026f7[_0x680e('0x5')](_0x2026f7[_0x680e('0x6')]('.'));}return _0xd5da80;}}}; \ No newline at end of file +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 diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 0d0dc58..47d71a5 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 _0x4d3a=['params','keys','options','create','body','find','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','destroy','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','count','offset','set','reject','save','update','then','sendStatus','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch'];(function(_0xf89105,_0xb124c2){var _0x60eeac=function(_0x1e9913){while(--_0x1e9913){_0xf89105['push'](_0xf89105['shift']());}};_0x60eeac(++_0xb124c2);}(_0x4d3a,0x80));var _0xa4d3=function(_0x23b57c,_0xdc7f98){_0x23b57c=_0x23b57c-0x0;var _0x4c3b1d=_0x4d3a[_0x23b57c];return _0x4c3b1d;};'use strict';var pdf=require(_0xa4d3('0x0'));var emlformat=require(_0xa4d3('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa4d3('0x2'));var rp=require(_0xa4d3('0x3'));var moment=require(_0xa4d3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa4d3('0x5'));var util=require(_0xa4d3('0x6'));var path=require(_0xa4d3('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa4d3('0x8'));var fs=require('fs');var _=require(_0xa4d3('0x9'));var squel=require('squel');var crypto=require(_0xa4d3('0xa'));var jsforce=require(_0xa4d3('0xb'));var deskjs=require(_0xa4d3('0xc'));var toCsv=require(_0xa4d3('0xd'));var querystring=require(_0xa4d3('0xe'));var Papa=require(_0xa4d3('0xf'));var Redis=require(_0xa4d3('0x10'));var authService=require(_0xa4d3('0x11'));var qs=require(_0xa4d3('0x12'));var as=require(_0xa4d3('0x13'));var hardwareService=require(_0xa4d3('0x14'));var logger=require(_0xa4d3('0x15'))(_0xa4d3('0x16'));var utils=require(_0xa4d3('0x17'));var config=require('../../config/environment');var db=require(_0xa4d3('0x18'))['db'];function respondWithStatusCode(_0x44b147,_0x3f634f){_0x3f634f=_0x3f634f||0xcc;return function(_0x349d3b){if(_0x349d3b){return _0x44b147['sendStatus'](_0x3f634f);}return _0x44b147[_0xa4d3('0x19')](_0x3f634f)[_0xa4d3('0x1a')]();};}function respondWithResult(_0x161e4e,_0x3a91be){_0x3a91be=_0x3a91be||0xc8;return function(_0x236d73){if(_0x236d73){return _0x161e4e['status'](_0x3a91be)['json'](_0x236d73);}};}function respondWithFilteredResult(_0x3c095c,_0x77c8f1){return function(_0x1c139f){if(_0x1c139f){var _0x475329=_0x1c139f[_0xa4d3('0x1b')],_0x4e738e=_0x77c8f1['offset'],_0x593cfa=_0x77c8f1[_0xa4d3('0x1c')]+_0x77c8f1['limit'],_0x32bf03;if(_0x593cfa>=_0x475329){_0x593cfa=_0x475329;_0x32bf03=0xc8;}else{_0x32bf03=0xce;}_0x3c095c[_0xa4d3('0x19')](_0x32bf03);return _0x3c095c[_0xa4d3('0x1d')]('Content-Range',_0x4e738e+'-'+_0x593cfa+'/'+_0x475329)['json'](_0x1c139f);}return null;};}function patchUpdates(_0x51cc56){return function(_0x4c658e){try{jsonpatch['apply'](_0x4c658e,_0x51cc56,!![]);}catch(_0x409e03){return BPromise[_0xa4d3('0x1e')](_0x409e03);}return _0x4c658e[_0xa4d3('0x1f')]();};}function saveUpdates(_0x497a59,_0x15a089){return function(_0x212bd5){if(_0x212bd5){return _0x212bd5[_0xa4d3('0x20')](_0x497a59)['then'](function(_0x2d0578){return _0x2d0578;});}return null;};}function removeEntity(_0x4691bf,_0x3b7e27){return function(_0x1a06ad){if(_0x1a06ad){return _0x1a06ad['destroy']()[_0xa4d3('0x21')](function(){_0x4691bf[_0xa4d3('0x19')](0xcc)[_0xa4d3('0x1a')]();});}};}function handleEntityNotFound(_0x3ebcf7,_0x1b5003){return function(_0x3305d2){if(!_0x3305d2){_0x3ebcf7[_0xa4d3('0x22')](0x194);}return _0x3305d2;};}function handleError(_0x3137b7,_0x4bcd3e){_0x4bcd3e=_0x4bcd3e||0x1f4;return function(_0x1ea224){logger[_0xa4d3('0x23')](_0x1ea224[_0xa4d3('0x24')]);if(_0x1ea224[_0xa4d3('0x25')]){delete _0x1ea224[_0xa4d3('0x25')];}_0x3137b7['status'](_0x4bcd3e)[_0xa4d3('0x26')](_0x1ea224);};}exports[_0xa4d3('0x27')]=function(_0x136d9b,_0x22361f){var _0x869f30={},_0x2026bc={},_0xdb70e9={'count':0x0,'rows':[]};var _0x29913a=_[_0xa4d3('0x28')](db[_0xa4d3('0x29')][_0xa4d3('0x2a')],function(_0x350a62){return{'name':_0x350a62[_0xa4d3('0x2b')],'type':_0x350a62[_0xa4d3('0x2c')][_0xa4d3('0x2d')]};});_0x2026bc['model']=_[_0xa4d3('0x28')](_0x29913a,_0xa4d3('0x25'));_0x2026bc[_0xa4d3('0x2e')]=_['keys'](_0x136d9b[_0xa4d3('0x2e')]);_0x2026bc[_0xa4d3('0x2f')]=_[_0xa4d3('0x30')](_0x2026bc[_0xa4d3('0x31')],_0x2026bc[_0xa4d3('0x2e')]);_0x869f30[_0xa4d3('0x32')]=_[_0xa4d3('0x30')](_0x2026bc[_0xa4d3('0x31')],qs[_0xa4d3('0x33')](_0x136d9b[_0xa4d3('0x2e')][_0xa4d3('0x33')]));_0x869f30['attributes']=_0x869f30[_0xa4d3('0x32')][_0xa4d3('0x34')]?_0x869f30[_0xa4d3('0x32')]:_0x2026bc[_0xa4d3('0x31')];if(!_0x136d9b[_0xa4d3('0x2e')][_0xa4d3('0x35')](_0xa4d3('0x36'))){_0x869f30['limit']=qs['limit'](_0x136d9b[_0xa4d3('0x2e')]['limit']);_0x869f30[_0xa4d3('0x1c')]=qs['offset'](_0x136d9b['query'][_0xa4d3('0x1c')]);}_0x869f30[_0xa4d3('0x37')]=qs[_0xa4d3('0x38')](_0x136d9b[_0xa4d3('0x2e')][_0xa4d3('0x38')]);_0x869f30[_0xa4d3('0x39')]=qs['filters'](_[_0xa4d3('0x3a')](_0x136d9b['query'],_0x2026bc[_0xa4d3('0x2f')]));if(_0x136d9b[_0xa4d3('0x2e')][_0xa4d3('0x3b')]){_0x869f30[_0xa4d3('0x39')]=_['merge'](_0x869f30[_0xa4d3('0x39')],{'$or':_['map'](_0x29913a,function(_0x17e069){if(_0x17e069['type']!=='VIRTUAL'){var _0x3552d7={};_0x3552d7[_0x17e069[_0xa4d3('0x25')]]={'$like':'%'+_0x136d9b[_0xa4d3('0x2e')][_0xa4d3('0x3b')]+'%'};return _0x3552d7;}})});}_0x869f30=_[_0xa4d3('0x3c')]({},_0x869f30,_0x136d9b['options']);var _0x4795b9={'where':_0x869f30[_0xa4d3('0x39')]};return db[_0xa4d3('0x29')][_0xa4d3('0x1b')](_0x4795b9)['then'](function(_0x1b278b){_0xdb70e9[_0xa4d3('0x1b')]=_0x1b278b;if(_0x136d9b[_0xa4d3('0x2e')][_0xa4d3('0x3d')]){_0x869f30[_0xa4d3('0x3e')]=[{'all':!![]}];}return db[_0xa4d3('0x29')][_0xa4d3('0x3f')](_0x869f30);})[_0xa4d3('0x21')](function(_0x4432d7){_0xdb70e9[_0xa4d3('0x40')]=_0x4432d7;return _0xdb70e9;})[_0xa4d3('0x21')](respondWithFilteredResult(_0x22361f,_0x869f30))[_0xa4d3('0x41')](handleError(_0x22361f,null));};exports['show']=function(_0x179d7c,_0x2c7374){var _0x1e5a1b={'raw':!![],'where':{'id':_0x179d7c[_0xa4d3('0x42')]['id']}},_0x4dcb49={};_0x4dcb49[_0xa4d3('0x31')]=_[_0xa4d3('0x43')](db[_0xa4d3('0x29')][_0xa4d3('0x2a')]);_0x4dcb49[_0xa4d3('0x2e')]=_[_0xa4d3('0x43')](_0x179d7c[_0xa4d3('0x2e')]);_0x4dcb49['filters']=_[_0xa4d3('0x30')](_0x4dcb49['model'],_0x4dcb49['query']);_0x1e5a1b[_0xa4d3('0x32')]=_['intersection'](_0x4dcb49['model'],qs[_0xa4d3('0x33')](_0x179d7c['query'][_0xa4d3('0x33')]));_0x1e5a1b[_0xa4d3('0x32')]=_0x1e5a1b['attributes'][_0xa4d3('0x34')]?_0x1e5a1b['attributes']:_0x4dcb49[_0xa4d3('0x31')];if(_0x179d7c['query'][_0xa4d3('0x3d')]){_0x1e5a1b[_0xa4d3('0x3e')]=[{'all':!![]}];}_0x1e5a1b=_[_0xa4d3('0x3c')]({},_0x1e5a1b,_0x179d7c[_0xa4d3('0x44')]);return db[_0xa4d3('0x29')]['find'](_0x1e5a1b)[_0xa4d3('0x21')](handleEntityNotFound(_0x2c7374,null))['then'](respondWithResult(_0x2c7374,null))['catch'](handleError(_0x2c7374,null));};exports[_0xa4d3('0x45')]=function(_0x2d116b,_0x322a5e){return db[_0xa4d3('0x29')]['create'](_0x2d116b[_0xa4d3('0x46')],{})['then'](respondWithResult(_0x322a5e,0xc9))[_0xa4d3('0x41')](handleError(_0x322a5e,null));};exports['update']=function(_0x2aaa2b,_0x34d644){if(_0x2aaa2b[_0xa4d3('0x46')]['id']){delete _0x2aaa2b[_0xa4d3('0x46')]['id'];}return db[_0xa4d3('0x29')][_0xa4d3('0x47')]({'where':{'id':_0x2aaa2b['params']['id']}})['then'](handleEntityNotFound(_0x34d644,null))['then'](saveUpdates(_0x2aaa2b[_0xa4d3('0x46')],null))[_0xa4d3('0x21')](respondWithResult(_0x34d644,null))[_0xa4d3('0x41')](handleError(_0x34d644,null));};exports[_0xa4d3('0x48')]=function(_0x11f93d,_0x3e043c,_0x26f2a9){var _0xae1e34=require(_0xa4d3('0x49'));var _0x8fca=![];var _0xa0c979={};if(_0x11f93d[_0xa4d3('0x2e')]['type']&&_0x11f93d[_0xa4d3('0x2e')][_0xa4d3('0x2c')]===_0xa4d3('0x4a')){_0xa0c979['uniqueid']=_0x11f93d[_0xa4d3('0x42')]['id'];}else{_0xa0c979['id']=_0x11f93d[_0xa4d3('0x42')]['id'];}return db[_0xa4d3('0x29')][_0xa4d3('0x47')]({'where':_0xa0c979,'attributes':['id',_0xa4d3('0x4b'),_0xa4d3('0x4c')],'raw':!![]})[_0xa4d3('0x21')](handleEntityNotFound(_0x3e043c,null))[_0xa4d3('0x21')](function(_0x355851){if(_0x355851){var _0x4d2b3d=_0x355851['savePath'];var _0x6cbf93=util[_0xa4d3('0x4d')](_0xa4d3('0x4e'),_0x4d2b3d);if(fs[_0xa4d3('0x4f')](_0x6cbf93)){_0x8fca=!![];return _0xae1e34[_0xa4d3('0x50')](_0x6cbf93,_0x4d2b3d,config['secrets']['recording'])[_0xa4d3('0x21')](function(){return _0x355851;});}return _0x355851;}})[_0xa4d3('0x21')](function(_0x55049d){if(_0x55049d){var _0x31d466=_0x55049d['savePath'];if(!fs['existsSync'](_0x31d466)){throw new db[(_0xa4d3('0x51'))][(_0xa4d3('0x52'))](_0xa4d3('0x53'));}if(_0x55049d[_0xa4d3('0x4c')]){return _0x3e043c['download'](_0x31d466,_0x55049d[_0xa4d3('0x4c')]+path[_0xa4d3('0x54')](_0x31d466),function(){if(_0x8fca){fs[_0xa4d3('0x55')](_0x31d466);}});}else{return _0x3e043c[_0xa4d3('0x48')](_0x31d466,function(_0x240474){if(_0x8fca){fs['unlink'](_0x31d466);}});}}})[_0xa4d3('0x41')](function(_0x24bf87){if(_0x24bf87[_0xa4d3('0x56')]===_0xa4d3('0x53')){_0x3e043c[_0xa4d3('0x19')](0x194)[_0xa4d3('0x26')](_0xa4d3('0x57'));}else{return handleError(_0x3e043c,null);}});};exports['destroy']=function(_0x134b2b,_0x4426ff){return db[_0xa4d3('0x29')][_0xa4d3('0x47')]({'where':{'id':_0x134b2b[_0xa4d3('0x42')]['id']}})[_0xa4d3('0x21')](function(_0x396b06){if(!_0x396b06)throw new ReferenceError(_0xa4d3('0x58'));return _0x396b06;})['then'](function(_0x1bb4e0){var _0x12d636=_0x1bb4e0[_0xa4d3('0x4b')];logger[_0xa4d3('0x59')](_0xa4d3('0x5a'),_0x12d636);if(!_[_0xa4d3('0x5b')](_0x1bb4e0['savePath'])&&fs[_0xa4d3('0x4f')](_0x12d636)){logger[_0xa4d3('0x59')](_0xa4d3('0x5c')+_0x12d636+_0xa4d3('0x5d'));fs[_0xa4d3('0x5e')](_0x12d636);}_0x12d636=_0x12d636+_0xa4d3('0x5f');if(!_[_0xa4d3('0x5b')](_0x1bb4e0[_0xa4d3('0x4b')])&&fs[_0xa4d3('0x4f')](_0x12d636)){logger[_0xa4d3('0x59')](_0xa4d3('0x5c')+_0x12d636+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x12d636);}return _0x1bb4e0;})[_0xa4d3('0x21')](function(_0x560879){if(!_0x560879)throw new InternalError();return _0x560879[_0xa4d3('0x60')]();})[_0xa4d3('0x21')](function(){_0x4426ff['status'](0xcc)[_0xa4d3('0x1a')]();})[_0xa4d3('0x41')](handleError(_0x4426ff,null));}; \ No newline at end of file +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 diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index db6f666..b7307cb 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 _0x68b7=['request-promise','path','rimraf','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','../../config/logger','api','moment'];(function(_0x1cf30d,_0x9fdd8f){var _0x45ea5d=function(_0x2b14f1){while(--_0x2b14f1){_0x1cf30d['push'](_0x1cf30d['shift']());}};_0x45ea5d(++_0x9fdd8f);}(_0x68b7,0x8c));var _0x768b=function(_0x4e3079,_0x2e48ea){_0x4e3079=_0x4e3079-0x0;var _0x4356fb=_0x68b7[_0x4e3079];return _0x4356fb;};'use strict';var _=require(_0x768b('0x0'));var util=require('util');var logger=require(_0x768b('0x1'))(_0x768b('0x2'));var moment=require(_0x768b('0x3'));var BPromise=require('bluebird');var rp=require(_0x768b('0x4'));var fs=require('fs');var path=require(_0x768b('0x5'));var rimraf=require(_0x768b('0x6'));var config=require('../../config/environment');var attributes=require(_0x768b('0x7'));module[_0x768b('0x8')]=function(_0x18aaaa,_0x31aba4){return _0x18aaaa[_0x768b('0x9')](_0x768b('0xa'),attributes,{'tableName':_0x768b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index bc61a39..d59d2f3 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 _0x2200=['SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','catch','SquareRecording','body','options','raw','CreateSquareRecording','stringify','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','then','info'];(function(_0x3933a4,_0x259cc7){var _0x133c51=function(_0x34cec9){while(--_0x34cec9){_0x3933a4['push'](_0x3933a4['shift']());}};_0x133c51(++_0x259cc7);}(_0x2200,0x1d0));var _0x0220=function(_0x1cd674,_0x8d3638){_0x1cd674=_0x1cd674-0x0;var _0x27928f=_0x2200[_0x1cd674];return _0x27928f;};'use strict';var _=require(_0x0220('0x0'));var util=require('util');var moment=require(_0x0220('0x1'));var BPromise=require(_0x0220('0x2'));var rs=require(_0x0220('0x3'));var fs=require('fs');var Redis=require(_0x0220('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0220('0x5'));var logger=require(_0x0220('0x6'))(_0x0220('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0220('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ae000,_0x3e36a1,_0xf00567){return new BPromise(function(_0x495df6,_0x125e16){return client['request'](_0x4ae000,_0xf00567)[_0x0220('0x9')](function(_0x439924){logger[_0x0220('0xa')](_0x0220('0xb'),_0x3e36a1,_0x0220('0xc'));logger[_0x0220('0xd')](_0x0220('0xe'),_0x3e36a1,_0x0220('0xc'),JSON['stringify'](_0x439924));if(_0x439924[_0x0220('0xf')]){if(_0x439924[_0x0220('0xf')][_0x0220('0x10')]===0x1f4){logger[_0x0220('0xf')](_0x0220('0xb'),_0x3e36a1,_0x439924[_0x0220('0xf')]['message']);return _0x125e16(_0x439924[_0x0220('0xf')][_0x0220('0x11')]);}logger[_0x0220('0xf')](_0x0220('0xb'),_0x3e36a1,_0x439924[_0x0220('0xf')][_0x0220('0x11')]);return _0x495df6(_0x439924[_0x0220('0xf')][_0x0220('0x11')]);}else{logger[_0x0220('0xa')]('SquareRecording,\x20%s,\x20%s',_0x3e36a1,'request\x20sent');_0x495df6(_0x439924['result'][_0x0220('0x11')]);}})[_0x0220('0x12')](function(_0x29f9e7){logger['error'](_0x0220('0xb'),_0x3e36a1,_0x29f9e7);_0x125e16(_0x29f9e7);});});}exports['CreateSquareRecording']=function(_0x233acd){var _0x35bed9=this;return new Promise(function(_0x594469,_0x3e8385){return db[_0x0220('0x13')]['create'](_0x233acd[_0x0220('0x14')],{'raw':_0x233acd[_0x0220('0x15')]?_0x233acd[_0x0220('0x15')][_0x0220('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x417735){logger[_0x0220('0xa')]('CreateSquareRecording',_0x233acd);logger[_0x0220('0xd')](_0x0220('0x17'),_0x233acd,JSON[_0x0220('0x18')](_0x417735));_0x594469(_0x417735);})[_0x0220('0x12')](function(_0xae162){logger[_0x0220('0xf')](_0x0220('0x17'),_0xae162[_0x0220('0x11')],_0x233acd);_0x3e8385(_0x35bed9[_0x0220('0xf')](0x1f4,_0xae162[_0x0220('0x11')]));});});}; \ No newline at end of file +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 diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 3f1836e..d7115af 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 _0x0437=['path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','/describe','/:id','show','post','create','put','update','delete','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0437,0x1e4));var _0x7043=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x0437[_0x2070da];return _0x4f9fe1;};'use strict';var multer=require(_0x7043('0x0'));var util=require(_0x7043('0x1'));var path=require(_0x7043('0x2'));var timeout=require('connect-timeout');var express=require(_0x7043('0x3'));var router=express['Router']();var auth=require(_0x7043('0x4'));var interaction=require(_0x7043('0x5'));var config=require(_0x7043('0x6'));var controller=require(_0x7043('0x7'));router[_0x7043('0x8')]('/',auth[_0x7043('0x9')](),controller['index']);router[_0x7043('0x8')](_0x7043('0xa'),auth[_0x7043('0x9')](),controller['describe']);router['get'](_0x7043('0xb'),auth['isAuthenticated'](),controller[_0x7043('0xc')]);router[_0x7043('0xd')]('/',auth['isAuthenticated'](),controller[_0x7043('0xe')]);router[_0x7043('0xf')](_0x7043('0xb'),auth[_0x7043('0x9')](),controller[_0x7043('0x10')]);router[_0x7043('0x11')]('/:id',auth[_0x7043('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index ee69f17..a7a02bc 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 _0x6b56=['sequelize','exports','STRING','DATE'];(function(_0x54ab99,_0x384067){var _0x32e40b=function(_0x54cb58){while(--_0x54cb58){_0x54ab99['push'](_0x54ab99['shift']());}};_0x32e40b(++_0x384067);}(_0x6b56,0x7c));var _0x66b5=function(_0xdd45,_0x2daf10){_0xdd45=_0xdd45-0x0;var _0x106736=_0x6b56[_0xdd45];return _0x106736;};'use strict';var Sequelize=require(_0x66b5('0x0'));module[_0x66b5('0x1')]={'network':{'type':Sequelize[_0x66b5('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x66b5('0x2')]},'language':{'type':Sequelize[_0x66b5('0x2')]},'type':{'type':Sequelize[_0x66b5('0x2')]},'uniqueid':{'type':Sequelize[_0x66b5('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x66b5('0x2')]},'calleridname':{'type':Sequelize[_0x66b5('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x66b5('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x66b5('0x2')]},'dnid':{'type':Sequelize[_0x66b5('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x66b5('0x2')]},'priority':{'type':Sequelize[_0x66b5('0x2')]},'enhanced':{'type':Sequelize[_0x66b5('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x66b5('0x2')]},'project_name':{'type':Sequelize[_0x66b5('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x66b5('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +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 diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 7bc4ea4..dd3c373 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 _0x7217=['type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','create','body','find','params','describe','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','sendStatus','end','json','count','offset','status','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName'];(function(_0x297ff7,_0x3cd1b9){var _0x357e34=function(_0xc24bc6){while(--_0xc24bc6){_0x297ff7['push'](_0x297ff7['shift']());}};_0x357e34(++_0x3cd1b9);}(_0x7217,0x19e));var _0x7721=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0x7217[_0x9aada2];return _0x196dff;};'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'];function respondWithStatusCode(_0x27b36b,_0x55b4ca){_0x55b4ca=_0x55b4ca||0xcc;return function(_0x2911ec){if(_0x2911ec){return _0x27b36b[_0x7721('0x1b')](_0x55b4ca);}return _0x27b36b['status'](_0x55b4ca)[_0x7721('0x1c')]();};}function respondWithResult(_0x30da54,_0x3f01c5){_0x3f01c5=_0x3f01c5||0xc8;return function(_0x2e9752){if(_0x2e9752){return _0x30da54['status'](_0x3f01c5)[_0x7721('0x1d')](_0x2e9752);}};}function respondWithFilteredResult(_0x25b1c0,_0x534f1b){return function(_0x4e199a){if(_0x4e199a){var _0x4b183e=_0x4e199a[_0x7721('0x1e')],_0x5ed54=_0x534f1b['offset'],_0x25a628=_0x534f1b[_0x7721('0x1f')]+_0x534f1b['limit'],_0x3cc909;if(_0x25a628>=_0x4b183e){_0x25a628=_0x4b183e;_0x3cc909=0xc8;}else{_0x3cc909=0xce;}_0x25b1c0[_0x7721('0x20')](_0x3cc909);return _0x25b1c0['set'](_0x7721('0x21'),_0x5ed54+'-'+_0x25a628+'/'+_0x4b183e)[_0x7721('0x1d')](_0x4e199a);}return null;};}function patchUpdates(_0x3ab5a5){return function(_0x3e140d){try{jsonpatch[_0x7721('0x22')](_0x3e140d,_0x3ab5a5,!![]);}catch(_0x40af90){return BPromise[_0x7721('0x23')](_0x40af90);}return _0x3e140d[_0x7721('0x24')]();};}function saveUpdates(_0x3b29ac,_0xaeccc4){return function(_0x4ce1db){if(_0x4ce1db){return _0x4ce1db[_0x7721('0x25')](_0x3b29ac)[_0x7721('0x26')](function(_0x3a053f){return _0x3a053f;});}return null;};}function removeEntity(_0xd8ad3c,_0x57140c){return function(_0x28f5a6){if(_0x28f5a6){return _0x28f5a6['destroy']()[_0x7721('0x26')](function(){_0xd8ad3c[_0x7721('0x20')](0xcc)[_0x7721('0x1c')]();});}};}function handleEntityNotFound(_0x1caad8,_0x121cc4){return function(_0x395b15){if(!_0x395b15){_0x1caad8[_0x7721('0x1b')](0x194);}return _0x395b15;};}function handleError(_0x5b4d74,_0x216f20){_0x216f20=_0x216f20||0x1f4;return function(_0x1abedb){logger[_0x7721('0x27')](_0x1abedb[_0x7721('0x28')]);if(_0x1abedb[_0x7721('0x29')]){delete _0x1abedb[_0x7721('0x29')];}_0x5b4d74[_0x7721('0x20')](_0x216f20)[_0x7721('0x2a')](_0x1abedb);};}exports[_0x7721('0x2b')]=function(_0x52316e,_0x258ddf){var _0x5b0551={},_0x499b87={},_0x315202={'count':0x0,'rows':[]};var _0x343c19=_[_0x7721('0x2c')](db[_0x7721('0x2d')][_0x7721('0x2e')],function(_0x37b9f0){return{'name':_0x37b9f0[_0x7721('0x2f')],'type':_0x37b9f0[_0x7721('0x30')]['key']};});_0x499b87[_0x7721('0x31')]=_[_0x7721('0x2c')](_0x343c19,'name');_0x499b87['query']=_[_0x7721('0x32')](_0x52316e[_0x7721('0x33')]);_0x499b87['filters']=_[_0x7721('0x34')](_0x499b87[_0x7721('0x31')],_0x499b87[_0x7721('0x33')]);_0x5b0551['attributes']=_[_0x7721('0x34')](_0x499b87[_0x7721('0x31')],qs[_0x7721('0x35')](_0x52316e[_0x7721('0x33')][_0x7721('0x35')]));_0x5b0551['attributes']=_0x5b0551[_0x7721('0x36')][_0x7721('0x37')]?_0x5b0551[_0x7721('0x36')]:_0x499b87['model'];if(!_0x52316e[_0x7721('0x33')][_0x7721('0x38')]('nolimit')){_0x5b0551[_0x7721('0x39')]=qs['limit'](_0x52316e[_0x7721('0x33')][_0x7721('0x39')]);_0x5b0551[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x52316e[_0x7721('0x33')][_0x7721('0x1f')]);}_0x5b0551[_0x7721('0x3a')]=qs[_0x7721('0x3b')](_0x52316e[_0x7721('0x33')][_0x7721('0x3b')]);_0x5b0551[_0x7721('0x3c')]=qs['filters'](_[_0x7721('0x3d')](_0x52316e['query'],_0x499b87[_0x7721('0x3e')]));if(_0x52316e[_0x7721('0x33')][_0x7721('0x3f')]){_0x5b0551[_0x7721('0x3c')]=_[_0x7721('0x40')](_0x5b0551[_0x7721('0x3c')],{'$or':_['map'](_0x343c19,function(_0x557c34){if(_0x557c34['type']!=='VIRTUAL'){var _0x18001c={};_0x18001c[_0x557c34[_0x7721('0x29')]]={'$like':'%'+_0x52316e[_0x7721('0x33')][_0x7721('0x3f')]+'%'};return _0x18001c;}})});}_0x5b0551=_['merge']({},_0x5b0551,_0x52316e[_0x7721('0x41')]);var _0x4cf659={'where':_0x5b0551[_0x7721('0x3c')]};return db[_0x7721('0x2d')]['count'](_0x4cf659)[_0x7721('0x26')](function(_0x3a47c8){_0x315202['count']=_0x3a47c8;if(_0x52316e['query'][_0x7721('0x42')]){_0x5b0551[_0x7721('0x43')]=[{'all':!![]}];}return db[_0x7721('0x2d')][_0x7721('0x44')](_0x5b0551);})['then'](function(_0x2db173){_0x315202[_0x7721('0x45')]=_0x2db173;return _0x315202;})[_0x7721('0x26')](respondWithFilteredResult(_0x258ddf,_0x5b0551))[_0x7721('0x46')](handleError(_0x258ddf,null));};exports[_0x7721('0x47')]=function(_0x52ab67,_0x490d4){var _0x4a2c28={'raw':!![],'where':{'id':_0x52ab67['params']['id']}},_0xaa3216={};_0xaa3216[_0x7721('0x31')]=_[_0x7721('0x32')](db[_0x7721('0x2d')]['rawAttributes']);_0xaa3216[_0x7721('0x33')]=_[_0x7721('0x32')](_0x52ab67[_0x7721('0x33')]);_0xaa3216['filters']=_[_0x7721('0x34')](_0xaa3216[_0x7721('0x31')],_0xaa3216[_0x7721('0x33')]);_0x4a2c28[_0x7721('0x36')]=_[_0x7721('0x34')](_0xaa3216[_0x7721('0x31')],qs[_0x7721('0x35')](_0x52ab67['query']['fields']));_0x4a2c28[_0x7721('0x36')]=_0x4a2c28[_0x7721('0x36')][_0x7721('0x37')]?_0x4a2c28[_0x7721('0x36')]:_0xaa3216[_0x7721('0x31')];if(_0x52ab67[_0x7721('0x33')][_0x7721('0x42')]){_0x4a2c28[_0x7721('0x43')]=[{'all':!![]}];}_0x4a2c28=_[_0x7721('0x40')]({},_0x4a2c28,_0x52ab67[_0x7721('0x41')]);return db['SquareReport']['find'](_0x4a2c28)[_0x7721('0x26')](handleEntityNotFound(_0x490d4,null))[_0x7721('0x26')](respondWithResult(_0x490d4,null))[_0x7721('0x46')](handleError(_0x490d4,null));};exports[_0x7721('0x48')]=function(_0x589e95,_0x30107e){return db[_0x7721('0x2d')]['create'](_0x589e95[_0x7721('0x49')],{})['then'](respondWithResult(_0x30107e,0xc9))[_0x7721('0x46')](handleError(_0x30107e,null));};exports['update']=function(_0x334f23,_0x196be4){if(_0x334f23[_0x7721('0x49')]['id']){delete _0x334f23['body']['id'];}return db[_0x7721('0x2d')][_0x7721('0x4a')]({'where':{'id':_0x334f23['params']['id']}})[_0x7721('0x26')](handleEntityNotFound(_0x196be4,null))[_0x7721('0x26')](saveUpdates(_0x334f23[_0x7721('0x49')],null))['then'](respondWithResult(_0x196be4,null))[_0x7721('0x46')](handleError(_0x196be4,null));};exports['destroy']=function(_0xdb1ca8,_0x310549){return db[_0x7721('0x2d')][_0x7721('0x4a')]({'where':{'id':_0xdb1ca8[_0x7721('0x4b')]['id']}})[_0x7721('0x26')](handleEntityNotFound(_0x310549,null))[_0x7721('0x26')](removeEntity(_0x310549,null))[_0x7721('0x46')](handleError(_0x310549,null));};exports[_0x7721('0x4c')]=function(_0x3386aa,_0x31770e){return db[_0x7721('0x2d')][_0x7721('0x4c')]()[_0x7721('0x26')](respondWithResult(_0x31770e,null))[_0x7721('0x46')](handleError(_0x31770e,null));}; \ No newline at end of file +var _0xe14b=['findAll','rows','catch','find','create','body','params','destroy','describe','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','update','then','error','stack','name','index','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 diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 09ea473..7c23b41 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 _0x7be0=['report_square','uid_pname','project_name','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareReport'];(function(_0x3a0ebd,_0x47f368){var _0x51a660=function(_0x4023e6){while(--_0x4023e6){_0x3a0ebd['push'](_0x3a0ebd['shift']());}};_0x51a660(++_0x47f368);}(_0x7be0,0xe4));var _0x07be=function(_0x235ce4,_0x560f69){_0x235ce4=_0x235ce4-0x0;var _0x38af92=_0x7be0[_0x235ce4];return _0x38af92;};'use strict';var _=require('lodash');var util=require(_0x07be('0x0'));var logger=require(_0x07be('0x1'))(_0x07be('0x2'));var moment=require(_0x07be('0x3'));var BPromise=require(_0x07be('0x4'));var rp=require(_0x07be('0x5'));var fs=require('fs');var path=require(_0x07be('0x6'));var rimraf=require(_0x07be('0x7'));var config=require(_0x07be('0x8'));var attributes=require('./squareReport.attributes');module[_0x07be('0x9')]=function(_0x4b245b,_0x3a84f2){return _0x4b245b[_0x07be('0xa')](_0x07be('0xb'),attributes,{'tableName':_0x07be('0xc'),'paranoid':![],'indexes':[{'name':_0x07be('0xd'),'fields':['uniqueid',_0x07be('0xe')]},{'name':'leaveAt','fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 4cc08d5..4548f87 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 _0xad4a=['randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','request\x20sent','debug','stringify','error','SquareReport,\x20%s,\x20%s','message','info','result','catch','CreateSquareReport','create','body','options','then','UpdateSquareReport','raw','where','attributes','limit','lodash','util','bluebird'];(function(_0x3a79a5,_0x388857){var _0x59f264=function(_0x3c5fb6){while(--_0x3c5fb6){_0x3a79a5['push'](_0x3a79a5['shift']());}};_0x59f264(++_0x388857);}(_0xad4a,0x176));var _0xaad4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xad4a[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xaad4('0x0'));var util=require(_0xaad4('0x1'));var moment=require('moment');var BPromise=require(_0xaad4('0x2'));var rs=require(_0xaad4('0x3'));var fs=require('fs');var Redis=require(_0xaad4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xaad4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xaad4('0x6'));var jayson=require(_0xaad4('0x7'));var client=jayson['client'][_0xaad4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x8676a4,_0x147f23,_0xb84ced){return new BPromise(function(_0x596247,_0x19b61e){return client[_0xaad4('0x9')](_0x8676a4,_0xb84ced)['then'](function(_0x35dff4){logger['info']('SquareReport,\x20%s,\x20%s',_0x147f23,_0xaad4('0xa'));logger[_0xaad4('0xb')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x147f23,_0xaad4('0xa'),JSON[_0xaad4('0xc')](_0x35dff4));if(_0x35dff4[_0xaad4('0xd')]){if(_0x35dff4[_0xaad4('0xd')]['code']===0x1f4){logger[_0xaad4('0xd')](_0xaad4('0xe'),_0x147f23,_0x35dff4[_0xaad4('0xd')][_0xaad4('0xf')]);return _0x19b61e(_0x35dff4[_0xaad4('0xd')][_0xaad4('0xf')]);}logger[_0xaad4('0xd')](_0xaad4('0xe'),_0x147f23,_0x35dff4[_0xaad4('0xd')][_0xaad4('0xf')]);return _0x596247(_0x35dff4['error'][_0xaad4('0xf')]);}else{logger[_0xaad4('0x10')]('SquareReport,\x20%s,\x20%s',_0x147f23,_0xaad4('0xa'));_0x596247(_0x35dff4[_0xaad4('0x11')][_0xaad4('0xf')]);}})[_0xaad4('0x12')](function(_0x5645ef){logger['error'](_0xaad4('0xe'),_0x147f23,_0x5645ef);_0x19b61e(_0x5645ef);});});}exports[_0xaad4('0x13')]=function(_0x2b49ba){var _0x3487f3=this;return new Promise(function(_0x407cba,_0x8d6f78){return db['SquareReport'][_0xaad4('0x14')](_0x2b49ba[_0xaad4('0x15')],{'raw':_0x2b49ba[_0xaad4('0x16')]?_0x2b49ba[_0xaad4('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xaad4('0x17')](function(_0x25267e){logger[_0xaad4('0x10')](_0xaad4('0x13'),_0x2b49ba);logger['debug']('CreateSquareReport',_0x2b49ba,JSON[_0xaad4('0xc')](_0x25267e));_0x407cba(_0x25267e);})[_0xaad4('0x12')](function(_0x2dc817){logger[_0xaad4('0xd')](_0xaad4('0x13'),_0x2dc817['message'],_0x2b49ba);_0x8d6f78(_0x3487f3['error'](0x1f4,_0x2dc817['message']));});});};exports[_0xaad4('0x18')]=function(_0x48ddee){var _0x2d0da6=this;return new Promise(function(_0x2a7e12,_0x3ce17a){return db['SquareReport']['update'](_0x48ddee[_0xaad4('0x15')],{'raw':_0x48ddee[_0xaad4('0x16')]?_0x48ddee[_0xaad4('0x16')][_0xaad4('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48ddee[_0xaad4('0x16')]?_0x48ddee[_0xaad4('0x16')][_0xaad4('0x1a')]||null:null,'attributes':_0x48ddee['options']?_0x48ddee[_0xaad4('0x16')][_0xaad4('0x1b')]||null:null,'limit':_0x48ddee['options']?_0x48ddee[_0xaad4('0x16')][_0xaad4('0x1c')]||null:null})[_0xaad4('0x17')](function(_0x44e04f){logger[_0xaad4('0x10')](_0xaad4('0x18'),_0x48ddee);logger[_0xaad4('0xb')](_0xaad4('0x18'),_0x48ddee,JSON[_0xaad4('0xc')](_0x44e04f));_0x2a7e12(_0x44e04f);})[_0xaad4('0x12')](function(_0x5d713b){logger[_0xaad4('0xd')](_0xaad4('0x18'),_0x5d713b['message'],_0x48ddee);_0x3ce17a(_0x2d0da6[_0xaad4('0xd')](0x1f4,_0x5d713b['message']));});});}; \ No newline at end of file +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 diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 282cad6..e3562e9 100644 --- a/server/api/squareReportDetail/index.js +++ b/server/api/squareReportDetail/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','destroy','exports','multer','util'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x814b,0x1a2));var _0xb814=function(_0x234577,_0x3b9004){_0x234577=_0x234577-0x0;var _0x28fea6=_0x814b[_0x234577];return _0x28fea6;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb814('0x6'));var config=require(_0xb814('0x7'));var controller=require(_0xb814('0x8'));router[_0xb814('0x9')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0xa')](),controller['describe']);router[_0xb814('0x9')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xf')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0x11')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['delete'](_0xb814('0xd'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);module[_0xb814('0x14')]=router; \ No newline at end of file +var _0x7a54=['describe','/:id','create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_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 diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 9387dd4..3449719 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 _0xec63=['exports','STRING','TEXT'];(function(_0x382a62,_0x1baa5e){var _0x490a25=function(_0x1b3427){while(--_0x1b3427){_0x382a62['push'](_0x382a62['shift']());}};_0x490a25(++_0x1baa5e);}(_0xec63,0xd8));var _0x3ec6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xec63[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x3ec6('0x0')]={'uniqueid':{'type':Sequelize[_0x3ec6('0x1')]},'node':{'type':Sequelize[_0x3ec6('0x1')]},'application':{'type':Sequelize[_0x3ec6('0x1')]},'data':{'type':Sequelize[_0x3ec6('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +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 diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 1366b66..0a188ee 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 _0x4f39=['eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','apply','save','update','then','destroy','error','stack','name','index','map','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','SquareDetailsReport','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','find','create','body','describe','html-pdf'];(function(_0xa3463d,_0x32f8da){var _0x50fd67=function(_0xb984fd){while(--_0xb984fd){_0xa3463d['push'](_0xa3463d['shift']());}};_0x50fd67(++_0x32f8da);}(_0x4f39,0x8f));var _0x94f3=function(_0x4c6970,_0x3f527b){_0x4c6970=_0x4c6970-0x0;var _0x36c516=_0x4f39[_0x4c6970];return _0x36c516;};'use strict';var pdf=require(_0x94f3('0x0'));var emlformat=require(_0x94f3('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x94f3('0x2'));var moment=require(_0x94f3('0x3'));var BPromise=require(_0x94f3('0x4'));var Mustache=require(_0x94f3('0x5'));var util=require(_0x94f3('0x6'));var path=require(_0x94f3('0x7'));var sox=require(_0x94f3('0x8'));var csv=require(_0x94f3('0x9'));var ejs=require(_0x94f3('0xa'));var fs=require('fs');var _=require(_0x94f3('0xb'));var squel=require(_0x94f3('0xc'));var crypto=require(_0x94f3('0xd'));var jsforce=require(_0x94f3('0xe'));var deskjs=require(_0x94f3('0xf'));var toCsv=require(_0x94f3('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x94f3('0x10'));var authService=require(_0x94f3('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x94f3('0x12'));var hardwareService=require(_0x94f3('0x13'));var logger=require(_0x94f3('0x14'))(_0x94f3('0x15'));var utils=require(_0x94f3('0x16'));var config=require('../../config/environment');var db=require(_0x94f3('0x17'))['db'];function respondWithStatusCode(_0x58cb58,_0x2f11d4){_0x2f11d4=_0x2f11d4||0xcc;return function(_0x44d866){if(_0x44d866){return _0x58cb58[_0x94f3('0x18')](_0x2f11d4);}return _0x58cb58[_0x94f3('0x19')](_0x2f11d4)[_0x94f3('0x1a')]();};}function respondWithResult(_0xfa3fb8,_0x701743){_0x701743=_0x701743||0xc8;return function(_0x1df265){if(_0x1df265){return _0xfa3fb8[_0x94f3('0x19')](_0x701743)[_0x94f3('0x1b')](_0x1df265);}};}function respondWithFilteredResult(_0x291f54,_0x40b385){return function(_0x3aaff3){if(_0x3aaff3){var _0x551dd1=_0x3aaff3['count'],_0x12a7ff=_0x40b385[_0x94f3('0x1c')],_0x4df2ed=_0x40b385[_0x94f3('0x1c')]+_0x40b385[_0x94f3('0x1d')],_0x174256;if(_0x4df2ed>=_0x551dd1){_0x4df2ed=_0x551dd1;_0x174256=0xc8;}else{_0x174256=0xce;}_0x291f54['status'](_0x174256);return _0x291f54['set']('Content-Range',_0x12a7ff+'-'+_0x4df2ed+'/'+_0x551dd1)['json'](_0x3aaff3);}return null;};}function patchUpdates(_0x1dba8d){return function(_0x52c0bd){try{jsonpatch[_0x94f3('0x1e')](_0x52c0bd,_0x1dba8d,!![]);}catch(_0x536f8b){return BPromise['reject'](_0x536f8b);}return _0x52c0bd[_0x94f3('0x1f')]();};}function saveUpdates(_0x508d96,_0x323fcd){return function(_0xe8e9a9){if(_0xe8e9a9){return _0xe8e9a9[_0x94f3('0x20')](_0x508d96)[_0x94f3('0x21')](function(_0x15f94c){return _0x15f94c;});}return null;};}function removeEntity(_0x4dd131,_0x13c2c8){return function(_0x51f811){if(_0x51f811){return _0x51f811[_0x94f3('0x22')]()[_0x94f3('0x21')](function(){_0x4dd131[_0x94f3('0x19')](0xcc)[_0x94f3('0x1a')]();});}};}function handleEntityNotFound(_0x5c0a42,_0xbfa1a9){return function(_0x270a26){if(!_0x270a26){_0x5c0a42['sendStatus'](0x194);}return _0x270a26;};}function handleError(_0x57b214,_0x239726){_0x239726=_0x239726||0x1f4;return function(_0x48eee8){logger[_0x94f3('0x23')](_0x48eee8[_0x94f3('0x24')]);if(_0x48eee8[_0x94f3('0x25')]){delete _0x48eee8['name'];}_0x57b214[_0x94f3('0x19')](_0x239726)['send'](_0x48eee8);};}exports[_0x94f3('0x26')]=function(_0x584b1b,_0x1d1e95){var _0x556486={},_0x49e66c={},_0x4f9da9={'count':0x0,'rows':[]};var _0x142ae8=_[_0x94f3('0x27')](db['SquareDetailsReport']['rawAttributes'],function(_0x41f1cb){return{'name':_0x41f1cb['fieldName'],'type':_0x41f1cb['type'][_0x94f3('0x28')]};});_0x49e66c[_0x94f3('0x29')]=_[_0x94f3('0x27')](_0x142ae8,_0x94f3('0x25'));_0x49e66c[_0x94f3('0x2a')]=_['keys'](_0x584b1b['query']);_0x49e66c[_0x94f3('0x2b')]=_[_0x94f3('0x2c')](_0x49e66c[_0x94f3('0x29')],_0x49e66c[_0x94f3('0x2a')]);_0x556486['attributes']=_[_0x94f3('0x2c')](_0x49e66c[_0x94f3('0x29')],qs[_0x94f3('0x2d')](_0x584b1b[_0x94f3('0x2a')]['fields']));_0x556486[_0x94f3('0x2e')]=_0x556486[_0x94f3('0x2e')][_0x94f3('0x2f')]?_0x556486[_0x94f3('0x2e')]:_0x49e66c['model'];if(!_0x584b1b['query'][_0x94f3('0x30')]('nolimit')){_0x556486['limit']=qs[_0x94f3('0x1d')](_0x584b1b[_0x94f3('0x2a')]['limit']);_0x556486[_0x94f3('0x1c')]=qs[_0x94f3('0x1c')](_0x584b1b['query'][_0x94f3('0x1c')]);}_0x556486[_0x94f3('0x31')]=qs[_0x94f3('0x32')](_0x584b1b[_0x94f3('0x2a')][_0x94f3('0x32')]);_0x556486[_0x94f3('0x33')]=qs[_0x94f3('0x2b')](_[_0x94f3('0x34')](_0x584b1b['query'],_0x49e66c['filters']));if(_0x584b1b['query'][_0x94f3('0x35')]){_0x556486[_0x94f3('0x33')]=_['merge'](_0x556486[_0x94f3('0x33')],{'$or':_[_0x94f3('0x27')](_0x142ae8,function(_0x3cb582){if(_0x3cb582['type']!==_0x94f3('0x36')){var _0x4bf6a3={};_0x4bf6a3[_0x3cb582['name']]={'$like':'%'+_0x584b1b['query'][_0x94f3('0x35')]+'%'};return _0x4bf6a3;}})});}_0x556486=_[_0x94f3('0x37')]({},_0x556486,_0x584b1b[_0x94f3('0x38')]);var _0x598761={'where':_0x556486[_0x94f3('0x33')]};return db[_0x94f3('0x39')][_0x94f3('0x3a')](_0x598761)['then'](function(_0x198f7d){_0x4f9da9[_0x94f3('0x3a')]=_0x198f7d;if(_0x584b1b[_0x94f3('0x2a')][_0x94f3('0x3b')]){_0x556486[_0x94f3('0x3c')]=[{'all':!![]}];}return db[_0x94f3('0x39')][_0x94f3('0x3d')](_0x556486);})['then'](function(_0xcdde64){_0x4f9da9[_0x94f3('0x3e')]=_0xcdde64;return _0x4f9da9;})['then'](respondWithFilteredResult(_0x1d1e95,_0x556486))[_0x94f3('0x3f')](handleError(_0x1d1e95,null));};exports[_0x94f3('0x40')]=function(_0xf30cef,_0x512253){var _0x1a8788={'raw':!![],'where':{'id':_0xf30cef[_0x94f3('0x41')]['id']}},_0x30d871={};_0x30d871[_0x94f3('0x29')]=_['keys'](db[_0x94f3('0x39')][_0x94f3('0x42')]);_0x30d871[_0x94f3('0x2a')]=_[_0x94f3('0x43')](_0xf30cef[_0x94f3('0x2a')]);_0x30d871[_0x94f3('0x2b')]=_['intersection'](_0x30d871[_0x94f3('0x29')],_0x30d871[_0x94f3('0x2a')]);_0x1a8788[_0x94f3('0x2e')]=_[_0x94f3('0x2c')](_0x30d871['model'],qs['fields'](_0xf30cef[_0x94f3('0x2a')][_0x94f3('0x2d')]));_0x1a8788[_0x94f3('0x2e')]=_0x1a8788[_0x94f3('0x2e')][_0x94f3('0x2f')]?_0x1a8788['attributes']:_0x30d871[_0x94f3('0x29')];if(_0xf30cef[_0x94f3('0x2a')][_0x94f3('0x3b')]){_0x1a8788['include']=[{'all':!![]}];}_0x1a8788=_[_0x94f3('0x37')]({},_0x1a8788,_0xf30cef[_0x94f3('0x38')]);return db[_0x94f3('0x39')][_0x94f3('0x44')](_0x1a8788)[_0x94f3('0x21')](handleEntityNotFound(_0x512253,null))[_0x94f3('0x21')](respondWithResult(_0x512253,null))['catch'](handleError(_0x512253,null));};exports[_0x94f3('0x45')]=function(_0x4ceaf7,_0x1590a2){return db[_0x94f3('0x39')][_0x94f3('0x45')](_0x4ceaf7['body'],{})[_0x94f3('0x21')](respondWithResult(_0x1590a2,0xc9))['catch'](handleError(_0x1590a2,null));};exports[_0x94f3('0x20')]=function(_0x580f67,_0x19e8b3){if(_0x580f67[_0x94f3('0x46')]['id']){delete _0x580f67[_0x94f3('0x46')]['id'];}return db[_0x94f3('0x39')]['find']({'where':{'id':_0x580f67[_0x94f3('0x41')]['id']}})[_0x94f3('0x21')](handleEntityNotFound(_0x19e8b3,null))[_0x94f3('0x21')](saveUpdates(_0x580f67[_0x94f3('0x46')],null))['then'](respondWithResult(_0x19e8b3,null))[_0x94f3('0x3f')](handleError(_0x19e8b3,null));};exports[_0x94f3('0x22')]=function(_0x17ee11,_0x4aec16){return db['SquareDetailsReport'][_0x94f3('0x44')]({'where':{'id':_0x17ee11[_0x94f3('0x41')]['id']}})['then'](handleEntityNotFound(_0x4aec16,null))[_0x94f3('0x21')](removeEntity(_0x4aec16,null))[_0x94f3('0x3f')](handleError(_0x4aec16,null));};exports[_0x94f3('0x47')]=function(_0x3c6dc8,_0xcdc6d3){return db[_0x94f3('0x39')][_0x94f3('0x47')]()[_0x94f3('0x21')](respondWithResult(_0xcdc6d3,null))[_0x94f3('0x3f')](handleError(_0xcdc6d3,null));}; \ No newline at end of file +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 diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index bc56af9..c210b42 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 _0x986b=['lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','define','SquareDetailsReport'];(function(_0x4285da,_0x41a664){var _0xca3463=function(_0x3d9c88){while(--_0x3d9c88){_0x4285da['push'](_0x4285da['shift']());}};_0xca3463(++_0x41a664);}(_0x986b,0x156));var _0xb986=function(_0x3b3e54,_0x27f854){_0x3b3e54=_0x3b3e54-0x0;var _0x4f86e1=_0x986b[_0x3b3e54];return _0x4f86e1;};'use strict';var _=require(_0xb986('0x0'));var util=require(_0xb986('0x1'));var logger=require(_0xb986('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb986('0x3'));var fs=require('fs');var path=require(_0xb986('0x4'));var rimraf=require(_0xb986('0x5'));var config=require(_0xb986('0x6'));var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0x4f95de,_0x5b36e5){return _0x4f95de[_0xb986('0x7')](_0xb986('0x8'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index aee3dc6..d17e41c 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 _0x6b11=['create','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','client','request','then','info','SquareDetailsReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch','SquareDetailsReport'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x6b11,0x119));var _0x16b1=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0x6b11[_0x5a3cf0];return _0x5a64ee;};'use strict';var _=require(_0x16b1('0x0'));var util=require('util');var moment=require(_0x16b1('0x1'));var BPromise=require(_0x16b1('0x2'));var rs=require(_0x16b1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x16b1('0x4'))['db'];var utils=require(_0x16b1('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x16b1('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1be8b8,_0x5a99a7,_0x4b76b0){return new BPromise(function(_0x4999e8,_0x429fcf){return client[_0x16b1('0x7')](_0x1be8b8,_0x4b76b0)[_0x16b1('0x8')](function(_0x2ab17c){logger[_0x16b1('0x9')](_0x16b1('0xa'),_0x5a99a7,'request\x20sent');logger[_0x16b1('0xb')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x5a99a7,'request\x20sent',JSON[_0x16b1('0xc')](_0x2ab17c));if(_0x2ab17c[_0x16b1('0xd')]){if(_0x2ab17c[_0x16b1('0xd')][_0x16b1('0xe')]===0x1f4){logger[_0x16b1('0xd')](_0x16b1('0xa'),_0x5a99a7,_0x2ab17c[_0x16b1('0xd')][_0x16b1('0xf')]);return _0x429fcf(_0x2ab17c[_0x16b1('0xd')][_0x16b1('0xf')]);}logger[_0x16b1('0xd')](_0x16b1('0xa'),_0x5a99a7,_0x2ab17c[_0x16b1('0xd')][_0x16b1('0xf')]);return _0x4999e8(_0x2ab17c[_0x16b1('0xd')][_0x16b1('0xf')]);}else{logger[_0x16b1('0x9')]('SquareDetailsReport,\x20%s,\x20%s',_0x5a99a7,_0x16b1('0x10'));_0x4999e8(_0x2ab17c['result'][_0x16b1('0xf')]);}})[_0x16b1('0x11')](function(_0x3d7491){logger['error'](_0x16b1('0xa'),_0x5a99a7,_0x3d7491);_0x429fcf(_0x3d7491);});});}exports['CreateSquareDetailsReport']=function(_0x3ef33f){var _0x4cc21c=this;return new Promise(function(_0xd5b362,_0x465a0f){return db[_0x16b1('0x12')][_0x16b1('0x13')](_0x3ef33f['body'],{'raw':_0x3ef33f['options']?_0x3ef33f['options']['raw']===undefined?!![]:![]:!![]})[_0x16b1('0x8')](function(_0x1e6d81){logger['info']('CreateSquareDetailsReport',_0x3ef33f);logger[_0x16b1('0xb')]('CreateSquareDetailsReport',_0x3ef33f,JSON['stringify'](_0x1e6d81));_0xd5b362(_0x1e6d81);})[_0x16b1('0x11')](function(_0x16c023){logger[_0x16b1('0xd')]('CreateSquareDetailsReport',_0x16c023[_0x16b1('0xf')],_0x3ef33f);_0x465a0f(_0x4cc21c[_0x16b1('0xd')](0x1f4,_0x16c023[_0x16b1('0xf')]));});});}; \ No newline at end of file +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 diff --git a/server/api/system/index.js b/server/api/system/index.js index 3370f5e..68b8a0b 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 _0x6140=['../../components/auth/service','./system.controller','get','isAuthenticated','/process/:pid/kill','killProcess','express'];(function(_0x3ead55,_0x22bc51){var _0x3ea16d=function(_0x2a59e0){while(--_0x2a59e0){_0x3ead55['push'](_0x3ead55['shift']());}};_0x3ea16d(++_0x22bc51);}(_0x6140,0x125));var _0x0614=function(_0x16c382,_0x1feac3){_0x16c382=_0x16c382-0x0;var _0x1739fc=_0x6140[_0x16c382];return _0x1739fc;};'use strict';var express=require(_0x0614('0x0'));var router=express['Router']();var auth=require(_0x0614('0x1'));var controller=require(_0x0614('0x2'));router[_0x0614('0x3')]('/',auth[_0x0614('0x4')](),controller['index']);router['get'](_0x0614('0x5'),auth[_0x0614('0x4')](),controller[_0x0614('0x6')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 54336be..6be56f4 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 _0x4ba1=['ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','format','kill','SIGINT','systeminformation','child_process','exec','../../config/logger','api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','index','getAllData','then','status','json','catch','killProcess','components/import/cm'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x4ba1,0x159));var _0x14ba=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4ba1[_0x397e5f];return _0x5302b8;};'use strict';var info=require(_0x14ba('0x0'));var exec=require(_0x14ba('0x1'))[_0x14ba('0x2')];var logger=require(_0x14ba('0x3'))(_0x14ba('0x4'));var util=require('util');var BPromise=require(_0x14ba('0x5'));var _=require(_0x14ba('0x6'));function handleError(_0x50c116,_0x317d57,_0x1bf403){_0x317d57=_0x317d57||0x1f4;return function(_0x118476){logger[_0x14ba('0x7')](_0x14ba('0x8'),_0x1bf403,_0x317d57,util[_0x14ba('0x9')](_0x118476,{'showHidden':![],'depth':null}));delete _0x118476[_0x14ba('0xa')];_0x50c116['status'](_0x317d57)['send'](_0x118476);};}exports[_0x14ba('0xb')]=function(_0x5290e8,_0xf8455a){return info[_0x14ba('0xc')]()[_0x14ba('0xd')](function(_0x5ad9f6){return _0xf8455a[_0x14ba('0xe')](0xc8)[_0x14ba('0xf')](_0x5ad9f6);})[_0x14ba('0x10')](function(_0x3116e9){return _0xf8455a[_0x14ba('0xe')](0x1f4)['json'](_0x3116e9);});};exports[_0x14ba('0x11')]=function(_0x8b0abb,_0x3d2ce2){var _0xeb992b=[_0x14ba('0x12')];return new BPromise(function(_0xa6b865,_0x451699){return exec(util['format'](_0x14ba('0x13'),_0x8b0abb[_0x14ba('0x14')][_0x14ba('0x15')]),function(_0x343e61,_0x3b0282,_0x121e5f){if(_0x343e61){return _0x451699(_0x343e61);}return _0xa6b865(_0x3b0282);});})[_0x14ba('0xd')](function(_0x4d365e){var _0x2a30d5=![];var _0xdd4203=_0x4d365e[_0x14ba('0x16')](/\n/);for(var _0x588337=0x0,_0x208020=_0xeb992b[_0x14ba('0x17')];_0x588337<_0x208020,_0x2a30d5===![];_0x588337+=0x1){if(_0x4d365e[_0x14ba('0x18')](_0xeb992b[_0x588337])>=0x0){_0x2a30d5=!![];}}if(!_0x2a30d5){throw new Error(util[_0x14ba('0x19')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x8b0abb[_0x14ba('0x14')][_0x14ba('0x15')]));}process[_0x14ba('0x1a')](_0x8b0abb['params'][_0x14ba('0x15')],_0x14ba('0x1b'));return _0x3d2ce2[_0x14ba('0xe')](0xc8)[_0x14ba('0xf')]({'message':util['format']('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x8b0abb[_0x14ba('0x14')]['pid'])});})[_0x14ba('0x10')](handleError(_0x3d2ce2,null,'killProcess'));}; \ No newline at end of file +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 diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 3e656d4..ced5d10 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 _0xa9e0=['/:id','update','delete','multer','util','path','Router','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated'];(function(_0x1fd828,_0x3994a6){var _0xa00111=function(_0x5bd8fd){while(--_0x5bd8fd){_0x1fd828['push'](_0x1fd828['shift']());}};_0xa00111(++_0x3994a6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['show']);router['post']('/',auth[_0x0a9e('0x8')](),controller['create']);router['put'](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xa')]);router[_0x0a9e('0xb')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 2c99895..e2a85c1 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 _0x4fc2=['STRING','name','#0091EA','sequelize','exports'];(function(_0x36cba4,_0x53a452){var _0xcc6047=function(_0x20b2a5){while(--_0x20b2a5){_0x36cba4['push'](_0x36cba4['shift']());}};_0xcc6047(++_0x53a452);}(_0x4fc2,0x111));var _0x24fc=function(_0x4ae578,_0x47156f){_0x4ae578=_0x4ae578-0x0;var _0x386e83=_0x4fc2[_0x4ae578];return _0x386e83;};'use strict';var Sequelize=require(_0x24fc('0x0'));module[_0x24fc('0x1')]={'name':{'type':Sequelize[_0x24fc('0x2')],'unique':_0x24fc('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x24fc('0x4')},'description':{'type':Sequelize[_0x24fc('0x2')]}}; \ No newline at end of file +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 diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 5cb3a95..2dd72f9 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 _0xb914=['include','findAll','rows','show','params','keys','find','catch','create','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','set','json','apply','reject','update','then','get','Tags','UserProfileResource','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0xb914,0xba));var _0x4b91=function(_0x314105,_0x343f27){_0x314105=_0x314105-0x0;var _0x320cd3=_0xb914[_0x314105];return _0x320cd3;};'use strict';var pdf=require(_0x4b91('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4b91('0x1'));var zipdir=require(_0x4b91('0x2'));var jsonpatch=require(_0x4b91('0x3'));var rp=require(_0x4b91('0x4'));var moment=require(_0x4b91('0x5'));var BPromise=require(_0x4b91('0x6'));var Mustache=require(_0x4b91('0x7'));var util=require(_0x4b91('0x8'));var path=require('path');var sox=require(_0x4b91('0x9'));var csv=require(_0x4b91('0xa'));var ejs=require(_0x4b91('0xb'));var fs=require('fs');var _=require(_0x4b91('0xc'));var squel=require(_0x4b91('0xd'));var crypto=require('crypto');var jsforce=require(_0x4b91('0xe'));var deskjs=require(_0x4b91('0xf'));var toCsv=require(_0x4b91('0xa'));var querystring=require(_0x4b91('0x10'));var Papa=require(_0x4b91('0x11'));var Redis=require(_0x4b91('0x12'));var authService=require(_0x4b91('0x13'));var qs=require(_0x4b91('0x14'));var as=require(_0x4b91('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b91('0x16'))(_0x4b91('0x17'));var utils=require(_0x4b91('0x18'));var config=require(_0x4b91('0x19'));var db=require(_0x4b91('0x1a'))['db'];function respondWithStatusCode(_0x321388,_0x7d1580){_0x7d1580=_0x7d1580||0xcc;return function(_0x286595){if(_0x286595){return _0x321388[_0x4b91('0x1b')](_0x7d1580);}return _0x321388['status'](_0x7d1580)[_0x4b91('0x1c')]();};}function respondWithResult(_0x1b19a9,_0x37a128){_0x37a128=_0x37a128||0xc8;return function(_0x31a843){if(_0x31a843){return _0x1b19a9[_0x4b91('0x1d')](_0x37a128)['json'](_0x31a843);}};}function respondWithFilteredResult(_0x57455a,_0x73086a){return function(_0x25bd16){if(_0x25bd16){var _0x9d11c=_0x25bd16[_0x4b91('0x1e')],_0x5296f4=_0x73086a[_0x4b91('0x1f')],_0x333dc5=_0x73086a[_0x4b91('0x1f')]+_0x73086a['limit'],_0x558637;if(_0x333dc5>=_0x9d11c){_0x333dc5=_0x9d11c;_0x558637=0xc8;}else{_0x558637=0xce;}_0x57455a[_0x4b91('0x1d')](_0x558637);return _0x57455a[_0x4b91('0x20')]('Content-Range',_0x5296f4+'-'+_0x333dc5+'/'+_0x9d11c)[_0x4b91('0x21')](_0x25bd16);}return null;};}function patchUpdates(_0x68be21){return function(_0x129806){try{jsonpatch[_0x4b91('0x22')](_0x129806,_0x68be21,!![]);}catch(_0x394a75){return BPromise[_0x4b91('0x23')](_0x394a75);}return _0x129806['save']();};}function saveUpdates(_0x1eac3d,_0x340cce){return function(_0x18bfb){if(_0x18bfb){return _0x18bfb[_0x4b91('0x24')](_0x1eac3d)[_0x4b91('0x25')](function(_0x5b43f0){return _0x5b43f0;});}return null;};}function removeEntity(_0x598420,_0x2e0218){return function(_0x4a0448){if(_0x4a0448){return _0x4a0448['destroy']()['then'](function(){var _0x2cdf35=_0x4a0448[_0x4b91('0x26')]({'plain':!![]});var _0x503ec6=_0x4b91('0x27');return db[_0x4b91('0x28')]['destroy']({'where':{'type':_0x503ec6,'resourceId':_0x2cdf35['id']}})['then'](function(){return _0x4a0448;});})[_0x4b91('0x25')](function(){_0x598420[_0x4b91('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e1a7a,_0x2df594){return function(_0x1666c1){if(!_0x1666c1){_0x1e1a7a[_0x4b91('0x1b')](0x194);}return _0x1666c1;};}function handleError(_0x29cfae,_0x355f2a){_0x355f2a=_0x355f2a||0x1f4;return function(_0x489683){logger[_0x4b91('0x29')](_0x489683[_0x4b91('0x2a')]);if(_0x489683[_0x4b91('0x2b')]){delete _0x489683[_0x4b91('0x2b')];}_0x29cfae[_0x4b91('0x1d')](_0x355f2a)[_0x4b91('0x2c')](_0x489683);};}exports[_0x4b91('0x2d')]=function(_0x17d6eb,_0x2e240a){var _0x17e603={},_0x545768={},_0x13bd0d={'count':0x0,'rows':[]};var _0x4eb396=_[_0x4b91('0x2e')](db[_0x4b91('0x2f')][_0x4b91('0x30')],function(_0x113f44){return{'name':_0x113f44[_0x4b91('0x31')],'type':_0x113f44[_0x4b91('0x32')]['key']};});_0x545768[_0x4b91('0x33')]=_['map'](_0x4eb396,'name');_0x545768[_0x4b91('0x34')]=_['keys'](_0x17d6eb['query']);_0x545768[_0x4b91('0x35')]=_[_0x4b91('0x36')](_0x545768['model'],_0x545768[_0x4b91('0x34')]);_0x17e603['attributes']=_[_0x4b91('0x36')](_0x545768['model'],qs[_0x4b91('0x37')](_0x17d6eb[_0x4b91('0x34')]['fields']));_0x17e603[_0x4b91('0x38')]=_0x17e603[_0x4b91('0x38')]['length']?_0x17e603[_0x4b91('0x38')]:_0x545768['model'];if(!_0x17d6eb[_0x4b91('0x34')][_0x4b91('0x39')](_0x4b91('0x3a'))){_0x17e603[_0x4b91('0x3b')]=qs['limit'](_0x17d6eb[_0x4b91('0x34')]['limit']);_0x17e603[_0x4b91('0x1f')]=qs[_0x4b91('0x1f')](_0x17d6eb[_0x4b91('0x34')][_0x4b91('0x1f')]);}_0x17e603[_0x4b91('0x3c')]=qs[_0x4b91('0x3d')](_0x17d6eb['query'][_0x4b91('0x3d')]);_0x17e603[_0x4b91('0x3e')]=qs[_0x4b91('0x35')](_[_0x4b91('0x3f')](_0x17d6eb[_0x4b91('0x34')],_0x545768['filters']));if(_0x17d6eb[_0x4b91('0x34')]['filter']){_0x17e603[_0x4b91('0x3e')]=_[_0x4b91('0x40')](_0x17e603[_0x4b91('0x3e')],{'$or':_['map'](_0x4eb396,function(_0x573a2b){if(_0x573a2b['type']!==_0x4b91('0x41')){var _0x5772d8={};_0x5772d8[_0x573a2b['name']]={'$like':'%'+_0x17d6eb['query'][_0x4b91('0x42')]+'%'};return _0x5772d8;}})});}_0x17e603=_[_0x4b91('0x40')]({},_0x17e603,_0x17d6eb[_0x4b91('0x43')]);var _0x5e277f={'where':_0x17e603[_0x4b91('0x3e')]};return db[_0x4b91('0x2f')][_0x4b91('0x1e')](_0x5e277f)[_0x4b91('0x25')](function(_0x41cdc9){_0x13bd0d['count']=_0x41cdc9;if(_0x17d6eb[_0x4b91('0x34')][_0x4b91('0x44')]){_0x17e603[_0x4b91('0x45')]=[{'all':!![]}];}return db[_0x4b91('0x2f')][_0x4b91('0x46')](_0x17e603);})['then'](function(_0x20ddd0){_0x13bd0d[_0x4b91('0x47')]=_0x20ddd0;return _0x13bd0d;})[_0x4b91('0x25')](respondWithFilteredResult(_0x2e240a,_0x17e603))['catch'](handleError(_0x2e240a,null));};exports[_0x4b91('0x48')]=function(_0x4d1770,_0x5912c7){var _0x43df8b={'raw':!![],'where':{'id':_0x4d1770[_0x4b91('0x49')]['id']}},_0x4500db={};_0x4500db[_0x4b91('0x33')]=_['keys'](db[_0x4b91('0x2f')][_0x4b91('0x30')]);_0x4500db[_0x4b91('0x34')]=_[_0x4b91('0x4a')](_0x4d1770[_0x4b91('0x34')]);_0x4500db['filters']=_[_0x4b91('0x36')](_0x4500db[_0x4b91('0x33')],_0x4500db['query']);_0x43df8b['attributes']=_['intersection'](_0x4500db[_0x4b91('0x33')],qs[_0x4b91('0x37')](_0x4d1770[_0x4b91('0x34')][_0x4b91('0x37')]));_0x43df8b[_0x4b91('0x38')]=_0x43df8b[_0x4b91('0x38')]['length']?_0x43df8b['attributes']:_0x4500db[_0x4b91('0x33')];if(_0x4d1770[_0x4b91('0x34')][_0x4b91('0x44')]){_0x43df8b[_0x4b91('0x45')]=[{'all':!![]}];}_0x43df8b=_[_0x4b91('0x40')]({},_0x43df8b,_0x4d1770[_0x4b91('0x43')]);return db['Tag'][_0x4b91('0x4b')](_0x43df8b)[_0x4b91('0x25')](handleEntityNotFound(_0x5912c7,null))[_0x4b91('0x25')](respondWithResult(_0x5912c7,null))[_0x4b91('0x4c')](handleError(_0x5912c7,null));};exports[_0x4b91('0x4d')]=function(_0x48a572,_0x15760a){return db[_0x4b91('0x2f')][_0x4b91('0x4d')](_0x48a572['body'],{})['then'](function(_0xc4fdc3){var _0x21b738=_0x48a572[_0x4b91('0x4e')][_0x4b91('0x26')]({'plain':!![]});if(!_0x21b738)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21b738[_0x4b91('0x4f')]===_0x4b91('0x4e')){var _0xe2b132=_0xc4fdc3['get']({'plain':!![]});var _0x22e229=_0x4b91('0x27');return db[_0x4b91('0x50')][_0x4b91('0x4b')]({'where':{'name':_0x22e229,'userProfileId':_0x21b738[_0x4b91('0x51')]},'raw':!![]})[_0x4b91('0x25')](function(_0x2c56c5){if(_0x2c56c5&&_0x2c56c5['autoAssociation']===0x0){return db[_0x4b91('0x28')][_0x4b91('0x4d')]({'name':_0xe2b132[_0x4b91('0x2b')],'resourceId':_0xe2b132['id'],'type':_0x2c56c5[_0x4b91('0x2b')],'sectionId':_0x2c56c5['id']},{})[_0x4b91('0x25')](function(){return _0xc4fdc3;});}else{return _0xc4fdc3;}})[_0x4b91('0x4c')](function(_0x207d41){logger[_0x4b91('0x29')](_0x4b91('0x52'),_0x207d41);throw _0x207d41;});}return _0xc4fdc3;})[_0x4b91('0x25')](respondWithResult(_0x15760a,0xc9))['catch'](handleError(_0x15760a,null));};exports['update']=function(_0xbd8ad7,_0x3166ad){if(_0xbd8ad7['body']['id']){delete _0xbd8ad7[_0x4b91('0x53')]['id'];}return db['Tag'][_0x4b91('0x4b')]({'where':{'id':_0xbd8ad7[_0x4b91('0x49')]['id']}})['then'](handleEntityNotFound(_0x3166ad,null))[_0x4b91('0x25')](saveUpdates(_0xbd8ad7[_0x4b91('0x53')],null))[_0x4b91('0x25')](respondWithResult(_0x3166ad,null))[_0x4b91('0x4c')](handleError(_0x3166ad,null));};exports[_0x4b91('0x54')]=function(_0x21f24a,_0x2f4e95){return db[_0x4b91('0x2f')][_0x4b91('0x4b')]({'where':{'id':_0x21f24a[_0x4b91('0x49')]['id']}})[_0x4b91('0x25')](handleEntityNotFound(_0x2f4e95,null))[_0x4b91('0x25')](removeEntity(_0x2f4e95,null))[_0x4b91('0x4c')](handleError(_0x2f4e95,null));}; \ No newline at end of file +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 diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 2f6e858..ad05ff3 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 _0x22f0=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','define','util','../../config/logger','api'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x22f0,0x159));var _0x022f=function(_0x48a17b,_0x15fe4b){_0x48a17b=_0x48a17b-0x0;var _0x3170db=_0x22f0[_0x48a17b];return _0x3170db;};'use strict';var _=require('lodash');var util=require(_0x022f('0x0'));var logger=require(_0x022f('0x1'))(_0x022f('0x2'));var moment=require(_0x022f('0x3'));var BPromise=require(_0x022f('0x4'));var rp=require(_0x022f('0x5'));var fs=require('fs');var path=require(_0x022f('0x6'));var rimraf=require(_0x022f('0x7'));var config=require(_0x022f('0x8'));var attributes=require(_0x022f('0x9'));module[_0x022f('0xa')]=function(_0x511a80,_0x1f85c8){return _0x511a80[_0x022f('0xb')]('Tag',attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 3136bff..3c39f1f 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 _0x6f0d=['Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','Tag,\x20%s,\x20%s','request\x20sent'];(function(_0x320808,_0x464faf){var _0x5a2166=function(_0x527b0a){while(--_0x527b0a){_0x320808['push'](_0x320808['shift']());}};_0x5a2166(++_0x464faf);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x514c37,_0x3c1073){_0x514c37=_0x514c37-0x0;var _0x1fe86a=_0x6f0d[_0x514c37];return _0x1fe86a;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var moment=require(_0xd6f0('0x1'));var BPromise=require(_0xd6f0('0x2'));var rs=require(_0xd6f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6f0('0x4'))['db'];var utils=require(_0xd6f0('0x5'));var logger=require(_0xd6f0('0x6'))(_0xd6f0('0x7'));var config=require(_0xd6f0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd6f0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe21ac4,_0x1af29c,_0x8b89a9){return new BPromise(function(_0x1a48a0,_0x4c4916){return client['request'](_0xe21ac4,_0x8b89a9)[_0xd6f0('0xa')](function(_0x272c4e){logger[_0xd6f0('0xb')](_0xd6f0('0xc'),_0x1af29c,_0xd6f0('0xd'));logger['debug'](_0xd6f0('0xe'),_0x1af29c,_0xd6f0('0xd'),JSON[_0xd6f0('0xf')](_0x272c4e));if(_0x272c4e[_0xd6f0('0x10')]){if(_0x272c4e['error'][_0xd6f0('0x11')]===0x1f4){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);return _0x4c4916(_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);}logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e['error'][_0xd6f0('0x12')]);return _0x1a48a0(_0x272c4e[_0xd6f0('0x10')]['message']);}else{logger[_0xd6f0('0xb')]('Tag,\x20%s,\x20%s',_0x1af29c,_0xd6f0('0xd'));_0x1a48a0(_0x272c4e[_0xd6f0('0x13')][_0xd6f0('0x12')]);}})[_0xd6f0('0x14')](function(_0x64ff5f){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x64ff5f);_0x4c4916(_0x64ff5f);});});} \ No newline at end of file +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 diff --git a/server/api/team/index.js b/server/api/team/index.js index 3832b2b..65568c9 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 _0x3303=['./team.controller','get','isAuthenticated','index','show','/:id/queues','getQueues','/:id/users','getAgents','post','addQueues','addAgents','/:id','update','delete','removeAgents','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x24abf2,_0x394521){var _0x9191de=function(_0x2c0a86){while(--_0x2c0a86){_0x24abf2['push'](_0x24abf2['shift']());}};_0x9191de(++_0x394521);}(_0x3303,0xe0));var _0x3330=function(_0x1a9a12,_0x51c4bf){_0x1a9a12=_0x1a9a12-0x0;var _0x2b7fca=_0x3303[_0x1a9a12];return _0x2b7fca;};'use strict';var multer=require(_0x3330('0x0'));var util=require('util');var path=require(_0x3330('0x1'));var timeout=require(_0x3330('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x3330('0x3'));var interaction=require(_0x3330('0x4'));var config=require(_0x3330('0x5'));var controller=require(_0x3330('0x6'));router[_0x3330('0x7')]('/',auth[_0x3330('0x8')](),controller[_0x3330('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3330('0xa')]);router[_0x3330('0x7')](_0x3330('0xb'),auth[_0x3330('0x8')](),controller[_0x3330('0xc')]);router['get'](_0x3330('0xd'),auth[_0x3330('0x8')](),controller[_0x3330('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x3330('0xf')](_0x3330('0xb'),auth['isAuthenticated'](),controller[_0x3330('0x10')]);router[_0x3330('0xf')]('/:id/users',auth['isAuthenticated'](),controller[_0x3330('0x11')]);router['put'](_0x3330('0x12'),auth[_0x3330('0x8')](),controller[_0x3330('0x13')]);router['delete'](_0x3330('0x12'),auth[_0x3330('0x8')](),controller['destroy']);router[_0x3330('0x14')]('/:id/queues',auth['isAuthenticated'](),controller['removeQueues']);router[_0x3330('0x14')](_0x3330('0xd'),auth[_0x3330('0x8')](),controller[_0x3330('0x15')]);module[_0x3330('0x16')]=router; \ No newline at end of file +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 diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 9adf0fe..4ab3681 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 _0x41ab=['name','sequelize','exports','STRING'];(function(_0x16f1c1,_0x5e0ed2){var _0x547b10=function(_0x320972){while(--_0x320972){_0x16f1c1['push'](_0x16f1c1['shift']());}};_0x547b10(++_0x5e0ed2);}(_0x41ab,0xb1));var _0xb41a=function(_0x5eb90f,_0x5b860e){_0x5eb90f=_0x5eb90f-0x0;var _0x2ee99f=_0x41ab[_0x5eb90f];return _0x2ee99f;};'use strict';var Sequelize=require(_0xb41a('0x0'));module[_0xb41a('0x1')]={'name':{'type':Sequelize[_0xb41a('0x2')],'allowNull':![],'unique':_0xb41a('0x3')},'description':{'type':Sequelize[_0xb41a('0x2')]}}; \ No newline at end of file +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 diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 716e410..229835d 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 _0xa413=['localhost','./team.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Teams','UserProfileResource','error','stack','name','send','index','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','VIRTUAL','filter','merge','options','Team','includeAll','include','findAll','rows','show','params','keys','rawAttributes','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','findOne','isValidChannel','channel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','add','remove','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','ids','online','voicePause','interface','each','upsert','isNil','format','omit','spread','userTeam:save','removeAgents','voice','chat','sms','fax','UserVoiceQueueRt','userTeam:remove','getAgents','nolimit','html-pdf','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults'];(function(_0x275294,_0x1471b7){var _0x1981f7=function(_0x5e778a){while(--_0x5e778a){_0x275294['push'](_0x275294['shift']());}};_0x1981f7(++_0x1471b7);}(_0xa413,0x1e5));var _0x3a41=function(_0x5223db,_0x1baf08){_0x5223db=_0x5223db-0x0;var _0xa2002a=_0xa413[_0x5223db];return _0xa2002a;};'use strict';var pdf=require(_0x3a41('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3a41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3a41('0x2'));var rp=require(_0x3a41('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3a41('0x4'));var util=require(_0x3a41('0x5'));var path=require(_0x3a41('0x6'));var sox=require(_0x3a41('0x7'));var csv=require(_0x3a41('0x8'));var ejs=require(_0x3a41('0x9'));var fs=require('fs');var _=require(_0x3a41('0xa'));var squel=require(_0x3a41('0xb'));var crypto=require(_0x3a41('0xc'));var jsforce=require(_0x3a41('0xd'));var deskjs=require(_0x3a41('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3a41('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3a41('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3a41('0x11'));var logger=require('../../config/logger')(_0x3a41('0x12'));var utils=require(_0x3a41('0x13'));var config=require('../../config/environment');var db=require(_0x3a41('0x14'))['db'];config[_0x3a41('0x15')]=_[_0x3a41('0x16')](config[_0x3a41('0x15')],{'host':_0x3a41('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3a41('0x15')]));require(_0x3a41('0x18'))[_0x3a41('0x19')](socket);function respondWithStatusCode(_0x357829,_0x35f693){_0x35f693=_0x35f693||0xcc;return function(_0x2aba07){if(_0x2aba07){return _0x357829[_0x3a41('0x1a')](_0x35f693);}return _0x357829[_0x3a41('0x1b')](_0x35f693)[_0x3a41('0x1c')]();};}function respondWithResult(_0x37697c,_0xbb7877){_0xbb7877=_0xbb7877||0xc8;return function(_0x4e7e87){if(_0x4e7e87){return _0x37697c[_0x3a41('0x1b')](_0xbb7877)[_0x3a41('0x1d')](_0x4e7e87);}};}function respondWithFilteredResult(_0x58c3b6,_0x515a03){return function(_0xa564ed){if(_0xa564ed){var _0x3c4267=_0xa564ed[_0x3a41('0x1e')],_0x271344=_0x515a03[_0x3a41('0x1f')],_0x30591d=_0x515a03[_0x3a41('0x1f')]+_0x515a03['limit'],_0x127c84;if(_0x30591d>=_0x3c4267){_0x30591d=_0x3c4267;_0x127c84=0xc8;}else{_0x127c84=0xce;}_0x58c3b6['status'](_0x127c84);return _0x58c3b6[_0x3a41('0x20')](_0x3a41('0x21'),_0x271344+'-'+_0x30591d+'/'+_0x3c4267)['json'](_0xa564ed);}return null;};}function patchUpdates(_0x5616f3){return function(_0x4ddc3e){try{jsonpatch[_0x3a41('0x22')](_0x4ddc3e,_0x5616f3,!![]);}catch(_0x24196c){return BPromise[_0x3a41('0x23')](_0x24196c);}return _0x4ddc3e[_0x3a41('0x24')]();};}function saveUpdates(_0x547e43,_0x5caa79){return function(_0x313569){if(_0x313569){return _0x313569[_0x3a41('0x25')](_0x547e43)[_0x3a41('0x26')](function(_0x383788){return _0x383788;});}return null;};}function removeEntity(_0x115b82,_0x17dcf5){return function(_0x52fede){if(_0x52fede){return _0x52fede[_0x3a41('0x27')]()[_0x3a41('0x26')](function(){var _0x56c62d=_0x52fede[_0x3a41('0x28')]({'plain':!![]});var _0x2a1354=_0x3a41('0x29');return db[_0x3a41('0x2a')][_0x3a41('0x27')]({'where':{'type':_0x2a1354,'resourceId':_0x56c62d['id']}})['then'](function(){return _0x52fede;});})[_0x3a41('0x26')](function(){_0x115b82[_0x3a41('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x358d8e,_0x5dfbee){return function(_0x105e6f){if(!_0x105e6f){_0x358d8e['sendStatus'](0x194);}return _0x105e6f;};}function handleError(_0x201507,_0x5be3cd){_0x5be3cd=_0x5be3cd||0x1f4;return function(_0x39b9ef){logger[_0x3a41('0x2b')](_0x39b9ef[_0x3a41('0x2c')]);if(_0x39b9ef[_0x3a41('0x2d')]){delete _0x39b9ef[_0x3a41('0x2d')];}_0x201507[_0x3a41('0x1b')](_0x5be3cd)[_0x3a41('0x2e')](_0x39b9ef);};}exports[_0x3a41('0x2f')]=function(_0xeb5219,_0x3772ce){var _0x12b166={},_0x443fdf={},_0x435380={'count':0x0,'rows':[]};var _0x11476e=_['map'](db['Team']['rawAttributes'],function(_0x4e2d4c){return{'name':_0x4e2d4c[_0x3a41('0x30')],'type':_0x4e2d4c[_0x3a41('0x31')][_0x3a41('0x32')]};});_0x443fdf[_0x3a41('0x33')]=_[_0x3a41('0x34')](_0x11476e,'name');_0x443fdf['query']=_['keys'](_0xeb5219[_0x3a41('0x35')]);_0x443fdf[_0x3a41('0x36')]=_['intersection'](_0x443fdf[_0x3a41('0x33')],_0x443fdf[_0x3a41('0x35')]);_0x12b166[_0x3a41('0x37')]=_[_0x3a41('0x38')](_0x443fdf[_0x3a41('0x33')],qs[_0x3a41('0x39')](_0xeb5219[_0x3a41('0x35')][_0x3a41('0x39')]));_0x12b166[_0x3a41('0x37')]=_0x12b166[_0x3a41('0x37')][_0x3a41('0x3a')]?_0x12b166[_0x3a41('0x37')]:_0x443fdf[_0x3a41('0x33')];if(!_0xeb5219[_0x3a41('0x35')][_0x3a41('0x3b')]('nolimit')){_0x12b166['limit']=qs[_0x3a41('0x3c')](_0xeb5219[_0x3a41('0x35')]['limit']);_0x12b166[_0x3a41('0x1f')]=qs['offset'](_0xeb5219['query']['offset']);}_0x12b166[_0x3a41('0x3d')]=qs[_0x3a41('0x3e')](_0xeb5219['query'][_0x3a41('0x3e')]);_0x12b166[_0x3a41('0x3f')]=qs['filters'](_[_0x3a41('0x40')](_0xeb5219[_0x3a41('0x35')],_0x443fdf['filters']));if(_0xeb5219[_0x3a41('0x35')]['filter']){_0x12b166['where']=_['merge'](_0x12b166[_0x3a41('0x3f')],{'$or':_[_0x3a41('0x34')](_0x11476e,function(_0x58ce30){if(_0x58ce30[_0x3a41('0x31')]!==_0x3a41('0x41')){var _0xbfaa0e={};_0xbfaa0e[_0x58ce30[_0x3a41('0x2d')]]={'$like':'%'+_0xeb5219[_0x3a41('0x35')][_0x3a41('0x42')]+'%'};return _0xbfaa0e;}})});}_0x12b166=_[_0x3a41('0x43')]({},_0x12b166,_0xeb5219[_0x3a41('0x44')]);var _0xaa1ec3={'where':_0x12b166[_0x3a41('0x3f')]};return db[_0x3a41('0x45')][_0x3a41('0x1e')](_0xaa1ec3)[_0x3a41('0x26')](function(_0x5cd892){_0x435380['count']=_0x5cd892;if(_0xeb5219['query'][_0x3a41('0x46')]){_0x12b166[_0x3a41('0x47')]=[{'all':!![]}];}return db['Team'][_0x3a41('0x48')](_0x12b166);})['then'](function(_0x3e98b1){_0x435380[_0x3a41('0x49')]=_0x3e98b1;return _0x435380;})[_0x3a41('0x26')](respondWithFilteredResult(_0x3772ce,_0x12b166))['catch'](handleError(_0x3772ce,null));};exports[_0x3a41('0x4a')]=function(_0x1f2e28,_0x382dfd){var _0x48c94c={'raw':![],'where':{'id':_0x1f2e28[_0x3a41('0x4b')]['id']}},_0xba77c7={};_0xba77c7[_0x3a41('0x33')]=_[_0x3a41('0x4c')](db[_0x3a41('0x45')][_0x3a41('0x4d')]);_0xba77c7[_0x3a41('0x35')]=_['keys'](_0x1f2e28[_0x3a41('0x35')]);_0xba77c7[_0x3a41('0x36')]=_[_0x3a41('0x38')](_0xba77c7[_0x3a41('0x33')],_0xba77c7['query']);_0x48c94c[_0x3a41('0x37')]=_[_0x3a41('0x38')](_0xba77c7['model'],qs[_0x3a41('0x39')](_0x1f2e28[_0x3a41('0x35')][_0x3a41('0x39')]));_0x48c94c[_0x3a41('0x37')]=_0x48c94c[_0x3a41('0x37')]['length']?_0x48c94c[_0x3a41('0x37')]:_0xba77c7['model'];if(_0x1f2e28['query'][_0x3a41('0x46')]){_0x48c94c[_0x3a41('0x47')]=[{'all':!![]}];}_0x48c94c=_[_0x3a41('0x43')]({},_0x48c94c,_0x1f2e28[_0x3a41('0x44')]);return db['Team']['find'](_0x48c94c)['then'](handleEntityNotFound(_0x382dfd,null))[_0x3a41('0x26')](respondWithResult(_0x382dfd,null))[_0x3a41('0x4e')](handleError(_0x382dfd,null));};exports[_0x3a41('0x4f')]=function(_0x3069db,_0xef91ac){return db[_0x3a41('0x45')][_0x3a41('0x4f')](_0x3069db[_0x3a41('0x50')],{})[_0x3a41('0x26')](function(_0x3007c1){var _0x14d70b=_0x3069db[_0x3a41('0x51')][_0x3a41('0x28')]({'plain':!![]});if(!_0x14d70b)throw new Error(_0x3a41('0x52'));if(_0x14d70b['role']===_0x3a41('0x51')){var _0x4aa033=_0x3007c1[_0x3a41('0x28')]({'plain':!![]});var _0x56c193=_0x3a41('0x29');return db['UserProfileSection'][_0x3a41('0x53')]({'where':{'name':_0x56c193,'userProfileId':_0x14d70b[_0x3a41('0x54')]},'raw':!![]})[_0x3a41('0x26')](function(_0x2514b6){if(_0x2514b6&&_0x2514b6['autoAssociation']===0x0){return db[_0x3a41('0x2a')]['create']({'name':_0x4aa033[_0x3a41('0x2d')],'resourceId':_0x4aa033['id'],'type':_0x2514b6[_0x3a41('0x2d')],'sectionId':_0x2514b6['id']},{})[_0x3a41('0x26')](function(){return _0x3007c1;});}else{return _0x3007c1;}})[_0x3a41('0x4e')](function(_0x2fda95){logger[_0x3a41('0x2b')](_0x3a41('0x55'),_0x2fda95);throw _0x2fda95;});}return _0x3007c1;})[_0x3a41('0x26')](respondWithResult(_0xef91ac,0xc9))[_0x3a41('0x4e')](handleError(_0xef91ac,null));};exports['update']=function(_0x31c2c0,_0x59ae4f){if(_0x31c2c0[_0x3a41('0x50')]['id']){delete _0x31c2c0[_0x3a41('0x50')]['id'];}return db[_0x3a41('0x45')]['find']({'where':{'id':_0x31c2c0[_0x3a41('0x4b')]['id']}})[_0x3a41('0x26')](handleEntityNotFound(_0x59ae4f,null))[_0x3a41('0x26')](saveUpdates(_0x31c2c0['body'],null))[_0x3a41('0x26')](respondWithResult(_0x59ae4f,null))[_0x3a41('0x4e')](handleError(_0x59ae4f,null));};exports[_0x3a41('0x27')]=function(_0xcae8fa,_0x3c3bfa){return db[_0x3a41('0x45')][_0x3a41('0x53')]({'where':{'id':_0xcae8fa[_0x3a41('0x4b')]['id']}})[_0x3a41('0x26')](handleEntityNotFound(_0x3c3bfa,null))[_0x3a41('0x26')](removeEntity(_0x3c3bfa,null))['catch'](handleError(_0x3c3bfa,null));};exports[_0x3a41('0x56')]=function(_0x25dcc2,_0x462294,_0x2854f9){return db[_0x3a41('0x45')][_0x3a41('0x57')]({'where':{'id':_0x25dcc2[_0x3a41('0x4b')]['id']}})[_0x3a41('0x26')](handleEntityNotFound(_0x462294,null))[_0x3a41('0x26')](function(_0x4c6d0f){if(!_0x25dcc2[_0x3a41('0x35')]['channel']||!utils[_0x3a41('0x58')](_0x25dcc2['query'][_0x3a41('0x59')])){throw new db[(_0x3a41('0x5a'))][(_0x3a41('0x5b'))](_0x3a41('0x5c'));}var _0x3cd8e6={};var _0x13e116={};_0x13e116[_0x3a41('0x33')]=_[_0x3a41('0x4c')](db[_[_0x3a41('0x5d')](_0x25dcc2[_0x3a41('0x35')]['channel'][_0x3a41('0x5e')]())+_0x3a41('0x5f')]['rawAttributes']);_0x13e116[_0x3a41('0x35')]=_[_0x3a41('0x4c')](_0x25dcc2[_0x3a41('0x35')]);_0x13e116[_0x3a41('0x36')]=_[_0x3a41('0x38')](_0x13e116[_0x3a41('0x33')],_0x13e116['query']);_0x3cd8e6[_0x3a41('0x37')]=_[_0x3a41('0x38')](_0x13e116[_0x3a41('0x33')],qs[_0x3a41('0x39')](_0x25dcc2[_0x3a41('0x35')][_0x3a41('0x39')]));_0x3cd8e6[_0x3a41('0x37')]=_0x3cd8e6[_0x3a41('0x37')]['length']?_0x3cd8e6['attributes']:_0x13e116[_0x3a41('0x33')];_0x3cd8e6[_0x3a41('0x3c')]=qs['limit'](_0x25dcc2['query'][_0x3a41('0x3c')]);_0x3cd8e6[_0x3a41('0x1f')]=qs[_0x3a41('0x1f')](_0x25dcc2[_0x3a41('0x35')]['offset']);_0x3cd8e6['order']=qs[_0x3a41('0x3e')](_0x25dcc2[_0x3a41('0x35')][_0x3a41('0x3e')]);_0x3cd8e6[_0x3a41('0x3f')]=qs[_0x3a41('0x36')](_[_0x3a41('0x40')](_0x25dcc2['query'],_0x13e116[_0x3a41('0x36')]));_0x3cd8e6=_['merge']({},_0x3cd8e6,_0x25dcc2[_0x3a41('0x44')]);return _0x4c6d0f[_0x3a41('0x28')+_[_0x3a41('0x5d')](_0x25dcc2[_0x3a41('0x35')][_0x3a41('0x59')]['toLowerCase']())+_0x3a41('0x60')](_0x3cd8e6);})['then'](respondWithResult(_0x462294,null))[_0x3a41('0x4e')](handleError(_0x462294,null));};exports[_0x3a41('0x61')]=function(_0x32b054,_0x3232ea,_0x2861f5){return db[_0x3a41('0x45')][_0x3a41('0x57')]({'where':{'id':_0x32b054[_0x3a41('0x4b')]['id']}})[_0x3a41('0x26')](function(_0x4cd94b){if(_0x4cd94b){if(!_0x32b054['body'][_0x3a41('0x59')]||!utils[_0x3a41('0x58')](_0x32b054[_0x3a41('0x50')][_0x3a41('0x59')])){throw new db[(_0x3a41('0x5a'))]['ValidationError']('Unknown\x20channel');}return _0x4cd94b[_0x3a41('0x62')+_['capitalize'](_0x32b054[_0x3a41('0x50')]['channel'][_0x3a41('0x5e')]())+_0x3a41('0x60')](_0x32b054[_0x3a41('0x50')]['ids']);}return null;})[_0x3a41('0x26')](handleEntityNotFound(_0x3232ea,null))[_0x3a41('0x26')](respondWithStatusCode(_0x3232ea,null))[_0x3a41('0x4e')](handleError(_0x3232ea,null));};exports['removeQueues']=function(_0xa4d112,_0x52050c,_0x6f3c76){return db[_0x3a41('0x45')]['findOne']({'where':{'id':_0xa4d112[_0x3a41('0x4b')]['id']}})[_0x3a41('0x26')](function(_0x2a1e24){if(_0x2a1e24){if(!_0xa4d112[_0x3a41('0x35')][_0x3a41('0x59')]||!utils[_0x3a41('0x58')](_0xa4d112['query'][_0x3a41('0x59')])){throw new db['Sequelize'][(_0x3a41('0x5b'))]('Unknown\x20channel');}return _0x2a1e24[_0x3a41('0x63')+_[_0x3a41('0x5d')](_0xa4d112['query'][_0x3a41('0x59')]['toLowerCase']())+_0x3a41('0x60')](_0xa4d112[_0x3a41('0x35')]['ids']);}return null;})[_0x3a41('0x26')](handleEntityNotFound(_0x52050c,null))[_0x3a41('0x26')](respondWithStatusCode(_0x52050c,null))[_0x3a41('0x4e')](handleError(_0x52050c,null));};exports[_0x3a41('0x64')]=function(_0x3f3a4b,_0x4c2f75,_0x3556f6){return db[_0x3a41('0x45')][_0x3a41('0x53')]({'where':{'id':_0x3f3a4b[_0x3a41('0x4b')]['id']}})[_0x3a41('0x26')](handleEntityNotFound(_0x4c2f75,null))['then'](function(_0x1a21fc){if(_0x1a21fc){var _0x53d5e3=[_0x3a41('0x65'),_0x3a41('0x66'),_0x3a41('0x67'),_0x3a41('0x68'),_0x3a41('0x69'),_0x3a41('0x6a')];return BPromise['each'](_0x53d5e3,function(_0x2e7bcc){return _0x1a21fc['get'+_0x2e7bcc+_0x3a41('0x60')]({'attributes':['id',_0x3a41('0x2d')]})[_0x3a41('0x26')](function(_0x4fd432){return BPromise['each'](_0x4fd432,function(_0x3ceb33){return _0x3ceb33[_0x3a41('0x64')](_0x3f3a4b[_0x3a41('0x50')][_0x3a41('0x6b')])['then'](function(){if(_0x2e7bcc==='Voice'){return db['User'][_0x3a41('0x48')]({'where':{'id':_0x3f3a4b[_0x3a41('0x50')][_0x3a41('0x6b')]},'attributes':['id','name',_0x3a41('0x6c'),_0x3a41('0x6d'),_0x3a41('0x6e')],'raw':!![]})[_0x3a41('0x26')](function(_0x1b02fd){return BPromise[_0x3a41('0x6f')](_[_0x3a41('0x42')](_0x1b02fd,{'online':0x1}),function(_0x27bdc3){return db['UserVoiceQueueRt'][_0x3a41('0x70')]({'membername':_0x27bdc3[_0x3a41('0x2d')],'UserId':_0x27bdc3['id'],'queue_name':_0x3ceb33[_0x3a41('0x2d')],'VoiceQueueId':_0x3ceb33['id'],'interface':_[_0x3a41('0x71')](_0x27bdc3[_0x3a41('0x6e')])?util[_0x3a41('0x72')]('SIP/%s',_0x27bdc3['name']):_0x27bdc3['interface'],'paused':_0x27bdc3['voicePause']||![],'penalty':0x0});});});}});});})['then'](function(){return _0x1a21fc;});})[_0x3a41('0x26')](function(){return _0x1a21fc;});}})['then'](function(_0x3a7f6b){if(_0x3a7f6b){return _0x3a7f6b['addAgents'](_0x3f3a4b['body'][_0x3a41('0x6b')],_[_0x3a41('0x73')](_0x3f3a4b[_0x3a41('0x50')],[_0x3a41('0x6b'),'id'])||{})[_0x3a41('0x74')](function(_0x4e20cd){for(var _0x5da6d3=0x0;_0x5da6d3<_0x3f3a4b[_0x3a41('0x50')][_0x3a41('0x6b')]['length'];_0x5da6d3+=0x1){socket['emit'](_0x3a41('0x75'),{'UserId':_0x3f3a4b[_0x3a41('0x50')][_0x3a41('0x6b')][_0x5da6d3],'TeamId':_0x3f3a4b[_0x3a41('0x4b')]['id']});}return _0x4e20cd;});}})[_0x3a41('0x26')](respondWithResult(_0x4c2f75,null))[_0x3a41('0x4e')](handleError(_0x4c2f75,null));};exports[_0x3a41('0x76')]=function(_0x4a696b,_0x3a87ab,_0x3e8250){return db[_0x3a41('0x45')][_0x3a41('0x53')]({'where':{'id':_0x4a696b[_0x3a41('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3a87ab,null))['then'](function(_0x33c8af){if(_0x33c8af){return BPromise[_0x3a41('0x6f')]([_0x3a41('0x77'),_0x3a41('0x78'),'mail',_0x3a41('0x79'),_0x3a41('0x7a'),'openchannel'],function(_0x1c5b16){return _0x33c8af['get'+_['capitalize'](_0x1c5b16)+_0x3a41('0x60')]({'attributes':['id','name']})[_0x3a41('0x26')](function(_0x35bf6b){return BPromise[_0x3a41('0x6f')](_0x35bf6b,function(_0x8b4fcf){return _0x8b4fcf[_0x3a41('0x76')](_0x4a696b[_0x3a41('0x35')][_0x3a41('0x6b')])[_0x3a41('0x26')](function(){if(_0x1c5b16===_0x3a41('0x77')){return db[_0x3a41('0x7b')][_0x3a41('0x27')]({'where':{'VoiceQueueId':_0x8b4fcf['id'],'UserId':_0x4a696b[_0x3a41('0x35')][_0x3a41('0x6b')]}});}});});})['then'](function(){return _0x33c8af;});})[_0x3a41('0x26')](function(){return _0x33c8af;});}})[_0x3a41('0x26')](function(_0x451372){if(_0x451372){return _0x451372['removeAgents'](_0x4a696b['query']['ids'])[_0x3a41('0x26')](function(){if(_['isArray'](_0x4a696b['query'][_0x3a41('0x6b')])){for(var _0x211203=0x0;_0x211203<_0x4a696b[_0x3a41('0x35')][_0x3a41('0x6b')]['length'];_0x211203+=0x1){socket['emit']('userTeam:remove',{'UserId':Number(_0x4a696b[_0x3a41('0x35')][_0x3a41('0x6b')][_0x211203]),'TeamId':Number(_0x4a696b[_0x3a41('0x4b')]['id'])});}}else{socket['emit'](_0x3a41('0x7c'),{'UserId':Number(_0x4a696b[_0x3a41('0x35')]['ids']),'TeamId':Number(_0x4a696b[_0x3a41('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x3a87ab,null))[_0x3a41('0x4e')](handleError(_0x3a87ab,null));};exports[_0x3a41('0x7d')]=function(_0x5632ad,_0x236eab,_0x522277){var _0x182fd0={};var _0x4fba2c={};var _0x60c2fe;var _0x1c20d6;return db[_0x3a41('0x45')][_0x3a41('0x57')]({'where':{'id':_0x5632ad[_0x3a41('0x4b')]['id']}})['then'](handleEntityNotFound(_0x236eab,null))['then'](function(_0x3e5337){if(_0x3e5337){_0x60c2fe=_0x3e5337;_0x4fba2c[_0x3a41('0x33')]=_['keys'](db['User'][_0x3a41('0x4d')]);_0x4fba2c[_0x3a41('0x35')]=_[_0x3a41('0x4c')](_0x5632ad['query']);_0x4fba2c[_0x3a41('0x36')]=_[_0x3a41('0x38')](_0x4fba2c['model'],_0x4fba2c[_0x3a41('0x35')]);_0x182fd0['attributes']=_['intersection'](_0x4fba2c['model'],qs[_0x3a41('0x39')](_0x5632ad[_0x3a41('0x35')][_0x3a41('0x39')]));_0x182fd0[_0x3a41('0x37')]=_0x182fd0['attributes'][_0x3a41('0x3a')]?_0x182fd0[_0x3a41('0x37')]:_0x4fba2c[_0x3a41('0x33')];_0x182fd0[_0x3a41('0x3d')]=qs[_0x3a41('0x3e')](_0x5632ad[_0x3a41('0x35')]['sort']);_0x182fd0[_0x3a41('0x3f')]=qs[_0x3a41('0x36')](_['pick'](_0x5632ad[_0x3a41('0x35')],_0x4fba2c[_0x3a41('0x36')]));if(_0x5632ad[_0x3a41('0x35')]['filter']){_0x182fd0[_0x3a41('0x3f')]=_[_0x3a41('0x43')](_0x182fd0[_0x3a41('0x3f')],{'$or':_[_0x3a41('0x34')](_0x182fd0[_0x3a41('0x37')],function(_0x108778){var _0x24cb2c={};_0x24cb2c[_0x108778]={'$like':'%'+_0x5632ad[_0x3a41('0x35')][_0x3a41('0x42')]+'%'};return _0x24cb2c;})});}_0x182fd0=_['merge']({},_0x182fd0,_0x5632ad[_0x3a41('0x44')]);return _0x60c2fe[_0x3a41('0x7d')](_0x182fd0);}})[_0x3a41('0x26')](function(_0x14fdda){if(_0x14fdda){_0x1c20d6=_0x14fdda['length'];if(!_0x5632ad[_0x3a41('0x35')][_0x3a41('0x3b')](_0x3a41('0x7e'))){_0x182fd0[_0x3a41('0x3c')]=qs[_0x3a41('0x3c')](_0x5632ad[_0x3a41('0x35')]['limit']);_0x182fd0[_0x3a41('0x1f')]=qs['offset'](_0x5632ad[_0x3a41('0x35')][_0x3a41('0x1f')]);}return _0x60c2fe['getAgents'](_0x182fd0);}})[_0x3a41('0x26')](function(_0x1a9b54){if(_0x1a9b54){return _0x1a9b54?{'count':_0x1c20d6,'rows':_0x1a9b54}:null;}})[_0x3a41('0x26')](respondWithResult(_0x236eab,null))['catch'](handleError(_0x236eab,null));}; \ No newline at end of file +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 diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index decd471..d009cb4 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 _0x5516=['exports','../../mysqldb','Team','update','remove','emit','hook'];(function(_0x108117,_0x1dd9ec){var _0x18d55f=function(_0x5c11d6){while(--_0x5c11d6){_0x108117['push'](_0x108117['shift']());}};_0x18d55f(++_0x1dd9ec);}(_0x5516,0xd3));var _0x6551=function(_0x49348a,_0x2ca546){_0x49348a=_0x49348a-0x0;var _0x209919=_0x5516[_0x49348a];return _0x209919;};'use strict';var EventEmitter=require('events');var Team=require(_0x6551('0x0'))['db'][_0x6551('0x1')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6551('0x2'),'afterDestroy':_0x6551('0x3')};function emitEvent(_0x4d7caf){return function(_0xca51a,_0x3a7482,_0xff4bee){TeamEvents[_0x6551('0x4')](_0x4d7caf+':'+_0xca51a['id'],_0xca51a);TeamEvents['emit'](_0x4d7caf,_0xca51a);_0xff4bee(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x6551('0x5')](e,emitEvent(event));}}module[_0x6551('0x6')]=TeamEvents; \ No newline at end of file +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 diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 2f4df65..7a0cbd2 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 _0x176f=['bluebird','path','../../config/environment','./team.attributes','exports','define','Team','teams','lodash','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x176f,0x128));var _0xf176=function(_0x2fb914,_0x38e78d){_0x2fb914=_0x2fb914-0x0;var _0x4e0a97=_0x176f[_0x2fb914];return _0x4e0a97;};'use strict';var _=require(_0xf176('0x0'));var util=require('util');var logger=require(_0xf176('0x1'))(_0xf176('0x2'));var moment=require(_0xf176('0x3'));var BPromise=require(_0xf176('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf176('0x5'));var rimraf=require('rimraf');var config=require(_0xf176('0x6'));var attributes=require(_0xf176('0x7'));module[_0xf176('0x8')]=function(_0x27edf6,_0x223916){return _0x27edf6[_0xf176('0x9')](_0xf176('0xa'),attributes,{'tableName':_0xf176('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 69949aa..b574077 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 _0x9b75=['client','http','redis','socket.io-emitter','./team.socket','register','request','request\x20sent','error','code','Team,\x20%s,\x20%s','message','info','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x4e317c,_0x49416e){var _0x244b2e=function(_0x5ecfdf){while(--_0x5ecfdf){_0x4e317c['push'](_0x4e317c['shift']());}};_0x244b2e(++_0x49416e);}(_0x9b75,0xea));var _0x59b7=function(_0x232522,_0x538741){_0x232522=_0x232522-0x0;var _0xdf32fd=_0x9b75[_0x232522];return _0xdf32fd;};'use strict';var _=require(_0x59b7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x59b7('0x1'));var rs=require(_0x59b7('0x2'));var fs=require('fs');var Redis=require(_0x59b7('0x3'));var db=require(_0x59b7('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x59b7('0x5'));var config=require(_0x59b7('0x6'));var jayson=require(_0x59b7('0x7'));var client=jayson[_0x59b7('0x8')][_0x59b7('0x9')]({'port':0x232a});config[_0x59b7('0xa')]=_['defaults'](config[_0x59b7('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x59b7('0xb'))(new Redis(config[_0x59b7('0xa')]));require(_0x59b7('0xc'))[_0x59b7('0xd')](socket);function respondWithRpcPromise(_0x46cf92,_0x1ee813,_0x542665){return new BPromise(function(_0x404865,_0x40e9fc){return client[_0x59b7('0xe')](_0x46cf92,_0x542665)['then'](function(_0x182dcd){logger['info']('Team,\x20%s,\x20%s',_0x1ee813,'request\x20sent');logger['debug']('Team,\x20%s,\x20%s,\x20%s',_0x1ee813,_0x59b7('0xf'),JSON['stringify'](_0x182dcd));if(_0x182dcd[_0x59b7('0x10')]){if(_0x182dcd[_0x59b7('0x10')][_0x59b7('0x11')]===0x1f4){logger[_0x59b7('0x10')](_0x59b7('0x12'),_0x1ee813,_0x182dcd['error'][_0x59b7('0x13')]);return _0x40e9fc(_0x182dcd['error'][_0x59b7('0x13')]);}logger[_0x59b7('0x10')](_0x59b7('0x12'),_0x1ee813,_0x182dcd[_0x59b7('0x10')][_0x59b7('0x13')]);return _0x404865(_0x182dcd[_0x59b7('0x10')]['message']);}else{logger[_0x59b7('0x14')]('Team,\x20%s,\x20%s',_0x1ee813,_0x59b7('0xf'));_0x404865(_0x182dcd['result'][_0x59b7('0x13')]);}})[_0x59b7('0x15')](function(_0x218f2e){logger[_0x59b7('0x10')](_0x59b7('0x12'),_0x1ee813,_0x218f2e);_0x40e9fc(_0x218f2e);});});} \ No newline at end of file +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 diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 305a71a..9ab9181 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 _0xb5f3=['save','remove','removeListener','register','length','./team.events'];(function(_0x16de43,_0x2bb75f){var _0x2aaa5d=function(_0x5d6eee){while(--_0x5d6eee){_0x16de43['push'](_0x16de43['shift']());}};_0x2aaa5d(++_0x2bb75f);}(_0xb5f3,0x137));var _0x3b5f=function(_0x328b1c,_0xec0b4f){_0x328b1c=_0x328b1c-0x0;var _0x4dbeaa=_0xb5f3[_0x328b1c];return _0x4dbeaa;};'use strict';var TeamEvents=require(_0x3b5f('0x0'));var events=[_0x3b5f('0x1'),_0x3b5f('0x2'),'update'];function createListener(_0x353a99,_0x3a5ace){return function(_0x3a2c25){_0x3a5ace['emit'](_0x353a99,_0x3a2c25);};}function removeListener(_0x533286,_0x32a452){return function(){TeamEvents[_0x3b5f('0x3')](_0x533286,_0x32a452);};}exports[_0x3b5f('0x4')]=function(_0x42d102){for(var _0x55c7b4=0x0,_0x2db4ad=events[_0x3b5f('0x5')];_0x55c7b4<_0x2db4ad;_0x55c7b4++){var _0x4edb1a=events[_0x55c7b4];var _0x2e213c=createListener('team:'+_0x4edb1a,_0x42d102);TeamEvents['on'](_0x4edb1a,_0x2e213c);}}; \ No newline at end of file +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 diff --git a/server/api/template/index.js b/server/api/template/index.js index 1362234..45e9e56 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 _0xcfe2=['post','create','delete','exports','multer','util','path','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show'];(function(_0xa9f272,_0x25ddd3){var _0x56494f=function(_0x13a251){while(--_0x13a251){_0xa9f272['push'](_0xa9f272['shift']());}};_0x56494f(++_0x25ddd3);}(_0xcfe2,0x1e4));var _0x2cfe=function(_0x293329,_0x25a7dc){_0x293329=_0x293329-0x0;var _0xabc045=_0xcfe2[_0x293329];return _0xabc045;};'use strict';var multer=require(_0x2cfe('0x0'));var util=require(_0x2cfe('0x1'));var path=require(_0x2cfe('0x2'));var timeout=require('connect-timeout');var express=require(_0x2cfe('0x3'));var router=express[_0x2cfe('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2cfe('0x5'));var config=require('../../config/environment');var controller=require('./template.controller');router[_0x2cfe('0x6')]('/',auth[_0x2cfe('0x7')](),controller[_0x2cfe('0x8')]);router[_0x2cfe('0x6')](_0x2cfe('0x9'),auth[_0x2cfe('0x7')](),controller[_0x2cfe('0xa')]);router[_0x2cfe('0xb')]('/',auth['isAuthenticated'](),controller[_0x2cfe('0xc')]);router['put'](_0x2cfe('0x9'),auth[_0x2cfe('0x7')](),controller['update']);router[_0x2cfe('0xd')](_0x2cfe('0x9'),auth[_0x2cfe('0x7')](),controller['destroy']);module[_0x2cfe('0xe')]=router; \ No newline at end of file +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 diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index bc23cfa..79e0482 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 _0xc3ed=['TEXT'];(function(_0x3d243c,_0x26b00d){var _0x562131=function(_0x55bbdd){while(--_0x55bbdd){_0x3d243c['push'](_0x3d243c['shift']());}};_0x562131(++_0x26b00d);}(_0xc3ed,0xb2));var _0xdc3e=function(_0x3280c8,_0x341c9b){_0x3280c8=_0x3280c8-0x0;var _0x55737f=_0xc3ed[_0x3280c8];return _0x55737f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xdc3e('0x0')]}}; \ No newline at end of file +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 diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index fcab6ce..8c4c627 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 _0x0e0b=['destroy','get','UserProfileResource','end','error','stack','name','send','index','map','Template','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','params','intersection','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then'];(function(_0x5e3701,_0x596265){var _0x345dcf=function(_0x5eb12a){while(--_0x5eb12a){_0x5e3701['push'](_0x5e3701['shift']());}};_0x345dcf(++_0x596265);}(_0x0e0b,0xd2));var _0xb0e0=function(_0x401676,_0x3f1436){_0x401676=_0x401676-0x0;var _0x4f13fe=_0x0e0b[_0x401676];return _0x4f13fe;};'use strict';var pdf=require(_0xb0e0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb0e0('0x1'));var zipdir=require(_0xb0e0('0x2'));var jsonpatch=require(_0xb0e0('0x3'));var rp=require(_0xb0e0('0x4'));var moment=require(_0xb0e0('0x5'));var BPromise=require(_0xb0e0('0x6'));var Mustache=require('mustache');var util=require(_0xb0e0('0x7'));var path=require('path');var sox=require(_0xb0e0('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb0e0('0x9'));var squel=require(_0xb0e0('0xa'));var crypto=require('crypto');var jsforce=require(_0xb0e0('0xb'));var deskjs=require(_0xb0e0('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb0e0('0xd'));var Papa=require(_0xb0e0('0xe'));var Redis=require(_0xb0e0('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb0e0('0x10'));var as=require(_0xb0e0('0x11'));var hardwareService=require(_0xb0e0('0x12'));var logger=require(_0xb0e0('0x13'))(_0xb0e0('0x14'));var utils=require(_0xb0e0('0x15'));var config=require('../../config/environment');var db=require(_0xb0e0('0x16'))['db'];function respondWithStatusCode(_0x2e9e1b,_0x3a5f03){_0x3a5f03=_0x3a5f03||0xcc;return function(_0xd8143b){if(_0xd8143b){return _0x2e9e1b[_0xb0e0('0x17')](_0x3a5f03);}return _0x2e9e1b[_0xb0e0('0x18')](_0x3a5f03)['end']();};}function respondWithResult(_0x46e077,_0x434be0){_0x434be0=_0x434be0||0xc8;return function(_0x733027){if(_0x733027){return _0x46e077['status'](_0x434be0)[_0xb0e0('0x19')](_0x733027);}};}function respondWithFilteredResult(_0xb94443,_0x397b04){return function(_0x73ddd1){if(_0x73ddd1){var _0x26083b=_0x73ddd1[_0xb0e0('0x1a')],_0x1df85a=_0x397b04[_0xb0e0('0x1b')],_0x2205f4=_0x397b04[_0xb0e0('0x1b')]+_0x397b04[_0xb0e0('0x1c')],_0x510a31;if(_0x2205f4>=_0x26083b){_0x2205f4=_0x26083b;_0x510a31=0xc8;}else{_0x510a31=0xce;}_0xb94443[_0xb0e0('0x18')](_0x510a31);return _0xb94443[_0xb0e0('0x1d')](_0xb0e0('0x1e'),_0x1df85a+'-'+_0x2205f4+'/'+_0x26083b)[_0xb0e0('0x19')](_0x73ddd1);}return null;};}function patchUpdates(_0x2801ca){return function(_0x4c10ee){try{jsonpatch[_0xb0e0('0x1f')](_0x4c10ee,_0x2801ca,!![]);}catch(_0x3e1feb){return BPromise[_0xb0e0('0x20')](_0x3e1feb);}return _0x4c10ee[_0xb0e0('0x21')]();};}function saveUpdates(_0x4cd5dc,_0x32006f){return function(_0x3692fc){if(_0x3692fc){return _0x3692fc[_0xb0e0('0x22')](_0x4cd5dc)[_0xb0e0('0x23')](function(_0x43c213){return _0x43c213;});}return null;};}function removeEntity(_0x65e96d,_0x2f2826){return function(_0x38b631){if(_0x38b631){return _0x38b631[_0xb0e0('0x24')]()[_0xb0e0('0x23')](function(){var _0x607080=_0x38b631[_0xb0e0('0x25')]({'plain':!![]});var _0xe391df='Templates';return db[_0xb0e0('0x26')][_0xb0e0('0x24')]({'where':{'type':_0xe391df,'resourceId':_0x607080['id']}})[_0xb0e0('0x23')](function(){return _0x38b631;});})[_0xb0e0('0x23')](function(){_0x65e96d[_0xb0e0('0x18')](0xcc)[_0xb0e0('0x27')]();});}};}function handleEntityNotFound(_0x5f3f22,_0xbe814d){return function(_0x2798eb){if(!_0x2798eb){_0x5f3f22['sendStatus'](0x194);}return _0x2798eb;};}function handleError(_0x3255cf,_0x40d140){_0x40d140=_0x40d140||0x1f4;return function(_0x382d03){logger[_0xb0e0('0x28')](_0x382d03[_0xb0e0('0x29')]);if(_0x382d03[_0xb0e0('0x2a')]){delete _0x382d03[_0xb0e0('0x2a')];}_0x3255cf[_0xb0e0('0x18')](_0x40d140)[_0xb0e0('0x2b')](_0x382d03);};}exports[_0xb0e0('0x2c')]=function(_0x371f4f,_0x207af0){var _0x2f0a6f={},_0x32473e={},_0x539111={'count':0x0,'rows':[]};var _0x4e43db=_[_0xb0e0('0x2d')](db[_0xb0e0('0x2e')][_0xb0e0('0x2f')],function(_0x1c2bc8){return{'name':_0x1c2bc8[_0xb0e0('0x30')],'type':_0x1c2bc8[_0xb0e0('0x31')][_0xb0e0('0x32')]};});_0x32473e[_0xb0e0('0x33')]=_[_0xb0e0('0x2d')](_0x4e43db,'name');_0x32473e[_0xb0e0('0x34')]=_[_0xb0e0('0x35')](_0x371f4f[_0xb0e0('0x34')]);_0x32473e[_0xb0e0('0x36')]=_['intersection'](_0x32473e[_0xb0e0('0x33')],_0x32473e[_0xb0e0('0x34')]);_0x2f0a6f['attributes']=_['intersection'](_0x32473e[_0xb0e0('0x33')],qs[_0xb0e0('0x37')](_0x371f4f[_0xb0e0('0x34')][_0xb0e0('0x37')]));_0x2f0a6f[_0xb0e0('0x38')]=_0x2f0a6f['attributes'][_0xb0e0('0x39')]?_0x2f0a6f[_0xb0e0('0x38')]:_0x32473e[_0xb0e0('0x33')];if(!_0x371f4f[_0xb0e0('0x34')][_0xb0e0('0x3a')](_0xb0e0('0x3b'))){_0x2f0a6f[_0xb0e0('0x1c')]=qs[_0xb0e0('0x1c')](_0x371f4f[_0xb0e0('0x34')]['limit']);_0x2f0a6f['offset']=qs[_0xb0e0('0x1b')](_0x371f4f[_0xb0e0('0x34')]['offset']);}_0x2f0a6f[_0xb0e0('0x3c')]=qs[_0xb0e0('0x3d')](_0x371f4f['query'][_0xb0e0('0x3d')]);_0x2f0a6f[_0xb0e0('0x3e')]=qs[_0xb0e0('0x36')](_['pick'](_0x371f4f[_0xb0e0('0x34')],_0x32473e[_0xb0e0('0x36')]));if(_0x371f4f['query']['filter']){_0x2f0a6f[_0xb0e0('0x3e')]=_[_0xb0e0('0x3f')](_0x2f0a6f[_0xb0e0('0x3e')],{'$or':_[_0xb0e0('0x2d')](_0x4e43db,function(_0x1a6f1d){if(_0x1a6f1d[_0xb0e0('0x31')]!==_0xb0e0('0x40')){var _0x493274={};_0x493274[_0x1a6f1d[_0xb0e0('0x2a')]]={'$like':'%'+_0x371f4f['query'][_0xb0e0('0x41')]+'%'};return _0x493274;}})});}_0x2f0a6f=_['merge']({},_0x2f0a6f,_0x371f4f[_0xb0e0('0x42')]);var _0x467a3f={'where':_0x2f0a6f[_0xb0e0('0x3e')]};return db[_0xb0e0('0x2e')][_0xb0e0('0x1a')](_0x467a3f)[_0xb0e0('0x23')](function(_0x405aab){_0x539111[_0xb0e0('0x1a')]=_0x405aab;if(_0x371f4f[_0xb0e0('0x34')][_0xb0e0('0x43')]){_0x2f0a6f[_0xb0e0('0x44')]=[{'all':!![]}];}return db[_0xb0e0('0x2e')]['findAll'](_0x2f0a6f);})['then'](function(_0x435042){_0x539111[_0xb0e0('0x45')]=_0x435042;return _0x539111;})[_0xb0e0('0x23')](respondWithFilteredResult(_0x207af0,_0x2f0a6f))[_0xb0e0('0x46')](handleError(_0x207af0,null));};exports['show']=function(_0x4501dd,_0x1702d1){var _0x55ba3a={'raw':!![],'where':{'id':_0x4501dd[_0xb0e0('0x47')]['id']}},_0x53e533={};_0x53e533[_0xb0e0('0x33')]=_['keys'](db[_0xb0e0('0x2e')]['rawAttributes']);_0x53e533[_0xb0e0('0x34')]=_[_0xb0e0('0x35')](_0x4501dd['query']);_0x53e533[_0xb0e0('0x36')]=_[_0xb0e0('0x48')](_0x53e533[_0xb0e0('0x33')],_0x53e533['query']);_0x55ba3a[_0xb0e0('0x38')]=_[_0xb0e0('0x48')](_0x53e533[_0xb0e0('0x33')],qs[_0xb0e0('0x37')](_0x4501dd['query'][_0xb0e0('0x37')]));_0x55ba3a[_0xb0e0('0x38')]=_0x55ba3a[_0xb0e0('0x38')][_0xb0e0('0x39')]?_0x55ba3a[_0xb0e0('0x38')]:_0x53e533[_0xb0e0('0x33')];if(_0x4501dd[_0xb0e0('0x34')][_0xb0e0('0x43')]){_0x55ba3a['include']=[{'all':!![]}];}_0x55ba3a=_[_0xb0e0('0x3f')]({},_0x55ba3a,_0x4501dd['options']);return db[_0xb0e0('0x2e')][_0xb0e0('0x49')](_0x55ba3a)[_0xb0e0('0x23')](handleEntityNotFound(_0x1702d1,null))[_0xb0e0('0x23')](respondWithResult(_0x1702d1,null))['catch'](handleError(_0x1702d1,null));};exports[_0xb0e0('0x4a')]=function(_0x41b404,_0x2be400){return db[_0xb0e0('0x2e')][_0xb0e0('0x4a')](_0x41b404[_0xb0e0('0x4b')],{})[_0xb0e0('0x23')](function(_0x13e104){var _0x1a32f0=_0x41b404[_0xb0e0('0x4c')][_0xb0e0('0x25')]({'plain':!![]});if(!_0x1a32f0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a32f0[_0xb0e0('0x4d')]===_0xb0e0('0x4c')){var _0x4490ab=_0x13e104['get']({'plain':!![]});var _0x5d2988='Templates';return db[_0xb0e0('0x4e')][_0xb0e0('0x49')]({'where':{'name':_0x5d2988,'userProfileId':_0x1a32f0[_0xb0e0('0x4f')]},'raw':!![]})[_0xb0e0('0x23')](function(_0x3e88a9){if(_0x3e88a9&&_0x3e88a9[_0xb0e0('0x50')]===0x0){return db['UserProfileResource'][_0xb0e0('0x4a')]({'name':_0x4490ab['name'],'resourceId':_0x4490ab['id'],'type':_0x3e88a9[_0xb0e0('0x2a')],'sectionId':_0x3e88a9['id']},{})['then'](function(){return _0x13e104;});}else{return _0x13e104;}})[_0xb0e0('0x46')](function(_0x393ca3){logger['error'](_0xb0e0('0x51'),_0x393ca3);throw _0x393ca3;});}return _0x13e104;})[_0xb0e0('0x23')](respondWithResult(_0x2be400,0xc9))[_0xb0e0('0x46')](handleError(_0x2be400,null));};exports['update']=function(_0xb3c2f3,_0x190699){if(_0xb3c2f3[_0xb0e0('0x4b')]['id']){delete _0xb3c2f3[_0xb0e0('0x4b')]['id'];}return db[_0xb0e0('0x2e')][_0xb0e0('0x49')]({'where':{'id':_0xb3c2f3['params']['id']}})['then'](handleEntityNotFound(_0x190699,null))[_0xb0e0('0x23')](saveUpdates(_0xb3c2f3[_0xb0e0('0x4b')],null))[_0xb0e0('0x23')](respondWithResult(_0x190699,null))[_0xb0e0('0x46')](handleError(_0x190699,null));};exports[_0xb0e0('0x24')]=function(_0x57abbd,_0x4a5da6){return db[_0xb0e0('0x2e')][_0xb0e0('0x49')]({'where':{'id':_0x57abbd[_0xb0e0('0x47')]['id']}})[_0xb0e0('0x23')](handleEntityNotFound(_0x4a5da6,null))[_0xb0e0('0x23')](removeEntity(_0x4a5da6,null))['catch'](handleError(_0x4a5da6,null));}; \ No newline at end of file +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 diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index c47b646..8054069 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 _0x05fc=['exports','define','Template','tools_templates','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes'];(function(_0x309a3d,_0x2fc838){var _0x3086ad=function(_0x2ce0ef){while(--_0x2ce0ef){_0x309a3d['push'](_0x309a3d['shift']());}};_0x3086ad(++_0x2fc838);}(_0x05fc,0x170));var _0xc05f=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0x05fc[_0x298ed3];return _0x5aad28;};'use strict';var _=require(_0xc05f('0x0'));var util=require(_0xc05f('0x1'));var logger=require(_0xc05f('0x2'))('api');var moment=require(_0xc05f('0x3'));var BPromise=require(_0xc05f('0x4'));var rp=require(_0xc05f('0x5'));var fs=require('fs');var path=require(_0xc05f('0x6'));var rimraf=require(_0xc05f('0x7'));var config=require(_0xc05f('0x8'));var attributes=require(_0xc05f('0x9'));module[_0xc05f('0xa')]=function(_0xebb8d9,_0x42ac22){return _0xebb8d9[_0xc05f('0xb')](_0xc05f('0xc'),attributes,{'tableName':_0xc05f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 11c754d..7224bcf 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 _0x798e=['include','model','attributes','map','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','Template,\x20%s,\x20%s','message','result','catch','GetTemplate','Template','findAll','options','raw'];(function(_0x8fb5c,_0x18764e){var _0x43c194=function(_0x17ef0f){while(--_0x17ef0f){_0x8fb5c['push'](_0x8fb5c['shift']());}};_0x43c194(++_0x18764e);}(_0x798e,0x1c5));var _0xe798=function(_0x1c14e2,_0x419669){_0x1c14e2=_0x1c14e2-0x0;var _0x34225f=_0x798e[_0x1c14e2];return _0x34225f;};'use strict';var _=require(_0xe798('0x0'));var util=require(_0xe798('0x1'));var moment=require('moment');var BPromise=require(_0xe798('0x2'));var rs=require(_0xe798('0x3'));var fs=require('fs');var Redis=require(_0xe798('0x4'));var db=require(_0xe798('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe798('0x6'))(_0xe798('0x7'));var config=require('../../config/environment');var jayson=require(_0xe798('0x8'));var client=jayson[_0xe798('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2041b6,_0x293b4d,_0x3b1238){return new BPromise(function(_0x5e889a,_0x4e73e0){return client[_0xe798('0xa')](_0x2041b6,_0x3b1238)[_0xe798('0xb')](function(_0x59e43f){logger['info']('Template,\x20%s,\x20%s',_0x293b4d,_0xe798('0xc'));logger[_0xe798('0xd')](_0xe798('0xe'),_0x293b4d,_0xe798('0xc'),JSON[_0xe798('0xf')](_0x59e43f));if(_0x59e43f[_0xe798('0x10')]){if(_0x59e43f[_0xe798('0x10')][_0xe798('0x11')]===0x1f4){logger[_0xe798('0x10')](_0xe798('0x12'),_0x293b4d,_0x59e43f[_0xe798('0x10')]['message']);return _0x4e73e0(_0x59e43f[_0xe798('0x10')][_0xe798('0x13')]);}logger[_0xe798('0x10')](_0xe798('0x12'),_0x293b4d,_0x59e43f['error']['message']);return _0x5e889a(_0x59e43f['error'][_0xe798('0x13')]);}else{logger['info']('Template,\x20%s,\x20%s',_0x293b4d,_0xe798('0xc'));_0x5e889a(_0x59e43f[_0xe798('0x14')][_0xe798('0x13')]);}})[_0xe798('0x15')](function(_0x1a0ada){logger[_0xe798('0x10')]('Template,\x20%s,\x20%s',_0x293b4d,_0x1a0ada);_0x4e73e0(_0x1a0ada);});});}exports[_0xe798('0x16')]=function(_0x28ad6a){var _0x75d29a=this;return new Promise(function(_0x3e0e78,_0x265d40){return db[_0xe798('0x17')][_0xe798('0x18')]({'raw':_0x28ad6a[_0xe798('0x19')]?_0x28ad6a['options'][_0xe798('0x1a')]===undefined?!![]:![]:!![],'where':_0x28ad6a[_0xe798('0x19')]?_0x28ad6a[_0xe798('0x19')]['where']||null:null,'attributes':_0x28ad6a[_0xe798('0x19')]?_0x28ad6a[_0xe798('0x19')]['attributes']||null:null,'limit':_0x28ad6a[_0xe798('0x19')]?_0x28ad6a[_0xe798('0x19')]['limit']||null:null,'include':_0x28ad6a['options']?_0x28ad6a[_0xe798('0x19')][_0xe798('0x1b')]?_['map'](_0x28ad6a[_0xe798('0x19')][_0xe798('0x1b')],function(_0x5a8187){return{'model':db[_0x5a8187[_0xe798('0x1c')]],'as':_0x5a8187['as'],'attributes':_0x5a8187['attributes'],'include':_0x5a8187[_0xe798('0x1b')]?_['map'](_0x5a8187[_0xe798('0x1b')],function(_0x4d282f){return{'model':db[_0x4d282f['model']],'as':_0x4d282f['as'],'attributes':_0x4d282f[_0xe798('0x1d')],'include':_0x4d282f[_0xe798('0x1b')]?_[_0xe798('0x1e')](_0x4d282f[_0xe798('0x1b')],function(_0x4054a2){return{'model':db[_0x4054a2[_0xe798('0x1c')]],'as':_0x4054a2['as'],'attributes':_0x4054a2[_0xe798('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x433650){logger[_0xe798('0x1f')](_0xe798('0x16'),_0x28ad6a);logger[_0xe798('0xd')]('GetTemplate',_0x28ad6a,JSON[_0xe798('0xf')](_0x433650));_0x3e0e78(_0x433650);})[_0xe798('0x15')](function(_0x57d842){logger[_0xe798('0x10')]('GetTemplate',_0x57d842['message'],_0x28ad6a);_0x265d40(_0x75d29a[_0xe798('0x10')](0x1f4,_0x57d842[_0xe798('0x13')]));});});}; \ No newline at end of file +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 diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 656e08e..8d25e4d 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 _0xce6b=['index','show','getAllConditions','/:id/any_conditions','/:id/actions','getActions','post','create','/:id/all_conditions','addAllCondition','addAnyCondition','put','/:id','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated'];(function(_0x5b4c7f,_0x18067e){var _0x4c65f0=function(_0x2325a6){while(--_0x2325a6){_0x5b4c7f['push'](_0x5b4c7f['shift']());}};_0x4c65f0(++_0x18067e);}(_0xce6b,0x1f0));var _0xbce6=function(_0x1a133a,_0x5b49ee){_0x1a133a=_0x1a133a-0x0;var _0x4bc538=_0xce6b[_0x1a133a];return _0x4bc538;};'use strict';var multer=require('multer');var util=require(_0xbce6('0x0'));var path=require(_0xbce6('0x1'));var timeout=require(_0xbce6('0x2'));var express=require(_0xbce6('0x3'));var router=express[_0xbce6('0x4')]();var auth=require(_0xbce6('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./trigger.controller');router[_0xbce6('0x6')]('/',auth[_0xbce6('0x7')](),controller[_0xbce6('0x8')]);router[_0xbce6('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xbce6('0x9')]);router[_0xbce6('0x6')]('/:id/all_conditions',auth[_0xbce6('0x7')](),controller[_0xbce6('0xa')]);router['get'](_0xbce6('0xb'),auth[_0xbce6('0x7')](),controller['getAnyConditions']);router['get'](_0xbce6('0xc'),auth[_0xbce6('0x7')](),controller[_0xbce6('0xd')]);router[_0xbce6('0xe')]('/',auth[_0xbce6('0x7')](),controller[_0xbce6('0xf')]);router[_0xbce6('0xe')](_0xbce6('0x10'),auth[_0xbce6('0x7')](),controller[_0xbce6('0x11')]);router[_0xbce6('0xe')]('/:id/any_conditions',auth[_0xbce6('0x7')](),controller[_0xbce6('0x12')]);router[_0xbce6('0xe')](_0xbce6('0xc'),auth['isAuthenticated'](),controller['addAction']);router[_0xbce6('0x13')](_0xbce6('0x14'),auth[_0xbce6('0x7')](),controller[_0xbce6('0x15')]);router[_0xbce6('0x16')]('/:id',auth[_0xbce6('0x7')](),controller['destroy']);module[_0xbce6('0x17')]=router; \ No newline at end of file +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 diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 7e30ea6..1e0260c 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 _0x83e9=['BOOLEAN','sequelize','exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x83e9,0x8d));var _0x983e=function(_0x416586,_0xbdf0b1){_0x416586=_0x416586-0x0;var _0x5cbb10=_0x83e9[_0x416586];return _0x5cbb10;};'use strict';var Sequelize=require(_0x983e('0x0'));module[_0x983e('0x1')]={'name':{'type':Sequelize[_0x983e('0x2')]},'channel':{'type':Sequelize[_0x983e('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x983e('0x3')],'defaultValue':![]}}; \ No newline at end of file +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 diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 1589b26..21d7ddc 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 _0x485e=['type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','Trigger','include','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','addAnyCondition','Condition','getAllConditions','findOne','options','nolimit','getAnyConditions','addAction','TriggerId','Action','getActions','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x485e,0x1f3));var _0xe485=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x485e[_0x4e9628];return _0x27bc8c;};'use strict';var pdf=require(_0xe485('0x0'));var emlformat=require(_0xe485('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe485('0x2'));var jsonpatch=require(_0xe485('0x3'));var rp=require(_0xe485('0x4'));var moment=require(_0xe485('0x5'));var BPromise=require(_0xe485('0x6'));var Mustache=require('mustache');var util=require(_0xe485('0x7'));var path=require(_0xe485('0x8'));var sox=require(_0xe485('0x9'));var csv=require(_0xe485('0xa'));var ejs=require(_0xe485('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe485('0xc'));var jsforce=require(_0xe485('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe485('0xa'));var querystring=require(_0xe485('0xe'));var Papa=require(_0xe485('0xf'));var Redis=require(_0xe485('0x10'));var authService=require(_0xe485('0x11'));var qs=require(_0xe485('0x12'));var as=require(_0xe485('0x13'));var hardwareService=require(_0xe485('0x14'));var logger=require(_0xe485('0x15'))(_0xe485('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xe485('0x17'))['db'];function respondWithStatusCode(_0x3f2850,_0x105199){_0x105199=_0x105199||0xcc;return function(_0x1f85a9){if(_0x1f85a9){return _0x3f2850[_0xe485('0x18')](_0x105199);}return _0x3f2850[_0xe485('0x19')](_0x105199)[_0xe485('0x1a')]();};}function respondWithResult(_0x5693e9,_0x4396cc){_0x4396cc=_0x4396cc||0xc8;return function(_0x2d04ed){if(_0x2d04ed){return _0x5693e9[_0xe485('0x19')](_0x4396cc)[_0xe485('0x1b')](_0x2d04ed);}};}function respondWithFilteredResult(_0x161dcf,_0x412ae){return function(_0x24e3bc){if(_0x24e3bc){var _0x5dc0e1=_0x24e3bc[_0xe485('0x1c')],_0x22ee93=_0x412ae[_0xe485('0x1d')],_0x487f0b=_0x412ae['offset']+_0x412ae[_0xe485('0x1e')],_0x527336;if(_0x487f0b>=_0x5dc0e1){_0x487f0b=_0x5dc0e1;_0x527336=0xc8;}else{_0x527336=0xce;}_0x161dcf[_0xe485('0x19')](_0x527336);return _0x161dcf[_0xe485('0x1f')](_0xe485('0x20'),_0x22ee93+'-'+_0x487f0b+'/'+_0x5dc0e1)[_0xe485('0x1b')](_0x24e3bc);}return null;};}function patchUpdates(_0x10a555){return function(_0x43b193){try{jsonpatch[_0xe485('0x21')](_0x43b193,_0x10a555,!![]);}catch(_0xf5bc72){return BPromise['reject'](_0xf5bc72);}return _0x43b193[_0xe485('0x22')]();};}function saveUpdates(_0x4ee563,_0x2f5e1d){return function(_0x42b1f0){if(_0x42b1f0){return _0x42b1f0[_0xe485('0x23')](_0x4ee563)[_0xe485('0x24')](function(_0x1226fb){return _0x1226fb;});}return null;};}function removeEntity(_0x28ee4d,_0x296660){return function(_0x5675f9){if(_0x5675f9){return _0x5675f9[_0xe485('0x25')]()[_0xe485('0x24')](function(){var _0x59e070=_0x5675f9[_0xe485('0x26')]({'plain':!![]});var _0x254063='Triggers';return db[_0xe485('0x27')][_0xe485('0x25')]({'where':{'type':_0x254063,'resourceId':_0x59e070['id']}})[_0xe485('0x24')](function(){return _0x5675f9;});})[_0xe485('0x24')](function(){_0x28ee4d[_0xe485('0x19')](0xcc)[_0xe485('0x1a')]();});}};}function handleEntityNotFound(_0x185b6c,_0x48e0ae){return function(_0x5d8dc1){if(!_0x5d8dc1){_0x185b6c[_0xe485('0x18')](0x194);}return _0x5d8dc1;};}function handleError(_0x3349c1,_0x3b3b6a){_0x3b3b6a=_0x3b3b6a||0x1f4;return function(_0x141796){logger[_0xe485('0x28')](_0x141796[_0xe485('0x29')]);if(_0x141796['name']){delete _0x141796[_0xe485('0x2a')];}_0x3349c1[_0xe485('0x19')](_0x3b3b6a)['send'](_0x141796);};}exports[_0xe485('0x2b')]=function(_0x5c684f,_0x32f9c4){var _0x5ce0f5={},_0x2554f3={},_0x43574f={'count':0x0,'rows':[]};var _0x34782d=_[_0xe485('0x2c')](db['Trigger'][_0xe485('0x2d')],function(_0x42e43d){return{'name':_0x42e43d[_0xe485('0x2e')],'type':_0x42e43d[_0xe485('0x2f')]['key']};});_0x2554f3[_0xe485('0x30')]=_[_0xe485('0x2c')](_0x34782d,_0xe485('0x2a'));_0x2554f3[_0xe485('0x31')]=_[_0xe485('0x32')](_0x5c684f[_0xe485('0x31')]);_0x2554f3['filters']=_['intersection'](_0x2554f3['model'],_0x2554f3[_0xe485('0x31')]);_0x5ce0f5['attributes']=_[_0xe485('0x33')](_0x2554f3['model'],qs[_0xe485('0x34')](_0x5c684f[_0xe485('0x31')][_0xe485('0x34')]));_0x5ce0f5[_0xe485('0x35')]=_0x5ce0f5[_0xe485('0x35')][_0xe485('0x36')]?_0x5ce0f5[_0xe485('0x35')]:_0x2554f3['model'];if(!_0x5c684f['query'][_0xe485('0x37')]('nolimit')){_0x5ce0f5[_0xe485('0x1e')]=qs[_0xe485('0x1e')](_0x5c684f[_0xe485('0x31')][_0xe485('0x1e')]);_0x5ce0f5[_0xe485('0x1d')]=qs[_0xe485('0x1d')](_0x5c684f[_0xe485('0x31')][_0xe485('0x1d')]);}_0x5ce0f5[_0xe485('0x38')]=qs[_0xe485('0x39')](_0x5c684f[_0xe485('0x31')][_0xe485('0x39')]);_0x5ce0f5['where']=qs[_0xe485('0x3a')](_[_0xe485('0x3b')](_0x5c684f[_0xe485('0x31')],_0x2554f3['filters']));if(_0x5c684f[_0xe485('0x31')][_0xe485('0x3c')]){_0x5ce0f5[_0xe485('0x3d')]=_[_0xe485('0x3e')](_0x5ce0f5[_0xe485('0x3d')],{'$or':_[_0xe485('0x2c')](_0x34782d,function(_0x25220b){if(_0x25220b[_0xe485('0x2f')]!=='VIRTUAL'){var _0x3c7df6={};_0x3c7df6[_0x25220b[_0xe485('0x2a')]]={'$like':'%'+_0x5c684f[_0xe485('0x31')][_0xe485('0x3c')]+'%'};return _0x3c7df6;}})});}_0x5ce0f5=_[_0xe485('0x3e')]({},_0x5ce0f5,_0x5c684f['options']);var _0x3cdb3e={'where':_0x5ce0f5['where']};return db[_0xe485('0x3f')][_0xe485('0x1c')](_0x3cdb3e)[_0xe485('0x24')](function(_0x43494e){_0x43574f[_0xe485('0x1c')]=_0x43494e;if(_0x5c684f[_0xe485('0x31')]['includeAll']){_0x5ce0f5[_0xe485('0x40')]=[{'all':!![]}];}return db['Trigger']['findAll'](_0x5ce0f5);})['then'](function(_0x28c8ba){_0x43574f['rows']=_0x28c8ba;return _0x43574f;})['then'](respondWithFilteredResult(_0x32f9c4,_0x5ce0f5))[_0xe485('0x41')](handleError(_0x32f9c4,null));};exports[_0xe485('0x42')]=function(_0xafefc3,_0x22ee3c){var _0x5250e0={'raw':![],'where':{'id':_0xafefc3[_0xe485('0x43')]['id']}},_0x2c070d={};_0x2c070d['model']=_['keys'](db[_0xe485('0x3f')][_0xe485('0x2d')]);_0x2c070d[_0xe485('0x31')]=_[_0xe485('0x32')](_0xafefc3[_0xe485('0x31')]);_0x2c070d[_0xe485('0x3a')]=_[_0xe485('0x33')](_0x2c070d['model'],_0x2c070d['query']);_0x5250e0['attributes']=_[_0xe485('0x33')](_0x2c070d[_0xe485('0x30')],qs[_0xe485('0x34')](_0xafefc3[_0xe485('0x31')][_0xe485('0x34')]));_0x5250e0[_0xe485('0x35')]=_0x5250e0[_0xe485('0x35')]['length']?_0x5250e0['attributes']:_0x2c070d[_0xe485('0x30')];if(_0xafefc3[_0xe485('0x31')][_0xe485('0x44')]){_0x5250e0['include']=[{'all':!![]}];}_0x5250e0=_['merge']({},_0x5250e0,_0xafefc3['options']);return db[_0xe485('0x3f')][_0xe485('0x45')](_0x5250e0)[_0xe485('0x24')](handleEntityNotFound(_0x22ee3c,null))['then'](respondWithResult(_0x22ee3c,null))[_0xe485('0x41')](handleError(_0x22ee3c,null));};exports[_0xe485('0x46')]=function(_0x19e9bd,_0x1c8382){return db[_0xe485('0x3f')][_0xe485('0x46')](_0x19e9bd[_0xe485('0x47')],{})['then'](function(_0x2c6dc6){var _0x1c30d5=_0x19e9bd[_0xe485('0x48')][_0xe485('0x26')]({'plain':!![]});if(!_0x1c30d5)throw new Error(_0xe485('0x49'));if(_0x1c30d5[_0xe485('0x4a')]==='user'){var _0x47ee8e=_0x2c6dc6['get']({'plain':!![]});var _0x2ef2b7=_0xe485('0x4b');return db[_0xe485('0x4c')][_0xe485('0x45')]({'where':{'name':_0x2ef2b7,'userProfileId':_0x1c30d5['userProfileId']},'raw':!![]})['then'](function(_0x53edd3){if(_0x53edd3&&_0x53edd3[_0xe485('0x4d')]===0x0){return db[_0xe485('0x27')][_0xe485('0x46')]({'name':_0x47ee8e[_0xe485('0x2a')],'resourceId':_0x47ee8e['id'],'type':_0x53edd3['name'],'sectionId':_0x53edd3['id']},{})[_0xe485('0x24')](function(){return _0x2c6dc6;});}else{return _0x2c6dc6;}})[_0xe485('0x41')](function(_0x53f577){logger[_0xe485('0x28')](_0xe485('0x4e'),_0x53f577);throw _0x53f577;});}return _0x2c6dc6;})[_0xe485('0x24')](respondWithResult(_0x1c8382,0xc9))[_0xe485('0x41')](handleError(_0x1c8382,null));};exports[_0xe485('0x23')]=function(_0x12e9b8,_0x506394){if(_0x12e9b8[_0xe485('0x47')]['id']){delete _0x12e9b8[_0xe485('0x47')]['id'];}return db[_0xe485('0x3f')][_0xe485('0x45')]({'where':{'id':_0x12e9b8['params']['id']}})['then'](handleEntityNotFound(_0x506394,null))[_0xe485('0x24')](saveUpdates(_0x12e9b8['body'],null))['then'](respondWithResult(_0x506394,null))['catch'](handleError(_0x506394,null));};exports['destroy']=function(_0x5827cc,_0x2d3d43){return db[_0xe485('0x3f')][_0xe485('0x45')]({'where':{'id':_0x5827cc[_0xe485('0x43')]['id']}})[_0xe485('0x24')](handleEntityNotFound(_0x2d3d43,null))[_0xe485('0x24')](removeEntity(_0x2d3d43,null))[_0xe485('0x41')](handleError(_0x2d3d43,null));};exports[_0xe485('0x4f')]=function(_0x4a4ea9,_0xa1f7c5,_0x4b86a5){if(_0x4a4ea9[_0xe485('0x47')]['id']){delete _0x4a4ea9[_0xe485('0x47')]['id'];}return db[_0xe485('0x3f')][_0xe485('0x45')]({'where':{'id':_0x4a4ea9[_0xe485('0x43')]['id']}})[_0xe485('0x24')](handleEntityNotFound(_0xa1f7c5,null))['then'](function(_0x5e6a77){if(_0x5e6a77){_0x4a4ea9[_0xe485('0x47')]['TriggerAllId']=_0x5e6a77['id'];return db['Condition'][_0xe485('0x46')](_0x4a4ea9['body']);}})[_0xe485('0x24')](respondWithResult(_0xa1f7c5,null))[_0xe485('0x41')](handleError(_0xa1f7c5,null));};exports[_0xe485('0x50')]=function(_0x3cae05,_0x1df702,_0x3a0ee7){if(_0x3cae05['body']['id']){delete _0x3cae05[_0xe485('0x47')]['id'];}return db[_0xe485('0x3f')]['find']({'where':{'id':_0x3cae05[_0xe485('0x43')]['id']}})['then'](handleEntityNotFound(_0x1df702,null))[_0xe485('0x24')](function(_0x1dfa33){if(_0x1dfa33){_0x3cae05[_0xe485('0x47')]['TriggerAnyId']=_0x1dfa33['id'];return db[_0xe485('0x51')][_0xe485('0x46')](_0x3cae05[_0xe485('0x47')]);}})[_0xe485('0x24')](respondWithResult(_0x1df702,null))[_0xe485('0x41')](handleError(_0x1df702,null));};exports[_0xe485('0x52')]=function(_0x5348fc,_0x2a5c5a,_0x266cc9){var _0x8d1660={};var _0x259398={};var _0x2c39cb;var _0x3554fe;return db[_0xe485('0x3f')][_0xe485('0x53')]({'where':{'id':_0x5348fc[_0xe485('0x43')]['id']}})[_0xe485('0x24')](handleEntityNotFound(_0x2a5c5a,null))[_0xe485('0x24')](function(_0x2fda73){if(_0x2fda73){_0x2c39cb=_0x2fda73;_0x259398[_0xe485('0x30')]=_[_0xe485('0x32')](db[_0xe485('0x51')][_0xe485('0x2d')]);_0x259398[_0xe485('0x31')]=_[_0xe485('0x32')](_0x5348fc['query']);_0x259398[_0xe485('0x3a')]=_[_0xe485('0x33')](_0x259398[_0xe485('0x30')],_0x259398[_0xe485('0x31')]);_0x8d1660['attributes']=_[_0xe485('0x33')](_0x259398[_0xe485('0x30')],qs[_0xe485('0x34')](_0x5348fc[_0xe485('0x31')][_0xe485('0x34')]));_0x8d1660[_0xe485('0x35')]=_0x8d1660[_0xe485('0x35')]['length']?_0x8d1660['attributes']:_0x259398[_0xe485('0x30')];_0x8d1660[_0xe485('0x38')]=qs['sort'](_0x5348fc[_0xe485('0x31')][_0xe485('0x39')]);_0x8d1660['where']=qs[_0xe485('0x3a')](_[_0xe485('0x3b')](_0x5348fc['query'],_0x259398[_0xe485('0x3a')]));if(_0x5348fc[_0xe485('0x31')][_0xe485('0x3c')]){_0x8d1660[_0xe485('0x3d')]=_[_0xe485('0x3e')](_0x8d1660[_0xe485('0x3d')],{'$or':_['map'](_0x8d1660[_0xe485('0x35')],function(_0x4b0dd9){var _0x4c11e6={};_0x4c11e6[_0x4b0dd9]={'$like':'%'+_0x5348fc['query']['filter']+'%'};return _0x4c11e6;})});}_0x8d1660=_[_0xe485('0x3e')]({},_0x8d1660,_0x5348fc[_0xe485('0x54')]);return _0x2c39cb[_0xe485('0x52')](_0x8d1660);}})['then'](function(_0x408f49){if(_0x408f49){_0x3554fe=_0x408f49[_0xe485('0x36')];if(!_0x5348fc[_0xe485('0x31')][_0xe485('0x37')](_0xe485('0x55'))){_0x8d1660[_0xe485('0x1e')]=qs[_0xe485('0x1e')](_0x5348fc[_0xe485('0x31')][_0xe485('0x1e')]);_0x8d1660['offset']=qs[_0xe485('0x1d')](_0x5348fc[_0xe485('0x31')][_0xe485('0x1d')]);}return _0x2c39cb[_0xe485('0x52')](_0x8d1660);}})[_0xe485('0x24')](function(_0x20b17c){if(_0x20b17c){return _0x20b17c?{'count':_0x3554fe,'rows':_0x20b17c}:null;}})[_0xe485('0x24')](respondWithResult(_0x2a5c5a,null))[_0xe485('0x41')](handleError(_0x2a5c5a,null));};exports[_0xe485('0x56')]=function(_0x48c634,_0x130b1e,_0x1388a0){var _0x4d10c3={};var _0xf690d7={};var _0x1c8399;var _0x5cc7ae;return db[_0xe485('0x3f')][_0xe485('0x53')]({'where':{'id':_0x48c634['params']['id']}})[_0xe485('0x24')](handleEntityNotFound(_0x130b1e,null))['then'](function(_0x3563a2){if(_0x3563a2){_0x1c8399=_0x3563a2;_0xf690d7[_0xe485('0x30')]=_['keys'](db[_0xe485('0x51')][_0xe485('0x2d')]);_0xf690d7['query']=_[_0xe485('0x32')](_0x48c634[_0xe485('0x31')]);_0xf690d7[_0xe485('0x3a')]=_[_0xe485('0x33')](_0xf690d7[_0xe485('0x30')],_0xf690d7[_0xe485('0x31')]);_0x4d10c3['attributes']=_['intersection'](_0xf690d7[_0xe485('0x30')],qs[_0xe485('0x34')](_0x48c634[_0xe485('0x31')][_0xe485('0x34')]));_0x4d10c3[_0xe485('0x35')]=_0x4d10c3[_0xe485('0x35')][_0xe485('0x36')]?_0x4d10c3[_0xe485('0x35')]:_0xf690d7[_0xe485('0x30')];_0x4d10c3[_0xe485('0x38')]=qs[_0xe485('0x39')](_0x48c634['query'][_0xe485('0x39')]);_0x4d10c3['where']=qs[_0xe485('0x3a')](_[_0xe485('0x3b')](_0x48c634[_0xe485('0x31')],_0xf690d7['filters']));if(_0x48c634[_0xe485('0x31')][_0xe485('0x3c')]){_0x4d10c3[_0xe485('0x3d')]=_['merge'](_0x4d10c3[_0xe485('0x3d')],{'$or':_[_0xe485('0x2c')](_0x4d10c3[_0xe485('0x35')],function(_0x3765d2){var _0x10fc22={};_0x10fc22[_0x3765d2]={'$like':'%'+_0x48c634[_0xe485('0x31')][_0xe485('0x3c')]+'%'};return _0x10fc22;})});}_0x4d10c3=_[_0xe485('0x3e')]({},_0x4d10c3,_0x48c634[_0xe485('0x54')]);return _0x1c8399['getAnyConditions'](_0x4d10c3);}})[_0xe485('0x24')](function(_0x1fed08){if(_0x1fed08){_0x5cc7ae=_0x1fed08[_0xe485('0x36')];if(!_0x48c634[_0xe485('0x31')][_0xe485('0x37')]('nolimit')){_0x4d10c3[_0xe485('0x1e')]=qs[_0xe485('0x1e')](_0x48c634['query'][_0xe485('0x1e')]);_0x4d10c3[_0xe485('0x1d')]=qs[_0xe485('0x1d')](_0x48c634['query'][_0xe485('0x1d')]);}return _0x1c8399['getAnyConditions'](_0x4d10c3);}})['then'](function(_0x1a026){if(_0x1a026){return _0x1a026?{'count':_0x5cc7ae,'rows':_0x1a026}:null;}})[_0xe485('0x24')](respondWithResult(_0x130b1e,null))[_0xe485('0x41')](handleError(_0x130b1e,null));};exports[_0xe485('0x57')]=function(_0x24065b,_0x75218b,_0x451e4d){if(_0x24065b[_0xe485('0x47')]['id']){delete _0x24065b['body']['id'];}return db[_0xe485('0x3f')]['find']({'where':{'id':_0x24065b[_0xe485('0x43')]['id']}})['then'](handleEntityNotFound(_0x75218b,null))['then'](function(_0x1f5208){if(_0x1f5208){_0x24065b[_0xe485('0x47')][_0xe485('0x58')]=_0x1f5208['id'];return db[_0xe485('0x59')][_0xe485('0x46')](_0x24065b[_0xe485('0x47')]);}})[_0xe485('0x24')](respondWithResult(_0x75218b,null))['catch'](handleError(_0x75218b,null));};exports['getActions']=function(_0xa18b29,_0x38cd07,_0x517b54){var _0x428c83={};var _0x4a8801={};var _0x4c835b;var _0xbe796d;return db[_0xe485('0x3f')][_0xe485('0x53')]({'where':{'id':_0xa18b29[_0xe485('0x43')]['id']}})[_0xe485('0x24')](handleEntityNotFound(_0x38cd07,null))[_0xe485('0x24')](function(_0x237675){if(_0x237675){_0x4c835b=_0x237675;_0x4a8801[_0xe485('0x30')]=_[_0xe485('0x32')](db['Action'][_0xe485('0x2d')]);_0x4a8801[_0xe485('0x31')]=_[_0xe485('0x32')](_0xa18b29[_0xe485('0x31')]);_0x4a8801[_0xe485('0x3a')]=_[_0xe485('0x33')](_0x4a8801[_0xe485('0x30')],_0x4a8801[_0xe485('0x31')]);_0x428c83[_0xe485('0x35')]=_[_0xe485('0x33')](_0x4a8801[_0xe485('0x30')],qs[_0xe485('0x34')](_0xa18b29['query'][_0xe485('0x34')]));_0x428c83[_0xe485('0x35')]=_0x428c83[_0xe485('0x35')][_0xe485('0x36')]?_0x428c83[_0xe485('0x35')]:_0x4a8801[_0xe485('0x30')];_0x428c83['order']=qs['sort'](_0xa18b29['query'][_0xe485('0x39')]);_0x428c83['where']=qs[_0xe485('0x3a')](_[_0xe485('0x3b')](_0xa18b29['query'],_0x4a8801[_0xe485('0x3a')]));if(_0xa18b29['query'][_0xe485('0x3c')]){_0x428c83['where']=_[_0xe485('0x3e')](_0x428c83[_0xe485('0x3d')],{'$or':_['map'](_0x428c83['attributes'],function(_0x4cb413){var _0x49d1c5={};_0x49d1c5[_0x4cb413]={'$like':'%'+_0xa18b29[_0xe485('0x31')][_0xe485('0x3c')]+'%'};return _0x49d1c5;})});}_0x428c83=_[_0xe485('0x3e')]({},_0x428c83,_0xa18b29[_0xe485('0x54')]);return _0x4c835b[_0xe485('0x5a')](_0x428c83);}})['then'](function(_0x18bc49){if(_0x18bc49){_0xbe796d=_0x18bc49[_0xe485('0x36')];if(!_0xa18b29['query'][_0xe485('0x37')](_0xe485('0x55'))){_0x428c83[_0xe485('0x1e')]=qs['limit'](_0xa18b29[_0xe485('0x31')][_0xe485('0x1e')]);_0x428c83[_0xe485('0x1d')]=qs[_0xe485('0x1d')](_0xa18b29[_0xe485('0x31')][_0xe485('0x1d')]);}return _0x4c835b[_0xe485('0x5a')](_0x428c83);}})[_0xe485('0x24')](function(_0x5f5d5f){if(_0x5f5d5f){return _0x5f5d5f?{'count':_0xbe796d,'rows':_0x5f5d5f}:null;}})[_0xe485('0x24')](respondWithResult(_0x38cd07,null))[_0xe485('0x41')](handleError(_0x38cd07,null));}; \ No newline at end of file +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 diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 607e817..0aa2209 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 _0x81ba=['path','rimraf','define','Trigger','tools_triggers','lodash','moment','bluebird'];(function(_0x40cb7a,_0x505484){var _0x246f9c=function(_0x3bd730){while(--_0x3bd730){_0x40cb7a['push'](_0x40cb7a['shift']());}};_0x246f9c(++_0x505484);}(_0x81ba,0x8d));var _0xa81b=function(_0x5e2b7e,_0x3c5ddd){_0x5e2b7e=_0x5e2b7e-0x0;var _0xeb85e3=_0x81ba[_0x5e2b7e];return _0xeb85e3;};'use strict';var _=require(_0xa81b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xa81b('0x1'));var BPromise=require(_0xa81b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa81b('0x3'));var rimraf=require(_0xa81b('0x4'));var config=require('../../config/environment');var attributes=require('./trigger.attributes');module['exports']=function(_0x3ec999,_0x3c2be9){return _0x3ec999[_0xa81b('0x5')](_0xa81b('0x6'),attributes,{'tableName':_0xa81b('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 2f488c9..779f2a5 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 _0x3f8c=['jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetTrigger','Trigger','findAll','options','where','attributes','limit','include','map','model','debug','catch','find','raw','ShowTrigger','moment','bluebird','randomstring','ioredis'];(function(_0x36fbef,_0x4ffc84){var _0x45e270=function(_0x32dd95){while(--_0x32dd95){_0x36fbef['push'](_0x36fbef['shift']());}};_0x45e270(++_0x4ffc84);}(_0x3f8c,0x104));var _0xc3f8=function(_0xc0028,_0x43fd4f){_0xc0028=_0xc0028-0x0;var _0xbd4cc=_0x3f8c[_0xc0028];return _0xbd4cc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc3f8('0x0'));var BPromise=require(_0xc3f8('0x1'));var rs=require(_0xc3f8('0x2'));var fs=require('fs');var Redis=require(_0xc3f8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc3f8('0x4'));var client=jayson[_0xc3f8('0x5')][_0xc3f8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x44c25d,_0x2bbaa5,_0x15512a){return new BPromise(function(_0x51093a,_0x28397e){return client[_0xc3f8('0x7')](_0x44c25d,_0x15512a)[_0xc3f8('0x8')](function(_0x3c340c){logger[_0xc3f8('0x9')](_0xc3f8('0xa'),_0x2bbaa5,_0xc3f8('0xb'));logger['debug'](_0xc3f8('0xc'),_0x2bbaa5,_0xc3f8('0xb'),JSON[_0xc3f8('0xd')](_0x3c340c));if(_0x3c340c[_0xc3f8('0xe')]){if(_0x3c340c['error'][_0xc3f8('0xf')]===0x1f4){logger[_0xc3f8('0xe')](_0xc3f8('0xa'),_0x2bbaa5,_0x3c340c[_0xc3f8('0xe')]['message']);return _0x28397e(_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);}logger[_0xc3f8('0xe')](_0xc3f8('0xa'),_0x2bbaa5,_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);return _0x51093a(_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);}else{logger[_0xc3f8('0x9')](_0xc3f8('0xa'),_0x2bbaa5,_0xc3f8('0xb'));_0x51093a(_0x3c340c[_0xc3f8('0x11')][_0xc3f8('0x10')]);}})['catch'](function(_0x14b3ed){logger['error']('Trigger,\x20%s,\x20%s',_0x2bbaa5,_0x14b3ed);_0x28397e(_0x14b3ed);});});}exports[_0xc3f8('0x12')]=function(_0x2e7c0f){var _0x35500f=this;return new Promise(function(_0xb4ab67,_0x47a185){return db[_0xc3f8('0x13')][_0xc3f8('0x14')]({'raw':_0x2e7c0f['options']?_0x2e7c0f[_0xc3f8('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x2e7c0f[_0xc3f8('0x15')]?_0x2e7c0f[_0xc3f8('0x15')][_0xc3f8('0x16')]||null:null,'attributes':_0x2e7c0f['options']?_0x2e7c0f['options'][_0xc3f8('0x17')]||null:null,'limit':_0x2e7c0f[_0xc3f8('0x15')]?_0x2e7c0f[_0xc3f8('0x15')][_0xc3f8('0x18')]||null:null,'include':_0x2e7c0f[_0xc3f8('0x15')]?_0x2e7c0f[_0xc3f8('0x15')][_0xc3f8('0x19')]?_[_0xc3f8('0x1a')](_0x2e7c0f['options']['include'],function(_0x4b83f0){return{'model':db[_0x4b83f0[_0xc3f8('0x1b')]],'as':_0x4b83f0['as'],'attributes':_0x4b83f0['attributes'],'include':_0x4b83f0[_0xc3f8('0x19')]?_[_0xc3f8('0x1a')](_0x4b83f0['include'],function(_0x4569c2){return{'model':db[_0x4569c2[_0xc3f8('0x1b')]],'as':_0x4569c2['as'],'attributes':_0x4569c2[_0xc3f8('0x17')],'include':_0x4569c2[_0xc3f8('0x19')]?_[_0xc3f8('0x1a')](_0x4569c2[_0xc3f8('0x19')],function(_0xf1d460){return{'model':db[_0xf1d460[_0xc3f8('0x1b')]],'as':_0xf1d460['as'],'attributes':_0xf1d460[_0xc3f8('0x17')]};}):[]};}):[]};}):[]:[]})[_0xc3f8('0x8')](function(_0x22c8e6){logger[_0xc3f8('0x9')](_0xc3f8('0x12'),_0x2e7c0f);logger[_0xc3f8('0x1c')]('GetTrigger',_0x2e7c0f,JSON[_0xc3f8('0xd')](_0x22c8e6));_0xb4ab67(_0x22c8e6);})[_0xc3f8('0x1d')](function(_0x218029){logger['error'](_0xc3f8('0x12'),_0x218029['message'],_0x2e7c0f);_0x47a185(_0x35500f[_0xc3f8('0xe')](0x1f4,_0x218029[_0xc3f8('0x10')]));});});};exports['ShowTrigger']=function(_0x48b32e){var _0x21a225=this;return new Promise(function(_0x25df65,_0xd32b09){return db[_0xc3f8('0x13')][_0xc3f8('0x1e')]({'raw':_0x48b32e[_0xc3f8('0x15')]?_0x48b32e[_0xc3f8('0x15')][_0xc3f8('0x1f')]===undefined?!![]:![]:!![],'where':_0x48b32e[_0xc3f8('0x15')]?_0x48b32e[_0xc3f8('0x15')]['where']||null:null,'attributes':_0x48b32e[_0xc3f8('0x15')]?_0x48b32e[_0xc3f8('0x15')][_0xc3f8('0x17')]||null:null,'include':_0x48b32e[_0xc3f8('0x15')]?_0x48b32e[_0xc3f8('0x15')]['include']?_['map'](_0x48b32e[_0xc3f8('0x15')][_0xc3f8('0x19')],function(_0x76ef00){return{'model':db[_0x76ef00[_0xc3f8('0x1b')]],'as':_0x76ef00['as'],'attributes':_0x76ef00[_0xc3f8('0x17')],'include':_0x76ef00['include']?_[_0xc3f8('0x1a')](_0x76ef00[_0xc3f8('0x19')],function(_0x2ba6aa){return{'model':db[_0x2ba6aa['model']],'as':_0x2ba6aa['as'],'attributes':_0x2ba6aa[_0xc3f8('0x17')],'include':_0x2ba6aa[_0xc3f8('0x19')]?_[_0xc3f8('0x1a')](_0x2ba6aa['include'],function(_0x21a725){return{'model':db[_0x21a725[_0xc3f8('0x1b')]],'as':_0x21a725['as'],'attributes':_0x21a725['attributes']};}):[]};}):[]};}):[]:[]})[_0xc3f8('0x8')](function(_0x84d5d2){logger[_0xc3f8('0x9')](_0xc3f8('0x20'),_0x48b32e);logger[_0xc3f8('0x1c')](_0xc3f8('0x20'),_0x48b32e,JSON['stringify'](_0x84d5d2));_0x25df65(_0x84d5d2);})[_0xc3f8('0x1d')](function(_0x2e4880){logger[_0xc3f8('0xe')](_0xc3f8('0x20'),_0x2e4880[_0xc3f8('0x10')],_0x48b32e);_0xd32b09(_0x21a225['error'](0x1f4,_0x2e4880[_0xc3f8('0x10')]));});});}; \ No newline at end of file +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 diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index e8b5284..df48cb9 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 _0x00bb=['../../components/auth/service','../../components/interaction/service','./trunk.controller','get','/:id','isAuthenticated','show','post','/:id/clone','create','put','delete','exports','multer','util','path','express'];(function(_0x297c5f,_0x263700){var _0x5eeae1=function(_0x5288d1){while(--_0x5288d1){_0x297c5f['push'](_0x297c5f['shift']());}};_0x5eeae1(++_0x263700);}(_0x00bb,0x1d8));var _0xb00b=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x00bb[_0xae7c2f];return _0x5d7001;};'use strict';var multer=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var path=require(_0xb00b('0x2'));var timeout=require('connect-timeout');var express=require(_0xb00b('0x3'));var router=express['Router']();var auth=require(_0xb00b('0x4'));var interaction=require(_0xb00b('0x5'));var config=require('../../config/environment');var controller=require(_0xb00b('0x6'));router[_0xb00b('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb00b('0x8'),auth[_0xb00b('0x9')](),controller[_0xb00b('0xa')]);router[_0xb00b('0xb')](_0xb00b('0xc'),auth[_0xb00b('0x9')](),controller['clone']);router['post']('/',auth[_0xb00b('0x9')](),controller[_0xb00b('0xd')]);router[_0xb00b('0xe')](_0xb00b('0x8'),auth[_0xb00b('0x9')](),controller['update']);router[_0xb00b('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xb00b('0x10')]=router; \ No newline at end of file +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 diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 4d12e03..225e411 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 _0xaa62=['never','INTEGER','\x22\x22\x20<>','always','accept','refuse','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','ENUM','friend','user','STRING','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','yes','nonat','update','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'];(function(_0x15833e,_0x58a046){var _0x5c4745=function(_0x2d1a2c){while(--_0x2d1a2c){_0x15833e['push'](_0x15833e['shift']());}};_0x5c4745(++_0x58a046);}(_0xaa62,0xe1));var _0x2aa6=function(_0xad4314,_0x47071f){_0xad4314=_0xad4314-0x0;var _0x4693a1=_0xaa62[_0xad4314];return _0x4693a1;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x2aa6('0x0')](_0x2aa6('0x1'),_0x2aa6('0x2'),'peer'),'allowNull':![],'defaultValue':_0x2aa6('0x1')},'context':{'type':Sequelize[_0x2aa6('0x3')],'allowNull':![],'defaultValue':_0x2aa6('0x4')},'callingpres':{'type':Sequelize[_0x2aa6('0x0')](_0x2aa6('0x5'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0x2aa6('0x6'),_0x2aa6('0x7'),_0x2aa6('0x8'),_0x2aa6('0x9'),_0x2aa6('0xa'))},'deny':{'type':Sequelize[_0x2aa6('0x3')]},'permit':{'type':Sequelize[_0x2aa6('0x3')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x2aa6('0x3')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x2aa6('0x3')],'defaultValue':'udp','set':function(_0xce4d27){this[_0x2aa6('0xb')](_0x2aa6('0xc'),_0xce4d27?_0xce4d27[_0x2aa6('0xd')](','):null);},'get':function(){return this['getDataValue'](_0x2aa6('0xc'))?this[_0x2aa6('0xe')]('transport')[_0x2aa6('0xf')](','):null;},'comment':_0x2aa6('0x10')},'dtmfmode':{'type':Sequelize[_0x2aa6('0x0')]('rfc2833',_0x2aa6('0x11'),_0x2aa6('0x12'),_0x2aa6('0x13'),_0x2aa6('0x14')),'defaultValue':_0x2aa6('0x15')},'directmedia':{'type':Sequelize[_0x2aa6('0x0')](_0x2aa6('0x16'),'no',_0x2aa6('0x17'),_0x2aa6('0x18'),_0x2aa6('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2aa6('0x0')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2aa6('0x3')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0xa8ffe8){this[_0x2aa6('0xb')]('nat',_0xa8ffe8?_0xa8ffe8[_0x2aa6('0xd')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x2aa6('0xe')](_0x2aa6('0x1a'))[_0x2aa6('0xf')](','):null;},'comment':_0x2aa6('0x1b')},'callgroup':{'type':Sequelize[_0x2aa6('0x3')]},'namedcallgroup':{'type':Sequelize[_0x2aa6('0x3')]},'pickupgroup':{'type':Sequelize[_0x2aa6('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x2aa6('0x3')]},'language':{'type':Sequelize[_0x2aa6('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2aa6('0x3')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x2aa6('0x1c')},'allow':{'type':Sequelize[_0x2aa6('0x3')],'allowNull':![],'defaultValue':_0x2aa6('0x1d'),'set':function(_0x288c03){this['setDataValue'](_0x2aa6('0x1e'),_0x288c03?_0x288c03['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0x2aa6('0x1e'))?this[_0x2aa6('0xe')](_0x2aa6('0x1e'))[_0x2aa6('0xf')](';'):null;},'comment':_0x2aa6('0x1f')},'autoframing':{'type':Sequelize[_0x2aa6('0x0')](_0x2aa6('0x16'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x2aa6('0x20'),'set':function(_0x225bd9){this[_0x2aa6('0xb')](_0x2aa6('0x21'),_0x225bd9?_0x225bd9[_0x2aa6('0xd')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0x2aa6('0xe')](_0x2aa6('0x21'))[_0x2aa6('0xf')](','):null;},'comment':_0x2aa6('0x22')},'trustrpid':{'type':Sequelize[_0x2aa6('0x0')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2aa6('0x0')](_0x2aa6('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2aa6('0x0')](_0x2aa6('0x16'),'no',_0x2aa6('0x23'))},'promiscredir':{'type':Sequelize[_0x2aa6('0x0')]('yes','no')},'useclientcode':{'type':Sequelize['ENUM']('yes','no')},'accountcode':{'type':Sequelize[_0x2aa6('0x24')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x2aa6('0x3')],'defaultValue':_0x2aa6('0x25')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x2aa6('0x0')]('yes','no'),'defaultValue':_0x2aa6('0x16')},'busylevel':{'type':Sequelize[_0x2aa6('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0x2aa6('0x0')]('yes','no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x2aa6('0x16'),'no')},'allowtransfer':{'type':Sequelize[_0x2aa6('0x0')](_0x2aa6('0x16'),'no')},'ignoresdpversion':{'type':Sequelize[_0x2aa6('0x0')](_0x2aa6('0x16'),'no')},'subscribecontext':{'type':Sequelize[_0x2aa6('0x3')]},'template':{'type':Sequelize[_0x2aa6('0x3')]},'videosupport':{'type':Sequelize['ENUM'](_0x2aa6('0x16'),'no',_0x2aa6('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x2aa6('0x16'),'no')},'mailbox':{'type':Sequelize[_0x2aa6('0x3')]},'session_timers':{'type':Sequelize[_0x2aa6('0x0')](_0x2aa6('0x27'),_0x2aa6('0x28'),'originate')},'session_expires':{'type':Sequelize[_0x2aa6('0x24')](0xb)},'session_minse':{'type':Sequelize[_0x2aa6('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0x2aa6('0x0')](_0x2aa6('0x29'),_0x2aa6('0x2a')),'defaultValue':_0x2aa6('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0x2aa6('0x3')]},'regexten':{'type':Sequelize[_0x2aa6('0x3')]},'fromdomain':{'type':Sequelize[_0x2aa6('0x3')]},'fromuser':{'type':Sequelize[_0x2aa6('0x3')]},'port':{'type':Sequelize[_0x2aa6('0x24')](0x5)},'qualify':{'type':Sequelize[_0x2aa6('0x0')](_0x2aa6('0x16'),'no'),'defaultValue':_0x2aa6('0x16')},'keepalive':{'type':Sequelize[_0x2aa6('0x24')](0xb)},'defaultip':{'type':Sequelize[_0x2aa6('0x3')]},'defaultuser':{'type':Sequelize[_0x2aa6('0x3')]},'rtptimeout':{'type':Sequelize[_0x2aa6('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x2aa6('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x2aa6('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0x2aa6('0x0')](_0x2aa6('0x16'),'no',_0x2aa6('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2aa6('0x3')]},'callbackextension':{'type':Sequelize[_0x2aa6('0x3')]},'timert1':{'type':Sequelize[_0x2aa6('0x24')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x2aa6('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0x2aa6('0x3')]},'contactdeny':{'type':Sequelize[_0x2aa6('0x3')]},'contactacl':{'type':Sequelize[_0x2aa6('0x3')]},'unsolicited_mailbox':{'type':Sequelize[_0x2aa6('0x3')]},'use_q850_reason':{'type':Sequelize[_0x2aa6('0x3')]},'maxforwards':{'type':Sequelize[_0x2aa6('0x24')](0xb)},'encryption':{'type':Sequelize[_0x2aa6('0x0')](_0x2aa6('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x2aa6('0x16'),'no')},'force_avp':{'type':Sequelize[_0x2aa6('0x0')](_0x2aa6('0x16'),'no')},'icesupport':{'type':Sequelize[_0x2aa6('0x0')](_0x2aa6('0x16'),'no')},'dtlsenable':{'type':Sequelize[_0x2aa6('0x0')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x2aa6('0x0')](_0x2aa6('0x16'),'no',_0x2aa6('0x2c'),_0x2aa6('0x2d'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x2aa6('0x3')]},'dtlsprivatekey':{'type':Sequelize[_0x2aa6('0x3')]},'dtlscipher':{'type':Sequelize[_0x2aa6('0x3')]},'dtlscafile':{'type':Sequelize[_0x2aa6('0x3')]},'dtlscapath':{'type':Sequelize[_0x2aa6('0x3')]},'dtlssetup':{'type':Sequelize[_0x2aa6('0x0')](_0x2aa6('0x2e'),_0x2aa6('0x2f'),_0x2aa6('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2aa6('0x3')]},'usereqphone':{'type':Sequelize[_0x2aa6('0x0')](_0x2aa6('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2aa6('0x3')]},'recordofffeature':{'type':Sequelize[_0x2aa6('0x3')]},'call_limit':{'type':Sequelize[_0x2aa6('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x2aa6('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0x2aa6('0x0')](_0x2aa6('0x16'),'no')},'vmexten':{'type':Sequelize[_0x2aa6('0x3')]},'mohinterpret':{'type':Sequelize[_0x2aa6('0x3')]},'mohsuggest':{'type':Sequelize[_0x2aa6('0x3')]},'parkinglot':{'type':Sequelize[_0x2aa6('0x3')]},'description':{'type':Sequelize[_0x2aa6('0x3')]},'host':{'type':Sequelize[_0x2aa6('0x3')],'defaultValue':_0x2aa6('0x31')},'canreinvite':{'type':Sequelize[_0x2aa6('0x0')]('yes','no',_0x2aa6('0x17'),_0x2aa6('0x18'),_0x2aa6('0x32')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x2aa6('0x3')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x2aa6('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x2aa6('0x3')],'defaultValue':'no'}}; \ No newline at end of file +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 diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index af6edf8..f5328d4 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 _0x4611=['length','find','clone','updatedAt','body','createdAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','server/files/templates/registry.ejs','render','writeFileSync','registry','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','/etc/asterisk/sip_xcally_trunks.conf','Reload','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','json','offset','limit','set','Content-Range','apply','save','update','destroy','then','get','Trunks','UserProfileResource','end','stack','name','send','index','map','Trunk','rawAttributes','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','count','includeAll','include','findAll','rows','show','params'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4611,0x165));var _0x1461=function(_0x153e70,_0x4d16e2){_0x153e70=_0x153e70-0x0;var _0x5b055d=_0x4611[_0x153e70];return _0x5b055d;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1461('0x0'));var zipdir=require(_0x1461('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1461('0x2'));var moment=require(_0x1461('0x3'));var BPromise=require(_0x1461('0x4'));var Mustache=require(_0x1461('0x5'));var util=require(_0x1461('0x6'));var path=require('path');var sox=require(_0x1461('0x7'));var csv=require(_0x1461('0x8'));var ejs=require(_0x1461('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1461('0xa'));var crypto=require(_0x1461('0xb'));var jsforce=require(_0x1461('0xc'));var deskjs=require(_0x1461('0xd'));var toCsv=require(_0x1461('0x8'));var querystring=require(_0x1461('0xe'));var Papa=require(_0x1461('0xf'));var Redis=require('ioredis');var authService=require(_0x1461('0x10'));var qs=require(_0x1461('0x11'));var as=require(_0x1461('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1461('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x1461('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0x1461('0x15'));var client=jayson[_0x1461('0x16')][_0x1461('0x17')]({'port':0x232a});function checkPasswordPattern(_0x50203d,_0xdaf2eb,_0x222652){if(_0x222652){var _0x35d791=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x35d791[_0x1461('0x18')](_0xdaf2eb)){return _0x50203d;}else{throw new db['Sequelize'][(_0x1461('0x19'))](_0x1461('0x1a'));}}else{return _0x50203d;}}function respondWithRpcPromise(_0x4bcdd6,_0x1edcb7,_0x3a09e6,_0x185a6f){return new BPromise(function(_0x188946,_0x344067){var _0x58a825=_0x185a6f||client;return _0x58a825[_0x1461('0x1b')](_0x4bcdd6,_0x3a09e6)['then'](function(_0xca2c00){logger[_0x1461('0x1c')](_0x1461('0x1d'),_0x1edcb7,_0x1461('0x1e'));logger[_0x1461('0x1f')](_0x1461('0x20'),_0x1edcb7,_0x1461('0x1e'),JSON['stringify'](_0xca2c00));if(_0xca2c00[_0x1461('0x21')]){if(_0xca2c00[_0x1461('0x21')]['code']===0x1f4){logger['error'](_0x1461('0x1d'),_0x1edcb7,_0xca2c00['error']['message']);return _0x344067(_0xca2c00['error'][_0x1461('0x22')]);}logger[_0x1461('0x21')]('Trunk,\x20%s,\x20%s',_0x1edcb7,_0xca2c00[_0x1461('0x21')]['message']);return _0x188946(_0xca2c00[_0x1461('0x21')]['message']);}else{logger['info']('Trunk,\x20%s,\x20%s',_0x1edcb7,_0x1461('0x1e'));_0x188946(_0xca2c00[_0x1461('0x23')]['message']);}})[_0x1461('0x24')](function(_0x56e209){logger[_0x1461('0x21')]('Trunk,\x20%s,\x20%s',_0x1edcb7,_0x56e209);_0x344067(_0x56e209);});});}function respondWithStatusCode(_0x31bd35,_0x38a573){_0x38a573=_0x38a573||0xcc;return function(_0x40eb38){if(_0x40eb38){return _0x31bd35[_0x1461('0x25')](_0x38a573);}return _0x31bd35[_0x1461('0x26')](_0x38a573)['end']();};}function respondWithResult(_0x2a7ffd,_0x1b3827){_0x1b3827=_0x1b3827||0xc8;return function(_0x459fa1){if(_0x459fa1){return _0x2a7ffd[_0x1461('0x26')](_0x1b3827)[_0x1461('0x27')](_0x459fa1);}};}function respondWithFilteredResult(_0x2b5c9d,_0x1548d5){return function(_0x347d64){if(_0x347d64){var _0x1ecf6e=_0x347d64['count'],_0x494a14=_0x1548d5[_0x1461('0x28')],_0x48c4b5=_0x1548d5['offset']+_0x1548d5[_0x1461('0x29')],_0x182b9e;if(_0x48c4b5>=_0x1ecf6e){_0x48c4b5=_0x1ecf6e;_0x182b9e=0xc8;}else{_0x182b9e=0xce;}_0x2b5c9d[_0x1461('0x26')](_0x182b9e);return _0x2b5c9d[_0x1461('0x2a')](_0x1461('0x2b'),_0x494a14+'-'+_0x48c4b5+'/'+_0x1ecf6e)[_0x1461('0x27')](_0x347d64);}return null;};}function patchUpdates(_0x57c90e){return function(_0x252d5a){try{jsonpatch[_0x1461('0x2c')](_0x252d5a,_0x57c90e,!![]);}catch(_0x2f8395){return BPromise['reject'](_0x2f8395);}return _0x252d5a[_0x1461('0x2d')]();};}function saveUpdates(_0x4a38a9,_0x49c4d5){return function(_0x389b25){if(_0x389b25){return _0x389b25[_0x1461('0x2e')](_0x4a38a9)['then'](function(_0x379d8b){return _0x379d8b;});}return null;};}function removeEntity(_0x156eab,_0x2d4a32){return function(_0x195d1c){if(_0x195d1c){return _0x195d1c[_0x1461('0x2f')]()[_0x1461('0x30')](function(){var _0x29f99e=_0x195d1c[_0x1461('0x31')]({'plain':!![]});var _0x27b854=_0x1461('0x32');return db[_0x1461('0x33')]['destroy']({'where':{'type':_0x27b854,'resourceId':_0x29f99e['id']}})[_0x1461('0x30')](function(){return _0x195d1c;});})[_0x1461('0x30')](function(){_0x156eab[_0x1461('0x26')](0xcc)[_0x1461('0x34')]();});}};}function handleEntityNotFound(_0x408bfe,_0x159a3b){return function(_0x1f0faf){if(!_0x1f0faf){_0x408bfe['sendStatus'](0x194);}return _0x1f0faf;};}function handleError(_0x8977b2,_0x340c6b){_0x340c6b=_0x340c6b||0x1f4;return function(_0x41c8a4){logger['error'](_0x41c8a4[_0x1461('0x35')]);if(_0x41c8a4[_0x1461('0x36')]){delete _0x41c8a4['name'];}_0x8977b2['status'](_0x340c6b)[_0x1461('0x37')](_0x41c8a4);};}exports[_0x1461('0x38')]=function(_0x518eeb,_0x2648db){var _0x416bc2={},_0x489315={},_0x35ecad={'count':0x0,'rows':[]};var _0x1b6f38=_[_0x1461('0x39')](db[_0x1461('0x3a')][_0x1461('0x3b')],function(_0xfe1a3c){return{'name':_0xfe1a3c['fieldName'],'type':_0xfe1a3c[_0x1461('0x3c')]['key']};});_0x489315[_0x1461('0x3d')]=_[_0x1461('0x39')](_0x1b6f38,_0x1461('0x36'));_0x489315[_0x1461('0x3e')]=_[_0x1461('0x3f')](_0x518eeb[_0x1461('0x3e')]);_0x489315['filters']=_[_0x1461('0x40')](_0x489315[_0x1461('0x3d')],_0x489315[_0x1461('0x3e')]);_0x416bc2[_0x1461('0x41')]=_[_0x1461('0x40')](_0x489315['model'],qs[_0x1461('0x42')](_0x518eeb[_0x1461('0x3e')][_0x1461('0x42')]));_0x416bc2['attributes']=_0x416bc2[_0x1461('0x41')]['length']?_0x416bc2[_0x1461('0x41')]:_0x489315['model'];if(!_0x518eeb[_0x1461('0x3e')][_0x1461('0x43')]('nolimit')){_0x416bc2[_0x1461('0x29')]=qs[_0x1461('0x29')](_0x518eeb[_0x1461('0x3e')]['limit']);_0x416bc2['offset']=qs['offset'](_0x518eeb[_0x1461('0x3e')]['offset']);}_0x416bc2[_0x1461('0x44')]=qs[_0x1461('0x45')](_0x518eeb[_0x1461('0x3e')][_0x1461('0x45')]);_0x416bc2[_0x1461('0x46')]=qs[_0x1461('0x47')](_[_0x1461('0x48')](_0x518eeb[_0x1461('0x3e')],_0x489315['filters']));if(_0x518eeb[_0x1461('0x3e')][_0x1461('0x49')]){_0x416bc2[_0x1461('0x46')]=_['merge'](_0x416bc2['where'],{'$or':_[_0x1461('0x39')](_0x1b6f38,function(_0x273763){if(_0x273763[_0x1461('0x3c')]!=='VIRTUAL'){var _0x4eca4d={};_0x4eca4d[_0x273763[_0x1461('0x36')]]={'$like':'%'+_0x518eeb[_0x1461('0x3e')]['filter']+'%'};return _0x4eca4d;}})});}_0x416bc2=_[_0x1461('0x4a')]({},_0x416bc2,_0x518eeb[_0x1461('0x4b')]);var _0x3c466c={'where':_0x416bc2[_0x1461('0x46')]};return db[_0x1461('0x3a')][_0x1461('0x4c')](_0x3c466c)[_0x1461('0x30')](function(_0x556ed6){_0x35ecad[_0x1461('0x4c')]=_0x556ed6;if(_0x518eeb['query'][_0x1461('0x4d')]){_0x416bc2[_0x1461('0x4e')]=[{'all':!![]}];}return db[_0x1461('0x3a')][_0x1461('0x4f')](_0x416bc2);})[_0x1461('0x30')](function(_0x5478a4){_0x35ecad[_0x1461('0x50')]=_0x5478a4;return _0x35ecad;})[_0x1461('0x30')](respondWithFilteredResult(_0x2648db,_0x416bc2))[_0x1461('0x24')](handleError(_0x2648db,null));};exports[_0x1461('0x51')]=function(_0x11351e,_0x4b514c){var _0x12d10f={'raw':![],'where':{'id':_0x11351e[_0x1461('0x52')]['id']}},_0x6b0d14={};_0x6b0d14['model']=_[_0x1461('0x3f')](db[_0x1461('0x3a')][_0x1461('0x3b')]);_0x6b0d14[_0x1461('0x3e')]=_[_0x1461('0x3f')](_0x11351e[_0x1461('0x3e')]);_0x6b0d14[_0x1461('0x47')]=_[_0x1461('0x40')](_0x6b0d14[_0x1461('0x3d')],_0x6b0d14[_0x1461('0x3e')]);_0x12d10f[_0x1461('0x41')]=_[_0x1461('0x40')](_0x6b0d14[_0x1461('0x3d')],qs[_0x1461('0x42')](_0x11351e[_0x1461('0x3e')]['fields']));_0x12d10f[_0x1461('0x41')]=_0x12d10f[_0x1461('0x41')][_0x1461('0x53')]?_0x12d10f['attributes']:_0x6b0d14[_0x1461('0x3d')];if(_0x11351e[_0x1461('0x3e')]['includeAll']){_0x12d10f[_0x1461('0x4e')]=[{'all':!![]}];}_0x12d10f=_[_0x1461('0x4a')]({},_0x12d10f,_0x11351e['options']);return db[_0x1461('0x3a')][_0x1461('0x54')](_0x12d10f)['then'](handleEntityNotFound(_0x4b514c,null))['then'](respondWithResult(_0x4b514c,null))['catch'](handleError(_0x4b514c,null));};exports[_0x1461('0x55')]=function(_0x34ae15,_0x14df2a){var _0x715d30={'where':{'id':_0x34ae15[_0x1461('0x52')]['id']}},_0x4f4c9f={};_0x4f4c9f[_0x1461('0x3d')]=_[_0x1461('0x3f')](db['Trunk'][_0x1461('0x3b')]);_0x715d30[_0x1461('0x41')]=_[_0x1461('0x40')](_0x4f4c9f[_0x1461('0x3d')],qs[_0x1461('0x42')](_0x34ae15[_0x1461('0x3e')][_0x1461('0x42')]));_0x715d30[_0x1461('0x41')]=_0x715d30[_0x1461('0x41')][_0x1461('0x53')]?_0x715d30[_0x1461('0x41')]:_0x4f4c9f['model'];if(_0x34ae15['query'][_0x1461('0x4d')]){_0x715d30[_0x1461('0x4e')]=[{'all':!![]}];}_0x715d30=_['merge']({},_0x715d30,_0x34ae15[_0x1461('0x4b')]);return db[_0x1461('0x3a')][_0x1461('0x54')](_0x715d30)[_0x1461('0x30')](handleEntityNotFound(_0x14df2a,null))[_0x1461('0x30')](function(_0x1c5725){if(_0x1c5725){var _0x1dfa87=_0x1c5725[_0x1461('0x31')]({'plain':!![]});_0x1dfa87=qs['omit'](_0x1dfa87,['id','createdAt',_0x1461('0x56')]);_0x34ae15['body']=_['omit'](_0x34ae15[_0x1461('0x57')],['id',_0x1461('0x58'),_0x1461('0x56')]);return db[_0x1461('0x3a')][_0x1461('0x59')](_[_0x1461('0x4a')](_0x1dfa87,_0x34ae15[_0x1461('0x57')]),{'include':_0x34ae15[_0x1461('0x3e')][_0x1461('0x4d')]?[{'all':!![]}]:undefined})[_0x1461('0x30')](function(_0x3f6c68){var _0x216de8=_0x34ae15[_0x1461('0x5a')][_0x1461('0x31')]({'plain':!![]});if(!_0x216de8)throw new Error(_0x1461('0x5b'));if(_0x216de8[_0x1461('0x5c')]===_0x1461('0x5a')){var _0x457c5b=_0x3f6c68[_0x1461('0x31')]({'plain':!![]});var _0xc18aaf=_0x1461('0x32');return db[_0x1461('0x5d')]['find']({'where':{'name':_0xc18aaf,'userProfileId':_0x216de8[_0x1461('0x5e')]},'raw':!![]})[_0x1461('0x30')](function(_0x39ab38){if(_0x39ab38&&_0x39ab38[_0x1461('0x5f')]===0x0){return db[_0x1461('0x33')][_0x1461('0x59')]({'name':_0x457c5b[_0x1461('0x36')],'resourceId':_0x457c5b['id'],'type':_0x39ab38['name'],'sectionId':_0x39ab38['id']},{})[_0x1461('0x30')](function(){return _0x3f6c68;});}else{return _0x3f6c68;}})[_0x1461('0x24')](function(_0x52b40a){logger[_0x1461('0x21')](_0x1461('0x60'),_0x52b40a);throw _0x52b40a;});}return _0x3f6c68;});}})[_0x1461('0x30')](respondWithResult(_0x14df2a,0xc9))['catch'](handleError(_0x14df2a,null));};exports[_0x1461('0x59')]=function(_0x14c3d8,_0x457475,_0x465755){var _0x4cd151;return db[_0x1461('0x3a')][_0x1461('0x59')](_0x14c3d8[_0x1461('0x57')],{'raw':!![]})[_0x1461('0x30')](function(_0x199f65){_0x4cd151=_0x199f65;return db[_0x1461('0x3a')][_0x1461('0x4f')]({'raw':!![]});})[_0x1461('0x30')](function(_0x205f8d){var _0x2e6030=fs['readFileSync'](path[_0x1461('0x61')](config[_0x1461('0x62')],_0x1461('0x63')),_0x1461('0x64'));var _0x55241c=fs[_0x1461('0x65')](path[_0x1461('0x61')](config[_0x1461('0x62')],_0x1461('0x66')),'utf8');var _0x44a209=ejs[_0x1461('0x67')](_0x2e6030,{'trunks':_0x205f8d||[]});fs[_0x1461('0x68')]('/etc/asterisk/sip_xcally_trunks.conf',_0x44a209);if(_0x4cd151[_0x1461('0x69')]){var _0x41932e=ejs[_0x1461('0x67')](_0x55241c,{'trunks':_0x205f8d||[]});fs[_0x1461('0x68')](_0x1461('0x6a'),_0x41932e);}})['then'](function(){return respondWithRpcPromise('Reload','create',{'module':_0x1461('0x6b')});})[_0x1461('0x30')](function(){var _0x51e8d1=_0x14c3d8['user'][_0x1461('0x31')]({'plain':!![]});if(!_0x51e8d1)throw new Error(_0x1461('0x5b'));if(_0x51e8d1[_0x1461('0x5c')]===_0x1461('0x5a')){var _0xeeb21=_0x4cd151[_0x1461('0x31')]({'plain':!![]});return db[_0x1461('0x5d')][_0x1461('0x54')]({'where':{'name':'Trunks','userProfileId':_0x51e8d1['userProfileId']},'raw':!![]})['then'](function(_0x2b4a42){if(_0x2b4a42&&_0x2b4a42[_0x1461('0x5f')]===0x0){return db['UserProfileResource']['create']({'name':_0xeeb21[_0x1461('0x36')],'resourceId':_0xeeb21['id'],'type':_0x2b4a42[_0x1461('0x36')],'sectionId':_0x2b4a42['id']},{})[_0x1461('0x30')](function(){return _0x4cd151;});}else{return _0x4cd151;}})[_0x1461('0x24')](function(_0x1ac0fd){logger['error'](_0x1461('0x60'),_0x1ac0fd);throw _0x1ac0fd;});}return _0x4cd151;})[_0x1461('0x30')](respondWithResult(_0x457475,0xc9))[_0x1461('0x24')](handleError(_0x457475,null));};exports[_0x1461('0x2e')]=function(_0x3b1644,_0x7e6d7a,_0x16fbf7){var _0x1ffb61;return db[_0x1461('0x3a')][_0x1461('0x54')]({'where':{'id':_0x3b1644[_0x1461('0x52')]['id']}})[_0x1461('0x30')](handleEntityNotFound(_0x7e6d7a,null))[_0x1461('0x30')](saveUpdates(_0x3b1644[_0x1461('0x57')],null))[_0x1461('0x30')](function(_0xdb1c71){if(_0xdb1c71){_0x1ffb61=_0xdb1c71;return db[_0x1461('0x3a')][_0x1461('0x4f')]({'raw':!![]});}})['then'](function(_0x1b0485){if(_0x1b0485){var _0x478fcf=fs[_0x1461('0x65')](path[_0x1461('0x61')](config[_0x1461('0x62')],'server/files/templates/trunk.ejs'),_0x1461('0x64'));var _0x4580c8=fs[_0x1461('0x65')](path[_0x1461('0x61')](config[_0x1461('0x62')],_0x1461('0x66')),'utf8');var _0x30ff81=ejs[_0x1461('0x67')](_0x478fcf,{'trunks':_0x1b0485||[]});fs[_0x1461('0x68')](_0x1461('0x6c'),_0x30ff81);var _0x2f05eb=ejs[_0x1461('0x67')](_0x4580c8,{'trunks':_0x1b0485||[]});fs['writeFileSync'](_0x1461('0x6a'),_0x2f05eb);return respondWithRpcPromise(_0x1461('0x6d'),_0x1461('0x2e'),{'module':_0x1461('0x6b')});}return null;})[_0x1461('0x30')](function(_0x4bb963){if(_0x4bb963){return _0x1ffb61;}})[_0x1461('0x30')](respondWithResult(_0x7e6d7a,null))['catch'](handleError(_0x7e6d7a,null));};exports[_0x1461('0x2f')]=function(_0x58845f,_0x3f9219,_0x9c3d64){var _0x2f31de;return db[_0x1461('0x3a')]['find']({'where':{'id':_0x58845f[_0x1461('0x52')]['id']}})['then'](handleEntityNotFound(_0x3f9219,null))[_0x1461('0x30')](removeEntity(_0x3f9219,null))['then'](function(){return db['Trunk'][_0x1461('0x4f')]({'raw':!![]});})[_0x1461('0x30')](function(_0x2f3c38){var _0x35f47b=fs['readFileSync'](path['join'](config['root'],_0x1461('0x63')),_0x1461('0x64'));var _0x29c980=fs['readFileSync'](path['join'](config[_0x1461('0x62')],'server/files/templates/registry.ejs'),'utf8');var _0xd91a35=ejs[_0x1461('0x67')](_0x35f47b,{'trunks':_0x2f3c38});var _0x579402=ejs[_0x1461('0x67')](_0x29c980,{'trunks':_0x2f3c38});fs[_0x1461('0x68')]('/etc/asterisk/sip_xcally_trunks.conf',_0xd91a35);fs[_0x1461('0x68')]('/etc/asterisk/sip_xcally_registers.conf',_0x579402);return respondWithRpcPromise('Reload',_0x1461('0x2f'),{'module':_0x1461('0x6b')});})[_0x1461('0x24')](handleError(_0x3f9219,null));}; \ No newline at end of file +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 diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 8b8d6e9..ba5b4e8 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 _0x195c=['lodash','util','api','bluebird','request-promise','path','../../config/environment','./trunk.attributes','exports','Trunk','tools_trunks'];(function(_0xceb1bd,_0x5abf66){var _0x1d12de=function(_0xa92e16){while(--_0xa92e16){_0xceb1bd['push'](_0xceb1bd['shift']());}};_0x1d12de(++_0x5abf66);}(_0x195c,0x1c3));var _0xc195=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0x195c[_0x5d80de];return _0x1c7556;};'use strict';var _=require(_0xc195('0x0'));var util=require(_0xc195('0x1'));var logger=require('../../config/logger')(_0xc195('0x2'));var moment=require('moment');var BPromise=require(_0xc195('0x3'));var rp=require(_0xc195('0x4'));var fs=require('fs');var path=require(_0xc195('0x5'));var rimraf=require('rimraf');var config=require(_0xc195('0x6'));var attributes=require(_0xc195('0x7'));module[_0xc195('0x8')]=function(_0x29f1a2,_0x160146){return _0x29f1a2['define'](_0xc195('0x9'),attributes,{'tableName':_0xc195('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 56b6b86..e87d0ec 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 _0x9ffd=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','Trunk,\x20%s,\x20%s','info','catch','GetTrunk','Trunk','findAll','options','raw','include','map','model','attributes','where','ShowTrunk'];(function(_0x152dd4,_0xf72d48){var _0x5d93b0=function(_0x1c6c4f){while(--_0x1c6c4f){_0x152dd4['push'](_0x152dd4['shift']());}};_0x5d93b0(++_0xf72d48);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x3fa3eb,_0x163537){_0x3fa3eb=_0x3fa3eb-0x0;var _0x244ca7=_0x9ffd[_0x3fa3eb];return _0x244ca7;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('Trunk,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('Trunk,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('Trunk,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});}exports[_0xd9ff('0x17')]=function(_0x3afd19){var _0x5f45c4=this;return new Promise(function(_0x2d4df1,_0x3ccf15){return db[_0xd9ff('0x18')][_0xd9ff('0x19')]({'raw':_0x3afd19[_0xd9ff('0x1a')]?_0x3afd19[_0xd9ff('0x1a')][_0xd9ff('0x1b')]===undefined?!![]:![]:!![],'where':_0x3afd19[_0xd9ff('0x1a')]?_0x3afd19['options']['where']||null:null,'attributes':_0x3afd19[_0xd9ff('0x1a')]?_0x3afd19[_0xd9ff('0x1a')]['attributes']||null:null,'limit':_0x3afd19['options']?_0x3afd19['options']['limit']||null:null,'include':_0x3afd19[_0xd9ff('0x1a')]?_0x3afd19['options'][_0xd9ff('0x1c')]?_[_0xd9ff('0x1d')](_0x3afd19[_0xd9ff('0x1a')][_0xd9ff('0x1c')],function(_0x278b66){return{'model':db[_0x278b66[_0xd9ff('0x1e')]],'as':_0x278b66['as'],'attributes':_0x278b66['attributes'],'include':_0x278b66['include']?_[_0xd9ff('0x1d')](_0x278b66['include'],function(_0x3ca906){return{'model':db[_0x3ca906['model']],'as':_0x3ca906['as'],'attributes':_0x3ca906[_0xd9ff('0x1f')],'include':_0x3ca906['include']?_[_0xd9ff('0x1d')](_0x3ca906[_0xd9ff('0x1c')],function(_0x2138b4){return{'model':db[_0x2138b4[_0xd9ff('0x1e')]],'as':_0x2138b4['as'],'attributes':_0x2138b4['attributes']};}):[]};}):[]};}):[]:[]})[_0xd9ff('0xc')](function(_0xe11f88){logger[_0xd9ff('0x15')](_0xd9ff('0x17'),_0x3afd19);logger['debug'](_0xd9ff('0x17'),_0x3afd19,JSON[_0xd9ff('0x10')](_0xe11f88));_0x2d4df1(_0xe11f88);})[_0xd9ff('0x16')](function(_0x45fb63){logger[_0xd9ff('0x11')](_0xd9ff('0x17'),_0x45fb63[_0xd9ff('0x13')],_0x3afd19);_0x3ccf15(_0x5f45c4[_0xd9ff('0x11')](0x1f4,_0x45fb63[_0xd9ff('0x13')]));});});};exports['ShowTrunk']=function(_0xcea5db){var _0x4ba2be=this;return new Promise(function(_0x1d55fd,_0x29c532){return db[_0xd9ff('0x18')]['find']({'raw':_0xcea5db[_0xd9ff('0x1a')]?_0xcea5db[_0xd9ff('0x1a')][_0xd9ff('0x1b')]===undefined?!![]:![]:!![],'where':_0xcea5db[_0xd9ff('0x1a')]?_0xcea5db['options'][_0xd9ff('0x20')]||null:null,'attributes':_0xcea5db['options']?_0xcea5db[_0xd9ff('0x1a')][_0xd9ff('0x1f')]||null:null,'include':_0xcea5db[_0xd9ff('0x1a')]?_0xcea5db[_0xd9ff('0x1a')][_0xd9ff('0x1c')]?_[_0xd9ff('0x1d')](_0xcea5db[_0xd9ff('0x1a')][_0xd9ff('0x1c')],function(_0x36749c){return{'model':db[_0x36749c[_0xd9ff('0x1e')]],'as':_0x36749c['as'],'attributes':_0x36749c[_0xd9ff('0x1f')],'include':_0x36749c[_0xd9ff('0x1c')]?_[_0xd9ff('0x1d')](_0x36749c[_0xd9ff('0x1c')],function(_0x498025){return{'model':db[_0x498025[_0xd9ff('0x1e')]],'as':_0x498025['as'],'attributes':_0x498025[_0xd9ff('0x1f')],'include':_0x498025[_0xd9ff('0x1c')]?_['map'](_0x498025[_0xd9ff('0x1c')],function(_0x5e3ff9){return{'model':db[_0x5e3ff9[_0xd9ff('0x1e')]],'as':_0x5e3ff9['as'],'attributes':_0x5e3ff9['attributes']};}):[]};}):[]};}):[]:[]})[_0xd9ff('0xc')](function(_0x5db498){logger[_0xd9ff('0x15')](_0xd9ff('0x21'),_0xcea5db);logger[_0xd9ff('0xd')]('ShowTrunk',_0xcea5db,JSON['stringify'](_0x5db498));_0x1d55fd(_0x5db498);})['catch'](function(_0x7ac3d1){logger[_0xd9ff('0x11')](_0xd9ff('0x21'),_0x7ac3d1[_0xd9ff('0x13')],_0xcea5db);_0x29c532(_0x4ba2be[_0xd9ff('0x11')](0x1f4,_0x7ac3d1[_0xd9ff('0x13')]));});});}; \ No newline at end of file +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 diff --git a/server/api/user/index.js b/server/api/user/index.js index 3f7e03f..66fa043 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 _0x5f2f=['createApiKey','update','/:id/password','changePassword','removeQueues','removeTeams','destroy','delete','removeFaxInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','removeApiKey','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/whoami','/:id','/:id/contacts','getContacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/teams','getTeams','/:id/lists','getLists','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/square_projects','/:id/api_key','getApiKey','post','/create_many','bulkCreate','addContacts','create','addQueues','join','root','server/files/images/','format','%s-%s','originalname','/:id/avatar','file','addAvatar','/:id/login','login','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addSquareProjects'];(function(_0x45c48f,_0x4aa891){var _0xaf5037=function(_0x3e3c1f){while(--_0x3e3c1f){_0x45c48f['push'](_0x45c48f['shift']());}};_0xaf5037(++_0x4aa891);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1ba53f,_0x1dd49d){_0x1ba53f=_0x1ba53f-0x0;var _0x1ce436=_0x5f2f[_0x1ba53f];return _0x1ce436;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./user.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['whoami']);router[_0xf5f2('0x8')](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0x8')]('/:id/avatar',controller['getAvatar']);router[_0xf5f2('0x8')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x8')](_0xf5f2('0x10'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x11')]);router[_0xf5f2('0x8')]('/:id/queues_rt',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x8')](_0xf5f2('0x13'),auth[_0xf5f2('0x9')](),controller['getGroups']);router[_0xf5f2('0x8')](_0xf5f2('0x14'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x15')]);router[_0xf5f2('0x8')](_0xf5f2('0x16'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x17')]);router[_0xf5f2('0x8')](_0xf5f2('0x18'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x19')]);router[_0xf5f2('0x8')](_0xf5f2('0x1a'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x1b')]);router[_0xf5f2('0x8')]('/:id/mail/interactions',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x1c')]);router['get']('/:id/sms/interactions',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x1d')]);router['get'](_0xf5f2('0x1e'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x1f')]);router[_0xf5f2('0x8')](_0xf5f2('0x20'),auth['isAuthenticated'](),controller[_0xf5f2('0x21')]);router[_0xf5f2('0x8')](_0xf5f2('0x22'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x23')]);router['get']('/:id/agents',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x24')]);router[_0xf5f2('0x8')](_0xf5f2('0x25'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x26')]);router[_0xf5f2('0x8')](_0xf5f2('0x27'),auth[_0xf5f2('0x9')](),controller['getFaxAccounts']);router[_0xf5f2('0x8')](_0xf5f2('0x28'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x29')]);router[_0xf5f2('0x8')](_0xf5f2('0x2a'),auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router[_0xf5f2('0x8')](_0xf5f2('0x2b'),auth[_0xf5f2('0x9')](),controller['getSmsAccounts']);router['get'](_0xf5f2('0x2c'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x2d')]);router[_0xf5f2('0x8')](_0xf5f2('0x2e'),auth['isAuthenticated'](),controller['getSquareProjects']);router[_0xf5f2('0x8')]('/:id/scheduled_calls',auth[_0xf5f2('0x9')](),controller['getScheduledCalls']);router[_0xf5f2('0x8')](_0xf5f2('0x2f'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x30')]);router[_0xf5f2('0x31')](_0xf5f2('0x32'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x33')]);router['post'](_0xf5f2('0xe'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x34')]);router[_0xf5f2('0x31')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x35')]);router[_0xf5f2('0x31')]('/:id/queues',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x36')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3fc168,_0x4b8c42,_0x18ae07){_0x18ae07(null,path[_0xf5f2('0x37')](config[_0xf5f2('0x38')],_0xf5f2('0x39')));},'filename':function(_0x59a6dd,_0x5a98d7,_0x41088b){_0x41088b(null,util[_0xf5f2('0x3a')](_0xf5f2('0x3b'),Date['now'](),_0x5a98d7[_0xf5f2('0x3c')]));}})});router['post'](_0xf5f2('0x3d'),upload['single'](_0xf5f2('0x3e')),controller[_0xf5f2('0x3f')]);router['post'](_0xf5f2('0x40'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x41')]);router[_0xf5f2('0x31')]('/:id/logout',auth['isAuthenticated'](),controller[_0xf5f2('0x42')]);router[_0xf5f2('0x31')](_0xf5f2('0x43'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x44')]);router[_0xf5f2('0x31')](_0xf5f2('0x45'),auth['isAuthenticated'](),controller[_0xf5f2('0x46')]);router[_0xf5f2('0x31')]('/:id/teams',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x47')]);router[_0xf5f2('0x31')](_0xf5f2('0x48'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x49')]);router[_0xf5f2('0x31')](_0xf5f2('0x4a'),auth['isAuthenticated'](),controller[_0xf5f2('0x4b')]);router[_0xf5f2('0x31')](_0xf5f2('0x4c'),auth['isAuthenticated'](),controller['addFaxInteractions']);router['post'](_0xf5f2('0x4d'),auth[_0xf5f2('0x9')](),controller['addSmsInteractions']);router[_0xf5f2('0x31')](_0xf5f2('0x4e'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x4f')]);router[_0xf5f2('0x31')](_0xf5f2('0x27'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x50')]);router[_0xf5f2('0x31')](_0xf5f2('0x28'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x51')]);router[_0xf5f2('0x31')](_0xf5f2('0x2a'),auth['isAuthenticated'](),controller[_0xf5f2('0x52')]);router['post'](_0xf5f2('0x2b'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x53')]);router[_0xf5f2('0x31')](_0xf5f2('0x2c'),auth[_0xf5f2('0x9')](),controller['addChatWebsites']);router[_0xf5f2('0x31')](_0xf5f2('0x2e'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x54')]);router[_0xf5f2('0x31')](_0xf5f2('0x2f'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x55')]);router['put'](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x56')]);router['put'](_0xf5f2('0x57'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x58')]);router['delete']('/:id/queues',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x59')]);router['delete'](_0xf5f2('0x20'),auth['isAuthenticated'](),controller[_0xf5f2('0x5a')]);router['delete'](_0xf5f2('0xd'),auth['isAuthenticated'](),controller[_0xf5f2('0x5b')]);router[_0xf5f2('0x5c')](_0xf5f2('0x48'),auth[_0xf5f2('0x9')](),controller['removeChatInteractions']);router[_0xf5f2('0x5c')](_0xf5f2('0x4a'),auth['isAuthenticated'](),controller['removeMailInteractions']);router[_0xf5f2('0x5c')](_0xf5f2('0x4c'),auth['isAuthenticated'](),controller[_0xf5f2('0x5d')]);router[_0xf5f2('0x5c')](_0xf5f2('0x4d'),auth[_0xf5f2('0x9')](),controller['removeSmsInteractions']);router['delete'](_0xf5f2('0x4e'),auth[_0xf5f2('0x9')](),controller['removeOpenchannelInteractions']);router[_0xf5f2('0x5c')](_0xf5f2('0x27'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x5e')]);router[_0xf5f2('0x5c')](_0xf5f2('0x28'),auth[_0xf5f2('0x9')](),controller['removeMailAccounts']);router['delete'](_0xf5f2('0x2a'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x5f')]);router[_0xf5f2('0x5c')](_0xf5f2('0x2b'),auth['isAuthenticated'](),controller[_0xf5f2('0x60')]);router[_0xf5f2('0x5c')](_0xf5f2('0x2c'),auth['isAuthenticated'](),controller[_0xf5f2('0x61')]);router['delete'](_0xf5f2('0x2e'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x62')]);router[_0xf5f2('0x5c')]('/:id/api_key',auth['isAuthenticated'](),controller[_0xf5f2('0x63')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index f46a084..77da261 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(_0x4cb997,_0x42ae02){var _0x5aedab=function(_0x109a8d){while(--_0x109a8d){_0x4cb997['push'](_0x4cb997['shift']());}};_0x5aedab(++_0x42ae02);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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(_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 diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index af3d968..1fb0b02 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 _0x9261=['smsPause','pauseType','lastPauseAt','manual','mail','fax','sms','openchannel','%s%s','Pause','getTeams','addTeams','setDataValue','Voice','Chat','getMailQueues','Mail','getFaxQueues','getOpenchannelQueues','Openchannel','flatten','addAgent','getDataValue','upsert','removeTeams','Team','getChatQueues','getSmsQueues','Sms','Fax','removeAgent','getLists','getAgents','addChatInteractions','spread','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','removeChatWebsites','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contained','$any','firstName','CmHopper','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','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/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./user.socket','register','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','get','Users','Agents','agent','filter','ignore','map','value','includes','role','name','UserProfileResource','destroy','send','index','User','rawAttributes','fieldName','key','differenceBy','password','salt','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','sequelize','lower','col','options','includeAll','include','rows','catch','length','bulkCreate','body','find','params','describe','addContacts','ids','omit','telephone','admin','user','../../config/license/util','telephones','isNil','License\x20limit\x20reached','format','count\x20%s:\x20%s','create','Setting','findById','max','internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','VoiceMail','email','permissions','101','102','103','110','104','106','107','108','111','Unable\x20to\x20retrieve\x20the\x20current\x20user','Telephones','UserProfileSection','autoAssociation','changePassword','securePassword','oldPassword','newPassword','Sequelize','Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword','authenticate','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','addQueues','channel','online','loginInPause','interface','isValidChannel','Unknown\x20channel','capitalize','toLowerCase','Queues','penalty','emit','Queue:save','voice','VoiceQueue','voicePause','each','UserVoiceQueueRt','removeQueues','remove','Queue:remove','addAvatar','userpic','getAvatar','join','root','server/files/images/logos/default_profile.png','server/files/images/','download','getContacts','findOne','CmContact','order','pick','merge','CmList','List','Tags','tag','nolimit','getQueues','Queue','findAll','Unknown\x20role','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','SIP/%s','user:forcelogout','headers','x-forwarded-for','remoteAddress','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','push','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','all','LOGIN','device','PAUSE','LOGININPAUSE','isMiddleware','logout','pause','QueuePause','getChannels','type','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause'];(function(_0x474a72,_0x439f5a){var _0x304966=function(_0x1466eb){while(--_0x1466eb){_0x474a72['push'](_0x474a72['shift']());}};_0x304966(++_0x439f5a);}(_0x9261,0x1de));var _0x1926=function(_0x412342,_0x180734){_0x412342=_0x412342-0x0;var _0x3e62cb=_0x9261[_0x412342];return _0x3e62cb;};'use strict';var pdf=require(_0x1926('0x0'));var emlformat=require(_0x1926('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1926('0x2'));var jsonpatch=require(_0x1926('0x3'));var rp=require(_0x1926('0x4'));var moment=require('moment');var BPromise=require(_0x1926('0x5'));var Mustache=require(_0x1926('0x6'));var util=require(_0x1926('0x7'));var path=require(_0x1926('0x8'));var sox=require(_0x1926('0x9'));var csv=require('to-csv');var ejs=require(_0x1926('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1926('0xb'));var crypto=require(_0x1926('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1926('0xd'));var toCsv=require(_0x1926('0xe'));var querystring=require(_0x1926('0xf'));var Papa=require(_0x1926('0x10'));var Redis=require(_0x1926('0x11'));var authService=require(_0x1926('0x12'));var qs=require(_0x1926('0x13'));var as=require(_0x1926('0x14'));var hardwareService=require(_0x1926('0x15'));var logger=require(_0x1926('0x16'))(_0x1926('0x17'));var utils=require(_0x1926('0x18'));var config=require(_0x1926('0x19'));var db=require(_0x1926('0x1a'))['db'];config[_0x1926('0x1b')]=_[_0x1926('0x1c')](config[_0x1926('0x1b')],{'host':_0x1926('0x1d'),'port':0x18eb});var socket=require(_0x1926('0x1e'))(new Redis(config[_0x1926('0x1b')]));require(_0x1926('0x1f'))[_0x1926('0x20')](socket);var jayson=require(_0x1926('0x21'));var client=jayson[_0x1926('0x22')][_0x1926('0x23')]({'port':0x232a});function checkPasswordPattern(_0x472e41,_0x53f820,_0xe13cde){if(_0xe13cde){var _0x348117=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x348117[_0x1926('0x24')](_0x53f820)){return _0x472e41;}else{throw new db['Sequelize'][(_0x1926('0x25'))](_0x1926('0x26'));}}else{return _0x472e41;}}function respondWithRpcPromise(_0x50da1e,_0x21e214,_0x4552e0,_0xdfa757){return new BPromise(function(_0x2fdac0,_0x1b8d73){var _0x2606ba=_0xdfa757||client;return _0x2606ba[_0x1926('0x27')](_0x50da1e,_0x4552e0)[_0x1926('0x28')](function(_0x1e4b49){logger[_0x1926('0x29')](_0x1926('0x2a'),_0x21e214,_0x1926('0x2b'));logger[_0x1926('0x2c')]('User,\x20%s,\x20%s,\x20%s',_0x21e214,'request\x20sent',JSON[_0x1926('0x2d')](_0x1e4b49));if(_0x1e4b49[_0x1926('0x2e')]){if(_0x1e4b49[_0x1926('0x2e')][_0x1926('0x2f')]===0x1f4){logger[_0x1926('0x2e')](_0x1926('0x2a'),_0x21e214,_0x1e4b49[_0x1926('0x2e')][_0x1926('0x30')]);return _0x1b8d73(_0x1e4b49[_0x1926('0x2e')][_0x1926('0x30')]);}logger[_0x1926('0x2e')]('User,\x20%s,\x20%s',_0x21e214,_0x1e4b49['error']['message']);return _0x2fdac0(_0x1e4b49['error'][_0x1926('0x30')]);}else{logger[_0x1926('0x29')](_0x1926('0x2a'),_0x21e214,_0x1926('0x2b'));_0x2fdac0(_0x1e4b49['result']['message']);}})['catch'](function(_0x3659fa){logger[_0x1926('0x2e')]('User,\x20%s,\x20%s',_0x21e214,_0x3659fa);_0x1b8d73(_0x3659fa);});});}function respondWithStatusCode(_0x1c0d63,_0x2649ff){_0x2649ff=_0x2649ff||0xcc;return function(_0x3cb4ee){if(_0x3cb4ee){return _0x1c0d63[_0x1926('0x31')](_0x2649ff);}return _0x1c0d63[_0x1926('0x32')](_0x2649ff)[_0x1926('0x33')]();};}function respondWithResult(_0x267513,_0xd60129){_0xd60129=_0xd60129||0xc8;return function(_0x1c8290){if(_0x1c8290){return _0x267513['status'](_0xd60129)[_0x1926('0x34')](_0x1c8290);}};}function respondWithFilteredResult(_0x42e41e,_0x10fd25){return function(_0x733be2){if(_0x733be2){var _0x486a2e=_0x733be2[_0x1926('0x35')],_0x391915=_0x10fd25[_0x1926('0x36')],_0x47834a=_0x10fd25['offset']+_0x10fd25[_0x1926('0x37')],_0x406631;if(_0x47834a>=_0x486a2e){_0x47834a=_0x486a2e;_0x406631=0xc8;}else{_0x406631=0xce;}_0x42e41e['status'](_0x406631);return _0x42e41e[_0x1926('0x38')](_0x1926('0x39'),_0x391915+'-'+_0x47834a+'/'+_0x486a2e)[_0x1926('0x34')](_0x733be2);}return null;};}function patchUpdates(_0x33d4a4){return function(_0x56f7a8){try{jsonpatch[_0x1926('0x3a')](_0x56f7a8,_0x33d4a4,!![]);}catch(_0x3ed2b3){return BPromise[_0x1926('0x3b')](_0x3ed2b3);}return _0x56f7a8['save']();};}function saveUpdates(_0x9495cd,_0x331481){return function(_0x187b1e){if(_0x187b1e){return _0x187b1e[_0x1926('0x3c')](_0x9495cd)[_0x1926('0x28')](function(_0x5ab830){return _0x5ab830;});}return null;};}function removeEntity(_0x51cdce,_0x2c8d69){return function(_0x48fd4b){if(_0x48fd4b){return _0x48fd4b['destroy']()[_0x1926('0x28')](function(){var _0x4da402=_0x48fd4b[_0x1926('0x3d')]({'plain':!![]});var _0x1960ef=[{'name':_0x1926('0x3e'),'value':'user','ignore':!![]},{'name':_0x1926('0x3f'),'value':_0x1926('0x40'),'ignore':![]},{'name':'Telephones','value':'telephone','ignore':![]}];var _0x18b363=_(_0x1960ef)[_0x1926('0x41')](_0x1926('0x42'))[_0x1926('0x43')](_0x1926('0x44'))['value']();if(_[_0x1926('0x45')](_0x18b363,_0x4da402[_0x1926('0x46')])){return;}var _0x101a81=_['find'](_0x1960ef,[_0x1926('0x44'),_0x4da402[_0x1926('0x46')]])[_0x1926('0x47')];return db[_0x1926('0x48')][_0x1926('0x49')]({'where':{'type':_0x101a81,'resourceId':_0x4da402['id']}})[_0x1926('0x28')](function(){return _0x48fd4b;});})[_0x1926('0x28')](function(){_0x51cdce[_0x1926('0x32')](0xcc)[_0x1926('0x33')]();});}};}function handleEntityNotFound(_0x39925a,_0x40f425){return function(_0x13f122){if(!_0x13f122){_0x39925a[_0x1926('0x31')](0x194);}return _0x13f122;};}function handleError(_0x372204,_0x2018ae){_0x2018ae=_0x2018ae||0x1f4;return function(_0x5c04a7){logger[_0x1926('0x2e')](_0x5c04a7['stack']);if(_0x5c04a7[_0x1926('0x47')]){delete _0x5c04a7[_0x1926('0x47')];}_0x372204['status'](_0x2018ae)[_0x1926('0x4a')](_0x5c04a7);};}exports[_0x1926('0x4b')]=function(_0x55988d,_0x437029){var _0x1b17d5={},_0x362df6={},_0x1a1762={'count':0x0,'rows':[]};var _0x229fdf=_['map'](db[_0x1926('0x4c')][_0x1926('0x4d')],function(_0x54efec){return{'name':_0x54efec[_0x1926('0x4e')],'type':_0x54efec['type'][_0x1926('0x4f')]};});_0x362df6['model']=_[_0x1926('0x50')](_[_0x1926('0x43')](_0x229fdf,_0x1926('0x47')),[_0x1926('0x51'),_0x1926('0x52')]);_0x362df6['query']=_[_0x1926('0x53')](_0x55988d[_0x1926('0x54')]);_0x362df6[_0x1926('0x55')]=_[_0x1926('0x56')](_0x362df6[_0x1926('0x57')],_0x362df6[_0x1926('0x54')]);_0x1b17d5[_0x1926('0x58')]=_[_0x1926('0x56')](_0x362df6[_0x1926('0x57')],qs['fields'](_0x55988d['query'][_0x1926('0x59')]));_0x1b17d5['attributes']=_0x1b17d5[_0x1926('0x58')]['length']?_0x1b17d5[_0x1926('0x58')]:_0x362df6[_0x1926('0x57')];if(!_0x55988d[_0x1926('0x54')][_0x1926('0x5a')]('nolimit')){_0x1b17d5[_0x1926('0x37')]=qs[_0x1926('0x37')](_0x55988d[_0x1926('0x54')][_0x1926('0x37')]);_0x1b17d5[_0x1926('0x36')]=qs[_0x1926('0x36')](_0x55988d['query'][_0x1926('0x36')]);}_0x1b17d5['order']=qs[_0x1926('0x5b')](_0x55988d[_0x1926('0x54')][_0x1926('0x5b')]);_0x1b17d5[_0x1926('0x5c')]=qs[_0x1926('0x55')](_['pick'](_0x55988d[_0x1926('0x54')],_0x362df6[_0x1926('0x55')]));if(_0x55988d[_0x1926('0x54')][_0x1926('0x41')]){_0x1b17d5[_0x1926('0x5c')]=_['merge'](_0x1b17d5[_0x1926('0x5c')],{'$or':_[_0x1926('0x43')](_0x229fdf,function(_0x103579){if(_0x103579['type']!=='VIRTUAL'){return db[_0x1926('0x5d')][_0x1926('0x5c')](db['sequelize']['fn'](_0x1926('0x5e'),db[_0x1926('0x5d')][_0x1926('0x5f')](_0x103579['name'])),{'$like':db[_0x1926('0x5d')]['fn'](_0x1926('0x5e'),'%'+_0x55988d[_0x1926('0x54')][_0x1926('0x41')]+'%')});}})});}_0x1b17d5=_['merge']({},_0x1b17d5,_0x55988d[_0x1926('0x60')]);var _0x24912d={'where':_0x1b17d5[_0x1926('0x5c')]};return db[_0x1926('0x4c')]['count'](_0x24912d)['then'](function(_0x123ae8){_0x1a1762[_0x1926('0x35')]=_0x123ae8;if(_0x55988d[_0x1926('0x54')][_0x1926('0x61')]){_0x1b17d5[_0x1926('0x62')]=[{'all':!![]}];}return db[_0x1926('0x4c')]['findAll'](_0x1b17d5);})[_0x1926('0x28')](function(_0x366ba8){_0x1a1762[_0x1926('0x63')]=_0x366ba8;return _0x1a1762;})[_0x1926('0x28')](respondWithFilteredResult(_0x437029,_0x1b17d5))[_0x1926('0x64')](handleError(_0x437029,null));};exports['show']=function(_0x4a2932,_0x2017e8){var _0x37d1c1={'raw':![],'where':{'id':_0x4a2932['params']['id']}},_0x457a9f={};_0x457a9f['model']=_['differenceBy'](_[_0x1926('0x53')](db[_0x1926('0x4c')][_0x1926('0x4d')]),[_0x1926('0x51'),_0x1926('0x52')]);_0x457a9f[_0x1926('0x54')]=_['keys'](_0x4a2932[_0x1926('0x54')]);_0x457a9f[_0x1926('0x55')]=_[_0x1926('0x56')](_0x457a9f[_0x1926('0x57')],_0x457a9f[_0x1926('0x54')]);_0x37d1c1['attributes']=_[_0x1926('0x56')](_0x457a9f[_0x1926('0x57')],qs[_0x1926('0x59')](_0x4a2932['query'][_0x1926('0x59')]));_0x37d1c1['attributes']=_0x37d1c1['attributes'][_0x1926('0x65')]?_0x37d1c1[_0x1926('0x58')]:_0x457a9f[_0x1926('0x57')];if(_0x4a2932[_0x1926('0x54')][_0x1926('0x61')]){_0x37d1c1[_0x1926('0x62')]=[{'all':!![]}];}_0x37d1c1=_['merge']({},_0x37d1c1,_0x4a2932[_0x1926('0x60')]);return db[_0x1926('0x4c')]['find'](_0x37d1c1)[_0x1926('0x28')](handleEntityNotFound(_0x2017e8,null))[_0x1926('0x28')](respondWithResult(_0x2017e8,null))[_0x1926('0x64')](handleError(_0x2017e8,null));};exports[_0x1926('0x66')]=function(_0x566601,_0x5f44b0){return db['User'][_0x1926('0x66')](_0x566601[_0x1926('0x67')],{'raw':![],'individualHooks':!![]})[_0x1926('0x28')](respondWithResult(_0x5f44b0,0xc9))[_0x1926('0x64')](handleError(_0x5f44b0,null));};exports['update']=function(_0x36b0ee,_0x1ac0e4){if(_0x36b0ee['body']['id']){delete _0x36b0ee[_0x1926('0x67')]['id'];}delete _0x36b0ee[_0x1926('0x67')]['role'];return db[_0x1926('0x4c')][_0x1926('0x68')]({'where':{'id':_0x36b0ee[_0x1926('0x69')]['id']}})[_0x1926('0x28')](handleEntityNotFound(_0x1ac0e4,null))[_0x1926('0x28')](saveUpdates(_0x36b0ee[_0x1926('0x67')],null))['then'](respondWithResult(_0x1ac0e4,null))[_0x1926('0x64')](handleError(_0x1ac0e4,null));};exports[_0x1926('0x6a')]=function(_0x1aca21,_0x584aa3){return db[_0x1926('0x4c')][_0x1926('0x6a')]()['then'](respondWithResult(_0x584aa3,null))[_0x1926('0x64')](handleError(_0x584aa3,null));};exports['addContacts']=function(_0x26c0c0,_0x210878,_0x2608b2){return db[_0x1926('0x4c')][_0x1926('0x68')]({'where':{'id':_0x26c0c0['params']['id']}})[_0x1926('0x28')](handleEntityNotFound(_0x210878,null))[_0x1926('0x28')](function(_0x377eb3){if(_0x377eb3){return _0x377eb3[_0x1926('0x6b')](_0x26c0c0[_0x1926('0x67')][_0x1926('0x6c')],_[_0x1926('0x6d')](_0x26c0c0[_0x1926('0x67')],[_0x1926('0x6c'),'id'])||{});}})[_0x1926('0x28')](respondWithResult(_0x210878,null))['catch'](handleError(_0x210878,null));};var getLicense=function(_0x28b935){return new BPromise(function(_0x1537f6,_0x435f00){var _0x108361=0x0;_0x28b935[_0x1926('0x67')]['role']===_0x1926('0x40')&&_0x1537f6('agent\x20role');return db[_0x1926('0x4c')][_0x1926('0x35')]({'where':{'$or':[{'role':_0x28b935[_0x1926('0x67')][_0x1926('0x46')]===_0x1926('0x6e')?_0x1926('0x6e'):[_0x1926('0x6f'),_0x1926('0x70')]}]}})[_0x1926('0x28')](function(_0xa69a5e){_0x108361=_0xa69a5e;return require(_0x1926('0x71'))['getLicense']();})[_0x1926('0x28')](function(_0x160a00){var _0x4d7823=_0x28b935[_0x1926('0x67')][_0x1926('0x46')]==='telephone'?_0x1926('0x72'):'users';if(!_[_0x1926('0x73')](_0x160a00[_0x4d7823])&&_0x108361>=_0x160a00[_0x4d7823]){return _0x435f00({'message':_0x1926('0x74')});}return _0x1537f6(util[_0x1926('0x75')](_0x1926('0x76'),_0x4d7823,_0x108361));})['catch'](function(_0x2e9ff2){return _0x435f00(_0x2e9ff2);});});};exports[_0x1926('0x77')]=function(_0x10c583,_0x36729d){return getLicense(_0x10c583)[_0x1926('0x28')](function(_0x2be484){if(!_0x10c583[_0x1926('0x67')]['internal']){var _0x274033;return db[_0x1926('0x78')][_0x1926('0x79')](0x1)[_0x1926('0x28')](function(_0x32a763){return checkPasswordPattern(_0x32a763,_0x10c583[_0x1926('0x67')]['password'],_0x32a763['securePassword']);})[_0x1926('0x28')](function(_0x52dcec){_0x274033=_0x52dcec['min_internal'];return db[_0x1926('0x4c')][_0x1926('0x7a')]('internal');})['then'](function(_0x56def3){if(_[_0x1926('0x73')](_0x56def3)){if(_0x274033){_0x10c583[_0x1926('0x67')]['internal']=_0x274033;}else{_0x10c583[_0x1926('0x67')][_0x1926('0x7b')]=0x1;}}else{if(_[_0x1926('0x73')](_0x274033)||_0x274033==_0x56def3){_0x10c583['body'][_0x1926('0x7b')]=_0x56def3+0x1;}else if(_0x274033>_0x56def3){_0x10c583[_0x1926('0x67')]['internal']=_0x274033;}else{return db[_0x1926('0x5d')][_0x1926('0x54')](_0x1926('0x7c'),{'type':db[_0x1926('0x5d')][_0x1926('0x7d')][_0x1926('0x7e')]})[_0x1926('0x28')](function(_0x406ca3){if(_0x406ca3&&_0x406ca3['length']){for(var _0x373bf6=0x0,_0x32ad40=_0x406ca3[_0x1926('0x65')];_0x373bf6<_0x32ad40&&_['isNil'](_0x10c583[_0x1926('0x67')][_0x1926('0x7b')]);_0x373bf6++){if(_0x274033<=_0x406ca3[_0x373bf6][_0x1926('0x7f')]){_0x10c583[_0x1926('0x67')][_0x1926('0x7b')]=_0x406ca3[_0x373bf6][_0x1926('0x7f')];}else if(_0x274033>_0x406ca3[_0x373bf6]['from']&&_0x274033<=_0x406ca3[_0x373bf6]['to']){_0x10c583['body'][_0x1926('0x7b')]=_0x274033;}}}if(_[_0x1926('0x73')](_0x10c583[_0x1926('0x67')][_0x1926('0x7b')])){_0x10c583[_0x1926('0x67')][_0x1926('0x7b')]=_0x56def3+0x1;}});}}});}})[_0x1926('0x28')](function(){if(_0x10c583[_0x1926('0x67')][_0x1926('0x80')]){_0x10c583['body']['mailbox']=_0x10c583[_0x1926('0x67')][_0x1926('0x7b')];_0x10c583[_0x1926('0x67')][_0x1926('0x81')]={'mailbox':_0x10c583['body'][_0x1926('0x7b')],'password':_0x10c583[_0x1926('0x67')][_0x1926('0x51')],'fullname':_0x10c583[_0x1926('0x67')]['fullname'],'email':_0x10c583['body'][_0x1926('0x82')]};}if(_0x10c583[_0x1926('0x67')]&&_0x10c583['body'][_0x1926('0x46')]===_0x1926('0x40')){_0x10c583[_0x1926('0x67')][_0x1926('0x83')]=[_0x1926('0x84'),_0x1926('0x85'),_0x1926('0x86'),_0x1926('0x87'),_0x1926('0x88'),'105',_0x1926('0x89'),_0x1926('0x8a'),_0x1926('0x8b'),'109','100',_0x1926('0x8c')];}return db[_0x1926('0x4c')][_0x1926('0x77')](_0x10c583[_0x1926('0x67')],{'include':[{'model':db['VoiceMail'],'as':_0x1926('0x81')}]});})[_0x1926('0x28')](function(_0x3f242e){if(_0x10c583[_0x1926('0x67')][_0x1926('0x46')]===_0x1926('0x70'))return _0x3f242e;var _0x4798e5=_0x10c583[_0x1926('0x70')][_0x1926('0x3d')]({'plain':!![]});if(!_0x4798e5)throw new Error(_0x1926('0x8d'));if(_0x4798e5[_0x1926('0x46')]===_0x1926('0x70')){var _0x20e71e=_0x3f242e['get']({'plain':!![]});var _0x1d7ba3=[{'name':_0x1926('0x3f'),'value':_0x1926('0x40')},{'name':_0x1926('0x8e'),'value':_0x1926('0x6e')}];var _0x4d24c1=_[_0x1926('0x68')](_0x1d7ba3,[_0x1926('0x44'),_0x20e71e[_0x1926('0x46')]])[_0x1926('0x47')];return db[_0x1926('0x8f')][_0x1926('0x68')]({'where':{'name':_0x4d24c1,'userProfileId':_0x4798e5['userProfileId']},'raw':!![]})[_0x1926('0x28')](function(_0x338858){if(_0x338858&&_0x338858[_0x1926('0x90')]===0x0){return db[_0x1926('0x48')][_0x1926('0x77')]({'name':_0x20e71e[_0x1926('0x47')],'resourceId':_0x20e71e['id'],'type':_0x338858[_0x1926('0x47')],'sectionId':_0x338858['id']},{})[_0x1926('0x28')](function(){return _0x3f242e;});}else{return _0x3f242e;}})[_0x1926('0x64')](function(_0x3ac4ec){logger[_0x1926('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ac4ec);throw _0x3ac4ec;});}return _0x3f242e;})[_0x1926('0x28')](respondWithResult(_0x36729d,0xc9))[_0x1926('0x64')](handleError(_0x36729d,null));};exports[_0x1926('0x91')]=function(_0x103063,_0x447107,_0x5682e1){var _0x522ff1=![];if(_0x103063[_0x1926('0x67')]['id']){delete _0x103063[_0x1926('0x67')]['id'];}return db[_0x1926('0x78')]['findOne']({'attributes':['id','securePassword']})['then'](function(_0x4f8395){_0x522ff1=_0x4f8395[_0x1926('0x92')];return db[_0x1926('0x4c')][_0x1926('0x68')]({'where':{'id':_0x103063['params']['id']}});})[_0x1926('0x28')](function(_0x190ee5){if(_0x190ee5){if(_0x190ee5['id']==_0x103063[_0x1926('0x70')]['id']){if(!_0x103063[_0x1926('0x67')][_0x1926('0x93')]||!_0x103063[_0x1926('0x67')][_0x1926('0x94')]){throw new db[(_0x1926('0x95'))][(_0x1926('0x25'))](_0x1926('0x96'));}if(!_0x190ee5[_0x1926('0x97')](_0x103063[_0x1926('0x67')][_0x1926('0x93')])){throw new db[(_0x1926('0x95'))][(_0x1926('0x25'))]('Wrong\x20credentials');}if(_0x103063[_0x1926('0x67')][_0x1926('0x93')]==_0x103063[_0x1926('0x67')][_0x1926('0x94')]){throw new db[(_0x1926('0x95'))]['ValidationError'](_0x1926('0x98'));}return _0x190ee5;}else if(_0x103063[_0x1926('0x70')]['role']==_0x1926('0x6f')){if(!_0x103063[_0x1926('0x67')]['newPassword']){throw new db[(_0x1926('0x95'))]['ValidationError'](_0x1926('0x99'));}return _0x190ee5;}else if(_0x103063[_0x1926('0x70')][_0x1926('0x46')]=='user'){if(!_0x103063[_0x1926('0x67')][_0x1926('0x94')]){throw new db['Sequelize'][(_0x1926('0x25'))](_0x1926('0x99'));}if(_0x190ee5[_0x1926('0x46')]!='agent'){throw new db[(_0x1926('0x95'))][(_0x1926('0x25'))](_0x1926('0x9a'));}return _0x190ee5;}else{throw new db['Sequelize'][(_0x1926('0x25'))](_0x1926('0x9a'));}}return null;})[_0x1926('0x28')](handleEntityNotFound(_0x447107,null))[_0x1926('0x28')](function(_0x100eee){return checkPasswordPattern(_0x100eee,_0x103063['body'][_0x1926('0x94')],_0x522ff1);})['then'](saveUpdates({'password':_0x103063[_0x1926('0x67')][_0x1926('0x94')],'passwordResetAt':_0x103063[_0x1926('0x70')]['id']==_0x103063[_0x1926('0x69')]['id']?moment():null},null))['then'](respondWithResult(_0x447107,null))[_0x1926('0x64')](handleError(_0x447107,null));};exports[_0x1926('0x9b')]=function(_0x1829e6,_0x54c7ba,_0x3ed2e){var _0x2bf370=_0x1829e6[_0x1926('0x67')][_0x1926('0x9c')];return db['User'][_0x1926('0x68')]({'where':{'id':_0x1829e6[_0x1926('0x69')]['id']},'attributes':['id','name',_0x1926('0x46'),_0x1926('0x9d'),_0x1926('0x9e'),'voicePause',_0x1926('0x9f')]})[_0x1926('0x28')](handleEntityNotFound(_0x54c7ba,null))['then'](function(_0xe5d478){if(_0xe5d478){if(!utils[_0x1926('0xa0')](_0x2bf370)){throw new db[(_0x1926('0x95'))][(_0x1926('0x25'))](_0x1926('0xa1'));}return _0xe5d478['add'+_[_0x1926('0xa2')](_0x2bf370[_0x1926('0xa3')]())+_0x1926('0xa4')](_0x1829e6[_0x1926('0x67')][_0x1926('0x6c')],{'penalty':_0x1829e6[_0x1926('0x67')][_0x1926('0xa5')]||0x0})['spread'](function(_0x971507){for(var _0x5ada64=0x0;_0x5ada64<_0x1829e6['body'][_0x1926('0x6c')][_0x1926('0x65')];_0x5ada64+=0x1){var _0x4cdf81={'UserId':_0x1829e6[_0x1926('0x69')]['id']};_0x4cdf81[_[_0x1926('0xa2')](_0x2bf370[_0x1926('0xa3')]())+'QueueId']=_0x1829e6[_0x1926('0x67')][_0x1926('0x6c')][_0x5ada64];socket[_0x1926('0xa6')](_0x1926('0x70')+_[_0x1926('0xa2')](_0x2bf370['toLowerCase']())+_0x1926('0xa7'),_0x4cdf81);}return _0x971507;})['then'](function(){if(_0x2bf370===_0x1926('0xa8')){return db[_0x1926('0xa9')]['findAll']({'where':{'id':_0x1829e6[_0x1926('0x67')][_0x1926('0x6c')]||[]},'raw':!![],'attributes':['id',_0x1926('0x47')]});}})[_0x1926('0x28')](function(_0x1447ce){var _0x18757f=_0xe5d478[_0x1926('0x3d')]({'plain':!![]});var _0x3c08af=[];if(_0x2bf370===_0x1926('0xa8')&&_0x18757f[_0x1926('0x46')]==='agent'&&_0x18757f[_0x1926('0x9d')]){for(var _0x1f26b6=0x0;_0x1f26b6<_0x1447ce[_0x1926('0x65')];_0x1f26b6+=0x1){_0x3c08af['push']({'membername':_0x18757f[_0x1926('0x47')],'UserId':_0x18757f['id'],'queue_name':_0x1447ce[_0x1f26b6][_0x1926('0x47')],'VoiceQueueId':_0x1447ce[_0x1f26b6]['id'],'interface':_[_0x1926('0x73')](_0x18757f['interface'])?util[_0x1926('0x75')]('SIP/%s',_0x18757f[_0x1926('0x47')]):_0x18757f[_0x1926('0x9f')],'paused':_0x18757f[_0x1926('0xaa')]||![],'penalty':_0x1829e6[_0x1926('0x67')]['penalty']||0x0});}return BPromise[_0x1926('0xab')](_0x3c08af,function(_0x1bac36){return db[_0x1926('0xac')]['upsert'](_0x1bac36);});}return _0xe5d478;});}})[_0x1926('0x28')](respondWithStatusCode(_0x54c7ba,null))[_0x1926('0x64')](handleError(_0x54c7ba,null));};exports[_0x1926('0xad')]=function(_0x28451d,_0x25b1eb,_0x25dda2){var _0x4f8c08;return db[_0x1926('0x4c')][_0x1926('0x68')]({'where':{'id':_0x28451d[_0x1926('0x69')]['id']},'attributes':['id','name',_0x1926('0x46')]})['then'](handleEntityNotFound(_0x25b1eb,null))[_0x1926('0x28')](function(_0x4d7390){if(_0x4d7390){_0x4f8c08=_0x4d7390;if(!_0x28451d[_0x1926('0x54')][_0x1926('0x9c')]||!utils[_0x1926('0xa0')](_0x28451d['query'][_0x1926('0x9c')])){throw new db[(_0x1926('0x95'))]['ValidationError']('Unknown\x20channel');}return _0x4d7390[_0x1926('0xae')+_[_0x1926('0xa2')](_0x28451d[_0x1926('0x54')][_0x1926('0x9c')][_0x1926('0xa3')]())+'Queues'](_0x28451d['query'][_0x1926('0x6c')]);}})['then'](function(_0x12f97e){for(var _0xf94d04=0x0;_0xf94d04<_0x28451d[_0x1926('0x54')][_0x1926('0x6c')][_0x1926('0x65')];_0xf94d04+=0x1){var _0x3dc2b9={'UserId':_0x28451d[_0x1926('0x69')]['id']};_0x3dc2b9[_[_0x1926('0xa2')](_0x28451d[_0x1926('0x54')][_0x1926('0x9c')][_0x1926('0xa3')]())+'QueueId']=_0x28451d[_0x1926('0x54')]['ids'][_0xf94d04];socket[_0x1926('0xa6')](_0x1926('0x70')+_[_0x1926('0xa2')](_0x28451d[_0x1926('0x54')][_0x1926('0x9c')][_0x1926('0xa3')]())+_0x1926('0xaf'),_0x3dc2b9);}return _0x12f97e;})[_0x1926('0x28')](function(){if(_0x28451d[_0x1926('0x54')][_0x1926('0x9c')]===_0x1926('0xa8')){return db['UserVoiceQueueRt'][_0x1926('0x49')]({'where':{'UserId':_0x28451d[_0x1926('0x69')]['id'],'VoiceQueueId':_0x28451d[_0x1926('0x54')][_0x1926('0x6c')]},'individualHooks':!![]})['then'](function(){return _0x4f8c08;});}return _0x4f8c08;})['then'](respondWithStatusCode(_0x25b1eb,null))[_0x1926('0x64')](handleError(_0x25b1eb,null));};exports[_0x1926('0xb0')]=function(_0x312fbd,_0xf951d0,_0x10a475){_0x312fbd[_0x1926('0x67')][_0x1926('0xb1')]=_0x312fbd['file']['filename'];return db[_0x1926('0x4c')][_0x1926('0x68')]({'where':{'id':_0x312fbd[_0x1926('0x69')]['id']}})['then'](handleEntityNotFound(_0xf951d0,null))[_0x1926('0x28')](saveUpdates(_0x312fbd['body'],null))[_0x1926('0x28')](respondWithResult(_0xf951d0,null))[_0x1926('0x64')](handleError(_0xf951d0,null));};exports[_0x1926('0xb2')]=function(_0x539d9b,_0x268942,_0x45d66d){var _0x32cb35=path[_0x1926('0xb3')](config[_0x1926('0xb4')],_0x1926('0xb5'));return db['User'][_0x1926('0x68')]({'where':{'id':_0x539d9b[_0x1926('0x69')]['id']},'attributes':['id',_0x1926('0xb1')],'raw':!![]})[_0x1926('0x28')](handleEntityNotFound(_0x268942,null))[_0x1926('0x28')](function(_0x2e853e){if(_0x2e853e){if(_['isNil'](_0x2e853e[_0x1926('0xb1')])){return _0x268942['download'](_0x32cb35);}else{if(!fs['existsSync'](path[_0x1926('0xb3')](config['root'],_0x1926('0xb6'),_0x2e853e[_0x1926('0xb1')]))){return _0x268942[_0x1926('0xb7')](_0x32cb35);}return _0x268942[_0x1926('0xb7')](path[_0x1926('0xb3')](config['root'],_0x1926('0xb6'),_0x2e853e[_0x1926('0xb1')]));}}})[_0x1926('0x64')](handleError(_0x268942,null));};exports[_0x1926('0xb8')]=function(_0x47378b,_0x591333,_0x2c53d5){var _0x40a532={};var _0x568dc4={};var _0x124a0c;var _0x4e97f3;return db[_0x1926('0x4c')][_0x1926('0xb9')]({'where':{'id':_0x47378b[_0x1926('0x69')]['id']}})['then'](handleEntityNotFound(_0x591333,null))[_0x1926('0x28')](function(_0x38c32d){if(_0x38c32d){_0x124a0c=_0x38c32d;_0x568dc4[_0x1926('0x57')]=_['keys'](db[_0x1926('0xba')][_0x1926('0x4d')]);_0x568dc4[_0x1926('0x54')]=_[_0x1926('0x53')](_0x47378b[_0x1926('0x54')]);_0x568dc4[_0x1926('0x55')]=_[_0x1926('0x56')](_0x568dc4[_0x1926('0x57')],_0x568dc4[_0x1926('0x54')]);_0x40a532[_0x1926('0x58')]=_[_0x1926('0x56')](_0x568dc4[_0x1926('0x57')],qs[_0x1926('0x59')](_0x47378b[_0x1926('0x54')][_0x1926('0x59')]));_0x40a532[_0x1926('0x58')]=_0x40a532[_0x1926('0x58')][_0x1926('0x65')]?_0x40a532[_0x1926('0x58')]:_0x568dc4[_0x1926('0x57')];_0x40a532[_0x1926('0xbb')]=qs[_0x1926('0x5b')](_0x47378b[_0x1926('0x54')]['sort']);_0x40a532[_0x1926('0x5c')]=qs[_0x1926('0x55')](_[_0x1926('0xbc')](_0x47378b['query'],_0x568dc4['filters']));if(_0x47378b['query']['filter']){_0x40a532[_0x1926('0x5c')]=_['merge'](_0x40a532[_0x1926('0x5c')],{'$or':_[_0x1926('0x43')](_0x40a532[_0x1926('0x58')],function(_0x4ced0d){var _0x49ada1={};_0x49ada1[_0x4ced0d]={'$like':'%'+_0x47378b[_0x1926('0x54')][_0x1926('0x41')]+'%'};return _0x49ada1;})});}_0x40a532=_[_0x1926('0xbd')]({},_0x40a532,_0x47378b['options']);return _0x124a0c[_0x1926('0xb8')](_0x40a532);}})[_0x1926('0x28')](function(_0x41ea0e){if(_0x41ea0e){_0x4e97f3=_0x41ea0e[_0x1926('0x65')];if(_0x47378b[_0x1926('0x54')][_0x1926('0x5a')](_0x1926('0x61'))){_0x40a532[_0x1926('0x62')]=[{'model':db[_0x1926('0xbe')],'as':_0x1926('0xbf'),'required':![]},{'model':db['Tag'],'as':_0x1926('0xc0'),'attributes':['id',_0x1926('0x47'),'color'],'where':_0x47378b[_0x1926('0x54')][_0x1926('0xc1')]?{'id':_0x47378b['query'][_0x1926('0xc1')]}:undefined,'required':_0x47378b[_0x1926('0x54')][_0x1926('0xc1')]?!![]:![]}];}if(!_0x47378b[_0x1926('0x54')][_0x1926('0x5a')](_0x1926('0xc2'))){_0x40a532['limit']=qs['limit'](_0x47378b[_0x1926('0x54')][_0x1926('0x37')]);_0x40a532['offset']=qs['offset'](_0x47378b[_0x1926('0x54')][_0x1926('0x36')]);}return _0x124a0c[_0x1926('0xb8')](_0x40a532);}})[_0x1926('0x28')](function(_0x44591a){if(_0x44591a){return _0x44591a?{'count':_0x4e97f3,'rows':_0x44591a}:null;}})[_0x1926('0x28')](respondWithResult(_0x591333,null))[_0x1926('0x64')](handleError(_0x591333,null));};exports[_0x1926('0xc3')]=function(_0x284669,_0x398706,_0x3f1494){var _0xa6b018;var _0x57f574;var _0x4850df={};var _0x25cb18;return db[_0x1926('0x4c')][_0x1926('0xb9')]({'where':{'id':_0x284669[_0x1926('0x69')]['id']},'attributes':['id',_0x1926('0x47'),'role']})[_0x1926('0x28')](handleEntityNotFound(_0x398706,null))[_0x1926('0x28')](function(_0x4d395b){if(!utils[_0x1926('0xa0')](_0x284669[_0x1926('0x54')][_0x1926('0x9c')])){throw new db['Sequelize'][(_0x1926('0x25'))](_0x1926('0xa1'));}_0xa6b018=_0x4d395b;var _0x44bbcd={};_0x44bbcd[_0x1926('0x57')]=_[_0x1926('0x53')](db[_[_0x1926('0xa2')](_0x284669[_0x1926('0x54')][_0x1926('0x9c')])+_0x1926('0xc4')][_0x1926('0x4d')]);_0x44bbcd[_0x1926('0x54')]=_['keys'](_0x284669[_0x1926('0x54')]);_0x44bbcd[_0x1926('0x55')]=_[_0x1926('0x56')](_0x44bbcd['model'],_0x44bbcd[_0x1926('0x54')]);_0x4850df[_0x1926('0x58')]=_[_0x1926('0x56')](_0x44bbcd['model'],qs['fields'](_0x284669[_0x1926('0x54')]['fields']));_0x4850df[_0x1926('0x58')]=_0x4850df[_0x1926('0x58')][_0x1926('0x65')]?_0x4850df[_0x1926('0x58')]:_0x44bbcd[_0x1926('0x57')];_0x4850df[_0x1926('0xbb')]=qs[_0x1926('0x5b')](_0x284669[_0x1926('0x54')][_0x1926('0x5b')]);_0x4850df['where']=qs[_0x1926('0x55')](_[_0x1926('0xbc')](_0x284669[_0x1926('0x54')],_0x44bbcd[_0x1926('0x55')]));if(_0x284669['query'][_0x1926('0x41')]){_0x4850df['where']=_[_0x1926('0xbd')](_0x4850df['where'],{'$or':_['map'](_0x4850df['attributes'],function(_0x5dfec8){var _0x384f67={};_0x384f67[_0x5dfec8]={'$like':'%'+_0x284669[_0x1926('0x54')]['filter']+'%'};return _0x384f67;})});}_0x4850df=_[_0x1926('0xbd')]({},_0x4850df,_0x284669[_0x1926('0x60')]);switch(_0xa6b018['role']){case'admin':return db[_[_0x1926('0xa2')](_0x284669[_0x1926('0x54')][_0x1926('0x9c')])+'Queue'][_0x1926('0xc5')](_0x4850df);case _0x1926('0x70'):case _0x1926('0x40'):return _0xa6b018[_0x1926('0x3d')+_['capitalize'](_0x284669['query']['channel'])+'Queues'](_0x4850df);default:throw new db[(_0x1926('0x95'))]['ValidationError'](_0x1926('0xc6'));}})[_0x1926('0x28')](function(_0x131326){_0x25cb18=_0x131326[_0x1926('0x65')];if(!_0x284669[_0x1926('0x54')][_0x1926('0x5a')](_0x1926('0xc2'))){_0x4850df['limit']=qs[_0x1926('0x37')](_0x284669['query'][_0x1926('0x37')]);_0x4850df[_0x1926('0x36')]=qs[_0x1926('0x36')](_0x284669[_0x1926('0x54')][_0x1926('0x36')]);}switch(_0xa6b018[_0x1926('0x46')]){case _0x1926('0x6f'):return db[_['capitalize'](_0x284669[_0x1926('0x54')][_0x1926('0x9c')])+_0x1926('0xc4')][_0x1926('0xc5')](_0x4850df);case'user':case'agent':return _0xa6b018['get'+_[_0x1926('0xa2')](_0x284669[_0x1926('0x54')]['channel'])+_0x1926('0xa4')](_0x4850df);}})[_0x1926('0x28')](function(_0x1e169e){return{'count':_0x25cb18,'rows':_0x1e169e};})['then'](respondWithResult(_0x398706,null))[_0x1926('0x64')](handleError(_0x398706,null));};exports[_0x1926('0xc7')]=function(_0x1427b0,_0x52396f,_0x4b6b99){var _0x45d45e={};var _0x48a6bf={};var _0x1882e9;var _0x4fede4;return db[_0x1926('0x4c')][_0x1926('0xb9')]({'where':{'id':_0x1427b0[_0x1926('0x69')]['id']}})[_0x1926('0x28')](handleEntityNotFound(_0x52396f,null))[_0x1926('0x28')](function(_0x1fccaa){if(_0x1fccaa){_0x1882e9=_0x1fccaa;_0x48a6bf[_0x1926('0x57')]=_[_0x1926('0x53')](db[_0x1926('0xac')]['rawAttributes']);_0x48a6bf[_0x1926('0x54')]=_[_0x1926('0x53')](_0x1427b0['query']);_0x48a6bf[_0x1926('0x55')]=_[_0x1926('0x56')](_0x48a6bf['model'],_0x48a6bf['query']);_0x45d45e['attributes']=_['intersection'](_0x48a6bf[_0x1926('0x57')],qs[_0x1926('0x59')](_0x1427b0[_0x1926('0x54')][_0x1926('0x59')]));_0x45d45e[_0x1926('0x58')]=_0x45d45e[_0x1926('0x58')][_0x1926('0x65')]?_0x45d45e[_0x1926('0x58')]:_0x48a6bf[_0x1926('0x57')];_0x45d45e['order']=qs[_0x1926('0x5b')](_0x1427b0['query'][_0x1926('0x5b')]);_0x45d45e[_0x1926('0x5c')]=qs[_0x1926('0x55')](_[_0x1926('0xbc')](_0x1427b0[_0x1926('0x54')],_0x48a6bf[_0x1926('0x55')]));if(_0x1427b0[_0x1926('0x54')][_0x1926('0x41')]){_0x45d45e[_0x1926('0x5c')]=_['merge'](_0x45d45e[_0x1926('0x5c')],{'$or':_[_0x1926('0x43')](_0x45d45e[_0x1926('0x58')],function(_0xcda980){var _0x5cbb96={};_0x5cbb96[_0xcda980]={'$like':'%'+_0x1427b0[_0x1926('0x54')][_0x1926('0x41')]+'%'};return _0x5cbb96;})});}_0x45d45e=_[_0x1926('0xbd')]({},_0x45d45e,_0x1427b0[_0x1926('0x60')]);return _0x1882e9[_0x1926('0xc7')](_0x45d45e);}})['then'](function(_0x9fb36){if(_0x9fb36){_0x4fede4=_0x9fb36[_0x1926('0x65')];if(!_0x1427b0[_0x1926('0x54')]['hasOwnProperty'](_0x1926('0xc2'))){_0x45d45e[_0x1926('0x37')]=qs[_0x1926('0x37')](_0x1427b0[_0x1926('0x54')][_0x1926('0x37')]);_0x45d45e[_0x1926('0x36')]=qs[_0x1926('0x36')](_0x1427b0[_0x1926('0x54')]['offset']);}return _0x1882e9[_0x1926('0xc7')](_0x45d45e);}})[_0x1926('0x28')](function(_0x40d823){if(_0x40d823){return _0x40d823?{'count':_0x4fede4,'rows':_0x40d823}:null;}})['then'](respondWithResult(_0x52396f,null))['catch'](handleError(_0x52396f,null));};exports[_0x1926('0xc8')]=function(_0x1965d6,_0x53f221,_0x5001d5){var _0x252149={};var _0xe6093e={};var _0x268996;var _0x54b602;return db[_0x1926('0x4c')]['findOne']({'where':{'id':_0x1965d6['params']['id']}})[_0x1926('0x28')](handleEntityNotFound(_0x53f221,null))[_0x1926('0x28')](function(_0x463fd1){if(_0x463fd1){_0x268996=_0x463fd1;_0xe6093e[_0x1926('0x57')]=_['keys'](db[_0x1926('0xc9')][_0x1926('0x4d')]);_0xe6093e[_0x1926('0x54')]=_['keys'](_0x1965d6['query']);_0xe6093e[_0x1926('0x55')]=_['intersection'](_0xe6093e[_0x1926('0x57')],_0xe6093e[_0x1926('0x54')]);_0x252149[_0x1926('0x58')]=_[_0x1926('0x56')](_0xe6093e['model'],qs[_0x1926('0x59')](_0x1965d6[_0x1926('0x54')][_0x1926('0x59')]));_0x252149[_0x1926('0x58')]=_0x252149[_0x1926('0x58')]['length']?_0x252149[_0x1926('0x58')]:_0xe6093e[_0x1926('0x57')];_0x252149[_0x1926('0xbb')]=qs['sort'](_0x1965d6['query'][_0x1926('0x5b')]);_0x252149['where']=qs[_0x1926('0x55')](_[_0x1926('0xbc')](_0x1965d6['query'],_0xe6093e[_0x1926('0x55')]));if(_0x1965d6[_0x1926('0x54')][_0x1926('0x41')]){_0x252149['where']=_['merge'](_0x252149[_0x1926('0x5c')],{'$or':_[_0x1926('0x43')](_0x252149['attributes'],function(_0x4d62a8){var _0x112dc={};_0x112dc[_0x4d62a8]={'$like':'%'+_0x1965d6[_0x1926('0x54')][_0x1926('0x41')]+'%'};return _0x112dc;})});}_0x252149=_[_0x1926('0xbd')]({},_0x252149,_0x1965d6['options']);return _0x268996[_0x1926('0xc8')](_0x252149);}})['then'](function(_0x194b13){if(_0x194b13){_0x54b602=_0x194b13[_0x1926('0x65')];if(!_0x1965d6[_0x1926('0x54')][_0x1926('0x5a')](_0x1926('0xc2'))){_0x252149[_0x1926('0x37')]=qs[_0x1926('0x37')](_0x1965d6[_0x1926('0x54')]['limit']);_0x252149['offset']=qs['offset'](_0x1965d6[_0x1926('0x54')]['offset']);}return _0x268996[_0x1926('0xc8')](_0x252149);}})[_0x1926('0x28')](function(_0x27f709){if(_0x27f709){return _0x27f709?{'count':_0x54b602,'rows':_0x27f709}:null;}})[_0x1926('0x28')](respondWithResult(_0x53f221,null))[_0x1926('0x64')](handleError(_0x53f221,null));};exports[_0x1926('0xca')]=function(_0x29b76d,_0x141f70,_0x5afbd3){var _0x47c2cb={'raw':!![],'where':{}};var _0x312acc={};var _0x2090e6={'count':0x0,'rows':[]};return db[_0x1926('0x4c')][_0x1926('0xb9')]({'where':{'id':_0x29b76d[_0x1926('0x69')]['id']}})[_0x1926('0x28')](handleEntityNotFound(_0x141f70,null))[_0x1926('0x28')](function(_0x126ada){if(_0x126ada){_0x312acc['model']=_[_0x1926('0x53')](db[_0x1926('0xcb')][_0x1926('0x4d')]);_0x312acc[_0x1926('0x54')]=_[_0x1926('0x53')](_0x29b76d[_0x1926('0x54')]);_0x312acc[_0x1926('0x55')]=_['intersection'](_0x312acc['model'],_0x312acc[_0x1926('0x54')]);_0x47c2cb['attributes']=_[_0x1926('0x56')](_0x312acc[_0x1926('0x57')],qs[_0x1926('0x59')](_0x29b76d[_0x1926('0x54')]['fields']));_0x47c2cb[_0x1926('0x58')]=_0x47c2cb[_0x1926('0x58')][_0x1926('0x65')]?_0x47c2cb[_0x1926('0x58')]:_0x312acc[_0x1926('0x57')];if(!_0x29b76d[_0x1926('0x54')][_0x1926('0x5a')]('nolimit')){_0x47c2cb[_0x1926('0x37')]=qs[_0x1926('0x37')](_0x29b76d[_0x1926('0x54')]['limit']);_0x47c2cb['offset']=qs[_0x1926('0x36')](_0x29b76d[_0x1926('0x54')][_0x1926('0x36')]);}_0x47c2cb[_0x1926('0xbb')]=qs[_0x1926('0x5b')](_0x29b76d['query'][_0x1926('0x5b')]);_0x47c2cb[_0x1926('0x5c')]=qs[_0x1926('0x55')](_[_0x1926('0xbc')](_0x29b76d[_0x1926('0x54')],_0x312acc[_0x1926('0x55')]));_0x47c2cb[_0x1926('0x5c')][_0x1926('0xcc')]=_0x126ada['id'];if(_0x29b76d[_0x1926('0x54')][_0x1926('0x41')]){_0x47c2cb[_0x1926('0x5c')]=_[_0x1926('0xbd')](_0x47c2cb[_0x1926('0x5c')],{'$or':_[_0x1926('0x43')](_0x47c2cb[_0x1926('0x58')],function(_0x2dc3d2){var _0xfeb7d2={};_0xfeb7d2[_0x2dc3d2]={'$like':'%'+_0x29b76d['query']['filter']+'%'};return _0xfeb7d2;})});}_0x47c2cb=_[_0x1926('0xbd')]({},_0x47c2cb,_0x29b76d['options']);return db[_0x1926('0xcb')]['count']({'where':_0x47c2cb['where']})[_0x1926('0x28')](function(_0x297fa3){_0x2090e6[_0x1926('0x35')]=_0x297fa3;if(_0x29b76d[_0x1926('0x54')][_0x1926('0x61')]){_0x47c2cb[_0x1926('0x62')]=[{'all':!![]}];}return db['VoiceRecording'][_0x1926('0xc5')](_0x47c2cb);})[_0x1926('0x28')](function(_0x49b648){_0x2090e6['rows']=_0x49b648;return _0x2090e6;});}})['then'](respondWithFilteredResult(_0x141f70,_0x47c2cb))[_0x1926('0x64')](handleError(_0x141f70,null));};exports[_0x1926('0xcd')]=function(_0x21a702,_0x569b3c,_0x5565fc){var _0x49091d={'raw':!![],'where':{}};var _0x311037={};var _0x428578={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x21a702[_0x1926('0x69')]['id']}})['then'](handleEntityNotFound(_0x569b3c,null))['then'](function(_0x44f854){if(_0x44f854){_0x311037[_0x1926('0x57')]=_[_0x1926('0x53')](db['ScreenRecording'][_0x1926('0x4d')]);_0x311037[_0x1926('0x54')]=_[_0x1926('0x53')](_0x21a702['query']);_0x311037[_0x1926('0x55')]=_[_0x1926('0x56')](_0x311037[_0x1926('0x57')],_0x311037[_0x1926('0x54')]);_0x49091d[_0x1926('0x58')]=_[_0x1926('0x56')](_0x311037[_0x1926('0x57')],qs[_0x1926('0x59')](_0x21a702[_0x1926('0x54')]['fields']));_0x49091d['attributes']=_0x49091d[_0x1926('0x58')][_0x1926('0x65')]?_0x49091d['attributes']:_0x311037[_0x1926('0x57')];if(!_0x21a702[_0x1926('0x54')][_0x1926('0x5a')](_0x1926('0xc2'))){_0x49091d[_0x1926('0x37')]=qs[_0x1926('0x37')](_0x21a702['query']['limit']);_0x49091d[_0x1926('0x36')]=qs[_0x1926('0x36')](_0x21a702[_0x1926('0x54')][_0x1926('0x36')]);}_0x49091d[_0x1926('0xbb')]=qs[_0x1926('0x5b')](_0x21a702[_0x1926('0x54')]['sort']);_0x49091d[_0x1926('0x5c')]=qs[_0x1926('0x55')](_[_0x1926('0xbc')](_0x21a702['query'],_0x311037[_0x1926('0x55')]));_0x49091d[_0x1926('0x5c')][_0x1926('0xcc')]=_0x44f854['id'];if(_0x21a702[_0x1926('0x54')]['filter']){_0x49091d[_0x1926('0x5c')]=_['merge'](_0x49091d['where'],{'$or':_[_0x1926('0x43')](_0x49091d[_0x1926('0x58')],function(_0x562a73){var _0x3e12ac={};_0x3e12ac[_0x562a73]={'$like':'%'+_0x21a702[_0x1926('0x54')][_0x1926('0x41')]+'%'};return _0x3e12ac;})});}_0x49091d=_[_0x1926('0xbd')]({},_0x49091d,_0x21a702['options']);return db['ScreenRecording'][_0x1926('0x35')]({'where':_0x49091d['where']})[_0x1926('0x28')](function(_0x1d54cf){_0x428578[_0x1926('0x35')]=_0x1d54cf;if(_0x21a702[_0x1926('0x54')]['includeAll']){_0x49091d[_0x1926('0x62')]=[{'all':!![]}];}return db[_0x1926('0xce')]['findAll'](_0x49091d);})[_0x1926('0x28')](function(_0x4122c1){_0x428578[_0x1926('0x63')]=_0x4122c1;return _0x428578;});}})[_0x1926('0x28')](respondWithFilteredResult(_0x569b3c,_0x49091d))[_0x1926('0x64')](handleError(_0x569b3c,null));};exports[_0x1926('0xcf')]=function(_0xacb2ed,_0xf3c23f,_0x1f5df3){var _0x2c40f6={};var _0x18034c={};var _0x5eb05c;var _0x4f70c;return db[_0x1926('0x4c')][_0x1926('0xb9')]({'where':{'id':_0xacb2ed[_0x1926('0x69')]['id']}})['then'](handleEntityNotFound(_0xf3c23f,null))[_0x1926('0x28')](function(_0x117aac){if(_0x117aac){_0x5eb05c=_0x117aac;_0x18034c[_0x1926('0x57')]=_[_0x1926('0x53')](db[_0x1926('0xd0')][_0x1926('0x4d')]);_0x18034c['query']=_[_0x1926('0x53')](_0xacb2ed[_0x1926('0x54')]);_0x18034c[_0x1926('0x55')]=_['intersection'](_0x18034c[_0x1926('0x57')],_0x18034c[_0x1926('0x54')]);_0x2c40f6[_0x1926('0x58')]=_[_0x1926('0x56')](_0x18034c['model'],qs[_0x1926('0x59')](_0xacb2ed[_0x1926('0x54')]['fields']));_0x2c40f6[_0x1926('0x58')]=_0x2c40f6['attributes'][_0x1926('0x65')]?_0x2c40f6[_0x1926('0x58')]:_0x18034c[_0x1926('0x57')];_0x2c40f6[_0x1926('0xbb')]=qs[_0x1926('0x5b')](_0xacb2ed[_0x1926('0x54')][_0x1926('0x5b')]);_0x2c40f6[_0x1926('0x5c')]=qs['filters'](_['pick'](_0xacb2ed[_0x1926('0x54')],_0x18034c[_0x1926('0x55')]));if(_0xacb2ed[_0x1926('0x54')]['filter']){_0x2c40f6['where']=_['merge'](_0x2c40f6[_0x1926('0x5c')],{'$or':_[_0x1926('0x43')](_0x2c40f6['attributes'],function(_0x2b541b){var _0x310de6={};_0x310de6[_0x2b541b]={'$like':'%'+_0xacb2ed['query']['filter']+'%'};return _0x310de6;})});}_0x2c40f6=_[_0x1926('0xbd')]({},_0x2c40f6,_0xacb2ed[_0x1926('0x60')]);return _0x5eb05c['getChatInteractions'](_0x2c40f6);}})[_0x1926('0x28')](function(_0x449394){if(_0x449394){_0x4f70c=_0x449394[_0x1926('0x65')];if(!_0xacb2ed[_0x1926('0x54')][_0x1926('0x5a')](_0x1926('0xc2'))){_0x2c40f6[_0x1926('0x37')]=qs[_0x1926('0x37')](_0xacb2ed['query'][_0x1926('0x37')]);_0x2c40f6[_0x1926('0x36')]=qs[_0x1926('0x36')](_0xacb2ed['query']['offset']);}return _0x5eb05c['getChatInteractions'](_0x2c40f6);}})[_0x1926('0x28')](function(_0x2de3c4){if(_0x2de3c4){return _0x2de3c4?{'count':_0x4f70c,'rows':_0x2de3c4}:null;}})[_0x1926('0x28')](respondWithResult(_0xf3c23f,null))[_0x1926('0x64')](handleError(_0xf3c23f,null));};exports[_0x1926('0xd1')]=function(_0x32aa70,_0x3b7d41,_0x34fab2){var _0x3e522b={};var _0x13480c={};var _0x382ea1;var _0x5af0d5;return db[_0x1926('0x4c')][_0x1926('0xb9')]({'where':{'id':_0x32aa70[_0x1926('0x69')]['id']}})[_0x1926('0x28')](handleEntityNotFound(_0x3b7d41,null))['then'](function(_0x35b4b6){if(_0x35b4b6){_0x382ea1=_0x35b4b6;_0x13480c['model']=_[_0x1926('0x53')](db[_0x1926('0xd2')][_0x1926('0x4d')]);_0x13480c[_0x1926('0x54')]=_[_0x1926('0x53')](_0x32aa70['query']);_0x13480c['filters']=_[_0x1926('0x56')](_0x13480c[_0x1926('0x57')],_0x13480c[_0x1926('0x54')]);_0x3e522b[_0x1926('0x58')]=_[_0x1926('0x56')](_0x13480c[_0x1926('0x57')],qs[_0x1926('0x59')](_0x32aa70[_0x1926('0x54')]['fields']));_0x3e522b['attributes']=_0x3e522b[_0x1926('0x58')][_0x1926('0x65')]?_0x3e522b[_0x1926('0x58')]:_0x13480c['model'];_0x3e522b[_0x1926('0xbb')]=qs[_0x1926('0x5b')](_0x32aa70[_0x1926('0x54')][_0x1926('0x5b')]);_0x3e522b['where']=qs[_0x1926('0x55')](_[_0x1926('0xbc')](_0x32aa70[_0x1926('0x54')],_0x13480c[_0x1926('0x55')]));if(_0x32aa70[_0x1926('0x54')]['filter']){_0x3e522b[_0x1926('0x5c')]=_[_0x1926('0xbd')](_0x3e522b[_0x1926('0x5c')],{'$or':_['map'](_0x3e522b[_0x1926('0x58')],function(_0x52062a){var _0x1de1ce={};_0x1de1ce[_0x52062a]={'$like':'%'+_0x32aa70['query']['filter']+'%'};return _0x1de1ce;})});}_0x3e522b=_[_0x1926('0xbd')]({},_0x3e522b,_0x32aa70[_0x1926('0x60')]);return _0x382ea1[_0x1926('0xd1')](_0x3e522b);}})[_0x1926('0x28')](function(_0xecd41a){if(_0xecd41a){_0x5af0d5=_0xecd41a['length'];if(!_0x32aa70[_0x1926('0x54')]['hasOwnProperty'](_0x1926('0xc2'))){_0x3e522b[_0x1926('0x37')]=qs[_0x1926('0x37')](_0x32aa70[_0x1926('0x54')][_0x1926('0x37')]);_0x3e522b[_0x1926('0x36')]=qs[_0x1926('0x36')](_0x32aa70[_0x1926('0x54')][_0x1926('0x36')]);}return _0x382ea1[_0x1926('0xd1')](_0x3e522b);}})[_0x1926('0x28')](function(_0x3fd5f6){if(_0x3fd5f6){return _0x3fd5f6?{'count':_0x5af0d5,'rows':_0x3fd5f6}:null;}})[_0x1926('0x28')](respondWithResult(_0x3b7d41,null))['catch'](handleError(_0x3b7d41,null));};exports[_0x1926('0xd3')]=function(_0x3fb0cc,_0x4279ce,_0x2ea9cb){var _0xcfccb6={'raw':!![],'where':{}};var _0x548e8c={};var _0x1458df={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x3fb0cc[_0x1926('0x69')]['id']}})[_0x1926('0x28')](handleEntityNotFound(_0x4279ce,null))[_0x1926('0x28')](function(_0xbce591){if(_0xbce591){_0x548e8c[_0x1926('0x57')]=_[_0x1926('0x53')](db[_0x1926('0xd4')][_0x1926('0x4d')]);_0x548e8c['query']=_['keys'](_0x3fb0cc[_0x1926('0x54')]);_0x548e8c[_0x1926('0x55')]=_[_0x1926('0x56')](_0x548e8c['model'],_0x548e8c[_0x1926('0x54')]);_0xcfccb6[_0x1926('0x58')]=_[_0x1926('0x56')](_0x548e8c[_0x1926('0x57')],qs['fields'](_0x3fb0cc[_0x1926('0x54')]['fields']));_0xcfccb6['attributes']=_0xcfccb6[_0x1926('0x58')][_0x1926('0x65')]?_0xcfccb6['attributes']:_0x548e8c[_0x1926('0x57')];if(!_0x3fb0cc['query'][_0x1926('0x5a')](_0x1926('0xc2'))){_0xcfccb6[_0x1926('0x37')]=qs[_0x1926('0x37')](_0x3fb0cc[_0x1926('0x54')][_0x1926('0x37')]);_0xcfccb6['offset']=qs[_0x1926('0x36')](_0x3fb0cc['query'][_0x1926('0x36')]);}_0xcfccb6[_0x1926('0xbb')]=qs[_0x1926('0x5b')](_0x3fb0cc[_0x1926('0x54')][_0x1926('0x5b')]);_0xcfccb6[_0x1926('0x5c')]=qs[_0x1926('0x55')](_[_0x1926('0xbc')](_0x3fb0cc['query'],_0x548e8c[_0x1926('0x55')]));_0xcfccb6[_0x1926('0x5c')]['UserId']=_0xbce591['id'];if(_0x3fb0cc[_0x1926('0x54')][_0x1926('0x41')]){_0xcfccb6[_0x1926('0x5c')]=_[_0x1926('0xbd')](_0xcfccb6[_0x1926('0x5c')],{'$or':_[_0x1926('0x43')](_0xcfccb6[_0x1926('0x58')],function(_0x2aa62a){var _0x33ed29={};_0x33ed29[_0x2aa62a]={'$like':'%'+_0x3fb0cc[_0x1926('0x54')]['filter']+'%'};return _0x33ed29;})});}_0xcfccb6=_[_0x1926('0xbd')]({},_0xcfccb6,_0x3fb0cc[_0x1926('0x60')]);return db[_0x1926('0xd4')][_0x1926('0x35')]({'where':_0xcfccb6['where']})[_0x1926('0x28')](function(_0x22baf8){_0x1458df[_0x1926('0x35')]=_0x22baf8;if(_0x3fb0cc[_0x1926('0x54')][_0x1926('0x61')]){_0xcfccb6['include']=[{'all':!![]}];}return db[_0x1926('0xd4')][_0x1926('0xc5')](_0xcfccb6);})[_0x1926('0x28')](function(_0x1dbbf1){_0x1458df[_0x1926('0x63')]=_0x1dbbf1;return _0x1458df;});}})['then'](respondWithFilteredResult(_0x4279ce,_0xcfccb6))[_0x1926('0x64')](handleError(_0x4279ce,null));};exports[_0x1926('0xd5')]=function(_0x38800e,_0x36429f,_0x111027){var _0x5360f0={};var _0x207d81={};var _0x43642e;var _0x1c2c41;return db[_0x1926('0x4c')]['findOne']({'where':{'id':_0x38800e[_0x1926('0x69')]['id']}})[_0x1926('0x28')](handleEntityNotFound(_0x36429f,null))['then'](function(_0x8b19fb){if(_0x8b19fb){_0x43642e=_0x8b19fb;_0x207d81[_0x1926('0x57')]=_[_0x1926('0x53')](db[_0x1926('0xd6')][_0x1926('0x4d')]);_0x207d81[_0x1926('0x54')]=_[_0x1926('0x53')](_0x38800e[_0x1926('0x54')]);_0x207d81[_0x1926('0x55')]=_['intersection'](_0x207d81[_0x1926('0x57')],_0x207d81[_0x1926('0x54')]);_0x5360f0[_0x1926('0x58')]=_[_0x1926('0x56')](_0x207d81[_0x1926('0x57')],qs[_0x1926('0x59')](_0x38800e[_0x1926('0x54')][_0x1926('0x59')]));_0x5360f0['attributes']=_0x5360f0[_0x1926('0x58')][_0x1926('0x65')]?_0x5360f0['attributes']:_0x207d81['model'];_0x5360f0[_0x1926('0xbb')]=qs[_0x1926('0x5b')](_0x38800e['query'][_0x1926('0x5b')]);_0x5360f0['where']=qs[_0x1926('0x55')](_['pick'](_0x38800e[_0x1926('0x54')],_0x207d81[_0x1926('0x55')]));if(_0x38800e[_0x1926('0x54')][_0x1926('0x41')]){_0x5360f0[_0x1926('0x5c')]=_[_0x1926('0xbd')](_0x5360f0[_0x1926('0x5c')],{'$or':_[_0x1926('0x43')](_0x5360f0[_0x1926('0x58')],function(_0x4ea8cb){var _0x2d15ff={};_0x2d15ff[_0x4ea8cb]={'$like':'%'+_0x38800e['query'][_0x1926('0x41')]+'%'};return _0x2d15ff;})});}_0x5360f0=_['merge']({},_0x5360f0,_0x38800e['options']);return _0x43642e[_0x1926('0xd5')](_0x5360f0);}})[_0x1926('0x28')](function(_0x255e43){if(_0x255e43){_0x1c2c41=_0x255e43['length'];if(!_0x38800e[_0x1926('0x54')][_0x1926('0x5a')](_0x1926('0xc2'))){_0x5360f0['limit']=qs['limit'](_0x38800e['query'][_0x1926('0x37')]);_0x5360f0['offset']=qs[_0x1926('0x36')](_0x38800e['query']['offset']);}return _0x43642e[_0x1926('0xd5')](_0x5360f0);}})['then'](function(_0x359e25){if(_0x359e25){return _0x359e25?{'count':_0x1c2c41,'rows':_0x359e25}:null;}})[_0x1926('0x28')](respondWithResult(_0x36429f,null))[_0x1926('0x64')](handleError(_0x36429f,null));};exports[_0x1926('0xd7')]=function(_0x4532be,_0x594105,_0x27db69){var _0x626051={};var _0x48d641={};var _0x27cabc;var _0x33efb5;return db[_0x1926('0x4c')]['findOne']({'where':{'id':_0x4532be[_0x1926('0x69')]['id']}})['then'](handleEntityNotFound(_0x594105,null))['then'](function(_0x5d50bf){if(_0x5d50bf){_0x27cabc=_0x5d50bf;_0x48d641['model']=_[_0x1926('0x53')](db[_0x1926('0xd8')][_0x1926('0x4d')]);_0x48d641[_0x1926('0x54')]=_['keys'](_0x4532be['query']);_0x48d641[_0x1926('0x55')]=_['intersection'](_0x48d641[_0x1926('0x57')],_0x48d641[_0x1926('0x54')]);_0x626051['attributes']=_['intersection'](_0x48d641[_0x1926('0x57')],qs[_0x1926('0x59')](_0x4532be[_0x1926('0x54')]['fields']));_0x626051[_0x1926('0x58')]=_0x626051[_0x1926('0x58')]['length']?_0x626051[_0x1926('0x58')]:_0x48d641[_0x1926('0x57')];_0x626051['order']=qs[_0x1926('0x5b')](_0x4532be[_0x1926('0x54')][_0x1926('0x5b')]);_0x626051['where']=qs[_0x1926('0x55')](_['pick'](_0x4532be[_0x1926('0x54')],_0x48d641[_0x1926('0x55')]));if(_0x4532be[_0x1926('0x54')][_0x1926('0x41')]){_0x626051['where']=_['merge'](_0x626051[_0x1926('0x5c')],{'$or':_['map'](_0x626051[_0x1926('0x58')],function(_0x5487a0){var _0x333fa6={};_0x333fa6[_0x5487a0]={'$like':'%'+_0x4532be[_0x1926('0x54')][_0x1926('0x41')]+'%'};return _0x333fa6;})});}_0x626051=_[_0x1926('0xbd')]({},_0x626051,_0x4532be['options']);return _0x27cabc[_0x1926('0xd7')](_0x626051);}})[_0x1926('0x28')](function(_0x5b5264){if(_0x5b5264){_0x33efb5=_0x5b5264[_0x1926('0x65')];if(!_0x4532be[_0x1926('0x54')][_0x1926('0x5a')](_0x1926('0xc2'))){_0x626051[_0x1926('0x37')]=qs['limit'](_0x4532be[_0x1926('0x54')][_0x1926('0x37')]);_0x626051[_0x1926('0x36')]=qs[_0x1926('0x36')](_0x4532be[_0x1926('0x54')][_0x1926('0x36')]);}return _0x27cabc[_0x1926('0xd7')](_0x626051);}})['then'](function(_0x48d0f6){if(_0x48d0f6){return _0x48d0f6?{'count':_0x33efb5,'rows':_0x48d0f6}:null;}})[_0x1926('0x28')](respondWithResult(_0x594105,null))['catch'](handleError(_0x594105,null));};exports[_0x1926('0xd9')]=function(_0x40771f,_0x50a087,_0x3f734c){var _0x15909f;var _0x140214;var _0x4d1d49;var _0x4fd00c=!_[_0x1926('0x73')](_0x40771f['params']['id'])?_0x40771f[_0x1926('0x69')]['id']:!_['isNil'](_0x40771f['user']['id'])?_0x40771f[_0x1926('0x70')]['id']:null;return db[_0x1926('0x4c')][_0x1926('0x68')]({'where':{'id':_0x4fd00c,'role':{'$or':['admin',_0x1926('0x70'),_0x1926('0x40')]}},'attributes':['id',_0x1926('0x47'),_0x1926('0xda'),_0x1926('0xdb'),_0x1926('0x46'),_0x1926('0x7b'),_0x1926('0x9e')]})['then'](function(_0x329ef7){if(_0x329ef7){if(_0x329ef7[_0x1926('0x46')]===_0x1926('0x40')){_0x15909f=_0x329ef7;if(_0x40771f[_0x1926('0x67')]['interface']){_0x4d1d49=util[_0x1926('0x75')](_0x1926('0xdc'),_0x15909f[_0x40771f['body']['interface']]);}else if(_0x40771f[_0x1926('0x67')][_0x1926('0xdd')]){_0x4d1d49=util[_0x1926('0x75')](_0x1926('0xde'),_0x40771f[_0x1926('0x67')][_0x1926('0xdd')]);}else{_0x4d1d49=util[_0x1926('0x75')](_0x1926('0xde'),_0x15909f[_0x1926('0x47')]);}socket['to'](util[_0x1926('0x75')]('user:%s',_0x15909f[_0x1926('0x47')]))[_0x1926('0xa6')](_0x1926('0xdf'),{'ip':_0x40771f[_0x1926('0xe0')][_0x1926('0xe1')]||_0x40771f['connection'][_0x1926('0xe2')]||_0x40771f['socket'][_0x1926('0xe2')]||_0x40771f['connection']['socket'][_0x1926('0xe2')]});return db[_0x1926('0xac')][_0x1926('0x49')]({'where':{'membername':_0x15909f[_0x1926('0x47')]},'individualHooks':!![]});}}else{throw new db[(_0x1926('0x95'))][(_0x1926('0x25'))](_0x1926('0xe3'));}})[_0x1926('0x28')](function(){if(_0x15909f){return _0x15909f[_0x1926('0xe4')]({'raw':!![]});}})[_0x1926('0x28')](function(_0x161426){if(_0x15909f){var _0x860215=[];if(_0x161426){_0x140214=_0x161426;if(_0x140214['length']){for(var _0x2b270c=0x0;_0x2b270c<_0x140214['length'];_0x2b270c++){_0x860215[_0x1926('0xe5')]({'membername':_0x15909f['name'],'UserId':_0x15909f['id'],'queue_name':_0x140214[_0x2b270c][_0x1926('0x47')],'VoiceQueueId':_0x140214[_0x2b270c]['id'],'interface':_0x4d1d49,'paused':_0x15909f['loginInPause']||![],'penalty':_0x140214[_0x2b270c][_0x1926('0xe6')]||0x0});}return BPromise[_0x1926('0xab')](_0x860215,function(_0x35048c){return db[_0x1926('0xac')]['upsert'](_0x35048c);});}}}})[_0x1926('0x28')](function(){if(_0x15909f){return db[_0x1926('0xe7')]['findAll']({'where':{'membername':_0x15909f['name'],'exitAt':null}});}})[_0x1926('0x28')](function(_0x1a9b8f){if(_0x15909f){var _0x39a9f5=[];_0x1a9b8f[_0x1926('0xe8')](function(_0x71909f){_0x39a9f5[_0x1926('0xe5')](_0x71909f[_0x1926('0x3c')]({'exitAt':moment()['format'](_0x1926('0xe9'))}));});return BPromise[_0x1926('0xea')](_0x39a9f5);}})[_0x1926('0x28')](function(){if(_0x15909f){var _0x288983=[];var _0xb8991b=[];var _0x573218=utils['getChannels']();var _0x55d351={'membername':_0x15909f['name'],'interface':_0x4d1d49,'enterAt':moment()[_0x1926('0x75')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x15909f[_0x1926('0x46')],'internal':_0x15909f[_0x1926('0x7b')]};_0x573218[_0x1926('0xe8')](function(_0x50bb3e){_0x288983[_0x1926('0xe5')](_[_0x1926('0xbd')]({'channel':_0x50bb3e,'type':_0x1926('0xeb'),'data1':_0x40771f[_0x1926('0x67')][_0x1926('0xec')],'data2':_0x4d1d49},_0x55d351));if(_0x15909f[_0x1926('0x9e')]){_0xb8991b[_0x1926('0xe5')](_['merge']({'channel':_0x50bb3e,'type':_0x1926('0xed'),'data1':_0x1926('0xee')},_0x55d351));}});return db[_0x1926('0xe7')][_0x1926('0x66')](_0x288983['concat'](_0xb8991b),{'individualHooks':!![]});}})[_0x1926('0x28')](function(){if(_0x15909f){return _0x15909f['update']({'online':!![],'lastLoginAt':moment()[_0x1926('0x75')](_0x1926('0xe9')),'voicePause':_0x15909f['loginInPause']||![],'mailPause':_0x15909f[_0x1926('0x9e')]||![],'chatPause':_0x15909f[_0x1926('0x9e')]||![],'faxPause':_0x15909f[_0x1926('0x9e')]||![],'smsPause':_0x15909f[_0x1926('0x9e')]||![],'openchannelPause':_0x15909f['loginInPause']||![],'pauseType':_0x15909f[_0x1926('0x9e')]?'LOGININPAUSE':null,'interface':_0x4d1d49,'lastPauseAt':moment()[_0x1926('0x75')](_0x1926('0xe9'))});}})[_0x1926('0x28')](function(_0x3090c5){if(_0x40771f[_0x1926('0xef')]){return _0x3f734c();}else{return BPromise['resolve'](_0x3090c5)[_0x1926('0x28')](respondWithResult(_0x50a087,null));}})['catch'](handleError(_0x50a087,null));};exports[_0x1926('0xf0')]=function(_0xeb22ec,_0x2fbf28,_0x2c3ea3){var _0x19ee0f;return db[_0x1926('0x4c')][_0x1926('0x68')]({'where':{'id':_0xeb22ec['params']['id'],'role':'agent'},'attributes':['id',_0x1926('0x47'),'role']})[_0x1926('0x28')](handleEntityNotFound(_0x2fbf28,null))[_0x1926('0x28')](function(_0x19b6ce){if(_0x19b6ce){_0x19ee0f=_0x19b6ce;return db[_0x1926('0xac')]['destroy']({'where':{'membername':_0x19ee0f['name']},'individualHooks':!![]});}})[_0x1926('0x28')](function(){return db[_0x1926('0xe7')][_0x1926('0xc5')]({'where':{'membername':_0x19ee0f[_0x1926('0x47')],'exitAt':null}});})['then'](function(_0x581561){var _0xcd761f=[];_0x581561['forEach'](function(_0x46e567){_0xcd761f[_0x1926('0xe5')](_0x46e567[_0x1926('0x3c')]({'exitAt':moment()[_0x1926('0x75')](_0x1926('0xe9'))}));});return BPromise[_0x1926('0xea')](_0xcd761f);})[_0x1926('0x28')](function(){return _0x19ee0f[_0x1926('0x3c')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'interface':null});})['then'](respondWithResult(_0x2fbf28,null))['catch'](handleError(_0x2fbf28,null));};exports[_0x1926('0xf1')]=function(_0x1bd15f,_0x1445ca,_0x328c09){var _0x4f5186;return db[_0x1926('0xac')]['update']({'paused':0x1},{'where':{'UserId':_0x1bd15f['params']['id']},'individualHooks':!![]})['then'](function(){return db[_0x1926('0x4c')]['find']({'where':{'id':_0x1bd15f[_0x1926('0x69')]['id'],'role':_0x1926('0x40')},'attributes':['id',_0x1926('0x47'),_0x1926('0x46'),_0x1926('0x7b'),'interface']});})[_0x1926('0x28')](handleEntityNotFound(_0x1445ca,null))['then'](function(_0x4ca9dd){if(_0x4ca9dd){_0x4f5186=_0x4ca9dd;return respondWithRpcPromise(_0x1926('0xf2'),'pause',{'id':_0x4f5186['id'],'name':_0x4f5186['name'],'pause':!![]});}})[_0x1926('0x28')](function(){if(_0x4f5186){return db[_0x1926('0xe7')][_0x1926('0xc5')]({'where':{'membername':_0x4f5186[_0x1926('0x47')],'type':_0x1926('0xed'),'exitAt':null}});}})['then'](function(_0x5daff1){if(_0x5daff1[_0x1926('0x65')]){var _0x1405a5=moment()[_0x1926('0x75')](_0x1926('0xe9'));for(var _0x53bd48=0x0,_0x40b6d5=_0x5daff1['length'];_0x53bd48<_0x40b6d5;_0x53bd48++){_0x5daff1[_0x53bd48]['updateAttributes']({'exitAt':_0x1405a5});}}})[_0x1926('0x28')](function(){var _0xee0a85=[];var _0x2f507b=utils[_0x1926('0xf3')]();_0x2f507b[_0x1926('0xe8')](function(_0x5b898c){_0xee0a85[_0x1926('0xe5')]({'channel':_0x5b898c,'membername':_0x4f5186['name'],'interface':_['isNil'](_0x4f5186[_0x1926('0x9f')])?util[_0x1926('0x75')](_0x1926('0xde'),_0x4f5186[_0x1926('0x47')]):_0x4f5186[_0x1926('0x9f')],'type':'PAUSE','enterAt':moment()[_0x1926('0x75')](_0x1926('0xe9')),'data1':_0x1bd15f[_0x1926('0x67')][_0x1926('0xf4')]||_0x1926('0xf5'),'role':_0x4f5186['role'],'internal':_0x4f5186['internal']});});return db['MemberReport']['bulkCreate'](_0xee0a85,{'individualHooks':!![]});})[_0x1926('0x28')](function(){return _0x4f5186[_0x1926('0x3c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x1bd15f['body']['type']||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x1926('0x75')](_0x1926('0xe9'))});})[_0x1926('0x28')](respondWithResult(_0x1445ca,null))[_0x1926('0x64')](handleError(_0x1445ca,null));};exports[_0x1926('0xf6')]=function(_0x267ff4,_0x27a5df,_0x29afd9){var _0x33dc9a;return db[_0x1926('0x4c')][_0x1926('0x68')]({'where':{'id':_0x267ff4[_0x1926('0x69')]['id']},'attributes':['id',_0x1926('0x47'),_0x1926('0x46'),_0x1926('0xaa'),_0x1926('0xf7'),_0x1926('0xf8'),_0x1926('0xf9'),'openchannelPause',_0x1926('0xfa'),_0x1926('0xfb'),_0x1926('0xfc')]})[_0x1926('0x28')](handleEntityNotFound(_0x27a5df,null))[_0x1926('0x28')](function(_0x54f8d6){if(_0x54f8d6){_0x33dc9a=_0x54f8d6;if(_0x267ff4[_0x1926('0x67')][_0x1926('0x9c')]&&!utils[_0x1926('0xa0')](_0x267ff4[_0x1926('0x67')][_0x1926('0x9c')])){throw new db[(_0x1926('0x95'))][(_0x1926('0x25'))](_0x1926('0xa1'));}switch(_0x267ff4['body'][_0x1926('0x9c')]){case _0x1926('0xa8'):return respondWithRpcPromise('QueuePause',_0x1926('0xf6'),{'id':_0x33dc9a['id'],'name':_0x33dc9a[_0x1926('0x47')],'pause':![]})[_0x1926('0x28')](function(){return db['UserVoiceQueueRt'][_0x1926('0x3c')]({'paused':0x0},{'where':{'UserId':_0x33dc9a['id']},'individualHooks':!![]});})[_0x1926('0x28')](function(){return db['MemberReport']['find']({'where':{'channel':_0x267ff4[_0x1926('0x67')][_0x1926('0x9c')],'membername':_0x33dc9a[_0x1926('0x47')],'type':_0x1926('0xed'),'exitAt':null}});})[_0x1926('0x28')](function(_0x43d6e3){if(_0x43d6e3){return _0x43d6e3[_0x1926('0x3c')]({'exitAt':moment()[_0x1926('0x75')](_0x1926('0xe9')),'data2':_0x1926('0xfd')},{'individualHooks':!![]});}return null;})[_0x1926('0x28')](function(){return _0x33dc9a[_0x1926('0x3c')]({'voicePause':![]});});case _0x1926('0xfe'):case'chat':case _0x1926('0xff'):case _0x1926('0x100'):case _0x1926('0x101'):return db[_0x1926('0xe7')]['find']({'where':{'channel':_0x267ff4[_0x1926('0x67')][_0x1926('0x9c')],'membername':_0x33dc9a[_0x1926('0x47')],'type':_0x1926('0xed'),'exitAt':null}})[_0x1926('0x28')](function(_0xe59f21){if(_0xe59f21){return _0xe59f21['update']({'exitAt':moment()[_0x1926('0x75')](_0x1926('0xe9')),'data2':_0x1926('0xfd')},{'individualHooks':!![]});}return null;})[_0x1926('0x28')](function(){var _0x202b9a={};_[_0x1926('0x38')](_0x202b9a,util['format'](_0x1926('0x102'),_0x267ff4[_0x1926('0x67')][_0x1926('0x9c')],_0x1926('0x103')),![]);return _0x33dc9a[_0x1926('0x3c')](_0x202b9a);});default:return respondWithRpcPromise(_0x1926('0xf2'),'unpause',{'id':_0x33dc9a['id'],'name':_0x33dc9a[_0x1926('0x47')],'pause':![]})[_0x1926('0x28')](function(){return db['UserVoiceQueueRt'][_0x1926('0x3c')]({'paused':0x0},{'where':{'UserId':_0x33dc9a['id']}});})[_0x1926('0x28')](function(){return db['MemberReport'][_0x1926('0xc5')]({'where':{'membername':_0x33dc9a[_0x1926('0x47')],'type':_0x1926('0xed'),'exitAt':null}});})[_0x1926('0x28')](function(_0x2f74e4){var _0x4e568d=[];_0x2f74e4[_0x1926('0xe8')](function(_0x4ae4c9){_0x4e568d['push'](_0x4ae4c9[_0x1926('0x3c')]({'exitAt':moment()[_0x1926('0x75')](_0x1926('0xe9')),'data2':'manual'}));});return BPromise[_0x1926('0xea')](_0x4e568d);})['then'](function(){return _0x33dc9a[_0x1926('0x3c')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0x1926('0x28')](respondWithResult(_0x27a5df,null))[_0x1926('0x64')](handleError(_0x27a5df,null));};exports[_0x1926('0x104')]=function(_0x239a1e,_0x3426d3,_0x2e727e){var _0x16667f={};var _0x3d3b8c={};var _0x3caad7;var _0x2b19cc;return db['User'][_0x1926('0xb9')]({'where':{'id':_0x239a1e['params']['id']}})[_0x1926('0x28')](handleEntityNotFound(_0x3426d3,null))[_0x1926('0x28')](function(_0x23b3bc){if(_0x23b3bc){_0x3caad7=_0x23b3bc;_0x3d3b8c[_0x1926('0x57')]=_[_0x1926('0x53')](db['Team'][_0x1926('0x4d')]);_0x3d3b8c['query']=_[_0x1926('0x53')](_0x239a1e[_0x1926('0x54')]);_0x3d3b8c['filters']=_[_0x1926('0x56')](_0x3d3b8c[_0x1926('0x57')],_0x3d3b8c[_0x1926('0x54')]);_0x16667f['attributes']=_[_0x1926('0x56')](_0x3d3b8c[_0x1926('0x57')],qs['fields'](_0x239a1e[_0x1926('0x54')][_0x1926('0x59')]));_0x16667f[_0x1926('0x58')]=_0x16667f['attributes'][_0x1926('0x65')]?_0x16667f[_0x1926('0x58')]:_0x3d3b8c['model'];_0x16667f[_0x1926('0xbb')]=qs[_0x1926('0x5b')](_0x239a1e['query'][_0x1926('0x5b')]);_0x16667f[_0x1926('0x5c')]=qs['filters'](_[_0x1926('0xbc')](_0x239a1e[_0x1926('0x54')],_0x3d3b8c[_0x1926('0x55')]));if(_0x239a1e[_0x1926('0x54')][_0x1926('0x41')]){_0x16667f[_0x1926('0x5c')]=_[_0x1926('0xbd')](_0x16667f[_0x1926('0x5c')],{'$or':_[_0x1926('0x43')](_0x16667f['attributes'],function(_0x298eeb){var _0x354211={};_0x354211[_0x298eeb]={'$like':'%'+_0x239a1e['query'][_0x1926('0x41')]+'%'};return _0x354211;})});}_0x16667f=_['merge']({},_0x16667f,_0x239a1e[_0x1926('0x60')]);return _0x3caad7[_0x1926('0x104')](_0x16667f);}})['then'](function(_0x1f7ce5){if(_0x1f7ce5){_0x2b19cc=_0x1f7ce5[_0x1926('0x65')];if(!_0x239a1e[_0x1926('0x54')][_0x1926('0x5a')]('nolimit')){_0x16667f[_0x1926('0x37')]=qs[_0x1926('0x37')](_0x239a1e[_0x1926('0x54')][_0x1926('0x37')]);_0x16667f[_0x1926('0x36')]=qs[_0x1926('0x36')](_0x239a1e['query'][_0x1926('0x36')]);}return _0x3caad7[_0x1926('0x104')](_0x16667f);}})[_0x1926('0x28')](function(_0x5d770a){if(_0x5d770a){return _0x5d770a?{'count':_0x2b19cc,'rows':_0x5d770a}:null;}})['then'](respondWithResult(_0x3426d3,null))[_0x1926('0x64')](handleError(_0x3426d3,null));};exports[_0x1926('0x105')]=function(_0x14f15f,_0x34a5d0){return db[_0x1926('0x4c')][_0x1926('0x68')]({'where':{'id':_0x14f15f['params']['id']}})[_0x1926('0x28')](handleEntityNotFound(_0x34a5d0,null))[_0x1926('0x28')](function(_0x27c4b5){if(_0x27c4b5){var _0x148830=_0x27c4b5[_0x1926('0x3d')]({'plain':!![]});return _0x27c4b5[_0x1926('0x105')](_0x14f15f[_0x1926('0x67')][_0x1926('0x6c')],_[_0x1926('0x6d')](_0x14f15f[_0x1926('0x67')],['ids','id'])||{})[_0x1926('0x28')](function(){for(var _0x10481d=0x0;_0x10481d<_0x14f15f[_0x1926('0x67')][_0x1926('0x6c')]['length'];_0x10481d++){var _0x1e5224=[];db['Team']['findOne']({'where':{'id':_0x14f15f[_0x1926('0x67')][_0x1926('0x6c')][_0x10481d]}})[_0x1926('0x28')](function(_0x10bd20){_0x1e5224['push'](_0x10bd20[_0x1926('0xe4')]()[_0x1926('0x28')](function(_0x282242){for(var _0x570fcb=0x0;_0x570fcb<_0x282242['length'];_0x570fcb++){_0x282242[_0x570fcb][_0x1926('0x106')](_0x1926('0x9c'),_0x1926('0x107'));}return _0x282242;}));_0x1e5224[_0x1926('0xe5')](_0x10bd20['getChatQueues']()['then'](function(_0x4f849c){for(var _0x17bda1=0x0;_0x17bda1<_0x4f849c[_0x1926('0x65')];_0x17bda1++){_0x4f849c[_0x17bda1][_0x1926('0x106')](_0x1926('0x9c'),_0x1926('0x108'));}return _0x4f849c;}));_0x1e5224[_0x1926('0xe5')](_0x10bd20[_0x1926('0x109')]()[_0x1926('0x28')](function(_0x5d70ff){for(var _0x459e31=0x0;_0x459e31<_0x5d70ff[_0x1926('0x65')];_0x459e31++){_0x5d70ff[_0x459e31]['setDataValue'](_0x1926('0x9c'),_0x1926('0x10a'));}return _0x5d70ff;}));_0x1e5224[_0x1926('0xe5')](_0x10bd20['getSmsQueues']()['then'](function(_0x5ae842){for(var _0x416ce9=0x0;_0x416ce9<_0x5ae842[_0x1926('0x65')];_0x416ce9++){_0x5ae842[_0x416ce9][_0x1926('0x106')](_0x1926('0x9c'),'Sms');}return _0x5ae842;}));_0x1e5224[_0x1926('0xe5')](_0x10bd20[_0x1926('0x10b')]()[_0x1926('0x28')](function(_0x58862f){for(var _0x4b8a14=0x0;_0x4b8a14<_0x58862f[_0x1926('0x65')];_0x4b8a14++){_0x58862f[_0x4b8a14][_0x1926('0x106')]('channel','Fax');}return _0x58862f;}));_0x1e5224['push'](_0x10bd20[_0x1926('0x10c')]()[_0x1926('0x28')](function(_0x9a2bd1){for(var _0x580a53=0x0;_0x580a53<_0x9a2bd1[_0x1926('0x65')];_0x580a53++){_0x9a2bd1[_0x580a53][_0x1926('0x106')](_0x1926('0x9c'),_0x1926('0x10d'));}return _0x9a2bd1;}));return BPromise[_0x1926('0xea')](_0x1e5224);})[_0x1926('0x28')](function(_0x30616f){var _0x23cd35=_[_0x1926('0x10e')](_0x30616f);_0x1e5224=[];return db[_0x1926('0x5d')]['transaction'](function(_0x1cc00e){for(var _0x14d508=0x0;_0x14d508<_0x23cd35[_0x1926('0x65')];_0x14d508++){_0x1e5224['push'](_0x23cd35[_0x14d508][_0x1926('0x10f')](_0x148830['id']),{'transaction':_0x1cc00e});}return BPromise[_0x1926('0xea')](_0x1e5224)[_0x1926('0x28')](function(){if(_0x148830[_0x1926('0x9d')]){return BPromise['each'](_[_0x1926('0x41')](_0x23cd35,function(_0x10bd6a){return _0x10bd6a[_0x1926('0x110')](_0x1926('0x9c'))===_0x1926('0x107');}),function(_0x14d355){return db[_0x1926('0xac')][_0x1926('0x111')]({'membername':_0x148830['name'],'UserId':_0x148830['id'],'queue_name':_0x14d355[_0x1926('0x47')],'VoiceQueueId':_0x14d355['id'],'interface':_[_0x1926('0x73')](_0x148830[_0x1926('0x9f')])?util[_0x1926('0x75')](_0x1926('0xde'),_0x148830[_0x1926('0x47')]):_0x148830['interface'],'paused':_0x148830['voicePause']||![],'penalty':_0x148830[_0x1926('0xa5')]},{'transaction':_0x1cc00e});});}else{return;}})[_0x1926('0x28')](function(){for(var _0x14e4df=0x0;_0x14e4df<_0x23cd35[_0x1926('0x65')];_0x14e4df++){var _0xbc2468=_0x23cd35[_0x14e4df][_0x1926('0x110')]('channel');var _0x3d14d9=_0xbc2468+'QueueId';socket[_0x1926('0xa6')](_0x1926('0x70')+_0xbc2468+_0x1926('0xa7'),{'UserId':_0x148830['id'],['queueField']:_0x23cd35[_0x14e4df]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x34a5d0,null))[_0x1926('0x64')](handleError(_0x34a5d0,null));};exports[_0x1926('0x112')]=function(_0x31fe85,_0x582293){return db[_0x1926('0x4c')]['findOne']({'where':{'id':_0x31fe85['params']['id']}})[_0x1926('0x28')](handleEntityNotFound(_0x582293,null))[_0x1926('0x28')](function(_0x4ca811){if(_0x4ca811){var _0x2f5063=_0x4ca811[_0x1926('0x3d')]({'plain':!![]});var _0x595503=_0x31fe85['query'][_0x1926('0x6c')];return _0x4ca811[_0x1926('0x112')](_0x595503)[_0x1926('0x28')](function(){for(var _0x18bb38=0x0;_0x18bb38<_0x595503[_0x1926('0x65')];_0x18bb38++){var _0x4a73a3=[];db[_0x1926('0x113')][_0x1926('0xb9')]({'where':{'id':_0x595503[_0x18bb38]}})[_0x1926('0x28')](function(_0x3dd3cd){_0x4a73a3['push'](_0x3dd3cd[_0x1926('0xe4')]()[_0x1926('0x28')](function(_0x479f4f){for(var _0x53aade=0x0;_0x53aade<_0x479f4f[_0x1926('0x65')];_0x53aade++){_0x479f4f[_0x53aade][_0x1926('0x106')](_0x1926('0x9c'),_0x1926('0x107'));}return _0x479f4f;}));_0x4a73a3['push'](_0x3dd3cd[_0x1926('0x114')]()['then'](function(_0x31e4fc){for(var _0xa0d469=0x0;_0xa0d469<_0x31e4fc[_0x1926('0x65')];_0xa0d469++){_0x31e4fc[_0xa0d469][_0x1926('0x106')](_0x1926('0x9c'),_0x1926('0x108'));}return _0x31e4fc;}));_0x4a73a3[_0x1926('0xe5')](_0x3dd3cd[_0x1926('0x109')]()[_0x1926('0x28')](function(_0x5ea3d9){for(var _0x1801a4=0x0;_0x1801a4<_0x5ea3d9['length'];_0x1801a4++){_0x5ea3d9[_0x1801a4][_0x1926('0x106')]('channel',_0x1926('0x10a'));}return _0x5ea3d9;}));_0x4a73a3[_0x1926('0xe5')](_0x3dd3cd[_0x1926('0x115')]()[_0x1926('0x28')](function(_0x5b2dbb){for(var _0x3ef886=0x0;_0x3ef886<_0x5b2dbb[_0x1926('0x65')];_0x3ef886++){_0x5b2dbb[_0x3ef886]['setDataValue'](_0x1926('0x9c'),_0x1926('0x116'));}return _0x5b2dbb;}));_0x4a73a3[_0x1926('0xe5')](_0x3dd3cd[_0x1926('0x10b')]()['then'](function(_0x74f08f){for(var _0x1fd214=0x0;_0x1fd214<_0x74f08f['length'];_0x1fd214++){_0x74f08f[_0x1fd214]['setDataValue'](_0x1926('0x9c'),_0x1926('0x117'));}return _0x74f08f;}));_0x4a73a3['push'](_0x3dd3cd[_0x1926('0x10c')]()[_0x1926('0x28')](function(_0x4c9eed){for(var _0x44dca0=0x0;_0x44dca0<_0x4c9eed[_0x1926('0x65')];_0x44dca0++){_0x4c9eed[_0x44dca0]['setDataValue'](_0x1926('0x9c'),_0x1926('0x10d'));}return _0x4c9eed;}));return BPromise['all'](_0x4a73a3);})[_0x1926('0x28')](function(_0x569643){var _0x443b18=_[_0x1926('0x10e')](_0x569643);_0x4a73a3=[];return db[_0x1926('0x5d')]['transaction'](function(_0x53410e){for(var _0x5d0e86=0x0;_0x5d0e86<_0x443b18[_0x1926('0x65')];_0x5d0e86++){_0x4a73a3['push'](_0x443b18[_0x5d0e86][_0x1926('0x118')](_0x2f5063['id']),{'transaction':_0x53410e});}return BPromise['all'](_0x4a73a3)[_0x1926('0x28')](function(){if(_0x2f5063[_0x1926('0x9d')]){return BPromise[_0x1926('0xab')](_['filter'](_0x443b18,function(_0x547c15){return _0x547c15['getDataValue']('channel')==='Voice';}),function(_0x3fe094){return db['UserVoiceQueueRt'][_0x1926('0x49')]({'where':{'VoiceQueueId':_0x3fe094['id'],'UserId':_0x2f5063['id']},'transaction':_0x53410e});});}else{return;}})[_0x1926('0x28')](function(){for(var _0x1c8084=0x0;_0x1c8084<_0x443b18[_0x1926('0x65')];_0x1c8084++){var _0x167d64=_0x443b18[_0x1c8084][_0x1926('0x110')]('channel');var _0x1572a0=_0x167d64+'QueueId';socket['emit']('user'+_0x167d64+_0x1926('0xaf'),{'UserId':_0x2f5063['id'],['queueField']:_0x443b18[_0x1c8084]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x582293,null))[_0x1926('0x64')](handleError(_0x582293,null));};exports[_0x1926('0x119')]=function(_0x40f77c,_0x2ae648,_0x2e4245){var _0x4e122a={};var _0x10dc95={};var _0x1e0ee1;var _0x1b48b3;return db[_0x1926('0x4c')]['findOne']({'where':{'id':_0x40f77c[_0x1926('0x69')]['id']}})[_0x1926('0x28')](handleEntityNotFound(_0x2ae648,null))[_0x1926('0x28')](function(_0xad568e){if(_0xad568e){_0x1e0ee1=_0xad568e;_0x10dc95[_0x1926('0x57')]=_[_0x1926('0x53')](db[_0x1926('0xbe')][_0x1926('0x4d')]);_0x10dc95['query']=_[_0x1926('0x53')](_0x40f77c[_0x1926('0x54')]);_0x10dc95[_0x1926('0x55')]=_[_0x1926('0x56')](_0x10dc95[_0x1926('0x57')],_0x10dc95['query']);_0x4e122a['attributes']=_[_0x1926('0x56')](_0x10dc95['model'],qs[_0x1926('0x59')](_0x40f77c['query']['fields']));_0x4e122a['attributes']=_0x4e122a[_0x1926('0x58')][_0x1926('0x65')]?_0x4e122a['attributes']:_0x10dc95[_0x1926('0x57')];_0x4e122a[_0x1926('0xbb')]=qs[_0x1926('0x5b')](_0x40f77c[_0x1926('0x54')][_0x1926('0x5b')]);_0x4e122a[_0x1926('0x5c')]=qs['filters'](_['pick'](_0x40f77c[_0x1926('0x54')],_0x10dc95[_0x1926('0x55')]));if(_0x40f77c['query'][_0x1926('0x41')]){_0x4e122a['where']=_[_0x1926('0xbd')](_0x4e122a['where'],{'$or':_[_0x1926('0x43')](_0x4e122a[_0x1926('0x58')],function(_0x3ac48a){var _0x2c44bf={};_0x2c44bf[_0x3ac48a]={'$like':'%'+_0x40f77c['query'][_0x1926('0x41')]+'%'};return _0x2c44bf;})});}_0x4e122a=_[_0x1926('0xbd')]({},_0x4e122a,_0x40f77c['options']);return _0x1e0ee1[_0x1926('0x119')](_0x4e122a);}})[_0x1926('0x28')](function(_0x4396de){if(_0x4396de){_0x1b48b3=_0x4396de['length'];if(!_0x40f77c[_0x1926('0x54')]['hasOwnProperty'](_0x1926('0xc2'))){_0x4e122a['limit']=qs['limit'](_0x40f77c['query']['limit']);_0x4e122a[_0x1926('0x36')]=qs[_0x1926('0x36')](_0x40f77c[_0x1926('0x54')]['offset']);}return _0x1e0ee1['getLists'](_0x4e122a);}})[_0x1926('0x28')](function(_0x44cf55){if(_0x44cf55){return _0x44cf55?{'count':_0x1b48b3,'rows':_0x44cf55}:null;}})['then'](respondWithResult(_0x2ae648,null))[_0x1926('0x64')](handleError(_0x2ae648,null));};exports[_0x1926('0x11a')]=function(_0x5681a5,_0x531fc9,_0x16aeaa){var _0x46c899={};var _0x3f7056={};var _0x1f0aad;var _0x2b5b42;return db[_0x1926('0x4c')][_0x1926('0xb9')]({'where':{'id':_0x5681a5['params']['id']}})[_0x1926('0x28')](handleEntityNotFound(_0x531fc9,null))['then'](function(_0x654211){if(_0x654211){_0x1f0aad=_0x654211;_0x3f7056[_0x1926('0x57')]=_[_0x1926('0x53')](db[_0x1926('0x4c')][_0x1926('0x4d')]);_0x3f7056[_0x1926('0x54')]=_[_0x1926('0x53')](_0x5681a5[_0x1926('0x54')]);_0x3f7056[_0x1926('0x55')]=_[_0x1926('0x56')](_0x3f7056['model'],_0x3f7056['query']);_0x46c899[_0x1926('0x58')]=_['intersection'](_0x3f7056[_0x1926('0x57')],qs['fields'](_0x5681a5[_0x1926('0x54')]['fields']));_0x46c899[_0x1926('0x58')]=_0x46c899['attributes'][_0x1926('0x65')]?_0x46c899[_0x1926('0x58')]:_0x3f7056[_0x1926('0x57')];_0x46c899[_0x1926('0xbb')]=qs['sort'](_0x5681a5[_0x1926('0x54')][_0x1926('0x5b')]);_0x46c899[_0x1926('0x5c')]=qs[_0x1926('0x55')](_[_0x1926('0xbc')](_0x5681a5[_0x1926('0x54')],_0x3f7056[_0x1926('0x55')]));if(_0x5681a5[_0x1926('0x54')][_0x1926('0x41')]){_0x46c899[_0x1926('0x5c')]=_[_0x1926('0xbd')](_0x46c899[_0x1926('0x5c')],{'$or':_[_0x1926('0x43')](_0x46c899[_0x1926('0x58')],function(_0x1a5c58){var _0x1310f4={};_0x1310f4[_0x1a5c58]={'$like':'%'+_0x5681a5[_0x1926('0x54')][_0x1926('0x41')]+'%'};return _0x1310f4;})});}_0x46c899[_0x1926('0x57')]=db['User'];_0x46c899['as']=_0x1926('0x3f');_0x46c899=_['merge']({},_0x46c899,_0x5681a5[_0x1926('0x60')]);return _0x1f0aad['getVoiceQueues']({'include':[_0x46c899]});}})[_0x1926('0x28')](function(_0x5546c5){if(_0x5546c5){var _0x243c45={},_0x2ea897=[],_0x2f8b7d=0x0;for(var _0x16dbc7=0x0;_0x16dbc7<_0x5546c5['length'];_0x16dbc7+=0x1){for(var _0x1673cd=0x0,_0x5dd4ee;_0x1673cd<_0x5546c5[_0x16dbc7][_0x1926('0x3f')]['length'];_0x1673cd+=0x1){_0x5dd4ee=_0x5546c5[_0x16dbc7][_0x1926('0x3f')][_0x1673cd][_0x1926('0x3d')]({'plain':!![]});_0x243c45[_0x5dd4ee['id']]=_0x5dd4ee;}}_0x243c45=_['values'](_0x243c45);for(var _0x4210ac=qs[_0x1926('0x36')](_0x5681a5[_0x1926('0x54')][_0x1926('0x36')]);_0x4210ac<_0x243c45[_0x1926('0x65')]&&_0x2ea897[_0x1926('0x65')]=_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')]=_0x3ff0c6[_0xafe9('0x50')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0xafe9('0x10')](function(){if(_0x3ef11b){return db[_0xafe9('0x45')][_0xafe9('0x48')]({'where':{'membername':_0x3ef11b[_0xafe9('0x2a')]},'individualHooks':!![]});}})['then'](function(){if(_0x3ef11b){return _0x3ef11b['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x5ad5fd){if(_0x3ef11b){if(_0x5ad5fd){var _0x25fa47=[];_0xcd8c85=_0x5ad5fd;if(_0xcd8c85['length']){for(var _0x2aeb92=0x0;_0x2aeb92<_0xcd8c85[_0xafe9('0x30')];_0x2aeb92++){_0x25fa47[_0xafe9('0x32')](db[_0xafe9('0x45')][_0xafe9('0x51')]({'membername':_0x3ef11b[_0xafe9('0x2a')],'UserId':_0x3ef11b['id'],'queue_name':_0xcd8c85[_0x2aeb92][_0xafe9('0x2a')],'VoiceQueueId':_0xcd8c85[_0x2aeb92]['id'],'interface':_0x596a7f,'paused':_0x3ef11b['loginInPause']||![],'penalty':_0xcd8c85[_0x2aeb92][_0xafe9('0x52')]||0x0}));}return BPromise['all'](_0x25fa47);}}}})[_0xafe9('0x10')](function(){if(_0x3ef11b){return db[_0xafe9('0x2e')]['findAll']({'where':{'membername':_0x3ef11b[_0xafe9('0x2a')],'exitAt':null}});}})[_0xafe9('0x10')](function(_0x37e28f){if(_0x3ef11b){if(_0x37e28f&&_0x37e28f[_0xafe9('0x30')]){var _0x319fa3=[];_0x37e28f['forEach'](function(_0x476dc3){_0x319fa3['push'](_0x476dc3[_0xafe9('0x2d')]({'exitAt':moment()[_0xafe9('0x34')](_0xafe9('0x41'))}));});return BPromise['all'](_0x319fa3);}}})['then'](function(_0x2ee8e0){if(_0x3ef11b){var _0x54f928=[];var _0x27d2d6=[];var _0x3c8179=utils[_0xafe9('0x31')]();var _0x2470f2={'membername':_0x3ef11b[_0xafe9('0x2a')],'interface':_0x596a7f,'enterAt':moment()['format'](_0xafe9('0x41')),'role':_0x3ef11b[_0xafe9('0x2b')],'internal':_0x3ef11b[_0xafe9('0x2c')]};_0x3c8179[_0xafe9('0x46')](function(_0x4e02f5){_0x54f928[_0xafe9('0x32')](_[_0xafe9('0x53')]({'channel':_0x4e02f5,'type':'LOGIN','data1':'callysquare','data2':_0x596a7f},_0x2470f2));if(_0x3ef11b[_0xafe9('0x4b')]){_0x27d2d6['push'](_['merge']({'channel':_0x4e02f5,'type':'PAUSE','data1':_0xafe9('0x54')},_0x2470f2));}});return db[_0xafe9('0x2e')][_0xafe9('0x55')](_0x54f928[_0xafe9('0x56')](_0x27d2d6),{'individualHooks':!![]});}})[_0xafe9('0x10')](function(){if(_0x3ef11b){return _0x3ef11b['update']({'online':!![],'lastLoginAt':moment()[_0xafe9('0x34')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x3ef11b[_0xafe9('0x4b')]||![],'mailPause':_0x3ef11b[_0xafe9('0x4b')]||![],'chatPause':_0x3ef11b['loginInPause']||![],'faxPause':_0x3ef11b[_0xafe9('0x4b')]||![],'smsPause':_0x3ef11b['loginInPause']||![],'openchannelPause':_0x3ef11b[_0xafe9('0x4b')]||![],'pauseType':_0x3ef11b['loginInPause']?'LOGININPAUSE':null,'lastPauseAt':moment()[_0xafe9('0x34')](_0xafe9('0x41')),'interface':_0x596a7f});}})[_0xafe9('0x10')](function(_0x134aea){_0x15d990(_0x134aea);})[_0xafe9('0x1a')](function(_0x5006f7){_0x204225(_0x2d7282[_0xafe9('0x16')](0x1f4,_0x5006f7[_0xafe9('0x18')]));});});}; \ No newline at end of file +var _0xc02e=['../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE','concat','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','socket.io-emitter','./user.socket','register','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','message','GetUser','findAll','options','where','attributes','limit','include','model','map','catch','ShowUser','User','find','raw','PauseUser','role','internal','interface','UserVoiceQueueRt','update','name','PAUSE','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','forEach','isNil','SIP/%s','body','DEFAULT\x20PAUSE','MemberReport','bulkCreate','type','UnpauseUser','findOne','channel','isValidChannel','voice','mail','chat','fax','sms','system','set','Pause','push','all','LogoutUser','destroy','length','LoginUser','phone','loginInPause','count'];(function(_0x197106,_0x2212b1){var _0x4fdca4=function(_0x563101){while(--_0x563101){_0x197106['push'](_0x197106['shift']());}};_0x4fdca4(++_0x2212b1);}(_0xc02e,0xbe));var _0xec02=function(_0x2fb0a7,_0x4cc844){_0x2fb0a7=_0x2fb0a7-0x0;var _0x5348a9=_0xc02e[_0x2fb0a7];return _0x5348a9;};'use strict';var _=require(_0xec02('0x0'));var util=require('util');var moment=require(_0xec02('0x1'));var BPromise=require('bluebird');var rs=require(_0xec02('0x2'));var fs=require('fs');var Redis=require(_0xec02('0x3'));var db=require(_0xec02('0x4'))['db'];var utils=require(_0xec02('0x5'));var logger=require(_0xec02('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xec02('0x7'));var client=jayson[_0xec02('0x8')]['http']({'port':0x232a});config[_0xec02('0x9')]=_['defaults'](config[_0xec02('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xec02('0xa'))(new Redis(config['redis']));require(_0xec02('0xb'))[_0xec02('0xc')](socket);function respondWithRpcPromise(_0x339bc0,_0x3ba3da,_0x151fe2){return new BPromise(function(_0xa03976,_0x33058b){return client[_0xec02('0xd')](_0x339bc0,_0x151fe2)[_0xec02('0xe')](function(_0x53bb81){logger[_0xec02('0xf')](_0xec02('0x10'),_0x3ba3da,_0xec02('0x11'));logger[_0xec02('0x12')](_0xec02('0x13'),_0x3ba3da,'request\x20sent',JSON[_0xec02('0x14')](_0x53bb81));if(_0x53bb81[_0xec02('0x15')]){if(_0x53bb81[_0xec02('0x15')]['code']===0x1f4){logger[_0xec02('0x15')](_0xec02('0x10'),_0x3ba3da,_0x53bb81[_0xec02('0x15')][_0xec02('0x16')]);return _0x33058b(_0x53bb81['error']['message']);}logger[_0xec02('0x15')](_0xec02('0x10'),_0x3ba3da,_0x53bb81[_0xec02('0x15')][_0xec02('0x16')]);return _0xa03976(_0x53bb81[_0xec02('0x15')][_0xec02('0x16')]);}else{logger[_0xec02('0xf')](_0xec02('0x10'),_0x3ba3da,'request\x20sent');_0xa03976(_0x53bb81['result'][_0xec02('0x16')]);}})['catch'](function(_0x1eb610){logger[_0xec02('0x15')](_0xec02('0x10'),_0x3ba3da,_0x1eb610);_0x33058b(_0x1eb610);});});}exports[_0xec02('0x17')]=function(_0x378d46){var _0x334b67=this;return new Promise(function(_0xd76a77,_0x4884c3){return db['User'][_0xec02('0x18')]({'raw':_0x378d46[_0xec02('0x19')]?_0x378d46['options']['raw']===undefined?!![]:![]:!![],'where':_0x378d46[_0xec02('0x19')]?_0x378d46[_0xec02('0x19')][_0xec02('0x1a')]||null:null,'attributes':_0x378d46[_0xec02('0x19')]?_0x378d46[_0xec02('0x19')][_0xec02('0x1b')]||null:null,'limit':_0x378d46['options']?_0x378d46[_0xec02('0x19')][_0xec02('0x1c')]||null:null,'include':_0x378d46[_0xec02('0x19')]?_0x378d46[_0xec02('0x19')]['include']?_['map'](_0x378d46[_0xec02('0x19')][_0xec02('0x1d')],function(_0x3deecb){return{'model':db[_0x3deecb[_0xec02('0x1e')]],'as':_0x3deecb['as'],'attributes':_0x3deecb[_0xec02('0x1b')],'include':_0x3deecb[_0xec02('0x1d')]?_[_0xec02('0x1f')](_0x3deecb[_0xec02('0x1d')],function(_0xac28c4){return{'model':db[_0xac28c4[_0xec02('0x1e')]],'as':_0xac28c4['as'],'attributes':_0xac28c4['attributes'],'include':_0xac28c4[_0xec02('0x1d')]?_[_0xec02('0x1f')](_0xac28c4['include'],function(_0x31562e){return{'model':db[_0x31562e[_0xec02('0x1e')]],'as':_0x31562e['as'],'attributes':_0x31562e[_0xec02('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x66234c){logger[_0xec02('0xf')](_0xec02('0x17'),_0x378d46);logger[_0xec02('0x12')]('GetUser',_0x378d46,JSON[_0xec02('0x14')](_0x66234c));_0xd76a77(_0x66234c);})[_0xec02('0x20')](function(_0x117b45){logger[_0xec02('0x15')](_0xec02('0x17'),_0x117b45[_0xec02('0x16')],_0x378d46);_0x4884c3(_0x334b67['error'](0x1f4,_0x117b45[_0xec02('0x16')]));});});};exports[_0xec02('0x21')]=function(_0xf847f8){var _0x2a0813=this;return new Promise(function(_0x564f9d,_0x2c5bb0){return db[_0xec02('0x22')][_0xec02('0x23')]({'raw':_0xf847f8[_0xec02('0x19')]?_0xf847f8[_0xec02('0x19')][_0xec02('0x24')]===undefined?!![]:![]:!![],'where':_0xf847f8[_0xec02('0x19')]?_0xf847f8[_0xec02('0x19')][_0xec02('0x1a')]||null:null,'attributes':_0xf847f8[_0xec02('0x19')]?_0xf847f8[_0xec02('0x19')][_0xec02('0x1b')]||null:null,'include':_0xf847f8[_0xec02('0x19')]?_0xf847f8[_0xec02('0x19')][_0xec02('0x1d')]?_['map'](_0xf847f8[_0xec02('0x19')][_0xec02('0x1d')],function(_0x131dfc){return{'model':db[_0x131dfc[_0xec02('0x1e')]],'as':_0x131dfc['as'],'attributes':_0x131dfc[_0xec02('0x1b')],'include':_0x131dfc[_0xec02('0x1d')]?_[_0xec02('0x1f')](_0x131dfc[_0xec02('0x1d')],function(_0x52fc35){return{'model':db[_0x52fc35[_0xec02('0x1e')]],'as':_0x52fc35['as'],'attributes':_0x52fc35[_0xec02('0x1b')],'include':_0x52fc35[_0xec02('0x1d')]?_[_0xec02('0x1f')](_0x52fc35[_0xec02('0x1d')],function(_0x4e3da3){return{'model':db[_0x4e3da3['model']],'as':_0x4e3da3['as'],'attributes':_0x4e3da3[_0xec02('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xec02('0xe')](function(_0x716e3c){logger[_0xec02('0xf')](_0xec02('0x21'),_0xf847f8);logger['debug']('ShowUser',_0xf847f8,JSON[_0xec02('0x14')](_0x716e3c));_0x564f9d(_0x716e3c);})[_0xec02('0x20')](function(_0x2afe7f){logger[_0xec02('0x15')](_0xec02('0x21'),_0x2afe7f[_0xec02('0x16')],_0xf847f8);_0x2c5bb0(_0x2a0813['error'](0x1f4,_0x2afe7f[_0xec02('0x16')]));});});};exports[_0xec02('0x25')]=function(_0x1155de){var _0x4a8d3e=this;return new Promise(function(_0x11154f,_0x16a6f0){var _0x4c8c20;return db[_0xec02('0x22')][_0xec02('0x23')]({'where':_0x1155de[_0xec02('0x19')]['where']||{},'attributes':['id','name',_0xec02('0x26'),_0xec02('0x27'),_0xec02('0x28')]})['then'](function(_0x544dd0){if(_0x544dd0){_0x4c8c20=_0x544dd0;return db[_0xec02('0x29')][_0xec02('0x2a')]({'paused':0x1},{'where':{'UserId':_0x4c8c20['id']},'individualHooks':!![]});}})[_0xec02('0xe')](function(){if(_0x4c8c20){return db['MemberReport'][_0xec02('0x18')]({'where':{'membername':_0x4c8c20[_0xec02('0x2b')],'type':_0xec02('0x2c'),'exitAt':null}});}})[_0xec02('0xe')](function(_0x4ffa7a){if(_0x4c8c20){if(_0x4ffa7a&&_0x4ffa7a['length']){var _0x2cacfb=moment()[_0xec02('0x2d')](_0xec02('0x2e'));for(var _0x28e82b=0x0,_0x5bfeec=_0x4ffa7a['length'];_0x28e82b<_0x5bfeec;_0x28e82b++){_0x4ffa7a[_0x28e82b][_0xec02('0x2f')]({'exitAt':_0x2cacfb});}}}})[_0xec02('0xe')](function(){if(_0x4c8c20){var _0x15be9a=[];var _0xd89bfe=utils['getChannels']();_0xd89bfe[_0xec02('0x30')](function(_0x2247f8){_0x15be9a['push']({'channel':_0x2247f8,'membername':_0x4c8c20[_0xec02('0x2b')],'interface':_[_0xec02('0x31')](_0x4c8c20['interface'])?util[_0xec02('0x2d')](_0xec02('0x32'),_0x4c8c20['name']):_0x4c8c20[_0xec02('0x28')],'type':_0xec02('0x2c'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x1155de[_0xec02('0x33')]['type']||_0xec02('0x34'),'role':_0x4c8c20[_0xec02('0x26')],'internal':_0x4c8c20[_0xec02('0x27')],'uniqueid':_0x1155de[_0xec02('0x33')]['uniqueid']||null});});return db[_0xec02('0x35')][_0xec02('0x36')](_0x15be9a,{'individualHooks':!![]});}})['then'](function(){if(_0x4c8c20){return _0x4c8c20['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x1155de[_0xec02('0x33')][_0xec02('0x37')]||_0xec02('0x34'),'lastPauseAt':moment()[_0xec02('0x2d')](_0xec02('0x2e'))});}})['then'](function(_0x1cb71a){_0x11154f(_0x1cb71a);})[_0xec02('0x20')](function(_0x134ac5){_0x16a6f0(_0x4a8d3e[_0xec02('0x15')](0x1f4,_0x134ac5['message']));});});};exports[_0xec02('0x38')]=function(_0x192a42){var _0x278754=this;return new Promise(function(_0x593b1b,_0x2b96d4){var _0x490d6f;return db[_0xec02('0x22')][_0xec02('0x39')]({'where':_0x192a42[_0xec02('0x19')][_0xec02('0x1a')]||{},'attributes':['id',_0xec02('0x2b')]})[_0xec02('0xe')](function(_0x13d552){if(_0x13d552){_0x490d6f=_0x13d552;if(_0x192a42[_0xec02('0x33')][_0xec02('0x3a')]&&!utils[_0xec02('0x3b')](_0x192a42[_0xec02('0x33')]['channel'])){throw new Error('Unknown\x20channel');}switch(_0x192a42[_0xec02('0x33')]['channel']){case _0xec02('0x3c'):return db[_0xec02('0x29')][_0xec02('0x2a')]({'paused':0x0},{'where':{'UserId':_0x490d6f['id']}})[_0xec02('0xe')](function(){return db['MemberReport'][_0xec02('0x23')]({'where':{'channel':_0x192a42[_0xec02('0x33')]['channel'],'membername':_0x490d6f['name'],'type':_0xec02('0x2c'),'exitAt':null}});})[_0xec02('0xe')](function(_0x1adbe3){if(_0x1adbe3){return _0x1adbe3[_0xec02('0x2a')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':'system'},{'individualHooks':!![]});}return null;})['then'](function(){return _0x490d6f[_0xec02('0x2a')]({'voicePause':![]});});case _0xec02('0x3d'):case _0xec02('0x3e'):case _0xec02('0x3f'):case _0xec02('0x40'):case'openchannel':return db['MemberReport'][_0xec02('0x23')]({'where':{'channel':_0x192a42['body'][_0xec02('0x3a')],'membername':_0x490d6f[_0xec02('0x2b')],'type':_0xec02('0x2c'),'exitAt':null}})[_0xec02('0xe')](function(_0x1cb702){return _0x1cb702['update']({'exitAt':moment()[_0xec02('0x2d')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xec02('0x41')},{'individualHooks':!![]});})[_0xec02('0xe')](function(){var _0x5d9ccc={};_[_0xec02('0x42')](_0x5d9ccc,util[_0xec02('0x2d')]('%s%s',_0x192a42[_0xec02('0x33')][_0xec02('0x3a')],_0xec02('0x43')),![]);return _0x490d6f[_0xec02('0x2a')](_0x5d9ccc);});default:return db[_0xec02('0x29')][_0xec02('0x2a')]({'paused':0x0},{'where':{'UserId':_0x490d6f['id']}})[_0xec02('0xe')](function(){return db[_0xec02('0x35')][_0xec02('0x18')]({'where':{'membername':_0x490d6f[_0xec02('0x2b')],'type':_0xec02('0x2c'),'exitAt':null}});})[_0xec02('0xe')](function(_0x2a0d47){var _0x57b27f=[];_0x2a0d47[_0xec02('0x30')](function(_0x57c136){_0x57b27f[_0xec02('0x44')](_0x57c136['update']({'exitAt':moment()[_0xec02('0x2d')](_0xec02('0x2e')),'data2':_0xec02('0x41')}));});return BPromise[_0xec02('0x45')](_0x57b27f);})['then'](function(){return _0x490d6f[_0xec02('0x2a')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0xec02('0xe')](function(_0x406249){_0x593b1b(_0x406249);})[_0xec02('0x20')](function(_0x253077){_0x2b96d4(_0x278754[_0xec02('0x15')](0x1f4,_0x253077[_0xec02('0x16')]));});});};exports[_0xec02('0x46')]=function(_0x2a4126){var _0x2b0bcf=this;return new Promise(function(_0x77e4c0,_0x99522a){var _0x403a47;return db[_0xec02('0x22')][_0xec02('0x39')]({'where':_0x2a4126[_0xec02('0x19')][_0xec02('0x1a')]||{},'attributes':['id','name']})[_0xec02('0xe')](function(_0x2b07e1){if(_0x2b07e1){_0x403a47=_0x2b07e1;return db[_0xec02('0x29')][_0xec02('0x47')]({'where':{'membername':_0x403a47[_0xec02('0x2b')]},'individualHooks':!![]});}})[_0xec02('0xe')](function(){if(_0x403a47){return db[_0xec02('0x35')][_0xec02('0x18')]({'where':{'membername':_0x403a47[_0xec02('0x2b')],'exitAt':null}});}})[_0xec02('0xe')](function(_0x1a1325){if(_0x403a47){if(_0x1a1325&&_0x1a1325[_0xec02('0x48')]){var _0x70efe2=[];_0x1a1325[_0xec02('0x30')](function(_0x4c0ad2){_0x70efe2[_0xec02('0x44')](_0x4c0ad2[_0xec02('0x2a')]({'exitAt':moment()[_0xec02('0x2d')](_0xec02('0x2e'))}));});return BPromise[_0xec02('0x45')](_0x70efe2);}}})[_0xec02('0xe')](function(){if(_0x403a47){return _0x403a47[_0xec02('0x2a')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xec02('0xe')](function(_0x328ece){_0x77e4c0(_0x328ece);})[_0xec02('0x20')](function(_0x3e5cbf){_0x99522a(_0x2b0bcf['error'](0x1f4,_0x3e5cbf['message']));});});};exports[_0xec02('0x49')]=function(_0xd4a7cf){var _0x434e65=this;return new Promise(function(_0x2a5b39,_0x2cc49d){var _0x5157db;var _0x317b59;var _0x14a162;var _0x3ac483;return db['User'][_0xec02('0x39')]({'where':_0xd4a7cf[_0xec02('0x19')][_0xec02('0x1a')]||{},'attributes':['id',_0xec02('0x2b'),_0xec02('0x26'),'mobile',_0xec02('0x4a'),_0xec02('0x27'),_0xec02('0x4b'),'interface']})['then'](function(_0x336b10){if(_0x336b10){_0x5157db=_0x336b10;_0x3ac483=_0xd4a7cf[_0xec02('0x33')]['interface']?_0xd4a7cf['body'][_0xec02('0x28')]:util[_0xec02('0x2d')](_0xec02('0x32'),_0x5157db[_0xec02('0x2b')]);return db['User'][_0xec02('0x4c')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x5157db['id']}}});}})[_0xec02('0xe')](function(_0x523a9f){if(_0x523a9f){_0x14a162=_0x523a9f;return require(_0xec02('0x4d'))[_0xec02('0x4e')]();}})[_0xec02('0xe')](function(_0x58c602){if(_0x58c602&&_0x58c602[_0xec02('0x4f')]&&_0x14a162>=_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 diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 1eabcad..b6c3a67 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 _0xb163=['save','remove','update','removeListener'];(function(_0x18b4a1,_0x5405d4){var _0x58f14c=function(_0x1839b6){while(--_0x1839b6){_0x18b4a1['push'](_0x18b4a1['shift']());}};_0x58f14c(++_0x5405d4);}(_0xb163,0x1ac));var _0x3b16=function(_0x264c93,_0x33cb70){_0x264c93=_0x264c93-0x0;var _0x5003c0=_0xb163[_0x264c93];return _0x5003c0;};'use strict';var UserEvents=require('./user.events');var events=[_0x3b16('0x0'),_0x3b16('0x1'),_0x3b16('0x2')];function createListener(_0x24d37a,_0x3e1a0f){return function(_0x304479){_0x3e1a0f['emit'](_0x24d37a,_0x304479);};}function removeListener(_0x1beb70,_0x5df912){return function(){UserEvents[_0x3b16('0x3')](_0x1beb70,_0x5df912);};}exports['register']=function(_0x16400c){for(var _0x3bdef3=0x0,_0x349ff0=events['length'];_0x3bdef3<_0x349ff0;_0x3bdef3++){var _0x585250=events[_0x3bdef3];var _0x98df3d=createListener('user:'+_0x585250,_0x16400c);UserEvents['on'](_0x585250,_0x98df3d);}}; \ No newline at end of file +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 diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 0985806..ef951a7 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 _0xc3ee=['../../components/interaction/service','../../config/environment','exports','util','path','express','Router'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc3ee,0x1df));var _0xec3e=function(_0x260f96,_0xef220c){_0x260f96=_0x260f96-0x0;var _0x4cb97b=_0xc3ee[_0x260f96];return _0x4cb97b;};'use strict';var multer=require('multer');var util=require(_0xec3e('0x0'));var path=require(_0xec3e('0x1'));var timeout=require('connect-timeout');var express=require(_0xec3e('0x2'));var router=express[_0xec3e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xec3e('0x4'));var config=require(_0xec3e('0x5'));module[_0xec3e('0x6')]=router; \ No newline at end of file +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 diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index fb69e55..60804d8 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 _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x2f0ac5,_0x328e4e){var _0x255ced=function(_0x417d46){while(--_0x417d46){_0x2f0ac5['push'](_0x2f0ac5['shift']());}};_0x255ced(++_0x328e4e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +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 diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 9fd486d..970c682 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 _0xa0ae=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','lodash','util'];(function(_0x50f254,_0x6f017f){var _0x3c622f=function(_0x3fe494){while(--_0x3fe494){_0x50f254['push'](_0x50f254['shift']());}};_0x3c622f(++_0x6f017f);}(_0xa0ae,0x15d));var _0xea0a=function(_0x5d0725,_0x1ae8ad){_0x5d0725=_0x5d0725-0x0;var _0x157c30=_0xa0ae[_0x5d0725];return _0x157c30;};'use strict';var _=require(_0xea0a('0x0'));var util=require(_0xea0a('0x1'));var logger=require(_0xea0a('0x2'))(_0xea0a('0x3'));var moment=require(_0xea0a('0x4'));var BPromise=require(_0xea0a('0x5'));var rp=require(_0xea0a('0x6'));var fs=require('fs');var path=require(_0xea0a('0x7'));var rimraf=require(_0xea0a('0x8'));var config=require(_0xea0a('0x9'));var attributes=require(_0xea0a('0xa'));module[_0xea0a('0xb')]=function(_0x2dc77b,_0x219f65){return _0x2dc77b[_0xea0a('0xc')]('UserChatQueue',attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 0062b24..00b193f 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 _0xd8fd=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring'];(function(_0x40d020,_0x4879e9){var _0x364d92=function(_0x1ee137){while(--_0x1ee137){_0x40d020['push'](_0x40d020['shift']());}};_0x364d92(++_0x4879e9);}(_0xd8fd,0x105));var _0xdd8f=function(_0xafc244,_0x19c0ae){_0xafc244=_0xafc244-0x0;var _0xb91010=_0xd8fd[_0xafc244];return _0xb91010;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdd8f('0x0'));var BPromise=require(_0xdd8f('0x1'));var rs=require(_0xdd8f('0x2'));var fs=require('fs');var Redis=require(_0xdd8f('0x3'));var db=require(_0xdd8f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdd8f('0x5'))(_0xdd8f('0x6'));var config=require(_0xdd8f('0x7'));var jayson=require(_0xdd8f('0x8'));var client=jayson[_0xdd8f('0x9')][_0xdd8f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a84e0,_0x1cd2b9,_0x5220bb){return new BPromise(function(_0x3dd16a,_0x5cbf6a){return client[_0xdd8f('0xb')](_0x1a84e0,_0x5220bb)[_0xdd8f('0xc')](function(_0x5d414e){logger[_0xdd8f('0xd')](_0xdd8f('0xe'),_0x1cd2b9,_0xdd8f('0xf'));logger[_0xdd8f('0x10')](_0xdd8f('0x11'),_0x1cd2b9,_0xdd8f('0xf'),JSON[_0xdd8f('0x12')](_0x5d414e));if(_0x5d414e[_0xdd8f('0x13')]){if(_0x5d414e['error'][_0xdd8f('0x14')]===0x1f4){logger[_0xdd8f('0x13')](_0xdd8f('0xe'),_0x1cd2b9,_0x5d414e['error']['message']);return _0x5cbf6a(_0x5d414e['error']['message']);}logger[_0xdd8f('0x13')](_0xdd8f('0xe'),_0x1cd2b9,_0x5d414e['error']['message']);return _0x3dd16a(_0x5d414e['error'][_0xdd8f('0x15')]);}else{logger[_0xdd8f('0xd')](_0xdd8f('0xe'),_0x1cd2b9,'request\x20sent');_0x3dd16a(_0x5d414e[_0xdd8f('0x16')][_0xdd8f('0x15')]);}})[_0xdd8f('0x17')](function(_0x2531a2){logger[_0xdd8f('0x13')](_0xdd8f('0xe'),_0x1cd2b9,_0x2531a2);_0x5cbf6a(_0x2531a2);});});} \ No newline at end of file +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 diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 8dfc6f4..3f57569 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 _0x5e6f=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router'];(function(_0x1a01c1,_0x5c449c){var _0x22a564=function(_0xb7996f){while(--_0xb7996f){_0x1a01c1['push'](_0x1a01c1['shift']());}};_0x22a564(++_0x5c449c);}(_0x5e6f,0x15a));var _0xf5e6=function(_0x1098db,_0x39ba6b){_0x1098db=_0x1098db-0x0;var _0x14f090=_0x5e6f[_0x1098db];return _0x14f090;};'use strict';var multer=require(_0xf5e6('0x0'));var util=require(_0xf5e6('0x1'));var path=require(_0xf5e6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf5e6('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xf5e6('0x4'));var config=require(_0xf5e6('0x5'));module[_0xf5e6('0x6')]=router; \ No newline at end of file +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 diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 52bfda1..430c49b 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 _0xefda=['sequelize','INTEGER','STRING'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xefda,0x96));var _0xaefd=function(_0x102379,_0x20395f){_0x102379=_0x102379-0x0;var _0xa3a5b1=_0xefda[_0x102379];return _0xa3a5b1;};'use strict';var Sequelize=require(_0xaefd('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xaefd('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xaefd('0x2')]}}; \ No newline at end of file +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 diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 79e7397..4cab8ab 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 _0x7e05=['../../config/environment','./userFaxQueue.attributes','exports','define','user_has_fax_queues','lodash','util','api','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e05,0x69));var _0x57e0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7e05[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x57e0('0x0'));var util=require(_0x57e0('0x1'));var logger=require('../../config/logger')(_0x57e0('0x2'));var moment=require('moment');var BPromise=require(_0x57e0('0x3'));var rp=require(_0x57e0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x57e0('0x5'));var attributes=require(_0x57e0('0x6'));module[_0x57e0('0x7')]=function(_0x327596,_0x5f4f7e){return _0x327596[_0x57e0('0x8')]('UserFaxQueue',attributes,{'tableName':_0x57e0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index ad34d48..21cc36f 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 _0xd868=['debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x2bf68d,_0x55b6a1){var _0x1908ef=function(_0x459b4f){while(--_0x459b4f){_0x2bf68d['push'](_0x2bf68d['shift']());}};_0x1908ef(++_0x55b6a1);}(_0xd868,0xfd));var _0x8d86=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xd868[_0x5608a3];return _0x1ed50a;};'use strict';var _=require(_0x8d86('0x0'));var util=require('util');var moment=require(_0x8d86('0x1'));var BPromise=require(_0x8d86('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8d86('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8d86('0x4'));var config=require(_0x8d86('0x5'));var jayson=require(_0x8d86('0x6'));var client=jayson['client'][_0x8d86('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x43efa4,_0x24f6b3,_0x58e448){return new BPromise(function(_0x580f34,_0x154017){return client[_0x8d86('0x8')](_0x43efa4,_0x58e448)[_0x8d86('0x9')](function(_0x48a6ee){logger[_0x8d86('0xa')](_0x8d86('0xb'),_0x24f6b3,_0x8d86('0xc'));logger[_0x8d86('0xd')](_0x8d86('0xe'),_0x24f6b3,_0x8d86('0xc'),JSON['stringify'](_0x48a6ee));if(_0x48a6ee[_0x8d86('0xf')]){if(_0x48a6ee[_0x8d86('0xf')][_0x8d86('0x10')]===0x1f4){logger[_0x8d86('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x24f6b3,_0x48a6ee[_0x8d86('0xf')]['message']);return _0x154017(_0x48a6ee[_0x8d86('0xf')][_0x8d86('0x11')]);}logger['error'](_0x8d86('0xb'),_0x24f6b3,_0x48a6ee[_0x8d86('0xf')][_0x8d86('0x11')]);return _0x580f34(_0x48a6ee[_0x8d86('0xf')][_0x8d86('0x11')]);}else{logger[_0x8d86('0xa')](_0x8d86('0xb'),_0x24f6b3,_0x8d86('0xc'));_0x580f34(_0x48a6ee[_0x8d86('0x12')][_0x8d86('0x11')]);}})['catch'](function(_0x4dca2c){logger[_0x8d86('0xf')](_0x8d86('0xb'),_0x24f6b3,_0x4dca2c);_0x154017(_0x4dca2c);});});} \ No newline at end of file +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 diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index ba84f5e..9ac317b 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 _0xbdbc=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbdbc,0x1a8));var _0xcbdb=function(_0x23f0d0,_0x40ef17){_0x23f0d0=_0x23f0d0-0x0;var _0x5544fc=_0xbdbc[_0x23f0d0];return _0x5544fc;};'use strict';var multer=require(_0xcbdb('0x0'));var util=require(_0xcbdb('0x1'));var path=require(_0xcbdb('0x2'));var timeout=require(_0xcbdb('0x3'));var express=require(_0xcbdb('0x4'));var router=express[_0xcbdb('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xcbdb('0x6'));var config=require(_0xcbdb('0x7'));module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 02c6965..8140753 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 _0xd8b0=['exports','sequelize'];(function(_0x52d065,_0x31d24){var _0x49f7bc=function(_0x2f0966){while(--_0x2f0966){_0x52d065['push'](_0x52d065['shift']());}};_0x49f7bc(++_0x31d24);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_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 diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index eb1f893..f47cdf3 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 _0xb7e7=['UserMailQueue','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','define'];(function(_0x290c29,_0xe54d31){var _0x4e4548=function(_0x2de16f){while(--_0x2de16f){_0x290c29['push'](_0x290c29['shift']());}};_0x4e4548(++_0xe54d31);}(_0xb7e7,0x121));var _0x7b7e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xb7e7[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index cb400a8..9d1f108 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 _0x15ff=['request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0xeca6bf,_0x281414){var _0x36c5b0=function(_0x5a54f5){while(--_0x5a54f5){_0xeca6bf['push'](_0xeca6bf['shift']());}};_0x36c5b0(++_0x281414);}(_0x15ff,0x74));var _0xf15f=function(_0x180302,_0x5c2424){_0x180302=_0x180302-0x0;var _0x154b4b=_0x15ff[_0x180302];return _0x154b4b;};'use strict';var _=require(_0xf15f('0x0'));var util=require(_0xf15f('0x1'));var moment=require('moment');var BPromise=require(_0xf15f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf15f('0x3'));var db=require(_0xf15f('0x4'))['db'];var utils=require(_0xf15f('0x5'));var logger=require(_0xf15f('0x6'))(_0xf15f('0x7'));var config=require(_0xf15f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf15f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f4574,_0x23a2d9,_0x10e0bb){return new BPromise(function(_0x1a981c,_0x5748d4){return client[_0xf15f('0xa')](_0x3f4574,_0x10e0bb)[_0xf15f('0xb')](function(_0xec7424){logger['info'](_0xf15f('0xc'),_0x23a2d9,_0xf15f('0xd'));logger['debug'](_0xf15f('0xe'),_0x23a2d9,_0xf15f('0xd'),JSON[_0xf15f('0xf')](_0xec7424));if(_0xec7424[_0xf15f('0x10')]){if(_0xec7424[_0xf15f('0x10')][_0xf15f('0x11')]===0x1f4){logger[_0xf15f('0x10')](_0xf15f('0xc'),_0x23a2d9,_0xec7424[_0xf15f('0x10')][_0xf15f('0x12')]);return _0x5748d4(_0xec7424[_0xf15f('0x10')][_0xf15f('0x12')]);}logger[_0xf15f('0x10')](_0xf15f('0xc'),_0x23a2d9,_0xec7424[_0xf15f('0x10')][_0xf15f('0x12')]);return _0x1a981c(_0xec7424[_0xf15f('0x10')][_0xf15f('0x12')]);}else{logger[_0xf15f('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x23a2d9,'request\x20sent');_0x1a981c(_0xec7424[_0xf15f('0x14')][_0xf15f('0x12')]);}})['catch'](function(_0x5bea54){logger[_0xf15f('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x23a2d9,_0x5bea54);_0x5748d4(_0x5bea54);});});} \ No newline at end of file +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 diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 2ad668f..ab4252a 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 _0x24b1=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x305b20,_0x5e57e9){var _0x26d64a=function(_0x2e17f0){while(--_0x2e17f0){_0x305b20['push'](_0x305b20['shift']());}};_0x26d64a(++_0x5e57e9);}(_0x24b1,0xc1));var _0x124b=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x24b1[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require('multer');var util=require(_0x124b('0x0'));var path=require(_0x124b('0x1'));var timeout=require(_0x124b('0x2'));var express=require(_0x124b('0x3'));var router=express[_0x124b('0x4')]();var auth=require(_0x124b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x124b('0x6'));module[_0x124b('0x7')]=router; \ No newline at end of file +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 diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 84cbfd9..9038e3e 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_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 diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index f988d17..0a18ba2 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 _0x6ede=['UserOpenchannelQueue','user_has_openchannel_queues','util','../../config/logger','api','request-promise','path','rimraf','./userOpenchannelQueue.attributes','exports'];(function(_0x5988f4,_0x44ba3c){var _0x1becd9=function(_0x13e947){while(--_0x13e947){_0x5988f4['push'](_0x5988f4['shift']());}};_0x1becd9(++_0x44ba3c);}(_0x6ede,0x7a));var _0xe6ed=function(_0x4a095e,_0x381cd5){_0x4a095e=_0x4a095e-0x0;var _0x10ef73=_0x6ede[_0x4a095e];return _0x10ef73;};'use strict';var _=require('lodash');var util=require(_0xe6ed('0x0'));var logger=require(_0xe6ed('0x1'))(_0xe6ed('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe6ed('0x3'));var fs=require('fs');var path=require(_0xe6ed('0x4'));var rimraf=require(_0xe6ed('0x5'));var config=require('../../config/environment');var attributes=require(_0xe6ed('0x6'));module[_0xe6ed('0x7')]=function(_0x38f8a1,_0xf53734){return _0x38f8a1['define'](_0xe6ed('0x8'),attributes,{'tableName':_0xe6ed('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index ebfa356..bd973bd 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 _0x3f07=['info','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserOpenchannelQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3f07,0x94));var _0x73f0=function(_0x946bb2,_0xbdde84){_0x946bb2=_0x946bb2-0x0;var _0x40d752=_0x3f07[_0x946bb2];return _0x40d752;};'use strict';var _=require(_0x73f0('0x0'));var util=require(_0x73f0('0x1'));var moment=require(_0x73f0('0x2'));var BPromise=require(_0x73f0('0x3'));var rs=require(_0x73f0('0x4'));var fs=require('fs');var Redis=require(_0x73f0('0x5'));var db=require(_0x73f0('0x6'))['db'];var utils=require(_0x73f0('0x7'));var logger=require('../../config/logger')(_0x73f0('0x8'));var config=require(_0x73f0('0x9'));var jayson=require(_0x73f0('0xa'));var client=jayson['client'][_0x73f0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4766e2,_0x18edef,_0x355647){return new BPromise(function(_0x498a8f,_0x338e38){return client[_0x73f0('0xc')](_0x4766e2,_0x355647)['then'](function(_0x2eb6e5){logger[_0x73f0('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x18edef,_0x73f0('0xe'));logger[_0x73f0('0xf')](_0x73f0('0x10'),_0x18edef,_0x73f0('0xe'),JSON[_0x73f0('0x11')](_0x2eb6e5));if(_0x2eb6e5[_0x73f0('0x12')]){if(_0x2eb6e5[_0x73f0('0x12')]['code']===0x1f4){logger['error'](_0x73f0('0x13'),_0x18edef,_0x2eb6e5[_0x73f0('0x12')][_0x73f0('0x14')]);return _0x338e38(_0x2eb6e5[_0x73f0('0x12')]['message']);}logger[_0x73f0('0x12')](_0x73f0('0x13'),_0x18edef,_0x2eb6e5[_0x73f0('0x12')][_0x73f0('0x14')]);return _0x498a8f(_0x2eb6e5[_0x73f0('0x12')][_0x73f0('0x14')]);}else{logger[_0x73f0('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x18edef,'request\x20sent');_0x498a8f(_0x2eb6e5[_0x73f0('0x15')][_0x73f0('0x14')]);}})[_0x73f0('0x16')](function(_0x21fc58){logger[_0x73f0('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x18edef,_0x21fc58);_0x338e38(_0x21fc58);});});} \ No newline at end of file +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 diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index befc0c3..1199b09 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 _0x8558=['exports','multer','util','path','express','Router','../../config/environment','./userProfile.controller','get','isAuthenticated','describe','/:id','show','getSections','/:id/resources','getResources','post','create','/:id/clone','/:id/sections','addSections','addResources','update','delete','destroy','removeSections','removeResources'];(function(_0x11abb1,_0x2c7f24){var _0x39fa40=function(_0x2b49a3){while(--_0x2b49a3){_0x11abb1['push'](_0x11abb1['shift']());}};_0x39fa40(++_0x2c7f24);}(_0x8558,0x1b1));var _0x8855=function(_0x571223,_0x1d4258){_0x571223=_0x571223-0x0;var _0x5bcddb=_0x8558[_0x571223];return _0x5bcddb;};'use strict';var multer=require(_0x8855('0x0'));var util=require(_0x8855('0x1'));var path=require(_0x8855('0x2'));var timeout=require('connect-timeout');var express=require(_0x8855('0x3'));var router=express[_0x8855('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8855('0x5'));var controller=require(_0x8855('0x6'));router[_0x8855('0x7')]('/',auth[_0x8855('0x8')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x8855('0x9')]);router[_0x8855('0x7')](_0x8855('0xa'),auth['isAuthenticated'](),controller[_0x8855('0xb')]);router[_0x8855('0x7')]('/:id/sections',auth[_0x8855('0x8')](),controller[_0x8855('0xc')]);router[_0x8855('0x7')](_0x8855('0xd'),auth[_0x8855('0x8')](),controller[_0x8855('0xe')]);router[_0x8855('0xf')]('/',auth[_0x8855('0x8')](),controller[_0x8855('0x10')]);router[_0x8855('0xf')](_0x8855('0x11'),auth[_0x8855('0x8')](),controller['clone']);router['post'](_0x8855('0x12'),auth[_0x8855('0x8')](),controller[_0x8855('0x13')]);router[_0x8855('0xf')](_0x8855('0xd'),auth[_0x8855('0x8')](),controller[_0x8855('0x14')]);router['put'](_0x8855('0xa'),auth[_0x8855('0x8')](),controller[_0x8855('0x15')]);router[_0x8855('0x16')](_0x8855('0xa'),auth['isAuthenticated'](),controller[_0x8855('0x17')]);router[_0x8855('0x16')](_0x8855('0x12'),auth['isAuthenticated'](),controller[_0x8855('0x18')]);router[_0x8855('0x16')]('/:id/resources',auth['isAuthenticated'](),controller[_0x8855('0x19')]);module[_0x8855('0x1a')]=router; \ No newline at end of file +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 diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 0464062..5a16fcf 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 _0x60a5=['name','setDataValue','crudPermissions','join','getDataValue','sequelize'];(function(_0x464bdc,_0xb0a019){var _0x1b1f84=function(_0x394495){while(--_0x394495){_0x464bdc['push'](_0x464bdc['shift']());}};_0x1b1f84(++_0xb0a019);}(_0x60a5,0x83));var _0x560a=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x60a5[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0x560a('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x560a('0x1')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x4ebe35){this[_0x560a('0x2')](_0x560a('0x3'),_0x4ebe35?_0x4ebe35[_0x560a('0x4')](''):[]);},'get':function(){return this['getDataValue'](_0x560a('0x3'))?this[_0x560a('0x5')](_0x560a('0x3'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +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 diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 771c2e9..22f00ef 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 _0x14fb=['attributes','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','find','catch','create','body','clone','params','get','omit','createdAt','updatedAt','crudPermissions','transaction','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','update','describe','UserProfileSection','push','removeSections','ids','getSections','enabled','includes','subsections','Dashboard','forEach','Plugin','resourceId','addResources','sequelize','bulkCreate','removeResources','section','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','Invalid\x20section\x20\x27','isEmpty','parentSections','findOne','all','ignore','union','nolimit','VIRTUAL','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','reportId','CustomReports','rows','CmContact','Tag','Tags','color','tag','ThroughTags','value','squareprojects','SquareProject','odbc','SquareOdbc','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','Lists','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxQueue','faxaccounts','inboundroutes','internalroutes','VoiceExtension','contexts','voicemails','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','QueueCampaigns','VoiceQueue','musiconholds','VoiceChanSpy','ivrcampaigns','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','teams','Team','voicequeues','queuecampaigns','agents','Users','admin','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','tags','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','metrics','AnalyticMetric','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','keys','filters','intersection','query','model','fields'];(function(_0x22e953,_0x10a297){var _0x2d4bdc=function(_0x3fc8f4){while(--_0x3fc8f4){_0x22e953['push'](_0x22e953['shift']());}};_0x2d4bdc(++_0x10a297);}(_0x14fb,0x19b));var _0xb14f=function(_0x5a6594,_0x1045e0){_0x5a6594=_0x5a6594-0x0;var _0x1c0cdc=_0x14fb[_0x5a6594];return _0x1c0cdc;};'use strict';var pdf=require(_0xb14f('0x0'));var emlformat=require(_0xb14f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb14f('0x2'));var jsonpatch=require(_0xb14f('0x3'));var rp=require(_0xb14f('0x4'));var moment=require(_0xb14f('0x5'));var BPromise=require(_0xb14f('0x6'));var Mustache=require(_0xb14f('0x7'));var util=require(_0xb14f('0x8'));var path=require(_0xb14f('0x9'));var sox=require(_0xb14f('0xa'));var csv=require(_0xb14f('0xb'));var ejs=require(_0xb14f('0xc'));var fs=require('fs');var _=require(_0xb14f('0xd'));var squel=require(_0xb14f('0xe'));var crypto=require('crypto');var jsforce=require(_0xb14f('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb14f('0x10'));var Papa=require(_0xb14f('0x11'));var Redis=require(_0xb14f('0x12'));var authService=require(_0xb14f('0x13'));var qs=require(_0xb14f('0x14'));var as=require(_0xb14f('0x15'));var hardwareService=require(_0xb14f('0x16'));var logger=require('../../config/logger')(_0xb14f('0x17'));var utils=require(_0xb14f('0x18'));var config=require(_0xb14f('0x19'));var db=require(_0xb14f('0x1a'))['db'];config[_0xb14f('0x1b')]=_[_0xb14f('0x1c')](config[_0xb14f('0x1b')],{'host':_0xb14f('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb14f('0x1b')]));require('./userProfile.socket')[_0xb14f('0x1e')](socket);function respondWithStatusCode(_0x2af78c,_0x5f5758){_0x5f5758=_0x5f5758||0xcc;return function(_0x1ce3fa){if(_0x1ce3fa){return _0x2af78c['sendStatus'](_0x5f5758);}return _0x2af78c[_0xb14f('0x1f')](_0x5f5758)[_0xb14f('0x20')]();};}function respondWithResult(_0xfefb00,_0x23f408){_0x23f408=_0x23f408||0xc8;return function(_0x12e7ee){if(_0x12e7ee){return _0xfefb00['status'](_0x23f408)[_0xb14f('0x21')](_0x12e7ee);}};}function respondWithFilteredResult(_0x353465,_0x223600){return function(_0x124fa3){if(_0x124fa3){var _0x893cd1=_0x124fa3[_0xb14f('0x22')],_0x19fdd5=_0x223600['offset'],_0x431084=_0x223600[_0xb14f('0x23')]+_0x223600[_0xb14f('0x24')],_0x4ca855;if(_0x431084>=_0x893cd1){_0x431084=_0x893cd1;_0x4ca855=0xc8;}else{_0x4ca855=0xce;}_0x353465[_0xb14f('0x1f')](_0x4ca855);return _0x353465[_0xb14f('0x25')](_0xb14f('0x26'),_0x19fdd5+'-'+_0x431084+'/'+_0x893cd1)[_0xb14f('0x21')](_0x124fa3);}return null;};}function patchUpdates(_0x485536){return function(_0x596a31){try{jsonpatch[_0xb14f('0x27')](_0x596a31,_0x485536,!![]);}catch(_0x2d31e4){return BPromise[_0xb14f('0x28')](_0x2d31e4);}return _0x596a31[_0xb14f('0x29')]();};}function saveUpdates(_0x6961ea,_0x140a6d){return function(_0x1dc624){if(_0x1dc624){return _0x1dc624['update'](_0x6961ea)[_0xb14f('0x2a')](function(_0x23c878){return _0x23c878;});}return null;};}function removeEntity(_0x5da044,_0x271a9d){return function(_0x9d9d37){if(_0x9d9d37){return _0x9d9d37[_0xb14f('0x2b')]()[_0xb14f('0x2a')](function(){_0x5da044[_0xb14f('0x1f')](0xcc)[_0xb14f('0x20')]();});}};}function handleEntityNotFound(_0x4607e4,_0xdeedf3){return function(_0x226946){if(!_0x226946){_0x4607e4[_0xb14f('0x2c')](0x194);}return _0x226946;};}function handleError(_0x5eccc8,_0xd59362){_0xd59362=_0xd59362||0x1f4;return function(_0x58d034){logger[_0xb14f('0x2d')](_0x58d034['stack']);if(_0x58d034[_0xb14f('0x2e')]){delete _0x58d034[_0xb14f('0x2e')];}_0x5eccc8[_0xb14f('0x1f')](_0xd59362)[_0xb14f('0x2f')](_0x58d034);};}exports[_0xb14f('0x30')]=function(_0x33833b,_0x15cb5a){var _0x3ccbf5={},_0x24c674={},_0x54a22d={'count':0x0,'rows':[]};var _0x5419d2=_[_0xb14f('0x31')](db[_0xb14f('0x32')][_0xb14f('0x33')],function(_0x2c40b6){return{'name':_0x2c40b6[_0xb14f('0x34')],'type':_0x2c40b6[_0xb14f('0x35')][_0xb14f('0x36')]};});_0x24c674['model']=_[_0xb14f('0x31')](_0x5419d2,_0xb14f('0x2e'));_0x24c674['query']=_[_0xb14f('0x37')](_0x33833b['query']);_0x24c674[_0xb14f('0x38')]=_[_0xb14f('0x39')](_0x24c674['model'],_0x24c674[_0xb14f('0x3a')]);_0x3ccbf5['attributes']=_[_0xb14f('0x39')](_0x24c674[_0xb14f('0x3b')],qs[_0xb14f('0x3c')](_0x33833b[_0xb14f('0x3a')][_0xb14f('0x3c')]));_0x3ccbf5['attributes']=_0x3ccbf5[_0xb14f('0x3d')][_0xb14f('0x3e')]?_0x3ccbf5[_0xb14f('0x3d')]:_0x24c674[_0xb14f('0x3b')];if(!_0x33833b['query'][_0xb14f('0x3f')]('nolimit')){_0x3ccbf5['limit']=qs['limit'](_0x33833b[_0xb14f('0x3a')][_0xb14f('0x24')]);_0x3ccbf5[_0xb14f('0x23')]=qs[_0xb14f('0x23')](_0x33833b[_0xb14f('0x3a')][_0xb14f('0x23')]);}_0x3ccbf5['order']=qs['sort'](_0x33833b[_0xb14f('0x3a')][_0xb14f('0x40')]);_0x3ccbf5[_0xb14f('0x41')]=qs[_0xb14f('0x38')](_[_0xb14f('0x42')](_0x33833b['query'],_0x24c674[_0xb14f('0x38')]));if(_0x33833b[_0xb14f('0x3a')]['filter']){_0x3ccbf5[_0xb14f('0x41')]=_['merge'](_0x3ccbf5['where'],{'$or':_[_0xb14f('0x31')](_0x5419d2,function(_0x4c199f){if(_0x4c199f[_0xb14f('0x35')]!=='VIRTUAL'){var _0x4165df={};_0x4165df[_0x4c199f[_0xb14f('0x2e')]]={'$like':'%'+_0x33833b['query'][_0xb14f('0x43')]+'%'};return _0x4165df;}})});}_0x3ccbf5=_[_0xb14f('0x44')]({},_0x3ccbf5,_0x33833b[_0xb14f('0x45')]);var _0x11f416={'where':_0x3ccbf5[_0xb14f('0x41')]};return db[_0xb14f('0x32')]['count'](_0x11f416)[_0xb14f('0x2a')](function(_0x5a6fc6){_0x54a22d['count']=_0x5a6fc6;if(_0x33833b[_0xb14f('0x3a')][_0xb14f('0x46')]){_0x3ccbf5[_0xb14f('0x47')]=[{'all':!![]}];}return db['UserProfile'][_0xb14f('0x48')](_0x3ccbf5);})[_0xb14f('0x2a')](function(_0x311153){_0x54a22d['rows']=_0x311153;return _0x54a22d;})[_0xb14f('0x2a')](respondWithFilteredResult(_0x15cb5a,_0x3ccbf5))['catch'](handleError(_0x15cb5a,null));};exports[_0xb14f('0x49')]=function(_0x1ddb60,_0x86f60f){var _0x3fb6e3={'raw':![],'where':{'id':_0x1ddb60['params']['id']}},_0x1c09fd={};_0x1c09fd[_0xb14f('0x3b')]=_['keys'](db[_0xb14f('0x32')]['rawAttributes']);_0x1c09fd[_0xb14f('0x3a')]=_[_0xb14f('0x37')](_0x1ddb60[_0xb14f('0x3a')]);_0x1c09fd[_0xb14f('0x38')]=_[_0xb14f('0x39')](_0x1c09fd['model'],_0x1c09fd['query']);_0x3fb6e3[_0xb14f('0x3d')]=_[_0xb14f('0x39')](_0x1c09fd[_0xb14f('0x3b')],qs['fields'](_0x1ddb60[_0xb14f('0x3a')][_0xb14f('0x3c')]));_0x3fb6e3['attributes']=_0x3fb6e3[_0xb14f('0x3d')][_0xb14f('0x3e')]?_0x3fb6e3[_0xb14f('0x3d')]:_0x1c09fd[_0xb14f('0x3b')];if(_0x1ddb60[_0xb14f('0x3a')]['includeAll']){_0x3fb6e3[_0xb14f('0x47')]=[{'all':!![]}];}_0x3fb6e3=_[_0xb14f('0x44')]({},_0x3fb6e3,_0x1ddb60[_0xb14f('0x45')]);return db[_0xb14f('0x32')][_0xb14f('0x4a')](_0x3fb6e3)[_0xb14f('0x2a')](handleEntityNotFound(_0x86f60f,null))[_0xb14f('0x2a')](respondWithResult(_0x86f60f,null))[_0xb14f('0x4b')](handleError(_0x86f60f,null));};exports[_0xb14f('0x4c')]=function(_0x517ac7,_0x33ab2b){return db['UserProfile'][_0xb14f('0x4c')](_0x517ac7[_0xb14f('0x4d')],{})[_0xb14f('0x2a')](respondWithResult(_0x33ab2b,0xc9))[_0xb14f('0x4b')](handleError(_0x33ab2b,null));};exports[_0xb14f('0x4e')]=function(_0x1b6393,_0x263d17){var _0x39f29d={'where':{'id':_0x1b6393[_0xb14f('0x4f')]['id']}},_0xf668d7={};_0xf668d7[_0xb14f('0x3b')]=_[_0xb14f('0x37')](db[_0xb14f('0x32')][_0xb14f('0x33')]);_0x39f29d[_0xb14f('0x3d')]=_[_0xb14f('0x39')](_0xf668d7[_0xb14f('0x3b')],qs[_0xb14f('0x3c')](_0x1b6393[_0xb14f('0x3a')]['fields']));_0x39f29d[_0xb14f('0x3d')]=_0x39f29d[_0xb14f('0x3d')][_0xb14f('0x3e')]?_0x39f29d['attributes']:_0xf668d7[_0xb14f('0x3b')];if(_0x1b6393[_0xb14f('0x3a')][_0xb14f('0x46')]){_0x39f29d['include']=[{'all':!![]}];}_0x39f29d=_['merge']({},_0x39f29d,_0x1b6393[_0xb14f('0x45')]);return db[_0xb14f('0x32')]['find'](_0x39f29d)[_0xb14f('0x2a')](handleEntityNotFound(_0x263d17,null))[_0xb14f('0x2a')](function(_0x2abeaf){if(_0x2abeaf){var _0x20389f=_0x2abeaf[_0xb14f('0x50')]({'plain':!![]});_0x20389f=qs[_0xb14f('0x51')](_0x20389f,['id',_0xb14f('0x52'),_0xb14f('0x53'),_0xb14f('0x54')]);_0x1b6393[_0xb14f('0x4d')]=_[_0xb14f('0x51')](_0x1b6393[_0xb14f('0x4d')],['id',_0xb14f('0x52'),'updatedAt']);return db['sequelize'][_0xb14f('0x55')](function(_0x16f16b){return db['UserProfile']['create'](_['merge'](_0x20389f,_0x1b6393['body']),{'include':_0x1b6393['query'][_0xb14f('0x46')]?[{'all':!![]}]:undefined,'transaction':_0x16f16b})[_0xb14f('0x2a')](function(_0x10cd18){var _0x2432b0=_0x10cd18[_0xb14f('0x50')]({'plain':!![]});return db['UserProfileSection'][_0xb14f('0x48')]({'where':{'userProfileId':_0x1b6393['params']['id']},'raw':!![]})[_0xb14f('0x2a')](function(_0x585c7e){if(_0x585c7e){return BPromise[_0xb14f('0x56')](_0x585c7e,function(_0x2b662e){return new BPromise(function(_0x5a5c05,_0x19066a){if(_0x2b662e[_0xb14f('0x57')]===null||_0x2b662e[_0xb14f('0x57')]===0x1)_0x5a5c05(null);return db[_0xb14f('0x58')][_0xb14f('0x48')]({'where':{'sectionId':_0x2b662e['id']},'raw':!![]})[_0xb14f('0x2a')](function(_0x583cc7){var _0x212c72=_[_0xb14f('0x31')](_0x583cc7,function(_0xfd4840){return qs[_0xb14f('0x51')](_0xfd4840,['id',_0xb14f('0x52'),_0xb14f('0x53'),_0xb14f('0x59')]);});_0x5a5c05(_0x212c72);})[_0xb14f('0x4b')](function(_0x168ffd){_0x19066a(_0x168ffd);});})[_0xb14f('0x2a')](function(_0x491a74){var _0x596843=qs['omit'](_0x2b662e,['id','createdAt','updatedAt']);_0x596843[_0xb14f('0x5a')]=_0x2432b0['id'];if(_0x491a74)_0x596843[_0xb14f('0x5b')]=_0x491a74;return _0x596843;})[_0xb14f('0x2a')](function(_0x54432e){return db['UserProfileSection']['create'](_0x54432e,{'include':[{'model':db[_0xb14f('0x58')],'as':_0xb14f('0x5b')}],'raw':!![],'transaction':_0x16f16b});});})[_0xb14f('0x2a')](function(){return _0x2432b0;});}});});});}})[_0xb14f('0x2a')](respondWithResult(_0x263d17,0xc9))[_0xb14f('0x4b')](handleError(_0x263d17,null));};exports[_0xb14f('0x5c')]=function(_0x13d8d1,_0x106c2a){if(_0x13d8d1[_0xb14f('0x4d')]['id']){delete _0x13d8d1[_0xb14f('0x4d')]['id'];}return db[_0xb14f('0x32')]['find']({'where':{'id':_0x13d8d1['params']['id']}})[_0xb14f('0x2a')](handleEntityNotFound(_0x106c2a,null))[_0xb14f('0x2a')](saveUpdates(_0x13d8d1[_0xb14f('0x4d')],null))[_0xb14f('0x2a')](respondWithResult(_0x106c2a,null))[_0xb14f('0x4b')](handleError(_0x106c2a,null));};exports[_0xb14f('0x2b')]=function(_0x14c034,_0xabc5fe){return db['UserProfile'][_0xb14f('0x4a')]({'where':{'id':_0x14c034[_0xb14f('0x4f')]['id']}})['then'](handleEntityNotFound(_0xabc5fe,null))[_0xb14f('0x2a')](removeEntity(_0xabc5fe,null))['catch'](handleError(_0xabc5fe,null));};exports[_0xb14f('0x5d')]=function(_0x1d50cd,_0x18852d){return db[_0xb14f('0x32')][_0xb14f('0x5d')]()[_0xb14f('0x2a')](respondWithResult(_0x18852d,null))[_0xb14f('0x4b')](handleError(_0x18852d,null));};exports['addSections']=function(_0x39e12b,_0x181a49){var _0x43dc31=_0x39e12b[_0xb14f('0x4d')];return db[_0xb14f('0x32')][_0xb14f('0x4a')]({'where':{'id':_0x39e12b[_0xb14f('0x4f')]['id']}})[_0xb14f('0x2a')](handleEntityNotFound(_0x181a49,null))[_0xb14f('0x2a')](function(_0xeecf9){if(_0xeecf9){return db['sequelize']['transaction'](function(_0x589d67){return db[_0xb14f('0x5e')]['destroy']({'where':{'userProfileId':_0x39e12b[_0xb14f('0x4f')]['id'],'sectionId':_[_0xb14f('0x31')](_0x43dc31,function(_0x2a8844){return _0x2a8844[_0xb14f('0x59')];})},'transaction':_0x589d67})[_0xb14f('0x2a')](function(){var _0x491a52=_['map'](_0x43dc31,function(_0x11590b){_0x11590b[_0xb14f('0x5a')]=_0x39e12b[_0xb14f('0x4f')]['id'];return _0x11590b;});var _0xada539=[];return BPromise[_0xb14f('0x56')](_0x491a52,function(_0x152543){return db[_0xb14f('0x5e')][_0xb14f('0x4c')](_0x152543,{'include':[{'model':db[_0xb14f('0x58')],'as':_0xb14f('0x5b')}],'raw':!![],'transaction':_0x589d67})[_0xb14f('0x2a')](function(_0x34fc8c){_0xada539[_0xb14f('0x5f')](_0x34fc8c[_0xb14f('0x50')]({'plain':!![]}));});})[_0xb14f('0x2a')](function(){return _0xada539;});});});}})['then'](function(_0x3bdd8f){return _0x3bdd8f;})['then'](respondWithResult(_0x181a49,null))[_0xb14f('0x4b')](handleError(_0x181a49,null));};exports[_0xb14f('0x60')]=function(_0x32195d,_0x2594c5){var _0x196edb;return db['UserProfile'][_0xb14f('0x4a')]({'where':{'id':_0x32195d[_0xb14f('0x4f')]['id']},'attributes':['id',_0xb14f('0x2e')]})[_0xb14f('0x2a')](handleEntityNotFound(_0x2594c5,null))['then'](function(_0x5b44c4){if(_0x5b44c4){_0x196edb=_0x5b44c4;return db[_0xb14f('0x5e')]['destroy']({'where':{'userProfileId':_0x32195d[_0xb14f('0x4f')]['id'],'sectionId':_0x32195d['query'][_0xb14f('0x61')]}});}})[_0xb14f('0x2a')](function(){return _0x196edb;})[_0xb14f('0x2a')](respondWithStatusCode(_0x2594c5,null))['catch'](handleError(_0x2594c5,null));};exports[_0xb14f('0x62')]=function(_0x133f62,_0x312c99){var _0x50177d=[];var _0x3bc3ad=[];return db[_0xb14f('0x5e')][_0xb14f('0x48')]({'where':{'userProfileId':_0x133f62[_0xb14f('0x4f')]['id']},'raw':!![]})['then'](function(_0x3050ac){_0x50177d=_[_0xb14f('0x43')](_0x3050ac,function(_0x18e433){return _0x18e433[_0xb14f('0x63')]===0x1||_[_0xb14f('0x64')]([0x3eb,0x709],_0x18e433[_0xb14f('0x59')]);});if(!_['isEmpty'](_0x50177d)){return _[_0xb14f('0x31')](_0x50177d,function(_0x4191b4){return _0x4191b4[_0xb14f('0x59')];});}else{return;}})[_0xb14f('0x2a')](function(_0x379487){if(_0x379487)_0x3bc3ad=_0x379487;if(_[_0xb14f('0x64')](_0x3bc3ad,0x64)){var _0xac2ca7=_[_0xb14f('0x4a')](_0x50177d,{'sectionId':0x64});return hasDefaultDashboard(_0xac2ca7)[_0xb14f('0x2a')](function(_0x5430a6){return _[_0xb14f('0x31')](_0x50177d,function(_0x303cb2){if(_0x303cb2[_0xb14f('0x59')]===0x64){_0x303cb2[_0xb14f('0x65')]=_0x5430a6;}return _0x303cb2;});});}else{return;}})['then'](function(_0x295d0f){if(_0x295d0f)_0x50177d=_0x295d0f;if(_['includes'](_0x3bc3ad,0x3eb)){var _0x13da9a=_[_0xb14f('0x4a')](_0x50177d,{'sectionId':0x3eb});return getCustomDashboards(_0x13da9a)[_0xb14f('0x2a')](function(_0x4fd92c){return _[_0xb14f('0x31')](_0x50177d,function(_0x469b40){if(_0x13da9a[_0xb14f('0x63')]){if(_0x469b40[_0xb14f('0x59')]===0x3eb){_0x469b40[_0xb14f('0x65')]=_0x4fd92c;}}else{if(_0x469b40['sectionId']===0x64){_0x469b40[_0xb14f('0x65')]=_0x4fd92c;}}return _0x469b40;});});}else{return;}})[_0xb14f('0x2a')](function(_0x222d11){if(_0x222d11)_0x50177d=_0x222d11;if(_[_0xb14f('0x64')](_0x3bc3ad,0x709)){var _0x144954=_[_0xb14f('0x4a')](_0x50177d,{'sectionId':0x709});return getPlugins(_0x144954)['then'](function(_0x7c6e58){if(_0x144954[_0xb14f('0x63')]){return _[_0xb14f('0x31')](_0x50177d,function(_0x23efad){if(_0x23efad['sectionId']===0x709){_0x23efad[_0xb14f('0x65')]=_0x7c6e58;}return _0x23efad;});}else{var _0x291d4f={'sectionId':0x76c,'enabled':0x1,'subsections':_0x7c6e58};var _0x11eb03=_['map'](_0x50177d);_0x11eb03[_0xb14f('0x5f')](_0x291d4f);return _0x11eb03;}});}else{return;}})[_0xb14f('0x2a')](function(_0x5016fd){if(_0x5016fd)_0x50177d=_0x5016fd;return _[_0xb14f('0x43')](_0x50177d,[_0xb14f('0x63'),0x1]);})[_0xb14f('0x2a')](respondWithResult(_0x312c99,null))['catch'](handleError(_0x312c99,null));};function hasDefaultDashboard(_0x52fae1){var _0xc9eb8e=[0x65];return new BPromise(function(_0x25cae6,_0x51d59d){try{if(_0x52fae1[_0xb14f('0x57')]){_0x25cae6(_0xc9eb8e);}else{return db[_0xb14f('0x58')]['findOne']({'where':{'sectionId':_0x52fae1['id']},'raw':!![]})[_0xb14f('0x2a')](function(_0x2b4450){_0x2b4450?_0x25cae6(_0xc9eb8e):_0x25cae6();});}}catch(_0x3d5c4a){_0x51d59d(_0x3d5c4a);}});}function getCustomDashboards(_0x3d6876){var _0xce68ae=[];return new BPromise(function(_0x24fd07,_0x4303d4){try{if(_0x3d6876[_0xb14f('0x57')]){return db[_0xb14f('0x66')]['findAll']({'raw':!![]})[_0xb14f('0x2a')](function(_0x4ba64d){_0x4ba64d[_0xb14f('0x67')](function(_0x4ff41a){_0xce68ae[_0xb14f('0x5f')](_0x4ff41a['id']+0x1869f);});_0x24fd07(_0xce68ae);});}else{return db[_0xb14f('0x58')][_0xb14f('0x48')]({'where':{'sectionId':_0x3d6876['id']},'raw':!![]})['then'](function(_0xa2c6c3){_0xa2c6c3[_0xb14f('0x67')](function(_0x5c7e01){_0xce68ae[_0xb14f('0x5f')](_0x5c7e01['resourceId']+0x1869f);});_0x24fd07(_0xce68ae);});}}catch(_0x50923e){_0x4303d4(_0x50923e);}});}function getPlugins(_0x5f148d){var _0x3ec480=[];return new BPromise(function(_0x7ca41c,_0x1d28be){try{if(_0x5f148d[_0xb14f('0x57')]){return db[_0xb14f('0x68')][_0xb14f('0x48')]({'raw':!![]})[_0xb14f('0x2a')](function(_0x29e55a){_0x29e55a[_0xb14f('0x67')](function(_0x36b296){_0x3ec480[_0xb14f('0x5f')](_0x36b296['id']+0x15b38);});_0x7ca41c(_0x3ec480);});}else{return db[_0xb14f('0x58')][_0xb14f('0x48')]({'where':{'sectionId':_0x5f148d['id']},'raw':!![]})[_0xb14f('0x2a')](function(_0x1a5c27){_0x1a5c27[_0xb14f('0x67')](function(_0x4bd200){_0x3ec480[_0xb14f('0x5f')](_0x4bd200[_0xb14f('0x69')]+0x15b38);});_0x7ca41c(_0x3ec480);});}}catch(_0x307219){_0x1d28be(_0x307219);}});}exports[_0xb14f('0x6a')]=function(_0x14719a,_0x54b1d7){return db[_0xb14f('0x32')]['find']({'where':{'id':_0x14719a[_0xb14f('0x4f')]['id']}})[_0xb14f('0x2a')](handleEntityNotFound(_0x54b1d7,null))['then'](function(_0x93c175){if(_0x93c175){return db[_0xb14f('0x6b')]['transaction'](function(_0x2d01ad){return db['UserProfileSection'][_0xb14f('0x48')]({'where':{'userProfileId':_0x14719a[_0xb14f('0x4f')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x5c04b1){if(_0x5c04b1){return db[_0xb14f('0x5e')][_0xb14f('0x2b')]({'where':{'userProfileId':_0x14719a[_0xb14f('0x4f')]['id'],'id':_['map'](_0x5c04b1,function(_0x1ab778){return _0x1ab778['id'];})},'transaction':_0x2d01ad});}})[_0xb14f('0x2a')](function(_0x442393){var _0x1206b2=_[_0xb14f('0x31')](_0x14719a[_0xb14f('0x4d')],function(_0x282c02){_0x282c02[_0xb14f('0x5a')]=_0x14719a[_0xb14f('0x4f')]['id'];return _0x282c02;});return db[_0xb14f('0x5e')][_0xb14f('0x6c')](_0x1206b2,{'raw':!![],'transaction':_0x2d01ad});})[_0xb14f('0x2a')](function(_0x4ab64e){var _0x498f58=_[_0xb14f('0x43')](_['map'](_0x4ab64e,function(_0x25163e){return _0x25163e[_0xb14f('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x498f58){return db[_0xb14f('0x5e')][_0xb14f('0x48')]({'where':{'userProfileId':_0x14719a['params']['id'],'sectionId':_[_0xb14f('0x31')](_0x498f58,function(_0x556493){return _0x556493[_0xb14f('0x59')];})},'attributes':['id',_0xb14f('0x59')],'raw':!![]})[_0xb14f('0x2a')](function(_0x63f832){var _0x1787e0=_['map'](_0x14719a[_0xb14f('0x4d')],function(_0x12a674){_0x12a674[_0xb14f('0x5a')]=_0x14719a['params']['id'];return _0x12a674;});return db[_0xb14f('0x58')][_0xb14f('0x6c')](_0x1787e0,{'raw':!![],'transaction':_0x2d01ad});});}})[_0xb14f('0x4b')](handleError(_0x54b1d7,null));});}})[_0xb14f('0x2a')](function(_0x2a4a7c){var _0x161c0d=_[_0xb14f('0x31')](_0x2a4a7c,function(_0x4021a3){return _0x4021a3[_0xb14f('0x50')]({'plain':!![]});});})[_0xb14f('0x2a')](respondWithResult(_0x54b1d7,null))[_0xb14f('0x4b')](handleError(_0x54b1d7,null));};exports[_0xb14f('0x6d')]=function(_0x509560,_0x5e810e,_0x39a21b){return db['UserProfile'][_0xb14f('0x4a')]({'where':{'id':_0x509560[_0xb14f('0x4f')]['id']}})[_0xb14f('0x2a')](handleEntityNotFound(_0x5e810e,null))[_0xb14f('0x2a')](function(_0x118b5d){if(_0x118b5d){return _0x118b5d[_0xb14f('0x6d')](_0x509560[_0xb14f('0x3a')][_0xb14f('0x61')]);}})[_0xb14f('0x2a')](respondWithStatusCode(_0x5e810e,null))['catch'](handleError(_0x5e810e,null));};exports['getResources']=function(_0x4d0129,_0x3e1c64){var _0x340159={'raw':![],'where':{}};var _0x3eb075={};var _0x5c154a={'count':0x0,'rows':[]};var _0x1f88cc=_0x4d0129['query'][_0xb14f('0x6e')];if(typeof _0x1f88cc===_0xb14f('0x6f')){throw new db[(_0xb14f('0x70'))][(_0xb14f('0x71'))](_0xb14f('0x72'));}var _0x4cedaa=_0x4d0129[_0xb14f('0x3a')][_0xb14f('0x73')]||![];var _0x1bfa01=getQueryModels(_0x1f88cc,_0x4cedaa);if(typeof _0x1bfa01[_0xb14f('0x74')]===_0xb14f('0x6f')){throw new db[(_0xb14f('0x70'))][(_0xb14f('0x71'))](_0xb14f('0x75')+_0x1f88cc+'\x27');}var _0x1cf1ab=[];if(!_[_0xb14f('0x76')](_0x1bfa01[_0xb14f('0x77')])){_0x1cf1ab=_0x1bfa01[_0xb14f('0x77')];}else{_0x1cf1ab=[{'name':_0x1f88cc}];}return db[_0xb14f('0x32')][_0xb14f('0x78')]({'where':{'id':_0x4d0129['params']['id']}})[_0xb14f('0x2a')](handleEntityNotFound(_0x3e1c64,null))[_0xb14f('0x2a')](function(_0x352068){if(_0x352068){var _0x2eff1c=[];for(var _0xa00270=0x0;_0xa00270<_0x1cf1ab[_0xb14f('0x3e')];_0xa00270++){_0x2eff1c['push'](db['UserProfileSection']['findOne']({'where':{'userProfileId':_0x352068['id'],'name':_0x1cf1ab[_0xa00270]['name']},'raw':!![]}));}return BPromise[_0xb14f('0x79')](_0x2eff1c);}})['then'](function(_0x361e29){var _0x2b2550=_[_0xb14f('0x43')](_0x361e29,function(_0x1b136e){return _0x1b136e?_0x1b136e:undefined;});var _0x2139f9=_[_0xb14f('0x43')](_0x1cf1ab,[_0xb14f('0x7a'),!![]]);var _0x2e84bb=_[_0xb14f('0x76')](_0x2b2550)&&_[_0xb14f('0x76')](_0x2139f9)?null:_[_0xb14f('0x7b')](_0x2139f9,_0x2b2550);if(_0x2e84bb){var _0x2af3a1=[];for(var _0x220134=0x0;_0x220134<_0x2e84bb[_0xb14f('0x3e')];_0x220134++){var _0xeba9d3=_[_0xb14f('0x4a')](_0x1cf1ab,function(_0x13d106){return _0x2e84bb[_0x220134]?_0x13d106[_0xb14f('0x2e')]===_0x2e84bb[_0x220134]['name']:null;});if(_0xeba9d3){if(_0x2e84bb[_0x220134][_0xb14f('0x7a')]){_0x2af3a1[_0xb14f('0x5f')](getAllResources(_0x1bfa01['childModel'],_0x2e84bb[_0x220134]));}else{if(!_0x2e84bb[_0x220134][_0xb14f('0x57')]){_0x2af3a1[_0xb14f('0x5f')](getAllowedResources(_0xeba9d3,_0x2e84bb[_0x220134],_0x1bfa01['childModel']));}else{if(_0xeba9d3[_0xb14f('0x3b')]){_0x2af3a1['push'](getAllFilteredResources(_0xeba9d3,_0x2e84bb[_0x220134]));}}}}}return BPromise['all'](_0x2af3a1);}else{return null;}})[_0xb14f('0x2a')](function(_0x259f5f){var _0x3d257f=_0x259f5f;var _0x471c80=null;if(_0x3d257f){_0x471c80=_0x3d257f[_0xb14f('0x3e')]===0x1?_0x3d257f[0x0]:null;}if(_0x471c80||_0x3d257f){var _0x2935d6=db[_0x1bfa01['childModel']][_0xb14f('0x33')];_0x3eb075[_0xb14f('0x3b')]=_[_0xb14f('0x37')](_0x2935d6);_0x3eb075['query']=_['keys'](_0x4d0129['query']);_0x3eb075['filters']=_[_0xb14f('0x39')](_0x3eb075[_0xb14f('0x3b')],_0x3eb075[_0xb14f('0x3a')]);_0x340159[_0xb14f('0x3d')]=_['intersection'](_0x3eb075[_0xb14f('0x3b')],qs[_0xb14f('0x3c')](_0x4d0129[_0xb14f('0x3a')][_0xb14f('0x3c')]));_0x340159[_0xb14f('0x3d')]=_0x340159[_0xb14f('0x3d')][_0xb14f('0x3e')]?_0x340159[_0xb14f('0x3d')]:_0x3eb075[_0xb14f('0x3b')];if(!_0x4d0129[_0xb14f('0x3a')][_0xb14f('0x3f')](_0xb14f('0x7c'))){_0x340159[_0xb14f('0x24')]=qs[_0xb14f('0x24')](_0x4d0129[_0xb14f('0x3a')][_0xb14f('0x24')]);_0x340159['offset']=qs['offset'](_0x4d0129[_0xb14f('0x3a')]['offset']);}_0x340159['order']=qs['sort'](_0x4d0129[_0xb14f('0x3a')][_0xb14f('0x40')]);_0x340159['where']=qs[_0xb14f('0x38')](_[_0xb14f('0x42')](_0x4d0129[_0xb14f('0x3a')],_0x3eb075[_0xb14f('0x38')]));if(_0x4d0129[_0xb14f('0x3a')]['filter']){_0x340159['where']=_['merge'](_0x340159['where'],{'$or':_['map'](_0x2935d6,function(_0x22a782){if(_0x22a782['type'][_0xb14f('0x36')]!==_0xb14f('0x7d')){var _0x382a7b={};_0x382a7b[_0x22a782[_0xb14f('0x7e')]]={'$like':'%'+_0x4d0129[_0xb14f('0x3a')][_0xb14f('0x43')]+'%'};return _0x382a7b;}})});}var _0x147645=[];if(_0x471c80){var _0x590553=_[_0xb14f('0x4a')](_0x1cf1ab,['name',_0x471c80[_0xb14f('0x2e')]]);if(_0x590553['field']){var _0x3ff1c8={};if(_0x1bfa01['childModel']===_0xb14f('0x7f')){_0x3ff1c8[_0x590553[_0xb14f('0x80')]]=_[_0xb14f('0x31')](_0x471c80[_0xb14f('0x81')],'id');}else{_0x3ff1c8[_0x590553['foreignKey']]=_0x471c80['associatedResources'];}_0x147645['push'](_0x3ff1c8);}else{_0x340159[_0xb14f('0x41')]['id']=_0x471c80[_0xb14f('0x81')];}}else{for(var _0x5374b7=0x0;_0x5374b7<_0x3d257f[_0xb14f('0x3e')];_0x5374b7++){var _0x590553=_[_0xb14f('0x4a')](_0x1cf1ab,[_0xb14f('0x2e'),_0x3d257f[_0x5374b7][_0xb14f('0x2e')]]);if(_0x590553[_0xb14f('0x7e')]){var _0x3ff1c8={};_0x3ff1c8[_0x590553[_0xb14f('0x80')]]=_0x3d257f[_0x5374b7][_0xb14f('0x81')];_0x147645[_0xb14f('0x5f')](_0x3ff1c8);}else{if(!_0x340159[_0xb14f('0x41')]['id'])_0x340159[_0xb14f('0x41')]['id']=[];_0x3d257f[_0x5374b7][_0xb14f('0x81')]['forEach'](function(_0x325c1d){_0x340159['where']['id'][_0xb14f('0x5f')](_0x325c1d);});}}}if(!_['isEmpty'](_0x147645)){_0x340159[_0xb14f('0x41')]=_[_0xb14f('0x44')](_0x340159['where'],{'$and':{'$or':_0x147645}});}_0x340159=_[_0xb14f('0x44')]({},_0x340159,_0x4d0129['options']);if(_0x471c80&&!_0x471c80[_0xb14f('0x57')]&&_0x1bfa01[_0xb14f('0x74')]===_0xb14f('0x7f')){if(_0x4d0129[_0xb14f('0x3a')][_0xb14f('0x46')]){_0x340159['include']=[{'all':!![]}];}return db[_0x1bfa01[_0xb14f('0x74')]][_0xb14f('0x48')](_0x340159)['then'](function(_0x351b97){var _0x5a23d3=[];_0x351b97[_0xb14f('0x67')](function(_0x5643c4){var _0x2e5227;switch(_0x5643c4[_0xb14f('0x82')]){case'default':_0x2e5227=_[_0xb14f('0x4a')](_0x471c80['associatedResources'],function(_0x3ea421){return _0x3ea421['id']===_0x5643c4['reportId']&&_0x3ea421[_0xb14f('0x35')]==='DefaultReports';});break;case'custom':_0x2e5227=_[_0xb14f('0x4a')](_0x471c80[_0xb14f('0x81')],function(_0x4c699d){return _0x4c699d['id']===_0x5643c4[_0xb14f('0x83')]&&_0x4c699d[_0xb14f('0x35')]===_0xb14f('0x84');});break;}if(_0x2e5227)_0x5a23d3[_0xb14f('0x5f')](_0x5643c4);});_0x5c154a[_0xb14f('0x22')]=_0x5a23d3[_0xb14f('0x3e')];_0x5c154a[_0xb14f('0x85')]=_0x5a23d3;return _0x5c154a;});}else{return db[_0x1bfa01[_0xb14f('0x74')]][_0xb14f('0x22')]({'where':_0x340159[_0xb14f('0x41')]})[_0xb14f('0x2a')](function(_0x2839f8){_0x5c154a['count']=_0x2839f8;if(_0x4d0129[_0xb14f('0x3a')]['includeAll']){if(_0x1bfa01[_0xb14f('0x74')]===_0xb14f('0x86')){_0x340159['include']=[{'model':db[_0xb14f('0x87')],'as':_0xb14f('0x88'),'attributes':['id',_0xb14f('0x2e'),_0xb14f('0x89')],'required':_0x4d0129[_0xb14f('0x3a')][_0xb14f('0x8a')]?!![]:![]},{'model':db[_0xb14f('0x87')],'as':_0xb14f('0x8b'),'attributes':['id',_0xb14f('0x2e'),_0xb14f('0x89')],'through':_0x4d0129[_0xb14f('0x3a')][_0xb14f('0x8a')]?{'attributes':[],'where':{'TagId':_0x4d0129[_0xb14f('0x3a')][_0xb14f('0x8a')]||undefined}}:{},'required':_0x4d0129[_0xb14f('0x3a')][_0xb14f('0x8a')]?!![]:![]}];}else{_0x340159[_0xb14f('0x47')]=[{'all':!![]}];}}return db[_0x1bfa01['childModel']]['findAll'](_0x340159);})['then'](function(_0x1c4ebd){_0x5c154a['rows']=_0x1c4ebd;return _0x5c154a;});}}else{return _0x5c154a;}})[_0xb14f('0x2a')](respondWithFilteredResult(_0x3e1c64,_0x340159))[_0xb14f('0x4b')](handleError(_0x3e1c64,null));};function getAllResources(_0x6a2f77,_0x2e68f3){return new BPromise(function(_0x224c74,_0x228bb4){if(_0x2e68f3){var _0x531067=_0x2e68f3[_0xb14f('0x43')]?{[_0x2e68f3[_0xb14f('0x43')]['field']]:_0x2e68f3[_0xb14f('0x43')][_0xb14f('0x8c')]}:undefined;return db[_0x6a2f77][_0xb14f('0x48')]({'where':_0x531067,'raw':!![]})[_0xb14f('0x2a')](function(_0x5ade2c){_0x2e68f3[_0xb14f('0x81')]=_[_0xb14f('0x31')](_0x5ade2c,'id');_0x224c74(_0x2e68f3);})['catch'](function(_0x24b1f4){_0x228bb4(_0x24b1f4);});}else{_0x224c74(null);}});}function getAllFilteredResources(_0x1d7715,_0x46d496){return new BPromise(function(_0x351a7d,_0x5f5c5c){var _0x2c4bd8=_0x1d7715[_0xb14f('0x43')]?{[_0x1d7715[_0xb14f('0x43')][_0xb14f('0x7e')]]:_0x1d7715['filter'][_0xb14f('0x8c')]}:undefined;return db[_0x1d7715[_0xb14f('0x3b')]]['findAll']({'where':_0x2c4bd8,'raw':!![]})[_0xb14f('0x2a')](function(_0x2b9b8c){_0x46d496['associatedResources']=_[_0xb14f('0x31')](_0x2b9b8c,function(_0x2d37a7){return _0x2d37a7[_0xb14f('0x2e')];});_0x351a7d(_0x46d496);})['catch'](function(_0x1b4590){_0x5f5c5c(_0x1b4590);});});}function getAllowedResources(_0x7683f8,_0x120066,_0x8f70cf){return new BPromise(function(_0x366a1c,_0x33842d){if(_0x120066){return db['UserProfileResource'][_0xb14f('0x48')]({'where':{'sectionId':_0x120066['id']},'raw':!![]})[_0xb14f('0x2a')](function(_0x3b1f61){if(_0x7683f8[_0xb14f('0x7e')]&&_0x7683f8['field']!=='id'){_0x120066['associatedResources']=_[_0xb14f('0x31')](_0x3b1f61,function(_0x338463){return _0x338463[_0x7683f8[_0xb14f('0x7e')]];});}else{if(_0x8f70cf==='AnalyticExtractedReport'){_0x120066[_0xb14f('0x81')]=_[_0xb14f('0x31')](_0x3b1f61,function(_0x110d07){return{'id':_0x110d07[_0xb14f('0x69')],'type':_0x110d07[_0xb14f('0x35')]};});}else{_0x120066['associatedResources']=_[_0xb14f('0x31')](_0x3b1f61,function(_0x3dd7fc){return _0x3dd7fc['resourceId'];});}}_0x366a1c(_0x120066);})[_0xb14f('0x4b')](function(_0x307893){_0x33842d(_0x307893);});}else{_0x366a1c(null);}});}function getQueryModels(_0x32162e,_0x3e89fb){var _0x55edde=_0x32162e['toLowerCase']();var _0x1da1d6={'childModel':undefined,'parentSections':[]};switch(_0x55edde){case _0xb14f('0x8d'):_0x1da1d6[_0xb14f('0x74')]=_0xb14f('0x8e');break;case _0xb14f('0x8f'):_0x1da1d6['childModel']=_0xb14f('0x90');break;case'squarerecordings':_0x1da1d6[_0xb14f('0x74')]=_0xb14f('0x91');_0x1da1d6[_0xb14f('0x77')]=[{'name':_0xb14f('0x92'),'field':_0xb14f('0x2e'),'foreignKey':_0xb14f('0x93')}];break;case _0xb14f('0x94'):_0x1da1d6['childModel']=_0xb14f('0x95');break;case _0xb14f('0x96'):_0x1da1d6[_0xb14f('0x74')]='CmContact';_0x1da1d6[_0xb14f('0x77')]=[{'name':_0xb14f('0x97'),'field':'id','foreignKey':'ListId'}];break;case _0xb14f('0x98'):_0x1da1d6[_0xb14f('0x74')]=_0xb14f('0x99');break;case _0xb14f('0x9a'):_0x1da1d6[_0xb14f('0x74')]=_0xb14f('0x9b');break;case _0xb14f('0x9c'):_0x1da1d6[_0xb14f('0x74')]=_0xb14f('0x9d');break;case _0xb14f('0x9e'):_0x1da1d6[_0xb14f('0x74')]=_0xb14f('0x9f');break;case'chatwebsites':_0x1da1d6[_0xb14f('0x74')]=_0xb14f('0xa0');break;case _0xb14f('0xa1'):_0x1da1d6[_0xb14f('0x74')]=_0xb14f('0xa2');break;case _0xb14f('0xa3'):_0x1da1d6[_0xb14f('0x74')]='FaxAccount';break;case _0xb14f('0xa4'):case _0xb14f('0xa5'):case'outboundroutes':_0x1da1d6[_0xb14f('0x74')]=_0xb14f('0xa6');break;case _0xb14f('0xa7'):_0x1da1d6['childModel']='VoiceContext';break;case _0xb14f('0xa8'):_0x1da1d6[_0xb14f('0x74')]='VoiceMail';break;case'voicerecordings':_0x1da1d6[_0xb14f('0x74')]=_0xb14f('0xa9');_0x1da1d6[_0xb14f('0x77')]=[{'name':_0xb14f('0xaa'),'field':'name','foreignKey':_0xb14f('0xab'),'model':_0xb14f('0xac'),'filter':{'field':_0xb14f('0xad'),'value':[_0xb14f('0xae')]}},{'name':_0xb14f('0xaf'),'field':_0xb14f('0x2e'),'foreignKey':_0xb14f('0xab'),'model':'User','filter':{'field':_0xb14f('0xad'),'value':[_0xb14f('0xb0')]}},{'name':_0xb14f('0xb1'),'field':_0xb14f('0x2e'),'foreignKey':_0xb14f('0xb2'),'model':'VoiceQueue','filter':{'field':_0xb14f('0x35'),'value':['inbound']}},{'name':_0xb14f('0xb3'),'field':_0xb14f('0x2e'),'foreignKey':'queue','model':_0xb14f('0xb4'),'filter':{'field':'type','value':['outbound']}}];break;case _0xb14f('0xb5'):_0x1da1d6[_0xb14f('0x74')]='VoiceMusicOnHold';break;case'chanspies':_0x1da1d6[_0xb14f('0x74')]=_0xb14f('0xb6');break;case'voiceprefixes':_0x1da1d6[_0xb14f('0x74')]='VoicePrefix';break;case _0xb14f('0xb7'):_0x1da1d6[_0xb14f('0x74')]='Campaign';break;case _0xb14f('0xb8'):_0x1da1d6[_0xb14f('0x74')]=_0xb14f('0xb9');break;case _0xb14f('0xba'):_0x1da1d6[_0xb14f('0x74')]=_0xb14f('0xbb');break;case _0xb14f('0xbc'):_0x1da1d6[_0xb14f('0x74')]='MailSubstatus';break;case _0xb14f('0xbd'):_0x1da1d6[_0xb14f('0x74')]=_0xb14f('0xbe');break;case _0xb14f('0xbf'):_0x1da1d6['childModel']=_0xb14f('0xc0');break;case _0xb14f('0xc1'):_0x1da1d6['childModel']=_0xb14f('0xc2');break;case'smsaccounts':_0x1da1d6[_0xb14f('0x74')]=_0xb14f('0xc3');break;case _0xb14f('0xc4'):_0x1da1d6[_0xb14f('0x74')]=_0xb14f('0xc5');break;case _0xb14f('0xc6'):case _0xb14f('0xc7'):_0x1da1d6[_0xb14f('0x74')]=_0xb14f('0xb4');if(_0x3e89fb){_0x1da1d6['parentSections']=[{'name':_0xb14f('0xb1')},{'name':_0xb14f('0xb3')}];}break;case'users':case _0xb14f('0xc8'):case'telephones':_0x1da1d6['childModel']='User';if(_0x3e89fb){_0x1da1d6[_0xb14f('0x77')]=[{'name':_0xb14f('0xc9'),'filter':{'field':_0xb14f('0xad'),'value':[_0xb14f('0xca'),'user']},'ignore':!![]},{'name':_0xb14f('0xaa')},{'name':_0xb14f('0xaf')}];}break;case _0xb14f('0xcb'):_0x1da1d6[_0xb14f('0x74')]='ZendeskAccount';break;case _0xb14f('0xcc'):_0x1da1d6[_0xb14f('0x74')]=_0xb14f('0xcd');break;case _0xb14f('0xce'):_0x1da1d6[_0xb14f('0x74')]=_0xb14f('0xcf');break;case _0xb14f('0xd0'):_0x1da1d6['childModel']='SugarcrmAccount';break;case _0xb14f('0xd1'):_0x1da1d6[_0xb14f('0x74')]=_0xb14f('0xd2');break;case'zohoaccounts':_0x1da1d6[_0xb14f('0x74')]=_0xb14f('0xd3');break;case _0xb14f('0xd4'):_0x1da1d6[_0xb14f('0x74')]=_0xb14f('0xac');break;case _0xb14f('0xd5'):_0x1da1d6[_0xb14f('0x74')]=_0xb14f('0xd6');break;case _0xb14f('0xd7'):_0x1da1d6[_0xb14f('0x74')]=_0xb14f('0xd8');break;case _0xb14f('0xd9'):_0x1da1d6[_0xb14f('0x74')]=_0xb14f('0x66');break;case _0xb14f('0xda'):_0x1da1d6[_0xb14f('0x74')]=_0xb14f('0xdb');break;case _0xb14f('0xdc'):_0x1da1d6[_0xb14f('0x74')]=_0xb14f('0xdd');break;case _0xb14f('0xde'):_0x1da1d6[_0xb14f('0x74')]=_0xb14f('0xdf');break;case _0xb14f('0xe0'):_0x1da1d6[_0xb14f('0x74')]='Sound';break;case _0xb14f('0xe1'):_0x1da1d6[_0xb14f('0x74')]='Tag';break;case'templates':_0x1da1d6['childModel']=_0xb14f('0xe2');break;case _0xb14f('0xe3'):_0x1da1d6[_0xb14f('0x74')]=_0xb14f('0xe4');break;case _0xb14f('0xe5'):_0x1da1d6[_0xb14f('0x74')]=_0xb14f('0xe6');break;case _0xb14f('0xe7'):_0x1da1d6['childModel']=_0xb14f('0xe8');break;case _0xb14f('0xe9'):_0x1da1d6['childModel']=_0xb14f('0x68');break;case'extractedreports':_0x1da1d6[_0xb14f('0x74')]=_0xb14f('0x7f');_0x1da1d6[_0xb14f('0x77')]=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case _0xb14f('0xea'):_0x1da1d6[_0xb14f('0x74')]=_0xb14f('0xeb');break;default:return _0x1da1d6;}return _0x1da1d6;} \ No newline at end of file +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 diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 6bdee9e..77206bd 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 _0x2539=['update','remove','emit','hasOwnProperty','hook','exports','events','UserProfile','setMaxListeners','save'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x2539,0x1d2));var _0x9253=function(_0x51ff76,_0x51b058){_0x51ff76=_0x51ff76-0x0;var _0x17055c=_0x2539[_0x51ff76];return _0x17055c;};'use strict';var EventEmitter=require(_0x9253('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x9253('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x9253('0x2')](0x0);var events={'afterCreate':_0x9253('0x3'),'afterUpdate':_0x9253('0x4'),'afterDestroy':_0x9253('0x5')};function emitEvent(_0xab6397){return function(_0x3d91b2,_0x529123,_0x2212db){UserProfileEvents[_0x9253('0x6')](_0xab6397+':'+_0x3d91b2['id'],_0x3d91b2);UserProfileEvents[_0x9253('0x6')](_0xab6397,_0x3d91b2);_0x2212db(null);};}for(var e in events){if(events[_0x9253('0x7')](e)){var event=events[e];UserProfile[_0x9253('0x8')](e,emitEvent(event));}}module[_0x9253('0x9')]=UserProfileEvents; \ No newline at end of file +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 diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 38986b6..bc85835 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 _0x2818=['bluebird','rimraf','../../config/environment','./userProfile.attributes','define','UserProfile','user_profiles','lodash','util','../../config/logger','api','moment'];(function(_0x3e969a,_0x2eaa03){var _0x4ddfc7=function(_0x5eac10){while(--_0x5eac10){_0x3e969a['push'](_0x3e969a['shift']());}};_0x4ddfc7(++_0x2eaa03);}(_0x2818,0x133));var _0x8281=function(_0x2b81dd,_0x1c58b2){_0x2b81dd=_0x2b81dd-0x0;var _0x2b2bbf=_0x2818[_0x2b81dd];return _0x2b2bbf;};'use strict';var _=require(_0x8281('0x0'));var util=require(_0x8281('0x1'));var logger=require(_0x8281('0x2'))(_0x8281('0x3'));var moment=require(_0x8281('0x4'));var BPromise=require(_0x8281('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8281('0x6'));var config=require(_0x8281('0x7'));var attributes=require(_0x8281('0x8'));module['exports']=function(_0x143ba8,_0x3ef000){return _0x143ba8[_0x8281('0x9')](_0x8281('0xa'),attributes,{'tableName':_0x8281('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index afdb146..a0648ca 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 _0x207c=['debug','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','redis','defaults','localhost','socket.io-emitter','register','info','request\x20sent'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x207c,0x1e8));var _0xc207=function(_0x48c1bf,_0x2e76bf){_0x48c1bf=_0x48c1bf-0x0;var _0x3172b7=_0x207c[_0x48c1bf];return _0x3172b7;};'use strict';var _=require('lodash');var util=require(_0xc207('0x0'));var moment=require(_0xc207('0x1'));var BPromise=require(_0xc207('0x2'));var rs=require(_0xc207('0x3'));var fs=require('fs');var Redis=require(_0xc207('0x4'));var db=require(_0xc207('0x5'))['db'];var utils=require(_0xc207('0x6'));var logger=require('../../config/logger')(_0xc207('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc207('0x8')]({'port':0x232a});config[_0xc207('0x9')]=_[_0xc207('0xa')](config['redis'],{'host':_0xc207('0xb'),'port':0x18eb});var socket=require(_0xc207('0xc'))(new Redis(config[_0xc207('0x9')]));require('./userProfile.socket')[_0xc207('0xd')](socket);function respondWithRpcPromise(_0x817576,_0x216e14,_0x13ec41){return new BPromise(function(_0x201162,_0x347549){return client['request'](_0x817576,_0x13ec41)['then'](function(_0x5b556f){logger[_0xc207('0xe')]('UserProfile,\x20%s,\x20%s',_0x216e14,_0xc207('0xf'));logger[_0xc207('0x10')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x216e14,_0xc207('0xf'),JSON[_0xc207('0x11')](_0x5b556f));if(_0x5b556f[_0xc207('0x12')]){if(_0x5b556f[_0xc207('0x12')][_0xc207('0x13')]===0x1f4){logger['error'](_0xc207('0x14'),_0x216e14,_0x5b556f[_0xc207('0x12')][_0xc207('0x15')]);return _0x347549(_0x5b556f[_0xc207('0x12')]['message']);}logger['error']('UserProfile,\x20%s,\x20%s',_0x216e14,_0x5b556f[_0xc207('0x12')][_0xc207('0x15')]);return _0x201162(_0x5b556f[_0xc207('0x12')][_0xc207('0x15')]);}else{logger['info'](_0xc207('0x14'),_0x216e14,_0xc207('0xf'));_0x201162(_0x5b556f[_0xc207('0x16')]['message']);}})[_0xc207('0x17')](function(_0x488cc0){logger[_0xc207('0x12')](_0xc207('0x14'),_0x216e14,_0x488cc0);_0x347549(_0x488cc0);});});} \ No newline at end of file +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 diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 09d975c..862957a 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 _0x6a16=['save','update','removeListener','length','./userProfile.events'];(function(_0x2f8192,_0x78544c){var _0x6c447b=function(_0x5ca5e8){while(--_0x5ca5e8){_0x2f8192['push'](_0x2f8192['shift']());}};_0x6c447b(++_0x78544c);}(_0x6a16,0x162));var _0x66a1=function(_0x2870a8,_0x385dec){_0x2870a8=_0x2870a8-0x0;var _0x56686a=_0x6a16[_0x2870a8];return _0x56686a;};'use strict';var UserProfileEvents=require(_0x66a1('0x0'));var events=[_0x66a1('0x1'),'remove',_0x66a1('0x2')];function createListener(_0x125f99,_0x415f0e){return function(_0x2e968d){_0x415f0e['emit'](_0x125f99,_0x2e968d);};}function removeListener(_0x46f58f,_0x21bf8e){return function(){UserProfileEvents[_0x66a1('0x3')](_0x46f58f,_0x21bf8e);};}exports['register']=function(_0x53b86f){for(var _0x4eaffc=0x0,_0x5201d4=events[_0x66a1('0x4')];_0x4eaffc<_0x5201d4;_0x4eaffc++){var _0x2cf5cf=events[_0x4eaffc];var _0x1e8a84=createListener('userProfile:'+_0x2cf5cf,_0x53b86f);UserProfileEvents['on'](_0x2cf5cf,_0x1e8a84);}}; \ No newline at end of file +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 diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 0f9ca5c..609646f 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 _0xdd7e=['../../config/environment','get','isAuthenticated','index','/describe','describe','show','create','update','delete','/:id','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x53d53c,_0x357fbb){var _0x2f4216=function(_0x394fa1){while(--_0x394fa1){_0x53d53c['push'](_0x53d53c['shift']());}};_0x2f4216(++_0x357fbb);}(_0xdd7e,0x124));var _0xedd7=function(_0x37fdda,_0x1f4355){_0x37fdda=_0x37fdda-0x0;var _0x415ff5=_0xdd7e[_0x37fdda];return _0x415ff5;};'use strict';var multer=require(_0xedd7('0x0'));var util=require(_0xedd7('0x1'));var path=require(_0xedd7('0x2'));var timeout=require(_0xedd7('0x3'));var express=require(_0xedd7('0x4'));var router=express[_0xedd7('0x5')]();var auth=require(_0xedd7('0x6'));var interaction=require(_0xedd7('0x7'));var config=require(_0xedd7('0x8'));var controller=require('./userProfileResource.controller');router[_0xedd7('0x9')]('/',auth[_0xedd7('0xa')](),controller[_0xedd7('0xb')]);router['get'](_0xedd7('0xc'),auth[_0xedd7('0xa')](),controller[_0xedd7('0xd')]);router[_0xedd7('0x9')]('/:id',auth[_0xedd7('0xa')](),controller[_0xedd7('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xedd7('0xf')]);router['put']('/:id',auth[_0xedd7('0xa')](),controller[_0xedd7('0x10')]);router[_0xedd7('0x11')](_0xedd7('0x12'),auth[_0xedd7('0xa')](),controller['destroy']);module[_0xedd7('0x13')]=router; \ No newline at end of file +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 diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index d253334..7ee83e1 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 _0x4885=['INTEGER','exports','STRING'];(function(_0x4cdd3e,_0x136784){var _0x3a83b0=function(_0x4a192b){while(--_0x4a192b){_0x4cdd3e['push'](_0x4cdd3e['shift']());}};_0x3a83b0(++_0x136784);}(_0x4885,0x1ae));var _0x5488=function(_0x1cb24b,_0x3e205c){_0x1cb24b=_0x1cb24b-0x0;var _0x2f53ba=_0x4885[_0x1cb24b];return _0x2f53ba;};'use strict';var Sequelize=require('sequelize');module[_0x5488('0x0')]={'name':{'type':Sequelize[_0x5488('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x5488('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5488('0x1')],'allowNull':![]}}; \ No newline at end of file +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 diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 8513105..c9867d8 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 _0x1de4=['intersection','fields','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','filters','length','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../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','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','keys','attributes'];(function(_0x2fbcf6,_0x2e7155){var _0x3e7265=function(_0x15a3c3){while(--_0x15a3c3){_0x2fbcf6['push'](_0x2fbcf6['shift']());}};_0x3e7265(++_0x2e7155);}(_0x1de4,0xa7));var _0x41de=function(_0xff22d8,_0x3b8fc2){_0xff22d8=_0xff22d8-0x0;var _0x2ba668=_0x1de4[_0xff22d8];return _0x2ba668;};'use strict';var pdf=require(_0x41de('0x0'));var emlformat=require(_0x41de('0x1'));var rimraf=require(_0x41de('0x2'));var zipdir=require(_0x41de('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x41de('0x4'));var BPromise=require(_0x41de('0x5'));var Mustache=require(_0x41de('0x6'));var util=require('util');var path=require('path');var sox=require(_0x41de('0x7'));var csv=require(_0x41de('0x8'));var ejs=require(_0x41de('0x9'));var fs=require('fs');var _=require(_0x41de('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x41de('0xb'));var deskjs=require(_0x41de('0xc'));var toCsv=require(_0x41de('0x8'));var querystring=require(_0x41de('0xd'));var Papa=require('papaparse');var Redis=require(_0x41de('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x41de('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x41de('0x10'));var logger=require(_0x41de('0x11'))(_0x41de('0x12'));var utils=require(_0x41de('0x13'));var config=require(_0x41de('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4aa7e5,_0x244360){_0x244360=_0x244360||0xcc;return function(_0x21afe8){if(_0x21afe8){return _0x4aa7e5[_0x41de('0x15')](_0x244360);}return _0x4aa7e5[_0x41de('0x16')](_0x244360)[_0x41de('0x17')]();};}function respondWithResult(_0x4d6ada,_0x243c5a){_0x243c5a=_0x243c5a||0xc8;return function(_0x530773){if(_0x530773){return _0x4d6ada[_0x41de('0x16')](_0x243c5a)[_0x41de('0x18')](_0x530773);}};}function respondWithFilteredResult(_0x23b4f2,_0x46843a){return function(_0x2cbccb){if(_0x2cbccb){var _0x1ca779=_0x2cbccb[_0x41de('0x19')],_0x41db98=_0x46843a[_0x41de('0x1a')],_0x15ecb9=_0x46843a[_0x41de('0x1a')]+_0x46843a[_0x41de('0x1b')],_0x16bcbd;if(_0x15ecb9>=_0x1ca779){_0x15ecb9=_0x1ca779;_0x16bcbd=0xc8;}else{_0x16bcbd=0xce;}_0x23b4f2['status'](_0x16bcbd);return _0x23b4f2[_0x41de('0x1c')](_0x41de('0x1d'),_0x41db98+'-'+_0x15ecb9+'/'+_0x1ca779)[_0x41de('0x18')](_0x2cbccb);}return null;};}function patchUpdates(_0x3e55b4){return function(_0x38e4c1){try{jsonpatch[_0x41de('0x1e')](_0x38e4c1,_0x3e55b4,!![]);}catch(_0x22972b){return BPromise[_0x41de('0x1f')](_0x22972b);}return _0x38e4c1[_0x41de('0x20')]();};}function saveUpdates(_0x46f741,_0x489b29){return function(_0x1b3ef2){if(_0x1b3ef2){return _0x1b3ef2[_0x41de('0x21')](_0x46f741)[_0x41de('0x22')](function(_0x17f3a7){return _0x17f3a7;});}return null;};}function removeEntity(_0x229a8f,_0x425748){return function(_0x2d0538){if(_0x2d0538){return _0x2d0538[_0x41de('0x23')]()[_0x41de('0x22')](function(){_0x229a8f['status'](0xcc)[_0x41de('0x17')]();});}};}function handleEntityNotFound(_0xf9e0b4,_0x592805){return function(_0x1385a5){if(!_0x1385a5){_0xf9e0b4['sendStatus'](0x194);}return _0x1385a5;};}function handleError(_0x3f0bbf,_0x3d5a34){_0x3d5a34=_0x3d5a34||0x1f4;return function(_0x355339){logger[_0x41de('0x24')](_0x355339[_0x41de('0x25')]);if(_0x355339[_0x41de('0x26')]){delete _0x355339[_0x41de('0x26')];}_0x3f0bbf[_0x41de('0x16')](_0x3d5a34)['send'](_0x355339);};}exports['index']=function(_0x4788dd,_0x30af08){var _0x5d770e={},_0x3d3850={},_0x502eb0={'count':0x0,'rows':[]};var _0x1d645c=_[_0x41de('0x27')](db[_0x41de('0x28')][_0x41de('0x29')],function(_0x339012){return{'name':_0x339012[_0x41de('0x2a')],'type':_0x339012[_0x41de('0x2b')][_0x41de('0x2c')]};});_0x3d3850[_0x41de('0x2d')]=_['map'](_0x1d645c,_0x41de('0x26'));_0x3d3850[_0x41de('0x2e')]=_[_0x41de('0x2f')](_0x4788dd[_0x41de('0x2e')]);_0x3d3850['filters']=_['intersection'](_0x3d3850[_0x41de('0x2d')],_0x3d3850[_0x41de('0x2e')]);_0x5d770e[_0x41de('0x30')]=_[_0x41de('0x31')](_0x3d3850[_0x41de('0x2d')],qs[_0x41de('0x32')](_0x4788dd[_0x41de('0x2e')][_0x41de('0x32')]));_0x5d770e[_0x41de('0x30')]=_0x5d770e['attributes']['length']?_0x5d770e[_0x41de('0x30')]:_0x3d3850['model'];if(!_0x4788dd[_0x41de('0x2e')][_0x41de('0x33')]('nolimit')){_0x5d770e[_0x41de('0x1b')]=qs[_0x41de('0x1b')](_0x4788dd['query']['limit']);_0x5d770e[_0x41de('0x1a')]=qs[_0x41de('0x1a')](_0x4788dd[_0x41de('0x2e')]['offset']);}_0x5d770e[_0x41de('0x34')]=qs[_0x41de('0x35')](_0x4788dd['query'][_0x41de('0x35')]);_0x5d770e['where']=qs['filters'](_[_0x41de('0x36')](_0x4788dd[_0x41de('0x2e')],_0x3d3850['filters']));if(_0x4788dd['query'][_0x41de('0x37')]){_0x5d770e[_0x41de('0x38')]=_[_0x41de('0x39')](_0x5d770e[_0x41de('0x38')],{'$or':_[_0x41de('0x27')](_0x1d645c,function(_0x3ff952){if(_0x3ff952[_0x41de('0x2b')]!=='VIRTUAL'){var _0x430d78={};_0x430d78[_0x3ff952['name']]={'$like':'%'+_0x4788dd[_0x41de('0x2e')][_0x41de('0x37')]+'%'};return _0x430d78;}})});}_0x5d770e=_[_0x41de('0x39')]({},_0x5d770e,_0x4788dd[_0x41de('0x3a')]);var _0x18ca35={'where':_0x5d770e[_0x41de('0x38')]};return db[_0x41de('0x28')][_0x41de('0x19')](_0x18ca35)[_0x41de('0x22')](function(_0x2a2e25){_0x502eb0['count']=_0x2a2e25;if(_0x4788dd[_0x41de('0x2e')][_0x41de('0x3b')]){_0x5d770e[_0x41de('0x3c')]=[{'all':!![]}];}return db[_0x41de('0x28')][_0x41de('0x3d')](_0x5d770e);})['then'](function(_0x25773e){_0x502eb0[_0x41de('0x3e')]=_0x25773e;return _0x502eb0;})['then'](respondWithFilteredResult(_0x30af08,_0x5d770e))[_0x41de('0x3f')](handleError(_0x30af08,null));};exports[_0x41de('0x40')]=function(_0x4e8a0c,_0x5b0789){var _0x53e2be={'raw':![],'where':{'id':_0x4e8a0c[_0x41de('0x41')]['id']}},_0x23ccde={};_0x23ccde[_0x41de('0x2d')]=_[_0x41de('0x2f')](db['UserProfileResource'][_0x41de('0x29')]);_0x23ccde[_0x41de('0x2e')]=_[_0x41de('0x2f')](_0x4e8a0c[_0x41de('0x2e')]);_0x23ccde[_0x41de('0x42')]=_[_0x41de('0x31')](_0x23ccde[_0x41de('0x2d')],_0x23ccde['query']);_0x53e2be[_0x41de('0x30')]=_[_0x41de('0x31')](_0x23ccde['model'],qs[_0x41de('0x32')](_0x4e8a0c[_0x41de('0x2e')]['fields']));_0x53e2be[_0x41de('0x30')]=_0x53e2be[_0x41de('0x30')][_0x41de('0x43')]?_0x53e2be[_0x41de('0x30')]:_0x23ccde[_0x41de('0x2d')];if(_0x4e8a0c[_0x41de('0x2e')][_0x41de('0x3b')]){_0x53e2be['include']=[{'all':!![]}];}_0x53e2be=_['merge']({},_0x53e2be,_0x4e8a0c[_0x41de('0x3a')]);return db[_0x41de('0x28')][_0x41de('0x44')](_0x53e2be)[_0x41de('0x22')](handleEntityNotFound(_0x5b0789,null))['then'](respondWithResult(_0x5b0789,null))[_0x41de('0x3f')](handleError(_0x5b0789,null));};exports[_0x41de('0x45')]=function(_0x565bd1,_0x40a21e){return db['UserProfileResource'][_0x41de('0x45')](_0x565bd1[_0x41de('0x46')],{})[_0x41de('0x22')](respondWithResult(_0x40a21e,0xc9))['catch'](handleError(_0x40a21e,null));};exports[_0x41de('0x21')]=function(_0x24000a,_0x465f38){if(_0x24000a['body']['id']){delete _0x24000a['body']['id'];}return db[_0x41de('0x28')][_0x41de('0x44')]({'where':{'id':_0x24000a[_0x41de('0x41')]['id']}})[_0x41de('0x22')](handleEntityNotFound(_0x465f38,null))[_0x41de('0x22')](saveUpdates(_0x24000a[_0x41de('0x46')],null))['then'](respondWithResult(_0x465f38,null))[_0x41de('0x3f')](handleError(_0x465f38,null));};exports[_0x41de('0x23')]=function(_0x418f72,_0x927e3e){return db[_0x41de('0x28')][_0x41de('0x44')]({'where':{'id':_0x418f72[_0x41de('0x41')]['id']}})[_0x41de('0x22')](handleEntityNotFound(_0x927e3e,null))['then'](removeEntity(_0x927e3e,null))[_0x41de('0x3f')](handleError(_0x927e3e,null));};exports[_0x41de('0x47')]=function(_0x115af6,_0x166cb7){return db[_0x41de('0x28')][_0x41de('0x47')]()[_0x41de('0x22')](respondWithResult(_0x166cb7,null))[_0x41de('0x3f')](handleError(_0x166cb7,null));}; \ No newline at end of file +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 diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 7542c3f..a600007 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 _0x1e70=['sectionId','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./userProfileResource.attributes','define','compositeIndex','resourceId'];(function(_0x318126,_0x47f1c1){var _0x22fbd7=function(_0x1ddfb3){while(--_0x1ddfb3){_0x318126['push'](_0x318126['shift']());}};_0x22fbd7(++_0x47f1c1);}(_0x1e70,0x1ef));var _0x01e7=function(_0x837668,_0x1e09af){_0x837668=_0x837668-0x0;var _0x745dc6=_0x1e70[_0x837668];return _0x745dc6;};'use strict';var _=require(_0x01e7('0x0'));var util=require(_0x01e7('0x1'));var logger=require(_0x01e7('0x2'))(_0x01e7('0x3'));var moment=require(_0x01e7('0x4'));var BPromise=require('bluebird');var rp=require(_0x01e7('0x5'));var fs=require('fs');var path=require(_0x01e7('0x6'));var rimraf=require('rimraf');var config=require(_0x01e7('0x7'));var attributes=require(_0x01e7('0x8'));module['exports']=function(_0x50977f,_0x9e1982){return _0x50977f[_0x01e7('0x9')]('UserProfileResource',attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x01e7('0xa'),'fields':[_0x01e7('0xb'),_0x01e7('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 1c5c3e0..e0af430 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 _0x70f8=['error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x585eea,_0x330198){var _0x3e75f5=function(_0x16ffef){while(--_0x16ffef){_0x585eea['push'](_0x585eea['shift']());}};_0x3e75f5(++_0x330198);}(_0x70f8,0x155));var _0x870f=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x70f8[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x870f('0x0'));var util=require('util');var moment=require(_0x870f('0x1'));var BPromise=require(_0x870f('0x2'));var rs=require(_0x870f('0x3'));var fs=require('fs');var Redis=require(_0x870f('0x4'));var db=require(_0x870f('0x5'))['db'];var utils=require(_0x870f('0x6'));var logger=require(_0x870f('0x7'))(_0x870f('0x8'));var config=require(_0x870f('0x9'));var jayson=require(_0x870f('0xa'));var client=jayson[_0x870f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d5243,_0x1835b6,_0xfc15d1){return new BPromise(function(_0x13420c,_0x4b1142){return client[_0x870f('0xc')](_0x5d5243,_0xfc15d1)[_0x870f('0xd')](function(_0x2eb9d7){logger['info'](_0x870f('0xe'),_0x1835b6,_0x870f('0xf'));logger[_0x870f('0x10')](_0x870f('0x11'),_0x1835b6,_0x870f('0xf'),JSON[_0x870f('0x12')](_0x2eb9d7));if(_0x2eb9d7[_0x870f('0x13')]){if(_0x2eb9d7[_0x870f('0x13')][_0x870f('0x14')]===0x1f4){logger[_0x870f('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x1835b6,_0x2eb9d7[_0x870f('0x13')]['message']);return _0x4b1142(_0x2eb9d7['error'][_0x870f('0x15')]);}logger[_0x870f('0x13')](_0x870f('0xe'),_0x1835b6,_0x2eb9d7[_0x870f('0x13')]['message']);return _0x13420c(_0x2eb9d7[_0x870f('0x13')]['message']);}else{logger['info'](_0x870f('0xe'),_0x1835b6,_0x870f('0xf'));_0x13420c(_0x2eb9d7[_0x870f('0x16')]['message']);}})[_0x870f('0x17')](function(_0x45cf1e){logger['error'](_0x870f('0xe'),_0x1835b6,_0x45cf1e);_0x4b1142(_0x45cf1e);});});} \ No newline at end of file +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 diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index a30e529..1ccbc64 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 _0x18ea=['update','destroy','exports','multer','util','express','Router','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','create','put'];(function(_0x5aa6a8,_0x26ec27){var _0x38cf92=function(_0x5392bc){while(--_0x5392bc){_0x5aa6a8['push'](_0x5aa6a8['shift']());}};_0x38cf92(++_0x26ec27);}(_0x18ea,0xbe));var _0xa18e=function(_0x47c14f,_0x2864c1){_0x47c14f=_0x47c14f-0x0;var _0x4dcc3a=_0x18ea[_0x47c14f];return _0x4dcc3a;};'use strict';var multer=require(_0xa18e('0x0'));var util=require(_0xa18e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa18e('0x2'));var router=express[_0xa18e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xa18e('0x4'));var config=require('../../config/environment');var controller=require('./userProfileSection.controller');router[_0xa18e('0x5')]('/',auth['isAuthenticated'](),controller[_0xa18e('0x6')]);router[_0xa18e('0x5')](_0xa18e('0x7'),auth[_0xa18e('0x8')](),controller[_0xa18e('0x9')]);router['get'](_0xa18e('0xa'),auth[_0xa18e('0x8')](),controller[_0xa18e('0xb')]);router['post']('/',auth[_0xa18e('0x8')](),controller[_0xa18e('0xc')]);router[_0xa18e('0xd')](_0xa18e('0xa'),auth[_0xa18e('0x8')](),controller[_0xa18e('0xe')]);router['delete'](_0xa18e('0xa'),auth[_0xa18e('0x8')](),controller[_0xa18e('0xf')]);module[_0xa18e('0x10')]=router; \ No newline at end of file +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 diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 1ca8147..6d13873 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 _0xd493=['crudPermissions','sequelize','STRING','BOOLEAN','setDataValue','getDataValue'];(function(_0x35b0cc,_0x5e4a5f){var _0x2b69d7=function(_0x587268){while(--_0x587268){_0x35b0cc['push'](_0x35b0cc['shift']());}};_0x2b69d7(++_0x5e4a5f);}(_0xd493,0x1bd));var _0x3d49=function(_0xcdb3,_0x2ca817){_0xcdb3=_0xcdb3-0x0;var _0xb0ac22=_0xd493[_0xcdb3];return _0xb0ac22;};'use strict';var Sequelize=require(_0x3d49('0x0'));module['exports']={'name':{'type':Sequelize[_0x3d49('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x3d49('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x3d49('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x439989){this[_0x3d49('0x3')]('crudPermissions',_0x439989?_0x439989['join'](''):[]);},'get':function(){return this[_0x3d49('0x4')](_0x3d49('0x5'))?this[_0x3d49('0x4')](_0x3d49('0x5'))['split'](''):[];}}}; \ No newline at end of file +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 diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 9c3244b..66bf251 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 _0xdeab=['count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','name','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','status','end','json'];(function(_0x3a92a0,_0x359008){var _0xe1c96d=function(_0x2e0547){while(--_0x2e0547){_0x3a92a0['push'](_0x3a92a0['shift']());}};_0xe1c96d(++_0x359008);}(_0xdeab,0xc0));var _0xbdea=function(_0x540187,_0x156ba9){_0x540187=_0x540187-0x0;var _0x227027=_0xdeab[_0x540187];return _0x227027;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbdea('0x0'));var rimraf=require(_0xbdea('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbdea('0x2'));var rp=require(_0xbdea('0x3'));var moment=require(_0xbdea('0x4'));var BPromise=require(_0xbdea('0x5'));var Mustache=require(_0xbdea('0x6'));var util=require(_0xbdea('0x7'));var path=require('path');var sox=require(_0xbdea('0x8'));var csv=require(_0xbdea('0x9'));var ejs=require(_0xbdea('0xa'));var fs=require('fs');var _=require(_0xbdea('0xb'));var squel=require(_0xbdea('0xc'));var crypto=require(_0xbdea('0xd'));var jsforce=require(_0xbdea('0xe'));var deskjs=require(_0xbdea('0xf'));var toCsv=require(_0xbdea('0x9'));var querystring=require(_0xbdea('0x10'));var Papa=require(_0xbdea('0x11'));var Redis=require('ioredis');var authService=require(_0xbdea('0x12'));var qs=require(_0xbdea('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbdea('0x14'));var logger=require(_0xbdea('0x15'))(_0xbdea('0x16'));var utils=require('../../config/utils');var config=require(_0xbdea('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22c639,_0x5e9654){_0x5e9654=_0x5e9654||0xcc;return function(_0x4d6387){if(_0x4d6387){return _0x22c639['sendStatus'](_0x5e9654);}return _0x22c639[_0xbdea('0x18')](_0x5e9654)[_0xbdea('0x19')]();};}function respondWithResult(_0x67ae03,_0x273d90){_0x273d90=_0x273d90||0xc8;return function(_0x4fd6b4){if(_0x4fd6b4){return _0x67ae03['status'](_0x273d90)[_0xbdea('0x1a')](_0x4fd6b4);}};}function respondWithFilteredResult(_0x2673d9,_0x510af6){return function(_0xcd64a8){if(_0xcd64a8){var _0x30d864=_0xcd64a8[_0xbdea('0x1b')],_0x52a130=_0x510af6[_0xbdea('0x1c')],_0x3a50eb=_0x510af6['offset']+_0x510af6[_0xbdea('0x1d')],_0x340995;if(_0x3a50eb>=_0x30d864){_0x3a50eb=_0x30d864;_0x340995=0xc8;}else{_0x340995=0xce;}_0x2673d9['status'](_0x340995);return _0x2673d9[_0xbdea('0x1e')](_0xbdea('0x1f'),_0x52a130+'-'+_0x3a50eb+'/'+_0x30d864)['json'](_0xcd64a8);}return null;};}function patchUpdates(_0x2e3cb5){return function(_0x2bc5ca){try{jsonpatch[_0xbdea('0x20')](_0x2bc5ca,_0x2e3cb5,!![]);}catch(_0x26ff32){return BPromise[_0xbdea('0x21')](_0x26ff32);}return _0x2bc5ca[_0xbdea('0x22')]();};}function saveUpdates(_0x562833,_0x447b56){return function(_0xa913f3){if(_0xa913f3){return _0xa913f3['update'](_0x562833)[_0xbdea('0x23')](function(_0x46881a){return _0x46881a;});}return null;};}function removeEntity(_0x9d647d,_0x42d7d7){return function(_0x5a4919){if(_0x5a4919){return _0x5a4919[_0xbdea('0x24')]()[_0xbdea('0x23')](function(){_0x9d647d[_0xbdea('0x18')](0xcc)[_0xbdea('0x19')]();});}};}function handleEntityNotFound(_0x454cfa,_0x4b0ccb){return function(_0x44ff4e){if(!_0x44ff4e){_0x454cfa[_0xbdea('0x25')](0x194);}return _0x44ff4e;};}function handleError(_0xbe83c0,_0x3060cf){_0x3060cf=_0x3060cf||0x1f4;return function(_0x2b2a1e){logger['error'](_0x2b2a1e['stack']);if(_0x2b2a1e[_0xbdea('0x26')]){delete _0x2b2a1e[_0xbdea('0x26')];}_0xbe83c0['status'](_0x3060cf)['send'](_0x2b2a1e);};}exports[_0xbdea('0x27')]=function(_0x2eddda,_0x445749){var _0x397787={},_0x15e3ca={},_0x34fe92={'count':0x0,'rows':[]};var _0x37fd8e=_[_0xbdea('0x28')](db[_0xbdea('0x29')][_0xbdea('0x2a')],function(_0x4dcc08){return{'name':_0x4dcc08[_0xbdea('0x2b')],'type':_0x4dcc08[_0xbdea('0x2c')][_0xbdea('0x2d')]};});_0x15e3ca[_0xbdea('0x2e')]=_[_0xbdea('0x28')](_0x37fd8e,_0xbdea('0x26'));_0x15e3ca[_0xbdea('0x2f')]=_['keys'](_0x2eddda[_0xbdea('0x2f')]);_0x15e3ca[_0xbdea('0x30')]=_[_0xbdea('0x31')](_0x15e3ca[_0xbdea('0x2e')],_0x15e3ca[_0xbdea('0x2f')]);_0x397787[_0xbdea('0x32')]=_[_0xbdea('0x31')](_0x15e3ca[_0xbdea('0x2e')],qs[_0xbdea('0x33')](_0x2eddda[_0xbdea('0x2f')][_0xbdea('0x33')]));_0x397787[_0xbdea('0x32')]=_0x397787[_0xbdea('0x32')][_0xbdea('0x34')]?_0x397787[_0xbdea('0x32')]:_0x15e3ca['model'];if(!_0x2eddda[_0xbdea('0x2f')][_0xbdea('0x35')](_0xbdea('0x36'))){_0x397787[_0xbdea('0x1d')]=qs[_0xbdea('0x1d')](_0x2eddda['query'][_0xbdea('0x1d')]);_0x397787[_0xbdea('0x1c')]=qs[_0xbdea('0x1c')](_0x2eddda[_0xbdea('0x2f')][_0xbdea('0x1c')]);}_0x397787['order']=qs['sort'](_0x2eddda[_0xbdea('0x2f')][_0xbdea('0x37')]);_0x397787[_0xbdea('0x38')]=qs[_0xbdea('0x30')](_['pick'](_0x2eddda[_0xbdea('0x2f')],_0x15e3ca[_0xbdea('0x30')]));if(_0x2eddda[_0xbdea('0x2f')][_0xbdea('0x39')]){_0x397787[_0xbdea('0x38')]=_[_0xbdea('0x3a')](_0x397787[_0xbdea('0x38')],{'$or':_[_0xbdea('0x28')](_0x37fd8e,function(_0x18483e){if(_0x18483e[_0xbdea('0x2c')]!==_0xbdea('0x3b')){var _0x2537ec={};_0x2537ec[_0x18483e['name']]={'$like':'%'+_0x2eddda[_0xbdea('0x2f')]['filter']+'%'};return _0x2537ec;}})});}_0x397787=_[_0xbdea('0x3a')]({},_0x397787,_0x2eddda[_0xbdea('0x3c')]);var _0x55debf={'where':_0x397787['where']};return db[_0xbdea('0x29')][_0xbdea('0x1b')](_0x55debf)['then'](function(_0x100a53){_0x34fe92[_0xbdea('0x1b')]=_0x100a53;if(_0x2eddda[_0xbdea('0x2f')]['includeAll']){_0x397787[_0xbdea('0x3d')]=[{'all':!![]}];}return db['UserProfileSection'][_0xbdea('0x3e')](_0x397787);})[_0xbdea('0x23')](function(_0x1b6317){_0x34fe92[_0xbdea('0x3f')]=_0x1b6317;return _0x34fe92;})[_0xbdea('0x23')](respondWithFilteredResult(_0x445749,_0x397787))[_0xbdea('0x40')](handleError(_0x445749,null));};exports[_0xbdea('0x41')]=function(_0xcd19e9,_0x51b4d5){var _0x5f8e05={'raw':![],'where':{'id':_0xcd19e9[_0xbdea('0x42')]['id']}},_0x556de3={};_0x556de3[_0xbdea('0x2e')]=_['keys'](db['UserProfileSection'][_0xbdea('0x2a')]);_0x556de3['query']=_[_0xbdea('0x43')](_0xcd19e9[_0xbdea('0x2f')]);_0x556de3[_0xbdea('0x30')]=_[_0xbdea('0x31')](_0x556de3[_0xbdea('0x2e')],_0x556de3['query']);_0x5f8e05[_0xbdea('0x32')]=_['intersection'](_0x556de3[_0xbdea('0x2e')],qs['fields'](_0xcd19e9[_0xbdea('0x2f')][_0xbdea('0x33')]));_0x5f8e05[_0xbdea('0x32')]=_0x5f8e05['attributes'][_0xbdea('0x34')]?_0x5f8e05[_0xbdea('0x32')]:_0x556de3['model'];if(_0xcd19e9[_0xbdea('0x2f')][_0xbdea('0x44')]){_0x5f8e05['include']=[{'all':!![]}];}_0x5f8e05=_[_0xbdea('0x3a')]({},_0x5f8e05,_0xcd19e9[_0xbdea('0x3c')]);return db[_0xbdea('0x29')][_0xbdea('0x45')](_0x5f8e05)[_0xbdea('0x23')](handleEntityNotFound(_0x51b4d5,null))[_0xbdea('0x23')](respondWithResult(_0x51b4d5,null))[_0xbdea('0x40')](handleError(_0x51b4d5,null));};exports[_0xbdea('0x46')]=function(_0x390c4e,_0x474c12){return db[_0xbdea('0x29')]['create'](_0x390c4e[_0xbdea('0x47')],{})[_0xbdea('0x23')](respondWithResult(_0x474c12,0xc9))[_0xbdea('0x40')](handleError(_0x474c12,null));};exports['update']=function(_0x2cafe1,_0x14b61c){if(_0x2cafe1['body']['id']){delete _0x2cafe1[_0xbdea('0x47')]['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x2cafe1[_0xbdea('0x42')]['id']}})[_0xbdea('0x23')](handleEntityNotFound(_0x14b61c,null))[_0xbdea('0x23')](saveUpdates(_0x2cafe1['body'],null))['then'](respondWithResult(_0x14b61c,null))[_0xbdea('0x40')](handleError(_0x14b61c,null));};exports['destroy']=function(_0x1e1927,_0x410be6){return db['UserProfileSection'][_0xbdea('0x45')]({'where':{'id':_0x1e1927[_0xbdea('0x42')]['id']}})[_0xbdea('0x23')](handleEntityNotFound(_0x410be6,null))[_0xbdea('0x23')](removeEntity(_0x410be6,null))['catch'](handleError(_0x410be6,null));};exports[_0xbdea('0x48')]=function(_0x3c2b68,_0x2fc90a){return db[_0xbdea('0x29')][_0xbdea('0x48')]()[_0xbdea('0x23')](respondWithResult(_0x2fc90a,null))[_0xbdea('0x40')](handleError(_0x2fc90a,null));}; \ No newline at end of file +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 diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 53f085d..375d940 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 _0x3edd=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','define','UserProfileSection','user_profile_has_sections','sectionId','userProfileId','lodash'];(function(_0x20713e,_0x44f710){var _0x7d998b=function(_0x5d98ab){while(--_0x5d98ab){_0x20713e['push'](_0x20713e['shift']());}};_0x7d998b(++_0x44f710);}(_0x3edd,0x14f));var _0xd3ed=function(_0x583d46,_0x2bfbf6){_0x583d46=_0x583d46-0x0;var _0x133967=_0x3edd[_0x583d46];return _0x133967;};'use strict';var _=require(_0xd3ed('0x0'));var util=require(_0xd3ed('0x1'));var logger=require(_0xd3ed('0x2'))(_0xd3ed('0x3'));var moment=require(_0xd3ed('0x4'));var BPromise=require(_0xd3ed('0x5'));var rp=require(_0xd3ed('0x6'));var fs=require('fs');var path=require(_0xd3ed('0x7'));var rimraf=require(_0xd3ed('0x8'));var config=require(_0xd3ed('0x9'));var attributes=require(_0xd3ed('0xa'));module['exports']=function(_0x2e6483,_0x2f7100){return _0x2e6483[_0xd3ed('0xb')](_0xd3ed('0xc'),attributes,{'tableName':_0xd3ed('0xd'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xd3ed('0xe'),_0xd3ed('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 76d8167..30f3f71 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 _0xfafd=['http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x258257,_0x32042d){var _0xafb58a=function(_0x506b5a){while(--_0x506b5a){_0x258257['push'](_0x258257['shift']());}};_0xafb58a(++_0x32042d);}(_0xfafd,0xcc));var _0xdfaf=function(_0x220bc1,_0xf3bd62){_0x220bc1=_0x220bc1-0x0;var _0x41e77f=_0xfafd[_0x220bc1];return _0x41e77f;};'use strict';var _=require('lodash');var util=require(_0xdfaf('0x0'));var moment=require(_0xdfaf('0x1'));var BPromise=require(_0xdfaf('0x2'));var rs=require(_0xdfaf('0x3'));var fs=require('fs');var Redis=require(_0xdfaf('0x4'));var db=require(_0xdfaf('0x5'))['db'];var utils=require(_0xdfaf('0x6'));var logger=require(_0xdfaf('0x7'))(_0xdfaf('0x8'));var config=require(_0xdfaf('0x9'));var jayson=require(_0xdfaf('0xa'));var client=jayson[_0xdfaf('0xb')][_0xdfaf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3bbc49,_0x14e8d9,_0x57fcb8){return new BPromise(function(_0x19f205,_0x191ea3){return client[_0xdfaf('0xd')](_0x3bbc49,_0x57fcb8)[_0xdfaf('0xe')](function(_0x1372ce){logger[_0xdfaf('0xf')](_0xdfaf('0x10'),_0x14e8d9,_0xdfaf('0x11'));logger['debug'](_0xdfaf('0x12'),_0x14e8d9,_0xdfaf('0x11'),JSON[_0xdfaf('0x13')](_0x1372ce));if(_0x1372ce[_0xdfaf('0x14')]){if(_0x1372ce[_0xdfaf('0x14')]['code']===0x1f4){logger[_0xdfaf('0x14')](_0xdfaf('0x10'),_0x14e8d9,_0x1372ce[_0xdfaf('0x14')][_0xdfaf('0x15')]);return _0x191ea3(_0x1372ce[_0xdfaf('0x14')][_0xdfaf('0x15')]);}logger[_0xdfaf('0x14')](_0xdfaf('0x10'),_0x14e8d9,_0x1372ce[_0xdfaf('0x14')][_0xdfaf('0x15')]);return _0x19f205(_0x1372ce['error'][_0xdfaf('0x15')]);}else{logger[_0xdfaf('0xf')](_0xdfaf('0x10'),_0x14e8d9,'request\x20sent');_0x19f205(_0x1372ce[_0xdfaf('0x16')][_0xdfaf('0x15')]);}})[_0xdfaf('0x17')](function(_0x4a2ef5){logger['error'](_0xdfaf('0x10'),_0x14e8d9,_0x4a2ef5);_0x191ea3(_0x4a2ef5);});});} \ No newline at end of file +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 diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index ef8df7d..cb890b3 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 _0x7c96=['Router','../../components/auth/service','../../config/environment','exports','util','connect-timeout'];(function(_0x4ab9a7,_0x291df1){var _0xd08799=function(_0x32bd6a){while(--_0x32bd6a){_0x4ab9a7['push'](_0x4ab9a7['shift']());}};_0xd08799(++_0x291df1);}(_0x7c96,0x8e));var _0x67c9=function(_0x489b87,_0xd51c93){_0x489b87=_0x489b87-0x0;var _0x1823b6=_0x7c96[_0x489b87];return _0x1823b6;};'use strict';var multer=require('multer');var util=require(_0x67c9('0x0'));var path=require('path');var timeout=require(_0x67c9('0x1'));var express=require('express');var router=express[_0x67c9('0x2')]();var auth=require(_0x67c9('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x67c9('0x4'));module[_0x67c9('0x5')]=router; \ No newline at end of file +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 diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 2ad0dc3..3bf17a5 100644 --- a/server/api/userSmsQueue/userSmsQueue.attributes.js +++ b/server/api/userSmsQueue/userSmsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_0x2d000c,_0x3a9cda){var _0x5b4909=function(_0x17085f){while(--_0x17085f){_0x2d000c['push'](_0x2d000c['shift']());}};_0x5b4909(++_0x3a9cda);}(_0xe706,0xa3));var _0x6e70=function(_0x363618,_0x5ebf3a){_0x363618=_0x363618-0x0;var _0x496dee=_0xe706[_0x363618];return _0x496dee;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +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 diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 42ae4f2..f2d8c64 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 _0xcfa7=['user_has_sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','define'];(function(_0x3a5dd3,_0x164208){var _0x3cecba=function(_0x858c9f){while(--_0x858c9f){_0x3a5dd3['push'](_0x3a5dd3['shift']());}};_0x3cecba(++_0x164208);}(_0xcfa7,0x1c8));var _0x7cfa=function(_0x28d9d4,_0x245d79){_0x28d9d4=_0x28d9d4-0x0;var _0x52ed4d=_0xcfa7[_0x28d9d4];return _0x52ed4d;};'use strict';var _=require(_0x7cfa('0x0'));var util=require(_0x7cfa('0x1'));var logger=require(_0x7cfa('0x2'))(_0x7cfa('0x3'));var moment=require(_0x7cfa('0x4'));var BPromise=require(_0x7cfa('0x5'));var rp=require(_0x7cfa('0x6'));var fs=require('fs');var path=require(_0x7cfa('0x7'));var rimraf=require(_0x7cfa('0x8'));var config=require(_0x7cfa('0x9'));var attributes=require(_0x7cfa('0xa'));module['exports']=function(_0x592d3e,_0x27a116){return _0x592d3e[_0x7cfa('0xb')]('UserSmsQueue',attributes,{'tableName':_0x7cfa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index d637862..4bd0b42 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 _0x7503=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','util','bluebird','randomstring','ioredis'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7503,0x178));var _0x3750=function(_0x2ace72,_0x814809){_0x2ace72=_0x2ace72-0x0;var _0x33d102=_0x7503[_0x2ace72];return _0x33d102;};'use strict';var _=require('lodash');var util=require(_0x3750('0x0'));var moment=require('moment');var BPromise=require(_0x3750('0x1'));var rs=require(_0x3750('0x2'));var fs=require('fs');var Redis=require(_0x3750('0x3'));var db=require(_0x3750('0x4'))['db'];var utils=require(_0x3750('0x5'));var logger=require(_0x3750('0x6'))(_0x3750('0x7'));var config=require('../../config/environment');var jayson=require(_0x3750('0x8'));var client=jayson['client'][_0x3750('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1af398,_0x17df3e,_0x2391e7){return new BPromise(function(_0x223f03,_0x2170b5){return client[_0x3750('0xa')](_0x1af398,_0x2391e7)['then'](function(_0x34f9e3){logger[_0x3750('0xb')](_0x3750('0xc'),_0x17df3e,'request\x20sent');logger[_0x3750('0xd')](_0x3750('0xe'),_0x17df3e,'request\x20sent',JSON['stringify'](_0x34f9e3));if(_0x34f9e3[_0x3750('0xf')]){if(_0x34f9e3[_0x3750('0xf')][_0x3750('0x10')]===0x1f4){logger['error'](_0x3750('0xc'),_0x17df3e,_0x34f9e3[_0x3750('0xf')][_0x3750('0x11')]);return _0x2170b5(_0x34f9e3['error'][_0x3750('0x11')]);}logger[_0x3750('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x17df3e,_0x34f9e3['error'][_0x3750('0x11')]);return _0x223f03(_0x34f9e3[_0x3750('0xf')][_0x3750('0x11')]);}else{logger[_0x3750('0xb')](_0x3750('0xc'),_0x17df3e,'request\x20sent');_0x223f03(_0x34f9e3[_0x3750('0x12')][_0x3750('0x11')]);}})['catch'](function(_0x3df5a8){logger[_0x3750('0xf')](_0x3750('0xc'),_0x17df3e,_0x3df5a8);_0x2170b5(_0x3df5a8);});});} \ No newline at end of file +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 diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 8403992..6f16f74 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 _0x05b0=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x5c8827,_0x5bc5d7){var _0x50ffd5=function(_0x4121bc){while(--_0x4121bc){_0x5c8827['push'](_0x5c8827['shift']());}};_0x50ffd5(++_0x5bc5d7);}(_0x05b0,0x100));var _0x005b=function(_0x3d14db,_0x31f023){_0x3d14db=_0x3d14db-0x0;var _0x1646f3=_0x05b0[_0x3d14db];return _0x1646f3;};'use strict';var multer=require('multer');var util=require(_0x005b('0x0'));var path=require(_0x005b('0x1'));var timeout=require(_0x005b('0x2'));var express=require(_0x005b('0x3'));var router=express[_0x005b('0x4')]();var auth=require(_0x005b('0x5'));var interaction=require(_0x005b('0x6'));var config=require('../../config/environment');module[_0x005b('0x7')]=router; \ No newline at end of file +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 diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index d058e6d..1080126 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.attributes.js +++ b/server/api/userVoiceQueue/userVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_0x330adf,_0x3e6cf4){var _0x120d10=function(_0xf7d4b2){while(--_0xf7d4b2){_0x330adf['push'](_0x330adf['shift']());}};_0x120d10(++_0x3e6cf4);}(_0xe706,0xa3));var _0x6e70=function(_0x33fab6,_0x532a04){_0x33fab6=_0x33fab6-0x0;var _0x314e60=_0xe706[_0x33fab6];return _0x314e60;};'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(_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 diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index c181eee..e9de41d 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 _0xa8a8=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util'];(function(_0x5bc6ce,_0x4cd3a5){var _0x1e4602=function(_0x495295){while(--_0x495295){_0x5bc6ce['push'](_0x5bc6ce['shift']());}};_0x1e4602(++_0x4cd3a5);}(_0xa8a8,0xec));var _0x8a8a=function(_0x6b9285,_0x28c2ad){_0x6b9285=_0x6b9285-0x0;var _0x1e9fab=_0xa8a8[_0x6b9285];return _0x1e9fab;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var logger=require(_0x8a8a('0x2'))(_0x8a8a('0x3'));var moment=require('moment');var BPromise=require(_0x8a8a('0x4'));var rp=require(_0x8a8a('0x5'));var fs=require('fs');var path=require(_0x8a8a('0x6'));var rimraf=require(_0x8a8a('0x7'));var config=require(_0x8a8a('0x8'));var attributes=require(_0x8a8a('0x9'));module[_0x8a8a('0xa')]=function(_0x12db82,_0x2e8193){return _0x12db82[_0x8a8a('0xb')](_0x8a8a('0xc'),attributes,{'tableName':_0x8a8a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 6367806..6ed10ad 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 _0x9410=['jayson/promise','client','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','message','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3ad545,_0x21b73e){var _0x246c49=function(_0x3e4a5e){while(--_0x3e4a5e){_0x3ad545['push'](_0x3ad545['shift']());}};_0x246c49(++_0x21b73e);}(_0x9410,0x14b));var _0x0941=function(_0x1997ef,_0x422d07){_0x1997ef=_0x1997ef-0x0;var _0x134b73=_0x9410[_0x1997ef];return _0x134b73;};'use strict';var _=require(_0x0941('0x0'));var util=require(_0x0941('0x1'));var moment=require(_0x0941('0x2'));var BPromise=require(_0x0941('0x3'));var rs=require(_0x0941('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0941('0x5'));var logger=require(_0x0941('0x6'))(_0x0941('0x7'));var config=require(_0x0941('0x8'));var jayson=require(_0x0941('0x9'));var client=jayson[_0x0941('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7cbde0,_0x1eed74,_0x599f5f){return new BPromise(function(_0x315f1d,_0x21c6ab){return client[_0x0941('0xb')](_0x7cbde0,_0x599f5f)[_0x0941('0xc')](function(_0x25d1e9){logger[_0x0941('0xd')](_0x0941('0xe'),_0x1eed74,_0x0941('0xf'));logger[_0x0941('0x10')](_0x0941('0x11'),_0x1eed74,_0x0941('0xf'),JSON['stringify'](_0x25d1e9));if(_0x25d1e9[_0x0941('0x12')]){if(_0x25d1e9[_0x0941('0x12')]['code']===0x1f4){logger[_0x0941('0x12')](_0x0941('0xe'),_0x1eed74,_0x25d1e9[_0x0941('0x12')][_0x0941('0x13')]);return _0x21c6ab(_0x25d1e9['error'][_0x0941('0x13')]);}logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x1eed74,_0x25d1e9['error'][_0x0941('0x13')]);return _0x315f1d(_0x25d1e9['error'][_0x0941('0x13')]);}else{logger['info'](_0x0941('0xe'),_0x1eed74,_0x0941('0xf'));_0x315f1d(_0x25d1e9['result'][_0x0941('0x13')]);}})['catch'](function(_0x16da26){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x1eed74,_0x16da26);_0x21c6ab(_0x16da26);});});} \ No newline at end of file +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 diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 39c4f1e..2450b77 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 _0x0d3d=['multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0d3d,0xee));var _0xd0d3=function(_0x545168,_0x4f149f){_0x545168=_0x545168-0x0;var _0x1a633c=_0x0d3d[_0x545168];return _0x1a633c;};'use strict';var multer=require(_0xd0d3('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd0d3('0x1'));var router=express[_0xd0d3('0x2')]();var auth=require(_0xd0d3('0x3'));var interaction=require(_0xd0d3('0x4'));var config=require(_0xd0d3('0x5'));module[_0xd0d3('0x6')]=router; \ No newline at end of file +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 diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index c7c7773..361a4da 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 _0xcec2=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x27a65a,_0x4e98ff){var _0x3944c1=function(_0x11f8e4){while(--_0x11f8e4){_0x27a65a['push'](_0x27a65a['shift']());}};_0x3944c1(++_0x4e98ff);}(_0xcec2,0x191));var _0x2cec=function(_0x24d030,_0x19f953){_0x24d030=_0x24d030-0x0;var _0x133764=_0xcec2[_0x24d030];return _0x133764;};'use strict';var Sequelize=require(_0x2cec('0x0'));module[_0x2cec('0x1')]={'uniqueid':{'type':Sequelize[_0x2cec('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x2cec('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x2cec('0x3')},'UserId':{'type':Sequelize[_0x2cec('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x2cec('0x4')],'allowNull':![],'unique':_0x2cec('0x5'),'comment':_0x2cec('0x3')},'VoiceQueueId':{'type':Sequelize[_0x2cec('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x2cec('0x4')],'allowNull':![],'unique':_0x2cec('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x2cec('0x2')](0xb),'defaultValue':0x0,'comment':_0x2cec('0x3')},'paused':{'type':Sequelize[_0x2cec('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +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 diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index add6c72..6c85761 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 _0xf6ae=['hook','exports','events','UserVoiceQueueRt','update','remove','emit','hasOwnProperty'];(function(_0x4008ea,_0x259968){var _0x596f29=function(_0x4c1ea7){while(--_0x4c1ea7){_0x4008ea['push'](_0x4008ea['shift']());}};_0x596f29(++_0x259968);}(_0xf6ae,0x1aa));var _0xef6a=function(_0x1487a7,_0x408ba3){_0x1487a7=_0x1487a7-0x0;var _0x192fed=_0xf6ae[_0x1487a7];return _0x192fed;};'use strict';var EventEmitter=require(_0xef6a('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xef6a('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xef6a('0x2'),'afterDestroy':_0xef6a('0x3')};function emitEvent(_0x240be4){return function(_0x49cd5c,_0x4ba4e2,_0x36cb2d){UserVoiceQueueRtEvents[_0xef6a('0x4')](_0x240be4+':'+_0x49cd5c['id'],_0x49cd5c);UserVoiceQueueRtEvents[_0xef6a('0x4')](_0x240be4,_0x49cd5c);_0x36cb2d(null);};}for(var e in events){if(events[_0xef6a('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0xef6a('0x6')](e,emitEvent(event));}}module[_0xef6a('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +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 diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 4736d1d..ea53730 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 _0xd8e6=['lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','user_has_voice_queues_rt'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd8e6,0xfc));var _0x6d8e=function(_0x2e5945,_0x32d050){_0x2e5945=_0x2e5945-0x0;var _0x270b4a=_0xd8e6[_0x2e5945];return _0x270b4a;};'use strict';var _=require(_0x6d8e('0x0'));var util=require(_0x6d8e('0x1'));var logger=require(_0x6d8e('0x2'))(_0x6d8e('0x3'));var moment=require(_0x6d8e('0x4'));var BPromise=require('bluebird');var rp=require(_0x6d8e('0x5'));var fs=require('fs');var path=require(_0x6d8e('0x6'));var rimraf=require('rimraf');var config=require(_0x6d8e('0x7'));var attributes=require(_0x6d8e('0x8'));module[_0x6d8e('0x9')]=function(_0x101570,_0x1c19f3){return _0x101570['define'](_0x6d8e('0xa'),attributes,{'tableName':_0x6d8e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 835fb47..27bedf0 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 _0x19ad=['../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','then','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserVoiceQueueRt,\x20%s,\x20%s','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x81338c,_0x383030){var _0x7fcfe1=function(_0x44bab6){while(--_0x44bab6){_0x81338c['push'](_0x81338c['shift']());}};_0x7fcfe1(++_0x383030);}(_0x19ad,0x1cf));var _0xd19a=function(_0x34bb68,_0x5b0079){_0x34bb68=_0x34bb68-0x0;var _0x3db9fb=_0x19ad[_0x34bb68];return _0x3db9fb;};'use strict';var _=require('lodash');var util=require(_0xd19a('0x0'));var moment=require(_0xd19a('0x1'));var BPromise=require(_0xd19a('0x2'));var rs=require(_0xd19a('0x3'));var fs=require('fs');var Redis=require(_0xd19a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd19a('0x5'));var logger=require(_0xd19a('0x6'))(_0xd19a('0x7'));var config=require('../../config/environment');var jayson=require(_0xd19a('0x8'));var client=jayson[_0xd19a('0x9')]['http']({'port':0x232a});config[_0xd19a('0xa')]=_[_0xd19a('0xb')](config[_0xd19a('0xa')],{'host':_0xd19a('0xc'),'port':0x18eb});var socket=require(_0xd19a('0xd'))(new Redis(config[_0xd19a('0xa')]));require(_0xd19a('0xe'))['register'](socket);function respondWithRpcPromise(_0x9a0ca1,_0x51db44,_0x26f4f4){return new BPromise(function(_0x4570cd,_0x5adf7a){return client['request'](_0x9a0ca1,_0x26f4f4)[_0xd19a('0xf')](function(_0x171e0a){logger[_0xd19a('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x51db44,_0xd19a('0x11'));logger[_0xd19a('0x12')](_0xd19a('0x13'),_0x51db44,_0xd19a('0x11'),JSON[_0xd19a('0x14')](_0x171e0a));if(_0x171e0a[_0xd19a('0x15')]){if(_0x171e0a['error'][_0xd19a('0x16')]===0x1f4){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x51db44,_0x171e0a[_0xd19a('0x15')][_0xd19a('0x17')]);return _0x5adf7a(_0x171e0a[_0xd19a('0x15')][_0xd19a('0x17')]);}logger[_0xd19a('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x51db44,_0x171e0a[_0xd19a('0x15')][_0xd19a('0x17')]);return _0x4570cd(_0x171e0a[_0xd19a('0x15')][_0xd19a('0x17')]);}else{logger[_0xd19a('0x10')](_0xd19a('0x18'),_0x51db44,'request\x20sent');_0x4570cd(_0x171e0a[_0xd19a('0x19')][_0xd19a('0x17')]);}})['catch'](function(_0x3ee909){logger[_0xd19a('0x15')](_0xd19a('0x18'),_0x51db44,_0x3ee909);_0x5adf7a(_0x3ee909);});});}exports[_0xd19a('0x1a')]=function(_0x23bd08){var _0x367e29=this;return new Promise(function(_0x1b0e50,_0x5ce140){return db[_0xd19a('0x1b')]['findAll']({'raw':_0x23bd08[_0xd19a('0x1c')]?_0x23bd08[_0xd19a('0x1c')][_0xd19a('0x1d')]===undefined?!![]:![]:!![],'where':_0x23bd08[_0xd19a('0x1c')]?_0x23bd08[_0xd19a('0x1c')][_0xd19a('0x1e')]||null:null,'attributes':[[db[_0xd19a('0x1f')]['fn'](_0xd19a('0x20'),db[_0xd19a('0x1f')]['fn']('IF',db[_0xd19a('0x1f')]['literal'](_0xd19a('0x21')))),_0xd19a('0x22')]]})[_0xd19a('0xf')](function(_0x265d98){logger[_0xd19a('0x10')]('GetVoiceQueueRtPauses',_0x23bd08);logger[_0xd19a('0x12')](_0xd19a('0x1a'),_0x23bd08,JSON[_0xd19a('0x14')](_0x265d98));_0x1b0e50(_0x265d98);})[_0xd19a('0x23')](function(_0x48d579){logger[_0xd19a('0x15')](_0xd19a('0x1a'),_0x48d579[_0xd19a('0x17')],_0x23bd08);_0x5ce140(_0x367e29[_0xd19a('0x15')](0x1f4,_0x48d579[_0xd19a('0x17')]));});});}; \ No newline at end of file +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 diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index f55e1ad..88c30e4 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 _0x009b=['save','remove','update','emit','length'];(function(_0x2efd88,_0x517a54){var _0x30a7ac=function(_0x322b80){while(--_0x322b80){_0x2efd88['push'](_0x2efd88['shift']());}};_0x30a7ac(++_0x517a54);}(_0x009b,0x104));var _0xb009=function(_0x29e2c7,_0x36cc8b){_0x29e2c7=_0x29e2c7-0x0;var _0x5aa87=_0x009b[_0x29e2c7];return _0x5aa87;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xb009('0x0'),_0xb009('0x1'),_0xb009('0x2')];function createListener(_0x551345,_0x4b902f){return function(_0x56d649){_0x4b902f[_0xb009('0x3')](_0x551345,_0x56d649);};}function removeListener(_0x27692c,_0x1bef44){return function(){UserVoiceQueueRtEvents['removeListener'](_0x27692c,_0x1bef44);};}exports['register']=function(_0x3dac91){for(var _0xf3993f=0x0,_0x4d406c=events[_0xb009('0x4')];_0xf3993f<_0x4d406c;_0xf3993f++){var _0xcae64a=events[_0xf3993f];var _0x5973b1=createListener('userVoiceQueueRt:'+_0xcae64a,_0x3dac91);UserVoiceQueueRtEvents['on'](_0xcae64a,_0x5973b1);}}; \ No newline at end of file +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 diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index a3e1b1a..be0b9e1 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 _0x06cf=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util'];(function(_0x34883c,_0x13114a){var _0x802117=function(_0x472340){while(--_0x472340){_0x34883c['push'](_0x34883c['shift']());}};_0x802117(++_0x13114a);}(_0x06cf,0x1ef));var _0xf06c=function(_0x49057c,_0xad29d7){_0x49057c=_0x49057c-0x0;var _0xf03b3c=_0x06cf[_0x49057c];return _0xf03b3c;};'use strict';var multer=require('multer');var util=require(_0xf06c('0x0'));var path=require(_0xf06c('0x1'));var timeout=require(_0xf06c('0x2'));var express=require(_0xf06c('0x3'));var router=express['Router']();var auth=require(_0xf06c('0x4'));var interaction=require(_0xf06c('0x5'));var config=require(_0xf06c('0x6'));module[_0xf06c('0x7')]=router; \ No newline at end of file +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 diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 205f67b..139a9c5 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(_0x59a268,_0x3bd156){var _0x36733e=function(_0x3b00f9){while(--_0x3b00f9){_0x59a268['push'](_0x59a268['shift']());}};_0x36733e(++_0x3bd156);}(_0xe706,0xa3));var _0x6e70=function(_0xf4356f,_0x478f6d){_0xf4356f=_0xf4356f-0x0;var _0x3c304c=_0xe706[_0xf4356f];return _0x3c304c;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_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 diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 82bc935..122a901 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 _0x1c7c=['./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x489b87,_0xd51c93){var _0x1823b6=function(_0x451c70){while(--_0x451c70){_0x489b87['push'](_0x489b87['shift']());}};_0x1823b6(++_0xd51c93);}(_0x1c7c,0x164));var _0xc1c7=function(_0x183118,_0x555dae){_0x183118=_0x183118-0x0;var _0x2fcc7b=_0x1c7c[_0x183118];return _0x2fcc7b;};'use strict';var _=require(_0xc1c7('0x0'));var util=require(_0xc1c7('0x1'));var logger=require(_0xc1c7('0x2'))(_0xc1c7('0x3'));var moment=require('moment');var BPromise=require(_0xc1c7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc1c7('0x5'));var rimraf=require(_0xc1c7('0x6'));var config=require(_0xc1c7('0x7'));var attributes=require(_0xc1c7('0x8'));module[_0xc1c7('0x9')]=function(_0x364dde,_0x1f3e21){return _0x364dde[_0xc1c7('0xa')](_0xc1c7('0xb'),attributes,{'tableName':_0xc1c7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 009f1ea..6a0a7f6 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(_0x59503b,_0x471b87){var _0x1728f0=function(_0x5e9c58){while(--_0x5e9c58){_0x59503b['push'](_0x59503b['shift']());}};_0x1728f0(++_0x471b87);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','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 diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 4353ed8..d1d4c96 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 _0x6da8=['path','express','Router','../../components/auth/service','../../components/interaction/service','./variable.controller','get','index','show','post','create','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','util'];(function(_0xfdb87a,_0x49a708){var _0x47caf6=function(_0x1a31c5){while(--_0x1a31c5){_0xfdb87a['push'](_0xfdb87a['shift']());}};_0x47caf6(++_0x49a708);}(_0x6da8,0x116));var _0x86da=function(_0x5d6a6f,_0x466a30){_0x5d6a6f=_0x5d6a6f-0x0;var _0x2a9450=_0x6da8[_0x5d6a6f];return _0x2a9450;};'use strict';var multer=require(_0x86da('0x0'));var util=require(_0x86da('0x1'));var path=require(_0x86da('0x2'));var timeout=require('connect-timeout');var express=require(_0x86da('0x3'));var router=express[_0x86da('0x4')]();var auth=require(_0x86da('0x5'));var interaction=require(_0x86da('0x6'));var config=require('../../config/environment');var controller=require(_0x86da('0x7'));router[_0x86da('0x8')]('/',auth['isAuthenticated'](),controller[_0x86da('0x9')]);router[_0x86da('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x86da('0xa')]);router[_0x86da('0xb')]('/',auth['isAuthenticated'](),controller[_0x86da('0xc')]);router[_0x86da('0xd')](_0x86da('0xe'),auth[_0x86da('0xf')](),controller[_0x86da('0x10')]);router[_0x86da('0x11')](_0x86da('0xe'),auth[_0x86da('0xf')](),controller[_0x86da('0x12')]);module[_0x86da('0x13')]=router; \ No newline at end of file +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 diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 48b8122..959c66b 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 _0x9b0e=['sequelize','STRING','name'];(function(_0x1af9a2,_0x45bca0){var _0x421b22=function(_0x356f33){while(--_0x356f33){_0x1af9a2['push'](_0x1af9a2['shift']());}};_0x421b22(++_0x45bca0);}(_0x9b0e,0x1d4));var _0xe9b0=function(_0xc35ea4,_0x5b9fbb){_0xc35ea4=_0xc35ea4-0x0;var _0xc6bd22=_0x9b0e[_0xc35ea4];return _0xc6bd22;};'use strict';var Sequelize=require(_0xe9b0('0x0'));module['exports']={'name':{'type':Sequelize[_0xe9b0('0x1')],'unique':_0xe9b0('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe9b0('0x1')]}}; \ No newline at end of file +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 diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index bca643a..2281856 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 _0xeb1c=['count','offset','limit','set','Content-Range','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','rawAttributes','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','Variable','includeAll','include','findAll','rows','catch','show','params','keys','length','create','user','role','Variables','find','userProfileId','autoAssociation','body','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','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','sendStatus','status','end','json'];(function(_0x1ea50c,_0x981432){var _0x3f2c13=function(_0x3734dd){while(--_0x3734dd){_0x1ea50c['push'](_0x1ea50c['shift']());}};_0x3f2c13(++_0x981432);}(_0xeb1c,0x185));var _0xceb1=function(_0x3d6529,_0x58ca06){_0x3d6529=_0x3d6529-0x0;var _0x1021db=_0xeb1c[_0x3d6529];return _0x1021db;};'use strict';var pdf=require(_0xceb1('0x0'));var emlformat=require(_0xceb1('0x1'));var rimraf=require(_0xceb1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xceb1('0x3'));var rp=require('request-promise');var moment=require(_0xceb1('0x4'));var BPromise=require(_0xceb1('0x5'));var Mustache=require(_0xceb1('0x6'));var util=require(_0xceb1('0x7'));var path=require(_0xceb1('0x8'));var sox=require('sox');var csv=require(_0xceb1('0x9'));var ejs=require(_0xceb1('0xa'));var fs=require('fs');var _=require(_0xceb1('0xb'));var squel=require(_0xceb1('0xc'));var crypto=require(_0xceb1('0xd'));var jsforce=require(_0xceb1('0xe'));var deskjs=require(_0xceb1('0xf'));var toCsv=require('to-csv');var querystring=require(_0xceb1('0x10'));var Papa=require(_0xceb1('0x11'));var Redis=require(_0xceb1('0x12'));var authService=require(_0xceb1('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xceb1('0x14'));var hardwareService=require(_0xceb1('0x15'));var logger=require(_0xceb1('0x16'))(_0xceb1('0x17'));var utils=require(_0xceb1('0x18'));var config=require(_0xceb1('0x19'));var db=require(_0xceb1('0x1a'))['db'];function respondWithStatusCode(_0x2deb27,_0x583382){_0x583382=_0x583382||0xcc;return function(_0x4387ba){if(_0x4387ba){return _0x2deb27[_0xceb1('0x1b')](_0x583382);}return _0x2deb27[_0xceb1('0x1c')](_0x583382)[_0xceb1('0x1d')]();};}function respondWithResult(_0x279894,_0x3e536f){_0x3e536f=_0x3e536f||0xc8;return function(_0x3568fe){if(_0x3568fe){return _0x279894['status'](_0x3e536f)[_0xceb1('0x1e')](_0x3568fe);}};}function respondWithFilteredResult(_0x50618f,_0x115103){return function(_0x4a4fef){if(_0x4a4fef){var _0x15b818=_0x4a4fef[_0xceb1('0x1f')],_0x2d3c27=_0x115103['offset'],_0x3efde7=_0x115103[_0xceb1('0x20')]+_0x115103[_0xceb1('0x21')],_0x3dd03a;if(_0x3efde7>=_0x15b818){_0x3efde7=_0x15b818;_0x3dd03a=0xc8;}else{_0x3dd03a=0xce;}_0x50618f[_0xceb1('0x1c')](_0x3dd03a);return _0x50618f[_0xceb1('0x22')](_0xceb1('0x23'),_0x2d3c27+'-'+_0x3efde7+'/'+_0x15b818)[_0xceb1('0x1e')](_0x4a4fef);}return null;};}function patchUpdates(_0x38c54e){return function(_0x3e02ce){try{jsonpatch['apply'](_0x3e02ce,_0x38c54e,!![]);}catch(_0x159c08){return BPromise[_0xceb1('0x24')](_0x159c08);}return _0x3e02ce['save']();};}function saveUpdates(_0x5d0fa3,_0x126e3b){return function(_0x476b37){if(_0x476b37){return _0x476b37[_0xceb1('0x25')](_0x5d0fa3)[_0xceb1('0x26')](function(_0x1f1ee5){return _0x1f1ee5;});}return null;};}function removeEntity(_0x5b0790,_0xa24295){return function(_0xe89df9){if(_0xe89df9){return _0xe89df9[_0xceb1('0x27')]()[_0xceb1('0x26')](function(){var _0x538976=_0xe89df9[_0xceb1('0x28')]({'plain':!![]});var _0x744286='Variables';return db[_0xceb1('0x29')][_0xceb1('0x27')]({'where':{'type':_0x744286,'resourceId':_0x538976['id']}})['then'](function(){return _0xe89df9;});})[_0xceb1('0x26')](function(){_0x5b0790[_0xceb1('0x1c')](0xcc)[_0xceb1('0x1d')]();});}};}function handleEntityNotFound(_0x23a807,_0x3ada0d){return function(_0x2f006f){if(!_0x2f006f){_0x23a807[_0xceb1('0x1b')](0x194);}return _0x2f006f;};}function handleError(_0x217bab,_0x20f3a0){_0x20f3a0=_0x20f3a0||0x1f4;return function(_0x12eba1){logger[_0xceb1('0x2a')](_0x12eba1[_0xceb1('0x2b')]);if(_0x12eba1['name']){delete _0x12eba1[_0xceb1('0x2c')];}_0x217bab['status'](_0x20f3a0)[_0xceb1('0x2d')](_0x12eba1);};}exports[_0xceb1('0x2e')]=function(_0x4f94c0,_0x5d9cd3){var _0x173146={},_0x183ba0={},_0x723eeb={'count':0x0,'rows':[]};var _0x53d12a=_[_0xceb1('0x2f')](db['Variable'][_0xceb1('0x30')],function(_0x33bedb){return{'name':_0x33bedb['fieldName'],'type':_0x33bedb['type'][_0xceb1('0x31')]};});_0x183ba0[_0xceb1('0x32')]=_['map'](_0x53d12a,_0xceb1('0x2c'));_0x183ba0[_0xceb1('0x33')]=_['keys'](_0x4f94c0[_0xceb1('0x33')]);_0x183ba0[_0xceb1('0x34')]=_['intersection'](_0x183ba0[_0xceb1('0x32')],_0x183ba0['query']);_0x173146[_0xceb1('0x35')]=_[_0xceb1('0x36')](_0x183ba0['model'],qs[_0xceb1('0x37')](_0x4f94c0[_0xceb1('0x33')][_0xceb1('0x37')]));_0x173146['attributes']=_0x173146['attributes']['length']?_0x173146[_0xceb1('0x35')]:_0x183ba0[_0xceb1('0x32')];if(!_0x4f94c0[_0xceb1('0x33')][_0xceb1('0x38')](_0xceb1('0x39'))){_0x173146[_0xceb1('0x21')]=qs[_0xceb1('0x21')](_0x4f94c0['query'][_0xceb1('0x21')]);_0x173146[_0xceb1('0x20')]=qs[_0xceb1('0x20')](_0x4f94c0[_0xceb1('0x33')][_0xceb1('0x20')]);}_0x173146[_0xceb1('0x3a')]=qs[_0xceb1('0x3b')](_0x4f94c0[_0xceb1('0x33')][_0xceb1('0x3b')]);_0x173146[_0xceb1('0x3c')]=qs[_0xceb1('0x34')](_[_0xceb1('0x3d')](_0x4f94c0[_0xceb1('0x33')],_0x183ba0[_0xceb1('0x34')]));if(_0x4f94c0[_0xceb1('0x33')]['filter']){_0x173146['where']=_[_0xceb1('0x3e')](_0x173146[_0xceb1('0x3c')],{'$or':_[_0xceb1('0x2f')](_0x53d12a,function(_0x9f050f){if(_0x9f050f[_0xceb1('0x3f')]!=='VIRTUAL'){var _0x327020={};_0x327020[_0x9f050f[_0xceb1('0x2c')]]={'$like':'%'+_0x4f94c0['query'][_0xceb1('0x40')]+'%'};return _0x327020;}})});}_0x173146=_[_0xceb1('0x3e')]({},_0x173146,_0x4f94c0[_0xceb1('0x41')]);var _0x7bbae8={'where':_0x173146[_0xceb1('0x3c')]};return db[_0xceb1('0x42')][_0xceb1('0x1f')](_0x7bbae8)[_0xceb1('0x26')](function(_0x31a9b8){_0x723eeb[_0xceb1('0x1f')]=_0x31a9b8;if(_0x4f94c0['query'][_0xceb1('0x43')]){_0x173146[_0xceb1('0x44')]=[{'all':!![]}];}return db[_0xceb1('0x42')][_0xceb1('0x45')](_0x173146);})[_0xceb1('0x26')](function(_0x53a439){_0x723eeb[_0xceb1('0x46')]=_0x53a439;return _0x723eeb;})[_0xceb1('0x26')](respondWithFilteredResult(_0x5d9cd3,_0x173146))[_0xceb1('0x47')](handleError(_0x5d9cd3,null));};exports[_0xceb1('0x48')]=function(_0x30dda3,_0x561808){var _0x5ed343={'raw':!![],'where':{'id':_0x30dda3[_0xceb1('0x49')]['id']}},_0x512d96={};_0x512d96['model']=_['keys'](db[_0xceb1('0x42')]['rawAttributes']);_0x512d96[_0xceb1('0x33')]=_[_0xceb1('0x4a')](_0x30dda3[_0xceb1('0x33')]);_0x512d96[_0xceb1('0x34')]=_[_0xceb1('0x36')](_0x512d96['model'],_0x512d96['query']);_0x5ed343['attributes']=_[_0xceb1('0x36')](_0x512d96[_0xceb1('0x32')],qs[_0xceb1('0x37')](_0x30dda3[_0xceb1('0x33')][_0xceb1('0x37')]));_0x5ed343['attributes']=_0x5ed343['attributes'][_0xceb1('0x4b')]?_0x5ed343[_0xceb1('0x35')]:_0x512d96['model'];if(_0x30dda3[_0xceb1('0x33')][_0xceb1('0x43')]){_0x5ed343[_0xceb1('0x44')]=[{'all':!![]}];}_0x5ed343=_[_0xceb1('0x3e')]({},_0x5ed343,_0x30dda3[_0xceb1('0x41')]);return db[_0xceb1('0x42')]['find'](_0x5ed343)[_0xceb1('0x26')](handleEntityNotFound(_0x561808,null))['then'](respondWithResult(_0x561808,null))[_0xceb1('0x47')](handleError(_0x561808,null));};exports[_0xceb1('0x4c')]=function(_0xc55583,_0x5de61a){return db[_0xceb1('0x42')][_0xceb1('0x4c')](_0xc55583['body'],{})['then'](function(_0x49631e){var _0x41546d=_0xc55583[_0xceb1('0x4d')][_0xceb1('0x28')]({'plain':!![]});if(!_0x41546d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x41546d[_0xceb1('0x4e')]===_0xceb1('0x4d')){var _0x462123=_0x49631e['get']({'plain':!![]});var _0x4c0c0f=_0xceb1('0x4f');return db['UserProfileSection'][_0xceb1('0x50')]({'where':{'name':_0x4c0c0f,'userProfileId':_0x41546d[_0xceb1('0x51')]},'raw':!![]})['then'](function(_0x49363b){if(_0x49363b&&_0x49363b[_0xceb1('0x52')]===0x0){return db[_0xceb1('0x29')][_0xceb1('0x4c')]({'name':_0x462123[_0xceb1('0x2c')],'resourceId':_0x462123['id'],'type':_0x49363b[_0xceb1('0x2c')],'sectionId':_0x49363b['id']},{})['then'](function(){return _0x49631e;});}else{return _0x49631e;}})[_0xceb1('0x47')](function(_0x444c78){logger[_0xceb1('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x444c78);throw _0x444c78;});}return _0x49631e;})['then'](respondWithResult(_0x5de61a,0xc9))[_0xceb1('0x47')](handleError(_0x5de61a,null));};exports[_0xceb1('0x25')]=function(_0x11c504,_0x15f9f3){if(_0x11c504[_0xceb1('0x53')]['id']){delete _0x11c504[_0xceb1('0x53')]['id'];}return db[_0xceb1('0x42')]['find']({'where':{'id':_0x11c504[_0xceb1('0x49')]['id']}})[_0xceb1('0x26')](handleEntityNotFound(_0x15f9f3,null))[_0xceb1('0x26')](saveUpdates(_0x11c504[_0xceb1('0x53')],null))[_0xceb1('0x26')](respondWithResult(_0x15f9f3,null))[_0xceb1('0x47')](handleError(_0x15f9f3,null));};exports['destroy']=function(_0xf984b2,_0x4ec5c2){return db[_0xceb1('0x42')][_0xceb1('0x50')]({'where':{'id':_0xf984b2[_0xceb1('0x49')]['id']}})[_0xceb1('0x26')](handleEntityNotFound(_0x4ec5c2,null))['then'](removeEntity(_0x4ec5c2,null))[_0xceb1('0x47')](handleError(_0x4ec5c2,null));}; \ No newline at end of file +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 diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 3f5f9e4..cf13748 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 _0x8e94=['lodash','util','api','bluebird','path','exports','define','tools_variables'];(function(_0x4fce69,_0x3625cb){var _0x2c3670=function(_0x1fbe30){while(--_0x1fbe30){_0x4fce69['push'](_0x4fce69['shift']());}};_0x2c3670(++_0x3625cb);}(_0x8e94,0xf8));var _0x48e9=function(_0x5178fb,_0x121e19){_0x5178fb=_0x5178fb-0x0;var _0x348183=_0x8e94[_0x5178fb];return _0x348183;};'use strict';var _=require(_0x48e9('0x0'));var util=require(_0x48e9('0x1'));var logger=require('../../config/logger')(_0x48e9('0x2'));var moment=require('moment');var BPromise=require(_0x48e9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x48e9('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./variable.attributes');module[_0x48e9('0x5')]=function(_0x20d724,_0x5d6996){return _0x20d724[_0x48e9('0x6')]('Variable',attributes,{'tableName':_0x48e9('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index a1aa271..9b5a0c4 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 _0x2e86=['include','map','model','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowVariable','Variable','find','options','where','attributes'];(function(_0x1f8ee9,_0x521f85){var _0x24c8a9=function(_0x351d5a){while(--_0x351d5a){_0x1f8ee9['push'](_0x1f8ee9['shift']());}};_0x24c8a9(++_0x521f85);}(_0x2e86,0x190));var _0x62e8=function(_0x1902b5,_0x4d249b){_0x1902b5=_0x1902b5-0x0;var _0x212030=_0x2e86[_0x1902b5];return _0x212030;};'use strict';var _=require(_0x62e8('0x0'));var util=require(_0x62e8('0x1'));var moment=require(_0x62e8('0x2'));var BPromise=require('bluebird');var rs=require(_0x62e8('0x3'));var fs=require('fs');var Redis=require(_0x62e8('0x4'));var db=require(_0x62e8('0x5'))['db'];var utils=require(_0x62e8('0x6'));var logger=require(_0x62e8('0x7'))(_0x62e8('0x8'));var config=require('../../config/environment');var jayson=require(_0x62e8('0x9'));var client=jayson[_0x62e8('0xa')][_0x62e8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e4cd3,_0x515d8e,_0x34acd4){return new BPromise(function(_0x3dd7e2,_0x331901){return client[_0x62e8('0xc')](_0x3e4cd3,_0x34acd4)[_0x62e8('0xd')](function(_0x311200){logger[_0x62e8('0xe')](_0x62e8('0xf'),_0x515d8e,'request\x20sent');logger[_0x62e8('0x10')](_0x62e8('0x11'),_0x515d8e,_0x62e8('0x12'),JSON[_0x62e8('0x13')](_0x311200));if(_0x311200['error']){if(_0x311200['error']['code']===0x1f4){logger[_0x62e8('0x14')](_0x62e8('0xf'),_0x515d8e,_0x311200[_0x62e8('0x14')]['message']);return _0x331901(_0x311200[_0x62e8('0x14')][_0x62e8('0x15')]);}logger['error'](_0x62e8('0xf'),_0x515d8e,_0x311200[_0x62e8('0x14')][_0x62e8('0x15')]);return _0x3dd7e2(_0x311200['error'][_0x62e8('0x15')]);}else{logger[_0x62e8('0xe')](_0x62e8('0xf'),_0x515d8e,'request\x20sent');_0x3dd7e2(_0x311200[_0x62e8('0x16')][_0x62e8('0x15')]);}})['catch'](function(_0x6abe14){logger[_0x62e8('0x14')]('Variable,\x20%s,\x20%s',_0x515d8e,_0x6abe14);_0x331901(_0x6abe14);});});}exports[_0x62e8('0x17')]=function(_0x2832f2){var _0x2c4677=this;return new Promise(function(_0x1058d9,_0x537d7b){return db[_0x62e8('0x18')][_0x62e8('0x19')]({'raw':_0x2832f2['options']?_0x2832f2[_0x62e8('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2832f2['options']?_0x2832f2[_0x62e8('0x1a')][_0x62e8('0x1b')]||null:null,'attributes':_0x2832f2[_0x62e8('0x1a')]?_0x2832f2[_0x62e8('0x1a')][_0x62e8('0x1c')]||null:null,'include':_0x2832f2[_0x62e8('0x1a')]?_0x2832f2['options'][_0x62e8('0x1d')]?_[_0x62e8('0x1e')](_0x2832f2[_0x62e8('0x1a')][_0x62e8('0x1d')],function(_0x5d15e0){return{'model':db[_0x5d15e0[_0x62e8('0x1f')]],'as':_0x5d15e0['as'],'attributes':_0x5d15e0['attributes'],'include':_0x5d15e0[_0x62e8('0x1d')]?_[_0x62e8('0x1e')](_0x5d15e0[_0x62e8('0x1d')],function(_0x51dd){return{'model':db[_0x51dd[_0x62e8('0x1f')]],'as':_0x51dd['as'],'attributes':_0x51dd['attributes'],'include':_0x51dd[_0x62e8('0x1d')]?_['map'](_0x51dd['include'],function(_0x59c2bc){return{'model':db[_0x59c2bc[_0x62e8('0x1f')]],'as':_0x59c2bc['as'],'attributes':_0x59c2bc['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ff6df){logger[_0x62e8('0xe')]('ShowVariable',_0x2832f2);logger[_0x62e8('0x10')](_0x62e8('0x17'),_0x2832f2,JSON[_0x62e8('0x13')](_0x5ff6df));_0x1058d9(_0x5ff6df);})[_0x62e8('0x20')](function(_0x3dca1){logger['error'](_0x62e8('0x17'),_0x3dca1[_0x62e8('0x15')],_0x2832f2);_0x537d7b(_0x2c4677['error'](0x1f4,_0x3dca1[_0x62e8('0x15')]));});});}; \ No newline at end of file +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 diff --git a/server/api/version/index.js b/server/api/version/index.js index 7112ed7..e1174f2 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 _0xd7b1=['/restart','restart','exports','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','reset','/pull','pull'];(function(_0x2a2571,_0x44127a){var _0x3123ff=function(_0x4c2323){while(--_0x4c2323){_0x2a2571['push'](_0x2a2571['shift']());}};_0x3123ff(++_0x44127a);}(_0xd7b1,0xd5));var _0x1d7b=function(_0x3b341e,_0x509432){_0x3b341e=_0x3b341e-0x0;var _0x5a5178=_0xd7b1[_0x3b341e];return _0x5a5178;};'use strict';var express=require('express');var router=express[_0x1d7b('0x0')]();var auth=require(_0x1d7b('0x1'));var controller=require(_0x1d7b('0x2'));router[_0x1d7b('0x3')]('/',controller[_0x1d7b('0x4')]);router[_0x1d7b('0x3')](_0x1d7b('0x5'),auth[_0x1d7b('0x6')](),auth[_0x1d7b('0x7')](),controller[_0x1d7b('0x8')]);router[_0x1d7b('0x3')]('/reset',auth[_0x1d7b('0x6')](),auth[_0x1d7b('0x7')](),controller[_0x1d7b('0x9')]);router[_0x1d7b('0x3')](_0x1d7b('0xa'),auth[_0x1d7b('0x6')](),auth[_0x1d7b('0x7')](),controller[_0x1d7b('0xb')]);router[_0x1d7b('0x3')](_0x1d7b('0xc'),auth['isAuthenticated'](),controller[_0x1d7b('0xd')]);router[_0x1d7b('0x3')]('/migrations',controller['migrations']);module[_0x1d7b('0xe')]=router; \ No newline at end of file +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 diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index e71c34c..b11e6cd 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 _0xc6a2=['path','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','latest','fetch','tags','json','status','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','--hard','FETCH_HEAD','git\x20reset\x20--hard','pull','restart','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','replace','.js','push','sort','Migration','sequelize','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','Database\x20migrated\x20successfully\x20from\x20version\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug'];(function(_0x3f6d42,_0xeb7da3){var _0x32413a=function(_0x2f3ce6){while(--_0x2f3ce6){_0x3f6d42['push'](_0x3f6d42['shift']());}};_0x32413a(++_0xeb7da3);}(_0xc6a2,0x69));var _0x2c6a=function(_0x3e7d32,_0x3f3a54){_0x3e7d32=_0x3e7d32-0x0;var _0x33fc15=_0xc6a2[_0x3e7d32];return _0x33fc15;};'use strict';var Umzug=require(_0x2c6a('0x0'));var path=require(_0x2c6a('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x2c6a('0x2'))(module,_0x2c6a('0x3'));var compareVersions=require(_0x2c6a('0x4'));var exec=require(_0x2c6a('0x5'))[_0x2c6a('0x6')];var db=require(_0x2c6a('0x7'))['db'];var config=require(_0x2c6a('0x8'));var pm2=require(_0x2c6a('0x9'));var logger=require(_0x2c6a('0xa'))(_0x2c6a('0xb'));var git=require(_0x2c6a('0xc'))(config[_0x2c6a('0xd')]);exports[_0x2c6a('0xe')]=function(_0x2b006a,_0x4e45fa){var _0x36f800={'current':module[_0x2c6a('0xf')][_0x2c6a('0x3')],'phonebar':0x2};if(_0x2b006a[_0x2c6a('0x10')]&&_0x2b006a[_0x2c6a('0x10')][_0x2c6a('0x11')]){return git[_0x2c6a('0x12')]()[_0x2c6a('0x13')](function(_0x4aa0a3,_0x5dbeba){_0x36f800[_0x2c6a('0x11')]=(_0x4aa0a3?module[_0x2c6a('0xf')][_0x2c6a('0x3')]:_0x5dbeba[_0x2c6a('0x11')])||'2.0.0';return _0x4e45fa['status'](0xc8)[_0x2c6a('0x14')](_0x36f800);});}else{return _0x4e45fa[_0x2c6a('0x15')](0xc8)[_0x2c6a('0x14')](_0x36f800);}};exports['fetch']=function(_0x5e965d,_0x5cb8d3){return git[_0x2c6a('0x12')]([_0x2c6a('0x16'),_0x2c6a('0x17')],function(_0xe74e1f){if(_0xe74e1f){logger[_0x2c6a('0x18')](_0xe74e1f);return _0x5cb8d3[_0x2c6a('0x15')](0x1f4)[_0x2c6a('0x14')](_0xe74e1f);}logger[_0x2c6a('0x19')](_0x2c6a('0x1a'));return _0x5cb8d3['status'](0xc8)[_0x2c6a('0x14')]({'output':_0x2c6a('0x1b')});});};exports['reset']=function(_0x2995eb,_0x4b9dcb){return git['reset']([_0x2c6a('0x1c'),_0x2c6a('0x1d')],function(_0x15fa74){if(_0x15fa74){logger[_0x2c6a('0x18')](_0x15fa74);return _0x4b9dcb[_0x2c6a('0x15')](0x1f4)[_0x2c6a('0x14')](_0x15fa74);}logger[_0x2c6a('0x19')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x4b9dcb[_0x2c6a('0x15')](0xc8)[_0x2c6a('0x14')]({'output':_0x2c6a('0x1e')});});};exports[_0x2c6a('0x1f')]=function(_0x10edaa,_0x49c5b7){exec('npm\x20install\x20--production',function(_0x3652ac,_0x33528a,_0x9de775){logger[_0x2c6a('0x19')](_0x33528a);logger['info'](_0x9de775);if(_0x3652ac){logger['error'](_0x3652ac);return _0x49c5b7['status'](0x1f4)[_0x2c6a('0x14')](_0x3652ac);}return _0x49c5b7[_0x2c6a('0x15')](0xc8)[_0x2c6a('0x14')]({'output':_0x33528a});});};exports[_0x2c6a('0x20')]=function(_0x39723a,_0x3e9439){return pm2[_0x2c6a('0x20')]('motion2')[_0x2c6a('0x21')](function(_0x48c35a){logger[_0x2c6a('0x19')]('pm2\x20restart\x20motion\x20%s',_0x48c35a);return _0x3e9439[_0x2c6a('0x15')](0xc8)[_0x2c6a('0x14')]({'output':_0x2c6a('0x22')});})[_0x2c6a('0x23')](function(_0x3a75a3){logger['error'](_0x3a75a3);return _0x3e9439[_0x2c6a('0x15')](0x1f4)[_0x2c6a('0x14')](_0x3a75a3);});};exports[_0x2c6a('0x24')]=function(_0x3f7ea5,_0x48e898){var _0x1d77a3=fs[_0x2c6a('0x25')](path[_0x2c6a('0x26')](config[_0x2c6a('0xd')],'server',_0x2c6a('0x24')));var _0x4baecf=[];for(var _0x5dfa89=0x0;_0x5dfa89<_0x1d77a3['length'];_0x5dfa89++){var _0x2805fb=_0x1d77a3[_0x5dfa89][_0x2c6a('0x27')](_0x2c6a('0x28'),'');if(compareVersions(module[_0x2c6a('0xf')][_0x2c6a('0x3')],_0x2805fb)===-0x1){_0x4baecf[_0x2c6a('0x29')](_0x2805fb);}}if(_0x4baecf['length']){var _0x110219=_0x4baecf[_0x2c6a('0x2a')](compareVersions);var _0x3a3c6e=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x2c6a('0x2b')],'modelName':_0x2c6a('0x2b'),'columnName':_0x2c6a('0x3')},'migrations':{'params':[db[_0x2c6a('0x2c')][_0x2c6a('0x2d')](),db[_0x2c6a('0x2c')][_0x2c6a('0x2e')],function(){throw new Error(_0x2c6a('0x2f'));}],'path':path['join'](config[_0x2c6a('0xd')],_0x2c6a('0x30'),_0x2c6a('0x24')),'pattern':/\.js$/}});_0x3a3c6e['up']({'migrations':_['map'](_0x110219,function(_0x4d06a2){return _0x4d06a2+_0x2c6a('0x28');})})['then'](function(){return _0x48e898[_0x2c6a('0x15')](0xc8)['json']({'output':_0x2c6a('0x31')+module[_0x2c6a('0xf')][_0x2c6a('0x3')]+'\x20to\x20'+_[_0x2c6a('0x32')](_0x110219),'migrations':_[_0x2c6a('0x26')](_0x110219)});})['catch'](function(_0xeb28f){if(_0xeb28f instanceof db[_0x2c6a('0x2c')][_0x2c6a('0x33')]){return _0x48e898[_0x2c6a('0x15')](0xc8)[_0x2c6a('0x14')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x48e898['status'](0x1f4)['json'](_0xeb28f);}});}else{return _0x48e898[_0x2c6a('0x15')](0xc8)[_0x2c6a('0x14')]({'output':_0x2c6a('0x34')});}}; \ No newline at end of file +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 diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 0bcdf8a..f6bd84c 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 _0x7844=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update'];(function(_0x195fad,_0x1787bb){var _0x5aea29=function(_0x56a8d4){while(--_0x56a8d4){_0x195fad['push'](_0x195fad['shift']());}};_0x5aea29(++_0x1787bb);}(_0x7844,0xb3));var _0x4784=function(_0xd875db,_0x2e953f){_0xd875db=_0xd875db-0x0;var _0x599347=_0x7844[_0xd875db];return _0x599347;};'use strict';var multer=require(_0x4784('0x0'));var util=require(_0x4784('0x1'));var path=require(_0x4784('0x2'));var timeout=require(_0x4784('0x3'));var express=require(_0x4784('0x4'));var router=express[_0x4784('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x4784('0x6'));var config=require(_0x4784('0x7'));var controller=require(_0x4784('0x8'));router[_0x4784('0x9')]('/',auth[_0x4784('0xa')](),controller[_0x4784('0xb')]);router[_0x4784('0x9')]('/describe',auth[_0x4784('0xa')](),controller[_0x4784('0xc')]);router['get'](_0x4784('0xd'),auth[_0x4784('0xa')](),controller[_0x4784('0xe')]);router[_0x4784('0xf')]('/',auth[_0x4784('0xa')](),controller[_0x4784('0x10')]);router[_0x4784('0x11')](_0x4784('0xd'),auth[_0x4784('0xa')](),controller[_0x4784('0x12')]);router[_0x4784('0x13')](_0x4784('0xd'),auth[_0x4784('0xa')](),controller[_0x4784('0x14')]);module[_0x4784('0x15')]=router; \ No newline at end of file +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 diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 5452fa4..c6f62cd 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 _0x2d17=['STRING','DATE','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x15b158,_0x3ff147){var _0x3491f3=function(_0x1e6619){while(--_0x1e6619){_0x15b158['push'](_0x15b158['shift']());}};_0x3491f3(++_0x3ff147);}(_0x2d17,0x17e));var _0x72d1=function(_0x215f29,_0x25a515){_0x215f29=_0x215f29-0x0;var _0x34d31e=_0x2d17[_0x215f29];return _0x34d31e;};'use strict';var Sequelize=require(_0x72d1('0x0'));module[_0x72d1('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x72d1('0x2')]},'calleridnum':{'type':Sequelize[_0x72d1('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x72d1('0x2')]},'interface':{'type':Sequelize[_0x72d1('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x72d1('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x72d1('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x72d1('0x3')]},'holdtime':{'type':Sequelize[_0x72d1('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x72d1('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x72d1('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x72d1('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x72d1('0x4')]},'reason':{'type':Sequelize[_0x72d1('0x2')]},'lastevent':{'type':Sequelize[_0x72d1('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x72d1('0x4')]},'channelstatedesc':{'type':Sequelize[_0x72d1('0x2')]},'connectedlinenum':{'type':Sequelize[_0x72d1('0x2')]},'connectedlinename':{'type':Sequelize[_0x72d1('0x2')]},'language':{'type':Sequelize[_0x72d1('0x2')]},'accountcode':{'type':Sequelize[_0x72d1('0x2')]},'context':{'type':Sequelize[_0x72d1('0x2')]},'exten':{'type':Sequelize[_0x72d1('0x2')]},'priority':{'type':Sequelize[_0x72d1('0x2')]},'destchannel':{'type':Sequelize[_0x72d1('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x72d1('0x2')]},'destcalleridnum':{'type':Sequelize[_0x72d1('0x2')]},'destcalleridname':{'type':Sequelize[_0x72d1('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x72d1('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x72d1('0x2')]},'destlanguage':{'type':Sequelize[_0x72d1('0x2')]},'destaccountcode':{'type':Sequelize[_0x72d1('0x2')]},'destcontext':{'type':Sequelize[_0x72d1('0x2')]},'destexten':{'type':Sequelize[_0x72d1('0x2')]},'destpriority':{'type':Sequelize[_0x72d1('0x2')]},'destuniqueid':{'type':Sequelize[_0x72d1('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x72d1('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x72d1('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x72d1('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x72d1('0x2')]},'transferuniqueid':{'type':Sequelize[_0x72d1('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +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 diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 384b550..e8765ce 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 _0x1df1=['ejs','lodash','squel','crypto','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','stack','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','includeAll','include','VoiceAgentReport','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox'];(function(_0x2001b4,_0x3ca098){var _0x17a507=function(_0x11340b){while(--_0x11340b){_0x2001b4['push'](_0x2001b4['shift']());}};_0x17a507(++_0x3ca098);}(_0x1df1,0x1a8));var _0x11df=function(_0x477fdb,_0x462b55){_0x477fdb=_0x477fdb-0x0;var _0x32beaf=_0x1df1[_0x477fdb];return _0x32beaf;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x11df('0x0'));var jsonpatch=require(_0x11df('0x1'));var rp=require(_0x11df('0x2'));var moment=require(_0x11df('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x11df('0x4'));var util=require(_0x11df('0x5'));var path=require(_0x11df('0x6'));var sox=require(_0x11df('0x7'));var csv=require('to-csv');var ejs=require(_0x11df('0x8'));var fs=require('fs');var _=require(_0x11df('0x9'));var squel=require(_0x11df('0xa'));var crypto=require(_0x11df('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x11df('0xc'));var querystring=require(_0x11df('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x11df('0xe'));var qs=require(_0x11df('0xf'));var as=require(_0x11df('0x10'));var hardwareService=require(_0x11df('0x11'));var logger=require(_0x11df('0x12'))(_0x11df('0x13'));var utils=require(_0x11df('0x14'));var config=require(_0x11df('0x15'));var db=require(_0x11df('0x16'))['db'];function respondWithStatusCode(_0x19688f,_0x24cce5){_0x24cce5=_0x24cce5||0xcc;return function(_0x57b26a){if(_0x57b26a){return _0x19688f[_0x11df('0x17')](_0x24cce5);}return _0x19688f[_0x11df('0x18')](_0x24cce5)[_0x11df('0x19')]();};}function respondWithResult(_0x381049,_0x504bca){_0x504bca=_0x504bca||0xc8;return function(_0x39e294){if(_0x39e294){return _0x381049[_0x11df('0x18')](_0x504bca)[_0x11df('0x1a')](_0x39e294);}};}function respondWithFilteredResult(_0x21e9a8,_0x2a3162){return function(_0x3a6d4c){if(_0x3a6d4c){var _0x24a3e8=_0x3a6d4c[_0x11df('0x1b')],_0x33959d=_0x2a3162['offset'],_0x2fac91=_0x2a3162[_0x11df('0x1c')]+_0x2a3162[_0x11df('0x1d')],_0x1f224d;if(_0x2fac91>=_0x24a3e8){_0x2fac91=_0x24a3e8;_0x1f224d=0xc8;}else{_0x1f224d=0xce;}_0x21e9a8['status'](_0x1f224d);return _0x21e9a8['set'](_0x11df('0x1e'),_0x33959d+'-'+_0x2fac91+'/'+_0x24a3e8)[_0x11df('0x1a')](_0x3a6d4c);}return null;};}function patchUpdates(_0x1d46e8){return function(_0x4b5d5b){try{jsonpatch[_0x11df('0x1f')](_0x4b5d5b,_0x1d46e8,!![]);}catch(_0x25985e){return BPromise[_0x11df('0x20')](_0x25985e);}return _0x4b5d5b[_0x11df('0x21')]();};}function saveUpdates(_0x54e293,_0x2964a5){return function(_0x5baae1){if(_0x5baae1){return _0x5baae1[_0x11df('0x22')](_0x54e293)[_0x11df('0x23')](function(_0x411e9e){return _0x411e9e;});}return null;};}function removeEntity(_0x532fcf,_0x11a93a){return function(_0x4e1981){if(_0x4e1981){return _0x4e1981[_0x11df('0x24')]()[_0x11df('0x23')](function(){_0x532fcf[_0x11df('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xaa2889,_0x27b819){return function(_0x4d1487){if(!_0x4d1487){_0xaa2889[_0x11df('0x17')](0x194);}return _0x4d1487;};}function handleError(_0x48463a,_0x49b992){_0x49b992=_0x49b992||0x1f4;return function(_0x2bc2b6){logger['error'](_0x2bc2b6[_0x11df('0x25')]);if(_0x2bc2b6['name']){delete _0x2bc2b6['name'];}_0x48463a[_0x11df('0x18')](_0x49b992)['send'](_0x2bc2b6);};}exports['index']=function(_0x56fb0f,_0x2b484f){var _0x21bc53={},_0x3a59a1={},_0x435ad8={'count':0x0,'rows':[]};var _0x26577f=_['map'](db['VoiceAgentReport']['rawAttributes'],function(_0x13a3d2){return{'name':_0x13a3d2['fieldName'],'type':_0x13a3d2[_0x11df('0x26')][_0x11df('0x27')]};});_0x3a59a1[_0x11df('0x28')]=_['map'](_0x26577f,_0x11df('0x29'));_0x3a59a1[_0x11df('0x2a')]=_[_0x11df('0x2b')](_0x56fb0f['query']);_0x3a59a1[_0x11df('0x2c')]=_[_0x11df('0x2d')](_0x3a59a1[_0x11df('0x28')],_0x3a59a1[_0x11df('0x2a')]);_0x21bc53[_0x11df('0x2e')]=_[_0x11df('0x2d')](_0x3a59a1[_0x11df('0x28')],qs[_0x11df('0x2f')](_0x56fb0f[_0x11df('0x2a')][_0x11df('0x2f')]));_0x21bc53[_0x11df('0x2e')]=_0x21bc53[_0x11df('0x2e')][_0x11df('0x30')]?_0x21bc53['attributes']:_0x3a59a1['model'];if(!_0x56fb0f[_0x11df('0x2a')][_0x11df('0x31')](_0x11df('0x32'))){_0x21bc53[_0x11df('0x1d')]=qs['limit'](_0x56fb0f[_0x11df('0x2a')][_0x11df('0x1d')]);_0x21bc53[_0x11df('0x1c')]=qs[_0x11df('0x1c')](_0x56fb0f[_0x11df('0x2a')][_0x11df('0x1c')]);}_0x21bc53[_0x11df('0x33')]=qs[_0x11df('0x34')](_0x56fb0f[_0x11df('0x2a')]['sort']);_0x21bc53['where']=qs['filters'](_[_0x11df('0x35')](_0x56fb0f[_0x11df('0x2a')],_0x3a59a1[_0x11df('0x2c')]));if(_0x56fb0f[_0x11df('0x2a')][_0x11df('0x36')]){_0x21bc53[_0x11df('0x37')]=_[_0x11df('0x38')](_0x21bc53[_0x11df('0x37')],{'$or':_[_0x11df('0x39')](_0x26577f,function(_0x225709){if(_0x225709[_0x11df('0x26')]!==_0x11df('0x3a')){var _0x4e163d={};_0x4e163d[_0x225709[_0x11df('0x29')]]={'$like':'%'+_0x56fb0f[_0x11df('0x2a')][_0x11df('0x36')]+'%'};return _0x4e163d;}})});}_0x21bc53=_[_0x11df('0x38')]({},_0x21bc53,_0x56fb0f['options']);var _0x31606b={'where':_0x21bc53['where']};return db['VoiceAgentReport'][_0x11df('0x1b')](_0x31606b)['then'](function(_0x3b3410){_0x435ad8['count']=_0x3b3410;if(_0x56fb0f[_0x11df('0x2a')][_0x11df('0x3b')]){_0x21bc53[_0x11df('0x3c')]=[{'all':!![]}];}return db[_0x11df('0x3d')][_0x11df('0x3e')](_0x21bc53);})[_0x11df('0x23')](function(_0x3ff85b){_0x435ad8[_0x11df('0x3f')]=_0x3ff85b;return _0x435ad8;})['then'](respondWithFilteredResult(_0x2b484f,_0x21bc53))[_0x11df('0x40')](handleError(_0x2b484f,null));};exports[_0x11df('0x41')]=function(_0x219eb5,_0x14ac35){var _0x5928d5={'raw':![],'where':{'id':_0x219eb5[_0x11df('0x42')]['id']}},_0x20cc1e={};_0x20cc1e[_0x11df('0x28')]=_[_0x11df('0x2b')](db[_0x11df('0x3d')][_0x11df('0x43')]);_0x20cc1e['query']=_['keys'](_0x219eb5['query']);_0x20cc1e[_0x11df('0x2c')]=_[_0x11df('0x2d')](_0x20cc1e['model'],_0x20cc1e[_0x11df('0x2a')]);_0x5928d5[_0x11df('0x2e')]=_['intersection'](_0x20cc1e[_0x11df('0x28')],qs[_0x11df('0x2f')](_0x219eb5['query']['fields']));_0x5928d5['attributes']=_0x5928d5['attributes']['length']?_0x5928d5[_0x11df('0x2e')]:_0x20cc1e[_0x11df('0x28')];if(_0x219eb5[_0x11df('0x2a')]['includeAll']){_0x5928d5[_0x11df('0x3c')]=[{'all':!![]}];}_0x5928d5=_[_0x11df('0x38')]({},_0x5928d5,_0x219eb5['options']);return db['VoiceAgentReport'][_0x11df('0x44')](_0x5928d5)[_0x11df('0x23')](handleEntityNotFound(_0x14ac35,null))[_0x11df('0x23')](respondWithResult(_0x14ac35,null))[_0x11df('0x40')](handleError(_0x14ac35,null));};exports[_0x11df('0x45')]=function(_0x9cc69b,_0x268285){return db['VoiceAgentReport'][_0x11df('0x45')](_0x9cc69b[_0x11df('0x46')],{})[_0x11df('0x23')](respondWithResult(_0x268285,0xc9))[_0x11df('0x40')](handleError(_0x268285,null));};exports[_0x11df('0x22')]=function(_0x2acbcc,_0x5b5a4a){if(_0x2acbcc[_0x11df('0x46')]['id']){delete _0x2acbcc[_0x11df('0x46')]['id'];}return db['VoiceAgentReport'][_0x11df('0x44')]({'where':{'id':_0x2acbcc[_0x11df('0x42')]['id']}})[_0x11df('0x23')](handleEntityNotFound(_0x5b5a4a,null))['then'](saveUpdates(_0x2acbcc[_0x11df('0x46')],null))[_0x11df('0x23')](respondWithResult(_0x5b5a4a,null))[_0x11df('0x40')](handleError(_0x5b5a4a,null));};exports[_0x11df('0x24')]=function(_0x33b3ee,_0x35f7e1){return db[_0x11df('0x3d')][_0x11df('0x44')]({'where':{'id':_0x33b3ee[_0x11df('0x42')]['id']}})['then'](handleEntityNotFound(_0x35f7e1,null))[_0x11df('0x23')](removeEntity(_0x35f7e1,null))[_0x11df('0x40')](handleError(_0x35f7e1,null));};exports[_0x11df('0x47')]=function(_0x244621,_0x2e02bc){return db['VoiceAgentReport'][_0x11df('0x47')]()[_0x11df('0x23')](respondWithResult(_0x2e02bc,null))[_0x11df('0x40')](handleError(_0x2e02bc,null));}; \ No newline at end of file +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 diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 4691e27..e085c44 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 _0xe5fe=['report_agent','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','rimraf','exports','define'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xe5fe,0xf4));var _0xee5f=function(_0x31e4de,_0x46b169){_0x31e4de=_0x31e4de-0x0;var _0x479098=_0xe5fe[_0x31e4de];return _0x479098;};'use strict';var _=require(_0xee5f('0x0'));var util=require(_0xee5f('0x1'));var logger=require(_0xee5f('0x2'))(_0xee5f('0x3'));var moment=require(_0xee5f('0x4'));var BPromise=require('bluebird');var rp=require(_0xee5f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xee5f('0x6'));var config=require('../../config/environment');var attributes=require('./voiceAgentReport.attributes');module[_0xee5f('0x7')]=function(_0x1f7823,_0x2c998e){return _0x1f7823[_0xee5f('0x8')]('VoiceAgentReport',attributes,{'tableName':_0xee5f('0x9'),'paranoid':![],'indexes':[{'fields':[_0xee5f('0xa'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 4172980..ebf2cc3 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 _0x7f97=['VoiceAgentReport,\x20%s,\x20%s','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','options','UpdateVoiceAgentReport','update','body','raw','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','request\x20sent','stringify','error','code'];(function(_0x5332a4,_0x16d8a6){var _0xbd5cc3=function(_0x40f863){while(--_0x40f863){_0x5332a4['push'](_0x5332a4['shift']());}};_0xbd5cc3(++_0x16d8a6);}(_0x7f97,0x116));var _0x77f9=function(_0x483e5b,_0x139003){_0x483e5b=_0x483e5b-0x0;var _0x1ca9a9=_0x7f97[_0x483e5b];return _0x1ca9a9;};'use strict';var _=require(_0x77f9('0x0'));var util=require(_0x77f9('0x1'));var moment=require(_0x77f9('0x2'));var BPromise=require('bluebird');var rs=require(_0x77f9('0x3'));var fs=require('fs');var Redis=require(_0x77f9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x77f9('0x5'));var logger=require(_0x77f9('0x6'))(_0x77f9('0x7'));var config=require(_0x77f9('0x8'));var jayson=require(_0x77f9('0x9'));var client=jayson['client'][_0x77f9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15f387,_0x1af9fb,_0x310f9f){return new BPromise(function(_0xe98784,_0x3d2235){return client[_0x77f9('0xb')](_0x15f387,_0x310f9f)[_0x77f9('0xc')](function(_0x1a8245){logger[_0x77f9('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x1af9fb,'request\x20sent');logger[_0x77f9('0xe')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x1af9fb,_0x77f9('0xf'),JSON[_0x77f9('0x10')](_0x1a8245));if(_0x1a8245['error']){if(_0x1a8245[_0x77f9('0x11')][_0x77f9('0x12')]===0x1f4){logger[_0x77f9('0x11')](_0x77f9('0x13'),_0x1af9fb,_0x1a8245[_0x77f9('0x11')][_0x77f9('0x14')]);return _0x3d2235(_0x1a8245[_0x77f9('0x11')][_0x77f9('0x14')]);}logger[_0x77f9('0x11')](_0x77f9('0x13'),_0x1af9fb,_0x1a8245[_0x77f9('0x11')][_0x77f9('0x14')]);return _0xe98784(_0x1a8245[_0x77f9('0x11')]['message']);}else{logger[_0x77f9('0xd')](_0x77f9('0x13'),_0x1af9fb,_0x77f9('0xf'));_0xe98784(_0x1a8245[_0x77f9('0x15')][_0x77f9('0x14')]);}})[_0x77f9('0x16')](function(_0x6a5274){logger[_0x77f9('0x11')](_0x77f9('0x13'),_0x1af9fb,_0x6a5274);_0x3d2235(_0x6a5274);});});}exports[_0x77f9('0x17')]=function(_0x5fb475){var _0x43821c=this;return new Promise(function(_0x25c5fd,_0x3e135a){return db[_0x77f9('0x18')]['create'](_0x5fb475['body'],{'raw':_0x5fb475['options']?_0x5fb475[_0x77f9('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1cdade){logger[_0x77f9('0xd')](_0x77f9('0x17'),_0x5fb475);logger['debug'](_0x77f9('0x17'),_0x5fb475,JSON[_0x77f9('0x10')](_0x1cdade));_0x25c5fd(_0x1cdade);})[_0x77f9('0x16')](function(_0x2d823f){logger['error']('CreateVoiceAgentReport',_0x2d823f['message'],_0x5fb475);_0x3e135a(_0x43821c[_0x77f9('0x11')](0x1f4,_0x2d823f['message']));});});};exports[_0x77f9('0x1a')]=function(_0x4b12a9){var _0x454ab1=this;return new Promise(function(_0xd0581e,_0x17e320){return db[_0x77f9('0x18')][_0x77f9('0x1b')](_0x4b12a9[_0x77f9('0x1c')],{'raw':_0x4b12a9[_0x77f9('0x19')]?_0x4b12a9[_0x77f9('0x19')][_0x77f9('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b12a9[_0x77f9('0x19')]?_0x4b12a9[_0x77f9('0x19')][_0x77f9('0x1e')]||null:null,'attributes':_0x4b12a9[_0x77f9('0x19')]?_0x4b12a9[_0x77f9('0x19')][_0x77f9('0x1f')]||null:null,'limit':_0x4b12a9['options']?_0x4b12a9[_0x77f9('0x19')][_0x77f9('0x20')]||null:null})[_0x77f9('0xc')](function(_0x2fd8d0){logger[_0x77f9('0xd')](_0x77f9('0x1a'),_0x4b12a9);logger[_0x77f9('0xe')]('UpdateVoiceAgentReport',_0x4b12a9,JSON['stringify'](_0x2fd8d0));_0xd0581e(_0x2fd8d0);})[_0x77f9('0x16')](function(_0x302a1a){logger[_0x77f9('0x11')]('UpdateVoiceAgentReport',_0x302a1a[_0x77f9('0x14')],_0x4b12a9);_0x17e320(_0x454ab1[_0x77f9('0x11')](0x1f4,_0x302a1a['message']));});});}; \ No newline at end of file +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 diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 749d17d..261a5b7 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 _0x7c5d=['post','create','update','delete','destroy','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show'];(function(_0x4afac5,_0x1ab4ed){var _0x2404b3=function(_0x5c700b){while(--_0x5c700b){_0x4afac5['push'](_0x4afac5['shift']());}};_0x2404b3(++_0x1ab4ed);}(_0x7c5d,0x1aa));var _0xd7c5=function(_0xe54a5d,_0x35a5c0){_0xe54a5d=_0xe54a5d-0x0;var _0x35f1fe=_0x7c5d[_0xe54a5d];return _0x35f1fe;};'use strict';var multer=require(_0xd7c5('0x0'));var util=require('util');var path=require(_0xd7c5('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd7c5('0x2')]();var auth=require(_0xd7c5('0x3'));var interaction=require(_0xd7c5('0x4'));var config=require(_0xd7c5('0x5'));var controller=require(_0xd7c5('0x6'));router['get']('/',auth[_0xd7c5('0x7')](),controller[_0xd7c5('0x8')]);router[_0xd7c5('0x9')](_0xd7c5('0xa'),auth['isAuthenticated'](),controller[_0xd7c5('0xb')]);router[_0xd7c5('0x9')](_0xd7c5('0xc'),auth[_0xd7c5('0x7')](),controller[_0xd7c5('0xd')]);router[_0xd7c5('0xe')]('/',auth[_0xd7c5('0x7')](),controller[_0xd7c5('0xf')]);router['put'](_0xd7c5('0xc'),auth['isAuthenticated'](),controller[_0xd7c5('0x10')]);router[_0xd7c5('0x11')](_0xd7c5('0xc'),auth[_0xd7c5('0x7')](),controller[_0xd7c5('0x12')]);module[_0xd7c5('0x13')]=router; \ No newline at end of file +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 diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 087eff2..4b05756 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(_0x2089b2,_0x16b016){var _0x4ada4d=function(_0x3d0115){while(--_0x3d0115){_0x2089b2['push'](_0x2089b2['shift']());}};_0x4ada4d(++_0x16b016);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'type':{'type':Sequelize[_0x7995('0x3')]('inbound',_0x7995('0x4'),_0x7995('0x5'),_0x7995('0x6'),_0x7995('0x7'),'dialer')},'tag':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'source':{'type':Sequelize[_0x7995('0x2')]},'destination':{'type':Sequelize[_0x7995('0x2')]},'destinationcontext':{'type':Sequelize[_0x7995('0x2')]},'callerid':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x7995('0x2')]},'lastapplication':{'type':Sequelize[_0x7995('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x7995('0x8')]},'systemanswertime':{'type':Sequelize[_0x7995('0x8')]},'answertime':{'type':Sequelize[_0x7995('0x8')]},'endtime':{'type':Sequelize[_0x7995('0x8')]},'duration':{'type':Sequelize[_0x7995('0x9')]},'billableseconds':{'type':Sequelize[_0x7995('0x9')]},'mohtime':{'type':Sequelize[_0x7995('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x7995('0x2')]},'userfield':{'type':Sequelize[_0x7995('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7995('0x2')]},'prefix':{'type':Sequelize[_0x7995('0x2')]},'routeid':{'type':Sequelize[_0x7995('0x9')]},'sipcallid':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x9957=['ENUM','internal','outbound','inbound-fax','outbound-fax','DATE','INTEGER','sequelize','exports','STRING'];(function(_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 diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 45f58a0..b17d5da 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 _0xdc37=['error','name','index','map','VoiceCallReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','fullname','alias','User','findAll','catch','params','create','body','find','describe','uniqueid','user','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','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','save','update','destroy','then'];(function(_0x5c2baf,_0x28d472){var _0x34168f=function(_0x545a62){while(--_0x545a62){_0x5c2baf['push'](_0x5c2baf['shift']());}};_0x34168f(++_0x28d472);}(_0xdc37,0xc3));var _0x7dc3=function(_0x22b8a3,_0x2a79a7){_0x22b8a3=_0x22b8a3-0x0;var _0x199a0c=_0xdc37[_0x22b8a3];return _0x199a0c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7dc3('0x0'));var rimraf=require(_0x7dc3('0x1'));var zipdir=require(_0x7dc3('0x2'));var jsonpatch=require(_0x7dc3('0x3'));var rp=require(_0x7dc3('0x4'));var moment=require(_0x7dc3('0x5'));var BPromise=require(_0x7dc3('0x6'));var Mustache=require(_0x7dc3('0x7'));var util=require(_0x7dc3('0x8'));var path=require(_0x7dc3('0x9'));var sox=require(_0x7dc3('0xa'));var csv=require(_0x7dc3('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7dc3('0xc'));var squel=require(_0x7dc3('0xd'));var crypto=require('crypto');var jsforce=require(_0x7dc3('0xe'));var deskjs=require(_0x7dc3('0xf'));var toCsv=require(_0x7dc3('0xb'));var querystring=require(_0x7dc3('0x10'));var Papa=require(_0x7dc3('0x11'));var Redis=require(_0x7dc3('0x12'));var authService=require(_0x7dc3('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7dc3('0x14'))('api');var utils=require(_0x7dc3('0x15'));var config=require(_0x7dc3('0x16'));var db=require(_0x7dc3('0x17'))['db'];function respondWithStatusCode(_0x16e8f2,_0x4fac7e){_0x4fac7e=_0x4fac7e||0xcc;return function(_0x521713){if(_0x521713){return _0x16e8f2[_0x7dc3('0x18')](_0x4fac7e);}return _0x16e8f2[_0x7dc3('0x19')](_0x4fac7e)[_0x7dc3('0x1a')]();};}function respondWithResult(_0x19dd64,_0x1f4dee){_0x1f4dee=_0x1f4dee||0xc8;return function(_0x4cd474){if(_0x4cd474){return _0x19dd64[_0x7dc3('0x19')](_0x1f4dee)[_0x7dc3('0x1b')](_0x4cd474);}};}function respondWithFilteredResult(_0x453e3b,_0x3377aa){return function(_0xe93f6d){if(_0xe93f6d){var _0x36f022=_0xe93f6d[_0x7dc3('0x1c')],_0x1ddbd4=_0x3377aa[_0x7dc3('0x1d')],_0x11dc45=_0x3377aa['offset']+_0x3377aa['limit'],_0x50539a;if(_0x11dc45>=_0x36f022){_0x11dc45=_0x36f022;_0x50539a=0xc8;}else{_0x50539a=0xce;}_0x453e3b[_0x7dc3('0x19')](_0x50539a);return _0x453e3b['set'](_0x7dc3('0x1e'),_0x1ddbd4+'-'+_0x11dc45+'/'+_0x36f022)[_0x7dc3('0x1b')](_0xe93f6d);}return null;};}function patchUpdates(_0x5ae25){return function(_0x406408){try{jsonpatch[_0x7dc3('0x1f')](_0x406408,_0x5ae25,!![]);}catch(_0xc5a689){return BPromise['reject'](_0xc5a689);}return _0x406408[_0x7dc3('0x20')]();};}function saveUpdates(_0x451186,_0x11552e){return function(_0x550f19){if(_0x550f19){return _0x550f19[_0x7dc3('0x21')](_0x451186)['then'](function(_0xe58fee){return _0xe58fee;});}return null;};}function removeEntity(_0x42ab1e,_0xb0fe10){return function(_0x4614d6){if(_0x4614d6){return _0x4614d6[_0x7dc3('0x22')]()[_0x7dc3('0x23')](function(){_0x42ab1e[_0x7dc3('0x19')](0xcc)[_0x7dc3('0x1a')]();});}};}function handleEntityNotFound(_0x590a00,_0x5afb87){return function(_0x4cd682){if(!_0x4cd682){_0x590a00[_0x7dc3('0x18')](0x194);}return _0x4cd682;};}function handleError(_0x2b0e60,_0x4bd371){_0x4bd371=_0x4bd371||0x1f4;return function(_0xa739fd){logger[_0x7dc3('0x24')](_0xa739fd['stack']);if(_0xa739fd['name']){delete _0xa739fd[_0x7dc3('0x25')];}_0x2b0e60[_0x7dc3('0x19')](_0x4bd371)['send'](_0xa739fd);};}exports[_0x7dc3('0x26')]=function(_0x1c7a75,_0x265edb){var _0x307cac={},_0x26bf53={},_0x45f00a={'count':0x0,'rows':[]};var _0x53bc3d=_[_0x7dc3('0x27')](db[_0x7dc3('0x28')][_0x7dc3('0x29')],function(_0x1b67b8){return{'name':_0x1b67b8[_0x7dc3('0x2a')],'type':_0x1b67b8['type'][_0x7dc3('0x2b')]};});_0x26bf53['model']=_[_0x7dc3('0x27')](_0x53bc3d,'name');_0x26bf53[_0x7dc3('0x2c')]=_[_0x7dc3('0x2d')](_0x1c7a75[_0x7dc3('0x2c')]);_0x26bf53[_0x7dc3('0x2e')]=_[_0x7dc3('0x2f')](_0x26bf53[_0x7dc3('0x30')],_0x26bf53[_0x7dc3('0x2c')]);_0x307cac[_0x7dc3('0x31')]=_['intersection'](_0x26bf53[_0x7dc3('0x30')],qs[_0x7dc3('0x32')](_0x1c7a75[_0x7dc3('0x2c')][_0x7dc3('0x32')]));_0x307cac[_0x7dc3('0x31')]=_0x307cac[_0x7dc3('0x31')][_0x7dc3('0x33')]?_0x307cac[_0x7dc3('0x31')]:_0x26bf53[_0x7dc3('0x30')];if(!_0x1c7a75[_0x7dc3('0x2c')][_0x7dc3('0x34')](_0x7dc3('0x35'))){_0x307cac[_0x7dc3('0x36')]=qs['limit'](_0x1c7a75['query'][_0x7dc3('0x36')]);_0x307cac[_0x7dc3('0x1d')]=qs[_0x7dc3('0x1d')](_0x1c7a75[_0x7dc3('0x2c')][_0x7dc3('0x1d')]);}_0x307cac['order']=qs[_0x7dc3('0x37')](_0x1c7a75['query']['sort']);_0x307cac[_0x7dc3('0x38')]=qs['filters'](_[_0x7dc3('0x39')](_0x1c7a75[_0x7dc3('0x2c')],_0x26bf53['filters']));if(_0x1c7a75[_0x7dc3('0x2c')][_0x7dc3('0x3a')]){_0x307cac[_0x7dc3('0x38')]=_[_0x7dc3('0x3b')](_0x307cac[_0x7dc3('0x38')],{'$or':_[_0x7dc3('0x27')](_0x53bc3d,function(_0xaeb7b9){if(_0xaeb7b9[_0x7dc3('0x3c')]!==_0x7dc3('0x3d')){var _0x4cd073={};_0x4cd073[_0xaeb7b9[_0x7dc3('0x25')]]={'$like':'%'+_0x1c7a75['query'][_0x7dc3('0x3a')]+'%'};return _0x4cd073;}})});}_0x307cac=_[_0x7dc3('0x3b')]({},_0x307cac,_0x1c7a75[_0x7dc3('0x3e')]);var _0x46e75f={'where':_0x307cac[_0x7dc3('0x38')]};return db[_0x7dc3('0x28')][_0x7dc3('0x1c')](_0x46e75f)[_0x7dc3('0x23')](function(_0x3752dd){_0x45f00a['count']=_0x3752dd;if(_0x1c7a75[_0x7dc3('0x2c')][_0x7dc3('0x3f')]){_0x307cac[_0x7dc3('0x40')]=[{'attributes':['id',_0x7dc3('0x25'),_0x7dc3('0x41'),_0x7dc3('0x42')],'model':db[_0x7dc3('0x43')],'as':_0x7dc3('0x43')}];}return db[_0x7dc3('0x28')][_0x7dc3('0x44')](_0x307cac);})[_0x7dc3('0x23')](function(_0x404e40){_0x45f00a['rows']=_0x404e40;return _0x45f00a;})[_0x7dc3('0x23')](respondWithFilteredResult(_0x265edb,_0x307cac))[_0x7dc3('0x45')](handleError(_0x265edb,null));};exports['show']=function(_0x3a72ff,_0x96d79){var _0x45bd53={'raw':!![],'where':{'id':_0x3a72ff[_0x7dc3('0x46')]['id']}},_0xf1d804={};_0xf1d804['model']=_['keys'](db[_0x7dc3('0x28')][_0x7dc3('0x29')]);_0xf1d804['query']=_['keys'](_0x3a72ff[_0x7dc3('0x2c')]);_0xf1d804['filters']=_[_0x7dc3('0x2f')](_0xf1d804[_0x7dc3('0x30')],_0xf1d804[_0x7dc3('0x2c')]);_0x45bd53[_0x7dc3('0x31')]=_[_0x7dc3('0x2f')](_0xf1d804[_0x7dc3('0x30')],qs[_0x7dc3('0x32')](_0x3a72ff[_0x7dc3('0x2c')][_0x7dc3('0x32')]));_0x45bd53['attributes']=_0x45bd53[_0x7dc3('0x31')]['length']?_0x45bd53[_0x7dc3('0x31')]:_0xf1d804[_0x7dc3('0x30')];if(_0x3a72ff['query'][_0x7dc3('0x3f')]){_0x45bd53[_0x7dc3('0x40')]=[{'all':!![]}];}_0x45bd53=_[_0x7dc3('0x3b')]({},_0x45bd53,_0x3a72ff['options']);return db[_0x7dc3('0x28')]['find'](_0x45bd53)[_0x7dc3('0x23')](handleEntityNotFound(_0x96d79,null))[_0x7dc3('0x23')](respondWithResult(_0x96d79,null))['catch'](handleError(_0x96d79,null));};exports['create']=function(_0x4bb116,_0x4acd33){return db[_0x7dc3('0x28')][_0x7dc3('0x47')](_0x4bb116[_0x7dc3('0x48')],{})[_0x7dc3('0x23')](respondWithResult(_0x4acd33,0xc9))['catch'](handleError(_0x4acd33,null));};exports['destroy']=function(_0x5a5ca3,_0x4abb5d){return db[_0x7dc3('0x28')][_0x7dc3('0x49')]({'where':{'id':_0x5a5ca3['params']['id']}})[_0x7dc3('0x23')](handleEntityNotFound(_0x4abb5d,null))['then'](removeEntity(_0x4abb5d,null))['catch'](handleError(_0x4abb5d,null));};exports[_0x7dc3('0x4a')]=function(_0x545dc3,_0x1d1330){return db[_0x7dc3('0x28')][_0x7dc3('0x4a')]()[_0x7dc3('0x23')](respondWithResult(_0x1d1330,null))[_0x7dc3('0x45')](handleError(_0x1d1330,null));};exports[_0x7dc3('0x21')]=function(_0x44443f,_0x585618){if(_0x44443f[_0x7dc3('0x48')][_0x7dc3('0x4b')]){delete _0x44443f[_0x7dc3('0x48')][_0x7dc3('0x4b')];}return db[_0x7dc3('0x28')][_0x7dc3('0x49')]({'where':{'uniqueid':_0x44443f[_0x7dc3('0x46')]['id'],'UserId':{'$or':[null,_0x44443f[_0x7dc3('0x4c')]['id']]}}})[_0x7dc3('0x23')](handleEntityNotFound(_0x585618,null))[_0x7dc3('0x23')](saveUpdates(_0x44443f[_0x7dc3('0x48')],null))[_0x7dc3('0x23')](respondWithResult(_0x585618,null))['catch'](handleError(_0x585618,null));}; \ No newline at end of file +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 diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index bb71b6f..aed44c3 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 _0xe223=['exports','report_call','uniqueid','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes'];(function(_0x45544e,_0x396713){var _0x323bdd=function(_0x3dbaf0){while(--_0x3dbaf0){_0x45544e['push'](_0x45544e['shift']());}};_0x323bdd(++_0x396713);}(_0xe223,0xc3));var _0x3e22=function(_0x15b1ec,_0x15ee62){_0x15b1ec=_0x15b1ec-0x0;var _0x33320c=_0xe223[_0x15b1ec];return _0x33320c;};'use strict';var _=require(_0x3e22('0x0'));var util=require(_0x3e22('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3e22('0x2'));var BPromise=require(_0x3e22('0x3'));var rp=require(_0x3e22('0x4'));var fs=require('fs');var path=require(_0x3e22('0x5'));var rimraf=require(_0x3e22('0x6'));var config=require(_0x3e22('0x7'));var attributes=require(_0x3e22('0x8'));module[_0x3e22('0x9')]=function(_0x5def84,_0x3749d2){return _0x5def84['define']('VoiceCallReport',attributes,{'tableName':_0x3e22('0xa'),'paranoid':![],'indexes':[{'fields':[_0x3e22('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index b7feee0..af7ccee 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 _0xbd2f=['VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceCallReport','stringify','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x390a19,_0x5dd137){var _0x5d8230=function(_0x2e6234){while(--_0x2e6234){_0x390a19['push'](_0x390a19['shift']());}};_0x5d8230(++_0x5dd137);}(_0xbd2f,0x1b9));var _0xfbd2=function(_0x4e3867,_0x67aed3){_0x4e3867=_0x4e3867-0x0;var _0x12d23c=_0xbd2f[_0x4e3867];return _0x12d23c;};'use strict';var _=require(_0xfbd2('0x0'));var util=require(_0xfbd2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfbd2('0x2'));var fs=require('fs');var Redis=require(_0xfbd2('0x3'));var db=require(_0xfbd2('0x4'))['db'];var utils=require(_0xfbd2('0x5'));var logger=require(_0xfbd2('0x6'))(_0xfbd2('0x7'));var config=require('../../config/environment');var jayson=require(_0xfbd2('0x8'));var client=jayson[_0xfbd2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a0dbc,_0x1ad38c,_0x220910){return new BPromise(function(_0xac85c2,_0xb3adde){return client[_0xfbd2('0xa')](_0x5a0dbc,_0x220910)[_0xfbd2('0xb')](function(_0x1dd03c){logger['info'](_0xfbd2('0xc'),_0x1ad38c,_0xfbd2('0xd'));logger[_0xfbd2('0xe')](_0xfbd2('0xf'),_0x1ad38c,_0xfbd2('0xd'),JSON['stringify'](_0x1dd03c));if(_0x1dd03c['error']){if(_0x1dd03c[_0xfbd2('0x10')][_0xfbd2('0x11')]===0x1f4){logger[_0xfbd2('0x10')](_0xfbd2('0xc'),_0x1ad38c,_0x1dd03c['error'][_0xfbd2('0x12')]);return _0xb3adde(_0x1dd03c[_0xfbd2('0x10')][_0xfbd2('0x12')]);}logger[_0xfbd2('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x1ad38c,_0x1dd03c['error'][_0xfbd2('0x12')]);return _0xac85c2(_0x1dd03c['error'][_0xfbd2('0x12')]);}else{logger[_0xfbd2('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x1ad38c,_0xfbd2('0xd'));_0xac85c2(_0x1dd03c[_0xfbd2('0x14')][_0xfbd2('0x12')]);}})[_0xfbd2('0x15')](function(_0x195905){logger[_0xfbd2('0x10')](_0xfbd2('0xc'),_0x1ad38c,_0x195905);_0xb3adde(_0x195905);});});}exports['GetVoiceCallReport']=function(_0x486a87){var _0x12bacb=this;return new Promise(function(_0x4ab071,_0x139d5c){return db[_0xfbd2('0x16')][_0xfbd2('0x17')]({'raw':_0x486a87[_0xfbd2('0x18')]?_0x486a87[_0xfbd2('0x18')][_0xfbd2('0x19')]===undefined?!![]:![]:!![],'where':_0x486a87['options']?_0x486a87[_0xfbd2('0x18')][_0xfbd2('0x1a')]||null:null,'attributes':_0x486a87['options']?_0x486a87[_0xfbd2('0x18')][_0xfbd2('0x1b')]||null:null,'limit':_0x486a87[_0xfbd2('0x18')]?_0x486a87[_0xfbd2('0x18')][_0xfbd2('0x1c')]||null:null,'include':_0x486a87[_0xfbd2('0x18')]?_0x486a87[_0xfbd2('0x18')][_0xfbd2('0x1d')]?_[_0xfbd2('0x1e')](_0x486a87[_0xfbd2('0x18')][_0xfbd2('0x1d')],function(_0x5e62c1){return{'model':db[_0x5e62c1[_0xfbd2('0x1f')]],'as':_0x5e62c1['as'],'attributes':_0x5e62c1[_0xfbd2('0x1b')],'include':_0x5e62c1[_0xfbd2('0x1d')]?_[_0xfbd2('0x1e')](_0x5e62c1[_0xfbd2('0x1d')],function(_0x3b35d0){return{'model':db[_0x3b35d0[_0xfbd2('0x1f')]],'as':_0x3b35d0['as'],'attributes':_0x3b35d0[_0xfbd2('0x1b')],'include':_0x3b35d0[_0xfbd2('0x1d')]?_[_0xfbd2('0x1e')](_0x3b35d0[_0xfbd2('0x1d')],function(_0x396c59){return{'model':db[_0x396c59[_0xfbd2('0x1f')]],'as':_0x396c59['as'],'attributes':_0x396c59[_0xfbd2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xfbd2('0xb')](function(_0x5dda17){logger['info'](_0xfbd2('0x20'),_0x486a87);logger['debug']('GetVoiceCallReport',_0x486a87,JSON[_0xfbd2('0x21')](_0x5dda17));_0x4ab071(_0x5dda17);})[_0xfbd2('0x15')](function(_0x1b5a8a){logger[_0xfbd2('0x10')]('GetVoiceCallReport',_0x1b5a8a[_0xfbd2('0x12')],_0x486a87);_0x139d5c(_0x12bacb[_0xfbd2('0x10')](0x1f4,_0x1b5a8a[_0xfbd2('0x12')]));});});};exports[_0xfbd2('0x22')]=function(_0x1910bf){var _0x474018=this;return new Promise(function(_0x51bac4,_0x560f72){return db[_0xfbd2('0x16')][_0xfbd2('0x23')](_0x1910bf[_0xfbd2('0x24')],{'raw':_0x1910bf[_0xfbd2('0x18')]?_0x1910bf[_0xfbd2('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x47935b){logger[_0xfbd2('0x13')](_0xfbd2('0x22'),_0x1910bf);logger[_0xfbd2('0xe')]('CreateVoiceCallReport',_0x1910bf,JSON['stringify'](_0x47935b));_0x51bac4(_0x47935b);})[_0xfbd2('0x15')](function(_0x3bf136){logger[_0xfbd2('0x10')]('CreateVoiceCallReport',_0x3bf136[_0xfbd2('0x12')],_0x1910bf);_0x560f72(_0x474018['error'](0x1f4,_0x3bf136[_0xfbd2('0x12')]));});});};exports[_0xfbd2('0x25')]=function(_0x8b1b5){var _0x5117df=this;return new Promise(function(_0x5abe5c,_0xe9405d){return db[_0xfbd2('0x16')]['update'](_0x8b1b5[_0xfbd2('0x24')],{'raw':_0x8b1b5['options']?_0x8b1b5[_0xfbd2('0x18')][_0xfbd2('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8b1b5['options']?_0x8b1b5[_0xfbd2('0x18')][_0xfbd2('0x1a')]||null:null,'attributes':_0x8b1b5['options']?_0x8b1b5[_0xfbd2('0x18')][_0xfbd2('0x1b')]||null:null,'limit':_0x8b1b5['options']?_0x8b1b5[_0xfbd2('0x18')][_0xfbd2('0x1c')]||null:null})['then'](function(_0x22996a){logger[_0xfbd2('0x13')]('UpdateVoiceCallReport',_0x8b1b5);logger['debug'](_0xfbd2('0x25'),_0x8b1b5,JSON['stringify'](_0x22996a));_0x5abe5c(_0x22996a);})[_0xfbd2('0x15')](function(_0x118166){logger[_0xfbd2('0x10')](_0xfbd2('0x25'),_0x118166['message'],_0x8b1b5);_0xe9405d(_0x5117df[_0xfbd2('0x10')](0x1f4,_0x118166['message']));});});}; \ No newline at end of file +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 diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index ca51854..67470b0 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 _0xf3ff=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','get','isAuthenticated','/:id','show','post','update','destroy','exports','multer','path'];(function(_0x4a489f,_0x5402ab){var _0x4a4137=function(_0x4e35f3){while(--_0x4e35f3){_0x4a489f['push'](_0x4a489f['shift']());}};_0x4a4137(++_0x5402ab);}(_0xf3ff,0xae));var _0xff3f=function(_0x33c2b3,_0x4d8f40){_0x33c2b3=_0x33c2b3-0x0;var _0x4eea9e=_0xf3ff[_0x33c2b3];return _0x4eea9e;};'use strict';var multer=require(_0xff3f('0x0'));var util=require('util');var path=require(_0xff3f('0x1'));var timeout=require(_0xff3f('0x2'));var express=require(_0xff3f('0x3'));var router=express[_0xff3f('0x4')]();var auth=require(_0xff3f('0x5'));var interaction=require(_0xff3f('0x6'));var config=require('../../config/environment');var controller=require(_0xff3f('0x7'));router[_0xff3f('0x8')]('/',auth[_0xff3f('0x9')](),controller['index']);router[_0xff3f('0x8')](_0xff3f('0xa'),auth['isAuthenticated'](),controller[_0xff3f('0xb')]);router[_0xff3f('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xff3f('0xa'),auth['isAuthenticated'](),controller[_0xff3f('0xd')]);router['delete'](_0xff3f('0xa'),auth[_0xff3f('0x9')](),controller[_0xff3f('0xe')]);module[_0xff3f('0xf')]=router; \ No newline at end of file +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 diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 4475abc..3c644e1 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 _0xe7f6=['getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','options','join'];(function(_0xc7c7a1,_0x57a0a5){var _0x148ee7=function(_0x28a8e5){while(--_0x28a8e5){_0xc7c7a1['push'](_0xc7c7a1['shift']());}};_0x148ee7(++_0x57a0a5);}(_0xe7f6,0xff));var _0x6e7f=function(_0x514260,_0x1891e1){_0x514260=_0x514260-0x0;var _0x4ac81b=_0xe7f6[_0x514260];return _0x4ac81b;};'use strict';var Sequelize=require(_0x6e7f('0x0'));module[_0x6e7f('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x6e7f('0x2')],'unique':_0x6e7f('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x6e7f('0x2')],'set':function(_0x22131d){this['setDataValue'](_0x6e7f('0x4'),_0x22131d?_0x22131d[_0x6e7f('0x5')](''):[]);},'get':function(){return this[_0x6e7f('0x6')](_0x6e7f('0x4'))?this[_0x6e7f('0x6')]('options')[_0x6e7f('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x6e7f('0x2')]},'record':{'type':Sequelize[_0x6e7f('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x6e7f('0x2')]},'description':{'type':Sequelize[_0x6e7f('0x2')]}}; \ No newline at end of file +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 diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index bb78e9c..45d24b6 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 _0x93d6=['moment','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','sendStatus','end','status','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','ChanSpies','UserProfileResource','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','params','includeAll','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','html-pdf','eml-format','zip-dir','fast-json-patch'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x93d6,0x13c));var _0x693d=function(_0x10721,_0x3afd6b){_0x10721=_0x10721-0x0;var _0x11b3de=_0x93d6[_0x10721];return _0x11b3de;};'use strict';var pdf=require(_0x693d('0x0'));var emlformat=require(_0x693d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x693d('0x2'));var jsonpatch=require(_0x693d('0x3'));var rp=require('request-promise');var moment=require(_0x693d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x693d('0x5'));var util=require(_0x693d('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x693d('0x7'));var ejs=require(_0x693d('0x8'));var fs=require('fs');var _=require(_0x693d('0x9'));var squel=require(_0x693d('0xa'));var crypto=require(_0x693d('0xb'));var jsforce=require(_0x693d('0xc'));var deskjs=require(_0x693d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x693d('0xe'));var Papa=require(_0x693d('0xf'));var Redis=require(_0x693d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x693d('0x11'));var as=require(_0x693d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x693d('0x13'))(_0x693d('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ba157,_0x37bb63){_0x37bb63=_0x37bb63||0xcc;return function(_0x8de06c){if(_0x8de06c){return _0x3ba157[_0x693d('0x15')](_0x37bb63);}return _0x3ba157['status'](_0x37bb63)[_0x693d('0x16')]();};}function respondWithResult(_0x195bc4,_0x357ce7){_0x357ce7=_0x357ce7||0xc8;return function(_0x24b6ee){if(_0x24b6ee){return _0x195bc4[_0x693d('0x17')](_0x357ce7)['json'](_0x24b6ee);}};}function respondWithFilteredResult(_0x210e40,_0x4c664a){return function(_0x3de18c){if(_0x3de18c){var _0x25ea8c=_0x3de18c[_0x693d('0x18')],_0x8c120a=_0x4c664a[_0x693d('0x19')],_0x510d91=_0x4c664a[_0x693d('0x19')]+_0x4c664a[_0x693d('0x1a')],_0x2e8569;if(_0x510d91>=_0x25ea8c){_0x510d91=_0x25ea8c;_0x2e8569=0xc8;}else{_0x2e8569=0xce;}_0x210e40['status'](_0x2e8569);return _0x210e40[_0x693d('0x1b')](_0x693d('0x1c'),_0x8c120a+'-'+_0x510d91+'/'+_0x25ea8c)['json'](_0x3de18c);}return null;};}function patchUpdates(_0x51f499){return function(_0x562c9e){try{jsonpatch[_0x693d('0x1d')](_0x562c9e,_0x51f499,!![]);}catch(_0x2964ec){return BPromise[_0x693d('0x1e')](_0x2964ec);}return _0x562c9e[_0x693d('0x1f')]();};}function saveUpdates(_0x1e4f0b,_0x2cb16e){return function(_0x3661e5){if(_0x3661e5){return _0x3661e5[_0x693d('0x20')](_0x1e4f0b)[_0x693d('0x21')](function(_0x3d0e18){return _0x3d0e18;});}return null;};}function removeEntity(_0x5e314c,_0x554c0a){return function(_0x4705c7){if(_0x4705c7){return _0x4705c7['destroy']()[_0x693d('0x21')](function(){var _0x502417=_0x4705c7[_0x693d('0x22')]({'plain':!![]});var _0x36cfae=_0x693d('0x23');return db[_0x693d('0x24')]['destroy']({'where':{'type':_0x36cfae,'resourceId':_0x502417['id']}})['then'](function(){return _0x4705c7;});})[_0x693d('0x21')](function(){_0x5e314c['status'](0xcc)[_0x693d('0x16')]();});}};}function handleEntityNotFound(_0x14d8b1,_0x191f0e){return function(_0x1b984b){if(!_0x1b984b){_0x14d8b1[_0x693d('0x15')](0x194);}return _0x1b984b;};}function handleError(_0x5cb70c,_0xb89c44){_0xb89c44=_0xb89c44||0x1f4;return function(_0x2aeb21){logger[_0x693d('0x25')](_0x2aeb21[_0x693d('0x26')]);if(_0x2aeb21[_0x693d('0x27')]){delete _0x2aeb21['name'];}_0x5cb70c['status'](_0xb89c44)[_0x693d('0x28')](_0x2aeb21);};}exports[_0x693d('0x29')]=function(_0x93b0ef,_0x389deb){var _0xeae831={},_0x6b4755={},_0x29a8fd={'count':0x0,'rows':[]};var _0x3722a9=_[_0x693d('0x2a')](db[_0x693d('0x2b')][_0x693d('0x2c')],function(_0x140f57){return{'name':_0x140f57['fieldName'],'type':_0x140f57[_0x693d('0x2d')]['key']};});_0x6b4755[_0x693d('0x2e')]=_[_0x693d('0x2a')](_0x3722a9,_0x693d('0x27'));_0x6b4755['query']=_[_0x693d('0x2f')](_0x93b0ef['query']);_0x6b4755[_0x693d('0x30')]=_[_0x693d('0x31')](_0x6b4755['model'],_0x6b4755[_0x693d('0x32')]);_0xeae831[_0x693d('0x33')]=_[_0x693d('0x31')](_0x6b4755[_0x693d('0x2e')],qs['fields'](_0x93b0ef[_0x693d('0x32')][_0x693d('0x34')]));_0xeae831[_0x693d('0x33')]=_0xeae831[_0x693d('0x33')][_0x693d('0x35')]?_0xeae831['attributes']:_0x6b4755[_0x693d('0x2e')];if(!_0x93b0ef[_0x693d('0x32')][_0x693d('0x36')](_0x693d('0x37'))){_0xeae831[_0x693d('0x1a')]=qs[_0x693d('0x1a')](_0x93b0ef[_0x693d('0x32')]['limit']);_0xeae831[_0x693d('0x19')]=qs[_0x693d('0x19')](_0x93b0ef[_0x693d('0x32')]['offset']);}_0xeae831[_0x693d('0x38')]=qs[_0x693d('0x39')](_0x93b0ef[_0x693d('0x32')]['sort']);_0xeae831[_0x693d('0x3a')]=qs['filters'](_[_0x693d('0x3b')](_0x93b0ef[_0x693d('0x32')],_0x6b4755['filters']));if(_0x93b0ef[_0x693d('0x32')][_0x693d('0x3c')]){_0xeae831[_0x693d('0x3a')]=_[_0x693d('0x3d')](_0xeae831[_0x693d('0x3a')],{'$or':_[_0x693d('0x2a')](_0x3722a9,function(_0x26c030){if(_0x26c030['type']!==_0x693d('0x3e')){var _0x4cff84={};_0x4cff84[_0x26c030[_0x693d('0x27')]]={'$like':'%'+_0x93b0ef[_0x693d('0x32')][_0x693d('0x3c')]+'%'};return _0x4cff84;}})});}_0xeae831=_['merge']({},_0xeae831,_0x93b0ef[_0x693d('0x3f')]);var _0x599ff9={'where':_0xeae831[_0x693d('0x3a')]};return db[_0x693d('0x2b')]['count'](_0x599ff9)[_0x693d('0x21')](function(_0x2b2437){_0x29a8fd[_0x693d('0x18')]=_0x2b2437;if(_0x93b0ef[_0x693d('0x32')]['includeAll']){_0xeae831['include']=[{'all':!![]}];}return db[_0x693d('0x2b')][_0x693d('0x40')](_0xeae831);})[_0x693d('0x21')](function(_0x2b835c){_0x29a8fd[_0x693d('0x41')]=_0x2b835c;return _0x29a8fd;})[_0x693d('0x21')](respondWithFilteredResult(_0x389deb,_0xeae831))[_0x693d('0x42')](handleError(_0x389deb,null));};exports['show']=function(_0x1c5a3c,_0x2e5280){var _0x1a0992={'raw':![],'where':{'id':_0x1c5a3c[_0x693d('0x43')]['id']}},_0x35149b={};_0x35149b['model']=_[_0x693d('0x2f')](db[_0x693d('0x2b')][_0x693d('0x2c')]);_0x35149b[_0x693d('0x32')]=_[_0x693d('0x2f')](_0x1c5a3c[_0x693d('0x32')]);_0x35149b[_0x693d('0x30')]=_[_0x693d('0x31')](_0x35149b[_0x693d('0x2e')],_0x35149b[_0x693d('0x32')]);_0x1a0992[_0x693d('0x33')]=_[_0x693d('0x31')](_0x35149b['model'],qs[_0x693d('0x34')](_0x1c5a3c[_0x693d('0x32')][_0x693d('0x34')]));_0x1a0992[_0x693d('0x33')]=_0x1a0992[_0x693d('0x33')][_0x693d('0x35')]?_0x1a0992['attributes']:_0x35149b[_0x693d('0x2e')];if(_0x1c5a3c[_0x693d('0x32')][_0x693d('0x44')]){_0x1a0992[_0x693d('0x45')]=[{'all':!![]}];}_0x1a0992=_[_0x693d('0x3d')]({},_0x1a0992,_0x1c5a3c[_0x693d('0x3f')]);return db[_0x693d('0x2b')][_0x693d('0x46')](_0x1a0992)[_0x693d('0x21')](handleEntityNotFound(_0x2e5280,null))[_0x693d('0x21')](respondWithResult(_0x2e5280,null))[_0x693d('0x42')](handleError(_0x2e5280,null));};exports['create']=function(_0x46171f,_0x1ba69b){return db[_0x693d('0x2b')][_0x693d('0x47')](_0x46171f['body'],{})[_0x693d('0x21')](function(_0x4690d0){var _0x2da501=_0x46171f[_0x693d('0x48')]['get']({'plain':!![]});if(!_0x2da501)throw new Error(_0x693d('0x49'));if(_0x2da501['role']===_0x693d('0x48')){var _0x52eb7a=_0x4690d0[_0x693d('0x22')]({'plain':!![]});var _0x2b557b=_0x693d('0x23');return db[_0x693d('0x4a')]['find']({'where':{'name':_0x2b557b,'userProfileId':_0x2da501[_0x693d('0x4b')]},'raw':!![]})[_0x693d('0x21')](function(_0x3a74a6){if(_0x3a74a6&&_0x3a74a6[_0x693d('0x4c')]===0x0){return db[_0x693d('0x24')][_0x693d('0x47')]({'name':_0x52eb7a[_0x693d('0x27')],'resourceId':_0x52eb7a['id'],'type':_0x3a74a6['name'],'sectionId':_0x3a74a6['id']},{})[_0x693d('0x21')](function(){return _0x4690d0;});}else{return _0x4690d0;}})[_0x693d('0x42')](function(_0x2e2633){logger[_0x693d('0x25')](_0x693d('0x4d'),_0x2e2633);throw _0x2e2633;});}return _0x4690d0;})[_0x693d('0x21')](respondWithResult(_0x1ba69b,0xc9))['catch'](handleError(_0x1ba69b,null));};exports[_0x693d('0x20')]=function(_0x3921ad,_0x38c7ef){if(_0x3921ad[_0x693d('0x4e')]['id']){delete _0x3921ad[_0x693d('0x4e')]['id'];}return db['VoiceChanSpy'][_0x693d('0x46')]({'where':{'id':_0x3921ad[_0x693d('0x43')]['id']}})[_0x693d('0x21')](handleEntityNotFound(_0x38c7ef,null))[_0x693d('0x21')](saveUpdates(_0x3921ad[_0x693d('0x4e')],null))[_0x693d('0x21')](respondWithResult(_0x38c7ef,null))[_0x693d('0x42')](handleError(_0x38c7ef,null));};exports[_0x693d('0x4f')]=function(_0x1817bf,_0x5eae93){return db[_0x693d('0x2b')][_0x693d('0x46')]({'where':{'id':_0x1817bf['params']['id']}})[_0x693d('0x21')](handleEntityNotFound(_0x5eae93,null))[_0x693d('0x21')](removeEntity(_0x5eae93,null))[_0x693d('0x42')](handleError(_0x5eae93,null));}; \ No newline at end of file +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 diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 366f082..74c4d19 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 _0x0712=['SIP/%s,%s','options','join','StopMixMonitor','length','concat','internal','name','User','findAll','agent','then','exports','models','define','VoiceChanSpy','VoiceExtension','catch','destroy','bulkCreate','lodash','util','bluebird','from-sip','format','%s%s','prefix','system','push','Set','CDR(type)=%s','chanspy','record','merge','${UNIQUEID}.%s,ab','recordingFormat','Authenticate','password','ChanSpy'];(function(_0x399719,_0x232b0f){var _0x1bd3e9=function(_0x2fad56){while(--_0x2fad56){_0x399719['push'](_0x399719['shift']());}};_0x1bd3e9(++_0x232b0f);}(_0x0712,0x173));var _0x2071=function(_0x1978e2,_0x20cf0f){_0x1978e2=_0x1978e2-0x0;var _0x55af92=_0x0712[_0x1978e2];return _0x55af92;};'use strict';var _=require(_0x2071('0x0'));var util=require(_0x2071('0x1'));var BPromise=require(_0x2071('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x17b560,_0x5571a0,_0x433a98){var _0x5d3a20=0x1;var _0x3f4c13=[];var _0x5369c3={'context':_0x5571a0['context']||_0x2071('0x3'),'exten':util[_0x2071('0x4')](_0x2071('0x5'),_0x17b560[_0x2071('0x6')],_0x433a98),'type':_0x2071('0x7'),'isApp':![],'ChanSpyId':_0x17b560['id'],'UserId':_0x5571a0['id']};_0x3f4c13[_0x2071('0x8')](_['merge']({'app':_0x2071('0x9'),'appdata':util[_0x2071('0x4')](_0x2071('0xa'),_0x2071('0xb')),'priority':_0x5d3a20++},_0x5369c3));if(_0x17b560[_0x2071('0xc')]){_0x3f4c13[_0x2071('0x8')](_[_0x2071('0xd')]({'app':'MixMonitor','appdata':util[_0x2071('0x4')](_0x2071('0xe'),_0x17b560[_0x2071('0xf')]),'priority':_0x5d3a20++},_0x5369c3));}if(_0x17b560['auth']){_0x3f4c13[_0x2071('0x8')](_[_0x2071('0xd')]({'app':_0x2071('0x10'),'appdata':_0x17b560[_0x2071('0x11')],'priority':_0x5d3a20++},_0x5369c3));}_0x3f4c13[_0x2071('0x8')](_[_0x2071('0xd')]({'app':_0x2071('0x12'),'appdata':util['format'](_0x2071('0x13'),_0x5571a0['name'],_0x17b560[_0x2071('0x14')]?_0x17b560[_0x2071('0x14')][_0x2071('0x15')](''):''),'priority':_0x5d3a20++},_0x5369c3));if(_0x17b560[_0x2071('0xc')]){_0x3f4c13[_0x2071('0x8')](_[_0x2071('0xd')]({'app':_0x2071('0x16'),'priority':_0x5d3a20++},_0x5369c3));}return _0x3f4c13;};var getChanSpyApplications=function(_0x27cf75,_0xff9dfd){var _0x35beed=[];for(var _0x17195b=0x0,_0x1f6fa7=0x1;_0x17195b<_0xff9dfd[_0x2071('0x17')];_0x17195b++,_0x1f6fa7=0x1){_0x35beed=_0x35beed[_0x2071('0x18')](getUserApplications(_0x27cf75,_0xff9dfd[_0x17195b],_0xff9dfd[_0x17195b][_0x2071('0x19')]));if(_0xff9dfd[_0x17195b]['internal']!=_0xff9dfd[_0x17195b][_0x2071('0x1a')]){_0x35beed=_0x35beed['concat'](getUserApplications(_0x27cf75,_0xff9dfd[_0x17195b],_0xff9dfd[_0x17195b][_0x2071('0x1a')]));}}return _0x35beed;};var getChanSpyPromise=function(_0x18819d,_0x7aebb7){return new BPromise(function(_0x3e6771,_0x23f43a){return _0x18819d[_0x2071('0x1b')][_0x2071('0x1c')]({'attributes':['id',_0x2071('0x1a'),_0x2071('0x19')],'where':{'role':_0x2071('0x1d'),'chanspy':!![]},'raw':!![]})[_0x2071('0x1e')](function(_0x18ed61){if(_0x18ed61){return _0x3e6771(getChanSpyApplications(_0x7aebb7,_0x18ed61));}return _0x3e6771([]);})['catch'](function(_0x348b67){_0x23f43a(_0x348b67);});});};module[_0x2071('0x1f')]=function(_0x27cde6,_0x264548){var _0x2c4a27=_0x27cde6[_0x2071('0x20')];return _0x27cde6[_0x2071('0x21')](_0x2071('0x22'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2df485,_0xe7e0b3,_0x107a7d){return getChanSpyPromise(_0x2c4a27,_0x2df485)[_0x2071('0x1e')](function(_0x37f455){if(_0x37f455&&_0x37f455[_0x2071('0x17')]){return _0x2c4a27[_0x2071('0x23')]['bulkCreate'](_0x37f455);}})[_0x2071('0x1e')](function(){_0x107a7d();})[_0x2071('0x24')](function(_0x1df281){_0x107a7d(_0x1df281);});},'afterUpdate':function(_0x3f3ddc,_0x40ebff,_0x21c6aa){return _0x2c4a27[_0x2071('0x23')][_0x2071('0x25')]({'where':{'ChanSpyId':_0x3f3ddc['id']}})['then'](function(){return getChanSpyPromise(_0x2c4a27,_0x3f3ddc);})[_0x2071('0x1e')](function(_0x159dc3){if(_0x159dc3&&_0x159dc3[_0x2071('0x17')]){return _0x2c4a27[_0x2071('0x23')][_0x2071('0x26')](_0x159dc3);}})[_0x2071('0x1e')](function(){_0x21c6aa();})['catch'](function(_0x124840){_0x21c6aa(_0x124840);});},'afterDestroy':function(_0x21f2bd,_0x26366a,_0x597f01){return _0x2c4a27['VoiceExtension'][_0x2071('0x25')]({'where':{'ChanSpyId':_0x21f2bd['id']}})[_0x2071('0x1e')](function(){_0x597f01();})[_0x2071('0x24')](function(_0x680ff8){_0x597f01(_0x680ff8);});}}});}; \ No newline at end of file +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 diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 6fa5967..2e6efeb 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 _0xfda5=['info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then'];(function(_0x56ef82,_0x580abd){var _0x4866b8=function(_0x3f33e8){while(--_0x3f33e8){_0x56ef82['push'](_0x56ef82['shift']());}};_0x4866b8(++_0x580abd);}(_0xfda5,0x1c1));var _0x5fda=function(_0xc49ae3,_0x3f3239){_0xc49ae3=_0xc49ae3-0x0;var _0x846884=_0xfda5[_0xc49ae3];return _0x846884;};'use strict';var _=require(_0x5fda('0x0'));var util=require(_0x5fda('0x1'));var moment=require('moment');var BPromise=require(_0x5fda('0x2'));var rs=require(_0x5fda('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5fda('0x4'))['db'];var utils=require(_0x5fda('0x5'));var logger=require(_0x5fda('0x6'))(_0x5fda('0x7'));var config=require('../../config/environment');var jayson=require(_0x5fda('0x8'));var client=jayson[_0x5fda('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x516417,_0x2f20c8,_0x5aefeb){return new BPromise(function(_0x576e81,_0x1e49e0){return client['request'](_0x516417,_0x5aefeb)[_0x5fda('0xa')](function(_0x3b82cb){logger[_0x5fda('0xb')](_0x5fda('0xc'),_0x2f20c8,_0x5fda('0xd'));logger[_0x5fda('0xe')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x2f20c8,_0x5fda('0xd'),JSON[_0x5fda('0xf')](_0x3b82cb));if(_0x3b82cb[_0x5fda('0x10')]){if(_0x3b82cb[_0x5fda('0x10')][_0x5fda('0x11')]===0x1f4){logger[_0x5fda('0x10')](_0x5fda('0xc'),_0x2f20c8,_0x3b82cb['error'][_0x5fda('0x12')]);return _0x1e49e0(_0x3b82cb[_0x5fda('0x10')][_0x5fda('0x12')]);}logger[_0x5fda('0x10')](_0x5fda('0xc'),_0x2f20c8,_0x3b82cb['error'][_0x5fda('0x12')]);return _0x576e81(_0x3b82cb[_0x5fda('0x10')][_0x5fda('0x12')]);}else{logger[_0x5fda('0xb')](_0x5fda('0xc'),_0x2f20c8,'request\x20sent');_0x576e81(_0x3b82cb[_0x5fda('0x13')][_0x5fda('0x12')]);}})['catch'](function(_0x21a9b4){logger[_0x5fda('0x10')](_0x5fda('0xc'),_0x2f20c8,_0x21a9b4);_0x1e49e0(_0x21a9b4);});});} \ No newline at end of file +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 diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 3d8da11..4afa0a2 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 _0x7bee=['isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x43a7f1,_0x2aa326){var _0x512471=function(_0x512f86){while(--_0x512f86){_0x43a7f1['push'](_0x43a7f1['shift']());}};_0x512471(++_0x2aa326);}(_0x7bee,0x180));var _0xe7be=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7bee[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xe7be('0x0'));var util=require(_0xe7be('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe7be('0x2'));var router=express[_0xe7be('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xe7be('0x4'));var config=require(_0xe7be('0x5'));var controller=require('./voiceContext.controller');router[_0xe7be('0x6')]('/',auth[_0xe7be('0x7')](),controller[_0xe7be('0x8')]);router['get'](_0xe7be('0x9'),auth[_0xe7be('0x7')](),controller[_0xe7be('0xa')]);router[_0xe7be('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe7be('0xc')](_0xe7be('0x9'),auth[_0xe7be('0x7')](),controller[_0xe7be('0xd')]);router[_0xe7be('0xe')](_0xe7be('0x9'),auth[_0xe7be('0x7')](),controller[_0xe7be('0xf')]);module[_0xe7be('0x10')]=router; \ No newline at end of file +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 diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index ba0a041..e749167 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(_0x2b739d,_0x37c634){var _0x371c6e=function(_0x2566ed){while(--_0x2566ed){_0x2b739d['push'](_0x2b739d['shift']());}};_0x371c6e(++_0x37c634);}(_0x34e8,0x12c));var _0x834e=function(_0x126231,_0x2c4668){_0x126231=_0x126231-0x0;var _0x46c1bc=_0x34e8[_0x126231];return _0x46c1bc;};'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 _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 diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index c361d04..e7b3eed 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 _0xe141=['query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','VoiceContext','include','findAll','rows','show','params','includeAll','create','body','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','sendStatus','status','json','count','set','Content-Range','apply','reject','save','update','destroy','get','Contexts','end','stack','name','send','index','rawAttributes','type','model','map'];(function(_0x3f0656,_0x1b1dff){var _0x2d73ae=function(_0xd3d2d1){while(--_0xd3d2d1){_0x3f0656['push'](_0x3f0656['shift']());}};_0x2d73ae(++_0x1b1dff);}(_0xe141,0x169));var _0x1e14=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xe141[_0x18a79d];return _0x4f8848;};'use strict';var pdf=require(_0x1e14('0x0'));var emlformat=require(_0x1e14('0x1'));var rimraf=require(_0x1e14('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e14('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1e14('0x4'));var Mustache=require(_0x1e14('0x5'));var util=require(_0x1e14('0x6'));var path=require(_0x1e14('0x7'));var sox=require(_0x1e14('0x8'));var csv=require(_0x1e14('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1e14('0xa'));var squel=require(_0x1e14('0xb'));var crypto=require('crypto');var jsforce=require(_0x1e14('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1e14('0x9'));var querystring=require(_0x1e14('0xd'));var Papa=require(_0x1e14('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1e14('0xf'));var hardwareService=require(_0x1e14('0x10'));var logger=require(_0x1e14('0x11'))(_0x1e14('0x12'));var utils=require(_0x1e14('0x13'));var config=require(_0x1e14('0x14'));var db=require(_0x1e14('0x15'))['db'];var jayson=require(_0x1e14('0x16'));var client=jayson[_0x1e14('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0x54632a,_0x488a27,_0x141ca4){if(_0x141ca4){var _0x37733c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x37733c[_0x1e14('0x18')](_0x488a27)){return _0x54632a;}else{throw new db['Sequelize'][(_0x1e14('0x19'))](_0x1e14('0x1a'));}}else{return _0x54632a;}}function respondWithRpcPromise(_0x17679e,_0x52edff,_0x7b0309,_0x3474df){return new BPromise(function(_0x4d819b,_0xcf1beb){var _0x297456=_0x3474df||client;return _0x297456['request'](_0x17679e,_0x7b0309)[_0x1e14('0x1b')](function(_0x3d93d8){logger[_0x1e14('0x1c')](_0x1e14('0x1d'),_0x52edff,_0x1e14('0x1e'));logger['debug'](_0x1e14('0x1f'),_0x52edff,_0x1e14('0x1e'),JSON['stringify'](_0x3d93d8));if(_0x3d93d8['error']){if(_0x3d93d8['error'][_0x1e14('0x20')]===0x1f4){logger['error'](_0x1e14('0x1d'),_0x52edff,_0x3d93d8[_0x1e14('0x21')][_0x1e14('0x22')]);return _0xcf1beb(_0x3d93d8[_0x1e14('0x21')][_0x1e14('0x22')]);}logger['error'](_0x1e14('0x1d'),_0x52edff,_0x3d93d8[_0x1e14('0x21')]['message']);return _0x4d819b(_0x3d93d8[_0x1e14('0x21')][_0x1e14('0x22')]);}else{logger[_0x1e14('0x1c')](_0x1e14('0x1d'),_0x52edff,'request\x20sent');_0x4d819b(_0x3d93d8[_0x1e14('0x23')]['message']);}})[_0x1e14('0x24')](function(_0xbeaf2){logger[_0x1e14('0x21')](_0x1e14('0x1d'),_0x52edff,_0xbeaf2);_0xcf1beb(_0xbeaf2);});});}function respondWithStatusCode(_0x3e40fb,_0x328709){_0x328709=_0x328709||0xcc;return function(_0x35f70f){if(_0x35f70f){return _0x3e40fb[_0x1e14('0x25')](_0x328709);}return _0x3e40fb['status'](_0x328709)['end']();};}function respondWithResult(_0x2547fd,_0x150ece){_0x150ece=_0x150ece||0xc8;return function(_0x515ada){if(_0x515ada){return _0x2547fd[_0x1e14('0x26')](_0x150ece)[_0x1e14('0x27')](_0x515ada);}};}function respondWithFilteredResult(_0x41777e,_0x26ac84){return function(_0x265c52){if(_0x265c52){var _0x44e572=_0x265c52[_0x1e14('0x28')],_0x5b375a=_0x26ac84['offset'],_0x3e4175=_0x26ac84['offset']+_0x26ac84['limit'],_0x323fdc;if(_0x3e4175>=_0x44e572){_0x3e4175=_0x44e572;_0x323fdc=0xc8;}else{_0x323fdc=0xce;}_0x41777e['status'](_0x323fdc);return _0x41777e[_0x1e14('0x29')](_0x1e14('0x2a'),_0x5b375a+'-'+_0x3e4175+'/'+_0x44e572)[_0x1e14('0x27')](_0x265c52);}return null;};}function patchUpdates(_0x59438e){return function(_0x663fbe){try{jsonpatch[_0x1e14('0x2b')](_0x663fbe,_0x59438e,!![]);}catch(_0x3ba809){return BPromise[_0x1e14('0x2c')](_0x3ba809);}return _0x663fbe[_0x1e14('0x2d')]();};}function saveUpdates(_0x19f7e1,_0x7bb9b2){return function(_0x41addf){if(_0x41addf){return _0x41addf[_0x1e14('0x2e')](_0x19f7e1)['then'](function(_0x12fdb9){return _0x12fdb9;});}return null;};}function removeEntity(_0x5ac6d0,_0x35910a){return function(_0x33abc9){if(_0x33abc9){return _0x33abc9[_0x1e14('0x2f')]()[_0x1e14('0x1b')](function(){var _0x22c161=_0x33abc9[_0x1e14('0x30')]({'plain':!![]});var _0x39942e=_0x1e14('0x31');return db['UserProfileResource']['destroy']({'where':{'type':_0x39942e,'resourceId':_0x22c161['id']}})['then'](function(){return _0x33abc9;});})[_0x1e14('0x1b')](function(){_0x5ac6d0[_0x1e14('0x26')](0xcc)[_0x1e14('0x32')]();});}};}function handleEntityNotFound(_0x49eb34,_0x443fe7){return function(_0x3663ea){if(!_0x3663ea){_0x49eb34['sendStatus'](0x194);}return _0x3663ea;};}function handleError(_0x324428,_0x1aa287){_0x1aa287=_0x1aa287||0x1f4;return function(_0x20410e){logger['error'](_0x20410e[_0x1e14('0x33')]);if(_0x20410e[_0x1e14('0x34')]){delete _0x20410e['name'];}_0x324428[_0x1e14('0x26')](_0x1aa287)[_0x1e14('0x35')](_0x20410e);};}exports[_0x1e14('0x36')]=function(_0x196d78,_0x58b8b5){var _0x4132cb={},_0x3f0be8={},_0x5b3d10={'count':0x0,'rows':[]};var _0xc745da=_['map'](db['VoiceContext'][_0x1e14('0x37')],function(_0x4ff18a){return{'name':_0x4ff18a['fieldName'],'type':_0x4ff18a[_0x1e14('0x38')]['key']};});_0x3f0be8[_0x1e14('0x39')]=_[_0x1e14('0x3a')](_0xc745da,_0x1e14('0x34'));_0x3f0be8[_0x1e14('0x3b')]=_[_0x1e14('0x3c')](_0x196d78[_0x1e14('0x3b')]);_0x3f0be8['filters']=_['intersection'](_0x3f0be8[_0x1e14('0x39')],_0x3f0be8[_0x1e14('0x3b')]);_0x4132cb[_0x1e14('0x3d')]=_[_0x1e14('0x3e')](_0x3f0be8[_0x1e14('0x39')],qs[_0x1e14('0x3f')](_0x196d78[_0x1e14('0x3b')][_0x1e14('0x3f')]));_0x4132cb[_0x1e14('0x3d')]=_0x4132cb[_0x1e14('0x3d')][_0x1e14('0x40')]?_0x4132cb[_0x1e14('0x3d')]:_0x3f0be8['model'];if(!_0x196d78['query'][_0x1e14('0x41')](_0x1e14('0x42'))){_0x4132cb[_0x1e14('0x43')]=qs[_0x1e14('0x43')](_0x196d78[_0x1e14('0x3b')]['limit']);_0x4132cb[_0x1e14('0x44')]=qs[_0x1e14('0x44')](_0x196d78['query'][_0x1e14('0x44')]);}_0x4132cb[_0x1e14('0x45')]=qs[_0x1e14('0x46')](_0x196d78[_0x1e14('0x3b')][_0x1e14('0x46')]);_0x4132cb[_0x1e14('0x47')]=qs[_0x1e14('0x48')](_[_0x1e14('0x49')](_0x196d78[_0x1e14('0x3b')],_0x3f0be8[_0x1e14('0x48')]));if(_0x196d78[_0x1e14('0x3b')][_0x1e14('0x4a')]){_0x4132cb[_0x1e14('0x47')]=_[_0x1e14('0x4b')](_0x4132cb[_0x1e14('0x47')],{'$or':_[_0x1e14('0x3a')](_0xc745da,function(_0x40be0d){if(_0x40be0d[_0x1e14('0x38')]!==_0x1e14('0x4c')){var _0xfb7ef1={};_0xfb7ef1[_0x40be0d[_0x1e14('0x34')]]={'$like':'%'+_0x196d78[_0x1e14('0x3b')][_0x1e14('0x4a')]+'%'};return _0xfb7ef1;}})});}_0x4132cb=_[_0x1e14('0x4b')]({},_0x4132cb,_0x196d78[_0x1e14('0x4d')]);var _0x42c34c={'where':_0x4132cb[_0x1e14('0x47')]};return db[_0x1e14('0x4e')][_0x1e14('0x28')](_0x42c34c)[_0x1e14('0x1b')](function(_0x276198){_0x5b3d10['count']=_0x276198;if(_0x196d78[_0x1e14('0x3b')]['includeAll']){_0x4132cb[_0x1e14('0x4f')]=[{'all':!![]}];}return db['VoiceContext'][_0x1e14('0x50')](_0x4132cb);})[_0x1e14('0x1b')](function(_0x262904){_0x5b3d10[_0x1e14('0x51')]=_0x262904;return _0x5b3d10;})[_0x1e14('0x1b')](respondWithFilteredResult(_0x58b8b5,_0x4132cb))['catch'](handleError(_0x58b8b5,null));};exports[_0x1e14('0x52')]=function(_0x380fd7,_0x24ffb6){var _0x2cb2f6={'raw':![],'where':{'id':_0x380fd7[_0x1e14('0x53')]['id']}},_0x5a4e92={};_0x5a4e92[_0x1e14('0x39')]=_[_0x1e14('0x3c')](db[_0x1e14('0x4e')][_0x1e14('0x37')]);_0x5a4e92[_0x1e14('0x3b')]=_[_0x1e14('0x3c')](_0x380fd7[_0x1e14('0x3b')]);_0x5a4e92[_0x1e14('0x48')]=_[_0x1e14('0x3e')](_0x5a4e92[_0x1e14('0x39')],_0x5a4e92[_0x1e14('0x3b')]);_0x2cb2f6['attributes']=_[_0x1e14('0x3e')](_0x5a4e92[_0x1e14('0x39')],qs[_0x1e14('0x3f')](_0x380fd7[_0x1e14('0x3b')][_0x1e14('0x3f')]));_0x2cb2f6['attributes']=_0x2cb2f6[_0x1e14('0x3d')][_0x1e14('0x40')]?_0x2cb2f6[_0x1e14('0x3d')]:_0x5a4e92[_0x1e14('0x39')];if(_0x380fd7[_0x1e14('0x3b')][_0x1e14('0x54')]){_0x2cb2f6[_0x1e14('0x4f')]=[{'all':!![]}];}_0x2cb2f6=_[_0x1e14('0x4b')]({},_0x2cb2f6,_0x380fd7[_0x1e14('0x4d')]);return db[_0x1e14('0x4e')]['find'](_0x2cb2f6)[_0x1e14('0x1b')](handleEntityNotFound(_0x24ffb6,null))[_0x1e14('0x1b')](respondWithResult(_0x24ffb6,null))[_0x1e14('0x24')](handleError(_0x24ffb6,null));};exports[_0x1e14('0x55')]=function(_0x18be96,_0x261c31,_0x198fe2){var _0x1f5010;return db[_0x1e14('0x4e')][_0x1e14('0x55')](_0x18be96[_0x1e14('0x56')],{'raw':!![]})['then'](function(_0x21e28f){_0x1f5010=_0x21e28f;return db['VoiceContext'][_0x1e14('0x50')]({'raw':!![]});})[_0x1e14('0x1b')](function(_0x3f2a70){var _0x4af180=fs['readFileSync'](path[_0x1e14('0x57')](config[_0x1e14('0x58')],_0x1e14('0x59')),_0x1e14('0x5a'));var _0x112e73=ejs[_0x1e14('0x5b')](_0x4af180,{'contexts':_0x3f2a70||[]});fs[_0x1e14('0x5c')](_0x1e14('0x5d'),_0x112e73);})[_0x1e14('0x1b')](function(){return respondWithRpcPromise(_0x1e14('0x5e'),_0x1e14('0x55'),{'module':_0x1e14('0x5f')});})['then'](function(){var _0x33669c=_0x18be96['user'][_0x1e14('0x30')]({'plain':!![]});if(!_0x33669c)throw new Error(_0x1e14('0x60'));if(_0x33669c[_0x1e14('0x61')]===_0x1e14('0x62')){var _0x5b7281=_0x1f5010['get']({'plain':!![]});return db[_0x1e14('0x63')][_0x1e14('0x64')]({'where':{'name':_0x1e14('0x31'),'userProfileId':_0x33669c[_0x1e14('0x65')]},'raw':!![]})['then'](function(_0x1d7d28){if(_0x1d7d28&&_0x1d7d28['autoAssociation']===0x0){return db[_0x1e14('0x66')][_0x1e14('0x55')]({'name':_0x5b7281[_0x1e14('0x34')],'resourceId':_0x5b7281['id'],'type':_0x1d7d28[_0x1e14('0x34')],'sectionId':_0x1d7d28['id']},{})[_0x1e14('0x1b')](function(){return _0x1f5010;});}else{return _0x1f5010;}})['catch'](function(_0x3c1699){logger['error'](_0x1e14('0x67'),_0x3c1699);throw _0x3c1699;});}return _0x1f5010;})[_0x1e14('0x1b')](respondWithResult(_0x261c31,0xc9))[_0x1e14('0x24')](handleError(_0x261c31,null));};exports['update']=function(_0xdf86a0,_0x59531a,_0x110559){var _0x44dc1b;return db[_0x1e14('0x4e')][_0x1e14('0x64')]({'where':{'id':_0xdf86a0['params']['id']}})[_0x1e14('0x1b')](handleEntityNotFound(_0x59531a,null))['then'](saveUpdates(_0xdf86a0['body'],null))['then'](function(_0x46f2a4){if(_0x46f2a4){_0x44dc1b=_0x46f2a4;return db[_0x1e14('0x4e')][_0x1e14('0x50')]({'raw':!![]});}})[_0x1e14('0x1b')](function(_0x15aa0c){var _0x1c7ad0=fs[_0x1e14('0x68')](path[_0x1e14('0x57')](config[_0x1e14('0x58')],_0x1e14('0x59')),_0x1e14('0x5a'));var _0x8a8ade=ejs[_0x1e14('0x5b')](_0x1c7ad0,{'contexts':_0x15aa0c||[]});fs[_0x1e14('0x5c')](_0x1e14('0x5d'),_0x8a8ade);})['then'](function(){return respondWithRpcPromise('Reload',_0x1e14('0x2e'),{'module':_0x1e14('0x5f')});})['then'](function(){return _0x44dc1b;})[_0x1e14('0x1b')](respondWithResult(_0x59531a,null))['catch'](handleError(_0x59531a,null));};exports[_0x1e14('0x2f')]=function(_0x3effe7,_0x4250ba,_0x4cbec2){var _0x3d39ac;return db[_0x1e14('0x4e')][_0x1e14('0x64')]({'where':{'id':_0x3effe7[_0x1e14('0x53')]['id']}})[_0x1e14('0x1b')](handleEntityNotFound(_0x4250ba,null))['then'](removeEntity(_0x4250ba,null))['then'](function(){return db[_0x1e14('0x4e')][_0x1e14('0x50')]({'raw':!![]});})[_0x1e14('0x1b')](function(_0x47e13e){var _0x62dbcd=fs[_0x1e14('0x68')](path[_0x1e14('0x57')](config[_0x1e14('0x58')],_0x1e14('0x59')),'utf8');var _0x2dd20a=ejs[_0x1e14('0x5b')](_0x62dbcd,{'contexts':_0x47e13e});fs[_0x1e14('0x5c')](_0x1e14('0x5d'),_0x2dd20a);return respondWithRpcPromise(_0x1e14('0x5e'),_0x1e14('0x2f'),{'module':_0x1e14('0x5f')});})[_0x1e14('0x24')](handleError(_0x4250ba,null));}; \ No newline at end of file +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 diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 8ad5b4d..b0be029 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 _0xdf2b=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment'];(function(_0x24ae03,_0x334660){var _0x38a29e=function(_0x25e64b){while(--_0x25e64b){_0x24ae03['push'](_0x24ae03['shift']());}};_0x38a29e(++_0x334660);}(_0xdf2b,0x12f));var _0xbdf2=function(_0x38bf76,_0x313689){_0x38bf76=_0x38bf76-0x0;var _0x141848=_0xdf2b[_0x38bf76];return _0x141848;};'use strict';var _=require(_0xbdf2('0x0'));var util=require(_0xbdf2('0x1'));var logger=require(_0xbdf2('0x2'))(_0xbdf2('0x3'));var moment=require(_0xbdf2('0x4'));var BPromise=require(_0xbdf2('0x5'));var rp=require(_0xbdf2('0x6'));var fs=require('fs');var path=require(_0xbdf2('0x7'));var rimraf=require(_0xbdf2('0x8'));var config=require(_0xbdf2('0x9'));var attributes=require('./voiceContext.attributes');module[_0xbdf2('0xa')]=function(_0x3a7447,_0xdbbe32){return _0x3a7447[_0xbdf2('0xb')](_0xbdf2('0xc'),attributes,{'tableName':_0xbdf2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index ffe7843..f40e71d 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 _0x38b0=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util'];(function(_0x1ae7f4,_0x5a955d){var _0x9d1858=function(_0x569112){while(--_0x569112){_0x1ae7f4['push'](_0x1ae7f4['shift']());}};_0x9d1858(++_0x5a955d);}(_0x38b0,0x1e1));var _0x038b=function(_0x36909d,_0x2795f1){_0x36909d=_0x36909d-0x0;var _0x1fd29d=_0x38b0[_0x36909d];return _0x1fd29d;};'use strict';var _=require(_0x038b('0x0'));var util=require(_0x038b('0x1'));var moment=require(_0x038b('0x2'));var BPromise=require(_0x038b('0x3'));var rs=require(_0x038b('0x4'));var fs=require('fs');var Redis=require(_0x038b('0x5'));var db=require(_0x038b('0x6'))['db'];var utils=require(_0x038b('0x7'));var logger=require(_0x038b('0x8'))(_0x038b('0x9'));var config=require(_0x038b('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x038b('0xb')][_0x038b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x213e26,_0x4d8898,_0xc37ec8){return new BPromise(function(_0x58f1be,_0x15a4ae){return client[_0x038b('0xd')](_0x213e26,_0xc37ec8)['then'](function(_0x22fe6d){logger[_0x038b('0xe')](_0x038b('0xf'),_0x4d8898,_0x038b('0x10'));logger[_0x038b('0x11')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x4d8898,_0x038b('0x10'),JSON[_0x038b('0x12')](_0x22fe6d));if(_0x22fe6d[_0x038b('0x13')]){if(_0x22fe6d['error']['code']===0x1f4){logger['error'](_0x038b('0xf'),_0x4d8898,_0x22fe6d[_0x038b('0x13')]['message']);return _0x15a4ae(_0x22fe6d[_0x038b('0x13')]['message']);}logger[_0x038b('0x13')](_0x038b('0xf'),_0x4d8898,_0x22fe6d[_0x038b('0x13')][_0x038b('0x14')]);return _0x58f1be(_0x22fe6d[_0x038b('0x13')][_0x038b('0x14')]);}else{logger[_0x038b('0xe')]('VoiceContext,\x20%s,\x20%s',_0x4d8898,_0x038b('0x10'));_0x58f1be(_0x22fe6d[_0x038b('0x15')]['message']);}})[_0x038b('0x16')](function(_0xced15d){logger[_0x038b('0x13')](_0x038b('0xf'),_0x4d8898,_0xced15d);_0x15a4ae(_0xced15d);});});} \ No newline at end of file +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 diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 3fd4c2f..d200997 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 _0xc9ea=['create','put','/:id','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','show','post'];(function(_0xb97e4,_0x4cadc){var _0xaabe86=function(_0x3bdd18){while(--_0x3bdd18){_0xb97e4['push'](_0xb97e4['shift']());}};_0xaabe86(++_0x4cadc);}(_0xc9ea,0xcf));var _0xac9e=function(_0x47e349,_0x1a5dbc){_0x47e349=_0x47e349-0x0;var _0x5f130b=_0xc9ea[_0x47e349];return _0x5f130b;};'use strict';var multer=require(_0xac9e('0x0'));var util=require(_0xac9e('0x1'));var path=require(_0xac9e('0x2'));var timeout=require('connect-timeout');var express=require(_0xac9e('0x3'));var router=express['Router']();var auth=require(_0xac9e('0x4'));var interaction=require(_0xac9e('0x5'));var config=require(_0xac9e('0x6'));var controller=require('./voiceDialReport.controller');router[_0xac9e('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xac9e('0x7')](_0xac9e('0x8'),auth[_0xac9e('0x9')](),controller[_0xac9e('0xa')]);router[_0xac9e('0x7')]('/:id',auth[_0xac9e('0x9')](),controller[_0xac9e('0xb')]);router[_0xac9e('0xc')]('/',auth[_0xac9e('0x9')](),controller[_0xac9e('0xd')]);router[_0xac9e('0xe')](_0xac9e('0xf'),auth[_0xac9e('0x9')](),controller[_0xac9e('0x10')]);router[_0xac9e('0x11')](_0xac9e('0xf'),auth[_0xac9e('0x9')](),controller[_0xac9e('0x12')]);module[_0xac9e('0x13')]=router; \ No newline at end of file +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 diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 7e6bf66..ffe5856 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 _0x5658=['sequelize','exports','STRING','INTEGER','DATE'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x5658,0xcd));var _0x8565=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x5658[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x8565('0x0'));module[_0x8565('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x8565('0x2')]},'channelstate':{'type':Sequelize[_0x8565('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x8565('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x8565('0x2')]},'accountcode':{'type':Sequelize[_0x8565('0x2')]},'context':{'type':Sequelize[_0x8565('0x2')]},'exten':{'type':Sequelize[_0x8565('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x8565('0x2')]},'linkedid':{'type':Sequelize[_0x8565('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x8565('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x8565('0x2')]},'destcalleridname':{'type':Sequelize[_0x8565('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x8565('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x8565('0x2')]},'destaccountcode':{'type':Sequelize[_0x8565('0x2')]},'destcontext':{'type':Sequelize[_0x8565('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x8565('0x3')]},'destuniqueid':{'type':Sequelize[_0x8565('0x2')]},'destlinkedid':{'type':Sequelize[_0x8565('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x8565('0x2')]},'starttime':{'type':Sequelize[_0x8565('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x8565('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x8565('0x3')]},'duration':{'type':Sequelize[_0x8565('0x3')]},'holdtime':{'type':Sequelize[_0x8565('0x3')]},'billableseconds':{'type':Sequelize[_0x8565('0x3')]}}; \ No newline at end of file +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 diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 8842e0f..7b284b4 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 _0xcf60=['intersection','query','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','findAll','rows','show','params','includeAll','catch','create','body','find','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','to-csv','lodash','squel','jsforce','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','apply','reject','update','then','end','error','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','keys','filters'];(function(_0xa01eea,_0x12e531){var _0x47c05e=function(_0x22a818){while(--_0x22a818){_0xa01eea['push'](_0xa01eea['shift']());}};_0x47c05e(++_0x12e531);}(_0xcf60,0x1bd));var _0x0cf6=function(_0x5af375,_0x36bff1){_0x5af375=_0x5af375-0x0;var _0x26b449=_0xcf60[_0x5af375];return _0x26b449;};'use strict';var pdf=require(_0x0cf6('0x0'));var emlformat=require(_0x0cf6('0x1'));var rimraf=require(_0x0cf6('0x2'));var zipdir=require(_0x0cf6('0x3'));var jsonpatch=require(_0x0cf6('0x4'));var rp=require('request-promise');var moment=require(_0x0cf6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0cf6('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x0cf6('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0cf6('0x8'));var squel=require(_0x0cf6('0x9'));var crypto=require('crypto');var jsforce=require(_0x0cf6('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x0cf6('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0cf6('0xb'));var authService=require(_0x0cf6('0xc'));var qs=require(_0x0cf6('0xd'));var as=require(_0x0cf6('0xe'));var hardwareService=require(_0x0cf6('0xf'));var logger=require(_0x0cf6('0x10'))(_0x0cf6('0x11'));var utils=require(_0x0cf6('0x12'));var config=require(_0x0cf6('0x13'));var db=require(_0x0cf6('0x14'))['db'];function respondWithStatusCode(_0x33ba2e,_0x443aff){_0x443aff=_0x443aff||0xcc;return function(_0x1290ec){if(_0x1290ec){return _0x33ba2e[_0x0cf6('0x15')](_0x443aff);}return _0x33ba2e[_0x0cf6('0x16')](_0x443aff)['end']();};}function respondWithResult(_0x2deedb,_0x46bdf1){_0x46bdf1=_0x46bdf1||0xc8;return function(_0x3bb1e9){if(_0x3bb1e9){return _0x2deedb[_0x0cf6('0x16')](_0x46bdf1)[_0x0cf6('0x17')](_0x3bb1e9);}};}function respondWithFilteredResult(_0xb1d07b,_0x33fd1c){return function(_0x322e6e){if(_0x322e6e){var _0x4916b2=_0x322e6e[_0x0cf6('0x18')],_0x147e19=_0x33fd1c[_0x0cf6('0x19')],_0x54edd2=_0x33fd1c[_0x0cf6('0x19')]+_0x33fd1c['limit'],_0x2a31a8;if(_0x54edd2>=_0x4916b2){_0x54edd2=_0x4916b2;_0x2a31a8=0xc8;}else{_0x2a31a8=0xce;}_0xb1d07b[_0x0cf6('0x16')](_0x2a31a8);return _0xb1d07b[_0x0cf6('0x1a')]('Content-Range',_0x147e19+'-'+_0x54edd2+'/'+_0x4916b2)[_0x0cf6('0x17')](_0x322e6e);}return null;};}function patchUpdates(_0x4a2c78){return function(_0x38d167){try{jsonpatch[_0x0cf6('0x1b')](_0x38d167,_0x4a2c78,!![]);}catch(_0x21120a){return BPromise[_0x0cf6('0x1c')](_0x21120a);}return _0x38d167['save']();};}function saveUpdates(_0x3a73d8,_0x24f0eb){return function(_0x4c3ede){if(_0x4c3ede){return _0x4c3ede[_0x0cf6('0x1d')](_0x3a73d8)[_0x0cf6('0x1e')](function(_0x55f597){return _0x55f597;});}return null;};}function removeEntity(_0x5c919f,_0x51455d){return function(_0x49eacd){if(_0x49eacd){return _0x49eacd['destroy']()[_0x0cf6('0x1e')](function(){_0x5c919f[_0x0cf6('0x16')](0xcc)[_0x0cf6('0x1f')]();});}};}function handleEntityNotFound(_0xfc0e3c,_0x1ac37d){return function(_0x29b191){if(!_0x29b191){_0xfc0e3c[_0x0cf6('0x15')](0x194);}return _0x29b191;};}function handleError(_0x51ff20,_0x434e26){_0x434e26=_0x434e26||0x1f4;return function(_0x26545f){logger[_0x0cf6('0x20')](_0x26545f['stack']);if(_0x26545f[_0x0cf6('0x21')]){delete _0x26545f[_0x0cf6('0x21')];}_0x51ff20[_0x0cf6('0x16')](_0x434e26)[_0x0cf6('0x22')](_0x26545f);};}exports[_0x0cf6('0x23')]=function(_0x35bb11,_0xe4050c){var _0x3d8cb9={},_0x5dd17b={},_0x25a5e1={'count':0x0,'rows':[]};var _0x43caa3=_[_0x0cf6('0x24')](db[_0x0cf6('0x25')][_0x0cf6('0x26')],function(_0x2012ce){return{'name':_0x2012ce[_0x0cf6('0x27')],'type':_0x2012ce[_0x0cf6('0x28')][_0x0cf6('0x29')]};});_0x5dd17b[_0x0cf6('0x2a')]=_['map'](_0x43caa3,'name');_0x5dd17b['query']=_[_0x0cf6('0x2b')](_0x35bb11['query']);_0x5dd17b[_0x0cf6('0x2c')]=_[_0x0cf6('0x2d')](_0x5dd17b[_0x0cf6('0x2a')],_0x5dd17b[_0x0cf6('0x2e')]);_0x3d8cb9[_0x0cf6('0x2f')]=_[_0x0cf6('0x2d')](_0x5dd17b['model'],qs[_0x0cf6('0x30')](_0x35bb11['query'][_0x0cf6('0x30')]));_0x3d8cb9['attributes']=_0x3d8cb9[_0x0cf6('0x2f')][_0x0cf6('0x31')]?_0x3d8cb9[_0x0cf6('0x2f')]:_0x5dd17b['model'];if(!_0x35bb11['query'][_0x0cf6('0x32')]('nolimit')){_0x3d8cb9[_0x0cf6('0x33')]=qs['limit'](_0x35bb11['query'][_0x0cf6('0x33')]);_0x3d8cb9['offset']=qs['offset'](_0x35bb11[_0x0cf6('0x2e')][_0x0cf6('0x19')]);}_0x3d8cb9[_0x0cf6('0x34')]=qs[_0x0cf6('0x35')](_0x35bb11[_0x0cf6('0x2e')][_0x0cf6('0x35')]);_0x3d8cb9[_0x0cf6('0x36')]=qs[_0x0cf6('0x2c')](_[_0x0cf6('0x37')](_0x35bb11[_0x0cf6('0x2e')],_0x5dd17b[_0x0cf6('0x2c')]));if(_0x35bb11[_0x0cf6('0x2e')][_0x0cf6('0x38')]){_0x3d8cb9['where']=_['merge'](_0x3d8cb9['where'],{'$or':_['map'](_0x43caa3,function(_0x3835b6){if(_0x3835b6[_0x0cf6('0x28')]!==_0x0cf6('0x39')){var _0x5e485c={};_0x5e485c[_0x3835b6[_0x0cf6('0x21')]]={'$like':'%'+_0x35bb11['query']['filter']+'%'};return _0x5e485c;}})});}_0x3d8cb9=_[_0x0cf6('0x3a')]({},_0x3d8cb9,_0x35bb11['options']);var _0x75b014={'where':_0x3d8cb9[_0x0cf6('0x36')]};return db[_0x0cf6('0x25')][_0x0cf6('0x18')](_0x75b014)[_0x0cf6('0x1e')](function(_0x279af1){_0x25a5e1[_0x0cf6('0x18')]=_0x279af1;if(_0x35bb11[_0x0cf6('0x2e')]['includeAll']){_0x3d8cb9['include']=[{'all':!![]}];}return db['VoiceDialReport'][_0x0cf6('0x3b')](_0x3d8cb9);})[_0x0cf6('0x1e')](function(_0x57d28c){_0x25a5e1[_0x0cf6('0x3c')]=_0x57d28c;return _0x25a5e1;})[_0x0cf6('0x1e')](respondWithFilteredResult(_0xe4050c,_0x3d8cb9))['catch'](handleError(_0xe4050c,null));};exports[_0x0cf6('0x3d')]=function(_0x1dd2d7,_0x15b53d){var _0xaff342={'raw':!![],'where':{'id':_0x1dd2d7[_0x0cf6('0x3e')]['id']}},_0x2d02ce={};_0x2d02ce['model']=_['keys'](db[_0x0cf6('0x25')][_0x0cf6('0x26')]);_0x2d02ce[_0x0cf6('0x2e')]=_['keys'](_0x1dd2d7[_0x0cf6('0x2e')]);_0x2d02ce['filters']=_['intersection'](_0x2d02ce[_0x0cf6('0x2a')],_0x2d02ce['query']);_0xaff342[_0x0cf6('0x2f')]=_[_0x0cf6('0x2d')](_0x2d02ce[_0x0cf6('0x2a')],qs[_0x0cf6('0x30')](_0x1dd2d7[_0x0cf6('0x2e')][_0x0cf6('0x30')]));_0xaff342[_0x0cf6('0x2f')]=_0xaff342[_0x0cf6('0x2f')][_0x0cf6('0x31')]?_0xaff342[_0x0cf6('0x2f')]:_0x2d02ce[_0x0cf6('0x2a')];if(_0x1dd2d7[_0x0cf6('0x2e')][_0x0cf6('0x3f')]){_0xaff342['include']=[{'all':!![]}];}_0xaff342=_[_0x0cf6('0x3a')]({},_0xaff342,_0x1dd2d7['options']);return db[_0x0cf6('0x25')]['find'](_0xaff342)[_0x0cf6('0x1e')](handleEntityNotFound(_0x15b53d,null))[_0x0cf6('0x1e')](respondWithResult(_0x15b53d,null))[_0x0cf6('0x40')](handleError(_0x15b53d,null));};exports['create']=function(_0x4b0504,_0x14a2b8){return db[_0x0cf6('0x25')][_0x0cf6('0x41')](_0x4b0504[_0x0cf6('0x42')],{})[_0x0cf6('0x1e')](respondWithResult(_0x14a2b8,0xc9))[_0x0cf6('0x40')](handleError(_0x14a2b8,null));};exports['update']=function(_0x32c245,_0x5286c7){if(_0x32c245[_0x0cf6('0x42')]['id']){delete _0x32c245[_0x0cf6('0x42')]['id'];}return db[_0x0cf6('0x25')][_0x0cf6('0x43')]({'where':{'id':_0x32c245['params']['id']}})[_0x0cf6('0x1e')](handleEntityNotFound(_0x5286c7,null))[_0x0cf6('0x1e')](saveUpdates(_0x32c245['body'],null))[_0x0cf6('0x1e')](respondWithResult(_0x5286c7,null))[_0x0cf6('0x40')](handleError(_0x5286c7,null));};exports[_0x0cf6('0x44')]=function(_0x170e46,_0x33d425){return db['VoiceDialReport'][_0x0cf6('0x43')]({'where':{'id':_0x170e46['params']['id']}})[_0x0cf6('0x1e')](handleEntityNotFound(_0x33d425,null))['then'](removeEntity(_0x33d425,null))[_0x0cf6('0x40')](handleError(_0x33d425,null));};exports[_0x0cf6('0x45')]=function(_0x430f27,_0xb656ce){return db[_0x0cf6('0x25')]['describe']()[_0x0cf6('0x1e')](respondWithResult(_0xb656ce,null))[_0x0cf6('0x40')](handleError(_0xb656ce,null));}; \ No newline at end of file +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 diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 59bae59..828964e 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 _0x0c6f=['path','../../config/environment','exports','define','VoiceDialReport','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x345691,_0x18c7c7){var _0x162179=function(_0x140b65){while(--_0x140b65){_0x345691['push'](_0x345691['shift']());}};_0x162179(++_0x18c7c7);}(_0x0c6f,0xf6));var _0xf0c6=function(_0xfda396,_0x6d2570){_0xfda396=_0xfda396-0x0;var _0x308f3a=_0x0c6f[_0xfda396];return _0x308f3a;};'use strict';var _=require(_0xf0c6('0x0'));var util=require(_0xf0c6('0x1'));var logger=require(_0xf0c6('0x2'))(_0xf0c6('0x3'));var moment=require('moment');var BPromise=require(_0xf0c6('0x4'));var rp=require(_0xf0c6('0x5'));var fs=require('fs');var path=require(_0xf0c6('0x6'));var rimraf=require('rimraf');var config=require(_0xf0c6('0x7'));var attributes=require('./voiceDialReport.attributes');module[_0xf0c6('0x8')]=function(_0x29178b,_0x473b2d){return _0x29178b[_0xf0c6('0x9')](_0xf0c6('0xa'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0xf0c6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 9504044..7318461 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 _0xb32d=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','options','raw','CreateVoiceDialReport','catch','UpdateVoiceDialReport','VoiceDialReport','update','body','where','lodash','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x2938bc,_0x537a50){var _0x341ad4=function(_0x5d3d68){while(--_0x5d3d68){_0x2938bc['push'](_0x2938bc['shift']());}};_0x341ad4(++_0x537a50);}(_0xb32d,0x1da));var _0xdb32=function(_0xe0dee2,_0x35d2a8){_0xe0dee2=_0xe0dee2-0x0;var _0x568ed0=_0xb32d[_0xe0dee2];return _0x568ed0;};'use strict';var _=require(_0xdb32('0x0'));var util=require(_0xdb32('0x1'));var moment=require(_0xdb32('0x2'));var BPromise=require(_0xdb32('0x3'));var rs=require(_0xdb32('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdb32('0x5'));var logger=require(_0xdb32('0x6'))('rpc');var config=require(_0xdb32('0x7'));var jayson=require(_0xdb32('0x8'));var client=jayson[_0xdb32('0x9')][_0xdb32('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6f4af0,_0x386309,_0x5bb076){return new BPromise(function(_0x3b0995,_0x2686db){return client[_0xdb32('0xb')](_0x6f4af0,_0x5bb076)[_0xdb32('0xc')](function(_0x30e03d){logger[_0xdb32('0xd')](_0xdb32('0xe'),_0x386309,_0xdb32('0xf'));logger[_0xdb32('0x10')](_0xdb32('0x11'),_0x386309,_0xdb32('0xf'),JSON[_0xdb32('0x12')](_0x30e03d));if(_0x30e03d[_0xdb32('0x13')]){if(_0x30e03d[_0xdb32('0x13')][_0xdb32('0x14')]===0x1f4){logger[_0xdb32('0x13')](_0xdb32('0xe'),_0x386309,_0x30e03d[_0xdb32('0x13')][_0xdb32('0x15')]);return _0x2686db(_0x30e03d[_0xdb32('0x13')][_0xdb32('0x15')]);}logger['error'](_0xdb32('0xe'),_0x386309,_0x30e03d[_0xdb32('0x13')][_0xdb32('0x15')]);return _0x3b0995(_0x30e03d[_0xdb32('0x13')][_0xdb32('0x15')]);}else{logger['info'](_0xdb32('0xe'),_0x386309,_0xdb32('0xf'));_0x3b0995(_0x30e03d[_0xdb32('0x16')]['message']);}})['catch'](function(_0x59a5f8){logger['error'](_0xdb32('0xe'),_0x386309,_0x59a5f8);_0x2686db(_0x59a5f8);});});}exports['CreateVoiceDialReport']=function(_0x1fd22b){var _0xfab49a=this;return new Promise(function(_0x1ba5f4,_0x301cc3){return db['VoiceDialReport']['create'](_0x1fd22b['body'],{'raw':_0x1fd22b[_0xdb32('0x17')]?_0x1fd22b['options'][_0xdb32('0x18')]===undefined?!![]:![]:!![]})[_0xdb32('0xc')](function(_0x8a5f88){logger[_0xdb32('0xd')](_0xdb32('0x19'),_0x1fd22b);logger['debug'](_0xdb32('0x19'),_0x1fd22b,JSON[_0xdb32('0x12')](_0x8a5f88));_0x1ba5f4(_0x8a5f88);})[_0xdb32('0x1a')](function(_0x5a5a84){logger['error'](_0xdb32('0x19'),_0x5a5a84['message'],_0x1fd22b);_0x301cc3(_0xfab49a['error'](0x1f4,_0x5a5a84[_0xdb32('0x15')]));});});};exports[_0xdb32('0x1b')]=function(_0x307aaf){var _0x4406b9=this;return new Promise(function(_0x537fec,_0x498c20){return db[_0xdb32('0x1c')][_0xdb32('0x1d')](_0x307aaf[_0xdb32('0x1e')],{'raw':_0x307aaf['options']?_0x307aaf[_0xdb32('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x307aaf[_0xdb32('0x17')]?_0x307aaf[_0xdb32('0x17')][_0xdb32('0x1f')]||null:null,'attributes':_0x307aaf[_0xdb32('0x17')]?_0x307aaf[_0xdb32('0x17')]['attributes']||null:null,'limit':_0x307aaf['options']?_0x307aaf[_0xdb32('0x17')]['limit']||null:null})[_0xdb32('0xc')](function(_0x38d7a0){logger[_0xdb32('0xd')]('UpdateVoiceDialReport',_0x307aaf);logger['debug'](_0xdb32('0x1b'),_0x307aaf,JSON[_0xdb32('0x12')](_0x38d7a0));_0x537fec(_0x38d7a0);})[_0xdb32('0x1a')](function(_0x566b8b){logger[_0xdb32('0x13')](_0xdb32('0x1b'),_0x566b8b[_0xdb32('0x15')],_0x307aaf);_0x498c20(_0x4406b9[_0xdb32('0x13')](0x1f4,_0x566b8b[_0xdb32('0x15')]));});});}; \ No newline at end of file +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 diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index b22ff9e..1521ba3 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 _0x0018=['/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x3a8789,_0x5bb70b){var _0x19e422=function(_0x49d386){while(--_0x49d386){_0x3a8789['push'](_0x3a8789['shift']());}};_0x19e422(++_0x5bb70b);}(_0x0018,0x1aa));var _0x8001=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x0018[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x8001('0x0'));var util=require(_0x8001('0x1'));var path=require(_0x8001('0x2'));var timeout=require(_0x8001('0x3'));var express=require(_0x8001('0x4'));var router=express[_0x8001('0x5')]();var auth=require(_0x8001('0x6'));var interaction=require(_0x8001('0x7'));var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router[_0x8001('0x8')]('/',auth[_0x8001('0x9')](),controller[_0x8001('0xa')]);router[_0x8001('0x8')](_0x8001('0xb'),auth[_0x8001('0x9')](),controller[_0x8001('0xc')]);router[_0x8001('0xd')]('/',auth[_0x8001('0x9')](),controller['create']);router[_0x8001('0xd')]('/:id/applications',auth[_0x8001('0x9')](),controller['addApplications']);router[_0x8001('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x8001('0xf')]);router[_0x8001('0x10')](_0x8001('0xb'),auth[_0x8001('0x9')](),controller[_0x8001('0x11')]);module[_0x8001('0x12')]=router; \ No newline at end of file +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 diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 6911ead..1ac9f62 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(_0x269ac2,_0x139b30){var _0x288e11=function(_0x3886e3){while(--_0x3886e3){_0x269ac2['push'](_0x269ac2['shift']());}};_0x288e11(++_0x139b30);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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(_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 diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index c5d2866..d448671 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 _0x5eca=['index','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','VoiceExtension','includeAll','include','rows','catch','show','params','startsWith','exten','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OutboundRoutes','internal','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','mandatoryDisposition','addApplications','findOne','sequelize','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','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','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','InboundRoutes','inbound','outbound','InternalRoutes','ignore','map','value','includes','type','find','name','error','stack','send'];(function(_0x298f61,_0x2eb60b){var _0xdd16f2=function(_0x23f3b6){while(--_0x23f3b6){_0x298f61['push'](_0x298f61['shift']());}};_0xdd16f2(++_0x2eb60b);}(_0x5eca,0x10e));var _0xa5ec=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x5eca[_0x4b369d];return _0x571a98;};'use strict';var pdf=require(_0xa5ec('0x0'));var emlformat=require(_0xa5ec('0x1'));var rimraf=require(_0xa5ec('0x2'));var zipdir=require(_0xa5ec('0x3'));var jsonpatch=require(_0xa5ec('0x4'));var rp=require('request-promise');var moment=require(_0xa5ec('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa5ec('0x6'));var path=require(_0xa5ec('0x7'));var sox=require(_0xa5ec('0x8'));var csv=require(_0xa5ec('0x9'));var ejs=require(_0xa5ec('0xa'));var fs=require('fs');var _=require(_0xa5ec('0xb'));var squel=require(_0xa5ec('0xc'));var crypto=require('crypto');var jsforce=require(_0xa5ec('0xd'));var deskjs=require(_0xa5ec('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa5ec('0xf'));var Papa=require('papaparse');var Redis=require(_0xa5ec('0x10'));var authService=require(_0xa5ec('0x11'));var qs=require(_0xa5ec('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa5ec('0x13'));var logger=require(_0xa5ec('0x14'))(_0xa5ec('0x15'));var utils=require(_0xa5ec('0x16'));var config=require(_0xa5ec('0x17'));var db=require(_0xa5ec('0x18'))['db'];config[_0xa5ec('0x19')]=_[_0xa5ec('0x1a')](config[_0xa5ec('0x19')],{'host':_0xa5ec('0x1b'),'port':0x18eb});var socket=require(_0xa5ec('0x1c'))(new Redis(config[_0xa5ec('0x19')]));require(_0xa5ec('0x1d'))['register'](socket);function respondWithStatusCode(_0x21c65a,_0x241d2b){_0x241d2b=_0x241d2b||0xcc;return function(_0x3d6801){if(_0x3d6801){return _0x21c65a[_0xa5ec('0x1e')](_0x241d2b);}return _0x21c65a[_0xa5ec('0x1f')](_0x241d2b)[_0xa5ec('0x20')]();};}function respondWithResult(_0x54288a,_0x471de4){_0x471de4=_0x471de4||0xc8;return function(_0x498882){if(_0x498882){return _0x54288a[_0xa5ec('0x1f')](_0x471de4)[_0xa5ec('0x21')](_0x498882);}};}function respondWithFilteredResult(_0x1a4348,_0x32281e){return function(_0x11aac3){if(_0x11aac3){var _0x372767=_0x11aac3[_0xa5ec('0x22')],_0x1ab214=_0x32281e['offset'],_0x29fbb4=_0x32281e[_0xa5ec('0x23')]+_0x32281e[_0xa5ec('0x24')],_0x5d6e39;if(_0x29fbb4>=_0x372767){_0x29fbb4=_0x372767;_0x5d6e39=0xc8;}else{_0x5d6e39=0xce;}_0x1a4348[_0xa5ec('0x1f')](_0x5d6e39);return _0x1a4348[_0xa5ec('0x25')](_0xa5ec('0x26'),_0x1ab214+'-'+_0x29fbb4+'/'+_0x372767)[_0xa5ec('0x21')](_0x11aac3);}return null;};}function patchUpdates(_0x1255bc){return function(_0x172823){try{jsonpatch[_0xa5ec('0x27')](_0x172823,_0x1255bc,!![]);}catch(_0x581f5b){return BPromise[_0xa5ec('0x28')](_0x581f5b);}return _0x172823[_0xa5ec('0x29')]();};}function saveUpdates(_0x3c957,_0xa2daff){return function(_0x40c0c6){if(_0x40c0c6){return _0x40c0c6[_0xa5ec('0x2a')](_0x3c957)[_0xa5ec('0x2b')](function(_0x364770){return _0x364770;});}return null;};}function removeEntity(_0x5eef95,_0x584d82){return function(_0x5ca79f){if(_0x5ca79f){return _0x5ca79f[_0xa5ec('0x2c')]()['then'](function(){var _0x1016fa=_0x5ca79f[_0xa5ec('0x2d')]({'plain':!![]});var _0x57ef19=[{'name':_0xa5ec('0x2e'),'value':_0xa5ec('0x2f'),'ignore':![]},{'name':'OutboundRoutes','value':_0xa5ec('0x30'),'ignore':![]},{'name':_0xa5ec('0x31'),'value':'internal','ignore':![]}];var _0x3d7f55=_(_0x57ef19)['filter'](_0xa5ec('0x32'))[_0xa5ec('0x33')](_0xa5ec('0x34'))[_0xa5ec('0x34')]();if(_[_0xa5ec('0x35')](_0x3d7f55,_0x1016fa[_0xa5ec('0x36')])){return;}var _0x45e32c=_[_0xa5ec('0x37')](_0x57ef19,[_0xa5ec('0x34'),_0x1016fa[_0xa5ec('0x36')]])[_0xa5ec('0x38')];return db['UserProfileResource']['destroy']({'where':{'type':_0x45e32c,'resourceId':_0x1016fa['id']}})[_0xa5ec('0x2b')](function(){return _0x5ca79f;});})[_0xa5ec('0x2b')](function(){_0x5eef95[_0xa5ec('0x1f')](0xcc)[_0xa5ec('0x20')]();});}};}function handleEntityNotFound(_0x1ad317,_0x2436f5){return function(_0x482962){if(!_0x482962){_0x1ad317[_0xa5ec('0x1e')](0x194);}return _0x482962;};}function handleError(_0x309840,_0x5b8265){_0x5b8265=_0x5b8265||0x1f4;return function(_0x24ad85){logger[_0xa5ec('0x39')](_0x24ad85[_0xa5ec('0x3a')]);if(_0x24ad85[_0xa5ec('0x38')]){delete _0x24ad85['name'];}_0x309840[_0xa5ec('0x1f')](_0x5b8265)[_0xa5ec('0x3b')](_0x24ad85);};}exports[_0xa5ec('0x3c')]=function(_0x1acb96,_0x56c792){var _0x28390f={},_0x48deed={},_0x451819={'count':0x0,'rows':[]};var _0x41721b=_['map'](db['VoiceExtension'][_0xa5ec('0x3d')],function(_0x2e1b44){return{'name':_0x2e1b44[_0xa5ec('0x3e')],'type':_0x2e1b44[_0xa5ec('0x36')][_0xa5ec('0x3f')]};});_0x48deed['model']=_[_0xa5ec('0x33')](_0x41721b,_0xa5ec('0x38'));_0x48deed[_0xa5ec('0x40')]=_[_0xa5ec('0x41')](_0x1acb96[_0xa5ec('0x40')]);_0x48deed[_0xa5ec('0x42')]=_['intersection'](_0x48deed[_0xa5ec('0x43')],_0x48deed['query']);_0x28390f[_0xa5ec('0x44')]=_[_0xa5ec('0x45')](_0x48deed[_0xa5ec('0x43')],qs[_0xa5ec('0x46')](_0x1acb96[_0xa5ec('0x40')]['fields']));_0x28390f[_0xa5ec('0x44')]=_0x28390f[_0xa5ec('0x44')][_0xa5ec('0x47')]?_0x28390f[_0xa5ec('0x44')]:_0x48deed[_0xa5ec('0x43')];if(!_0x1acb96[_0xa5ec('0x40')][_0xa5ec('0x48')]('nolimit')){_0x28390f[_0xa5ec('0x24')]=qs[_0xa5ec('0x24')](_0x1acb96['query'][_0xa5ec('0x24')]);_0x28390f[_0xa5ec('0x23')]=qs[_0xa5ec('0x23')](_0x1acb96[_0xa5ec('0x40')][_0xa5ec('0x23')]);}_0x28390f[_0xa5ec('0x49')]=qs[_0xa5ec('0x4a')](_0x1acb96[_0xa5ec('0x40')][_0xa5ec('0x4a')]);_0x28390f[_0xa5ec('0x4b')]=qs[_0xa5ec('0x42')](_['pick'](_0x1acb96['query'],_0x48deed['filters']));if(_0x1acb96['query'][_0xa5ec('0x4c')]){_0x28390f[_0xa5ec('0x4b')]=_[_0xa5ec('0x4d')](_0x28390f[_0xa5ec('0x4b')],{'$or':_[_0xa5ec('0x33')](_0x41721b,function(_0x1ae6e4){if(_0x1ae6e4[_0xa5ec('0x36')]!==_0xa5ec('0x4e')){var _0x56dfa4={};_0x56dfa4[_0x1ae6e4[_0xa5ec('0x38')]]={'$like':'%'+_0x1acb96['query'][_0xa5ec('0x4c')]+'%'};return _0x56dfa4;}})});}_0x28390f=_[_0xa5ec('0x4d')]({},_0x28390f,_0x1acb96['options']);var _0x4e6a16={'where':_0x28390f[_0xa5ec('0x4b')]};return db[_0xa5ec('0x4f')][_0xa5ec('0x22')](_0x4e6a16)[_0xa5ec('0x2b')](function(_0x3594a0){_0x451819[_0xa5ec('0x22')]=_0x3594a0;if(_0x1acb96[_0xa5ec('0x40')][_0xa5ec('0x50')]){_0x28390f[_0xa5ec('0x51')]=[{'all':!![]}];}return db[_0xa5ec('0x4f')]['findAll'](_0x28390f);})['then'](function(_0x2de9cc){_0x451819[_0xa5ec('0x52')]=_0x2de9cc;return _0x451819;})[_0xa5ec('0x2b')](respondWithFilteredResult(_0x56c792,_0x28390f))[_0xa5ec('0x53')](handleError(_0x56c792,null));};exports[_0xa5ec('0x54')]=function(_0x136324,_0x20d20d){var _0x4afdd9={'raw':![],'where':{'id':_0x136324['params']['id']}},_0x41f7cb={};_0x41f7cb['model']=_[_0xa5ec('0x41')](db[_0xa5ec('0x4f')][_0xa5ec('0x3d')]);_0x41f7cb['query']=_[_0xa5ec('0x41')](_0x136324['query']);_0x41f7cb[_0xa5ec('0x42')]=_[_0xa5ec('0x45')](_0x41f7cb[_0xa5ec('0x43')],_0x41f7cb[_0xa5ec('0x40')]);_0x4afdd9[_0xa5ec('0x44')]=_[_0xa5ec('0x45')](_0x41f7cb['model'],qs['fields'](_0x136324[_0xa5ec('0x40')]['fields']));_0x4afdd9[_0xa5ec('0x44')]=_0x4afdd9[_0xa5ec('0x44')]['length']?_0x4afdd9['attributes']:_0x41f7cb[_0xa5ec('0x43')];if(_0x136324[_0xa5ec('0x40')][_0xa5ec('0x50')]){_0x4afdd9[_0xa5ec('0x51')]=[{'all':!![]}];}_0x4afdd9=_['merge']({},_0x4afdd9,_0x136324['options']);return db[_0xa5ec('0x4f')][_0xa5ec('0x37')](_0x4afdd9)[_0xa5ec('0x2b')](handleEntityNotFound(_0x20d20d,null))[_0xa5ec('0x2b')](respondWithResult(_0x20d20d,null))[_0xa5ec('0x53')](handleError(_0x20d20d,null));};exports[_0xa5ec('0x2c')]=function(_0x10fddc,_0x32cabe){return db[_0xa5ec('0x4f')][_0xa5ec('0x37')]({'where':{'id':_0x10fddc[_0xa5ec('0x55')]['id']}})['then'](handleEntityNotFound(_0x32cabe,null))[_0xa5ec('0x2b')](removeEntity(_0x32cabe,null))[_0xa5ec('0x53')](handleError(_0x32cabe,null));};exports['create']=function(_0x501945,_0x267b8b){if(_0x501945['body'][_0xa5ec('0x36')]===_0xa5ec('0x30')&&!_[_0xa5ec('0x56')](_0x501945['body']['exten'],'_')){_0x501945['body'][_0xa5ec('0x57')]='_'['concat'](_0x501945['body'][_0xa5ec('0x57')]);}return db[_0xa5ec('0x4f')][_0xa5ec('0x58')](_0x501945[_0xa5ec('0x59')],{'raw':![]})[_0xa5ec('0x2b')](function(_0x139e00){var _0x28fb94=_0x501945[_0xa5ec('0x5a')][_0xa5ec('0x2d')]({'plain':!![]});if(!_0x28fb94)throw new Error(_0xa5ec('0x5b'));if(_0x28fb94[_0xa5ec('0x5c')]===_0xa5ec('0x5a')){var _0x463a84=_0x139e00['get']({'plain':!![]});var _0x2568df=[{'name':_0xa5ec('0x2e'),'value':_0xa5ec('0x2f')},{'name':_0xa5ec('0x5d'),'value':'outbound'},{'name':_0xa5ec('0x31'),'value':_0xa5ec('0x5e')}];var _0x1567b2=_['find'](_0x2568df,[_0xa5ec('0x34'),_0x463a84[_0xa5ec('0x36')]])[_0xa5ec('0x38')];return db[_0xa5ec('0x5f')][_0xa5ec('0x37')]({'where':{'name':_0x1567b2,'userProfileId':_0x28fb94[_0xa5ec('0x60')]},'raw':!![]})['then'](function(_0x4ee014){if(_0x4ee014&&_0x4ee014[_0xa5ec('0x61')]===0x0){return db['UserProfileResource'][_0xa5ec('0x58')]({'name':_0x463a84[_0xa5ec('0x38')],'resourceId':_0x463a84['id'],'type':_0x4ee014['name'],'sectionId':_0x4ee014['id']},{})[_0xa5ec('0x2b')](function(){return _0x139e00;});}else{return _0x139e00;}})[_0xa5ec('0x53')](function(_0x9864c8){logger[_0xa5ec('0x39')](_0xa5ec('0x62'),_0x9864c8);throw _0x9864c8;});}return _0x139e00;})[_0xa5ec('0x2b')](respondWithResult(_0x267b8b,0xc9))[_0xa5ec('0x53')](handleError(_0x267b8b,null));};exports[_0xa5ec('0x2a')]=function(_0xf9ee5a,_0x1509b3){if(_0xf9ee5a[_0xa5ec('0x59')]['id']){delete _0xf9ee5a[_0xa5ec('0x59')]['id'];}return db['VoiceExtension'][_0xa5ec('0x37')]({'where':{'id':_0xf9ee5a[_0xa5ec('0x55')]['id']}})[_0xa5ec('0x2b')](handleEntityNotFound(_0x1509b3,null))[_0xa5ec('0x2b')](function(_0x52b6e0){if(_0x52b6e0){return db['VoiceExtension'][_0xa5ec('0x2a')](_['pick'](_0xf9ee5a[_0xa5ec('0x59')],[_0xa5ec('0x57'),_0xa5ec('0x63'),_0xa5ec('0x64'),_0xa5ec('0x65'),'cutdigits',_0xa5ec('0x66')]),{'where':{'context':_0x52b6e0[_0xa5ec('0x63')],'exten':_0x52b6e0['exten']},'individualHooks':!![]})[_0xa5ec('0x2b')](function(_0x17ab7c){return _0x17ab7c;});}return null;})[_0xa5ec('0x2b')](respondWithStatusCode(_0x1509b3,null))['catch'](handleError(_0x1509b3,null));};exports[_0xa5ec('0x67')]=function(_0x1f08cd,_0x435eec,_0x59c7e2){return db[_0xa5ec('0x4f')][_0xa5ec('0x68')]({'where':{'id':_0x1f08cd['params']['id']}})[_0xa5ec('0x2b')](handleEntityNotFound(_0x435eec,null))[_0xa5ec('0x2b')](function(_0x229bf6){if(_0x229bf6){return db[_0xa5ec('0x69')][_0xa5ec('0x6a')](function(_0x370352){return db[_0xa5ec('0x4f')]['destroy']({'where':{'VoiceExtensionId':_0x1f08cd[_0xa5ec('0x55')]['id']},'transaction':_0x370352})['then'](function(_0x517ffc){var _0x24bf2a=_[_0xa5ec('0x33')](_0x1f08cd['body'],function(_0x1d8eae){_0x1d8eae[_0xa5ec('0x6b')]=_0x1f08cd[_0xa5ec('0x55')]['id'];return _0x1d8eae;});return db[_0xa5ec('0x4f')][_0xa5ec('0x6c')](_0x24bf2a,{'transaction':_0x370352});});})[_0xa5ec('0x2b')](function(){return db[_0xa5ec('0x4f')][_0xa5ec('0x6d')]({'where':{'isApp':!![],'VoiceExtensionId':_0x1f08cd[_0xa5ec('0x55')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0xa5ec('0x2b')](respondWithResult(_0x435eec,null))[_0xa5ec('0x53')](handleError(_0x435eec,null));}; \ No newline at end of file +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 diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index e808448..f33ffa8 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 _0xf590=['remove','emit','hasOwnProperty','hook','exports','events','VoiceExtension','save','update'];(function(_0x1b4b01,_0x43eb55){var _0x521446=function(_0x3767a4){while(--_0x3767a4){_0x1b4b01['push'](_0x1b4b01['shift']());}};_0x521446(++_0x43eb55);}(_0xf590,0x1e2));var _0x0f59=function(_0x53a3d9,_0x581974){_0x53a3d9=_0x53a3d9-0x0;var _0x3b80bb=_0xf590[_0x53a3d9];return _0x3b80bb;};'use strict';var EventEmitter=require(_0x0f59('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x0f59('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0f59('0x2'),'afterUpdate':_0x0f59('0x3'),'afterDestroy':_0x0f59('0x4')};function emitEvent(_0x472b54){return function(_0x275016,_0x3d7352,_0x293246){VoiceExtensionEvents[_0x0f59('0x5')](_0x472b54+':'+_0x275016['id'],_0x275016);VoiceExtensionEvents['emit'](_0x472b54,_0x275016);_0x293246(null);};}for(var e in events){if(events[_0x0f59('0x6')](e)){var event=events[e];VoiceExtension[_0x0f59('0x7')](e,emitEvent(event));}}module[_0x0f59('0x8')]=VoiceExtensionEvents; \ No newline at end of file +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 diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 648f6b6..f233d57 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 _0x8e2f=['define','VoiceExtension','voice_extensions','util','../../config/logger','api','moment','bluebird','request-promise','path','./voiceExtension.attributes'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x8e2f,0xc9));var _0xf8e2=function(_0x2cd2c8,_0x148af1){_0x2cd2c8=_0x2cd2c8-0x0;var _0x22004d=_0x8e2f[_0x2cd2c8];return _0x22004d;};'use strict';var _=require('lodash');var util=require(_0xf8e2('0x0'));var logger=require(_0xf8e2('0x1'))(_0xf8e2('0x2'));var moment=require(_0xf8e2('0x3'));var BPromise=require(_0xf8e2('0x4'));var rp=require(_0xf8e2('0x5'));var fs=require('fs');var path=require(_0xf8e2('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf8e2('0x7'));module['exports']=function(_0x1edb34,_0x2c4896){return _0x1edb34[_0xf8e2('0x8')](_0xf8e2('0x9'),attributes,{'tableName':_0xf8e2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 24358fb..51b8010 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 _0x4abd=['error','code','message','request\x20sent','GetVoiceExtension','VoiceExtension','options','where','attributes','limit','include','map','model','debug','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./voiceExtension.socket','request','then','info','VoiceExtension,\x20%s,\x20%s'];(function(_0x437545,_0x4ab48b){var _0x408060=function(_0x564586){while(--_0x564586){_0x437545['push'](_0x437545['shift']());}};_0x408060(++_0x4ab48b);}(_0x4abd,0xa4));var _0xd4ab=function(_0x143d33,_0x5ae149){_0x143d33=_0x143d33-0x0;var _0x2ec94e=_0x4abd[_0x143d33];return _0x2ec94e;};'use strict';var _=require(_0xd4ab('0x0'));var util=require(_0xd4ab('0x1'));var moment=require(_0xd4ab('0x2'));var BPromise=require(_0xd4ab('0x3'));var rs=require(_0xd4ab('0x4'));var fs=require('fs');var Redis=require(_0xd4ab('0x5'));var db=require(_0xd4ab('0x6'))['db'];var utils=require(_0xd4ab('0x7'));var logger=require(_0xd4ab('0x8'))(_0xd4ab('0x9'));var config=require(_0xd4ab('0xa'));var jayson=require(_0xd4ab('0xb'));var client=jayson[_0xd4ab('0xc')]['http']({'port':0x232a});config[_0xd4ab('0xd')]=_[_0xd4ab('0xe')](config[_0xd4ab('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xd4ab('0xf'))(new Redis(config[_0xd4ab('0xd')]));require(_0xd4ab('0x10'))['register'](socket);function respondWithRpcPromise(_0x1719da,_0x554d34,_0x316fe8){return new BPromise(function(_0x38804a,_0x40b8e6){return client[_0xd4ab('0x11')](_0x1719da,_0x316fe8)[_0xd4ab('0x12')](function(_0x3695c6){logger[_0xd4ab('0x13')](_0xd4ab('0x14'),_0x554d34,'request\x20sent');logger['debug']('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x554d34,'request\x20sent',JSON['stringify'](_0x3695c6));if(_0x3695c6[_0xd4ab('0x15')]){if(_0x3695c6[_0xd4ab('0x15')][_0xd4ab('0x16')]===0x1f4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x554d34,_0x3695c6[_0xd4ab('0x15')][_0xd4ab('0x17')]);return _0x40b8e6(_0x3695c6[_0xd4ab('0x15')][_0xd4ab('0x17')]);}logger[_0xd4ab('0x15')](_0xd4ab('0x14'),_0x554d34,_0x3695c6[_0xd4ab('0x15')][_0xd4ab('0x17')]);return _0x38804a(_0x3695c6['error'][_0xd4ab('0x17')]);}else{logger[_0xd4ab('0x13')](_0xd4ab('0x14'),_0x554d34,_0xd4ab('0x18'));_0x38804a(_0x3695c6['result']['message']);}})['catch'](function(_0x2bd200){logger[_0xd4ab('0x15')](_0xd4ab('0x14'),_0x554d34,_0x2bd200);_0x40b8e6(_0x2bd200);});});}exports[_0xd4ab('0x19')]=function(_0x34fdb7){var _0x5200a5=this;return new Promise(function(_0x24ebf6,_0x1c6938){return db[_0xd4ab('0x1a')]['findAll']({'raw':_0x34fdb7[_0xd4ab('0x1b')]?_0x34fdb7['options']['raw']===undefined?!![]:![]:!![],'where':_0x34fdb7[_0xd4ab('0x1b')]?_0x34fdb7[_0xd4ab('0x1b')][_0xd4ab('0x1c')]||null:null,'attributes':_0x34fdb7[_0xd4ab('0x1b')]?_0x34fdb7[_0xd4ab('0x1b')][_0xd4ab('0x1d')]||null:null,'limit':_0x34fdb7[_0xd4ab('0x1b')]?_0x34fdb7[_0xd4ab('0x1b')][_0xd4ab('0x1e')]||null:null,'include':_0x34fdb7[_0xd4ab('0x1b')]?_0x34fdb7[_0xd4ab('0x1b')][_0xd4ab('0x1f')]?_[_0xd4ab('0x20')](_0x34fdb7['options'][_0xd4ab('0x1f')],function(_0x383c30){return{'model':db[_0x383c30[_0xd4ab('0x21')]],'as':_0x383c30['as'],'attributes':_0x383c30[_0xd4ab('0x1d')],'include':_0x383c30[_0xd4ab('0x1f')]?_[_0xd4ab('0x20')](_0x383c30[_0xd4ab('0x1f')],function(_0xbbb8b4){return{'model':db[_0xbbb8b4['model']],'as':_0xbbb8b4['as'],'attributes':_0xbbb8b4[_0xd4ab('0x1d')],'include':_0xbbb8b4[_0xd4ab('0x1f')]?_[_0xd4ab('0x20')](_0xbbb8b4['include'],function(_0x3ebd0a){return{'model':db[_0x3ebd0a['model']],'as':_0x3ebd0a['as'],'attributes':_0x3ebd0a[_0xd4ab('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x20ad62){logger[_0xd4ab('0x13')](_0xd4ab('0x19'),_0x34fdb7);logger[_0xd4ab('0x22')](_0xd4ab('0x19'),_0x34fdb7,JSON[_0xd4ab('0x23')](_0x20ad62));_0x24ebf6(_0x20ad62);})[_0xd4ab('0x24')](function(_0x510c2a){logger[_0xd4ab('0x15')](_0xd4ab('0x19'),_0x510c2a[_0xd4ab('0x17')],_0x34fdb7);_0x1c6938(_0x5200a5['error'](0x1f4,_0x510c2a[_0xd4ab('0x17')]));});});}; \ No newline at end of file +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 diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 4d24cac..df7e809 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 _0xd828=['emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','remove','update'];(function(_0x38841c,_0x1af0bf){var _0x500610=function(_0x225955){while(--_0x225955){_0x38841c['push'](_0x38841c['shift']());}};_0x500610(++_0x1af0bf);}(_0xd828,0x1bd));var _0x8d82=function(_0x4dc008,_0x25f6f9){_0x4dc008=_0x4dc008-0x0;var _0x3bc9df=_0xd828[_0x4dc008];return _0x3bc9df;};'use strict';var VoiceExtensionEvents=require(_0x8d82('0x0'));var events=['save',_0x8d82('0x1'),_0x8d82('0x2')];function createListener(_0x526fa1,_0x2e1a26){return function(_0x3ca3dd){_0x2e1a26[_0x8d82('0x3')](_0x526fa1,_0x3ca3dd);};}function removeListener(_0x492b52,_0x5ec60c){return function(){VoiceExtensionEvents[_0x8d82('0x4')](_0x492b52,_0x5ec60c);};}exports[_0x8d82('0x5')]=function(_0x55e1b8){for(var _0x7f7a57=0x0,_0x4cf3b3=events[_0x8d82('0x6')];_0x7f7a57<_0x4cf3b3;_0x7f7a57++){var _0x394eda=events[_0x7f7a57];var _0x15e2cb=createListener(_0x8d82('0x7')+_0x394eda,_0x55e1b8);VoiceExtensionEvents['on'](_0x394eda,_0x15e2cb);}}; \ No newline at end of file +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 diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 558eca0..a9f5276 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 _0xdc97=['connect-timeout','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','isAuthenticated','index','/:id','/:id/messages','getMessages','post','create','update','delete','multer','util','path'];(function(_0x4d8929,_0x377cba){var _0x1464e7=function(_0x58379c){while(--_0x58379c){_0x4d8929['push'](_0x4d8929['shift']());}};_0x1464e7(++_0x377cba);}(_0xdc97,0xeb));var _0x7dc9=function(_0x4a9ce1,_0x3107eb){_0x4a9ce1=_0x4a9ce1-0x0;var _0x52b2c2=_0xdc97[_0x4a9ce1];return _0x52b2c2;};'use strict';var multer=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var path=require(_0x7dc9('0x2'));var timeout=require(_0x7dc9('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x7dc9('0x4'));var interaction=require(_0x7dc9('0x5'));var config=require('../../config/environment');var controller=require(_0x7dc9('0x6'));router[_0x7dc9('0x7')]('/',auth[_0x7dc9('0x8')](),controller[_0x7dc9('0x9')]);router[_0x7dc9('0x7')](_0x7dc9('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x7dc9('0x7')](_0x7dc9('0xb'),auth[_0x7dc9('0x8')](),controller[_0x7dc9('0xc')]);router[_0x7dc9('0xd')]('/',auth[_0x7dc9('0x8')](),controller[_0x7dc9('0xe')]);router['put'](_0x7dc9('0xa'),auth[_0x7dc9('0x8')](),controller[_0x7dc9('0xf')]);router[_0x7dc9('0x10')](_0x7dc9('0xa'),auth[_0x7dc9('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 711c5f2..4d4bc3e 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 _0x4024=['mailbox','sequelize','exports','STRING','from-voicemail','setDataValue','email','string','trim','central','yes','ENUM','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','fullname'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4024,0x89));var _0x4402=function(_0x416bed,_0xca08f8){_0x416bed=_0x416bed-0x0;var _0x3466d4=_0x4024[_0x416bed];return _0x3466d4;};'use strict';var Sequelize=require(_0x4402('0x0'));module[_0x4402('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x4402('0x2')],'defaultValue':_0x4402('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x4402('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x4402('0x2')]},'fullname':{'type':Sequelize[_0x4402('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x4f9482){this[_0x4402('0x4')](_0x4402('0x5'),typeof _0x4f9482===_0x4402('0x6')&&_0x4f9482['trim']()?_0x4f9482[_0x4402('0x7')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x4402('0x8')},'attach':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x4402('0x9'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x4402('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x4402('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x4402('0xa')](_0x4402('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x4402('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x4402('0xa')](_0x4402('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x4402('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x4402('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x4402('0xa')](_0x4402('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x4402('0xa')](_0x4402('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x4402('0xa')](_0x4402('0x9'),'no'),'defaultValue':_0x4402('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x4402('0xa')](_0x4402('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x4402('0xa')](_0x4402('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x4402('0xa')](_0x4402('0x9'),'no'),'defaultValue':_0x4402('0x9'),'allowNull':![]},'stamp':{'type':_0x4402('0xc')},'emailsubject':{'type':Sequelize[_0x4402('0x2')]},'emailbody':{'type':Sequelize[_0x4402('0x2')]},'maxsecs':{'type':Sequelize[_0x4402('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x4402('0xe')](_0x4402('0xf'))+'\x20-\x20'+this[_0x4402('0xe')](_0x4402('0x10'));}}}; \ No newline at end of file +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 diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 03b88c0..3db6470 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 _0x4658=['mailbox','findAndCountAll','html-pdf','eml-format','rimraf','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','Voicemails','UserProfileResource','error','stack','name','send','index','map','fieldName','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','options','includeAll','VoiceMail','findAll','rows','catch','show','params','rawAttributes','length','include','find','create','user','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','findOne','VoiceMailMessage','order'];(function(_0x47a5e3,_0x10d0b0){var _0x29a50f=function(_0x595c77){while(--_0x595c77){_0x47a5e3['push'](_0x47a5e3['shift']());}};_0x29a50f(++_0x10d0b0);}(_0x4658,0x1ba));var _0x8465=function(_0x816026,_0x365dee){_0x816026=_0x816026-0x0;var _0xf6fa6d=_0x4658[_0x816026];return _0xf6fa6d;};'use strict';var pdf=require(_0x8465('0x0'));var emlformat=require(_0x8465('0x1'));var rimraf=require(_0x8465('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8465('0x3'));var util=require(_0x8465('0x4'));var path=require(_0x8465('0x5'));var sox=require(_0x8465('0x6'));var csv=require(_0x8465('0x7'));var ejs=require(_0x8465('0x8'));var fs=require('fs');var _=require(_0x8465('0x9'));var squel=require(_0x8465('0xa'));var crypto=require(_0x8465('0xb'));var jsforce=require(_0x8465('0xc'));var deskjs=require(_0x8465('0xd'));var toCsv=require(_0x8465('0x7'));var querystring=require(_0x8465('0xe'));var Papa=require('papaparse');var Redis=require(_0x8465('0xf'));var authService=require(_0x8465('0x10'));var qs=require(_0x8465('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8465('0x12'));var logger=require(_0x8465('0x13'))(_0x8465('0x14'));var utils=require(_0x8465('0x15'));var config=require(_0x8465('0x16'));var db=require(_0x8465('0x17'))['db'];function respondWithStatusCode(_0xdf7984,_0x375005){_0x375005=_0x375005||0xcc;return function(_0x54ffba){if(_0x54ffba){return _0xdf7984[_0x8465('0x18')](_0x375005);}return _0xdf7984[_0x8465('0x19')](_0x375005)[_0x8465('0x1a')]();};}function respondWithResult(_0x46c113,_0xaedc83){_0xaedc83=_0xaedc83||0xc8;return function(_0x240823){if(_0x240823){return _0x46c113['status'](_0xaedc83)[_0x8465('0x1b')](_0x240823);}};}function respondWithFilteredResult(_0x13e66f,_0x4fb8c4){return function(_0x272ec0){if(_0x272ec0){var _0x27c184=_0x272ec0[_0x8465('0x1c')],_0x5ebe45=_0x4fb8c4[_0x8465('0x1d')],_0x38b15d=_0x4fb8c4['offset']+_0x4fb8c4[_0x8465('0x1e')],_0x395781;if(_0x38b15d>=_0x27c184){_0x38b15d=_0x27c184;_0x395781=0xc8;}else{_0x395781=0xce;}_0x13e66f[_0x8465('0x19')](_0x395781);return _0x13e66f[_0x8465('0x1f')](_0x8465('0x20'),_0x5ebe45+'-'+_0x38b15d+'/'+_0x27c184)[_0x8465('0x1b')](_0x272ec0);}return null;};}function patchUpdates(_0xbab5e0){return function(_0x25e3c0){try{jsonpatch[_0x8465('0x21')](_0x25e3c0,_0xbab5e0,!![]);}catch(_0x26f401){return BPromise[_0x8465('0x22')](_0x26f401);}return _0x25e3c0[_0x8465('0x23')]();};}function saveUpdates(_0x1b43c3,_0x2ebbad){return function(_0x296301){if(_0x296301){return _0x296301['update'](_0x1b43c3)[_0x8465('0x24')](function(_0x5c6c22){return _0x5c6c22;});}return null;};}function removeEntity(_0x3294ef,_0x258ca4){return function(_0x4db792){if(_0x4db792){return _0x4db792[_0x8465('0x25')]()[_0x8465('0x24')](function(){var _0x1284bb=_0x4db792['get']({'plain':!![]});var _0x49ab46=_0x8465('0x26');return db[_0x8465('0x27')]['destroy']({'where':{'type':_0x49ab46,'resourceId':_0x1284bb['id']}})[_0x8465('0x24')](function(){return _0x4db792;});})['then'](function(){_0x3294ef['status'](0xcc)[_0x8465('0x1a')]();});}};}function handleEntityNotFound(_0x4014b5,_0x125b76){return function(_0x8b07ff){if(!_0x8b07ff){_0x4014b5[_0x8465('0x18')](0x194);}return _0x8b07ff;};}function handleError(_0x44aacc,_0x2fe34f){_0x2fe34f=_0x2fe34f||0x1f4;return function(_0x20e549){logger[_0x8465('0x28')](_0x20e549[_0x8465('0x29')]);if(_0x20e549[_0x8465('0x2a')]){delete _0x20e549[_0x8465('0x2a')];}_0x44aacc[_0x8465('0x19')](_0x2fe34f)[_0x8465('0x2b')](_0x20e549);};}exports[_0x8465('0x2c')]=function(_0x4cc47f,_0x54a774){var _0x59e1ad={},_0x48d0ac={},_0xabbdc={'count':0x0,'rows':[]};var _0x4a71d7=_[_0x8465('0x2d')](db['VoiceMail']['rawAttributes'],function(_0x2607c7){return{'name':_0x2607c7[_0x8465('0x2e')],'type':_0x2607c7['type'][_0x8465('0x2f')]};});_0x48d0ac[_0x8465('0x30')]=_[_0x8465('0x2d')](_0x4a71d7,'name');_0x48d0ac['query']=_[_0x8465('0x31')](_0x4cc47f[_0x8465('0x32')]);_0x48d0ac['filters']=_[_0x8465('0x33')](_0x48d0ac['model'],_0x48d0ac[_0x8465('0x32')]);_0x59e1ad[_0x8465('0x34')]=_[_0x8465('0x33')](_0x48d0ac['model'],qs[_0x8465('0x35')](_0x4cc47f['query'][_0x8465('0x35')]));_0x59e1ad[_0x8465('0x34')]=_0x59e1ad[_0x8465('0x34')]['length']?_0x59e1ad['attributes']:_0x48d0ac[_0x8465('0x30')];if(!_0x4cc47f['query'][_0x8465('0x36')](_0x8465('0x37'))){_0x59e1ad[_0x8465('0x1e')]=qs[_0x8465('0x1e')](_0x4cc47f[_0x8465('0x32')][_0x8465('0x1e')]);_0x59e1ad['offset']=qs[_0x8465('0x1d')](_0x4cc47f['query'][_0x8465('0x1d')]);}_0x59e1ad['order']=qs[_0x8465('0x38')](_0x4cc47f[_0x8465('0x32')]['sort']);_0x59e1ad[_0x8465('0x39')]=qs[_0x8465('0x3a')](_[_0x8465('0x3b')](_0x4cc47f[_0x8465('0x32')],_0x48d0ac[_0x8465('0x3a')]));if(_0x4cc47f[_0x8465('0x32')][_0x8465('0x3c')]){_0x59e1ad[_0x8465('0x39')]=_[_0x8465('0x3d')](_0x59e1ad['where'],{'$or':_[_0x8465('0x2d')](_0x4a71d7,function(_0x42393d){if(_0x42393d[_0x8465('0x3e')]!=='VIRTUAL'){var _0x26d1d6={};_0x26d1d6[_0x42393d[_0x8465('0x2a')]]={'$like':'%'+_0x4cc47f[_0x8465('0x32')][_0x8465('0x3c')]+'%'};return _0x26d1d6;}})});}_0x59e1ad=_[_0x8465('0x3d')]({},_0x59e1ad,_0x4cc47f[_0x8465('0x3f')]);var _0x59112e={'where':_0x59e1ad['where']};return db['VoiceMail'][_0x8465('0x1c')](_0x59112e)['then'](function(_0x28dbff){_0xabbdc['count']=_0x28dbff;if(_0x4cc47f[_0x8465('0x32')][_0x8465('0x40')]){_0x59e1ad['include']=[{'all':!![]}];}return db[_0x8465('0x41')][_0x8465('0x42')](_0x59e1ad);})[_0x8465('0x24')](function(_0x3f5452){_0xabbdc[_0x8465('0x43')]=_0x3f5452;return _0xabbdc;})[_0x8465('0x24')](respondWithFilteredResult(_0x54a774,_0x59e1ad))[_0x8465('0x44')](handleError(_0x54a774,null));};exports[_0x8465('0x45')]=function(_0xae105,_0x35b59e){var _0x1f1bca={'raw':!![],'where':{'id':_0xae105[_0x8465('0x46')]['id']}},_0x185131={};_0x185131['model']=_[_0x8465('0x31')](db[_0x8465('0x41')][_0x8465('0x47')]);_0x185131['query']=_['keys'](_0xae105['query']);_0x185131[_0x8465('0x3a')]=_[_0x8465('0x33')](_0x185131[_0x8465('0x30')],_0x185131[_0x8465('0x32')]);_0x1f1bca[_0x8465('0x34')]=_['intersection'](_0x185131[_0x8465('0x30')],qs[_0x8465('0x35')](_0xae105[_0x8465('0x32')]['fields']));_0x1f1bca[_0x8465('0x34')]=_0x1f1bca[_0x8465('0x34')][_0x8465('0x48')]?_0x1f1bca['attributes']:_0x185131[_0x8465('0x30')];if(_0xae105[_0x8465('0x32')][_0x8465('0x40')]){_0x1f1bca[_0x8465('0x49')]=[{'all':!![]}];}_0x1f1bca=_[_0x8465('0x3d')]({},_0x1f1bca,_0xae105['options']);return db['VoiceMail'][_0x8465('0x4a')](_0x1f1bca)['then'](handleEntityNotFound(_0x35b59e,null))['then'](respondWithResult(_0x35b59e,null))[_0x8465('0x44')](handleError(_0x35b59e,null));};exports['create']=function(_0x12a0da,_0x1231cd){return db[_0x8465('0x41')][_0x8465('0x4b')](_0x12a0da['body'],{})[_0x8465('0x24')](function(_0x266c2d){var _0x5ed569=_0x12a0da[_0x8465('0x4c')][_0x8465('0x4d')]({'plain':!![]});if(!_0x5ed569)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ed569[_0x8465('0x4e')]===_0x8465('0x4c')){var _0x4b0cd2=_0x266c2d[_0x8465('0x4d')]({'plain':!![]});var _0x5613c5=_0x8465('0x26');return db[_0x8465('0x4f')][_0x8465('0x4a')]({'where':{'name':_0x5613c5,'userProfileId':_0x5ed569[_0x8465('0x50')]},'raw':!![]})[_0x8465('0x24')](function(_0x4d56a7){if(_0x4d56a7&&_0x4d56a7['autoAssociation']===0x0){return db[_0x8465('0x27')]['create']({'name':_0x4b0cd2[_0x8465('0x2a')],'resourceId':_0x4b0cd2['id'],'type':_0x4d56a7[_0x8465('0x2a')],'sectionId':_0x4d56a7['id']},{})['then'](function(){return _0x266c2d;});}else{return _0x266c2d;}})['catch'](function(_0x3d2de5){logger[_0x8465('0x28')](_0x8465('0x51'),_0x3d2de5);throw _0x3d2de5;});}return _0x266c2d;})[_0x8465('0x24')](respondWithResult(_0x1231cd,0xc9))[_0x8465('0x44')](handleError(_0x1231cd,null));};exports['update']=function(_0x1491d7,_0x59df28){if(_0x1491d7[_0x8465('0x52')]['id']){delete _0x1491d7[_0x8465('0x52')]['id'];}return db[_0x8465('0x41')][_0x8465('0x4a')]({'where':{'id':_0x1491d7['params']['id']}})[_0x8465('0x24')](handleEntityNotFound(_0x59df28,null))[_0x8465('0x24')](saveUpdates(_0x1491d7['body'],null))[_0x8465('0x24')](respondWithResult(_0x59df28,null))[_0x8465('0x44')](handleError(_0x59df28,null));};exports['destroy']=function(_0x40443a,_0x4f6aeb){return db[_0x8465('0x41')]['find']({'where':{'id':_0x40443a['params']['id']}})['then'](handleEntityNotFound(_0x4f6aeb,null))[_0x8465('0x24')](removeEntity(_0x4f6aeb,null))[_0x8465('0x44')](handleError(_0x4f6aeb,null));};exports['getMessages']=function(_0xa1cc33,_0x1f42b0,_0x498d3a){return db[_0x8465('0x41')][_0x8465('0x53')]({'where':{'id':_0xa1cc33['params']['id']}})[_0x8465('0x24')](handleEntityNotFound(_0x1f42b0,null))[_0x8465('0x24')](function(_0x1da729){var _0xe18ac;var _0x95df30={},_0x128283={};_0x128283[_0x8465('0x30')]=_['keys'](db[_0x8465('0x54')]['rawAttributes']);_0x128283[_0x8465('0x32')]=_[_0x8465('0x31')](_0xa1cc33[_0x8465('0x32')]);_0x128283[_0x8465('0x3a')]=_[_0x8465('0x33')](_0x128283[_0x8465('0x30')],_0x128283[_0x8465('0x32')]);_0x95df30[_0x8465('0x34')]=_['intersection'](_0x128283[_0x8465('0x30')],qs[_0x8465('0x35')](_0xa1cc33[_0x8465('0x32')][_0x8465('0x35')]));_0x95df30[_0x8465('0x34')]=_0x95df30[_0x8465('0x34')]['length']?_0x95df30[_0x8465('0x34')]:_0x128283[_0x8465('0x30')];if(!_0xa1cc33[_0x8465('0x32')][_0x8465('0x36')](_0x8465('0x37'))){_0x95df30['limit']=qs[_0x8465('0x1e')](_0xa1cc33[_0x8465('0x32')]['limit']);_0x95df30[_0x8465('0x1d')]=qs['offset'](_0xa1cc33[_0x8465('0x32')]['offset']);}_0x95df30[_0x8465('0x55')]=qs[_0x8465('0x38')](_0xa1cc33['query']['sort']);_0x95df30['where']=qs['filters'](_[_0x8465('0x3b')](_0xa1cc33['query'],_0x128283[_0x8465('0x3a')]));if(_0xa1cc33['query']['filter']){_0x95df30[_0x8465('0x39')]=_[_0x8465('0x3d')](_0x95df30[_0x8465('0x39')],{'$or':_[_0x8465('0x2d')](_0x95df30[_0x8465('0x34')],function(_0x1b0f65){var _0x3aa20f={};_0x3aa20f[_0x1b0f65]={'$like':'%'+_0xa1cc33[_0x8465('0x32')][_0x8465('0x3c')]+'%'};return _0x3aa20f;})});}_0x95df30[_0x8465('0x39')]=_[_0x8465('0x3d')](_0x95df30['where'],{'mailboxuser':_0x1da729[_0x8465('0x56')]});_0x95df30=_[_0x8465('0x3d')]({},_0x95df30,_0xa1cc33[_0x8465('0x3f')]);return db[_0x8465('0x54')][_0x8465('0x57')](_0x95df30)[_0x8465('0x24')](respondWithFilteredResult(_0x1f42b0,_0x95df30));})[_0x8465('0x44')](handleError(_0x1f42b0,null));}; \ No newline at end of file +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 diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 9a9cb3c..93263c9 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 _0xf891=['voice_voicemail','mailbox_context','mailbox','context','lodash','util','moment','bluebird','path','../../config/environment','./voiceMail.attributes','exports','define'];(function(_0xd35683,_0x29ad94){var _0xb54d60=function(_0x8e138e){while(--_0x8e138e){_0xd35683['push'](_0xd35683['shift']());}};_0xb54d60(++_0x29ad94);}(_0xf891,0x93));var _0x1f89=function(_0x4cc49d,_0x4eed77){_0x4cc49d=_0x4cc49d-0x0;var _0x51276b=_0xf891[_0x4cc49d];return _0x51276b;};'use strict';var _=require(_0x1f89('0x0'));var util=require(_0x1f89('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1f89('0x2'));var BPromise=require(_0x1f89('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1f89('0x4'));var rimraf=require('rimraf');var config=require(_0x1f89('0x5'));var attributes=require(_0x1f89('0x6'));module[_0x1f89('0x7')]=function(_0x52c493,_0x1acdc4){return _0x52c493[_0x1f89('0x8')]('VoiceMail',attributes,{'tableName':_0x1f89('0x9'),'paranoid':![],'indexes':[{'name':_0x1f89('0xa'),'fields':[_0x1f89('0xb'),_0x1f89('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 0b8b7ec..5b23a32 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 _0x5f83=['rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x6273c0,_0x2a61cc){var _0x38cc4e=function(_0x3d645d){while(--_0x3d645d){_0x6273c0['push'](_0x6273c0['shift']());}};_0x38cc4e(++_0x2a61cc);}(_0x5f83,0x10c));var _0x35f8=function(_0x1bb485,_0x1a695e){_0x1bb485=_0x1bb485-0x0;var _0x5ae7dc=_0x5f83[_0x1bb485];return _0x5ae7dc;};'use strict';var _=require(_0x35f8('0x0'));var util=require(_0x35f8('0x1'));var moment=require(_0x35f8('0x2'));var BPromise=require(_0x35f8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35f8('0x4'));var db=require(_0x35f8('0x5'))['db'];var utils=require(_0x35f8('0x6'));var logger=require(_0x35f8('0x7'))(_0x35f8('0x8'));var config=require(_0x35f8('0x9'));var jayson=require(_0x35f8('0xa'));var client=jayson[_0x35f8('0xb')][_0x35f8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4f5f0a,_0x57986a,_0x2c565a){return new BPromise(function(_0x25b7b6,_0x244806){return client['request'](_0x4f5f0a,_0x2c565a)[_0x35f8('0xd')](function(_0x38a9b1){logger[_0x35f8('0xe')](_0x35f8('0xf'),_0x57986a,_0x35f8('0x10'));logger[_0x35f8('0x11')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x57986a,'request\x20sent',JSON[_0x35f8('0x12')](_0x38a9b1));if(_0x38a9b1[_0x35f8('0x13')]){if(_0x38a9b1[_0x35f8('0x13')][_0x35f8('0x14')]===0x1f4){logger[_0x35f8('0x13')](_0x35f8('0xf'),_0x57986a,_0x38a9b1[_0x35f8('0x13')][_0x35f8('0x15')]);return _0x244806(_0x38a9b1[_0x35f8('0x13')]['message']);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x57986a,_0x38a9b1[_0x35f8('0x13')][_0x35f8('0x15')]);return _0x25b7b6(_0x38a9b1[_0x35f8('0x13')][_0x35f8('0x15')]);}else{logger[_0x35f8('0xe')](_0x35f8('0xf'),_0x57986a,'request\x20sent');_0x25b7b6(_0x38a9b1[_0x35f8('0x16')][_0x35f8('0x15')]);}})['catch'](function(_0x577dc9){logger[_0x35f8('0x13')](_0x35f8('0xf'),_0x57986a,_0x577dc9);_0x244806(_0x577dc9);});});} \ No newline at end of file +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 diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 0fc454d..9b41f11 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 _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','download','post','create','put','update'];(function(_0x13187a,_0x2fcec4){var _0x65b85f=function(_0x33bf1f){while(--_0x33bf1f){_0x13187a['push'](_0x13187a['shift']());}};_0x65b85f(++_0x2fcec4);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xc4aa[_0x273c39];return _0x46d6b5;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xac4a('0x6'));router[_0xac4a('0x7')]('/',auth[_0xac4a('0x8')](),controller[_0xac4a('0x9')]);router[_0xac4a('0x7')](_0xac4a('0xa'),auth[_0xac4a('0x8')](),controller[_0xac4a('0xb')]);router['get']('/:id/download',auth[_0xac4a('0x8')](),controller[_0xac4a('0xc')]);router[_0xac4a('0xd')]('/',auth['isAuthenticated'](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')](_0xac4a('0xa'),auth['isAuthenticated'](),controller[_0xac4a('0x10')]);router['delete'](_0xac4a('0xa'),auth['isAuthenticated'](),controller[_0xac4a('0x11')]);module[_0xac4a('0x12')]=router; \ No newline at end of file +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 diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 845de6d..b2fed62 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 _0x847e=['BLOB','long','TIMESTAMP','sequelize','exports','VIRTUAL','INTEGER','STRING'];(function(_0x28ff47,_0x26a4e0){var _0xdb4b11=function(_0x411a8d){while(--_0x411a8d){_0x28ff47['push'](_0x28ff47['shift']());}};_0xdb4b11(++_0x26a4e0);}(_0x847e,0x1a3));var _0xe847=function(_0x52be6c,_0x31d470){_0x52be6c=_0x52be6c-0x0;var _0x21b915=_0x847e[_0x52be6c];return _0x21b915;};'use strict';var Sequelize=require(_0xe847('0x0'));module[_0xe847('0x1')]={'name':{'type':Sequelize[_0xe847('0x2')],'get':function(_0x3b2187){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0xe847('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xe847('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xe847('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xe847('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xe847('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xe847('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xe847('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xe847('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xe847('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xe847('0x5')](_0xe847('0x6')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xe847('0x7'),'allowNull':![]}}; \ No newline at end of file +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 diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index d2ecec6..fa29df3 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 _0xae24=['.wav\x22','html-pdf','rimraf','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../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','save','update','destroy','then','error','stack','name','send','map','model','differenceBy','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','VoiceMailMessage','include','findAll','catch','show','length','includeAll','find','create','body','params','msg_id','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','attachment;\x20filename=\x22'];(function(_0x32bdd9,_0x5f0082){var _0xe6511f=function(_0x539382){while(--_0x539382){_0x32bdd9['push'](_0x32bdd9['shift']());}};_0xe6511f(++_0x5f0082);}(_0xae24,0x182));var _0x4ae2=function(_0x54658f,_0x72a3cb){_0x54658f=_0x54658f-0x0;var _0x26419a=_0xae24[_0x54658f];return _0x26419a;};'use strict';var pdf=require(_0x4ae2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4ae2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4ae2('0x2'));var rp=require(_0x4ae2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4ae2('0x4'));var util=require('util');var path=require(_0x4ae2('0x5'));var sox=require(_0x4ae2('0x6'));var csv=require(_0x4ae2('0x7'));var ejs=require(_0x4ae2('0x8'));var fs=require('fs');var _=require(_0x4ae2('0x9'));var squel=require(_0x4ae2('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4ae2('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4ae2('0xc'));var Redis=require(_0x4ae2('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x4ae2('0xe'));var as=require(_0x4ae2('0xf'));var hardwareService=require(_0x4ae2('0x10'));var logger=require(_0x4ae2('0x11'))('api');var utils=require(_0x4ae2('0x12'));var config=require(_0x4ae2('0x13'));var db=require(_0x4ae2('0x14'))['db'];function respondWithStatusCode(_0x4d7dc3,_0x25d2b4){_0x25d2b4=_0x25d2b4||0xcc;return function(_0x22ac1e){if(_0x22ac1e){return _0x4d7dc3[_0x4ae2('0x15')](_0x25d2b4);}return _0x4d7dc3[_0x4ae2('0x16')](_0x25d2b4)[_0x4ae2('0x17')]();};}function respondWithResult(_0x40954f,_0x145287){_0x145287=_0x145287||0xc8;return function(_0x3cabc9){if(_0x3cabc9){return _0x40954f[_0x4ae2('0x16')](_0x145287)['json'](_0x3cabc9);}};}function respondWithFilteredResult(_0x4ec027,_0x4d5cab){return function(_0x2f3936){if(_0x2f3936){var _0xf834a1=_0x2f3936[_0x4ae2('0x18')],_0x5f447a=_0x4d5cab[_0x4ae2('0x19')],_0x463765=_0x4d5cab[_0x4ae2('0x19')]+_0x4d5cab[_0x4ae2('0x1a')],_0x9fb8db;if(_0x463765>=_0xf834a1){_0x463765=_0xf834a1;_0x9fb8db=0xc8;}else{_0x9fb8db=0xce;}_0x4ec027[_0x4ae2('0x16')](_0x9fb8db);return _0x4ec027[_0x4ae2('0x1b')](_0x4ae2('0x1c'),_0x5f447a+'-'+_0x463765+'/'+_0xf834a1)[_0x4ae2('0x1d')](_0x2f3936);}return null;};}function patchUpdates(_0x4d5071){return function(_0x4a97af){try{jsonpatch[_0x4ae2('0x1e')](_0x4a97af,_0x4d5071,!![]);}catch(_0x2d910c){return BPromise['reject'](_0x2d910c);}return _0x4a97af[_0x4ae2('0x1f')]();};}function saveUpdates(_0x343db1,_0xccb3b){return function(_0x2ad222){if(_0x2ad222){return _0x2ad222[_0x4ae2('0x20')](_0x343db1)['then'](function(_0x2bf5fe){return _0x2bf5fe;});}return null;};}function removeEntity(_0x53c686,_0x522165){return function(_0x2ceec4){if(_0x2ceec4){return _0x2ceec4[_0x4ae2('0x21')]()[_0x4ae2('0x22')](function(){_0x53c686[_0x4ae2('0x16')](0xcc)[_0x4ae2('0x17')]();});}};}function handleEntityNotFound(_0x526768,_0x1005e0){return function(_0x4a0ddb){if(!_0x4a0ddb){_0x526768[_0x4ae2('0x15')](0x194);}return _0x4a0ddb;};}function handleError(_0x12b5d2,_0x130239){_0x130239=_0x130239||0x1f4;return function(_0x57933b){logger[_0x4ae2('0x23')](_0x57933b[_0x4ae2('0x24')]);if(_0x57933b[_0x4ae2('0x25')]){delete _0x57933b[_0x4ae2('0x25')];}_0x12b5d2[_0x4ae2('0x16')](_0x130239)[_0x4ae2('0x26')](_0x57933b);};}exports['index']=function(_0x5962b0,_0x9508d7){var _0x3030f8={},_0x3fa514={},_0x329588={'count':0x0,'rows':[]};var _0x3a9b96=_[_0x4ae2('0x27')](db['VoiceMailMessage']['rawAttributes'],function(_0x3e2666){return{'name':_0x3e2666['fieldName'],'type':_0x3e2666['type']['key']};});_0x3fa514[_0x4ae2('0x28')]=_[_0x4ae2('0x29')](_['map'](_0x3a9b96,_0x4ae2('0x25')),[_0x4ae2('0x25')]);_0x3fa514[_0x4ae2('0x2a')]=_[_0x4ae2('0x2b')](_0x5962b0[_0x4ae2('0x2a')]);_0x3fa514[_0x4ae2('0x2c')]=_[_0x4ae2('0x2d')](_0x3fa514[_0x4ae2('0x28')],_0x3fa514[_0x4ae2('0x2a')]);_0x3030f8[_0x4ae2('0x2e')]=_[_0x4ae2('0x2d')](_0x3fa514[_0x4ae2('0x28')],qs[_0x4ae2('0x2f')](_0x5962b0[_0x4ae2('0x2a')][_0x4ae2('0x2f')]));_0x3030f8[_0x4ae2('0x2e')]=_0x3030f8[_0x4ae2('0x2e')]['length']?_0x3030f8[_0x4ae2('0x2e')]:_0x3fa514['model'];if(!_0x5962b0[_0x4ae2('0x2a')][_0x4ae2('0x30')]('nolimit')){_0x3030f8[_0x4ae2('0x1a')]=qs[_0x4ae2('0x1a')](_0x5962b0[_0x4ae2('0x2a')][_0x4ae2('0x1a')]);_0x3030f8['offset']=qs[_0x4ae2('0x19')](_0x5962b0[_0x4ae2('0x2a')][_0x4ae2('0x19')]);}_0x3030f8[_0x4ae2('0x31')]=qs[_0x4ae2('0x32')](_0x5962b0[_0x4ae2('0x2a')][_0x4ae2('0x32')]);_0x3030f8[_0x4ae2('0x33')]=qs[_0x4ae2('0x2c')](_['pick'](_0x5962b0[_0x4ae2('0x2a')],_0x3fa514['filters']));if(_0x5962b0[_0x4ae2('0x2a')][_0x4ae2('0x34')]){_0x3030f8[_0x4ae2('0x33')]=_[_0x4ae2('0x35')](_0x3030f8[_0x4ae2('0x33')],{'$or':_[_0x4ae2('0x27')](_0x3a9b96,function(_0x5e1fa4){if(_0x5e1fa4[_0x4ae2('0x36')]!==_0x4ae2('0x37')){var _0x20d755={};_0x20d755[_0x5e1fa4[_0x4ae2('0x25')]]={'$like':'%'+_0x5962b0['query'][_0x4ae2('0x34')]+'%'};return _0x20d755;}})});}_0x3030f8=_[_0x4ae2('0x35')]({},_0x3030f8,_0x5962b0[_0x4ae2('0x38')]);var _0x2a2dba={'where':_0x3030f8[_0x4ae2('0x33')]};return db[_0x4ae2('0x39')][_0x4ae2('0x18')](_0x2a2dba)[_0x4ae2('0x22')](function(_0x1d5888){_0x329588[_0x4ae2('0x18')]=_0x1d5888;if(_0x5962b0[_0x4ae2('0x2a')]['includeAll']){_0x3030f8[_0x4ae2('0x3a')]=[{'all':!![]}];}return db[_0x4ae2('0x39')][_0x4ae2('0x3b')](_0x3030f8);})[_0x4ae2('0x22')](function(_0x5bade3){_0x329588['rows']=_0x5bade3;return _0x329588;})[_0x4ae2('0x22')](respondWithFilteredResult(_0x9508d7,_0x3030f8))[_0x4ae2('0x3c')](handleError(_0x9508d7,null));};exports[_0x4ae2('0x3d')]=function(_0x3cdf23,_0x567371){var _0x3c0a56={'raw':!![],'where':{'id':_0x3cdf23['params']['id']}},_0x178898={};_0x178898[_0x4ae2('0x28')]=_[_0x4ae2('0x2b')](db[_0x4ae2('0x39')]['rawAttributes']);_0x178898[_0x4ae2('0x2a')]=_[_0x4ae2('0x2b')](_0x3cdf23[_0x4ae2('0x2a')]);_0x178898[_0x4ae2('0x2c')]=_[_0x4ae2('0x2d')](_0x178898[_0x4ae2('0x28')],_0x178898[_0x4ae2('0x2a')]);_0x3c0a56[_0x4ae2('0x2e')]=_['intersection'](_0x178898[_0x4ae2('0x28')],qs[_0x4ae2('0x2f')](_0x3cdf23['query'][_0x4ae2('0x2f')]));_0x3c0a56[_0x4ae2('0x2e')]=_0x3c0a56['attributes'][_0x4ae2('0x3e')]?_0x3c0a56[_0x4ae2('0x2e')]:_0x178898['model'];if(_0x3cdf23[_0x4ae2('0x2a')][_0x4ae2('0x3f')]){_0x3c0a56[_0x4ae2('0x3a')]=[{'all':!![]}];}_0x3c0a56=_['merge']({},_0x3c0a56,_0x3cdf23['options']);return db[_0x4ae2('0x39')][_0x4ae2('0x40')](_0x3c0a56)[_0x4ae2('0x22')](handleEntityNotFound(_0x567371,null))[_0x4ae2('0x22')](respondWithResult(_0x567371,null))['catch'](handleError(_0x567371,null));};exports[_0x4ae2('0x41')]=function(_0x28b33a,_0x163d75){return db['VoiceMailMessage'][_0x4ae2('0x41')](_0x28b33a[_0x4ae2('0x42')],{})[_0x4ae2('0x22')](respondWithResult(_0x163d75,0xc9))['catch'](handleError(_0x163d75,null));};exports[_0x4ae2('0x20')]=function(_0x24ec08,_0x2b596c){if(_0x24ec08[_0x4ae2('0x42')]['id']){delete _0x24ec08[_0x4ae2('0x42')]['id'];}return db[_0x4ae2('0x39')][_0x4ae2('0x40')]({'where':{'id':_0x24ec08[_0x4ae2('0x43')]['id']}})[_0x4ae2('0x22')](handleEntityNotFound(_0x2b596c,null))[_0x4ae2('0x22')](saveUpdates(_0x24ec08['body'],null))[_0x4ae2('0x22')](respondWithResult(_0x2b596c,null))[_0x4ae2('0x3c')](handleError(_0x2b596c,null));};exports[_0x4ae2('0x21')]=function(_0x1c0898,_0x2292ec){return db[_0x4ae2('0x39')][_0x4ae2('0x40')]({'where':{'id':_0x1c0898[_0x4ae2('0x43')]['id']}})['then'](handleEntityNotFound(_0x2292ec,null))[_0x4ae2('0x22')](removeEntity(_0x2292ec,null))[_0x4ae2('0x3c')](handleError(_0x2292ec,null));};exports['download']=function(_0x2fee58,_0x3c5f8d,_0x4f7206){return db[_0x4ae2('0x39')]['find']({'where':{'id':_0x2fee58[_0x4ae2('0x43')]['id']},'attributes':['id','recording',_0x4ae2('0x44')]})[_0x4ae2('0x22')](handleEntityNotFound(_0x3c5f8d,null))[_0x4ae2('0x22')](function(_0x1a21ad){if(_0x1a21ad){if(!_0x1a21ad[_0x4ae2('0x45')]){throw new db[(_0x4ae2('0x46'))][(_0x4ae2('0x47'))](_0x4ae2('0x48'));}var _0x28de70={'Content-Type':'audio/wav','Content-Disposition':_0x4ae2('0x49')};if(_0x1a21ad[_0x4ae2('0x44')]){_0x28de70[_0x4ae2('0x4a')]=_0x4ae2('0x4b')+_0x1a21ad['msg_id']+_0x4ae2('0x4c');}_0x3c5f8d[_0x4ae2('0x1b')](_0x28de70);return _0x3c5f8d[_0x4ae2('0x26')](new Buffer(_0x1a21ad['recording']));}})['catch'](handleError(_0x3c5f8d,null));}; \ No newline at end of file +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 diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 7eab190..4a73e34 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 _0x6add=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','dir','lodash','util','../../config/logger','api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6add,0x1ca));var _0xd6ad=function(_0x17e069,_0x3a0dfd){_0x17e069=_0x17e069-0x0;var _0x461041=_0x6add[_0x17e069];return _0x461041;};'use strict';var _=require(_0xd6ad('0x0'));var util=require(_0xd6ad('0x1'));var logger=require(_0xd6ad('0x2'))(_0xd6ad('0x3'));var moment=require('moment');var BPromise=require(_0xd6ad('0x4'));var rp=require(_0xd6ad('0x5'));var fs=require('fs');var path=require(_0xd6ad('0x6'));var rimraf=require(_0xd6ad('0x7'));var config=require(_0xd6ad('0x8'));var attributes=require(_0xd6ad('0x9'));module[_0xd6ad('0xa')]=function(_0x100310,_0x382d8a){return _0x100310[_0xd6ad('0xb')](_0xd6ad('0xc'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0xd6ad('0xd'),'fields':[_0xd6ad('0xd')]}],'timestamps':![]});}; \ No newline at end of file +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 diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 06ae105..0476674 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.rpc.js +++ b/server/api/voiceMailMessage/voiceMailMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a85=['../../config/logger','rpc','jayson/promise','http','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils'];(function(_0x3c9ef4,_0x481248){var _0x2f8796=function(_0x38aeee){while(--_0x38aeee){_0x3c9ef4['push'](_0x3c9ef4['shift']());}};_0x2f8796(++_0x481248);}(_0x1a85,0x178));var _0x51a8=function(_0x25e214,_0x42a13e){_0x25e214=_0x25e214-0x0;var _0x48ca06=_0x1a85[_0x25e214];return _0x48ca06;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});} \ No newline at end of file +var _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 diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 834d87a..8301dcf 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 _0x7cac=['destroy','delete','removeSound','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id/sounds','post','create','addSound','put','/:id','update'];(function(_0x4fe438,_0x91bcaf){var _0x444998=function(_0x357c82){while(--_0x357c82){_0x4fe438['push'](_0x4fe438['shift']());}};_0x444998(++_0x91bcaf);}(_0x7cac,0x94));var _0xc7ca=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x7cac[_0x6cf19c];return _0xce14f3;};'use strict';var multer=require(_0xc7ca('0x0'));var util=require(_0xc7ca('0x1'));var path=require(_0xc7ca('0x2'));var timeout=require(_0xc7ca('0x3'));var express=require(_0xc7ca('0x4'));var router=express[_0xc7ca('0x5')]();var auth=require(_0xc7ca('0x6'));var interaction=require(_0xc7ca('0x7'));var config=require(_0xc7ca('0x8'));var controller=require(_0xc7ca('0x9'));router[_0xc7ca('0xa')]('/',auth[_0xc7ca('0xb')](),controller[_0xc7ca('0xc')]);router[_0xc7ca('0xa')]('/:id',auth[_0xc7ca('0xb')](),controller['show']);router['get'](_0xc7ca('0xd'),auth[_0xc7ca('0xb')](),controller['getSounds']);router[_0xc7ca('0xe')]('/',auth[_0xc7ca('0xb')](),controller[_0xc7ca('0xf')]);router[_0xc7ca('0xe')](_0xc7ca('0xd'),auth[_0xc7ca('0xb')](),controller[_0xc7ca('0x10')]);router[_0xc7ca('0x11')](_0xc7ca('0x12'),auth[_0xc7ca('0xb')](),controller[_0xc7ca('0x13')]);router['delete'](_0xc7ca('0x12'),auth['isAuthenticated'](),controller[_0xc7ca('0x14')]);router[_0xc7ca('0x15')]('/:id/sounds/:id2',auth[_0xc7ca('0xb')](),controller[_0xc7ca('0x16')]);module[_0xc7ca('0x17')]=router; \ No newline at end of file +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 diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 4d3d7f3..91ed256 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 _0x5c41=['STRING','ENUM','custom','files','mp3nb','mp3','alpha','TIMESTAMP','sequelize','exports'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0x5c41,0x134));var _0x15c4=function(_0x443fe4,_0x30ff62){_0x443fe4=_0x443fe4-0x0;var _0x39d269=_0x5c41[_0x443fe4];return _0x39d269;};'use strict';var Sequelize=require(_0x15c4('0x0'));module[_0x15c4('0x1')]={'name':{'type':Sequelize[_0x15c4('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x15c4('0x3')](_0x15c4('0x4'),_0x15c4('0x5'),_0x15c4('0x6'),'quietmp3nb','quietmp3',_0x15c4('0x7')),'allowNull':!![],'defaultValue':_0x15c4('0x5')},'directory':{'type':Sequelize[_0x15c4('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x15c4('0x8')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x15c4('0x9')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +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 diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 9dda3c7..5078dd3 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 _0xf98f=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','join','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','server/files/moh','symlinkSync','removeSound','id2','getSounds','rawAttributes','order','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','get','MusicOnHolds','destroy','stack','name','VoiceMusicOnHold','type','key','map','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','params','fields','merge','find','body','catch','create','sequelize','transaction','root','mode','files','directory'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xf98f,0xf4));var _0xff98=function(_0x515b57,_0x3300a6){_0x515b57=_0x515b57-0x0;var _0x7a8f19=_0xf98f[_0x515b57];return _0x7a8f19;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xff98('0x0'));var zipdir=require(_0xff98('0x1'));var jsonpatch=require(_0xff98('0x2'));var rp=require(_0xff98('0x3'));var moment=require(_0xff98('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xff98('0x5'));var path=require(_0xff98('0x6'));var sox=require(_0xff98('0x7'));var csv=require(_0xff98('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xff98('0x9'));var squel=require(_0xff98('0xa'));var crypto=require('crypto');var jsforce=require(_0xff98('0xb'));var deskjs=require(_0xff98('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xff98('0xd'));var Redis=require(_0xff98('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xff98('0xf'));var hardwareService=require(_0xff98('0x10'));var logger=require(_0xff98('0x11'))(_0xff98('0x12'));var utils=require('../../config/utils');var config=require(_0xff98('0x13'));var db=require(_0xff98('0x14'))['db'];function respondWithStatusCode(_0x17003d,_0xac8600){_0xac8600=_0xac8600||0xcc;return function(_0x10e643){if(_0x10e643){return _0x17003d[_0xff98('0x15')](_0xac8600);}return _0x17003d[_0xff98('0x16')](_0xac8600)[_0xff98('0x17')]();};}function respondWithResult(_0x49068d,_0x33f17d){_0x33f17d=_0x33f17d||0xc8;return function(_0x480440){if(_0x480440){return _0x49068d[_0xff98('0x16')](_0x33f17d)[_0xff98('0x18')](_0x480440);}};}function respondWithFilteredResult(_0x4fd4f1,_0x1bf4e8){return function(_0x724893){if(_0x724893){var _0x10da43=_0x724893[_0xff98('0x19')],_0xb76463=_0x1bf4e8[_0xff98('0x1a')],_0x4f55d0=_0x1bf4e8[_0xff98('0x1a')]+_0x1bf4e8[_0xff98('0x1b')],_0x765020;if(_0x4f55d0>=_0x10da43){_0x4f55d0=_0x10da43;_0x765020=0xc8;}else{_0x765020=0xce;}_0x4fd4f1['status'](_0x765020);return _0x4fd4f1[_0xff98('0x1c')](_0xff98('0x1d'),_0xb76463+'-'+_0x4f55d0+'/'+_0x10da43)[_0xff98('0x18')](_0x724893);}return null;};}function patchUpdates(_0x2fb61c){return function(_0x180db5){try{jsonpatch['apply'](_0x180db5,_0x2fb61c,!![]);}catch(_0xf29754){return BPromise[_0xff98('0x1e')](_0xf29754);}return _0x180db5[_0xff98('0x1f')]();};}function saveUpdates(_0x1bbdf1,_0x26b609){return function(_0x5857c5){if(_0x5857c5){return _0x5857c5[_0xff98('0x20')](_0x1bbdf1)[_0xff98('0x21')](function(_0x289e84){return _0x289e84;});}return null;};}function removeEntity(_0x262b71,_0x1f6f35){return function(_0x1c60d2){if(_0x1c60d2){return _0x1c60d2['destroy']()[_0xff98('0x21')](function(){var _0x3f5828=_0x1c60d2[_0xff98('0x22')]({'plain':!![]});var _0x5ba9e6=_0xff98('0x23');return db['UserProfileResource'][_0xff98('0x24')]({'where':{'type':_0x5ba9e6,'resourceId':_0x3f5828['id']}})[_0xff98('0x21')](function(){return _0x1c60d2;});})[_0xff98('0x21')](function(){_0x262b71[_0xff98('0x16')](0xcc)[_0xff98('0x17')]();});}};}function handleEntityNotFound(_0x5abcbb,_0x5970ba){return function(_0x302b3a){if(!_0x302b3a){_0x5abcbb[_0xff98('0x15')](0x194);}return _0x302b3a;};}function handleError(_0x165fb3,_0x532c4d){_0x532c4d=_0x532c4d||0x1f4;return function(_0x3e69c5){logger['error'](_0x3e69c5[_0xff98('0x25')]);if(_0x3e69c5[_0xff98('0x26')]){delete _0x3e69c5['name'];}_0x165fb3[_0xff98('0x16')](_0x532c4d)['send'](_0x3e69c5);};}exports['index']=function(_0x41024c,_0x33ce91){var _0xf6d632={},_0x28893b={},_0x56fe4b={'count':0x0,'rows':[]};var _0x3a5a13=_['map'](db[_0xff98('0x27')]['rawAttributes'],function(_0x386cf1){return{'name':_0x386cf1['fieldName'],'type':_0x386cf1[_0xff98('0x28')][_0xff98('0x29')]};});_0x28893b['model']=_[_0xff98('0x2a')](_0x3a5a13,_0xff98('0x26'));_0x28893b[_0xff98('0x2b')]=_[_0xff98('0x2c')](_0x41024c['query']);_0x28893b[_0xff98('0x2d')]=_[_0xff98('0x2e')](_0x28893b[_0xff98('0x2f')],_0x28893b['query']);_0xf6d632[_0xff98('0x30')]=_['intersection'](_0x28893b[_0xff98('0x2f')],qs['fields'](_0x41024c[_0xff98('0x2b')]['fields']));_0xf6d632[_0xff98('0x30')]=_0xf6d632[_0xff98('0x30')][_0xff98('0x31')]?_0xf6d632[_0xff98('0x30')]:_0x28893b[_0xff98('0x2f')];if(!_0x41024c[_0xff98('0x2b')][_0xff98('0x32')](_0xff98('0x33'))){_0xf6d632['limit']=qs[_0xff98('0x1b')](_0x41024c[_0xff98('0x2b')][_0xff98('0x1b')]);_0xf6d632[_0xff98('0x1a')]=qs[_0xff98('0x1a')](_0x41024c[_0xff98('0x2b')][_0xff98('0x1a')]);}_0xf6d632['order']=qs[_0xff98('0x34')](_0x41024c[_0xff98('0x2b')][_0xff98('0x34')]);_0xf6d632[_0xff98('0x35')]=qs[_0xff98('0x2d')](_[_0xff98('0x36')](_0x41024c[_0xff98('0x2b')],_0x28893b['filters']));if(_0x41024c[_0xff98('0x2b')][_0xff98('0x37')]){_0xf6d632[_0xff98('0x35')]=_['merge'](_0xf6d632[_0xff98('0x35')],{'$or':_[_0xff98('0x2a')](_0x3a5a13,function(_0x1d5dd2){if(_0x1d5dd2[_0xff98('0x28')]!==_0xff98('0x38')){var _0x594300={};_0x594300[_0x1d5dd2['name']]={'$like':'%'+_0x41024c[_0xff98('0x2b')][_0xff98('0x37')]+'%'};return _0x594300;}})});}_0xf6d632=_['merge']({},_0xf6d632,_0x41024c[_0xff98('0x39')]);var _0x22bdfe={'where':_0xf6d632[_0xff98('0x35')]};return db[_0xff98('0x27')]['count'](_0x22bdfe)[_0xff98('0x21')](function(_0x47f56a){_0x56fe4b[_0xff98('0x19')]=_0x47f56a;if(_0x41024c[_0xff98('0x2b')]['includeAll']){_0xf6d632[_0xff98('0x3a')]=[{'all':!![]}];}return db[_0xff98('0x27')][_0xff98('0x3b')](_0xf6d632);})[_0xff98('0x21')](function(_0x49bf4f){_0x56fe4b[_0xff98('0x3c')]=_0x49bf4f;return _0x56fe4b;})[_0xff98('0x21')](respondWithFilteredResult(_0x33ce91,_0xf6d632))['catch'](handleError(_0x33ce91,null));};exports['show']=function(_0x1e7084,_0x3bf156){var _0xaeb6a6={'raw':![],'where':{'id':_0x1e7084[_0xff98('0x3d')]['id']}},_0x216617={};_0x216617['model']=_[_0xff98('0x2c')](db['VoiceMusicOnHold']['rawAttributes']);_0x216617[_0xff98('0x2b')]=_['keys'](_0x1e7084[_0xff98('0x2b')]);_0x216617[_0xff98('0x2d')]=_[_0xff98('0x2e')](_0x216617['model'],_0x216617[_0xff98('0x2b')]);_0xaeb6a6[_0xff98('0x30')]=_[_0xff98('0x2e')](_0x216617[_0xff98('0x2f')],qs[_0xff98('0x3e')](_0x1e7084[_0xff98('0x2b')]['fields']));_0xaeb6a6[_0xff98('0x30')]=_0xaeb6a6['attributes']['length']?_0xaeb6a6['attributes']:_0x216617[_0xff98('0x2f')];if(_0x1e7084['query']['includeAll']){_0xaeb6a6[_0xff98('0x3a')]=[{'all':!![]}];}_0xaeb6a6=_[_0xff98('0x3f')]({},_0xaeb6a6,_0x1e7084[_0xff98('0x39')]);return db['VoiceMusicOnHold'][_0xff98('0x40')](_0xaeb6a6)[_0xff98('0x21')](handleEntityNotFound(_0x3bf156,null))[_0xff98('0x21')](respondWithResult(_0x3bf156,null))['catch'](handleError(_0x3bf156,null));};exports[_0xff98('0x20')]=function(_0x2206b8,_0x347bb6){if(_0x2206b8[_0xff98('0x41')]['id']){delete _0x2206b8[_0xff98('0x41')]['id'];}return db[_0xff98('0x27')]['find']({'where':{'id':_0x2206b8[_0xff98('0x3d')]['id']}})[_0xff98('0x21')](handleEntityNotFound(_0x347bb6,null))[_0xff98('0x21')](saveUpdates(_0x2206b8['body'],null))['then'](respondWithResult(_0x347bb6,null))[_0xff98('0x42')](handleError(_0x347bb6,null));};exports[_0xff98('0x43')]=function(_0x1277aa,_0x313bbc,_0x11bb71){return db[_0xff98('0x44')][_0xff98('0x45')](function(_0x96a22){if(_0x1277aa[_0xff98('0x41')]['mode']==='files'){_0x1277aa[_0xff98('0x41')]['directory']=path['join'](config[_0xff98('0x46')],'server/files/moh',_0x1277aa[_0xff98('0x41')][_0xff98('0x26')]);}return db['VoiceMusicOnHold'][_0xff98('0x43')](_0x1277aa[_0xff98('0x41')],{'transaction':_0x96a22})['then'](function(_0x430925){if(_0x1277aa[_0xff98('0x41')][_0xff98('0x47')]===_0xff98('0x48')){fs['mkdirSync'](_0x430925[_0xff98('0x49')],parseInt('0777',0x8));}var _0x4639b0=_0x1277aa[_0xff98('0x4a')]['get']({'plain':!![]});if(!_0x4639b0)throw new Error(_0xff98('0x4b'));if(_0x4639b0[_0xff98('0x4c')]==='user'){var _0x2d523c=_0x430925[_0xff98('0x22')]({'plain':!![]});return db[_0xff98('0x4d')][_0xff98('0x40')]({'where':{'name':_0xff98('0x23'),'userProfileId':_0x4639b0[_0xff98('0x4e')]},'raw':!![]})['then'](function(_0x165ea6){if(_0x165ea6&&_0x165ea6['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x2d523c[_0xff98('0x26')],'resourceId':_0x2d523c['id'],'type':_0x165ea6['name'],'sectionId':_0x165ea6['id']},{})['then'](function(){return _0x430925;});}else{return _0x430925;}})[_0xff98('0x42')](function(_0x1dab6a){logger[_0xff98('0x4f')](_0xff98('0x50'),_0x1dab6a);});}return _0x430925;});})[_0xff98('0x21')](respondWithResult(_0x313bbc,0xc9))[_0xff98('0x42')](handleError(_0x313bbc,null));};exports['destroy']=function(_0xfe22b7,_0x594c85,_0x4feb1d){var _0xc128fa;return db[_0xff98('0x27')]['find']({'where':{'id':_0xfe22b7[_0xff98('0x3d')]['id']}})[_0xff98('0x21')](function(_0x45ca3f){if(_0x45ca3f){return db['sequelize'][_0xff98('0x45')](function(_0x2bd3aa){return _0x45ca3f[_0xff98('0x24')]({'transaction':_0x2bd3aa,'raw':!![]})[_0xff98('0x21')](function(_0x4d01aa){if(_0x4d01aa['directory']){fs[_0xff98('0x51')](_0x4d01aa[_0xff98('0x49')])[_0xff98('0x52')](function(_0x4ba039){fs[_0xff98('0x53')](path[_0xff98('0x54')](_0x4d01aa['directory'],_0x4ba039));});fs[_0xff98('0x55')](_0x4d01aa['directory']);}return _0x4d01aa;});})[_0xff98('0x42')](function(_0x179737){throw new db[(_0xff98('0x56'))][(_0xff98('0x57'))](_0x179737[_0xff98('0x58')]);});}})[_0xff98('0x21')](handleEntityNotFound(_0x594c85,null))[_0xff98('0x21')](removeEntity(_0x594c85,null))[_0xff98('0x42')](handleError(_0x594c85,null));};exports[_0xff98('0x59')]=function(_0x3cb427,_0x50f47c,_0x21dbed){return db[_0xff98('0x44')]['transaction'](function(_0x48f260){var _0x4fc2a2;return db[_0xff98('0x27')][_0xff98('0x40')]({'where':{'id':_0x3cb427[_0xff98('0x3d')]['id']}})[_0xff98('0x21')](function(_0x47eb60){if(_0x47eb60){_0x4fc2a2=_0x47eb60;return _0x47eb60[_0xff98('0x59')](_0x3cb427['body']['id'],{'transaction':_0x48f260});}})[_0xff98('0x21')](function(_0x58b760){if(_0x58b760){return db[_0xff98('0x5a')][_0xff98('0x5b')]({'where':{'id':_0x3cb427[_0xff98('0x41')]['id']},'attributes':['id',_0xff98('0x26'),_0xff98('0x5c'),_0xff98('0x5d'),_0xff98('0x5e')],'raw':!![]});}})[_0xff98('0x21')](function(_0x472d0d){if(_0x472d0d){var _0x263b7c=path[_0xff98('0x54')](config[_0xff98('0x46')],_0xff98('0x5f'),util[_0xff98('0x60')](_0xff98('0x61'),path[_0xff98('0x62')](_0x472d0d[_0xff98('0x5c')],path['extname'](_0x472d0d[_0xff98('0x5c')])),_0x472d0d['converted_format']));var _0x314cd8=path[_0xff98('0x54')](config[_0xff98('0x46')],_0xff98('0x63'),_0x4fc2a2[_0xff98('0x26')],util['format']('%s.%s',_0x472d0d['name'],_0x472d0d[_0xff98('0x5d')]));fs[_0xff98('0x64')](_0x263b7c,_0x314cd8);return _0x472d0d;}})[_0xff98('0x42')](function(_0x57663a){throw new db[(_0xff98('0x56'))][(_0xff98('0x57'))](_0x57663a['message']);});})[_0xff98('0x21')](handleEntityNotFound(_0x50f47c,null))[_0xff98('0x21')](respondWithResult(_0x50f47c,0xc9))['catch'](handleError(_0x50f47c,null));};exports[_0xff98('0x65')]=function(_0x29b470,_0x47a704,_0x5725e3){return db[_0xff98('0x44')][_0xff98('0x45')](function(_0x2bd7e1){var _0x7a1598;return db[_0xff98('0x27')][_0xff98('0x5b')]({'where':{'id':_0x29b470[_0xff98('0x3d')]['id']}})[_0xff98('0x21')](handleEntityNotFound(_0x47a704,null))[_0xff98('0x21')](function(_0x203b15){if(_0x203b15){_0x7a1598=_0x203b15;return _0x203b15['removeSound'](_0x29b470[_0xff98('0x3d')][_0xff98('0x66')]);}})['then'](function(_0x12814c){if(_0x12814c){return db[_0xff98('0x5a')][_0xff98('0x5b')]({'where':{'id':_0x29b470[_0xff98('0x3d')]['id2']},'attributes':['id',_0xff98('0x26'),'save_name','converted_format','createdAt'],'raw':!![]});}})['then'](function(_0x539e38){if(_0x539e38){fs[_0xff98('0x53')](path[_0xff98('0x54')](_0x7a1598[_0xff98('0x49')],util[_0xff98('0x60')]('%s.%s',_0x539e38[_0xff98('0x26')],_0x539e38[_0xff98('0x5d')])));return _0x539e38;}})[_0xff98('0x42')](function(_0x5b45f9){throw new db['Sequelize'][(_0xff98('0x57'))](_0x5b45f9[_0xff98('0x58')]);});})[_0xff98('0x21')](handleEntityNotFound(_0x47a704,null))[_0xff98('0x21')](respondWithStatusCode(_0x47a704,0xcc))[_0xff98('0x42')](handleError(_0x47a704,null));};exports[_0xff98('0x67')]=function(_0x16a39f,_0x12de96,_0x1356c3){var _0x481b43={};var _0x3fd9eb={};var _0x5fb593;var _0x3fc6c8;return db['VoiceMusicOnHold'][_0xff98('0x5b')]({'where':{'id':_0x16a39f[_0xff98('0x3d')]['id']}})[_0xff98('0x21')](handleEntityNotFound(_0x12de96,null))['then'](function(_0x37364c){if(_0x37364c){_0x5fb593=_0x37364c;_0x3fd9eb['model']=_[_0xff98('0x2c')](db[_0xff98('0x5a')][_0xff98('0x68')]);_0x3fd9eb[_0xff98('0x2b')]=_[_0xff98('0x2c')](_0x16a39f['query']);_0x3fd9eb[_0xff98('0x2d')]=_['intersection'](_0x3fd9eb[_0xff98('0x2f')],_0x3fd9eb[_0xff98('0x2b')]);_0x481b43['attributes']=_['intersection'](_0x3fd9eb[_0xff98('0x2f')],qs[_0xff98('0x3e')](_0x16a39f[_0xff98('0x2b')][_0xff98('0x3e')]));_0x481b43[_0xff98('0x30')]=_0x481b43['attributes'][_0xff98('0x31')]?_0x481b43['attributes']:_0x3fd9eb[_0xff98('0x2f')];_0x481b43[_0xff98('0x69')]=qs[_0xff98('0x34')](_0x16a39f[_0xff98('0x2b')][_0xff98('0x34')]);_0x481b43['where']=qs[_0xff98('0x2d')](_[_0xff98('0x36')](_0x16a39f[_0xff98('0x2b')],_0x3fd9eb[_0xff98('0x2d')]));if(_0x16a39f[_0xff98('0x2b')][_0xff98('0x37')]){_0x481b43[_0xff98('0x35')]=_[_0xff98('0x3f')](_0x481b43[_0xff98('0x35')],{'$or':_[_0xff98('0x2a')](_0x481b43[_0xff98('0x30')],function(_0x29d4ea){var _0x1991ca={};_0x1991ca[_0x29d4ea]={'$like':'%'+_0x16a39f[_0xff98('0x2b')][_0xff98('0x37')]+'%'};return _0x1991ca;})});}_0x481b43=_[_0xff98('0x3f')]({},_0x481b43,_0x16a39f[_0xff98('0x39')]);return _0x5fb593[_0xff98('0x67')](_0x481b43);}})['then'](function(_0xb41dba){if(_0xb41dba){_0x3fc6c8=_0xb41dba[_0xff98('0x31')];if(!_0x16a39f['query'][_0xff98('0x32')](_0xff98('0x33'))){_0x481b43[_0xff98('0x1b')]=qs[_0xff98('0x1b')](_0x16a39f[_0xff98('0x2b')]['limit']);_0x481b43['offset']=qs[_0xff98('0x1a')](_0x16a39f[_0xff98('0x2b')][_0xff98('0x1a')]);}return _0x5fb593[_0xff98('0x67')](_0x481b43);}})['then'](function(_0x405e94){if(_0x405e94){return _0x405e94?{'count':_0x3fc6c8,'rows':_0x405e94}:null;}})[_0xff98('0x21')](respondWithResult(_0x12de96,null))[_0xff98('0x42')](handleError(_0x12de96,null));}; \ No newline at end of file +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 diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index d8dd676..c8d7aca 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 _0x1b96=['VoiceMusicOnHold','voice_musiconhold','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceMusicOnHold.attributes','exports','define'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x1b96,0x9e));var _0x61b9=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x1b96[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require(_0x61b9('0x0'));var logger=require(_0x61b9('0x1'))(_0x61b9('0x2'));var moment=require(_0x61b9('0x3'));var BPromise=require(_0x61b9('0x4'));var rp=require(_0x61b9('0x5'));var fs=require('fs');var path=require(_0x61b9('0x6'));var rimraf=require('rimraf');var config=require(_0x61b9('0x7'));var attributes=require(_0x61b9('0x8'));module[_0x61b9('0x9')]=function(_0x94a09c,_0x7d58bf){return _0x94a09c[_0x61b9('0xa')](_0x61b9('0xb'),attributes,{'tableName':_0x61b9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 22fb14f..30e9ec9 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 _0x1441=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0xbc2e35,_0x54ba2d){var _0x46a9c0=function(_0x4c519){while(--_0x4c519){_0xbc2e35['push'](_0xbc2e35['shift']());}};_0x46a9c0(++_0x54ba2d);}(_0x1441,0x1b2));var _0x1144=function(_0x36cd93,_0x593481){_0x36cd93=_0x36cd93-0x0;var _0x10f6cd=_0x1441[_0x36cd93];return _0x10f6cd;};'use strict';var _=require(_0x1144('0x0'));var util=require(_0x1144('0x1'));var moment=require(_0x1144('0x2'));var BPromise=require(_0x1144('0x3'));var rs=require(_0x1144('0x4'));var fs=require('fs');var Redis=require(_0x1144('0x5'));var db=require(_0x1144('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1144('0x7'))('rpc');var config=require(_0x1144('0x8'));var jayson=require(_0x1144('0x9'));var client=jayson[_0x1144('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a90dc,_0x30c54a,_0x2650a4){return new BPromise(function(_0x418e67,_0xad1f23){return client['request'](_0x1a90dc,_0x2650a4)['then'](function(_0x48f114){logger[_0x1144('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x30c54a,'request\x20sent');logger[_0x1144('0xc')](_0x1144('0xd'),_0x30c54a,_0x1144('0xe'),JSON[_0x1144('0xf')](_0x48f114));if(_0x48f114[_0x1144('0x10')]){if(_0x48f114[_0x1144('0x10')][_0x1144('0x11')]===0x1f4){logger['error'](_0x1144('0x12'),_0x30c54a,_0x48f114['error'][_0x1144('0x13')]);return _0xad1f23(_0x48f114[_0x1144('0x10')][_0x1144('0x13')]);}logger[_0x1144('0x10')](_0x1144('0x12'),_0x30c54a,_0x48f114[_0x1144('0x10')][_0x1144('0x13')]);return _0x418e67(_0x48f114[_0x1144('0x10')]['message']);}else{logger[_0x1144('0xb')](_0x1144('0x12'),_0x30c54a,'request\x20sent');_0x418e67(_0x48f114[_0x1144('0x14')][_0x1144('0x13')]);}})[_0x1144('0x15')](function(_0x40f28d){logger[_0x1144('0x10')](_0x1144('0x12'),_0x30c54a,_0x40f28d);_0xad1f23(_0x40f28d);});});} \ No newline at end of file +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 diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 3122761..8181495 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 _0x84f7=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/:id','show','post','create','/:id/users','addAgents','put','update','delete','destroy','exports','multer','path','express'];(function(_0x305e18,_0x5adc08){var _0xb3fd41=function(_0x1e7556){while(--_0x1e7556){_0x305e18['push'](_0x305e18['shift']());}};_0xb3fd41(++_0x5adc08);}(_0x84f7,0x1e0));var _0x784f=function(_0x59162a,_0x10e547){_0x59162a=_0x59162a-0x0;var _0x35e50d=_0x84f7[_0x59162a];return _0x35e50d;};'use strict';var multer=require(_0x784f('0x0'));var util=require('util');var path=require(_0x784f('0x1'));var timeout=require('connect-timeout');var express=require(_0x784f('0x2'));var router=express['Router']();var auth=require(_0x784f('0x3'));var interaction=require(_0x784f('0x4'));var config=require(_0x784f('0x5'));var controller=require(_0x784f('0x6'));router[_0x784f('0x7')]('/',auth[_0x784f('0x8')](),controller[_0x784f('0x9')]);router[_0x784f('0x7')]('/describe',auth[_0x784f('0x8')](),controller['describe']);router[_0x784f('0x7')](_0x784f('0xa'),auth['isAuthenticated'](),controller[_0x784f('0xb')]);router['get']('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x784f('0xc')]('/',auth[_0x784f('0x8')](),controller[_0x784f('0xd')]);router[_0x784f('0xc')](_0x784f('0xe'),auth[_0x784f('0x8')](),controller[_0x784f('0xf')]);router[_0x784f('0x10')](_0x784f('0xa'),auth[_0x784f('0x8')](),controller[_0x784f('0x11')]);router[_0x784f('0x12')](_0x784f('0xa'),auth[_0x784f('0x8')](),controller[_0x784f('0x13')]);router['delete'](_0x784f('0xe'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x784f('0x14')]=router; \ No newline at end of file +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 diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 595e47f..b086252 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 _0x15ad=['sequelize','name','VIRTUAL','system-','getDataValue','STRING','INTEGER'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x15ad,0x1c7));var _0xd15a=function(_0x146c07,_0x453deb){_0x146c07=_0x146c07-0x0;var _0x5b5a99=_0x15ad[_0x146c07];return _0x5b5a99;};'use strict';var Sequelize=require(_0xd15a('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd15a('0x1')},'prefix':{'type':Sequelize[_0xd15a('0x2')],'get':function(_0x5381b4){return _0xd15a('0x3')+this[_0xd15a('0x4')](_0xd15a('0x1'))+'-';}},'description':{'type':Sequelize[_0xd15a('0x5')]},'callerIdAll':{'type':Sequelize[_0xd15a('0x5')]},'VoiceExtensionId':{'type':Sequelize[_0xd15a('0x6')]}}; \ No newline at end of file +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 diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index ebd7481..a5a9292 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 _0x92d1=['ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','User','filter','getAgents','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','model','keys','intersection','fields','query','attributes','length','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','options','VoicePrefix','includeAll','include','findAll','rows','show','params','catch','destroy','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','UserProfileSection','VoicePrefixes','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','system','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','push','callerIdAll','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','charAt','system-','find','addAgents','omit'];(function(_0x3226d3,_0x27e1c6){var _0x27fd7f=function(_0x27896b){while(--_0x27896b){_0x3226d3['push'](_0x3226d3['shift']());}};_0x27fd7f(++_0x27e1c6);}(_0x92d1,0xff));var _0x192d=function(_0x7b78b3,_0x272bb0){_0x7b78b3=_0x7b78b3-0x0;var _0xcecaf9=_0x92d1[_0x7b78b3];return _0xcecaf9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x192d('0x0'));var rimraf=require(_0x192d('0x1'));var zipdir=require(_0x192d('0x2'));var jsonpatch=require(_0x192d('0x3'));var rp=require(_0x192d('0x4'));var moment=require('moment');var BPromise=require(_0x192d('0x5'));var Mustache=require(_0x192d('0x6'));var util=require(_0x192d('0x7'));var path=require(_0x192d('0x8'));var sox=require(_0x192d('0x9'));var csv=require('to-csv');var ejs=require(_0x192d('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x192d('0xb'));var crypto=require('crypto');var jsforce=require(_0x192d('0xc'));var deskjs=require(_0x192d('0xd'));var toCsv=require(_0x192d('0xe'));var querystring=require('querystring');var Papa=require(_0x192d('0xf'));var Redis=require('ioredis');var authService=require(_0x192d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x192d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x192d('0x12'))(_0x192d('0x13'));var utils=require(_0x192d('0x14'));var config=require(_0x192d('0x15'));var db=require('../../mysqldb')['db'];config[_0x192d('0x16')]=_[_0x192d('0x17')](config[_0x192d('0x16')],{'host':_0x192d('0x18'),'port':0x18eb});var socket=require(_0x192d('0x19'))(new Redis(config[_0x192d('0x16')]));require(_0x192d('0x1a'))[_0x192d('0x1b')](socket);function respondWithStatusCode(_0x3d2690,_0x2e26cd){_0x2e26cd=_0x2e26cd||0xcc;return function(_0x4afd21){if(_0x4afd21){return _0x3d2690[_0x192d('0x1c')](_0x2e26cd);}return _0x3d2690[_0x192d('0x1d')](_0x2e26cd)[_0x192d('0x1e')]();};}function respondWithResult(_0x5cc63a,_0x232a72){_0x232a72=_0x232a72||0xc8;return function(_0x46e1f7){if(_0x46e1f7){return _0x5cc63a[_0x192d('0x1d')](_0x232a72)[_0x192d('0x1f')](_0x46e1f7);}};}function respondWithFilteredResult(_0x29b77e,_0x32c188){return function(_0x368ef0){if(_0x368ef0){var _0x130ae5=_0x368ef0[_0x192d('0x20')],_0x459fb5=_0x32c188[_0x192d('0x21')],_0x20af19=_0x32c188['offset']+_0x32c188[_0x192d('0x22')],_0x159923;if(_0x20af19>=_0x130ae5){_0x20af19=_0x130ae5;_0x159923=0xc8;}else{_0x159923=0xce;}_0x29b77e[_0x192d('0x1d')](_0x159923);return _0x29b77e[_0x192d('0x23')](_0x192d('0x24'),_0x459fb5+'-'+_0x20af19+'/'+_0x130ae5)[_0x192d('0x1f')](_0x368ef0);}return null;};}function patchUpdates(_0x2d4b3d){return function(_0x2eab67){try{jsonpatch[_0x192d('0x25')](_0x2eab67,_0x2d4b3d,!![]);}catch(_0x3790eb){return BPromise[_0x192d('0x26')](_0x3790eb);}return _0x2eab67[_0x192d('0x27')]();};}function saveUpdates(_0x449eee,_0x3e1930){return function(_0x46d8bb){if(_0x46d8bb){return _0x46d8bb[_0x192d('0x28')](_0x449eee)['then'](function(_0x5194d2){return _0x5194d2;});}return null;};}function removeEntity(_0x5249b5,_0x5256c3){return function(_0x2a9455){if(_0x2a9455){return _0x2a9455['destroy']()[_0x192d('0x29')](function(){var _0x3bf03d=_0x2a9455[_0x192d('0x2a')]({'plain':!![]});var _0x1bd7be='VoicePrefixes';return db[_0x192d('0x2b')]['destroy']({'where':{'type':_0x1bd7be,'resourceId':_0x3bf03d['id']}})[_0x192d('0x29')](function(){return _0x2a9455;});})[_0x192d('0x29')](function(){_0x5249b5[_0x192d('0x1d')](0xcc)[_0x192d('0x1e')]();});}};}function handleEntityNotFound(_0x3f6032,_0x1b2eb1){return function(_0x3ea31e){if(!_0x3ea31e){_0x3f6032[_0x192d('0x1c')](0x194);}return _0x3ea31e;};}function handleError(_0x4e36e2,_0x44469a){_0x44469a=_0x44469a||0x1f4;return function(_0xc500be){logger['error'](_0xc500be[_0x192d('0x2c')]);if(_0xc500be[_0x192d('0x2d')]){delete _0xc500be[_0x192d('0x2d')];}_0x4e36e2['status'](_0x44469a)[_0x192d('0x2e')](_0xc500be);};}exports[_0x192d('0x2f')]=function(_0x75c17b,_0x423877){var _0x26428c={},_0x286ee6={},_0xb82197={'count':0x0,'rows':[]};var _0x25d5a8=_[_0x192d('0x30')](db['VoicePrefix'][_0x192d('0x31')],function(_0x308503){return{'name':_0x308503[_0x192d('0x32')],'type':_0x308503['type']['key']};});_0x286ee6[_0x192d('0x33')]=_[_0x192d('0x30')](_0x25d5a8,_0x192d('0x2d'));_0x286ee6['query']=_[_0x192d('0x34')](_0x75c17b['query']);_0x286ee6['filters']=_['intersection'](_0x286ee6[_0x192d('0x33')],_0x286ee6['query']);_0x26428c['attributes']=_[_0x192d('0x35')](_0x286ee6[_0x192d('0x33')],qs[_0x192d('0x36')](_0x75c17b[_0x192d('0x37')][_0x192d('0x36')]));_0x26428c[_0x192d('0x38')]=_0x26428c[_0x192d('0x38')][_0x192d('0x39')]?_0x26428c[_0x192d('0x38')]:_0x286ee6[_0x192d('0x33')];if(!_0x75c17b[_0x192d('0x37')]['hasOwnProperty'](_0x192d('0x3a'))){_0x26428c[_0x192d('0x22')]=qs[_0x192d('0x22')](_0x75c17b[_0x192d('0x37')]['limit']);_0x26428c[_0x192d('0x21')]=qs['offset'](_0x75c17b[_0x192d('0x37')][_0x192d('0x21')]);}_0x26428c[_0x192d('0x3b')]=qs[_0x192d('0x3c')](_0x75c17b[_0x192d('0x37')][_0x192d('0x3c')]);_0x26428c[_0x192d('0x3d')]=qs[_0x192d('0x3e')](_[_0x192d('0x3f')](_0x75c17b[_0x192d('0x37')],_0x286ee6[_0x192d('0x3e')]));if(_0x75c17b[_0x192d('0x37')]['filter']){_0x26428c['where']=_[_0x192d('0x40')](_0x26428c[_0x192d('0x3d')],{'$or':_[_0x192d('0x30')](_0x25d5a8,function(_0x2b76b5){if(_0x2b76b5[_0x192d('0x41')]!==_0x192d('0x42')){var _0x387230={};_0x387230[_0x2b76b5[_0x192d('0x2d')]]={'$like':'%'+_0x75c17b[_0x192d('0x37')]['filter']+'%'};return _0x387230;}})});}_0x26428c=_[_0x192d('0x40')]({},_0x26428c,_0x75c17b[_0x192d('0x43')]);var _0x538b92={'where':_0x26428c['where']};return db[_0x192d('0x44')][_0x192d('0x20')](_0x538b92)[_0x192d('0x29')](function(_0x39385e){_0xb82197[_0x192d('0x20')]=_0x39385e;if(_0x75c17b[_0x192d('0x37')][_0x192d('0x45')]){_0x26428c[_0x192d('0x46')]=[{'all':!![]}];}return db[_0x192d('0x44')][_0x192d('0x47')](_0x26428c);})[_0x192d('0x29')](function(_0x47bb4f){_0xb82197[_0x192d('0x48')]=_0x47bb4f;return _0xb82197;})['then'](respondWithFilteredResult(_0x423877,_0x26428c))['catch'](handleError(_0x423877,null));};exports[_0x192d('0x49')]=function(_0x20febf,_0x4cae15){var _0x3e264e={'raw':![],'where':{'id':_0x20febf[_0x192d('0x4a')]['id']}},_0x4acab7={};_0x4acab7[_0x192d('0x33')]=_[_0x192d('0x34')](db[_0x192d('0x44')][_0x192d('0x31')]);_0x4acab7[_0x192d('0x37')]=_[_0x192d('0x34')](_0x20febf['query']);_0x4acab7[_0x192d('0x3e')]=_[_0x192d('0x35')](_0x4acab7[_0x192d('0x33')],_0x4acab7[_0x192d('0x37')]);_0x3e264e[_0x192d('0x38')]=_['intersection'](_0x4acab7[_0x192d('0x33')],qs[_0x192d('0x36')](_0x20febf[_0x192d('0x37')][_0x192d('0x36')]));_0x3e264e[_0x192d('0x38')]=_0x3e264e[_0x192d('0x38')][_0x192d('0x39')]?_0x3e264e[_0x192d('0x38')]:_0x4acab7['model'];if(_0x20febf[_0x192d('0x37')]['includeAll']){_0x3e264e['include']=[{'all':!![]}];}_0x3e264e=_[_0x192d('0x40')]({},_0x3e264e,_0x20febf[_0x192d('0x43')]);return db[_0x192d('0x44')]['find'](_0x3e264e)[_0x192d('0x29')](handleEntityNotFound(_0x4cae15,null))[_0x192d('0x29')](respondWithResult(_0x4cae15,null))[_0x192d('0x4b')](handleError(_0x4cae15,null));};exports[_0x192d('0x4c')]=function(_0x166f55,_0x342851){return db[_0x192d('0x44')]['find']({'where':{'id':_0x166f55['params']['id']}})[_0x192d('0x29')](handleEntityNotFound(_0x342851,null))['then'](removeEntity(_0x342851,null))[_0x192d('0x4b')](handleError(_0x342851,null));};exports[_0x192d('0x4d')]=function(_0x520dbe,_0x568e9c){return db['VoicePrefix'][_0x192d('0x4d')]()[_0x192d('0x29')](respondWithResult(_0x568e9c,null))[_0x192d('0x4b')](handleError(_0x568e9c,null));};exports[_0x192d('0x4e')]=function(_0x2d07e6,_0x338055){var _0x4a5bc7;return db[_0x192d('0x4f')][_0x192d('0x50')](function(_0x33d9c5){return db[_0x192d('0x44')]['create'](_0x2d07e6[_0x192d('0x51')],{'transaction':_0x33d9c5})[_0x192d('0x29')](function(_0x1b8d7b){_0x4a5bc7=_0x1b8d7b[_0x192d('0x2a')]({'plain':!![]});return db[_0x192d('0x52')]['find']({'where':{'id':_0x4a5bc7[_0x192d('0x53')]},'raw':!![]})[_0x192d('0x29')](function(_0x5cc560){return createVoicePrefixExtensions(_0x4a5bc7,_0x5cc560,_0x33d9c5);});});})[_0x192d('0x29')](function(){var _0x13c4a3=_0x2d07e6[_0x192d('0x54')][_0x192d('0x2a')]({'plain':!![]});if(!_0x13c4a3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x13c4a3['role']===_0x192d('0x54')){var _0x1b4b9b=_0x4a5bc7;return db[_0x192d('0x55')]['find']({'where':{'name':_0x192d('0x56'),'userProfileId':_0x13c4a3['userProfileId']},'raw':!![]})[_0x192d('0x29')](function(_0xcf5a28){if(_0xcf5a28&&_0xcf5a28[_0x192d('0x57')]===0x0){return db[_0x192d('0x2b')]['create']({'name':_0x1b4b9b[_0x192d('0x2d')],'resourceId':_0x1b4b9b['id'],'type':_0xcf5a28['name'],'sectionId':_0xcf5a28['id']},{})[_0x192d('0x29')](function(){return _0x4a5bc7;});}else{return _0x4a5bc7;}})[_0x192d('0x4b')](function(_0x4dad11){logger[_0x192d('0x58')](_0x192d('0x59'),_0x4dad11);throw _0x4dad11;});}return _0x4a5bc7;})['then'](respondWithResult(_0x338055,null))[_0x192d('0x4b')](handleError(_0x338055,null));};function Extension(_0x2d383d,_0x1dd476,_0x39efc6,_0x307c0d){this[_0x192d('0x5a')]=_0x192d('0x5b');this[_0x192d('0x5c')]=_0x2d383d;this['app']=_0x39efc6;this[_0x192d('0x41')]=_0x192d('0x5d');this['description']='Voice\x20Prefix\x20Extension';this[_0x192d('0x5e')]=_0x1dd476;this[_0x192d('0x5f')]=_0x307c0d;}function createVoicePrefixExtensions(_0x543a6e,_0x1afd41,_0x375e0a){return new BPromise(function(_0xd523a3,_0x194f46){var _0x2cdb26=new Extension(formatPrefixName(_0x543a6e[_0x192d('0x60')]),0x1,_0x192d('0x61'),_0x192d('0x62'));_0x2cdb26[_0x192d('0x63')]=_0x543a6e['id'];return db['VoiceExtension'][_0x192d('0x4e')](_0x2cdb26,{'transaction':_0x375e0a})[_0x192d('0x29')](function(_0x2fc989){var _0x5d4e56=_0x2fc989['get']({'plain':!![]});var _0x1a0961=_['map'](addVoicePrefixExtensions(_0x543a6e,_0x1afd41),function(_0x287bdb){_0x287bdb[_0x192d('0x53')]=_0x5d4e56['id'];_0x287bdb[_0x192d('0x63')]=_0x543a6e['id'];return _0x287bdb;});return db['VoiceExtension'][_0x192d('0x64')](_0x1a0961,{'transaction':_0x375e0a})[_0x192d('0x29')](function(_0x225de6){if(!_0x225de6){return _0x194f46('Extensions\x20creation\x20failed');}else{return _0xd523a3(_0x225de6);}})[_0x192d('0x4b')](function(_0x3a1128){return _0x194f46(_0x3a1128);});});;});};function addVoicePrefixExtensions(_0x49083e,_0x44cf94){var _0x2cd662=[];var _0x3e47b7=formatPrefixName(_0x49083e[_0x192d('0x60')]);_0x2cd662[_0x192d('0x65')](new Extension(_0x3e47b7,0x2,'Set','CDR(prefix)='+_0x49083e[_0x192d('0x2d')]));if(_0x49083e[_0x192d('0x66')]){_0x2cd662[_0x192d('0x65')](new Extension(_0x3e47b7,0x3,_0x192d('0x67'),_0x192d('0x68')+_0x49083e[_0x192d('0x66')]));}else{_0x2cd662[_0x192d('0x65')](new Extension(_0x3e47b7,0x3,_0x192d('0x61'),_0x192d('0x69')));}_0x2cd662[_0x192d('0x65')](new Extension(_0x3e47b7,0x4,'goto',_0x44cf94[_0x192d('0x5a')]+','+'${EXTEN:'+(0x8+_0x49083e[_0x192d('0x2d')][_0x192d('0x39')])+'}'+','+0x1));return _0x2cd662;}function formatPrefixName(_0xd96f76){var _0x50d4c1='_';for(var _0x48448f=0x0;_0x48448f<_0xd96f76[_0x192d('0x39')];_0x48448f++){if(_0xd96f76['charAt'](_0x48448f)=='-'){_0x50d4c1+=_0xd96f76[_0x192d('0x6a')](_0x48448f);}else{_0x50d4c1+='['+_0xd96f76[_0x192d('0x6a')](_0x48448f)+']';}}_0x50d4c1+='.';return _0x50d4c1;}exports[_0x192d('0x28')]=function(_0x2bba0b,_0x4a53b3,_0x4963db){var _0x1f7eb4=_0x2bba0b['body'];_0x1f7eb4[_0x192d('0x60')]=_0x192d('0x6b')+_0x1f7eb4['name']+'-';return db['sequelize']['transaction'](function(_0x4b3b68){return db[_0x192d('0x44')][_0x192d('0x28')](_0x1f7eb4,{'where':{'id':_0x1f7eb4['id']},'transaction':_0x4b3b68})[_0x192d('0x29')](function(){return db[_0x192d('0x52')][_0x192d('0x4c')]({'where':{'VoicePrefixId':_0x1f7eb4['id']},'transaction':_0x4b3b68})[_0x192d('0x29')](function(){return db[_0x192d('0x52')][_0x192d('0x6c')]({'where':{'id':_0x1f7eb4[_0x192d('0x53')]},'raw':!![]})[_0x192d('0x29')](function(_0x201a03){return createVoicePrefixExtensions(_0x1f7eb4,_0x201a03,_0x4b3b68);});});});})['then'](function(){return db[_0x192d('0x44')]['findById'](_0x1f7eb4['id']);})[_0x192d('0x29')](respondWithResult(_0x4a53b3,null))[_0x192d('0x4b')](handleError(_0x4a53b3,null));};exports[_0x192d('0x6d')]=function(_0x2f8ade,_0x4699dd,_0x98b704){return db[_0x192d('0x44')]['find']({'where':{'id':_0x2f8ade['params']['id']}})[_0x192d('0x29')](handleEntityNotFound(_0x4699dd,null))[_0x192d('0x29')](function(_0x17657a){if(_0x17657a){return _0x17657a[_0x192d('0x6d')](_0x2f8ade[_0x192d('0x51')]['ids'],_[_0x192d('0x6e')](_0x2f8ade[_0x192d('0x51')],[_0x192d('0x6f'),'id'])||{})[_0x192d('0x70')](function(_0x180f62){for(var _0xc57d8d=0x0;_0xc57d8d<_0x2f8ade[_0x192d('0x51')][_0x192d('0x6f')]['length'];_0xc57d8d+=0x1){socket[_0x192d('0x71')](_0x192d('0x72'),{'UserId':_0x2f8ade['body'][_0x192d('0x6f')][_0xc57d8d],'VoicePrefixId':_0x2f8ade[_0x192d('0x4a')]['id']});}return _0x180f62;});}})[_0x192d('0x29')](respondWithResult(_0x4699dd,null))['catch'](handleError(_0x4699dd,null));};exports[_0x192d('0x73')]=function(_0x249d9a,_0x1a3daa,_0x2a059e){return db['VoicePrefix'][_0x192d('0x6c')]({'where':{'id':_0x249d9a[_0x192d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1a3daa,null))[_0x192d('0x29')](function(_0xf8cc2a){if(_0xf8cc2a){return _0xf8cc2a[_0x192d('0x73')](_0x249d9a[_0x192d('0x37')][_0x192d('0x6f')])[_0x192d('0x29')](function(){if(_[_0x192d('0x74')](_0x249d9a[_0x192d('0x37')][_0x192d('0x6f')])){for(var _0x3e4763=0x0;_0x3e4763<_0x249d9a[_0x192d('0x37')][_0x192d('0x6f')][_0x192d('0x39')];_0x3e4763+=0x1){socket[_0x192d('0x71')](_0x192d('0x75'),{'UserId':Number(_0x249d9a[_0x192d('0x37')][_0x192d('0x6f')][_0x3e4763]),'VoicePrefixId':Number(_0x249d9a[_0x192d('0x4a')]['id'])});}}else{socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x249d9a[_0x192d('0x37')][_0x192d('0x6f')]),'VoicePrefixId':Number(_0x249d9a[_0x192d('0x4a')]['id'])});}});}})[_0x192d('0x29')](respondWithStatusCode(_0x1a3daa,null))[_0x192d('0x4b')](handleError(_0x1a3daa,null));};exports['getAgents']=function(_0x4e615f,_0x6dd06c,_0x327c42){var _0x70f3a1={};var _0x55c98a={};var _0x3408b1;var _0x3d9c12;return db[_0x192d('0x44')]['findOne']({'where':{'id':_0x4e615f[_0x192d('0x4a')]['id']}})[_0x192d('0x29')](handleEntityNotFound(_0x6dd06c,null))[_0x192d('0x29')](function(_0x3a4ffb){if(_0x3a4ffb){_0x3408b1=_0x3a4ffb;_0x55c98a['model']=_['keys'](db[_0x192d('0x76')]['rawAttributes']);_0x55c98a['query']=_[_0x192d('0x34')](_0x4e615f[_0x192d('0x37')]);_0x55c98a[_0x192d('0x3e')]=_[_0x192d('0x35')](_0x55c98a['model'],_0x55c98a[_0x192d('0x37')]);_0x70f3a1[_0x192d('0x38')]=_[_0x192d('0x35')](_0x55c98a[_0x192d('0x33')],qs[_0x192d('0x36')](_0x4e615f['query'][_0x192d('0x36')]));_0x70f3a1[_0x192d('0x38')]=_0x70f3a1[_0x192d('0x38')]['length']?_0x70f3a1[_0x192d('0x38')]:_0x55c98a[_0x192d('0x33')];_0x70f3a1[_0x192d('0x3b')]=qs['sort'](_0x4e615f[_0x192d('0x37')][_0x192d('0x3c')]);_0x70f3a1[_0x192d('0x3d')]=qs['filters'](_[_0x192d('0x3f')](_0x4e615f['query'],_0x55c98a[_0x192d('0x3e')]));if(_0x4e615f[_0x192d('0x37')][_0x192d('0x77')]){_0x70f3a1[_0x192d('0x3d')]=_[_0x192d('0x40')](_0x70f3a1[_0x192d('0x3d')],{'$or':_[_0x192d('0x30')](_0x70f3a1['attributes'],function(_0x164754){var _0x5f1f2a={};_0x5f1f2a[_0x164754]={'$like':'%'+_0x4e615f[_0x192d('0x37')][_0x192d('0x77')]+'%'};return _0x5f1f2a;})});}_0x70f3a1=_[_0x192d('0x40')]({},_0x70f3a1,_0x4e615f[_0x192d('0x43')]);return _0x3408b1[_0x192d('0x78')](_0x70f3a1);}})[_0x192d('0x29')](function(_0x593828){if(_0x593828){_0x3d9c12=_0x593828[_0x192d('0x39')];if(!_0x4e615f[_0x192d('0x37')][_0x192d('0x79')](_0x192d('0x3a'))){_0x70f3a1[_0x192d('0x22')]=qs['limit'](_0x4e615f['query'][_0x192d('0x22')]);_0x70f3a1[_0x192d('0x21')]=qs['offset'](_0x4e615f[_0x192d('0x37')]['offset']);}return _0x3408b1['getAgents'](_0x70f3a1);}})[_0x192d('0x29')](function(_0x5ba626){if(_0x5ba626){return _0x5ba626?{'count':_0x3d9c12,'rows':_0x5ba626}:null;}})[_0x192d('0x29')](respondWithResult(_0x6dd06c,null))['catch'](handleError(_0x6dd06c,null));}; \ No newline at end of file +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 diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 8d7108f..3b1186a 100644 --- a/server/api/voicePrefix/voicePrefix.events.js +++ b/server/api/voicePrefix/voicePrefix.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xedd9,0xfc));var _0x9edd=function(_0x406338,_0x46465a){_0x406338=_0x406338-0x0;var _0x1c4f0f=_0xedd9[_0x406338];return _0x1c4f0f;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x9edd('0x0'))['db'][_0x9edd('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x9edd('0x2')](0x0);var events={'afterCreate':_0x9edd('0x3'),'afterUpdate':_0x9edd('0x4'),'afterDestroy':_0x9edd('0x5')};function emitEvent(_0x3e6d3a){return function(_0x36b53f,_0x5943b3,_0x33679f){VoicePrefixEvents[_0x9edd('0x6')](_0x3e6d3a+':'+_0x36b53f['id'],_0x36b53f);VoicePrefixEvents[_0x9edd('0x6')](_0x3e6d3a,_0x36b53f);_0x33679f(null);};}for(var e in events){if(events[_0x9edd('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x9edd('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _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 diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 7669018..3807c96 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 _0x91b7=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','VoicePrefix','lodash'];(function(_0x1daaa9,_0x220393){var _0x1dd221=function(_0x492c61){while(--_0x492c61){_0x1daaa9['push'](_0x1daaa9['shift']());}};_0x1dd221(++_0x220393);}(_0x91b7,0xcb));var _0x791b=function(_0xc415c7,_0x5239ce){_0xc415c7=_0xc415c7-0x0;var _0x2e3806=_0x91b7[_0xc415c7];return _0x2e3806;};'use strict';var _=require(_0x791b('0x0'));var util=require(_0x791b('0x1'));var logger=require(_0x791b('0x2'))(_0x791b('0x3'));var moment=require(_0x791b('0x4'));var BPromise=require(_0x791b('0x5'));var rp=require(_0x791b('0x6'));var fs=require('fs');var path=require(_0x791b('0x7'));var rimraf=require(_0x791b('0x8'));var config=require(_0x791b('0x9'));var attributes=require(_0x791b('0xa'));module['exports']=function(_0x3cca1e,_0x1d3c8f){return _0x3cca1e['define'](_0x791b('0xb'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index c664147..e7d8e4e 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 _0x6e71=['socket.io-emitter','./voicePrefix.socket','then','info','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','VoicePrefix,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost'];(function(_0x15b2b0,_0x4b1aa6){var _0x38974d=function(_0xfe2936){while(--_0xfe2936){_0x15b2b0['push'](_0x15b2b0['shift']());}};_0x38974d(++_0x4b1aa6);}(_0x6e71,0x1ac));var _0x16e7=function(_0xfd503f,_0x5d85dd){_0xfd503f=_0xfd503f-0x0;var _0x561c0e=_0x6e71[_0xfd503f];return _0x561c0e;};'use strict';var _=require(_0x16e7('0x0'));var util=require(_0x16e7('0x1'));var moment=require(_0x16e7('0x2'));var BPromise=require(_0x16e7('0x3'));var rs=require(_0x16e7('0x4'));var fs=require('fs');var Redis=require(_0x16e7('0x5'));var db=require(_0x16e7('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x16e7('0x7'));var config=require(_0x16e7('0x8'));var jayson=require(_0x16e7('0x9'));var client=jayson['client'][_0x16e7('0xa')]({'port':0x232a});config['redis']=_[_0x16e7('0xb')](config[_0x16e7('0xc')],{'host':_0x16e7('0xd'),'port':0x18eb});var socket=require(_0x16e7('0xe'))(new Redis(config['redis']));require(_0x16e7('0xf'))['register'](socket);function respondWithRpcPromise(_0x5981ae,_0x5f2113,_0x17c36d){return new BPromise(function(_0x24e3ee,_0x3c25bb){return client['request'](_0x5981ae,_0x17c36d)[_0x16e7('0x10')](function(_0x413b59){logger[_0x16e7('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x5f2113,_0x16e7('0x12'));logger[_0x16e7('0x13')](_0x16e7('0x14'),_0x5f2113,_0x16e7('0x12'),JSON[_0x16e7('0x15')](_0x413b59));if(_0x413b59[_0x16e7('0x16')]){if(_0x413b59['error']['code']===0x1f4){logger[_0x16e7('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x5f2113,_0x413b59[_0x16e7('0x16')][_0x16e7('0x17')]);return _0x3c25bb(_0x413b59[_0x16e7('0x16')][_0x16e7('0x17')]);}logger[_0x16e7('0x16')](_0x16e7('0x18'),_0x5f2113,_0x413b59[_0x16e7('0x16')][_0x16e7('0x17')]);return _0x24e3ee(_0x413b59[_0x16e7('0x16')]['message']);}else{logger[_0x16e7('0x11')](_0x16e7('0x18'),_0x5f2113,_0x16e7('0x12'));_0x24e3ee(_0x413b59[_0x16e7('0x19')]['message']);}})['catch'](function(_0x16383b){logger[_0x16e7('0x16')](_0x16e7('0x18'),_0x5f2113,_0x16383b);_0x3c25bb(_0x16383b);});});} \ No newline at end of file +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 diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 207a79d..5fa40f3 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 _0x5ac0=['removeListener','register','voicePrefix:','./voicePrefix.events','save','remove','update','emit'];(function(_0x5d5cd6,_0x2fd35f){var _0x38c18c=function(_0x5d297a){while(--_0x5d297a){_0x5d5cd6['push'](_0x5d5cd6['shift']());}};_0x38c18c(++_0x2fd35f);}(_0x5ac0,0x193));var _0x05ac=function(_0x16c408,_0x4a86ce){_0x16c408=_0x16c408-0x0;var _0x34a133=_0x5ac0[_0x16c408];return _0x34a133;};'use strict';var VoicePrefixEvents=require(_0x05ac('0x0'));var events=[_0x05ac('0x1'),_0x05ac('0x2'),_0x05ac('0x3')];function createListener(_0x329ed0,_0x546257){return function(_0x735c9a){_0x546257[_0x05ac('0x4')](_0x329ed0,_0x735c9a);};}function removeListener(_0x402507,_0x142425){return function(){VoicePrefixEvents[_0x05ac('0x5')](_0x402507,_0x142425);};}exports[_0x05ac('0x6')]=function(_0x3c1d8f){for(var _0x47564d=0x0,_0x47a258=events['length'];_0x47564d<_0x47a258;_0x47564d++){var _0x17817f=events[_0x47564d];var _0x3602a6=createListener(_0x05ac('0x7')+_0x17817f,_0x3c1d8f);VoicePrefixEvents['on'](_0x17817f,_0x3602a6);}}; \ No newline at end of file +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 diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 4eccf7b..c4393d2 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 _0x6950=['destroy','removeTeams','removeAgents','removeLists','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','isAuthenticated','show','get','getHoppers','/:id/hopper_histories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','getMembers','/:id/lists','/:id/blacklists','getBlackLists','create','post','/:id/clone','clone','addTeams','addAgents','addLists','addBlackLists','/:id','update','delete'];(function(_0x2eceb9,_0x109a9c){var _0x25febc=function(_0x365b2e){while(--_0x365b2e){_0x2eceb9['push'](_0x2eceb9['shift']());}};_0x25febc(++_0x109a9c);}(_0x6950,0x7c));var _0x0695=function(_0xee1896,_0x2fea4e){_0xee1896=_0xee1896-0x0;var _0x349efd=_0x6950[_0xee1896];return _0x349efd;};'use strict';var multer=require(_0x0695('0x0'));var util=require('util');var path=require(_0x0695('0x1'));var timeout=require(_0x0695('0x2'));var express=require(_0x0695('0x3'));var router=express[_0x0695('0x4')]();var auth=require(_0x0695('0x5'));var interaction=require(_0x0695('0x6'));var config=require(_0x0695('0x7'));var controller=require(_0x0695('0x8'));router['get']('/',auth[_0x0695('0x9')](),controller['index']);router['get']('/:id',auth[_0x0695('0x9')](),controller[_0x0695('0xa')]);router[_0x0695('0xb')]('/:id/hoppers',auth[_0x0695('0x9')](),controller[_0x0695('0xc')]);router[_0x0695('0xb')](_0x0695('0xd'),auth[_0x0695('0x9')](),controller['getHopperHistories']);router['get']('/:id/hopper_finals',auth[_0x0695('0x9')](),controller[_0x0695('0xe')]);router[_0x0695('0xb')](_0x0695('0xf'),auth[_0x0695('0x9')](),controller[_0x0695('0x10')]);router[_0x0695('0xb')](_0x0695('0x11'),auth[_0x0695('0x9')](),controller[_0x0695('0x12')]);router[_0x0695('0xb')](_0x0695('0x13'),auth[_0x0695('0x9')](),controller[_0x0695('0x14')]);router[_0x0695('0xb')]('/:id/members',auth[_0x0695('0x9')](),controller[_0x0695('0x15')]);router[_0x0695('0xb')](_0x0695('0x16'),auth[_0x0695('0x9')](),controller['getLists']);router[_0x0695('0xb')](_0x0695('0x17'),auth[_0x0695('0x9')](),controller[_0x0695('0x18')]);router['post']('/',auth[_0x0695('0x9')](),controller[_0x0695('0x19')]);router[_0x0695('0x1a')](_0x0695('0x1b'),auth[_0x0695('0x9')](),controller[_0x0695('0x1c')]);router['post'](_0x0695('0x11'),auth[_0x0695('0x9')](),controller[_0x0695('0x1d')]);router[_0x0695('0x1a')](_0x0695('0x13'),auth[_0x0695('0x9')](),controller[_0x0695('0x1e')]);router[_0x0695('0x1a')](_0x0695('0x16'),auth['isAuthenticated'](),controller[_0x0695('0x1f')]);router[_0x0695('0x1a')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x0695('0x20')]);router['put'](_0x0695('0x21'),auth[_0x0695('0x9')](),controller[_0x0695('0x22')]);router[_0x0695('0x23')]('/:id',auth[_0x0695('0x9')](),controller[_0x0695('0x24')]);router[_0x0695('0x23')](_0x0695('0x11'),auth[_0x0695('0x9')](),controller[_0x0695('0x25')]);router[_0x0695('0x23')](_0x0695('0x13'),auth[_0x0695('0x9')](),controller[_0x0695('0x26')]);router['delete'](_0x0695('0x16'),auth[_0x0695('0x9')](),controller[_0x0695('0x27')]);router[_0x0695('0x23')](_0x0695('0x17'),auth[_0x0695('0x9')](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index f0176e4..0490e6d 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(_0x3effbe,_0x1b2020){var _0x27d525=function(_0x55eb5d){while(--_0x55eb5d){_0x3effbe['push'](_0x3effbe['shift']());}};_0x27d525(++_0x1b2020);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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(_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 diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 50497be..7f2cc9e 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 _0x7e05=['create','user','role','inbound','outbound','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','omit','createdAt','body','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','CmHopper','nolimit','order','VoiceQueueId','getHopperHistories','findOne','CmHopperFinal','CmHopperBlack','getTeams','Team','teams','User','Agents','voicePause','interface','flatMap','penalty','transaction','addTeams','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','isNil','forEach','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','all','union','compact','sequelize','isEmpty','userVoiceQueue:remove','addAgents','spread','online','format','SIP/%s','removeAgents','isArray','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','NOW()','ContactId','CmListId','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','deletedAt\x20IS\x20NULL','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','zip-dir','request-promise','moment','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','VoiceQueues','QueueCampaigns','filter','map','value','includes','find','type','name','stack','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','merge','options','VoiceQueue','include','findAll','rows','catch','includeAll'];(function(_0x202708,_0x1f2f7a){var _0x3faac2=function(_0x4480df){while(--_0x4480df){_0x202708['push'](_0x202708['shift']());}};_0x3faac2(++_0x1f2f7a);}(_0x7e05,0x69));var _0x57e0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7e05[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x57e0('0x0'));var emlformat=require(_0x57e0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x57e0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x57e0('0x3'));var moment=require(_0x57e0('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x57e0('0x5'));var path=require(_0x57e0('0x6'));var sox=require(_0x57e0('0x7'));var csv=require(_0x57e0('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x57e0('0x9'));var squel=require('squel');var crypto=require(_0x57e0('0xa'));var jsforce=require(_0x57e0('0xb'));var deskjs=require(_0x57e0('0xc'));var toCsv=require(_0x57e0('0x8'));var querystring=require(_0x57e0('0xd'));var Papa=require(_0x57e0('0xe'));var Redis=require(_0x57e0('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x57e0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x57e0('0x11'));var logger=require('../../config/logger')(_0x57e0('0x12'));var utils=require(_0x57e0('0x13'));var config=require(_0x57e0('0x14'));var db=require(_0x57e0('0x15'))['db'];config[_0x57e0('0x16')]=_[_0x57e0('0x17')](config[_0x57e0('0x16')],{'host':_0x57e0('0x18'),'port':0x18eb});var socket=require(_0x57e0('0x19'))(new Redis(config['redis']));require(_0x57e0('0x1a'))[_0x57e0('0x1b')](socket);function respondWithStatusCode(_0x4a4562,_0x32babd){_0x32babd=_0x32babd||0xcc;return function(_0x5d56e3){if(_0x5d56e3){return _0x4a4562[_0x57e0('0x1c')](_0x32babd);}return _0x4a4562[_0x57e0('0x1d')](_0x32babd)[_0x57e0('0x1e')]();};}function respondWithResult(_0x2e0beb,_0x304ec4){_0x304ec4=_0x304ec4||0xc8;return function(_0x489fa2){if(_0x489fa2){return _0x2e0beb[_0x57e0('0x1d')](_0x304ec4)[_0x57e0('0x1f')](_0x489fa2);}};}function respondWithFilteredResult(_0x2b04d0,_0x22c344){return function(_0x11a289){if(_0x11a289){var _0x52cf5a=_0x11a289[_0x57e0('0x20')],_0xf7b54a=_0x22c344[_0x57e0('0x21')],_0x2500ea=_0x22c344[_0x57e0('0x21')]+_0x22c344[_0x57e0('0x22')],_0x240c6d;if(_0x2500ea>=_0x52cf5a){_0x2500ea=_0x52cf5a;_0x240c6d=0xc8;}else{_0x240c6d=0xce;}_0x2b04d0['status'](_0x240c6d);return _0x2b04d0[_0x57e0('0x23')](_0x57e0('0x24'),_0xf7b54a+'-'+_0x2500ea+'/'+_0x52cf5a)[_0x57e0('0x1f')](_0x11a289);}return null;};}function patchUpdates(_0x3814a3){return function(_0x5c7214){try{jsonpatch[_0x57e0('0x25')](_0x5c7214,_0x3814a3,!![]);}catch(_0x373100){return BPromise[_0x57e0('0x26')](_0x373100);}return _0x5c7214[_0x57e0('0x27')]();};}function saveUpdates(_0x5d83c6,_0xc5b15){return function(_0x45acbd){if(_0x45acbd){return _0x45acbd[_0x57e0('0x28')](_0x5d83c6)['then'](function(_0x595696){return _0x595696;});}return null;};}function removeEntity(_0x44e84c,_0x3a6a14){return function(_0x41a8c9){if(_0x41a8c9){return _0x41a8c9[_0x57e0('0x29')]()[_0x57e0('0x2a')](function(){var _0x34cac4=_0x41a8c9[_0x57e0('0x2b')]({'plain':!![]});var _0x257e51=[{'name':_0x57e0('0x2c'),'value':'inbound','ignore':![]},{'name':_0x57e0('0x2d'),'value':'outbound','ignore':![]}];var _0x12a4ec=_(_0x257e51)[_0x57e0('0x2e')]('ignore')[_0x57e0('0x2f')](_0x57e0('0x30'))['value']();if(_[_0x57e0('0x31')](_0x12a4ec,_0x34cac4['type'])){return;}var _0x5d06bc=_[_0x57e0('0x32')](_0x257e51,[_0x57e0('0x30'),_0x34cac4[_0x57e0('0x33')]])[_0x57e0('0x34')];return db['UserProfileResource'][_0x57e0('0x29')]({'where':{'type':_0x5d06bc,'resourceId':_0x34cac4['id']}})[_0x57e0('0x2a')](function(){return _0x41a8c9;});})['then'](function(){_0x44e84c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x7e3b17,_0xcc8439){return function(_0x5b0e29){if(!_0x5b0e29){_0x7e3b17[_0x57e0('0x1c')](0x194);}return _0x5b0e29;};}function handleError(_0x17002e,_0x2766f9){_0x2766f9=_0x2766f9||0x1f4;return function(_0x382509){logger['error'](_0x382509[_0x57e0('0x35')]);if(_0x382509[_0x57e0('0x34')]){delete _0x382509['name'];}_0x17002e['status'](_0x2766f9)['send'](_0x382509);};}exports['index']=function(_0x52cf91,_0x20c926){var _0x2969c7={},_0x1ec00c={},_0x4448d5={'count':0x0,'rows':[]};var _0x252eb8=_['map'](db['VoiceQueue'][_0x57e0('0x36')],function(_0x30cadf){return{'name':_0x30cadf[_0x57e0('0x37')],'type':_0x30cadf[_0x57e0('0x33')][_0x57e0('0x38')]};});_0x1ec00c[_0x57e0('0x39')]=_[_0x57e0('0x2f')](_0x252eb8,_0x57e0('0x34'));_0x1ec00c[_0x57e0('0x3a')]=_[_0x57e0('0x3b')](_0x52cf91[_0x57e0('0x3a')]);_0x1ec00c['filters']=_[_0x57e0('0x3c')](_0x1ec00c[_0x57e0('0x39')],_0x1ec00c['query']);_0x2969c7['attributes']=_[_0x57e0('0x3c')](_0x1ec00c['model'],qs[_0x57e0('0x3d')](_0x52cf91[_0x57e0('0x3a')]['fields']));_0x2969c7['attributes']=_0x2969c7[_0x57e0('0x3e')][_0x57e0('0x3f')]?_0x2969c7[_0x57e0('0x3e')]:_0x1ec00c[_0x57e0('0x39')];if(!_0x52cf91[_0x57e0('0x3a')][_0x57e0('0x40')]('nolimit')){_0x2969c7[_0x57e0('0x22')]=qs[_0x57e0('0x22')](_0x52cf91[_0x57e0('0x3a')]['limit']);_0x2969c7[_0x57e0('0x21')]=qs[_0x57e0('0x21')](_0x52cf91[_0x57e0('0x3a')][_0x57e0('0x21')]);}_0x2969c7['order']=qs[_0x57e0('0x41')](_0x52cf91[_0x57e0('0x3a')][_0x57e0('0x41')]);_0x2969c7[_0x57e0('0x42')]=qs[_0x57e0('0x43')](_[_0x57e0('0x44')](_0x52cf91[_0x57e0('0x3a')],_0x1ec00c[_0x57e0('0x43')]));if(_0x52cf91[_0x57e0('0x3a')][_0x57e0('0x2e')]){_0x2969c7[_0x57e0('0x42')]=_[_0x57e0('0x45')](_0x2969c7[_0x57e0('0x42')],{'$or':_['map'](_0x252eb8,function(_0xc83af6){if(_0xc83af6['type']!=='VIRTUAL'){var _0xd800d9={};_0xd800d9[_0xc83af6[_0x57e0('0x34')]]={'$like':'%'+_0x52cf91[_0x57e0('0x3a')][_0x57e0('0x2e')]+'%'};return _0xd800d9;}})});}_0x2969c7=_[_0x57e0('0x45')]({},_0x2969c7,_0x52cf91[_0x57e0('0x46')]);var _0x4bba4d={'where':_0x2969c7[_0x57e0('0x42')]};return db[_0x57e0('0x47')][_0x57e0('0x20')](_0x4bba4d)[_0x57e0('0x2a')](function(_0x27210c){_0x4448d5[_0x57e0('0x20')]=_0x27210c;if(_0x52cf91['query']['includeAll']){_0x2969c7[_0x57e0('0x48')]=[{'all':!![]}];}return db[_0x57e0('0x47')][_0x57e0('0x49')](_0x2969c7);})[_0x57e0('0x2a')](function(_0x18b4dc){_0x4448d5[_0x57e0('0x4a')]=_0x18b4dc;return _0x4448d5;})[_0x57e0('0x2a')](respondWithFilteredResult(_0x20c926,_0x2969c7))[_0x57e0('0x4b')](handleError(_0x20c926,null));};exports['show']=function(_0x5cbd00,_0x2e529d){var _0x555e77={'raw':![],'where':{'id':_0x5cbd00['params']['id']}},_0x430620={};_0x430620[_0x57e0('0x39')]=_['keys'](db[_0x57e0('0x47')][_0x57e0('0x36')]);_0x430620[_0x57e0('0x3a')]=_['keys'](_0x5cbd00[_0x57e0('0x3a')]);_0x430620[_0x57e0('0x43')]=_[_0x57e0('0x3c')](_0x430620[_0x57e0('0x39')],_0x430620[_0x57e0('0x3a')]);_0x555e77[_0x57e0('0x3e')]=_[_0x57e0('0x3c')](_0x430620[_0x57e0('0x39')],qs[_0x57e0('0x3d')](_0x5cbd00['query'][_0x57e0('0x3d')]));_0x555e77[_0x57e0('0x3e')]=_0x555e77[_0x57e0('0x3e')][_0x57e0('0x3f')]?_0x555e77[_0x57e0('0x3e')]:_0x430620[_0x57e0('0x39')];if(_0x5cbd00[_0x57e0('0x3a')][_0x57e0('0x4c')]){_0x555e77[_0x57e0('0x48')]=[{'all':!![]}];}_0x555e77=_[_0x57e0('0x45')]({},_0x555e77,_0x5cbd00[_0x57e0('0x46')]);return db[_0x57e0('0x47')][_0x57e0('0x32')](_0x555e77)['then'](handleEntityNotFound(_0x2e529d,null))[_0x57e0('0x2a')](respondWithResult(_0x2e529d,null))['catch'](handleError(_0x2e529d,null));};exports[_0x57e0('0x4d')]=function(_0x968fc1,_0x328452){return db[_0x57e0('0x47')]['create'](_0x968fc1['body'],{})[_0x57e0('0x2a')](function(_0x585e76){var _0x1441b2=_0x968fc1[_0x57e0('0x4e')][_0x57e0('0x2b')]({'plain':!![]});if(!_0x1441b2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1441b2[_0x57e0('0x4f')]===_0x57e0('0x4e')){var _0x14aaf3=_0x585e76[_0x57e0('0x2b')]({'plain':!![]});var _0x1c89f5=[{'name':_0x57e0('0x2c'),'value':_0x57e0('0x50')},{'name':_0x57e0('0x2d'),'value':_0x57e0('0x51')}];var _0xa93399=_['find'](_0x1c89f5,[_0x57e0('0x30'),_0x14aaf3['type']])[_0x57e0('0x34')];return db[_0x57e0('0x52')][_0x57e0('0x32')]({'where':{'name':_0xa93399,'userProfileId':_0x1441b2[_0x57e0('0x53')]},'raw':!![]})[_0x57e0('0x2a')](function(_0x3356ad){if(_0x3356ad&&_0x3356ad[_0x57e0('0x54')]===0x0){return db[_0x57e0('0x55')][_0x57e0('0x4d')]({'name':_0x14aaf3[_0x57e0('0x34')],'resourceId':_0x14aaf3['id'],'type':_0x3356ad['name'],'sectionId':_0x3356ad['id']},{})['then'](function(){return _0x585e76;});}else{return _0x585e76;}})['catch'](function(_0x54f83e){logger[_0x57e0('0x56')](_0x57e0('0x57'),_0x54f83e);throw _0x54f83e;});}return _0x585e76;})[_0x57e0('0x2a')](respondWithResult(_0x328452,0xc9))[_0x57e0('0x4b')](handleError(_0x328452,null));};exports['clone']=function(_0x56a848,_0x2eda69){var _0x5133ef={'where':{'id':_0x56a848[_0x57e0('0x58')]['id']}},_0x2079f6={};_0x2079f6[_0x57e0('0x39')]=_[_0x57e0('0x3b')](db['VoiceQueue'][_0x57e0('0x36')]);_0x5133ef[_0x57e0('0x3e')]=_[_0x57e0('0x3c')](_0x2079f6[_0x57e0('0x39')],qs[_0x57e0('0x3d')](_0x56a848[_0x57e0('0x3a')][_0x57e0('0x3d')]));_0x5133ef['attributes']=_0x5133ef[_0x57e0('0x3e')][_0x57e0('0x3f')]?_0x5133ef[_0x57e0('0x3e')]:_0x2079f6[_0x57e0('0x39')];if(_0x56a848[_0x57e0('0x3a')]['includeAll']){_0x5133ef['include']=[{'all':!![]}];}_0x5133ef=_[_0x57e0('0x45')]({},_0x5133ef,_0x56a848[_0x57e0('0x46')]);return db[_0x57e0('0x47')]['find'](_0x5133ef)[_0x57e0('0x2a')](handleEntityNotFound(_0x2eda69,null))[_0x57e0('0x2a')](function(_0x160aae){if(_0x160aae){var _0x5a9983=_0x160aae[_0x57e0('0x2b')]({'plain':!![]});_0x5a9983=qs[_0x57e0('0x59')](_0x5a9983,['id',_0x57e0('0x5a'),'updatedAt']);_0x56a848[_0x57e0('0x5b')]=_[_0x57e0('0x59')](_0x56a848['body'],['id',_0x57e0('0x5a'),_0x57e0('0x5c')]);return db[_0x57e0('0x47')][_0x57e0('0x4d')](_['merge'](_0x5a9983,_0x56a848['body']),{'include':_0x56a848[_0x57e0('0x3a')][_0x57e0('0x4c')]?[{'all':!![]}]:undefined})[_0x57e0('0x2a')](function(_0x5cbabd){var _0x1f426e=_0x56a848[_0x57e0('0x4e')][_0x57e0('0x2b')]({'plain':!![]});if(!_0x1f426e)throw new Error(_0x57e0('0x5d'));if(_0x1f426e[_0x57e0('0x4f')]==='user'){var _0x2406ad=_0x5cbabd[_0x57e0('0x2b')]({'plain':!![]});var _0x14ef19=[{'name':'VoiceQueues','value':'inbound'},{'name':_0x57e0('0x2d'),'value':_0x57e0('0x51')}];var _0x337ca0=_[_0x57e0('0x32')](_0x14ef19,['value',_0x2406ad['type']])[_0x57e0('0x34')];return db[_0x57e0('0x52')][_0x57e0('0x32')]({'where':{'name':_0x337ca0,'userProfileId':_0x1f426e['userProfileId']},'raw':!![]})[_0x57e0('0x2a')](function(_0xed10a6){if(_0xed10a6&&_0xed10a6['autoAssociation']===0x0){return db['UserProfileResource'][_0x57e0('0x4d')]({'name':_0x2406ad[_0x57e0('0x34')],'resourceId':_0x2406ad['id'],'type':_0xed10a6[_0x57e0('0x34')],'sectionId':_0xed10a6['id']},{})[_0x57e0('0x2a')](function(){return _0x5cbabd;});}else{return _0x5cbabd;}})[_0x57e0('0x4b')](function(_0x49f2fb){logger[_0x57e0('0x56')](_0x57e0('0x57'),_0x49f2fb);throw _0x49f2fb;});}return _0x5cbabd;});}})[_0x57e0('0x2a')](respondWithResult(_0x2eda69,0xc9))[_0x57e0('0x4b')](handleError(_0x2eda69,null));};exports[_0x57e0('0x28')]=function(_0x579633,_0x50043f){if(_0x579633['body']['id']){delete _0x579633[_0x57e0('0x5b')]['id'];}return db[_0x57e0('0x47')][_0x57e0('0x32')]({'where':{'id':_0x579633[_0x57e0('0x58')]['id']}})[_0x57e0('0x2a')](handleEntityNotFound(_0x50043f,null))['then'](saveUpdates(_0x579633[_0x57e0('0x5b')],null))[_0x57e0('0x2a')](respondWithResult(_0x50043f,null))[_0x57e0('0x4b')](handleError(_0x50043f,null));};exports[_0x57e0('0x29')]=function(_0x177052,_0x2b20e5){return db[_0x57e0('0x47')][_0x57e0('0x32')]({'where':{'id':_0x177052[_0x57e0('0x58')]['id']}})[_0x57e0('0x2a')](handleEntityNotFound(_0x2b20e5,null))['then'](removeEntity(_0x2b20e5,null))[_0x57e0('0x4b')](handleError(_0x2b20e5,null));};exports[_0x57e0('0x5e')]=function(_0xa66566,_0x42787e,_0x315afb){var _0x25ad3c={'raw':![],'where':{}};var _0x92acd5={};var _0x2ecc99={'count':0x0,'rows':[]};return db[_0x57e0('0x47')]['findOne']({'where':{'id':_0xa66566[_0x57e0('0x58')]['id']}})[_0x57e0('0x2a')](handleEntityNotFound(_0x42787e,null))[_0x57e0('0x2a')](function(_0xff4a1c){if(_0xff4a1c){_0x92acd5['model']=_[_0x57e0('0x3b')](db[_0x57e0('0x5f')][_0x57e0('0x36')]);_0x92acd5[_0x57e0('0x3a')]=_[_0x57e0('0x3b')](_0xa66566[_0x57e0('0x3a')]);_0x92acd5[_0x57e0('0x43')]=_[_0x57e0('0x3c')](_0x92acd5[_0x57e0('0x39')],_0x92acd5[_0x57e0('0x3a')]);_0x25ad3c[_0x57e0('0x3e')]=_['intersection'](_0x92acd5[_0x57e0('0x39')],qs[_0x57e0('0x3d')](_0xa66566[_0x57e0('0x3a')][_0x57e0('0x3d')]));_0x25ad3c[_0x57e0('0x3e')]=_0x25ad3c[_0x57e0('0x3e')]['length']?_0x25ad3c[_0x57e0('0x3e')]:_0x92acd5[_0x57e0('0x39')];if(!_0xa66566[_0x57e0('0x3a')][_0x57e0('0x40')](_0x57e0('0x60'))){_0x25ad3c[_0x57e0('0x22')]=qs[_0x57e0('0x22')](_0xa66566['query'][_0x57e0('0x22')]);_0x25ad3c[_0x57e0('0x21')]=qs[_0x57e0('0x21')](_0xa66566[_0x57e0('0x3a')][_0x57e0('0x21')]);}_0x25ad3c[_0x57e0('0x61')]=qs[_0x57e0('0x41')](_0xa66566[_0x57e0('0x3a')]['sort']);_0x25ad3c[_0x57e0('0x42')]=qs[_0x57e0('0x43')](_[_0x57e0('0x44')](_0xa66566[_0x57e0('0x3a')],_0x92acd5[_0x57e0('0x43')]));_0x25ad3c[_0x57e0('0x42')][_0x57e0('0x62')]=_0xff4a1c['id'];if(_0xa66566['query']['filter']){_0x25ad3c['where']=_[_0x57e0('0x45')](_0x25ad3c[_0x57e0('0x42')],{'$or':_[_0x57e0('0x2f')](_0x25ad3c[_0x57e0('0x3e')],function(_0x2490df){var _0x2639fd={};_0x2639fd[_0x2490df]={'$like':'%'+_0xa66566['query'][_0x57e0('0x2e')]+'%'};return _0x2639fd;})});}_0x25ad3c=_[_0x57e0('0x45')]({},_0x25ad3c,_0xa66566[_0x57e0('0x46')]);return db[_0x57e0('0x5f')][_0x57e0('0x20')]({'where':_0x25ad3c[_0x57e0('0x42')]})[_0x57e0('0x2a')](function(_0x2e9e34){_0x2ecc99['count']=_0x2e9e34;if(_0xa66566[_0x57e0('0x3a')][_0x57e0('0x4c')]){_0x25ad3c[_0x57e0('0x48')]=[{'all':!![]}];}return db['CmHopper'][_0x57e0('0x49')](_0x25ad3c);})[_0x57e0('0x2a')](function(_0x4bad74){_0x2ecc99['rows']=_0x4bad74;return _0x2ecc99;});}})[_0x57e0('0x2a')](respondWithFilteredResult(_0x42787e,_0x25ad3c))['catch'](handleError(_0x42787e,null));};exports[_0x57e0('0x63')]=function(_0x30e7ed,_0x2664d2,_0x4c6775){var _0x30dbc4={'raw':!![],'where':{}};var _0x5f0e6f={};var _0x270005={'count':0x0,'rows':[]};return db[_0x57e0('0x47')][_0x57e0('0x64')]({'where':{'id':_0x30e7ed[_0x57e0('0x58')]['id']}})[_0x57e0('0x2a')](handleEntityNotFound(_0x2664d2,null))[_0x57e0('0x2a')](function(_0x151482){if(_0x151482){_0x5f0e6f[_0x57e0('0x39')]=_['keys'](db['CmHopperHistory']['rawAttributes']);_0x5f0e6f[_0x57e0('0x3a')]=_[_0x57e0('0x3b')](_0x30e7ed[_0x57e0('0x3a')]);_0x5f0e6f['filters']=_[_0x57e0('0x3c')](_0x5f0e6f[_0x57e0('0x39')],_0x5f0e6f['query']);_0x30dbc4[_0x57e0('0x3e')]=_['intersection'](_0x5f0e6f[_0x57e0('0x39')],qs[_0x57e0('0x3d')](_0x30e7ed[_0x57e0('0x3a')][_0x57e0('0x3d')]));_0x30dbc4['attributes']=_0x30dbc4[_0x57e0('0x3e')][_0x57e0('0x3f')]?_0x30dbc4[_0x57e0('0x3e')]:_0x5f0e6f[_0x57e0('0x39')];if(!_0x30e7ed[_0x57e0('0x3a')][_0x57e0('0x40')]('nolimit')){_0x30dbc4[_0x57e0('0x22')]=qs[_0x57e0('0x22')](_0x30e7ed[_0x57e0('0x3a')][_0x57e0('0x22')]);_0x30dbc4[_0x57e0('0x21')]=qs['offset'](_0x30e7ed[_0x57e0('0x3a')][_0x57e0('0x21')]);}_0x30dbc4['order']=qs['sort'](_0x30e7ed[_0x57e0('0x3a')][_0x57e0('0x41')]);_0x30dbc4['where']=qs[_0x57e0('0x43')](_['pick'](_0x30e7ed[_0x57e0('0x3a')],_0x5f0e6f[_0x57e0('0x43')]));_0x30dbc4[_0x57e0('0x42')][_0x57e0('0x62')]=_0x151482['id'];if(_0x30e7ed[_0x57e0('0x3a')][_0x57e0('0x2e')]){_0x30dbc4[_0x57e0('0x42')]=_['merge'](_0x30dbc4[_0x57e0('0x42')],{'$or':_['map'](_0x30dbc4['attributes'],function(_0x4a77b7){var _0x696aa7={};_0x696aa7[_0x4a77b7]={'$like':'%'+_0x30e7ed[_0x57e0('0x3a')][_0x57e0('0x2e')]+'%'};return _0x696aa7;})});}_0x30dbc4=_[_0x57e0('0x45')]({},_0x30dbc4,_0x30e7ed[_0x57e0('0x46')]);return db['CmHopperHistory'][_0x57e0('0x20')]({'where':_0x30dbc4[_0x57e0('0x42')]})['then'](function(_0xe01b57){_0x270005[_0x57e0('0x20')]=_0xe01b57;if(_0x30e7ed[_0x57e0('0x3a')][_0x57e0('0x4c')]){_0x30dbc4[_0x57e0('0x48')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x57e0('0x49')](_0x30dbc4);})[_0x57e0('0x2a')](function(_0x1e50f7){_0x270005[_0x57e0('0x4a')]=_0x1e50f7;return _0x270005;});}})[_0x57e0('0x2a')](respondWithFilteredResult(_0x2664d2,_0x30dbc4))['catch'](handleError(_0x2664d2,null));};exports['getHopperFinals']=function(_0x3c82c7,_0x507d0a,_0x42e43b){var _0xc54de7={'raw':!![],'where':{}};var _0x4b2683={};var _0x3a3a7f={'count':0x0,'rows':[]};return db[_0x57e0('0x47')][_0x57e0('0x64')]({'where':{'id':_0x3c82c7[_0x57e0('0x58')]['id']}})['then'](handleEntityNotFound(_0x507d0a,null))[_0x57e0('0x2a')](function(_0x2bac16){if(_0x2bac16){_0x4b2683[_0x57e0('0x39')]=_[_0x57e0('0x3b')](db[_0x57e0('0x65')][_0x57e0('0x36')]);_0x4b2683[_0x57e0('0x3a')]=_[_0x57e0('0x3b')](_0x3c82c7['query']);_0x4b2683['filters']=_[_0x57e0('0x3c')](_0x4b2683['model'],_0x4b2683[_0x57e0('0x3a')]);_0xc54de7[_0x57e0('0x3e')]=_['intersection'](_0x4b2683[_0x57e0('0x39')],qs[_0x57e0('0x3d')](_0x3c82c7['query']['fields']));_0xc54de7[_0x57e0('0x3e')]=_0xc54de7[_0x57e0('0x3e')]['length']?_0xc54de7['attributes']:_0x4b2683[_0x57e0('0x39')];if(!_0x3c82c7[_0x57e0('0x3a')][_0x57e0('0x40')](_0x57e0('0x60'))){_0xc54de7[_0x57e0('0x22')]=qs[_0x57e0('0x22')](_0x3c82c7[_0x57e0('0x3a')][_0x57e0('0x22')]);_0xc54de7['offset']=qs[_0x57e0('0x21')](_0x3c82c7['query']['offset']);}_0xc54de7[_0x57e0('0x61')]=qs[_0x57e0('0x41')](_0x3c82c7[_0x57e0('0x3a')][_0x57e0('0x41')]);_0xc54de7[_0x57e0('0x42')]=qs[_0x57e0('0x43')](_[_0x57e0('0x44')](_0x3c82c7[_0x57e0('0x3a')],_0x4b2683[_0x57e0('0x43')]));_0xc54de7[_0x57e0('0x42')]['VoiceQueueId']=_0x2bac16['id'];if(_0x3c82c7[_0x57e0('0x3a')][_0x57e0('0x2e')]){_0xc54de7['where']=_[_0x57e0('0x45')](_0xc54de7[_0x57e0('0x42')],{'$or':_[_0x57e0('0x2f')](_0xc54de7[_0x57e0('0x3e')],function(_0x4af02d){var _0x590c8e={};_0x590c8e[_0x4af02d]={'$like':'%'+_0x3c82c7[_0x57e0('0x3a')][_0x57e0('0x2e')]+'%'};return _0x590c8e;})});}_0xc54de7=_['merge']({},_0xc54de7,_0x3c82c7[_0x57e0('0x46')]);return db[_0x57e0('0x65')][_0x57e0('0x20')]({'where':_0xc54de7[_0x57e0('0x42')]})[_0x57e0('0x2a')](function(_0x3af194){_0x3a3a7f['count']=_0x3af194;if(_0x3c82c7['query'][_0x57e0('0x4c')]){_0xc54de7['include']=[{'all':!![]}];}return db[_0x57e0('0x65')][_0x57e0('0x49')](_0xc54de7);})[_0x57e0('0x2a')](function(_0x5aed70){_0x3a3a7f['rows']=_0x5aed70;return _0x3a3a7f;});}})[_0x57e0('0x2a')](respondWithFilteredResult(_0x507d0a,_0xc54de7))[_0x57e0('0x4b')](handleError(_0x507d0a,null));};exports['getHopperBlacks']=function(_0x35f3e9,_0x4878d5,_0x527f60){var _0x5af3be={'raw':!![],'where':{}};var _0x252588={};var _0x495adc={'count':0x0,'rows':[]};return db[_0x57e0('0x47')][_0x57e0('0x64')]({'where':{'id':_0x35f3e9['params']['id']}})[_0x57e0('0x2a')](handleEntityNotFound(_0x4878d5,null))[_0x57e0('0x2a')](function(_0xcc4828){if(_0xcc4828){_0x252588[_0x57e0('0x39')]=_[_0x57e0('0x3b')](db['CmHopperBlack'][_0x57e0('0x36')]);_0x252588[_0x57e0('0x3a')]=_[_0x57e0('0x3b')](_0x35f3e9[_0x57e0('0x3a')]);_0x252588['filters']=_[_0x57e0('0x3c')](_0x252588[_0x57e0('0x39')],_0x252588[_0x57e0('0x3a')]);_0x5af3be[_0x57e0('0x3e')]=_[_0x57e0('0x3c')](_0x252588[_0x57e0('0x39')],qs[_0x57e0('0x3d')](_0x35f3e9[_0x57e0('0x3a')][_0x57e0('0x3d')]));_0x5af3be[_0x57e0('0x3e')]=_0x5af3be[_0x57e0('0x3e')][_0x57e0('0x3f')]?_0x5af3be[_0x57e0('0x3e')]:_0x252588[_0x57e0('0x39')];if(!_0x35f3e9[_0x57e0('0x3a')][_0x57e0('0x40')](_0x57e0('0x60'))){_0x5af3be[_0x57e0('0x22')]=qs[_0x57e0('0x22')](_0x35f3e9['query'][_0x57e0('0x22')]);_0x5af3be[_0x57e0('0x21')]=qs[_0x57e0('0x21')](_0x35f3e9[_0x57e0('0x3a')][_0x57e0('0x21')]);}_0x5af3be[_0x57e0('0x61')]=qs['sort'](_0x35f3e9[_0x57e0('0x3a')][_0x57e0('0x41')]);_0x5af3be[_0x57e0('0x42')]=qs[_0x57e0('0x43')](_[_0x57e0('0x44')](_0x35f3e9[_0x57e0('0x3a')],_0x252588[_0x57e0('0x43')]));_0x5af3be['where'][_0x57e0('0x62')]=_0xcc4828['id'];if(_0x35f3e9['query']['filter']){_0x5af3be[_0x57e0('0x42')]=_[_0x57e0('0x45')](_0x5af3be[_0x57e0('0x42')],{'$or':_[_0x57e0('0x2f')](_0x5af3be[_0x57e0('0x3e')],function(_0x117866){var _0x1587f6={};_0x1587f6[_0x117866]={'$like':'%'+_0x35f3e9[_0x57e0('0x3a')][_0x57e0('0x2e')]+'%'};return _0x1587f6;})});}_0x5af3be=_[_0x57e0('0x45')]({},_0x5af3be,_0x35f3e9[_0x57e0('0x46')]);return db[_0x57e0('0x66')]['count']({'where':_0x5af3be[_0x57e0('0x42')]})[_0x57e0('0x2a')](function(_0x2c7d25){_0x495adc[_0x57e0('0x20')]=_0x2c7d25;if(_0x35f3e9[_0x57e0('0x3a')][_0x57e0('0x4c')]){_0x5af3be[_0x57e0('0x48')]=[{'all':!![]}];}return db[_0x57e0('0x66')]['findAll'](_0x5af3be);})[_0x57e0('0x2a')](function(_0x4931e3){_0x495adc['rows']=_0x4931e3;return _0x495adc;});}})[_0x57e0('0x2a')](respondWithFilteredResult(_0x4878d5,_0x5af3be))[_0x57e0('0x4b')](handleError(_0x4878d5,null));};exports[_0x57e0('0x67')]=function(_0x4283a0,_0x1fa358,_0x1036f4){var _0x143c0d={};var _0x377f2c={};var _0x17156f;var _0xe9c46b;return db[_0x57e0('0x47')]['findOne']({'where':{'id':_0x4283a0[_0x57e0('0x58')]['id']}})[_0x57e0('0x2a')](handleEntityNotFound(_0x1fa358,null))[_0x57e0('0x2a')](function(_0x4df6e7){if(_0x4df6e7){_0x17156f=_0x4df6e7;_0x377f2c['model']=_['keys'](db[_0x57e0('0x68')][_0x57e0('0x36')]);_0x377f2c['query']=_[_0x57e0('0x3b')](_0x4283a0[_0x57e0('0x3a')]);_0x377f2c[_0x57e0('0x43')]=_[_0x57e0('0x3c')](_0x377f2c['model'],_0x377f2c[_0x57e0('0x3a')]);_0x143c0d[_0x57e0('0x3e')]=_[_0x57e0('0x3c')](_0x377f2c[_0x57e0('0x39')],qs[_0x57e0('0x3d')](_0x4283a0['query'][_0x57e0('0x3d')]));_0x143c0d[_0x57e0('0x3e')]=_0x143c0d[_0x57e0('0x3e')][_0x57e0('0x3f')]?_0x143c0d[_0x57e0('0x3e')]:_0x377f2c['model'];_0x143c0d[_0x57e0('0x61')]=qs[_0x57e0('0x41')](_0x4283a0[_0x57e0('0x3a')][_0x57e0('0x41')]);_0x143c0d['where']=qs[_0x57e0('0x43')](_[_0x57e0('0x44')](_0x4283a0[_0x57e0('0x3a')],_0x377f2c[_0x57e0('0x43')]));if(_0x4283a0[_0x57e0('0x3a')][_0x57e0('0x2e')]){_0x143c0d['where']=_[_0x57e0('0x45')](_0x143c0d[_0x57e0('0x42')],{'$or':_[_0x57e0('0x2f')](_0x143c0d['attributes'],function(_0xca341e){var _0xa789bd={};_0xa789bd[_0xca341e]={'$like':'%'+_0x4283a0[_0x57e0('0x3a')][_0x57e0('0x2e')]+'%'};return _0xa789bd;})});}_0x143c0d=_[_0x57e0('0x45')]({},_0x143c0d,_0x4283a0['options']);return _0x17156f[_0x57e0('0x67')](_0x143c0d);}})[_0x57e0('0x2a')](function(_0x2f0dee){if(_0x2f0dee){_0xe9c46b=_0x2f0dee['length'];if(!_0x4283a0['query'][_0x57e0('0x40')]('nolimit')){_0x143c0d[_0x57e0('0x22')]=qs[_0x57e0('0x22')](_0x4283a0[_0x57e0('0x3a')][_0x57e0('0x22')]);_0x143c0d[_0x57e0('0x21')]=qs['offset'](_0x4283a0[_0x57e0('0x3a')][_0x57e0('0x21')]);}return _0x17156f[_0x57e0('0x67')](_0x143c0d);}})['then'](function(_0x47fab9){if(_0x47fab9){return _0x47fab9?{'count':_0xe9c46b,'rows':_0x47fab9}:null;}})[_0x57e0('0x2a')](respondWithResult(_0x1fa358,null))[_0x57e0('0x4b')](handleError(_0x1fa358,null));};exports['addTeams']=function(_0x3b9b31,_0x12ce49,_0x372c4e){var _0x3b1a6b=_0x3b9b31[_0x57e0('0x5b')][_0x57e0('0x69')];var _0x3c0029=_[_0x57e0('0x2f')](_0x3b1a6b,'id');return db[_0x57e0('0x68')]['findAll']({'where':{'id':_0x3c0029},'attributes':['id'],'include':[{'model':db[_0x57e0('0x6a')],'as':_0x57e0('0x6b'),'attributes':['id','name','online',_0x57e0('0x6c'),_0x57e0('0x6d')],'raw':!![]}]})[_0x57e0('0x2a')](function(_0x2e6a07){if(_0x2e6a07){var _0x163e84=_[_0x57e0('0x6e')](_0x2e6a07,function(_0x1f93b8){var _0xc78279=_0x1f93b8[_0x57e0('0x2b')]({'plain':!![]});_0xc78279['Agents']['forEach'](function(_0x3a6264){_0x3a6264[_0x57e0('0x6f')]=_[_0x57e0('0x32')](_0x3b1a6b,{'id':_0xc78279['id']})[_0x57e0('0x6f')];});return _0xc78279[_0x57e0('0x6b')];});return db[_0x57e0('0x47')][_0x57e0('0x32')]({'where':{'id':_0x3b9b31['params']['id']}})[_0x57e0('0x2a')](function(_0x2f420d){return db['sequelize'][_0x57e0('0x70')](function(_0x4c21cc){return _0x2f420d[_0x57e0('0x71')](_0x3c0029,{'transaction':_0x4c21cc})[_0x57e0('0x2a')](function(){return BPromise[_0x57e0('0x72')](_0x163e84,function(_0x58d0b5){return db[_0x57e0('0x73')][_0x57e0('0x74')]({'where':{'UserId':_0x58d0b5['id'],'VoiceQueueId':_0x3b9b31[_0x57e0('0x58')]['id']},'defaults':{'penalty':_0x58d0b5['penalty']},'transaction':_0x4c21cc});});})['then'](function(){return BPromise['each'](_[_0x57e0('0x2e')](_0x163e84,{'online':!![]}),function(_0x497bb8){return db[_0x57e0('0x75')][_0x57e0('0x76')]({'membername':_0x497bb8[_0x57e0('0x34')],'UserId':_0x497bb8['id'],'queue_name':_0x2f420d[_0x57e0('0x34')],'VoiceQueueId':_0x2f420d['id'],'interface':_[_0x57e0('0x77')](_0x497bb8['interface'])?util['format']('SIP/%s',_0x497bb8[_0x57e0('0x34')]):_0x497bb8[_0x57e0('0x6d')],'paused':_0x497bb8[_0x57e0('0x6c')]||![],'penalty':_0x497bb8[_0x57e0('0x6f')]},{'transaction':_0x4c21cc});});})[_0x57e0('0x2a')](function(){_0x163e84[_0x57e0('0x78')](function(_0x2617b3){socket[_0x57e0('0x79')](_0x57e0('0x7a'),{'UserId':_0x2617b3['id'],'VoiceQueueId':_0x2f420d['id']});});});});});}})[_0x57e0('0x2a')](respondWithStatusCode(_0x12ce49,null))[_0x57e0('0x4b')](handleError(_0x12ce49,null));};exports[_0x57e0('0x7b')]=function(_0x47f129,_0x16731a,_0x5dcc21){return db[_0x57e0('0x68')]['findAll']({'where':{'id':_0x47f129[_0x57e0('0x3a')][_0x57e0('0x7c')]},'attributes':['id'],'include':[{'model':db[_0x57e0('0x6a')],'as':_0x57e0('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x57e0('0x2a')](handleEntityNotFound(_0x16731a,null))[_0x57e0('0x2a')](function(_0x1e3967){var _0x4d358d=_['map'](_0x1e3967,'id');var _0x1e71df=[];var _0x5de2d6=[];var _0x5dfa0b=squel[_0x57e0('0x7d')]();_0x5dfa0b[_0x57e0('0x7e')](_0x57e0('0x7f'))[_0x57e0('0x80')](_0x57e0('0x81'),'tq')['join'](_0x57e0('0x82'),'ut',_0x57e0('0x83'))[_0x57e0('0x42')](_0x57e0('0x84'),_0x47f129[_0x57e0('0x58')]['id']);for(var _0x48a7b2=0x0;_0x48a7b2<_0x1e3967[_0x57e0('0x3f')];_0x48a7b2+=0x1){let _0x50e222=_0x1e3967[_0x48a7b2];for(var _0x5da0b3=0x0;_0x5da0b3<_0x50e222[_0x57e0('0x6b')]['length'];_0x5da0b3+=0x1){let _0x1be559=_0x50e222[_0x57e0('0x6b')][_0x5da0b3];var _0x4520c4=_0x5dfa0b['clone']();_0x4520c4['where'](_0x57e0('0x85'),_0x1be559['id']);_0x5de2d6[_0x57e0('0x86')](db['sequelize'][_0x57e0('0x3a')](_0x4520c4[_0x57e0('0x87')](),{'type':db['sequelize'][_0x57e0('0x88')][_0x57e0('0x89')]})['then'](function(_0x5054ed){if(_0x5054ed[_0x57e0('0x3f')]===0x1){return _0x1be559['id'];}else{var _0x2f8306=_[_0x57e0('0x8a')](_[_0x57e0('0x2f')](_0x5054ed,'TeamId'),function(_0x1156d6){return _[_0x57e0('0x31')](_0x4d358d,_0x1156d6);});if(_0x2f8306){return _0x1be559['id'];}}}));}}return BPromise[_0x57e0('0x8b')](_0x5de2d6)[_0x57e0('0x2a')](function(_0x479588){_0x1e71df=_(_0x1e71df)[_0x57e0('0x8c')](_0x479588)[_0x57e0('0x8d')]()[_0x57e0('0x30')]();return db[_0x57e0('0x47')]['find']({'where':{'id':_0x47f129[_0x57e0('0x58')]['id']}})[_0x57e0('0x2a')](function(_0x2c3bdf){return db[_0x57e0('0x8e')][_0x57e0('0x70')](function(_0x174d79){return _0x2c3bdf[_0x57e0('0x7b')](_0x47f129[_0x57e0('0x3a')]['ids'],{'transaction':_0x174d79})[_0x57e0('0x2a')](function(){if(!_[_0x57e0('0x8f')](_0x1e71df)){return _0x2c3bdf['removeAgents'](_0x1e71df,{'transaction':_0x174d79})[_0x57e0('0x2a')](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x47f129[_0x57e0('0x58')]['id'],'UserId':_0x1e71df},'transaction':_0x174d79});});}})[_0x57e0('0x2a')](function(){_0x1e71df[_0x57e0('0x78')](function(_0x4f2fdb){socket[_0x57e0('0x79')](_0x57e0('0x90'),{'UserId':_0x4f2fdb,'VoiceQueueId':_0x2c3bdf['id']});});});});});});})[_0x57e0('0x2a')](respondWithStatusCode(_0x16731a,null))['catch'](handleError(_0x16731a,null));};exports[_0x57e0('0x91')]=function(_0x785841,_0x2ed700,_0x43712d){var _0x23f75f,_0x107f7a;return db[_0x57e0('0x47')]['find']({'where':{'id':_0x785841[_0x57e0('0x58')]['id']}})[_0x57e0('0x2a')](handleEntityNotFound(_0x2ed700,null))[_0x57e0('0x2a')](function(_0x2e4798){if(_0x2e4798){_0x107f7a=_0x2e4798;return _0x2e4798[_0x57e0('0x91')](_0x785841[_0x57e0('0x5b')]['ids'],_[_0x57e0('0x59')](_0x785841[_0x57e0('0x5b')],['ids','id'])||{})[_0x57e0('0x92')](function(_0x274b1d){for(var _0x367dc4=0x0;_0x367dc4<_0x785841[_0x57e0('0x5b')]['ids'][_0x57e0('0x3f')];_0x367dc4+=0x1){socket[_0x57e0('0x79')]('userVoiceQueue:save',{'UserId':_0x785841['body'][_0x57e0('0x7c')][_0x367dc4],'VoiceQueueId':_0x785841[_0x57e0('0x58')]['id']});}return _0x274b1d;});}})[_0x57e0('0x2a')](function(_0x43c761){_0x23f75f=_0x43c761||[];if(_0x107f7a){return db[_0x57e0('0x6a')]['findAll']({'where':{'id':_0x785841[_0x57e0('0x5b')]['ids']},'attributes':['id',_0x57e0('0x34'),_0x57e0('0x93'),_0x57e0('0x6c'),_0x57e0('0x6d')],'raw':!![]});}})[_0x57e0('0x2a')](function(_0x1b61e5){if(!_[_0x57e0('0x8f')](_0x1b61e5)){var _0x428205=[];for(var _0x22c79e=0x0;_0x22c79e<_0x1b61e5[_0x57e0('0x3f')];_0x22c79e++){if(_0x1b61e5[_0x22c79e][_0x57e0('0x93')]){_0x428205['push'](db[_0x57e0('0x75')][_0x57e0('0x76')]({'membername':_0x1b61e5[_0x22c79e][_0x57e0('0x34')],'UserId':_0x1b61e5[_0x22c79e]['id'],'queue_name':_0x107f7a[_0x57e0('0x34')],'VoiceQueueId':_0x107f7a['id'],'interface':_[_0x57e0('0x77')](_0x1b61e5[_0x22c79e]['interface'])?util[_0x57e0('0x94')](_0x57e0('0x95'),_0x1b61e5[_0x22c79e]['name']):_0x1b61e5[_0x22c79e][_0x57e0('0x6d')],'paused':_0x1b61e5[_0x22c79e]['voicePause']||![],'penalty':_0x785841['body'][_0x57e0('0x6f')]||0x0}));}}return BPromise['all'](_0x428205);}})[_0x57e0('0x2a')](function(){return _0x23f75f;})['then'](respondWithResult(_0x2ed700,null))[_0x57e0('0x4b')](handleError(_0x2ed700,null));};exports[_0x57e0('0x96')]=function(_0x52dced,_0x36e472,_0x370dab){return db[_0x57e0('0x47')][_0x57e0('0x32')]({'where':{'id':_0x52dced[_0x57e0('0x58')]['id']}})[_0x57e0('0x2a')](handleEntityNotFound(_0x36e472,null))['then'](function(_0x34a5c0){if(_0x34a5c0){return _0x34a5c0[_0x57e0('0x96')](_0x52dced['query']['ids'])[_0x57e0('0x2a')](function(){if(_[_0x57e0('0x97')](_0x52dced[_0x57e0('0x3a')][_0x57e0('0x7c')])){for(var _0x39ad8f=0x0;_0x39ad8f<_0x52dced[_0x57e0('0x3a')][_0x57e0('0x7c')][_0x57e0('0x3f')];_0x39ad8f+=0x1){socket[_0x57e0('0x79')](_0x57e0('0x90'),{'UserId':Number(_0x52dced[_0x57e0('0x3a')]['ids'][_0x39ad8f]),'VoiceQueueId':Number(_0x52dced[_0x57e0('0x58')]['id'])});}}else{socket['emit'](_0x57e0('0x90'),{'UserId':Number(_0x52dced[_0x57e0('0x3a')][_0x57e0('0x7c')]),'VoiceQueueId':Number(_0x52dced[_0x57e0('0x58')]['id'])});}});}})[_0x57e0('0x2a')](function(_0x4dd44b){return db['UserVoiceQueueRt'][_0x57e0('0x29')]({'where':{'VoiceQueueId':_0x52dced[_0x57e0('0x58')]['id'],'UserId':_0x52dced[_0x57e0('0x3a')]['ids']}})[_0x57e0('0x2a')](function(){return _0x4dd44b;});})[_0x57e0('0x2a')](respondWithStatusCode(_0x36e472,null))[_0x57e0('0x4b')](handleError(_0x36e472,null));};exports[_0x57e0('0x98')]=function(_0x6a614d,_0x2aaf99,_0x547237){var _0xde415c={};var _0xc97ff6={};var _0x3e2c44;var _0x5433ad;return db[_0x57e0('0x47')][_0x57e0('0x64')]({'where':{'id':_0x6a614d[_0x57e0('0x58')]['id']}})[_0x57e0('0x2a')](handleEntityNotFound(_0x2aaf99,null))[_0x57e0('0x2a')](function(_0x13e34a){if(_0x13e34a){_0x3e2c44=_0x13e34a;_0xc97ff6[_0x57e0('0x39')]=_[_0x57e0('0x3b')](db[_0x57e0('0x6a')][_0x57e0('0x36')]);_0xc97ff6[_0x57e0('0x3a')]=_[_0x57e0('0x3b')](_0x6a614d[_0x57e0('0x3a')]);_0xc97ff6['filters']=_[_0x57e0('0x3c')](_0xc97ff6['model'],_0xc97ff6[_0x57e0('0x3a')]);_0xde415c[_0x57e0('0x3e')]=_[_0x57e0('0x3c')](_0xc97ff6[_0x57e0('0x39')],qs['fields'](_0x6a614d[_0x57e0('0x3a')]['fields']));_0xde415c[_0x57e0('0x3e')]=_0xde415c[_0x57e0('0x3e')]['length']?_0xde415c[_0x57e0('0x3e')]:_0xc97ff6['model'];_0xde415c[_0x57e0('0x61')]=qs[_0x57e0('0x41')](_0x6a614d[_0x57e0('0x3a')]['sort']);_0xde415c[_0x57e0('0x42')]=qs['filters'](_[_0x57e0('0x44')](_0x6a614d[_0x57e0('0x3a')],_0xc97ff6['filters']));if(_0x6a614d[_0x57e0('0x3a')][_0x57e0('0x2e')]){_0xde415c['where']=_[_0x57e0('0x45')](_0xde415c[_0x57e0('0x42')],{'$or':_['map'](_0xde415c[_0x57e0('0x3e')],function(_0x35dd01){var _0x53457={};_0x53457[_0x35dd01]={'$like':'%'+_0x6a614d[_0x57e0('0x3a')][_0x57e0('0x2e')]+'%'};return _0x53457;})});}_0xde415c=_[_0x57e0('0x45')]({},_0xde415c,_0x6a614d[_0x57e0('0x46')]);return _0x3e2c44[_0x57e0('0x98')](_0xde415c);}})[_0x57e0('0x2a')](function(_0xf78d35){if(_0xf78d35){_0x5433ad=_0xf78d35['length'];if(!_0x6a614d[_0x57e0('0x3a')][_0x57e0('0x40')](_0x57e0('0x60'))){_0xde415c['limit']=qs[_0x57e0('0x22')](_0x6a614d[_0x57e0('0x3a')][_0x57e0('0x22')]);_0xde415c[_0x57e0('0x21')]=qs[_0x57e0('0x21')](_0x6a614d[_0x57e0('0x3a')]['offset']);}return _0x3e2c44[_0x57e0('0x98')](_0xde415c);}})[_0x57e0('0x2a')](function(_0x20bc27){if(_0x20bc27){return _0x20bc27?{'count':_0x5433ad,'rows':_0x20bc27}:null;}})[_0x57e0('0x2a')](respondWithResult(_0x2aaf99,null))['catch'](handleError(_0x2aaf99,null));};exports[_0x57e0('0x99')]=function(_0x3131a8,_0xc43a50,_0x4c780c){var _0x1d2c50={};var _0x68a385={};var _0x5e804f;var _0x5e961c;return db[_0x57e0('0x47')][_0x57e0('0x64')]({'where':{'id':_0x3131a8[_0x57e0('0x58')]['id']}})[_0x57e0('0x2a')](handleEntityNotFound(_0xc43a50,null))['then'](function(_0x241afc){if(_0x241afc){_0x5e804f=_0x241afc;_0x68a385['model']=_['keys'](db['UserVoiceQueueRt'][_0x57e0('0x36')]);_0x68a385[_0x57e0('0x3a')]=_['keys'](_0x3131a8[_0x57e0('0x3a')]);_0x68a385['filters']=_[_0x57e0('0x3c')](_0x68a385[_0x57e0('0x39')],_0x68a385[_0x57e0('0x3a')]);_0x1d2c50[_0x57e0('0x3e')]=_[_0x57e0('0x3c')](_0x68a385[_0x57e0('0x39')],qs[_0x57e0('0x3d')](_0x3131a8[_0x57e0('0x3a')]['fields']));_0x1d2c50[_0x57e0('0x3e')]=_0x1d2c50[_0x57e0('0x3e')][_0x57e0('0x3f')]?_0x1d2c50[_0x57e0('0x3e')]:_0x68a385[_0x57e0('0x39')];_0x1d2c50[_0x57e0('0x61')]=qs[_0x57e0('0x41')](_0x3131a8[_0x57e0('0x3a')]['sort']);_0x1d2c50[_0x57e0('0x42')]=qs[_0x57e0('0x43')](_[_0x57e0('0x44')](_0x3131a8[_0x57e0('0x3a')],_0x68a385['filters']));if(_0x3131a8[_0x57e0('0x3a')]['filter']){_0x1d2c50[_0x57e0('0x42')]=_[_0x57e0('0x45')](_0x1d2c50[_0x57e0('0x42')],{'$or':_['map'](_0x1d2c50[_0x57e0('0x3e')],function(_0x245002){var _0x53a052={};_0x53a052[_0x245002]={'$like':'%'+_0x3131a8[_0x57e0('0x3a')][_0x57e0('0x2e')]+'%'};return _0x53a052;})});}_0x1d2c50=_[_0x57e0('0x45')]({},_0x1d2c50,_0x3131a8[_0x57e0('0x46')]);return _0x5e804f[_0x57e0('0x99')](_0x1d2c50);}})[_0x57e0('0x2a')](function(_0x145cc6){if(_0x145cc6){_0x5e961c=_0x145cc6['length'];if(!_0x3131a8[_0x57e0('0x3a')]['hasOwnProperty'](_0x57e0('0x60'))){_0x1d2c50[_0x57e0('0x22')]=qs[_0x57e0('0x22')](_0x3131a8[_0x57e0('0x3a')]['limit']);_0x1d2c50[_0x57e0('0x21')]=qs[_0x57e0('0x21')](_0x3131a8[_0x57e0('0x3a')][_0x57e0('0x21')]);}return _0x5e804f[_0x57e0('0x99')](_0x1d2c50);}})[_0x57e0('0x2a')](function(_0x202612){return _0x202612?{'count':_0x5e961c,'rows':_0x202612}:null;})[_0x57e0('0x2a')](respondWithResult(_0xc43a50,null))['catch'](handleError(_0xc43a50,null));};exports[_0x57e0('0x9a')]=function(_0x5e71c3,_0x215bdc,_0x9bcde7){var _0x5166bf={};var _0xf13fd8={};var _0x47e457;var _0x18bca9;return db['VoiceQueue'][_0x57e0('0x64')]({'where':{'id':_0x5e71c3['params']['id']}})[_0x57e0('0x2a')](handleEntityNotFound(_0x215bdc,null))['then'](function(_0x389a3f){if(_0x389a3f){_0x47e457=_0x389a3f;_0xf13fd8[_0x57e0('0x39')]=_[_0x57e0('0x3b')](db['CmList'][_0x57e0('0x36')]);_0xf13fd8[_0x57e0('0x3a')]=_[_0x57e0('0x3b')](_0x5e71c3[_0x57e0('0x3a')]);_0xf13fd8[_0x57e0('0x43')]=_[_0x57e0('0x3c')](_0xf13fd8[_0x57e0('0x39')],_0xf13fd8[_0x57e0('0x3a')]);_0x5166bf[_0x57e0('0x3e')]=_[_0x57e0('0x3c')](_0xf13fd8['model'],qs[_0x57e0('0x3d')](_0x5e71c3[_0x57e0('0x3a')][_0x57e0('0x3d')]));_0x5166bf['attributes']=_0x5166bf[_0x57e0('0x3e')][_0x57e0('0x3f')]?_0x5166bf['attributes']:_0xf13fd8[_0x57e0('0x39')];_0x5166bf[_0x57e0('0x61')]=qs[_0x57e0('0x41')](_0x5e71c3[_0x57e0('0x3a')]['sort']);_0x5166bf[_0x57e0('0x42')]=qs[_0x57e0('0x43')](_[_0x57e0('0x44')](_0x5e71c3[_0x57e0('0x3a')],_0xf13fd8['filters']));if(_0x5e71c3[_0x57e0('0x3a')][_0x57e0('0x2e')]){_0x5166bf[_0x57e0('0x42')]=_[_0x57e0('0x45')](_0x5166bf[_0x57e0('0x42')],{'$or':_[_0x57e0('0x2f')](_0x5166bf[_0x57e0('0x3e')],function(_0x4be7f1){var _0x1121ca={};_0x1121ca[_0x4be7f1]={'$like':'%'+_0x5e71c3[_0x57e0('0x3a')][_0x57e0('0x2e')]+'%'};return _0x1121ca;})});}_0x5166bf=_[_0x57e0('0x45')]({},_0x5166bf,_0x5e71c3[_0x57e0('0x46')]);return _0x47e457['getLists'](_0x5166bf);}})[_0x57e0('0x2a')](function(_0x3630e6){if(_0x3630e6){_0x18bca9=_0x3630e6[_0x57e0('0x3f')];if(!_0x5e71c3[_0x57e0('0x3a')][_0x57e0('0x40')]('nolimit')){_0x5166bf['limit']=qs[_0x57e0('0x22')](_0x5e71c3[_0x57e0('0x3a')][_0x57e0('0x22')]);_0x5166bf[_0x57e0('0x21')]=qs[_0x57e0('0x21')](_0x5e71c3[_0x57e0('0x3a')][_0x57e0('0x21')]);}return _0x47e457[_0x57e0('0x9a')](_0x5166bf);}})[_0x57e0('0x2a')](function(_0x12c7c1){if(_0x12c7c1){return _0x12c7c1?{'count':_0x18bca9,'rows':_0x12c7c1}:null;}})[_0x57e0('0x2a')](respondWithResult(_0x215bdc,null))[_0x57e0('0x4b')](handleError(_0x215bdc,null));};exports['addLists']=function(_0x1dc6cd,_0x12a4f4,_0x27f837){var _0x334760,_0x22d901;return db[_0x57e0('0x47')][_0x57e0('0x32')]({'where':{'id':_0x1dc6cd['params']['id']}})['then'](handleEntityNotFound(_0x12a4f4,null))[_0x57e0('0x2a')](function(_0x37273e){if(_0x37273e){_0x22d901=_0x37273e;return _0x37273e[_0x57e0('0x9b')](_0x1dc6cd['body'][_0x57e0('0x7c')],_[_0x57e0('0x59')](_0x1dc6cd[_0x57e0('0x5b')],['ids','id'])||{});}return null;})[_0x57e0('0x92')](function(_0x57c6a3){var _0x284e58;_0x334760=_0x57c6a3||[];var _0x3cd3d1=[];if(_0x57c6a3){for(var _0x407a52=0x0;_0x407a52<_0x57c6a3['length'];_0x407a52+=0x1){var _0x5b345d=_0x57c6a3[_0x407a52][_0x57e0('0x2b')]({'plain':!![]});_0x22d901[_0x57e0('0x9c')]=_0x1dc6cd[_0x57e0('0x5b')]['dialCheckDuplicateType']?_0x1dc6cd[_0x57e0('0x5b')]['dialCheckDuplicateType']:_0x22d901['dialCheckDuplicateType'];switch(_0x22d901['dialCheckDuplicateType']){case _0x57e0('0x9d'):_0x284e58=squel[_0x57e0('0x9e')]()[_0x57e0('0x9f')](_0x57e0('0xa0'))[_0x57e0('0xa1')]([_0x57e0('0xa2'),_0x57e0('0xa3'),'ContactId',_0x57e0('0xa4'),_0x57e0('0x62'),_0x57e0('0x5a'),_0x57e0('0x5c')],squel[_0x57e0('0x7d')]()[_0x57e0('0x7e')]('phone',_0x57e0('0xa2'))['field'](_0x57e0('0xa5'),_0x57e0('0xa3'))[_0x57e0('0x7e')]('id',_0x57e0('0xa6'))[_0x57e0('0x7e')](_0x5b345d[_0x57e0('0xa7')][_0x57e0('0x87')](),_0x57e0('0xa4'))['field'](_0x1dc6cd[_0x57e0('0x58')]['id'][_0x57e0('0x87')](),_0x57e0('0x62'))['field']('NOW()',_0x57e0('0x5a'))['field'](_0x57e0('0xa5'),'updatedAt')['from'](_0x57e0('0xa8'))[_0x57e0('0x42')]('deletedAt\x20IS\x20NULL')[_0x57e0('0x42')](_0x57e0('0xa9'),_0x5b345d['CmListId'][_0x57e0('0x87')]())[_0x57e0('0x42')](_0x57e0('0xaa'))[_0x57e0('0x42')](_0x57e0('0xab'),squel['select']()[_0x57e0('0x7e')](_0x57e0('0xac'))['from'](_0x57e0('0xad'))['where']('VoiceQueueId\x20=\x20?',_0x1dc6cd['params']['id'][_0x57e0('0x87')]()))['where'](_0x57e0('0xab'),squel[_0x57e0('0x7d')]()['field']('COALESCE(phone,\x27\x27)')['from'](_0x57e0('0xa0'))[_0x57e0('0x42')](_0x57e0('0x84'),_0x1dc6cd[_0x57e0('0x58')]['id']['toString']())))[_0x57e0('0x87')]();break;case _0x57e0('0xae'):_0x284e58=squel[_0x57e0('0x9e')]()[_0x57e0('0x9f')](_0x57e0('0xa0'))[_0x57e0('0xa1')]([_0x57e0('0xa2'),'scheduledAt',_0x57e0('0xa6'),_0x57e0('0xa4'),'VoiceQueueId',_0x57e0('0x5a'),_0x57e0('0x5c')],squel[_0x57e0('0x7d')]()[_0x57e0('0x7e')](_0x57e0('0xa2'),_0x57e0('0xa2'))['field'](_0x57e0('0xa5'),_0x57e0('0xa3'))[_0x57e0('0x7e')]('id',_0x57e0('0xa6'))['field'](_0x5b345d[_0x57e0('0xa7')][_0x57e0('0x87')](),_0x57e0('0xa4'))[_0x57e0('0x7e')](_0x1dc6cd[_0x57e0('0x58')]['id'][_0x57e0('0x87')](),_0x57e0('0x62'))[_0x57e0('0x7e')](_0x57e0('0xa5'),'createdAt')[_0x57e0('0x7e')](_0x57e0('0xa5'),_0x57e0('0x5c'))['from'](_0x57e0('0xa8'))[_0x57e0('0x42')]('deletedAt\x20IS\x20NULL')[_0x57e0('0x42')](_0x57e0('0xa9'),_0x5b345d[_0x57e0('0xa7')][_0x57e0('0x87')]())[_0x57e0('0x42')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x57e0('0xab'),squel[_0x57e0('0x7d')]()[_0x57e0('0x7e')]('COALESCE(phone,\x27\x27)')[_0x57e0('0x80')](_0x57e0('0xa0'))['where']('VoiceQueueId\x20=\x20?',_0x1dc6cd[_0x57e0('0x58')]['id'][_0x57e0('0x87')]())))[_0x57e0('0x87')]();break;default:_0x284e58=squel[_0x57e0('0x9e')]()[_0x57e0('0x9f')](_0x57e0('0xa0'))[_0x57e0('0xa1')]([_0x57e0('0xa2'),_0x57e0('0xa3'),'ContactId',_0x57e0('0xa4'),_0x57e0('0x62'),_0x57e0('0x5a'),_0x57e0('0x5c')],squel[_0x57e0('0x7d')]()[_0x57e0('0x7e')]('phone',_0x57e0('0xa2'))[_0x57e0('0x7e')](_0x57e0('0xa5'),_0x57e0('0xa3'))['field']('id',_0x57e0('0xa6'))[_0x57e0('0x7e')](_0x5b345d['CmListId'][_0x57e0('0x87')](),_0x57e0('0xa4'))[_0x57e0('0x7e')](_0x1dc6cd[_0x57e0('0x58')]['id'][_0x57e0('0x87')](),_0x57e0('0x62'))[_0x57e0('0x7e')]('NOW()',_0x57e0('0x5a'))[_0x57e0('0x7e')](_0x57e0('0xa5'),_0x57e0('0x5c'))['from'](_0x57e0('0xa8'))[_0x57e0('0x42')](_0x57e0('0xaf'))[_0x57e0('0x42')]('ListId\x20=\x20?',_0x5b345d[_0x57e0('0xa7')]['toString']())[_0x57e0('0x42')](_0x57e0('0xaa')))['toString']();}_0x3cd3d1[_0x57e0('0x86')](db[_0x57e0('0x8e')][_0x57e0('0x3a')](_0x284e58));}return BPromise[_0x57e0('0x8b')](_0x3cd3d1);}})[_0x57e0('0x2a')](function(){return _0x334760;})[_0x57e0('0x2a')](respondWithResult(_0x12a4f4,null))['catch'](handleError(_0x12a4f4,null));};exports['removeLists']=function(_0x57f836,_0x22a6d1,_0xe310ee){return db['VoiceQueue'][_0x57e0('0x32')]({'where':{'id':_0x57f836[_0x57e0('0x58')]['id']}})[_0x57e0('0x2a')](handleEntityNotFound(_0x22a6d1,null))[_0x57e0('0x2a')](function(_0x215a09){if(_0x215a09){return _0x215a09[_0x57e0('0xb0')](_0x57f836[_0x57e0('0x3a')][_0x57e0('0x7c')]);}})[_0x57e0('0x2a')](function(_0x9b7f37){if(_0x9b7f37){return db[_0x57e0('0x5f')][_0x57e0('0x29')]({'where':{'ListId':_0x57f836[_0x57e0('0x3a')]['ids'],'VoiceQueueId':_0x57f836[_0x57e0('0x58')]['id']}})[_0x57e0('0x2a')](function(){return _0x9b7f37;});}})[_0x57e0('0x2a')](respondWithStatusCode(_0x22a6d1,null))['catch'](handleError(_0x22a6d1,null));};exports[_0x57e0('0xb1')]=function(_0x46f2be,_0x149e4a,_0x3d6c0b){var _0x4038d8={};var _0x38f6ae={};var _0x2c720b;var _0x4e3245;return db['VoiceQueue'][_0x57e0('0x64')]({'where':{'id':_0x46f2be[_0x57e0('0x58')]['id']}})[_0x57e0('0x2a')](handleEntityNotFound(_0x149e4a,null))['then'](function(_0x283c05){if(_0x283c05){_0x2c720b=_0x283c05;_0x38f6ae[_0x57e0('0x39')]=_[_0x57e0('0x3b')](db[_0x57e0('0xb2')][_0x57e0('0x36')]);_0x38f6ae[_0x57e0('0x3a')]=_[_0x57e0('0x3b')](_0x46f2be[_0x57e0('0x3a')]);_0x38f6ae['filters']=_[_0x57e0('0x3c')](_0x38f6ae[_0x57e0('0x39')],_0x38f6ae['query']);_0x4038d8['attributes']=_[_0x57e0('0x3c')](_0x38f6ae['model'],qs[_0x57e0('0x3d')](_0x46f2be[_0x57e0('0x3a')][_0x57e0('0x3d')]));_0x4038d8[_0x57e0('0x3e')]=_0x4038d8[_0x57e0('0x3e')]['length']?_0x4038d8[_0x57e0('0x3e')]:_0x38f6ae[_0x57e0('0x39')];_0x4038d8[_0x57e0('0x61')]=qs['sort'](_0x46f2be['query'][_0x57e0('0x41')]);_0x4038d8[_0x57e0('0x42')]=qs[_0x57e0('0x43')](_[_0x57e0('0x44')](_0x46f2be[_0x57e0('0x3a')],_0x38f6ae[_0x57e0('0x43')]));if(_0x46f2be['query'][_0x57e0('0x2e')]){_0x4038d8[_0x57e0('0x42')]=_[_0x57e0('0x45')](_0x4038d8[_0x57e0('0x42')],{'$or':_['map'](_0x4038d8['attributes'],function(_0x43c531){var _0x2bd817={};_0x2bd817[_0x43c531]={'$like':'%'+_0x46f2be['query'][_0x57e0('0x2e')]+'%'};return _0x2bd817;})});}_0x4038d8=_[_0x57e0('0x45')]({},_0x4038d8,_0x46f2be[_0x57e0('0x46')]);return _0x2c720b[_0x57e0('0xb1')](_0x4038d8);}})['then'](function(_0x181006){if(_0x181006){_0x4e3245=_0x181006[_0x57e0('0x3f')];if(!_0x46f2be[_0x57e0('0x3a')][_0x57e0('0x40')]('nolimit')){_0x4038d8['limit']=qs[_0x57e0('0x22')](_0x46f2be['query']['limit']);_0x4038d8[_0x57e0('0x21')]=qs['offset'](_0x46f2be[_0x57e0('0x3a')][_0x57e0('0x21')]);}return _0x2c720b[_0x57e0('0xb1')](_0x4038d8);}})[_0x57e0('0x2a')](function(_0x203c83){if(_0x203c83){return _0x203c83?{'count':_0x4e3245,'rows':_0x203c83}:null;}})[_0x57e0('0x2a')](respondWithResult(_0x149e4a,null))['catch'](handleError(_0x149e4a,null));};exports[_0x57e0('0xb3')]=function(_0x265359,_0xd4c176,_0x195338){var _0x2615f5,_0x520a8c;return db['VoiceQueue']['find']({'where':{'id':_0x265359[_0x57e0('0x58')]['id']}})['then'](handleEntityNotFound(_0xd4c176,null))[_0x57e0('0x2a')](function(_0x36a993){if(_0x36a993){_0x520a8c=_0x36a993;return _0x36a993['addBlackLists'](_0x265359[_0x57e0('0x5b')]['ids'],_[_0x57e0('0x59')](_0x265359[_0x57e0('0x5b')],[_0x57e0('0x7c'),'id'])||{});}return null;})[_0x57e0('0x92')](function(_0x5dcee5){var _0x5bd83a;_0x2615f5=_0x5dcee5||[];var _0x431f5a=[];if(_0x5dcee5){for(var _0x51ef6a=0x0;_0x51ef6a<_0x5dcee5[_0x57e0('0x3f')];_0x51ef6a+=0x1){var _0x59effe=_0x5dcee5[_0x51ef6a]['get']({'plain':!![]});_0x5bd83a=squel[_0x57e0('0x9e')]()['into'](_0x57e0('0xb4'))[_0x57e0('0xa1')]([_0x57e0('0xa2'),_0x57e0('0xa6'),'ListId','VoiceQueueId',_0x57e0('0x5a'),_0x57e0('0x5c')],squel['select']()[_0x57e0('0x7e')]('phone',_0x57e0('0xa2'))['field']('id',_0x57e0('0xa6'))['field'](_0x59effe[_0x57e0('0xa7')][_0x57e0('0x87')](),_0x57e0('0xa4'))[_0x57e0('0x7e')](_0x265359[_0x57e0('0x58')]['id']['toString'](),'VoiceQueueId')[_0x57e0('0x7e')](_0x57e0('0xa5'),_0x57e0('0x5a'))['field'](_0x57e0('0xa5'),_0x57e0('0x5c'))[_0x57e0('0x80')](_0x57e0('0xa8'))[_0x57e0('0x42')](_0x57e0('0xaf'))[_0x57e0('0x42')](_0x57e0('0xa9'),_0x59effe['CmListId']['toString']())[_0x57e0('0x42')](_0x57e0('0xaa')))[_0x57e0('0x87')]();_0x431f5a['push'](db['sequelize']['query'](_0x5bd83a));}return BPromise['all'](_0x431f5a);}})[_0x57e0('0x2a')](function(){return _0x2615f5;})[_0x57e0('0x2a')](respondWithResult(_0xd4c176,null))[_0x57e0('0x4b')](handleError(_0xd4c176,null));};exports[_0x57e0('0xb5')]=function(_0x193a8e,_0x103abe,_0x226bc1){return db[_0x57e0('0x47')][_0x57e0('0x32')]({'where':{'id':_0x193a8e[_0x57e0('0x58')]['id']}})[_0x57e0('0x2a')](handleEntityNotFound(_0x103abe,null))[_0x57e0('0x2a')](function(_0x1f5050){if(_0x1f5050){return _0x1f5050[_0x57e0('0xb5')](_0x193a8e[_0x57e0('0x3a')][_0x57e0('0x7c')]);}})[_0x57e0('0x2a')](function(_0x267693){if(_0x267693){return db[_0x57e0('0x66')][_0x57e0('0x29')]({'where':{'ListId':_0x193a8e[_0x57e0('0x3a')]['ids'],'VoiceQueueId':_0x193a8e[_0x57e0('0x58')]['id']}})[_0x57e0('0x2a')](function(){return _0x267693;});}})[_0x57e0('0x2a')](respondWithStatusCode(_0x103abe,null))[_0x57e0('0x4b')](handleError(_0x103abe,null));}; \ No newline at end of file +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 diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 0006bee..a10a998 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 _0x21a9=['remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners','save'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x21a9,0x135));var _0x921a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x21a9[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0x921a('0x0'));var VoiceQueue=require('../../mysqldb')['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x921a('0x1')](0x0);var events={'afterCreate':_0x921a('0x2'),'afterUpdate':'update','afterDestroy':_0x921a('0x3')};function emitEvent(_0x13f2b7){return function(_0x5554b1,_0x42c5fb,_0x253209){VoiceQueueEvents[_0x921a('0x4')](_0x13f2b7+':'+_0x5554b1['id'],_0x5554b1);VoiceQueueEvents[_0x921a('0x4')](_0x13f2b7,_0x5554b1);_0x253209(null);};}for(var e in events){if(events[_0x921a('0x5')](e)){var event=events[e];VoiceQueue[_0x921a('0x6')](e,emitEvent(event));}}module[_0x921a('0x7')]=VoiceQueueEvents; \ No newline at end of file +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 diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index eac9507..fefdb34 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 _0xd512=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','VoiceQueue','voice_queues','lodash','util','../../config/logger','api','moment'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0xd512,0xf2));var _0x2d51=function(_0x2f2d88,_0x32815c){_0x2f2d88=_0x2f2d88-0x0;var _0x4742ee=_0xd512[_0x2f2d88];return _0x4742ee;};'use strict';var _=require(_0x2d51('0x0'));var util=require(_0x2d51('0x1'));var logger=require(_0x2d51('0x2'))(_0x2d51('0x3'));var moment=require(_0x2d51('0x4'));var BPromise=require(_0x2d51('0x5'));var rp=require(_0x2d51('0x6'));var fs=require('fs');var path=require(_0x2d51('0x7'));var rimraf=require(_0x2d51('0x8'));var config=require(_0x2d51('0x9'));var attributes=require(_0x2d51('0xa'));module['exports']=function(_0x84717c,_0x2e6f3e){return _0x84717c['define'](_0x2d51('0xb'),attributes,{'tableName':_0x2d51('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 812c1c3..fe22bb2 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 _0xb33c=['stringify','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','attributes','limit','include','map','model','ShowVoiceQueue','find','where','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x422bbe,_0x196dee){var _0x418adb=function(_0x445775){while(--_0x445775){_0x422bbe['push'](_0x422bbe['shift']());}};_0x418adb(++_0x196dee);}(_0xb33c,0xac));var _0xcb33=function(_0x4edd8b,_0x32b8cd){_0x4edd8b=_0x4edd8b-0x0;var _0x404088=_0xb33c[_0x4edd8b];return _0x404088;};'use strict';var _=require(_0xcb33('0x0'));var util=require(_0xcb33('0x1'));var moment=require(_0xcb33('0x2'));var BPromise=require(_0xcb33('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb33('0x4'));var db=require(_0xcb33('0x5'))['db'];var utils=require(_0xcb33('0x6'));var logger=require(_0xcb33('0x7'))(_0xcb33('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcb33('0x9')][_0xcb33('0xa')]({'port':0x232a});config[_0xcb33('0xb')]=_['defaults'](config[_0xcb33('0xb')],{'host':_0xcb33('0xc'),'port':0x18eb});var socket=require(_0xcb33('0xd'))(new Redis(config[_0xcb33('0xb')]));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0x34780d,_0xe6d3c0,_0x47396b){return new BPromise(function(_0x41ad67,_0x8e7f22){return client['request'](_0x34780d,_0x47396b)['then'](function(_0x16781e){logger[_0xcb33('0xe')](_0xcb33('0xf'),_0xe6d3c0,_0xcb33('0x10'));logger[_0xcb33('0x11')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0xe6d3c0,_0xcb33('0x10'),JSON[_0xcb33('0x12')](_0x16781e));if(_0x16781e[_0xcb33('0x13')]){if(_0x16781e[_0xcb33('0x13')][_0xcb33('0x14')]===0x1f4){logger[_0xcb33('0x13')](_0xcb33('0xf'),_0xe6d3c0,_0x16781e[_0xcb33('0x13')]['message']);return _0x8e7f22(_0x16781e[_0xcb33('0x13')]['message']);}logger[_0xcb33('0x13')](_0xcb33('0xf'),_0xe6d3c0,_0x16781e[_0xcb33('0x13')][_0xcb33('0x15')]);return _0x41ad67(_0x16781e[_0xcb33('0x13')]['message']);}else{logger[_0xcb33('0xe')](_0xcb33('0xf'),_0xe6d3c0,'request\x20sent');_0x41ad67(_0x16781e[_0xcb33('0x16')][_0xcb33('0x15')]);}})[_0xcb33('0x17')](function(_0x1dfda9){logger[_0xcb33('0x13')]('VoiceQueue,\x20%s,\x20%s',_0xe6d3c0,_0x1dfda9);_0x8e7f22(_0x1dfda9);});});}exports[_0xcb33('0x18')]=function(_0x465c1a){var _0x3a59b6=this;return new Promise(function(_0x522c4b,_0x3f5728){return db[_0xcb33('0x19')][_0xcb33('0x1a')]({'raw':_0x465c1a[_0xcb33('0x1b')]?_0x465c1a[_0xcb33('0x1b')][_0xcb33('0x1c')]===undefined?!![]:![]:!![],'where':_0x465c1a['options']?_0x465c1a[_0xcb33('0x1b')]['where']||null:null,'attributes':_0x465c1a[_0xcb33('0x1b')]?_0x465c1a['options'][_0xcb33('0x1d')]||null:null,'limit':_0x465c1a[_0xcb33('0x1b')]?_0x465c1a[_0xcb33('0x1b')][_0xcb33('0x1e')]||null:null,'include':_0x465c1a[_0xcb33('0x1b')]?_0x465c1a[_0xcb33('0x1b')][_0xcb33('0x1f')]?_[_0xcb33('0x20')](_0x465c1a['options'][_0xcb33('0x1f')],function(_0x12f28d){return{'model':db[_0x12f28d['model']],'as':_0x12f28d['as'],'attributes':_0x12f28d['attributes'],'include':_0x12f28d[_0xcb33('0x1f')]?_[_0xcb33('0x20')](_0x12f28d[_0xcb33('0x1f')],function(_0x70fd86){return{'model':db[_0x70fd86[_0xcb33('0x21')]],'as':_0x70fd86['as'],'attributes':_0x70fd86[_0xcb33('0x1d')],'include':_0x70fd86[_0xcb33('0x1f')]?_['map'](_0x70fd86[_0xcb33('0x1f')],function(_0x50a8af){return{'model':db[_0x50a8af[_0xcb33('0x21')]],'as':_0x50a8af['as'],'attributes':_0x50a8af['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x223b8c){logger['info'](_0xcb33('0x18'),_0x465c1a);logger[_0xcb33('0x11')](_0xcb33('0x18'),_0x465c1a,JSON[_0xcb33('0x12')](_0x223b8c));_0x522c4b(_0x223b8c);})[_0xcb33('0x17')](function(_0x3e88ec){logger[_0xcb33('0x13')](_0xcb33('0x18'),_0x3e88ec['message'],_0x465c1a);_0x3f5728(_0x3a59b6[_0xcb33('0x13')](0x1f4,_0x3e88ec[_0xcb33('0x15')]));});});};exports[_0xcb33('0x22')]=function(_0x5656d9){var _0x3996a8=this;return new Promise(function(_0x3e6ac4,_0x1e04b6){return db[_0xcb33('0x19')][_0xcb33('0x23')]({'raw':_0x5656d9[_0xcb33('0x1b')]?_0x5656d9[_0xcb33('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x5656d9[_0xcb33('0x1b')]?_0x5656d9['options'][_0xcb33('0x24')]||null:null,'attributes':_0x5656d9[_0xcb33('0x1b')]?_0x5656d9[_0xcb33('0x1b')][_0xcb33('0x1d')]||null:null,'include':_0x5656d9[_0xcb33('0x1b')]?_0x5656d9[_0xcb33('0x1b')][_0xcb33('0x1f')]?_[_0xcb33('0x20')](_0x5656d9[_0xcb33('0x1b')][_0xcb33('0x1f')],function(_0x2494c5){return{'model':db[_0x2494c5['model']],'as':_0x2494c5['as'],'attributes':_0x2494c5['attributes'],'include':_0x2494c5[_0xcb33('0x1f')]?_['map'](_0x2494c5[_0xcb33('0x1f')],function(_0x54c933){return{'model':db[_0x54c933['model']],'as':_0x54c933['as'],'attributes':_0x54c933[_0xcb33('0x1d')],'include':_0x54c933[_0xcb33('0x1f')]?_[_0xcb33('0x20')](_0x54c933[_0xcb33('0x1f')],function(_0x5d150f){return{'model':db[_0x5d150f[_0xcb33('0x21')]],'as':_0x5d150f['as'],'attributes':_0x5d150f['attributes']};}):[]};}):[]};}):[]:[]})[_0xcb33('0x25')](function(_0xef46d){logger[_0xcb33('0xe')](_0xcb33('0x22'),_0x5656d9);logger[_0xcb33('0x11')]('ShowVoiceQueue',_0x5656d9,JSON[_0xcb33('0x12')](_0xef46d));_0x3e6ac4(_0xef46d);})['catch'](function(_0x609c08){logger[_0xcb33('0x13')](_0xcb33('0x22'),_0x609c08[_0xcb33('0x15')],_0x5656d9);_0x1e04b6(_0x3996a8[_0xcb33('0x13')](0x1f4,_0x609c08[_0xcb33('0x15')]));});});}; \ No newline at end of file +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 diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 964c820..404c156 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 _0x2ac2=['update','emit','register','length','voiceQueue:','save'];(function(_0x1caa74,_0x3c5bd0){var _0x4ec450=function(_0x376070){while(--_0x376070){_0x1caa74['push'](_0x1caa74['shift']());}};_0x4ec450(++_0x3c5bd0);}(_0x2ac2,0x125));var _0x22ac=function(_0x5c0532,_0x2c7fda){_0x5c0532=_0x5c0532-0x0;var _0x4413a7=_0x2ac2[_0x5c0532];return _0x4413a7;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x22ac('0x0'),'remove',_0x22ac('0x1')];function createListener(_0x4ee882,_0x5364ea){return function(_0x587eaa){_0x5364ea[_0x22ac('0x2')](_0x4ee882,_0x587eaa);};}function removeListener(_0x389c76,_0x1f9011){return function(){VoiceQueueEvents['removeListener'](_0x389c76,_0x1f9011);};}exports[_0x22ac('0x3')]=function(_0x12d2c7){for(var _0x3f5c79=0x0,_0x31cf7b=events[_0x22ac('0x4')];_0x3f5c79<_0x31cf7b;_0x3f5c79++){var _0x3c95ca=events[_0x3f5c79];var _0x3c5cc2=createListener(_0x22ac('0x5')+_0x3c95ca,_0x12d2c7);VoiceQueueEvents['on'](_0x3c95ca,_0x3c5cc2);}}; \ No newline at end of file +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 diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 9d7a69c..c20394b 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 _0x49c1=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','index','/describe','isAuthenticated','/index','getVoiceQueuesReport','show','post','put','/:id','update','delete','destroy','multer'];(function(_0x251679,_0x282c51){var _0x4dec93=function(_0x318346){while(--_0x318346){_0x251679['push'](_0x251679['shift']());}};_0x4dec93(++_0x282c51);}(_0x49c1,0xef));var _0x149c=function(_0x334805,_0x2f41d6){_0x334805=_0x334805-0x0;var _0x360002=_0x49c1[_0x334805];return _0x360002;};'use strict';var multer=require(_0x149c('0x0'));var util=require('util');var path=require(_0x149c('0x1'));var timeout=require(_0x149c('0x2'));var express=require(_0x149c('0x3'));var router=express['Router']();var auth=require(_0x149c('0x4'));var interaction=require(_0x149c('0x5'));var config=require('../../config/environment');var controller=require(_0x149c('0x6'));router[_0x149c('0x7')]('/',auth['isAuthenticated'](),controller[_0x149c('0x8')]);router['get'](_0x149c('0x9'),auth[_0x149c('0xa')](),controller['describe']);router[_0x149c('0x7')](_0x149c('0xb'),auth['isAuthenticated'](),controller[_0x149c('0xc')]);router[_0x149c('0x7')]('/:id',auth[_0x149c('0xa')](),controller[_0x149c('0xd')]);router[_0x149c('0xe')]('/',auth[_0x149c('0xa')](),controller['create']);router[_0x149c('0xf')](_0x149c('0x10'),auth[_0x149c('0xa')](),controller[_0x149c('0x11')]);router[_0x149c('0x12')](_0x149c('0x10'),auth[_0x149c('0xa')](),controller[_0x149c('0x13')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index eb55e5f..63f155f 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 _0xa72f=['seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff'];(function(_0x90b954,_0x1fc827){var _0x2e9a2b=function(_0x2ba833){while(--_0x2ba833){_0x90b954['push'](_0x90b954['shift']());}};_0x2e9a2b(++_0x1fc827);}(_0xa72f,0x116));var _0xfa72=function(_0x9d9d58,_0x7bf873){_0x9d9d58=_0x9d9d58-0x0;var _0x51d4d3=_0xa72f[_0x9d9d58];return _0x51d4d3;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xfa72('0x0')]={'type':{'type':Sequelize[_0xfa72('0x1')]},'uniqueid':{'type':Sequelize[_0xfa72('0x1')]},'calleridnum':{'type':Sequelize[_0xfa72('0x1')]},'calleridname':{'type':Sequelize[_0xfa72('0x1')]},'queue':{'type':Sequelize[_0xfa72('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0xfa72('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0xfa72('0x2')],'set':function(_0x425524){var _0x47256b=moment(_0x425524);var _0x37e22b=moment(this['getDataValue'](_0xfa72('0x3')))[_0xfa72('0x4')](_0xfa72('0x5'));var _0x8ecb95=_0x47256b[_0xfa72('0x6')](_0x37e22b,_0xfa72('0x7'));this[_0xfa72('0x8')](_0xfa72('0x9'),_0x425524);this[_0xfa72('0x8')](_0xfa72('0xa'),_0x8ecb95||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0xfa72('0xb')]},'queuecallerabandon':{'type':Sequelize[_0xfa72('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0xfa72('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xfa72('0x2')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0xfa72('0xd')},'originalposition':{'type':Sequelize[_0xfa72('0xb')]},'channel':{'type':Sequelize[_0xfa72('0x1')]},'connectedlinenum':{'type':Sequelize[_0xfa72('0x1')]},'connectedlinename':{'type':Sequelize[_0xfa72('0x1')]},'accountcode':{'type':Sequelize[_0xfa72('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xfa72('0x1')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xfa72('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xfa72('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xfa72('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xfa72('0x1')],'comment':_0xfa72('0xe')},'transferexten':{'type':Sequelize[_0xfa72('0x1')]},'transferuniqueid':{'type':Sequelize[_0xfa72('0x1')]},'disposition':{'type':Sequelize[_0xfa72('0x1')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +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 diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 9680829..89a2af3 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 _0xc4aa=['fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','options','VoiceQueueReport','includeAll','rows','catch','show','rawAttributes','include','find','body','params','describe','getVoiceQueuesReport','nolimit','order','findAll','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','./voiceQueueReport.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map'];(function(_0x402ecb,_0x125110){var _0x2faf3a=function(_0x5eed1c){while(--_0x5eed1c){_0x402ecb['push'](_0x402ecb['shift']());}};_0x2faf3a(++_0x125110);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xc4aa[_0x346737];return _0x1ade2e;};'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);};}exports[_0xac4a('0x2d')]=function(_0x2772fe,_0x116700){var _0x4a5a9e={},_0x47f49c={},_0xdb7e={'count':0x0,'rows':[]};var _0x7a948b=_[_0xac4a('0x2e')](db['VoiceQueueReport']['rawAttributes'],function(_0x355755){return{'name':_0x355755[_0xac4a('0x2f')],'type':_0x355755[_0xac4a('0x30')][_0xac4a('0x31')]};});_0x47f49c[_0xac4a('0x32')]=_['map'](_0x7a948b,_0xac4a('0x2b'));_0x47f49c['query']=_[_0xac4a('0x33')](_0x2772fe['query']);_0x47f49c[_0xac4a('0x34')]=_[_0xac4a('0x35')](_0x47f49c[_0xac4a('0x32')],_0x47f49c[_0xac4a('0x36')]);_0x4a5a9e[_0xac4a('0x37')]=_[_0xac4a('0x35')](_0x47f49c[_0xac4a('0x32')],qs[_0xac4a('0x38')](_0x2772fe[_0xac4a('0x36')][_0xac4a('0x38')]));_0x4a5a9e[_0xac4a('0x37')]=_0x4a5a9e[_0xac4a('0x37')][_0xac4a('0x39')]?_0x4a5a9e[_0xac4a('0x37')]:_0x47f49c['model'];if(!_0x2772fe[_0xac4a('0x36')][_0xac4a('0x3a')]('nolimit')){_0x4a5a9e[_0xac4a('0x3b')]=qs[_0xac4a('0x3b')](_0x2772fe['query']['limit']);_0x4a5a9e[_0xac4a('0x21')]=qs[_0xac4a('0x21')](_0x2772fe[_0xac4a('0x36')][_0xac4a('0x21')]);}_0x4a5a9e['order']=qs[_0xac4a('0x3c')](_0x2772fe[_0xac4a('0x36')]['sort']);_0x4a5a9e[_0xac4a('0x3d')]=qs[_0xac4a('0x34')](_[_0xac4a('0x3e')](_0x2772fe['query'],_0x47f49c[_0xac4a('0x34')]));if(_0x2772fe[_0xac4a('0x36')][_0xac4a('0x3f')]){_0x4a5a9e['where']=_[_0xac4a('0x40')](_0x4a5a9e[_0xac4a('0x3d')],{'$or':_['map'](_0x7a948b,function(_0x59bebf){if(_0x59bebf[_0xac4a('0x30')]!=='VIRTUAL'){var _0x50e03e={};_0x50e03e[_0x59bebf['name']]={'$like':'%'+_0x2772fe['query'][_0xac4a('0x3f')]+'%'};return _0x50e03e;}})});}_0x4a5a9e=_[_0xac4a('0x40')]({},_0x4a5a9e,_0x2772fe[_0xac4a('0x41')]);var _0x472484={'where':_0x4a5a9e[_0xac4a('0x3d')]};return db[_0xac4a('0x42')][_0xac4a('0x20')](_0x472484)[_0xac4a('0x27')](function(_0x28292c){_0xdb7e[_0xac4a('0x20')]=_0x28292c;if(_0x2772fe[_0xac4a('0x36')][_0xac4a('0x43')]){_0x4a5a9e['include']=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x4a5a9e);})[_0xac4a('0x27')](function(_0x5c46a){_0xdb7e[_0xac4a('0x44')]=_0x5c46a;return _0xdb7e;})[_0xac4a('0x27')](respondWithFilteredResult(_0x116700,_0x4a5a9e))[_0xac4a('0x45')](handleError(_0x116700,null));};exports[_0xac4a('0x46')]=function(_0x8febf0,_0x3441f2){var _0x3e9973={'raw':![],'where':{'id':_0x8febf0['params']['id']}},_0x3edb19={};_0x3edb19[_0xac4a('0x32')]=_[_0xac4a('0x33')](db[_0xac4a('0x42')][_0xac4a('0x47')]);_0x3edb19[_0xac4a('0x36')]=_['keys'](_0x8febf0[_0xac4a('0x36')]);_0x3edb19[_0xac4a('0x34')]=_['intersection'](_0x3edb19[_0xac4a('0x32')],_0x3edb19['query']);_0x3e9973[_0xac4a('0x37')]=_[_0xac4a('0x35')](_0x3edb19[_0xac4a('0x32')],qs[_0xac4a('0x38')](_0x8febf0[_0xac4a('0x36')][_0xac4a('0x38')]));_0x3e9973[_0xac4a('0x37')]=_0x3e9973[_0xac4a('0x37')][_0xac4a('0x39')]?_0x3e9973[_0xac4a('0x37')]:_0x3edb19[_0xac4a('0x32')];if(_0x8febf0[_0xac4a('0x36')]['includeAll']){_0x3e9973[_0xac4a('0x48')]=[{'all':!![]}];}_0x3e9973=_[_0xac4a('0x40')]({},_0x3e9973,_0x8febf0[_0xac4a('0x41')]);return db['VoiceQueueReport'][_0xac4a('0x49')](_0x3e9973)[_0xac4a('0x27')](handleEntityNotFound(_0x3441f2,null))['then'](respondWithResult(_0x3441f2,null))[_0xac4a('0x45')](handleError(_0x3441f2,null));};exports['create']=function(_0x244950,_0xe620f6){return db[_0xac4a('0x42')]['create'](_0x244950['body'],{})[_0xac4a('0x27')](respondWithResult(_0xe620f6,0xc9))['catch'](handleError(_0xe620f6,null));};exports[_0xac4a('0x26')]=function(_0x566258,_0x3d2aaf){if(_0x566258['body']['id']){delete _0x566258[_0xac4a('0x4a')]['id'];}return db[_0xac4a('0x42')][_0xac4a('0x49')]({'where':{'id':_0x566258[_0xac4a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3d2aaf,null))[_0xac4a('0x27')](saveUpdates(_0x566258[_0xac4a('0x4a')],null))[_0xac4a('0x27')](respondWithResult(_0x3d2aaf,null))[_0xac4a('0x45')](handleError(_0x3d2aaf,null));};exports[_0xac4a('0x28')]=function(_0x138876,_0x187306){return db['VoiceQueueReport'][_0xac4a('0x49')]({'where':{'id':_0x138876[_0xac4a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x187306,null))[_0xac4a('0x27')](removeEntity(_0x187306,null))[_0xac4a('0x45')](handleError(_0x187306,null));};exports[_0xac4a('0x4c')]=function(_0x3ac36e,_0x4bb2fb){return db[_0xac4a('0x42')][_0xac4a('0x4c')]()[_0xac4a('0x27')](respondWithResult(_0x4bb2fb,null))[_0xac4a('0x45')](handleError(_0x4bb2fb,null));};exports[_0xac4a('0x4d')]=function(_0x49fbc3,_0x179373){var _0x564b10={},_0x307441={},_0x2c04af={'count':0x0,'rows':[]};_0x307441['model']=_['keys'](db[_0xac4a('0x42')][_0xac4a('0x47')]);_0x307441['query']=_[_0xac4a('0x33')](_0x49fbc3[_0xac4a('0x36')]);_0x307441[_0xac4a('0x34')]=_[_0xac4a('0x35')](_0x307441['model'],_0x307441[_0xac4a('0x36')]);_0x564b10[_0xac4a('0x37')]=_[_0xac4a('0x35')](_0x307441[_0xac4a('0x32')],qs[_0xac4a('0x38')](_0x49fbc3[_0xac4a('0x36')][_0xac4a('0x38')]));_0x564b10['attributes']=_0x564b10[_0xac4a('0x37')][_0xac4a('0x39')]?_0x564b10[_0xac4a('0x37')]:_0x307441[_0xac4a('0x32')];if(!_0x49fbc3[_0xac4a('0x36')][_0xac4a('0x3a')](_0xac4a('0x4e'))){_0x564b10[_0xac4a('0x3b')]=qs[_0xac4a('0x3b')](_0x49fbc3[_0xac4a('0x36')][_0xac4a('0x3b')]);_0x564b10[_0xac4a('0x21')]=qs[_0xac4a('0x21')](_0x49fbc3[_0xac4a('0x36')][_0xac4a('0x21')]);}_0x564b10[_0xac4a('0x4f')]=qs['sort'](_0x49fbc3[_0xac4a('0x36')]['sort']);_0x564b10[_0xac4a('0x3d')]=qs['filters'](_[_0xac4a('0x3e')](_0x49fbc3['query'],_0x307441[_0xac4a('0x34')]));if(_0x49fbc3['query']['filter']){_0x564b10[_0xac4a('0x3d')]=_[_0xac4a('0x40')](_0x564b10[_0xac4a('0x3d')],{'$or':_[_0xac4a('0x2e')](_0x564b10[_0xac4a('0x37')],function(_0xb7b884){var _0x592a4b={};_0x592a4b[_0xb7b884]={'$like':'%'+_0x49fbc3[_0xac4a('0x36')]['filter']+'%'};return _0x592a4b;})});}_0x564b10=_[_0xac4a('0x40')]({},_0x564b10,_0x49fbc3['options']);var _0x347880={'where':_0x564b10[_0xac4a('0x3d')]};return db[_0xac4a('0x42')][_0xac4a('0x20')](_0x347880)[_0xac4a('0x27')](function(_0x2bc39a){_0x2c04af[_0xac4a('0x20')]=_0x2bc39a;if(_0x49fbc3[_0xac4a('0x36')][_0xac4a('0x43')]){_0x564b10[_0xac4a('0x48')]=[{'all':!![]}];}return db[_0xac4a('0x42')][_0xac4a('0x50')](_0x564b10);})[_0xac4a('0x27')](function(_0x2cc410){_0x2c04af[_0xac4a('0x44')]=_0x2cc410;return _0x2c04af;})[_0xac4a('0x27')](respondWithFilteredResult(_0x179373,_0x564b10,_0xac4a('0x4d')))['catch'](handleError(_0x179373,null,_0xac4a('0x4d')));}; \ No newline at end of file +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 diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index c4fa4f3..dbc6f92 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 _0xef16=['hasOwnProperty','hook','exports','events','update','emit'];(function(_0x83d98b,_0xd2d6d2){var _0x472d79=function(_0x5ca005){while(--_0x5ca005){_0x83d98b['push'](_0x83d98b['shift']());}};_0x472d79(++_0xd2d6d2);}(_0xef16,0x16b));var _0x6ef1=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xef16[_0x2d8fc2];return _0x3a9e53;};'use strict';var EventEmitter=require(_0x6ef1('0x0'));var VoiceQueueReport=require('../../mysqldb')['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6ef1('0x1'),'afterDestroy':'remove'};function emitEvent(_0x386f88){return function(_0x2d9e27,_0x1a0296,_0x32dd5b){VoiceQueueReportEvents[_0x6ef1('0x2')](_0x386f88+':'+_0x2d9e27['id'],_0x2d9e27);VoiceQueueReportEvents[_0x6ef1('0x2')](_0x386f88,_0x2d9e27);_0x32dd5b(null);};}for(var e in events){if(events[_0x6ef1('0x3')](e)){var event=events[e];VoiceQueueReport[_0x6ef1('0x4')](e,emitEvent(event));}}module[_0x6ef1('0x5')]=VoiceQueueReportEvents; \ No newline at end of file +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 diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 12a2c39..e2e34ae 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 _0x5f2f=['VoiceQueueReport','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./voiceQueueReport.attributes','exports','define'];(function(_0xc65834,_0x5df6fb){var _0x5da298=function(_0x30fbc2){while(--_0x30fbc2){_0xc65834['push'](_0xc65834['shift']());}};_0x5da298(++_0x5df6fb);}(_0x5f2f,0x73));var _0xf5f2=function(_0x486826,_0x3e36d5){_0x486826=_0x486826-0x0;var _0x493a36=_0x5f2f[_0x486826];return _0x493a36;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var logger=require(_0xf5f2('0x2'))(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var BPromise=require(_0xf5f2('0x5'));var rp=require(_0xf5f2('0x6'));var fs=require('fs');var path=require(_0xf5f2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf5f2('0x8'));module[_0xf5f2('0x9')]=function(_0xad7f65,_0x3eebf6){return _0xad7f65[_0xf5f2('0xa')](_0xf5f2('0xb'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xf5f2('0xc')]},{'fields':[_0xf5f2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index cac7702..475ab09 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 _0xbf3d=['model','stringify','CreateVoiceQueueReport','create','body','raw','UpdateVoiceQueueReport','where','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','GetVoiceQueueReport','VoiceQueueReport','options','attributes','include','map'];(function(_0x510f43,_0x19771b){var _0x266569=function(_0x51d434){while(--_0x51d434){_0x510f43['push'](_0x510f43['shift']());}};_0x266569(++_0x19771b);}(_0xbf3d,0x84));var _0xdbf3=function(_0x7dad05,_0x1b625e){_0x7dad05=_0x7dad05-0x0;var _0x5926d6=_0xbf3d[_0x7dad05];return _0x5926d6;};'use strict';var _=require('lodash');var util=require(_0xdbf3('0x0'));var moment=require(_0xdbf3('0x1'));var BPromise=require(_0xdbf3('0x2'));var rs=require(_0xdbf3('0x3'));var fs=require('fs');var Redis=require(_0xdbf3('0x4'));var db=require(_0xdbf3('0x5'))['db'];var utils=require(_0xdbf3('0x6'));var logger=require('../../config/logger')(_0xdbf3('0x7'));var config=require('../../config/environment');var jayson=require(_0xdbf3('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xdbf3('0x9')]=_[_0xdbf3('0xa')](config[_0xdbf3('0x9')],{'host':_0xdbf3('0xb'),'port':0x18eb});var socket=require(_0xdbf3('0xc'))(new Redis(config[_0xdbf3('0x9')]));require(_0xdbf3('0xd'))[_0xdbf3('0xe')](socket);function respondWithRpcPromise(_0x5da7fd,_0x22eae8,_0xeb82f8){return new BPromise(function(_0xcd75da,_0x3863ef){return client[_0xdbf3('0xf')](_0x5da7fd,_0xeb82f8)[_0xdbf3('0x10')](function(_0x2eaa83){logger['info'](_0xdbf3('0x11'),_0x22eae8,'request\x20sent');logger[_0xdbf3('0x12')](_0xdbf3('0x13'),_0x22eae8,_0xdbf3('0x14'),JSON['stringify'](_0x2eaa83));if(_0x2eaa83['error']){if(_0x2eaa83[_0xdbf3('0x15')][_0xdbf3('0x16')]===0x1f4){logger[_0xdbf3('0x15')](_0xdbf3('0x11'),_0x22eae8,_0x2eaa83[_0xdbf3('0x15')][_0xdbf3('0x17')]);return _0x3863ef(_0x2eaa83[_0xdbf3('0x15')][_0xdbf3('0x17')]);}logger[_0xdbf3('0x15')](_0xdbf3('0x11'),_0x22eae8,_0x2eaa83[_0xdbf3('0x15')]['message']);return _0xcd75da(_0x2eaa83[_0xdbf3('0x15')][_0xdbf3('0x17')]);}else{logger[_0xdbf3('0x18')](_0xdbf3('0x11'),_0x22eae8,_0xdbf3('0x14'));_0xcd75da(_0x2eaa83['result']['message']);}})[_0xdbf3('0x19')](function(_0x5c7fd7){logger[_0xdbf3('0x15')](_0xdbf3('0x11'),_0x22eae8,_0x5c7fd7);_0x3863ef(_0x5c7fd7);});});}exports[_0xdbf3('0x1a')]=function(_0xc1eef3){var _0x548338=this;return new Promise(function(_0x5f0163,_0x4a573f){return db[_0xdbf3('0x1b')]['findAll']({'raw':_0xc1eef3[_0xdbf3('0x1c')]?_0xc1eef3[_0xdbf3('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0xc1eef3[_0xdbf3('0x1c')]?_0xc1eef3[_0xdbf3('0x1c')]['where']||null:null,'attributes':_0xc1eef3[_0xdbf3('0x1c')]?_0xc1eef3['options'][_0xdbf3('0x1d')]||null:null,'limit':_0xc1eef3['options']?_0xc1eef3[_0xdbf3('0x1c')]['limit']||null:null,'include':_0xc1eef3[_0xdbf3('0x1c')]?_0xc1eef3[_0xdbf3('0x1c')][_0xdbf3('0x1e')]?_[_0xdbf3('0x1f')](_0xc1eef3[_0xdbf3('0x1c')]['include'],function(_0x28b79e){return{'model':db[_0x28b79e[_0xdbf3('0x20')]],'as':_0x28b79e['as'],'attributes':_0x28b79e[_0xdbf3('0x1d')],'include':_0x28b79e[_0xdbf3('0x1e')]?_[_0xdbf3('0x1f')](_0x28b79e[_0xdbf3('0x1e')],function(_0x2c4700){return{'model':db[_0x2c4700[_0xdbf3('0x20')]],'as':_0x2c4700['as'],'attributes':_0x2c4700[_0xdbf3('0x1d')],'include':_0x2c4700['include']?_['map'](_0x2c4700['include'],function(_0x186366){return{'model':db[_0x186366['model']],'as':_0x186366['as'],'attributes':_0x186366[_0xdbf3('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdbf3('0x10')](function(_0x26af61){logger['info'](_0xdbf3('0x1a'),_0xc1eef3);logger[_0xdbf3('0x12')](_0xdbf3('0x1a'),_0xc1eef3,JSON[_0xdbf3('0x21')](_0x26af61));_0x5f0163(_0x26af61);})[_0xdbf3('0x19')](function(_0x432870){logger[_0xdbf3('0x15')](_0xdbf3('0x1a'),_0x432870[_0xdbf3('0x17')],_0xc1eef3);_0x4a573f(_0x548338[_0xdbf3('0x15')](0x1f4,_0x432870['message']));});});};exports[_0xdbf3('0x22')]=function(_0x22b3d3){var _0x369513=this;return new Promise(function(_0xd7a7fd,_0x30014b){return db['VoiceQueueReport'][_0xdbf3('0x23')](_0x22b3d3[_0xdbf3('0x24')],{'raw':_0x22b3d3[_0xdbf3('0x1c')]?_0x22b3d3['options'][_0xdbf3('0x25')]===undefined?!![]:![]:!![]})[_0xdbf3('0x10')](function(_0x27ed21){logger[_0xdbf3('0x18')](_0xdbf3('0x22'),_0x22b3d3);logger['debug']('CreateVoiceQueueReport',_0x22b3d3,JSON['stringify'](_0x27ed21));_0xd7a7fd(_0x27ed21);})[_0xdbf3('0x19')](function(_0x18149c){logger[_0xdbf3('0x15')](_0xdbf3('0x22'),_0x18149c[_0xdbf3('0x17')],_0x22b3d3);_0x30014b(_0x369513[_0xdbf3('0x15')](0x1f4,_0x18149c['message']));});});};exports[_0xdbf3('0x26')]=function(_0x5220a5){var _0x445c60=this;return new Promise(function(_0x57a979,_0x88267b){return db[_0xdbf3('0x1b')]['update'](_0x5220a5['body'],{'raw':_0x5220a5[_0xdbf3('0x1c')]?_0x5220a5['options'][_0xdbf3('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5220a5[_0xdbf3('0x1c')]?_0x5220a5[_0xdbf3('0x1c')][_0xdbf3('0x27')]||null:null,'attributes':_0x5220a5[_0xdbf3('0x1c')]?_0x5220a5[_0xdbf3('0x1c')][_0xdbf3('0x1d')]||null:null,'limit':_0x5220a5[_0xdbf3('0x1c')]?_0x5220a5[_0xdbf3('0x1c')][_0xdbf3('0x28')]||null:null})['then'](function(_0x569a86){logger[_0xdbf3('0x18')]('UpdateVoiceQueueReport',_0x5220a5);logger[_0xdbf3('0x12')]('UpdateVoiceQueueReport',_0x5220a5,JSON[_0xdbf3('0x21')](_0x569a86));_0x57a979(_0x569a86);})[_0xdbf3('0x19')](function(_0x976349){logger[_0xdbf3('0x15')]('UpdateVoiceQueueReport',_0x976349[_0xdbf3('0x17')],_0x5220a5);_0x88267b(_0x445c60['error'](0x1f4,_0x976349[_0xdbf3('0x17')]));});});}; \ No newline at end of file +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 diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index caeea0a..599ab84 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 _0x69f4=['voiceQueueReport:','save','update','removeListener','register'];(function(_0x68dbea,_0xff8e79){var _0x416ecd=function(_0x1ed548){while(--_0x1ed548){_0x68dbea['push'](_0x68dbea['shift']());}};_0x416ecd(++_0xff8e79);}(_0x69f4,0xf1));var _0x469f=function(_0x2464b7,_0x4f2d80){_0x2464b7=_0x2464b7-0x0;var _0x3e55dd=_0x69f4[_0x2464b7];return _0x3e55dd;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x469f('0x0'),'remove',_0x469f('0x1')];function createListener(_0x18beb4,_0x4901d7){return function(_0x33714d){_0x4901d7['emit'](_0x18beb4,_0x33714d);};}function removeListener(_0x441ea7,_0x15964b){return function(){VoiceQueueReportEvents[_0x469f('0x2')](_0x441ea7,_0x15964b);};}exports[_0x469f('0x3')]=function(_0x28dd07){for(var _0x53f349=0x0,_0x281ec5=events['length'];_0x53f349<_0x281ec5;_0x53f349++){var _0x45207b=events[_0x53f349];var _0xd7ee99=createListener(_0x469f('0x4')+_0x45207b,_0x28dd07);VoiceQueueReportEvents['on'](_0x45207b,_0xd7ee99);}}; \ No newline at end of file +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 diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 1c66869..dd5e266 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 _0x4af8=['index','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x1c98eb,_0x2e91cd){var _0x4da7d6=function(_0x275537){while(--_0x275537){_0x1c98eb['push'](_0x1c98eb['shift']());}};_0x4da7d6(++_0x2e91cd);}(_0x4af8,0x81));var _0x84af=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x4af8[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x84af('0x0'));var util=require(_0x84af('0x1'));var path=require(_0x84af('0x2'));var timeout=require(_0x84af('0x3'));var express=require(_0x84af('0x4'));var router=express[_0x84af('0x5')]();var auth=require(_0x84af('0x6'));var interaction=require(_0x84af('0x7'));var config=require(_0x84af('0x8'));var controller=require('./voiceQueuesLog.controller');router[_0x84af('0x9')]('/',auth[_0x84af('0xa')](),controller[_0x84af('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x84af('0xc')]('/',auth[_0x84af('0xa')](),controller[_0x84af('0xd')]);router[_0x84af('0xe')]('/:id',auth[_0x84af('0xa')](),controller[_0x84af('0xf')]);router[_0x84af('0x10')](_0x84af('0x11'),auth['isAuthenticated'](),controller[_0x84af('0x12')]);module[_0x84af('0x13')]=router; \ No newline at end of file +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 diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index a598534..9b96793 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 _0x644b=['sequelize','moment','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x644b,0xf0));var _0xb644=function(_0x33d431,_0xf591fb){_0x33d431=_0x33d431-0x0;var _0xad1bc8=_0x644b[_0x33d431];return _0xad1bc8;};'use strict';var Sequelize=require(_0xb644('0x0'));var moment=require(_0xb644('0x1'));module['exports']={'time':{'type':Sequelize[_0xb644('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xb644('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xb644('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xb644('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xb644('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xb644('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xb644('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xb644('0x3')],'allowNull':![],'defaultValue':moment()[_0xb644('0x4')](_0xb644('0x5'))}}; \ No newline at end of file +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 diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 9c74b1b..a814fe3 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 _0xa5c5=['name','send','map','VoiceQueuesLog','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','params','keys','options','find','create','body','destroy','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','save','then','error','stack'];(function(_0x4d1d3b,_0x358031){var _0x473905=function(_0x10a9c9){while(--_0x10a9c9){_0x4d1d3b['push'](_0x4d1d3b['shift']());}};_0x473905(++_0x358031);}(_0xa5c5,0xa4));var _0x5a5c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa5c5[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x5a5c('0x0'));var emlformat=require(_0x5a5c('0x1'));var rimraf=require(_0x5a5c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5a5c('0x3'));var rp=require(_0x5a5c('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5a5c('0x5'));var util=require(_0x5a5c('0x6'));var path=require(_0x5a5c('0x7'));var sox=require(_0x5a5c('0x8'));var csv=require(_0x5a5c('0x9'));var ejs=require(_0x5a5c('0xa'));var fs=require('fs');var _=require(_0x5a5c('0xb'));var squel=require(_0x5a5c('0xc'));var crypto=require(_0x5a5c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5a5c('0xe'));var toCsv=require(_0x5a5c('0x9'));var querystring=require(_0x5a5c('0xf'));var Papa=require(_0x5a5c('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5a5c('0x11'));var utils=require(_0x5a5c('0x12'));var config=require(_0x5a5c('0x13'));var db=require(_0x5a5c('0x14'))['db'];function respondWithStatusCode(_0x1ce4f5,_0x25c4b6){_0x25c4b6=_0x25c4b6||0xcc;return function(_0x38599b){if(_0x38599b){return _0x1ce4f5[_0x5a5c('0x15')](_0x25c4b6);}return _0x1ce4f5[_0x5a5c('0x16')](_0x25c4b6)[_0x5a5c('0x17')]();};}function respondWithResult(_0x4617d1,_0x181da8){_0x181da8=_0x181da8||0xc8;return function(_0x34b76f){if(_0x34b76f){return _0x4617d1[_0x5a5c('0x16')](_0x181da8)[_0x5a5c('0x18')](_0x34b76f);}};}function respondWithFilteredResult(_0x32c881,_0x3c2d8f){return function(_0x3711b8){if(_0x3711b8){var _0x40d529=_0x3711b8[_0x5a5c('0x19')],_0x5d2e84=_0x3c2d8f[_0x5a5c('0x1a')],_0x2b4569=_0x3c2d8f[_0x5a5c('0x1a')]+_0x3c2d8f[_0x5a5c('0x1b')],_0x13a027;if(_0x2b4569>=_0x40d529){_0x2b4569=_0x40d529;_0x13a027=0xc8;}else{_0x13a027=0xce;}_0x32c881[_0x5a5c('0x16')](_0x13a027);return _0x32c881['set']('Content-Range',_0x5d2e84+'-'+_0x2b4569+'/'+_0x40d529)[_0x5a5c('0x18')](_0x3711b8);}return null;};}function patchUpdates(_0x16f978){return function(_0xfdfe50){try{jsonpatch[_0x5a5c('0x1c')](_0xfdfe50,_0x16f978,!![]);}catch(_0xb10fd8){return BPromise[_0x5a5c('0x1d')](_0xb10fd8);}return _0xfdfe50[_0x5a5c('0x1e')]();};}function saveUpdates(_0x48ac80,_0x474e85){return function(_0x5535dd){if(_0x5535dd){return _0x5535dd['update'](_0x48ac80)['then'](function(_0x18a122){return _0x18a122;});}return null;};}function removeEntity(_0x3ae067,_0x5ba167){return function(_0x250982){if(_0x250982){return _0x250982['destroy']()[_0x5a5c('0x1f')](function(){_0x3ae067['status'](0xcc)[_0x5a5c('0x17')]();});}};}function handleEntityNotFound(_0x2c31dc,_0x460060){return function(_0x391a7a){if(!_0x391a7a){_0x2c31dc[_0x5a5c('0x15')](0x194);}return _0x391a7a;};}function handleError(_0x8c3583,_0x33be55){_0x33be55=_0x33be55||0x1f4;return function(_0x1194dc){logger[_0x5a5c('0x20')](_0x1194dc[_0x5a5c('0x21')]);if(_0x1194dc[_0x5a5c('0x22')]){delete _0x1194dc[_0x5a5c('0x22')];}_0x8c3583[_0x5a5c('0x16')](_0x33be55)[_0x5a5c('0x23')](_0x1194dc);};}exports['index']=function(_0x1e4312,_0x3c42a8){var _0x58392a={},_0x23d5ba={},_0x258361={'count':0x0,'rows':[]};var _0x578eff=_[_0x5a5c('0x24')](db[_0x5a5c('0x25')][_0x5a5c('0x26')],function(_0x2ed3ec){return{'name':_0x2ed3ec['fieldName'],'type':_0x2ed3ec[_0x5a5c('0x27')][_0x5a5c('0x28')]};});_0x23d5ba[_0x5a5c('0x29')]=_[_0x5a5c('0x24')](_0x578eff,_0x5a5c('0x22'));_0x23d5ba[_0x5a5c('0x2a')]=_['keys'](_0x1e4312['query']);_0x23d5ba[_0x5a5c('0x2b')]=_[_0x5a5c('0x2c')](_0x23d5ba[_0x5a5c('0x29')],_0x23d5ba[_0x5a5c('0x2a')]);_0x58392a[_0x5a5c('0x2d')]=_[_0x5a5c('0x2c')](_0x23d5ba[_0x5a5c('0x29')],qs[_0x5a5c('0x2e')](_0x1e4312['query']['fields']));_0x58392a[_0x5a5c('0x2d')]=_0x58392a[_0x5a5c('0x2d')][_0x5a5c('0x2f')]?_0x58392a[_0x5a5c('0x2d')]:_0x23d5ba[_0x5a5c('0x29')];if(!_0x1e4312['query']['hasOwnProperty'](_0x5a5c('0x30'))){_0x58392a['limit']=qs[_0x5a5c('0x1b')](_0x1e4312[_0x5a5c('0x2a')][_0x5a5c('0x1b')]);_0x58392a[_0x5a5c('0x1a')]=qs[_0x5a5c('0x1a')](_0x1e4312[_0x5a5c('0x2a')][_0x5a5c('0x1a')]);}_0x58392a['order']=qs[_0x5a5c('0x31')](_0x1e4312[_0x5a5c('0x2a')]['sort']);_0x58392a[_0x5a5c('0x32')]=qs[_0x5a5c('0x2b')](_[_0x5a5c('0x33')](_0x1e4312[_0x5a5c('0x2a')],_0x23d5ba[_0x5a5c('0x2b')]));if(_0x1e4312[_0x5a5c('0x2a')][_0x5a5c('0x34')]){_0x58392a['where']=_[_0x5a5c('0x35')](_0x58392a[_0x5a5c('0x32')],{'$or':_['map'](_0x578eff,function(_0x5623b1){if(_0x5623b1[_0x5a5c('0x27')]!==_0x5a5c('0x36')){var _0x4a6c27={};_0x4a6c27[_0x5623b1['name']]={'$like':'%'+_0x1e4312[_0x5a5c('0x2a')][_0x5a5c('0x34')]+'%'};return _0x4a6c27;}})});}_0x58392a=_[_0x5a5c('0x35')]({},_0x58392a,_0x1e4312['options']);var _0x3a23ed={'where':_0x58392a[_0x5a5c('0x32')]};return db['VoiceQueuesLog'][_0x5a5c('0x19')](_0x3a23ed)[_0x5a5c('0x1f')](function(_0x159a40){_0x258361['count']=_0x159a40;if(_0x1e4312[_0x5a5c('0x2a')][_0x5a5c('0x37')]){_0x58392a[_0x5a5c('0x38')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x5a5c('0x39')](_0x58392a);})[_0x5a5c('0x1f')](function(_0x2882e3){_0x258361['rows']=_0x2882e3;return _0x258361;})[_0x5a5c('0x1f')](respondWithFilteredResult(_0x3c42a8,_0x58392a))[_0x5a5c('0x3a')](handleError(_0x3c42a8,null));};exports['show']=function(_0x280598,_0x346293){var _0x33f4d0={'raw':!![],'where':{'id':_0x280598[_0x5a5c('0x3b')]['id']}},_0x318041={};_0x318041[_0x5a5c('0x29')]=_[_0x5a5c('0x3c')](db[_0x5a5c('0x25')][_0x5a5c('0x26')]);_0x318041['query']=_[_0x5a5c('0x3c')](_0x280598[_0x5a5c('0x2a')]);_0x318041['filters']=_[_0x5a5c('0x2c')](_0x318041[_0x5a5c('0x29')],_0x318041[_0x5a5c('0x2a')]);_0x33f4d0['attributes']=_[_0x5a5c('0x2c')](_0x318041[_0x5a5c('0x29')],qs[_0x5a5c('0x2e')](_0x280598['query'][_0x5a5c('0x2e')]));_0x33f4d0[_0x5a5c('0x2d')]=_0x33f4d0[_0x5a5c('0x2d')][_0x5a5c('0x2f')]?_0x33f4d0[_0x5a5c('0x2d')]:_0x318041[_0x5a5c('0x29')];if(_0x280598[_0x5a5c('0x2a')]['includeAll']){_0x33f4d0['include']=[{'all':!![]}];}_0x33f4d0=_['merge']({},_0x33f4d0,_0x280598[_0x5a5c('0x3d')]);return db['VoiceQueuesLog'][_0x5a5c('0x3e')](_0x33f4d0)['then'](handleEntityNotFound(_0x346293,null))[_0x5a5c('0x1f')](respondWithResult(_0x346293,null))[_0x5a5c('0x3a')](handleError(_0x346293,null));};exports[_0x5a5c('0x3f')]=function(_0x4c75b0,_0x34a00d){return db[_0x5a5c('0x25')]['create'](_0x4c75b0[_0x5a5c('0x40')],{})[_0x5a5c('0x1f')](respondWithResult(_0x34a00d,0xc9))[_0x5a5c('0x3a')](handleError(_0x34a00d,null));};exports['update']=function(_0x48c511,_0xdb6ced){if(_0x48c511[_0x5a5c('0x40')]['id']){delete _0x48c511[_0x5a5c('0x40')]['id'];}return db[_0x5a5c('0x25')][_0x5a5c('0x3e')]({'where':{'id':_0x48c511[_0x5a5c('0x3b')]['id']}})[_0x5a5c('0x1f')](handleEntityNotFound(_0xdb6ced,null))[_0x5a5c('0x1f')](saveUpdates(_0x48c511[_0x5a5c('0x40')],null))[_0x5a5c('0x1f')](respondWithResult(_0xdb6ced,null))[_0x5a5c('0x3a')](handleError(_0xdb6ced,null));};exports[_0x5a5c('0x41')]=function(_0x1ea850,_0x255afa){return db[_0x5a5c('0x25')][_0x5a5c('0x3e')]({'where':{'id':_0x1ea850[_0x5a5c('0x3b')]['id']}})['then'](handleEntityNotFound(_0x255afa,null))['then'](removeEntity(_0x255afa,null))['catch'](handleError(_0x255afa,null));}; \ No newline at end of file +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 diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 5d3c7e6..6b8fa5d 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 _0x6068=['moment','bluebird','request-promise','path','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api'];(function(_0x4d9394,_0x55a786){var _0x3a295a=function(_0x1e7e31){while(--_0x1e7e31){_0x4d9394['push'](_0x4d9394['shift']());}};_0x3a295a(++_0x55a786);}(_0x6068,0xdd));var _0x8606=function(_0x162e12,_0x53edbe){_0x162e12=_0x162e12-0x0;var _0x236703=_0x6068[_0x162e12];return _0x236703;};'use strict';var _=require(_0x8606('0x0'));var util=require(_0x8606('0x1'));var logger=require(_0x8606('0x2'))(_0x8606('0x3'));var moment=require(_0x8606('0x4'));var BPromise=require(_0x8606('0x5'));var rp=require(_0x8606('0x6'));var fs=require('fs');var path=require(_0x8606('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceQueuesLog.attributes');module[_0x8606('0x8')]=function(_0x159e92,_0x4797ae){return _0x159e92[_0x8606('0x9')](_0x8606('0xa'),attributes,{'tableName':_0x8606('0xb'),'paranoid':![],'indexes':[{'name':_0x8606('0xc'),'fields':[_0x8606('0xd'),_0x8606('0xe')]}],'timestamps':![]});}; \ No newline at end of file +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 diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 9f8b922..bc08b26 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 _0x9f4d=['debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent'];(function(_0x45f945,_0x2c5a50){var _0x2866b8=function(_0xdd0398){while(--_0xdd0398){_0x45f945['push'](_0x45f945['shift']());}};_0x2866b8(++_0x2c5a50);}(_0x9f4d,0xb0));var _0xd9f4=function(_0x18e89d,_0x4814fe){_0x18e89d=_0x18e89d-0x0;var _0x1aea52=_0x9f4d[_0x18e89d];return _0x1aea52;};'use strict';var _=require(_0xd9f4('0x0'));var util=require(_0xd9f4('0x1'));var moment=require(_0xd9f4('0x2'));var BPromise=require(_0xd9f4('0x3'));var rs=require(_0xd9f4('0x4'));var fs=require('fs');var Redis=require(_0xd9f4('0x5'));var db=require(_0xd9f4('0x6'))['db'];var utils=require(_0xd9f4('0x7'));var logger=require(_0xd9f4('0x8'))('rpc');var config=require(_0xd9f4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd9f4('0xa')][_0xd9f4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2cc036,_0x366b9d,_0x5cf448){return new BPromise(function(_0x6b13b5,_0x18305f){return client['request'](_0x2cc036,_0x5cf448)[_0xd9f4('0xc')](function(_0x47d52f){logger[_0xd9f4('0xd')](_0xd9f4('0xe'),_0x366b9d,_0xd9f4('0xf'));logger[_0xd9f4('0x10')](_0xd9f4('0x11'),_0x366b9d,'request\x20sent',JSON[_0xd9f4('0x12')](_0x47d52f));if(_0x47d52f[_0xd9f4('0x13')]){if(_0x47d52f[_0xd9f4('0x13')][_0xd9f4('0x14')]===0x1f4){logger[_0xd9f4('0x13')](_0xd9f4('0xe'),_0x366b9d,_0x47d52f[_0xd9f4('0x13')][_0xd9f4('0x15')]);return _0x18305f(_0x47d52f['error'][_0xd9f4('0x15')]);}logger[_0xd9f4('0x13')](_0xd9f4('0xe'),_0x366b9d,_0x47d52f[_0xd9f4('0x13')][_0xd9f4('0x15')]);return _0x6b13b5(_0x47d52f[_0xd9f4('0x13')][_0xd9f4('0x15')]);}else{logger[_0xd9f4('0xd')](_0xd9f4('0xe'),_0x366b9d,_0xd9f4('0xf'));_0x6b13b5(_0x47d52f[_0xd9f4('0x16')][_0xd9f4('0x15')]);}})[_0xd9f4('0x17')](function(_0x5e7da1){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x366b9d,_0x5e7da1);_0x18305f(_0x5e7da1);});});} \ No newline at end of file +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 diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 911d5d6..4a2ca5a 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 _0xc7dd=['isAuthenticated','get','/describe','/:id','/:id/download','downloads','post','put','update','delete','multer','connect-timeout','express','../../components/auth/service','../../config/environment','./voiceRecording.controller'];(function(_0x530f93,_0x54d681){var _0x159f8a=function(_0x50c76e){while(--_0x50c76e){_0x530f93['push'](_0x530f93['shift']());}};_0x159f8a(++_0x54d681);}(_0xc7dd,0x10a));var _0xdc7d=function(_0x496997,_0x5a576c){_0x496997=_0x496997-0x0;var _0x3d16b2=_0xc7dd[_0x496997];return _0x3d16b2;};'use strict';var multer=require(_0xdc7d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdc7d('0x1'));var express=require(_0xdc7d('0x2'));var router=express['Router']();var auth=require(_0xdc7d('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xdc7d('0x4'));var controller=require(_0xdc7d('0x5'));router['get']('/',auth[_0xdc7d('0x6')](),controller['index']);router[_0xdc7d('0x7')](_0xdc7d('0x8'),auth[_0xdc7d('0x6')](),controller['describe']);router['get'](_0xdc7d('0x9'),auth[_0xdc7d('0x6')](),controller['show']);router['get'](_0xdc7d('0xa'),auth['isAuthenticated'](),controller['download']);router[_0xdc7d('0x7')]('/:id/downloads',controller[_0xdc7d('0xb')]);router[_0xdc7d('0xc')]('/',auth[_0xdc7d('0x6')](),controller['create']);router[_0xdc7d('0xd')](_0xdc7d('0x9'),auth[_0xdc7d('0x6')](),controller[_0xdc7d('0xe')]);router[_0xdc7d('0xf')]('/:id',auth[_0xdc7d('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 5bd979e..6151f65 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 _0x4ae4=['createdAt','MM-DD-YYYY\x20HH:mm','updatedAt','format','toString','sequelize','VIRTUAL','getDataValue','value','extname','setDataValue','channel','membername','split','STRING','INTEGER','DATE'];(function(_0x1a1292,_0x2f4dfc){var _0x33cad2=function(_0x403d6c){while(--_0x403d6c){_0x1a1292['push'](_0x1a1292['shift']());}};_0x33cad2(++_0x2f4dfc);}(_0x4ae4,0xaf));var _0x44ae=function(_0x2bacef,_0x4a3219){_0x2bacef=_0x2bacef-0x0;var _0x242daf=_0x4ae4[_0x2bacef];return _0x242daf;};'use strict';var Sequelize=require(_0x44ae('0x0'));var moment=require('moment');var path=require('path');module['exports']={'format':{'type':Sequelize[_0x44ae('0x1')],'get':function(){return this[_0x44ae('0x2')](_0x44ae('0x3'))?path[_0x44ae('0x4')](this['getDataValue'](_0x44ae('0x3'))):undefined;}},'uniqueid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING'],'set':function(_0x4e8bf0){if(_0x4e8bf0){this[_0x44ae('0x5')](_0x44ae('0x6'),_0x4e8bf0);this[_0x44ae('0x5')](_0x44ae('0x7'),_0x4e8bf0[_0x44ae('0x8')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x44ae('0x9')]},'calleridnum':{'type':Sequelize[_0x44ae('0x9')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x44ae('0x9')]},'connectedlinename':{'type':Sequelize[_0x44ae('0x9')]},'accountcode':{'type':Sequelize[_0x44ae('0x9')]},'context':{'type':Sequelize[_0x44ae('0x9')]},'exten':{'type':Sequelize[_0x44ae('0x9')]},'value':{'type':Sequelize[_0x44ae('0x9')]},'type':{'type':Sequelize[_0x44ae('0x9')]},'rating':{'type':Sequelize[_0x44ae('0xa')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x44ae('0x9')]},'userDisposition':{'type':Sequelize['STRING']},'createdAt':{'type':Sequelize[_0x44ae('0xb')],'get':function(){return moment(this[_0x44ae('0x2')](_0x44ae('0xc')))['format'](_0x44ae('0xd'))['toString']();}},'updatedAt':{'type':Sequelize[_0x44ae('0xb')],'get':function(){return moment(this[_0x44ae('0x2')](_0x44ae('0xe')))[_0x44ae('0xf')](_0x44ae('0xd'))[_0x44ae('0x10')]();}}}; \ No newline at end of file +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 diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 146f1b6..bb0c56d 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 _0x2697=['status','count','offset','limit','Content-Range','json','reject','then','destroy','end','error','stack','name','send','VoiceRecording','rawAttributes','fieldName','key','differenceBy','map','format','query','keys','intersection','attributes','fields','length','model','nolimit','sort','where','filters','pick','filter','merge','type','options','findAll','catch','params','includeAll','include','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','downloads','sequelize','MD5','col','token','push','$and','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x386f01,_0x48bb77){var _0x41cc4c=function(_0x178d97){while(--_0x178d97){_0x386f01['push'](_0x386f01['shift']());}};_0x41cc4c(++_0x48bb77);}(_0x2697,0x114));var _0x7269=function(_0x5e6cb8,_0x16cf56){_0x5e6cb8=_0x5e6cb8-0x0;var _0x3faeb3=_0x2697[_0x5e6cb8];return _0x3faeb3;};'use strict';var pdf=require(_0x7269('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7269('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7269('0x2'));var moment=require(_0x7269('0x3'));var BPromise=require(_0x7269('0x4'));var Mustache=require(_0x7269('0x5'));var util=require(_0x7269('0x6'));var path=require(_0x7269('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7269('0x8'));var fs=require('fs');var _=require(_0x7269('0x9'));var squel=require('squel');var crypto=require(_0x7269('0xa'));var jsforce=require(_0x7269('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7269('0xc'));var Papa=require(_0x7269('0xd'));var Redis=require(_0x7269('0xe'));var authService=require(_0x7269('0xf'));var qs=require(_0x7269('0x10'));var as=require(_0x7269('0x11'));var hardwareService=require(_0x7269('0x12'));var logger=require('../../config/logger')(_0x7269('0x13'));var utils=require(_0x7269('0x14'));var config=require(_0x7269('0x15'));var db=require(_0x7269('0x16'))['db'];function respondWithStatusCode(_0x28b78e,_0x45a48c){_0x45a48c=_0x45a48c||0xcc;return function(_0x6c71d8){if(_0x6c71d8){return _0x28b78e[_0x7269('0x17')](_0x45a48c);}return _0x28b78e[_0x7269('0x18')](_0x45a48c)['end']();};}function respondWithResult(_0x5437ed,_0x347185){_0x347185=_0x347185||0xc8;return function(_0x4d89c2){if(_0x4d89c2){return _0x5437ed[_0x7269('0x18')](_0x347185)['json'](_0x4d89c2);}};}function respondWithFilteredResult(_0x1cb903,_0x2061cd){return function(_0x573893){if(_0x573893){var _0x391271=_0x573893[_0x7269('0x19')],_0x262b6e=_0x2061cd[_0x7269('0x1a')],_0x54cab2=_0x2061cd[_0x7269('0x1a')]+_0x2061cd[_0x7269('0x1b')],_0x4041ab;if(_0x54cab2>=_0x391271){_0x54cab2=_0x391271;_0x4041ab=0xc8;}else{_0x4041ab=0xce;}_0x1cb903[_0x7269('0x18')](_0x4041ab);return _0x1cb903['set'](_0x7269('0x1c'),_0x262b6e+'-'+_0x54cab2+'/'+_0x391271)[_0x7269('0x1d')](_0x573893);}return null;};}function patchUpdates(_0x41d6ae){return function(_0x36c734){try{jsonpatch['apply'](_0x36c734,_0x41d6ae,!![]);}catch(_0x443723){return BPromise[_0x7269('0x1e')](_0x443723);}return _0x36c734['save']();};}function saveUpdates(_0x32af37,_0x55ab86){return function(_0x43ebc8){if(_0x43ebc8){return _0x43ebc8['update'](_0x32af37)[_0x7269('0x1f')](function(_0x5b0386){return _0x5b0386;});}return null;};}function removeEntity(_0x51a602,_0x21e825){return function(_0x4ec2fe){if(_0x4ec2fe){return _0x4ec2fe[_0x7269('0x20')]()['then'](function(){_0x51a602[_0x7269('0x18')](0xcc)[_0x7269('0x21')]();});}};}function handleEntityNotFound(_0x193a71,_0x23cb8a){return function(_0x2d6d01){if(!_0x2d6d01){_0x193a71[_0x7269('0x17')](0x194);}return _0x2d6d01;};}function handleError(_0x117eea,_0x41ceff){_0x41ceff=_0x41ceff||0x1f4;return function(_0x575093){logger[_0x7269('0x22')](_0x575093[_0x7269('0x23')]);if(_0x575093[_0x7269('0x24')]){delete _0x575093[_0x7269('0x24')];}_0x117eea['status'](_0x41ceff)[_0x7269('0x25')](_0x575093);};}exports['index']=function(_0x230c08,_0x226e56){var _0x58c0be={},_0x25300a={},_0x548667={'count':0x0,'rows':[]};var _0x2475c3=_['map'](db[_0x7269('0x26')][_0x7269('0x27')],function(_0x5c8805){return{'name':_0x5c8805[_0x7269('0x28')],'type':_0x5c8805['type'][_0x7269('0x29')]};});_0x25300a['model']=_[_0x7269('0x2a')](_[_0x7269('0x2b')](_0x2475c3,_0x7269('0x24')),[_0x7269('0x2c')]);_0x25300a[_0x7269('0x2d')]=_[_0x7269('0x2e')](_0x230c08[_0x7269('0x2d')]);_0x25300a['filters']=_[_0x7269('0x2f')](_0x25300a['model'],_0x25300a[_0x7269('0x2d')]);_0x58c0be[_0x7269('0x30')]=_['intersection'](_0x25300a['model'],qs[_0x7269('0x31')](_0x230c08[_0x7269('0x2d')][_0x7269('0x31')]));_0x58c0be['attributes']=_0x58c0be[_0x7269('0x30')][_0x7269('0x32')]?_0x58c0be[_0x7269('0x30')]:_0x25300a[_0x7269('0x33')];if(!_0x230c08[_0x7269('0x2d')]['hasOwnProperty'](_0x7269('0x34'))){_0x58c0be[_0x7269('0x1b')]=qs[_0x7269('0x1b')](_0x230c08[_0x7269('0x2d')][_0x7269('0x1b')]);_0x58c0be[_0x7269('0x1a')]=qs[_0x7269('0x1a')](_0x230c08['query'][_0x7269('0x1a')]);}_0x58c0be['order']=qs[_0x7269('0x35')](_0x230c08[_0x7269('0x2d')][_0x7269('0x35')]);_0x58c0be[_0x7269('0x36')]=qs[_0x7269('0x37')](_[_0x7269('0x38')](_0x230c08[_0x7269('0x2d')],_0x25300a[_0x7269('0x37')]));if(_0x230c08['query'][_0x7269('0x39')]){_0x58c0be[_0x7269('0x36')]=_[_0x7269('0x3a')](_0x58c0be[_0x7269('0x36')],{'$or':_['map'](_0x2475c3,function(_0x165351){if(_0x165351[_0x7269('0x3b')]!=='VIRTUAL'){var _0x5563b2={};_0x5563b2[_0x165351[_0x7269('0x24')]]={'$like':'%'+_0x230c08[_0x7269('0x2d')][_0x7269('0x39')]+'%'};return _0x5563b2;}})});}_0x58c0be=_[_0x7269('0x3a')]({},_0x58c0be,_0x230c08[_0x7269('0x3c')]);var _0x573bc1={'where':_0x58c0be[_0x7269('0x36')]};return db['VoiceRecording'][_0x7269('0x19')](_0x573bc1)[_0x7269('0x1f')](function(_0x4f9b79){_0x548667['count']=_0x4f9b79;if(_0x230c08[_0x7269('0x2d')]['includeAll']){_0x58c0be['include']=[{'all':!![]}];}return db[_0x7269('0x26')][_0x7269('0x3d')](_0x58c0be);})[_0x7269('0x1f')](function(_0x4d6b50){_0x548667['rows']=_0x4d6b50;return _0x548667;})['then'](respondWithFilteredResult(_0x226e56,_0x58c0be))[_0x7269('0x3e')](handleError(_0x226e56,null));};exports['show']=function(_0x1f9578,_0x4bf6f0){var _0x24f249={'raw':![],'where':{'id':_0x1f9578[_0x7269('0x3f')]['id']}},_0x5e944e={};_0x5e944e[_0x7269('0x33')]=_[_0x7269('0x2e')](db[_0x7269('0x26')]['rawAttributes']);_0x5e944e[_0x7269('0x2d')]=_[_0x7269('0x2e')](_0x1f9578[_0x7269('0x2d')]);_0x5e944e[_0x7269('0x37')]=_[_0x7269('0x2f')](_0x5e944e['model'],_0x5e944e[_0x7269('0x2d')]);_0x24f249['attributes']=_['intersection'](_0x5e944e[_0x7269('0x33')],qs['fields'](_0x1f9578[_0x7269('0x2d')][_0x7269('0x31')]));_0x24f249[_0x7269('0x30')]=_0x24f249['attributes'][_0x7269('0x32')]?_0x24f249[_0x7269('0x30')]:_0x5e944e['model'];if(_0x1f9578[_0x7269('0x2d')][_0x7269('0x40')]){_0x24f249[_0x7269('0x41')]=[{'all':!![]}];}_0x24f249=_['merge']({},_0x24f249,_0x1f9578[_0x7269('0x3c')]);return db['VoiceRecording'][_0x7269('0x42')](_0x24f249)[_0x7269('0x1f')](handleEntityNotFound(_0x4bf6f0,null))[_0x7269('0x1f')](respondWithResult(_0x4bf6f0,null))[_0x7269('0x3e')](handleError(_0x4bf6f0,null));};exports[_0x7269('0x43')]=function(_0x1560af,_0x6af098){return db[_0x7269('0x26')][_0x7269('0x43')](_0x1560af[_0x7269('0x44')],{})[_0x7269('0x1f')](respondWithResult(_0x6af098,0xc9))[_0x7269('0x3e')](handleError(_0x6af098,null));};exports['update']=function(_0x4b1235,_0x111d64){if(_0x4b1235[_0x7269('0x44')]['id']){delete _0x4b1235[_0x7269('0x44')]['id'];}return db['VoiceRecording'][_0x7269('0x42')]({'where':{'id':_0x4b1235[_0x7269('0x3f')]['id']}})['then'](handleEntityNotFound(_0x111d64,null))['then'](saveUpdates(_0x4b1235['body'],null))[_0x7269('0x1f')](respondWithResult(_0x111d64,null))[_0x7269('0x3e')](handleError(_0x111d64,null));};exports[_0x7269('0x45')]=function(_0x4c4fb8,_0x25a095){return db[_0x7269('0x26')]['describe']()[_0x7269('0x1f')](respondWithResult(_0x25a095,null))[_0x7269('0x3e')](handleError(_0x25a095,null));};exports[_0x7269('0x46')]=function(_0x10be6d,_0x213107,_0xc994a5){var _0x586f60=require(_0x7269('0x47'));var _0x2af61a=![];var _0x1fdb0b={};if(_0x10be6d[_0x7269('0x2d')][_0x7269('0x3b')]&&_0x10be6d[_0x7269('0x2d')][_0x7269('0x3b')]==='uniqueid'){_0x1fdb0b[_0x7269('0x48')]=_0x10be6d[_0x7269('0x3f')]['id'];}else{_0x1fdb0b['id']=_0x10be6d[_0x7269('0x3f')]['id'];}return db['VoiceRecording']['find']({'where':_0x1fdb0b,'attributes':['id',_0x7269('0x49')],'raw':!![]})['then'](handleEntityNotFound(_0x213107,null))[_0x7269('0x1f')](function(_0x34edc7){if(_0x34edc7){var _0x3d2b96=_0x34edc7[_0x7269('0x49')];var _0x5e305a=util[_0x7269('0x2c')](_0x7269('0x4a'),_0x3d2b96);if(fs['existsSync'](_0x5e305a)){_0x2af61a=!![];return _0x586f60[_0x7269('0x4b')](_0x5e305a,_0x3d2b96,config['secrets'][_0x7269('0x4c')])[_0x7269('0x1f')](function(){return _0x34edc7;});}return _0x34edc7;}})[_0x7269('0x1f')](function(_0x36ff35){if(_0x36ff35){var _0x48c343=_0x36ff35[_0x7269('0x49')];if(!fs[_0x7269('0x4d')](_0x48c343)){throw new db[(_0x7269('0x4e'))][(_0x7269('0x4f'))](_0x7269('0x50'));}if(_0x36ff35[_0x7269('0x51')]){return _0x213107[_0x7269('0x46')](_0x48c343,_0x36ff35['filename']+path[_0x7269('0x52')](_0x48c343),function(){if(_0x2af61a){fs['unlink'](_0x48c343);}});}else{return _0x213107[_0x7269('0x46')](_0x48c343,function(_0x1c1433){if(_0x2af61a){fs[_0x7269('0x53')](_0x48c343);}});}}})[_0x7269('0x3e')](function(_0x137ccd){if(_0x137ccd[_0x7269('0x54')]===_0x7269('0x50')){_0x213107[_0x7269('0x18')](0x194)[_0x7269('0x25')]('Not\x20found');}else{return handleError(_0x213107,null);}});};exports[_0x7269('0x55')]=function(_0x171441,_0x168b5b,_0x3b9a5d){var _0xdf222e=require(_0x7269('0x47'));var _0x4420b7=![];var _0x45d1ec={'$and':[db[_0x7269('0x56')][_0x7269('0x36')](db['sequelize']['fn'](_0x7269('0x57'),db['sequelize'][_0x7269('0x58')]('uniqueid')),_0x171441[_0x7269('0x2d')][_0x7269('0x59')])]};if(_0x171441['query'][_0x7269('0x3b')]&&_0x171441['query'][_0x7269('0x3b')]===_0x7269('0x48')){_0x45d1ec['$and'][_0x7269('0x5a')]({'uniqueid':_0x171441[_0x7269('0x3f')]['id']});}else{_0x45d1ec[_0x7269('0x5b')][_0x7269('0x5a')]({'id':_0x171441[_0x7269('0x3f')]['id']});}return db['VoiceRecording'][_0x7269('0x42')]({'where':_0x45d1ec,'attributes':['id',_0x7269('0x49')],'raw':!![]})['then'](handleEntityNotFound(_0x168b5b,null))['then'](function(_0x1b551a){if(_0x1b551a){var _0x587078=util[_0x7269('0x2c')](_0x7269('0x4a'),_0x1b551a[_0x7269('0x49')]);if(fs['existsSync'](_0x587078)){_0x4420b7=!![];return _0xdf222e['decryptFile'](_0x587078,_0x1b551a[_0x7269('0x49')],config['secrets'][_0x7269('0x4c')])[_0x7269('0x1f')](function(){return _0x1b551a;});}return _0x1b551a;}})[_0x7269('0x1f')](function(_0x18d1f9){if(_0x18d1f9){if(!fs[_0x7269('0x4d')](_0x18d1f9[_0x7269('0x49')])){throw new db[(_0x7269('0x4e'))][(_0x7269('0x4f'))]('VoiceRecording\x20not\x20found');}if(_0x18d1f9['filename']){return _0x168b5b[_0x7269('0x46')](_0x18d1f9[_0x7269('0x49')],_0x18d1f9['filename']+path[_0x7269('0x52')](_0x18d1f9['value']),function(){if(_0x4420b7){fs['unlink'](_0x18d1f9[_0x7269('0x49')]);}});}else{return _0x168b5b[_0x7269('0x46')](_0x18d1f9[_0x7269('0x49')],function(_0x130eda){if(_0x4420b7){fs[_0x7269('0x53')](_0x18d1f9[_0x7269('0x49')]);}});}}})[_0x7269('0x3e')](handleError(_0x168b5b,null));};exports[_0x7269('0x20')]=function(_0x1503d9,_0x5f05bc){return db[_0x7269('0x26')][_0x7269('0x42')]({'where':{'id':_0x1503d9[_0x7269('0x3f')]['id']}})[_0x7269('0x1f')](function(_0x3bb43f){if(!_0x3bb43f)throw new ReferenceError(_0x7269('0x5c'));return _0x3bb43f;})[_0x7269('0x1f')](function(_0x77dbdc){var _0x4b6863=_0x77dbdc[_0x7269('0x49')];logger['info'](_0x7269('0x5d'),_0x4b6863);if(!_[_0x7269('0x5e')](_0x77dbdc[_0x7269('0x49')])&&fs[_0x7269('0x4d')](_0x4b6863)){logger[_0x7269('0x5f')](_0x7269('0x60')+_0x4b6863+_0x7269('0x61'));fs[_0x7269('0x62')](_0x4b6863);}_0x4b6863=_0x4b6863+_0x7269('0x63');if(!_[_0x7269('0x5e')](_0x77dbdc[_0x7269('0x49')])&&fs[_0x7269('0x4d')](_0x4b6863)){logger[_0x7269('0x5f')](_0x7269('0x60')+_0x4b6863+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x7269('0x62')](_0x4b6863);}return _0x77dbdc;})[_0x7269('0x1f')](function(_0x48ef07){if(!_0x48ef07)throw new InternalError();return _0x48ef07['destroy']();})['then'](function(){_0x5f05bc[_0x7269('0x18')](0xcc)[_0x7269('0x21')]();})['catch'](handleError(_0x5f05bc,null));}; \ No newline at end of file +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 diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 0e9bd21..8843238 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 _0x4a60=['./voiceRecording.attributes','define','VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x981e4f,_0x5b6ee8){var _0x7c36d5=function(_0x4e61f4){while(--_0x4e61f4){_0x981e4f['push'](_0x981e4f['shift']());}};_0x7c36d5(++_0x5b6ee8);}(_0x4a60,0x6d));var _0x04a6=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x4a60[_0x1abb09];return _0xea1c07;};'use strict';var _=require(_0x04a6('0x0'));var util=require(_0x04a6('0x1'));var logger=require(_0x04a6('0x2'))(_0x04a6('0x3'));var moment=require(_0x04a6('0x4'));var BPromise=require('bluebird');var rp=require(_0x04a6('0x5'));var fs=require('fs');var path=require(_0x04a6('0x6'));var rimraf=require('rimraf');var config=require(_0x04a6('0x7'));var attributes=require(_0x04a6('0x8'));module['exports']=function(_0x3b0f5c,_0x454eea){return _0x3b0f5c[_0x04a6('0x9')](_0x04a6('0xa'),attributes,{'tableName':_0x04a6('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x04a6('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index d0bf6b8..5da56bd 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(_0x3a75a1,_0x18842d){var _0x1f9f87=function(_0x1f21c2){while(--_0x1f21c2){_0x3a75a1['push'](_0x3a75a1['shift']());}};_0x1f9f87(++_0x18842d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_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 diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 9616327..cd9ccb7 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 _0x4975=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','show','post','create','/:id','update','delete','destroy'];(function(_0x449fb5,_0x4b7fcd){var _0x2ce57a=function(_0x1088d8){while(--_0x1088d8){_0x449fb5['push'](_0x449fb5['shift']());}};_0x2ce57a(++_0x4b7fcd);}(_0x4975,0x86));var _0x5497=function(_0x573c51,_0x5f0ce9){_0x573c51=_0x573c51-0x0;var _0x46592e=_0x4975[_0x573c51];return _0x46592e;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var auth=require(_0x5497('0x5'));var interaction=require(_0x5497('0x6'));var config=require(_0x5497('0x7'));var controller=require(_0x5497('0x8'));router[_0x5497('0x9')]('/',auth[_0x5497('0xa')](),controller['index']);router[_0x5497('0x9')]('/:id',auth[_0x5497('0xa')](),controller[_0x5497('0xb')]);router[_0x5497('0xc')]('/',auth['isAuthenticated'](),controller[_0x5497('0xd')]);router['put'](_0x5497('0xe'),auth[_0x5497('0xa')](),controller[_0x5497('0xf')]);router[_0x5497('0x10')](_0x5497('0xe'),auth[_0x5497('0xa')](),controller[_0x5497('0x11')]);module[_0x5497('0x12')]=router; \ No newline at end of file +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 diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index d13efe9..311fdfe 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 _0xec5f=['STRING','sequelize','moment','exports','attended'];(function(_0x3c3567,_0x1bbb45){var _0x5c9b4d=function(_0x637a08){while(--_0x637a08){_0x3c3567['push'](_0x3c3567['shift']());}};_0x5c9b4d(++_0x1bbb45);}(_0xec5f,0x17d));var _0xfec5=function(_0x532d11,_0x324289){_0x532d11=_0x532d11-0x0;var _0x4b3aa3=_0xec5f[_0x532d11];return _0x4b3aa3;};'use strict';var Sequelize=require(_0xfec5('0x0'));var moment=require(_0xfec5('0x1'));module[_0xfec5('0x2')]={'type':{'type':Sequelize['ENUM']('blind',_0xfec5('0x3'))},'result':{'type':Sequelize[_0xfec5('0x4')]},'transfererchannel':{'type':Sequelize[_0xfec5('0x4')]},'transferercalleridnum':{'type':Sequelize[_0xfec5('0x4')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0xfec5('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0xfec5('0x4')]},'transfereraccountcode':{'type':Sequelize[_0xfec5('0x4')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xfec5('0x4')]},'transfererlinkedid':{'type':Sequelize[_0xfec5('0x4')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0xfec5('0x4')]},'transfereecalleridname':{'type':Sequelize[_0xfec5('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0xfec5('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0xfec5('0x4')]},'transfereecontext':{'type':Sequelize[_0xfec5('0x4')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize[_0xfec5('0x4')]},'extension':{'type':Sequelize[_0xfec5('0x4')]}}; \ No newline at end of file +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 diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 69ceeaa..3d0a1d4 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 _0xbdb7=['filters','intersection','attributes','length','hasOwnProperty','order','sort','where','filter','merge','includeAll','include','findAll','rows','show','params','fields','options','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','count','offset','limit','status','set','json','apply','reject','save','update','then','destroy','end','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x43c2de,_0x42e7d9){var _0xcab02a=function(_0xdc21f3){while(--_0xdc21f3){_0x43c2de['push'](_0x43c2de['shift']());}};_0xcab02a(++_0x42e7d9);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x4fcbbe,_0x55a068){_0x4fcbbe=_0x4fcbbe-0x0;var _0x2ac729=_0xbdb7[_0x4fcbbe];return _0x2ac729;};'use strict';var pdf=require(_0x7bdb('0x0'));var emlformat=require(_0x7bdb('0x1'));var rimraf=require(_0x7bdb('0x2'));var zipdir=require(_0x7bdb('0x3'));var jsonpatch=require(_0x7bdb('0x4'));var rp=require(_0x7bdb('0x5'));var moment=require(_0x7bdb('0x6'));var BPromise=require(_0x7bdb('0x7'));var Mustache=require(_0x7bdb('0x8'));var util=require('util');var path=require(_0x7bdb('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7bdb('0xa'));var fs=require('fs');var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var as=require(_0x7bdb('0x12'));var hardwareService=require(_0x7bdb('0x13'));var logger=require(_0x7bdb('0x14'))(_0x7bdb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3053d0,_0x25e3cb){_0x25e3cb=_0x25e3cb||0xcc;return function(_0x496613){if(_0x496613){return _0x3053d0[_0x7bdb('0x16')](_0x25e3cb);}return _0x3053d0['status'](_0x25e3cb)['end']();};}function respondWithResult(_0x2abca6,_0x46dd4a){_0x46dd4a=_0x46dd4a||0xc8;return function(_0x4fd91a){if(_0x4fd91a){return _0x2abca6['status'](_0x46dd4a)['json'](_0x4fd91a);}};}function respondWithFilteredResult(_0x4476ff,_0x195b2e){return function(_0xe9919f){if(_0xe9919f){var _0x25d417=_0xe9919f[_0x7bdb('0x17')],_0x31c909=_0x195b2e['offset'],_0xbde12a=_0x195b2e[_0x7bdb('0x18')]+_0x195b2e[_0x7bdb('0x19')],_0x3e96ac;if(_0xbde12a>=_0x25d417){_0xbde12a=_0x25d417;_0x3e96ac=0xc8;}else{_0x3e96ac=0xce;}_0x4476ff[_0x7bdb('0x1a')](_0x3e96ac);return _0x4476ff[_0x7bdb('0x1b')]('Content-Range',_0x31c909+'-'+_0xbde12a+'/'+_0x25d417)[_0x7bdb('0x1c')](_0xe9919f);}return null;};}function patchUpdates(_0x23e9eb){return function(_0x5b8481){try{jsonpatch[_0x7bdb('0x1d')](_0x5b8481,_0x23e9eb,!![]);}catch(_0x31f78e){return BPromise[_0x7bdb('0x1e')](_0x31f78e);}return _0x5b8481[_0x7bdb('0x1f')]();};}function saveUpdates(_0x112793,_0x5bfc35){return function(_0x49f353){if(_0x49f353){return _0x49f353[_0x7bdb('0x20')](_0x112793)[_0x7bdb('0x21')](function(_0x5daea4){return _0x5daea4;});}return null;};}function removeEntity(_0x341fe4,_0x118ea1){return function(_0x346c72){if(_0x346c72){return _0x346c72[_0x7bdb('0x22')]()[_0x7bdb('0x21')](function(){_0x341fe4['status'](0xcc)[_0x7bdb('0x23')]();});}};}function handleEntityNotFound(_0xdad53d,_0x40c447){return function(_0x3a456f){if(!_0x3a456f){_0xdad53d['sendStatus'](0x194);}return _0x3a456f;};}function handleError(_0x4d6e44,_0x3c423f){_0x3c423f=_0x3c423f||0x1f4;return function(_0x5eface){logger['error'](_0x5eface['stack']);if(_0x5eface[_0x7bdb('0x24')]){delete _0x5eface['name'];}_0x4d6e44[_0x7bdb('0x1a')](_0x3c423f)[_0x7bdb('0x25')](_0x5eface);};}exports[_0x7bdb('0x26')]=function(_0x7c09cf,_0x2a494e){var _0x523869={},_0x10e818={},_0x32242d={'count':0x0,'rows':[]};var _0x399b62=_[_0x7bdb('0x27')](db[_0x7bdb('0x28')][_0x7bdb('0x29')],function(_0x1e9996){return{'name':_0x1e9996[_0x7bdb('0x2a')],'type':_0x1e9996[_0x7bdb('0x2b')][_0x7bdb('0x2c')]};});_0x10e818[_0x7bdb('0x2d')]=_[_0x7bdb('0x27')](_0x399b62,'name');_0x10e818[_0x7bdb('0x2e')]=_[_0x7bdb('0x2f')](_0x7c09cf[_0x7bdb('0x2e')]);_0x10e818[_0x7bdb('0x30')]=_[_0x7bdb('0x31')](_0x10e818['model'],_0x10e818[_0x7bdb('0x2e')]);_0x523869[_0x7bdb('0x32')]=_[_0x7bdb('0x31')](_0x10e818[_0x7bdb('0x2d')],qs['fields'](_0x7c09cf['query']['fields']));_0x523869[_0x7bdb('0x32')]=_0x523869['attributes'][_0x7bdb('0x33')]?_0x523869['attributes']:_0x10e818[_0x7bdb('0x2d')];if(!_0x7c09cf[_0x7bdb('0x2e')][_0x7bdb('0x34')]('nolimit')){_0x523869[_0x7bdb('0x19')]=qs['limit'](_0x7c09cf['query'][_0x7bdb('0x19')]);_0x523869['offset']=qs[_0x7bdb('0x18')](_0x7c09cf['query']['offset']);}_0x523869[_0x7bdb('0x35')]=qs[_0x7bdb('0x36')](_0x7c09cf[_0x7bdb('0x2e')][_0x7bdb('0x36')]);_0x523869[_0x7bdb('0x37')]=qs[_0x7bdb('0x30')](_['pick'](_0x7c09cf[_0x7bdb('0x2e')],_0x10e818[_0x7bdb('0x30')]));if(_0x7c09cf[_0x7bdb('0x2e')][_0x7bdb('0x38')]){_0x523869[_0x7bdb('0x37')]=_[_0x7bdb('0x39')](_0x523869[_0x7bdb('0x37')],{'$or':_[_0x7bdb('0x27')](_0x399b62,function(_0xde82a0){if(_0xde82a0['type']!=='VIRTUAL'){var _0x19c237={};_0x19c237[_0xde82a0[_0x7bdb('0x24')]]={'$like':'%'+_0x7c09cf[_0x7bdb('0x2e')][_0x7bdb('0x38')]+'%'};return _0x19c237;}})});}_0x523869=_[_0x7bdb('0x39')]({},_0x523869,_0x7c09cf['options']);var _0x55f020={'where':_0x523869[_0x7bdb('0x37')]};return db['VoiceTransferReport'][_0x7bdb('0x17')](_0x55f020)['then'](function(_0x212b50){_0x32242d['count']=_0x212b50;if(_0x7c09cf['query'][_0x7bdb('0x3a')]){_0x523869[_0x7bdb('0x3b')]=[{'all':!![]}];}return db[_0x7bdb('0x28')][_0x7bdb('0x3c')](_0x523869);})[_0x7bdb('0x21')](function(_0x2b4829){_0x32242d[_0x7bdb('0x3d')]=_0x2b4829;return _0x32242d;})['then'](respondWithFilteredResult(_0x2a494e,_0x523869))['catch'](handleError(_0x2a494e,null));};exports[_0x7bdb('0x3e')]=function(_0x206888,_0x2dbb43){var _0x3509e4={'raw':!![],'where':{'id':_0x206888[_0x7bdb('0x3f')]['id']}},_0x39fbca={};_0x39fbca[_0x7bdb('0x2d')]=_['keys'](db['VoiceTransferReport'][_0x7bdb('0x29')]);_0x39fbca[_0x7bdb('0x2e')]=_[_0x7bdb('0x2f')](_0x206888[_0x7bdb('0x2e')]);_0x39fbca['filters']=_[_0x7bdb('0x31')](_0x39fbca['model'],_0x39fbca[_0x7bdb('0x2e')]);_0x3509e4[_0x7bdb('0x32')]=_[_0x7bdb('0x31')](_0x39fbca[_0x7bdb('0x2d')],qs[_0x7bdb('0x40')](_0x206888[_0x7bdb('0x2e')][_0x7bdb('0x40')]));_0x3509e4[_0x7bdb('0x32')]=_0x3509e4[_0x7bdb('0x32')]['length']?_0x3509e4[_0x7bdb('0x32')]:_0x39fbca[_0x7bdb('0x2d')];if(_0x206888['query'][_0x7bdb('0x3a')]){_0x3509e4['include']=[{'all':!![]}];}_0x3509e4=_[_0x7bdb('0x39')]({},_0x3509e4,_0x206888[_0x7bdb('0x41')]);return db[_0x7bdb('0x28')][_0x7bdb('0x42')](_0x3509e4)[_0x7bdb('0x21')](handleEntityNotFound(_0x2dbb43,null))['then'](respondWithResult(_0x2dbb43,null))[_0x7bdb('0x43')](handleError(_0x2dbb43,null));};exports[_0x7bdb('0x44')]=function(_0x12d889,_0x3eda2e){return db[_0x7bdb('0x28')]['create'](_0x12d889[_0x7bdb('0x45')],{})[_0x7bdb('0x21')](respondWithResult(_0x3eda2e,0xc9))[_0x7bdb('0x43')](handleError(_0x3eda2e,null));};exports[_0x7bdb('0x20')]=function(_0x259007,_0x25c534){if(_0x259007[_0x7bdb('0x45')]['id']){delete _0x259007[_0x7bdb('0x45')]['id'];}return db[_0x7bdb('0x28')][_0x7bdb('0x42')]({'where':{'id':_0x259007['params']['id']}})[_0x7bdb('0x21')](handleEntityNotFound(_0x25c534,null))['then'](saveUpdates(_0x259007['body'],null))[_0x7bdb('0x21')](respondWithResult(_0x25c534,null))[_0x7bdb('0x43')](handleError(_0x25c534,null));};exports['destroy']=function(_0x37780a,_0x186809){return db['VoiceTransferReport']['find']({'where':{'id':_0x37780a['params']['id']}})[_0x7bdb('0x21')](handleEntityNotFound(_0x186809,null))[_0x7bdb('0x21')](removeEntity(_0x186809,null))[_0x7bdb('0x43')](handleError(_0x186809,null));}; \ No newline at end of file +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 diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 32d0b77..5fc45bd 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 _0xe04a=['path','rimraf','../../config/environment','exports','define','VoiceTransferReport','report_call_transfer','lodash','../../config/logger','api','moment','bluebird'];(function(_0x196e83,_0x274469){var _0x45cee2=function(_0xef1dd8){while(--_0xef1dd8){_0x196e83['push'](_0x196e83['shift']());}};_0x45cee2(++_0x274469);}(_0xe04a,0x10f));var _0xae04=function(_0x301a97,_0x3e4dc7){_0x301a97=_0x301a97-0x0;var _0x4995b5=_0xe04a[_0x301a97];return _0x4995b5;};'use strict';var _=require(_0xae04('0x0'));var util=require('util');var logger=require(_0xae04('0x1'))(_0xae04('0x2'));var moment=require(_0xae04('0x3'));var BPromise=require(_0xae04('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xae04('0x5'));var rimraf=require(_0xae04('0x6'));var config=require(_0xae04('0x7'));var attributes=require('./voiceTransferReport.attributes');module[_0xae04('0x8')]=function(_0x29ea68,_0x4231a6){return _0x29ea68[_0xae04('0x9')](_0xae04('0xa'),attributes,{'tableName':_0xae04('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 13169f2..e803888 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 _0xb44a=['info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','request','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','options','raw'];(function(_0x140010,_0x4d7233){var _0x373bb8=function(_0x2b6291){while(--_0x2b6291){_0x140010['push'](_0x140010['shift']());}};_0x373bb8(++_0x4d7233);}(_0xb44a,0x12a));var _0xab44=function(_0x51edca,_0x18ad70){_0x51edca=_0x51edca-0x0;var _0x2b77ec=_0xb44a[_0x51edca];return _0x2b77ec;};'use strict';var _=require(_0xab44('0x0'));var util=require(_0xab44('0x1'));var moment=require(_0xab44('0x2'));var BPromise=require(_0xab44('0x3'));var rs=require(_0xab44('0x4'));var fs=require('fs');var Redis=require(_0xab44('0x5'));var db=require(_0xab44('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xab44('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xab44('0x8')][_0xab44('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e4514,_0x5226db,_0x5ba5f2){return new BPromise(function(_0x3fed37,_0x4a7048){return client[_0xab44('0xa')](_0x2e4514,_0x5ba5f2)[_0xab44('0xb')](function(_0x2d9238){logger['info'](_0xab44('0xc'),_0x5226db,_0xab44('0xd'));logger[_0xab44('0xe')](_0xab44('0xf'),_0x5226db,_0xab44('0xd'),JSON['stringify'](_0x2d9238));if(_0x2d9238['error']){if(_0x2d9238['error'][_0xab44('0x10')]===0x1f4){logger[_0xab44('0x11')](_0xab44('0xc'),_0x5226db,_0x2d9238[_0xab44('0x11')][_0xab44('0x12')]);return _0x4a7048(_0x2d9238[_0xab44('0x11')][_0xab44('0x12')]);}logger[_0xab44('0x11')](_0xab44('0xc'),_0x5226db,_0x2d9238['error'][_0xab44('0x12')]);return _0x3fed37(_0x2d9238[_0xab44('0x11')][_0xab44('0x12')]);}else{logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x5226db,_0xab44('0xd'));_0x3fed37(_0x2d9238[_0xab44('0x13')][_0xab44('0x12')]);}})[_0xab44('0x14')](function(_0x1f74e9){logger[_0xab44('0x11')](_0xab44('0xc'),_0x5226db,_0x1f74e9);_0x4a7048(_0x1f74e9);});});}exports[_0xab44('0x15')]=function(_0x38760c){var _0x3b0ae7=this;return new Promise(function(_0x328fb7,_0x588a7c){return db[_0xab44('0x16')][_0xab44('0x17')](_0x38760c['body'],{'raw':_0x38760c['options']?_0x38760c[_0xab44('0x18')][_0xab44('0x19')]===undefined?!![]:![]:!![]})[_0xab44('0xb')](function(_0x6e4b15){logger[_0xab44('0x1a')](_0xab44('0x15'),_0x38760c);logger['debug']('CreateVoiceTransferReport',_0x38760c,JSON['stringify'](_0x6e4b15));_0x328fb7(_0x6e4b15);})[_0xab44('0x14')](function(_0x274309){logger[_0xab44('0x11')](_0xab44('0x15'),_0x274309[_0xab44('0x12')],_0x38760c);_0x588a7c(_0x3b0ae7['error'](0x1f4,_0x274309['message']));});});}; \ No newline at end of file +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 diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index a5447f1..c290bda 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 _0x4de7=['isAuthenticated','originate','/hangup','canUpdate','hangup','/answer','answer','/hold','hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','../../components/auth/service','./webbar.controller','post','/originate'];(function(_0x3dc84c,_0x2dc628){var _0xe607d4=function(_0x2489e6){while(--_0x2489e6){_0x3dc84c['push'](_0x3dc84c['shift']());}};_0xe607d4(++_0x2dc628);}(_0x4de7,0x1f3));var _0x74de=function(_0x36301e,_0x3a3f6e){_0x36301e=_0x36301e-0x0;var _0x64b1f=_0x4de7[_0x36301e];return _0x64b1f;};'use strict';var express=require(_0x74de('0x0'));var router=express['Router']();var auth=require(_0x74de('0x1'));var controller=require(_0x74de('0x2'));router[_0x74de('0x3')](_0x74de('0x4'),auth[_0x74de('0x5')](),auth['canUpdate'](),controller[_0x74de('0x6')]);router[_0x74de('0x3')](_0x74de('0x7'),auth['isAuthenticated'](),auth[_0x74de('0x8')](),controller[_0x74de('0x9')]);router[_0x74de('0x3')](_0x74de('0xa'),auth[_0x74de('0x5')](),auth[_0x74de('0x8')](),controller[_0x74de('0xb')]);router[_0x74de('0x3')](_0x74de('0xc'),auth[_0x74de('0x5')](),auth['canUpdate'](),controller[_0x74de('0xd')]);router['post'](_0x74de('0xe'),auth[_0x74de('0x5')](),auth['canUpdate'](),controller[_0x74de('0xf')]);router[_0x74de('0x3')](_0x74de('0x10'),auth[_0x74de('0x5')](),auth[_0x74de('0x8')](),controller[_0x74de('0x11')]);router['post'](_0x74de('0x12'),auth['isAuthenticated'](),auth[_0x74de('0x8')](),controller[_0x74de('0x13')]);module[_0x74de('0x14')]=router; \ No newline at end of file +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 diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 1aa4e10..d53b47b 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 _0xe80c=['answer\x20fired:','sessionId','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','conference','webbar:conference','transfer','transfer\x20fired:','transferNumber','webbar:transfer','lodash','../../mysqldb','../../config/environment','util','bluebird','client','http','../../config/logger','webbarapi','redis','defaults','socket.io-emitter','validate','userId\x20is\x20required','string','number','sessionId\x20is\x20required','emit','log','handleError:','stack','name','status','send','NotFound','then','error','message','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','length','originate','info','originate\x20fired:','body','json','userId','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','catch','hangup','hangup\x20fired:','hangup\x20executed!'];(function(_0x3330fc,_0xbc3547){var _0x99d540=function(_0x3de584){while(--_0x3de584){_0x3330fc['push'](_0x3330fc['shift']());}};_0x99d540(++_0xbc3547);}(_0xe80c,0x1c2));var _0xce80=function(_0x5476d7,_0x4fac0d){_0x5476d7=_0x5476d7-0x0;var _0x3a9ac7=_0xe80c[_0x5476d7];return _0x3a9ac7;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0xce80('0x0'));var db=require(_0xce80('0x1'))['db'];var config=require(_0xce80('0x2'));var util=require(_0xce80('0x3'));var BPromise=require(_0xce80('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0xce80('0x5')][_0xce80('0x6')]({'port':0x232a});var logger=require(_0xce80('0x7'))(_0xce80('0x8'));var Redis=require('ioredis');config[_0xce80('0x9')]=_[_0xce80('0xa')](config[_0xce80('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xce80('0xb'))(new Redis(config['redis']));var Schema=require(_0xce80('0xc'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0xce80('0xd')]},'callNumber':{'type':_0xce80('0xe'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':_0xce80('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0xce80('0xf'),'required':[!![],_0xce80('0xd')]},'sessionId':{'type':_0xce80('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xce80('0xf'),'required':[!![],_0xce80('0xd')]},'sessionId':{'type':_0xce80('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xce80('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xce80('0xe'),'required':[!![],_0xce80('0x10')]},'transferNumber':{'type':_0xce80('0xe'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xce80('0xd')]},'sessionId':{'type':_0xce80('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xce80('0xf'),'required':[!![],_0xce80('0xd')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xce80('0xf'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0xce80('0xf'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x24efa3,_0x43b8da,_0x4a8cab){logger['info'](_0x24efa3,_0x43b8da,JSON['stringify'](_0x4a8cab));io['to'](_0x24efa3)[_0xce80('0x11')](_0x43b8da,_0x4a8cab);}function handleError(_0xea0d){return function(_0x148d57){console[_0xce80('0x12')](_0xce80('0x13'),_0x148d57,_0x148d57 instanceof RangeError);logger['error'](_0x148d57[_0xce80('0x14')]);if(_0x148d57 instanceof RangeError){if(_0x148d57[_0xce80('0x15')]){delete _0x148d57['name'];}_0xea0d['status'](0x194)['send'](_0x148d57);}else{if(_0x148d57[_0xce80('0x15')]){delete _0x148d57[_0xce80('0x15')];}_0xea0d[_0xce80('0x16')](0x1f4)[_0xce80('0x17')](_0x148d57);}};}function checkError(){return function(_0x4d9822){if(!_0x4d9822){throw new RangeError(_0xce80('0x18'));}return _0x4d9822;};}function respondWithRpcPromise(_0x10ba3d,_0x2c0fcd){return new BPromise(function(_0x5315eb,_0x4df9bb){var _0x116b5e=amiClient;return _0x116b5e['request'](_0x10ba3d,_0x2c0fcd)[_0xce80('0x19')](function(_0x348d2d){if(_0x348d2d[_0xce80('0x1a')]){if(_0x348d2d[_0xce80('0x1a')]['code']===0x1f4){return _0x4df9bb(_0x348d2d[_0xce80('0x1a')]['message']);}return _0x5315eb(_0x348d2d[_0xce80('0x1a')][_0xce80('0x1b')]);}else{_0x5315eb(_0x348d2d['result']);}})['catch'](function(_0x2b2dc3){_0x4df9bb(_0x2b2dc3);});});}function getAgent(_0x5bb57e){return db[_0xce80('0x1c')][_0xce80('0x1d')]({'where':{'id':_0x5bb57e,'role':_0xce80('0x1e')}})[_0xce80('0x19')](checkError());}function getAgentCheckSession(_0x4c3e8a,_0x8fd32c){return new BPromise(function(_0x148e90,_0x1fec80){var _0x3d7c49=respondWithRpcPromise(_0xce80('0x1f'));var _0x4792fe=getAgent(_0x4c3e8a);Promise[_0xce80('0x20')]([_0x3d7c49,_0x4792fe])[_0xce80('0x19')](function(_0x51b5bf){var _0x40cd7e=_0x51b5bf[0x0];var _0x43ffb6=_0x51b5bf[0x1];var _0xa861d8=_[_0xce80('0x21')](_0x40cd7e[_0xce80('0x22')],function(_0x2f445c){return _0x2f445c[_0xce80('0x23')]==_0x43ffb6['id']&&_0x2f445c['sessionId']==_0x8fd32c;});if(_0xa861d8[_0xce80('0x24')]==0x1){_0x148e90(_0x43ffb6);}else{_0x1fec80(new RangeError('sessionId\x20'+_0x8fd32c+'\x20not\x20found!'));}});});}exports[_0xce80('0x25')]=function(_0x1b63f9,_0x39c1c0){logger[_0xce80('0x26')](_0xce80('0x27'),_0x1b63f9[_0xce80('0x28')]);var _0x2fe975=originateValidation[_0xce80('0xc')](_0x1b63f9['body']);if(_0x2fe975[_0xce80('0x24')]>0x0){return _0x39c1c0['status'](0x190)[_0xce80('0x29')](_0x2fe975);}var _0xc9b0d1=_0x1b63f9[_0xce80('0x28')][_0xce80('0x2a')];var _0xa3a711=_0x1b63f9[_0xce80('0x28')]['callNumber'];var _0x298b90=_0x1b63f9[_0xce80('0x28')][_0xce80('0x2b')];var _0x322e00=_0x1b63f9[_0xce80('0x28')][_0xce80('0x2c')];return getAgent(_0xc9b0d1)['then'](function(_0x4848d1){logger[_0xce80('0x26')](_0xce80('0x2d'),_0x4848d1[_0xce80('0x15')]);emit(util[_0xce80('0x2e')](_0xce80('0x2f'),_0x4848d1['name']),_0xce80('0x30'),{'callNumber':_0xa3a711,'callerId':_0x298b90,'callbackUrl':_0x322e00});return _0x39c1c0[_0xce80('0x16')](0xc8)[_0xce80('0x29')]({'error':![],'message':_0xce80('0x31')});})[_0xce80('0x32')](handleError(_0x39c1c0));};exports[_0xce80('0x33')]=function(_0x1acc00,_0x1a934d){logger[_0xce80('0x26')](_0xce80('0x34'),_0x1acc00['body']);var _0xd8dc54=hangupValidation['validate'](_0x1acc00[_0xce80('0x28')]);if(_0xd8dc54[_0xce80('0x24')]>0x0){return _0x1a934d[_0xce80('0x16')](0x190)[_0xce80('0x29')](_0xd8dc54);}var _0x222b08=_0x1acc00['body'][_0xce80('0x2a')];var _0x4273dd=_0x1acc00[_0xce80('0x28')]['sessionId'];return getAgent(_0x222b08)[_0xce80('0x19')](function(_0x4908c8){logger[_0xce80('0x26')](_0xce80('0x2d'),_0x4908c8[_0xce80('0x15')]);emit(util[_0xce80('0x2e')](_0xce80('0x2f'),_0x4908c8[_0xce80('0x15')]),'webbar:hangup',{'sessionId':_0x4273dd});return _0x1a934d[_0xce80('0x16')](0xc8)[_0xce80('0x29')]({'error':![],'message':_0xce80('0x35')});})[_0xce80('0x32')](handleError(_0x1a934d));};exports['answer']=function(_0x406d64,_0x561385){logger[_0xce80('0x26')](_0xce80('0x36'),_0x406d64[_0xce80('0x28')]);var _0x4167b9=answerValidation[_0xce80('0xc')](_0x406d64[_0xce80('0x28')]);if(_0x4167b9[_0xce80('0x24')]>0x0){return _0x561385[_0xce80('0x16')](0x190)[_0xce80('0x29')](_0x4167b9);}var _0x5ef5a2=_0x406d64[_0xce80('0x28')][_0xce80('0x2a')];var _0x215d8f=_0x406d64['body'][_0xce80('0x37')];return getAgent(_0x5ef5a2)[_0xce80('0x19')](function(_0x6e07b8){logger['info'](_0xce80('0x2d'),_0x6e07b8['name']);emit(util[_0xce80('0x2e')](_0xce80('0x2f'),_0x6e07b8[_0xce80('0x15')]),'webbar:answer',{'sessionId':_0x215d8f});return _0x561385[_0xce80('0x16')](0xc8)[_0xce80('0x29')]({'error':![],'message':_0xce80('0x38')});})['catch'](handleError(_0x561385));};exports[_0xce80('0x39')]=function(_0x55dbc1,_0x56d12d){logger[_0xce80('0x26')](_0xce80('0x3a'),_0x55dbc1[_0xce80('0x28')]);var _0x4115ea=holdValidation[_0xce80('0xc')](_0x55dbc1[_0xce80('0x28')]);if(_0x4115ea[_0xce80('0x24')]>0x0){return _0x56d12d[_0xce80('0x16')](0x190)['json'](_0x4115ea);}var _0x217fa4=_0x55dbc1['body'][_0xce80('0x2a')];var _0x2dd290=_0x55dbc1[_0xce80('0x28')][_0xce80('0x37')];return getAgent(_0x217fa4)[_0xce80('0x19')](function(_0x118583){logger['info'](_0xce80('0x2d'),_0x118583['name']);emit(util[_0xce80('0x2e')]('user:%s',_0x118583['name']),_0xce80('0x3b'),{'sessionId':_0x2dd290});return _0x56d12d[_0xce80('0x16')](0xc8)[_0xce80('0x29')]({'error':![],'message':_0xce80('0x3c')});})['catch'](handleError(_0x56d12d));};exports[_0xce80('0x3d')]=function(_0xc420ef,_0x56dc30){logger[_0xce80('0x26')](_0xce80('0x3e'),_0xc420ef[_0xce80('0x28')]);var _0x62d2ee=unholdValidation['validate'](_0xc420ef['body']);if(_0x62d2ee['length']>0x0){return _0x56dc30[_0xce80('0x16')](0x190)[_0xce80('0x29')](_0x62d2ee);}var _0x2735e9=_0xc420ef['body']['userId'];var _0x18e21c=_0xc420ef['body'][_0xce80('0x37')];return getAgent(_0x2735e9)[_0xce80('0x19')](function(_0x37de63){logger[_0xce80('0x26')](_0xce80('0x2d'),_0x37de63[_0xce80('0x15')]);emit(util[_0xce80('0x2e')](_0xce80('0x2f'),_0x37de63[_0xce80('0x15')]),_0xce80('0x3f'),{'sessionId':_0x18e21c});return _0x56dc30[_0xce80('0x16')](0xc8)['json']({'error':![],'message':_0xce80('0x40')});})[_0xce80('0x32')](handleError(_0x56dc30));};exports[_0xce80('0x41')]=function(_0x1b6460,_0x514843){logger[_0xce80('0x26')]('calls\x20fired:',_0x514843[_0xce80('0x28')]);var _0x1cc190=callsValidation[_0xce80('0xc')](_0x1b6460[_0xce80('0x28')]);if(_0x1cc190[_0xce80('0x24')]>0x0){return _0x514843[_0xce80('0x16')](0x190)[_0xce80('0x29')](_0x1cc190);}var _0x6487b8=_0x1b6460[_0xce80('0x28')][_0xce80('0x2a')];var _0x47e74c=respondWithRpcPromise(_0xce80('0x1f'));var _0x1e5c36=getAgent(_0x6487b8);return Promise[_0xce80('0x20')]([_0x47e74c,_0x1e5c36])[_0xce80('0x19')](function(_0x1bca6c){var _0x8aad3e=_0x1bca6c[0x0];var _0x183533=_0x1bca6c[0x1];var _0x10e445=_[_0xce80('0x21')](_0x8aad3e[_0xce80('0x22')],function(_0xbbd778){return _0xbbd778[_0xce80('0x23')]==_0x183533['id'];});return _0x514843[_0xce80('0x16')](0xc8)[_0xce80('0x29')]({'count':_0x10e445['length'],'rows':_0x10e445});})[_0xce80('0x32')](handleError(_0x514843));};exports[_0xce80('0x42')]=function(_0x33234a,_0x4af419){logger[_0xce80('0x26')]('conference\x20fired:',_0x33234a['body']);var _0x2a8d9f=conferenceValidation['validate'](_0x33234a[_0xce80('0x28')]);if(_0x2a8d9f[_0xce80('0x24')]>0x0){return _0x4af419[_0xce80('0x16')](0x190)['json'](_0x2a8d9f);}var _0x5474fa=_0x33234a['body'][_0xce80('0x2a')];return getAgent(_0x5474fa)[_0xce80('0x19')](function(_0x2028a8){logger[_0xce80('0x26')](_0xce80('0x2d'),_0x2028a8[_0xce80('0x15')]);emit(util[_0xce80('0x2e')](_0xce80('0x2f'),_0x2028a8[_0xce80('0x15')]),_0xce80('0x43'));return _0x4af419[_0xce80('0x16')](0xc8)[_0xce80('0x29')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x4af419));};exports[_0xce80('0x44')]=function(_0x3b5ad3,_0x29b26d){logger['info'](_0xce80('0x45'),_0x3b5ad3[_0xce80('0x28')]);var _0x3a212e=transferValidation['validate'](_0x3b5ad3[_0xce80('0x28')]);if(_0x3a212e[_0xce80('0x24')]>0x0){return _0x29b26d[_0xce80('0x16')](0x190)[_0xce80('0x29')](_0x3a212e);}var _0x4cc60b=_0x3b5ad3[_0xce80('0x28')]['userId'];var _0x15ea07=_0x3b5ad3[_0xce80('0x28')][_0xce80('0x37')];var _0x171103=_0x3b5ad3[_0xce80('0x28')][_0xce80('0x46')];return getAgent(_0x4cc60b)[_0xce80('0x19')](function(_0x19b642){logger[_0xce80('0x26')](_0xce80('0x2d'),_0x19b642[_0xce80('0x15')]);emit(util[_0xce80('0x2e')](_0xce80('0x2f'),_0x19b642[_0xce80('0x15')]),_0xce80('0x47'),{'sessionId':_0x15ea07,'transferNumber':_0x171103});return _0x29b26d['status'](0xc8)['json']({'error':![],'message':'transfer\x20executed!'});})[_0xce80('0x32')](handleError(_0x29b26d));}; \ No newline at end of file +var _0x4a81=['userId','callNumber','callerId','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','calls','conference','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','webbar:transfer','path','lodash','../../mysqldb','../../config/environment','jayson/promise','http','../../config/logger','redis','socket.io-emitter','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','info','emit','log','handleError:','error','stack','name','status','send','request','code','message','result','catch','User','findOne','agent','then','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','json','body'];(function(_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 diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 897c0d1..b80999c 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 _0xa41a=['/:id','destroy','delete','removeDispositions','removeAnswers','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','describe','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','getApplications','post','create','addDisposition','addAnswer','addAgents','/:id/applications','addApplications','/:id/notify','/:id/send','send'];(function(_0x1cd98d,_0x224986){var _0x5c5b50=function(_0x4080fd){while(--_0x4080fd){_0x1cd98d['push'](_0x1cd98d['shift']());}};_0x5c5b50(++_0x224986);}(_0xa41a,0x6b));var _0xaa41=function(_0x1b903b,_0x1b8a87){_0x1b903b=_0x1b903b-0x0;var _0x129d33=_0xa41a[_0x1b903b];return _0x129d33;};'use strict';var multer=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var path=require('path');var timeout=require(_0xaa41('0x2'));var express=require(_0xaa41('0x3'));var router=express[_0xaa41('0x4')]();var auth=require(_0xaa41('0x5'));var interaction=require(_0xaa41('0x6'));var config=require(_0xaa41('0x7'));var controller=require(_0xaa41('0x8'));router[_0xaa41('0x9')]('/',auth['isAuthenticated'](),controller[_0xaa41('0xa')]);router[_0xaa41('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xaa41('0xb')]);router[_0xaa41('0x9')]('/:id',auth[_0xaa41('0xc')](),controller[_0xaa41('0xd')]);router[_0xaa41('0x9')](_0xaa41('0xe'),auth[_0xaa41('0xc')](),controller[_0xaa41('0xf')]);router[_0xaa41('0x9')](_0xaa41('0x10'),auth[_0xaa41('0xc')](),controller['getAnswers']);router[_0xaa41('0x9')](_0xaa41('0x11'),auth['isAuthenticated'](),controller['getAgents']);router[_0xaa41('0x9')]('/:id/applications',auth[_0xaa41('0xc')](),controller[_0xaa41('0x12')]);router[_0xaa41('0x13')]('/',auth[_0xaa41('0xc')](),controller[_0xaa41('0x14')]);router['post'](_0xaa41('0xe'),auth[_0xaa41('0xc')](),controller[_0xaa41('0x15')]);router[_0xaa41('0x13')](_0xaa41('0x10'),auth[_0xaa41('0xc')](),controller[_0xaa41('0x16')]);router['post'](_0xaa41('0x11'),auth[_0xaa41('0xc')](),controller[_0xaa41('0x17')]);router[_0xaa41('0x13')](_0xaa41('0x18'),auth[_0xaa41('0xc')](),controller[_0xaa41('0x19')]);router[_0xaa41('0x13')](_0xaa41('0x1a'),controller['notify']);router['post'](_0xaa41('0x1b'),auth[_0xaa41('0xc')](),controller[_0xaa41('0x1c')]);router['put'](_0xaa41('0x1d'),auth[_0xaa41('0xc')](),controller['update']);router['delete'](_0xaa41('0x1d'),auth['isAuthenticated'](),controller[_0xaa41('0x1e')]);router[_0xaa41('0x1f')](_0xaa41('0xe'),auth[_0xaa41('0xc')](),controller[_0xaa41('0x20')]);router['delete'](_0xaa41('0x10'),auth[_0xaa41('0xc')](),controller[_0xaa41('0x21')]);router[_0xaa41('0x1f')](_0xaa41('0x11'),auth[_0xaa41('0xc')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 28fd53e..eeb80ca 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 _0x82a3=['randomstring','name','STRING','generate','ENUM','twilio','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x82a3,0x14a));var _0x382a=function(_0x1925bd,_0x3d880a){_0x1925bd=_0x1925bd-0x0;var _0x270fd5=_0x82a3[_0x1925bd];return _0x270fd5;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x382a('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x382a('0x1'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x382a('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x382a('0x2')],'defaultValue':function(){return rs[_0x382a('0x3')]();}},'phone':{'type':Sequelize[_0x382a('0x2')]},'type':{'type':Sequelize[_0x382a('0x4')](_0x382a('0x5'))},'accountSid':{'type':Sequelize[_0x382a('0x2')]},'authToken':{'type':Sequelize[_0x382a('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x382a('0x6')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x382a('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x382a('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x382a('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x382a('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x382a('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x382a('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x382a('0x6')],'defaultValue':![],'comment':_0x382a('0x9'),'set':function(_0x1e76b9){if(!_0x1e76b9){this[_0x382a('0xa')]('mandatoryDispositionPauseId',null);}this[_0x382a('0xa')]('mandatoryDisposition',_0x1e76b9);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +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 diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 30fd085..96f5efb 100644 --- a/server/api/whatsappAccount/whatsappAccount.controller.js +++ b/server/api/whatsappAccount/whatsappAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd64b=['waitForTheAssignedAgent','Start','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','\x0a','to\x20is\x20mandatory','CmList','List','DESC','out','Messages','dataValues','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','test','ValidationError','request','info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','catch','status','json','count','offset','limit','apply','save','update','then','destroy','get','end','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','rawAttributes','type','key','model','map','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','WhatsappAccount','includeAll','include','findAll','rows','show','length','find','create','body','user','WhatsappAccounts','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','WhatsappAccountId','Disposition','getDispositions','findOne','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','spread','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','emit','getAgents','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','getApplications','notify','whatsapp','Applications','account','applications','priority','asc','CmContact','difference','createdAt','updatedAt','twilio','From','replace','whatsapp:','Body','messageId','MessageSid','from','from\x20is\x20mandatory','isNil','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','ListId','Contacts','contact','WhatsappInteraction','interaction','created','autoclose','push','close','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId','agent'];(function(_0x6b0088,_0x5c4d84){var _0x37b395=function(_0x258557){while(--_0x258557){_0x6b0088['push'](_0x6b0088['shift']());}};_0x37b395(++_0x5c4d84);}(_0xd64b,0xc1));var _0xbd64=function(_0x332ff9,_0x2a6021){_0x332ff9=_0x332ff9-0x0;var _0x11ca93=_0xd64b[_0x332ff9];return _0x11ca93;};'use strict';var pdf=require(_0xbd64('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbd64('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbd64('0x2'));var rp=require(_0xbd64('0x3'));var moment=require(_0xbd64('0x4'));var BPromise=require(_0xbd64('0x5'));var Mustache=require(_0xbd64('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbd64('0x7'));var fs=require('fs');var _=require(_0xbd64('0x8'));var squel=require(_0xbd64('0x9'));var crypto=require(_0xbd64('0xa'));var jsforce=require(_0xbd64('0xb'));var deskjs=require(_0xbd64('0xc'));var toCsv=require(_0xbd64('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbd64('0xe'));var authService=require(_0xbd64('0xf'));var qs=require(_0xbd64('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd64('0x11'));var logger=require(_0xbd64('0x12'))(_0xbd64('0x13'));var utils=require(_0xbd64('0x14'));var config=require('../../config/environment');var db=require(_0xbd64('0x15'))['db'];config['redis']=_[_0xbd64('0x16')](config[_0xbd64('0x17')],{'host':_0xbd64('0x18'),'port':0x18eb});var socket=require(_0xbd64('0x19'))(new Redis(config[_0xbd64('0x17')]));require(_0xbd64('0x1a'))[_0xbd64('0x1b')](socket);var jayson=require(_0xbd64('0x1c'));var client=jayson[_0xbd64('0x1d')]['http']({'port':0x232c});function checkPasswordPattern(_0x2d1159,_0x13e7a4,_0x3ff550){if(_0x3ff550){var _0x32fd34=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x32fd34[_0xbd64('0x1e')](_0x13e7a4)){return _0x2d1159;}else{throw new db['Sequelize'][(_0xbd64('0x1f'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x2d1159;}}function respondWithRpcPromise(_0xccb0d5,_0x1432a6,_0x3aef70,_0x1d7a14){return new BPromise(function(_0x17d015,_0x2f4554){var _0xa5491d=_0x1d7a14||client;return _0xa5491d[_0xbd64('0x20')](_0xccb0d5,_0x3aef70)['then'](function(_0x305545){logger[_0xbd64('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0x1432a6,'request\x20sent');logger[_0xbd64('0x22')](_0xbd64('0x23'),_0x1432a6,_0xbd64('0x24'),JSON[_0xbd64('0x25')](_0x305545));if(_0x305545[_0xbd64('0x26')]){if(_0x305545[_0xbd64('0x26')]['code']===0x1f4){logger['error'](_0xbd64('0x27'),_0x1432a6,_0x305545[_0xbd64('0x26')][_0xbd64('0x28')]);return _0x2f4554(_0x305545[_0xbd64('0x26')]['message']);}logger['error'](_0xbd64('0x27'),_0x1432a6,_0x305545['error'][_0xbd64('0x28')]);return _0x17d015(_0x305545['error'][_0xbd64('0x28')]);}else{logger[_0xbd64('0x21')](_0xbd64('0x27'),_0x1432a6,_0xbd64('0x24'));_0x17d015(_0x305545['result'][_0xbd64('0x28')]);}})[_0xbd64('0x29')](function(_0x13f527){logger[_0xbd64('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x1432a6,_0x13f527);_0x2f4554(_0x13f527);});});}function respondWithStatusCode(_0x4e8719,_0x29c9c8){_0x29c9c8=_0x29c9c8||0xcc;return function(_0x49eac5){if(_0x49eac5){return _0x4e8719['sendStatus'](_0x29c9c8);}return _0x4e8719[_0xbd64('0x2a')](_0x29c9c8)['end']();};}function respondWithResult(_0x3cf5b7,_0x5300e8){_0x5300e8=_0x5300e8||0xc8;return function(_0x28199c){if(_0x28199c){return _0x3cf5b7['status'](_0x5300e8)[_0xbd64('0x2b')](_0x28199c);}};}function respondWithFilteredResult(_0x3c0eaf,_0x3be63a){return function(_0x210fff){if(_0x210fff){var _0x306f19=_0x210fff[_0xbd64('0x2c')],_0x207ffc=_0x3be63a[_0xbd64('0x2d')],_0x4ed44a=_0x3be63a[_0xbd64('0x2d')]+_0x3be63a[_0xbd64('0x2e')],_0x35bdd5;if(_0x4ed44a>=_0x306f19){_0x4ed44a=_0x306f19;_0x35bdd5=0xc8;}else{_0x35bdd5=0xce;}_0x3c0eaf[_0xbd64('0x2a')](_0x35bdd5);return _0x3c0eaf['set']('Content-Range',_0x207ffc+'-'+_0x4ed44a+'/'+_0x306f19)[_0xbd64('0x2b')](_0x210fff);}return null;};}function patchUpdates(_0x576604){return function(_0xebed78){try{jsonpatch[_0xbd64('0x2f')](_0xebed78,_0x576604,!![]);}catch(_0x54459f){return BPromise['reject'](_0x54459f);}return _0xebed78[_0xbd64('0x30')]();};}function saveUpdates(_0x4e1834,_0x5b6948){return function(_0x1867af){if(_0x1867af){return _0x1867af[_0xbd64('0x31')](_0x4e1834)[_0xbd64('0x32')](function(_0x50c58e){return _0x50c58e;});}return null;};}function removeEntity(_0x231c37,_0x569cb6){return function(_0x1fc9cf){if(_0x1fc9cf){return _0x1fc9cf[_0xbd64('0x33')]()[_0xbd64('0x32')](function(){var _0x243588=_0x1fc9cf[_0xbd64('0x34')]({'plain':!![]});var _0x429aec='WhatsappAccounts';return db['UserProfileResource'][_0xbd64('0x33')]({'where':{'type':_0x429aec,'resourceId':_0x243588['id']}})[_0xbd64('0x32')](function(){return _0x1fc9cf;});})[_0xbd64('0x32')](function(){_0x231c37[_0xbd64('0x2a')](0xcc)[_0xbd64('0x35')]();});}};}function handleEntityNotFound(_0x3b245e,_0x54784f){return function(_0x5a74a9){if(!_0x5a74a9){_0x3b245e[_0xbd64('0x36')](0x194);}return _0x5a74a9;};}function handleError(_0x1bcd4c,_0x21f518){_0x21f518=_0x21f518||0x1f4;return function(_0x4df52a){logger['error'](_0x4df52a[_0xbd64('0x37')]);if(_0x4df52a['name']){delete _0x4df52a[_0xbd64('0x38')];}_0x1bcd4c['status'](_0x21f518)[_0xbd64('0x39')](_0x4df52a);};}exports[_0xbd64('0x3a')]=function(_0x550221,_0x107da1){var _0x51ae42={'include':[{'model':db[_0xbd64('0x3b')],'as':_0xbd64('0x3c')}]},_0x534091={},_0x380f32={'count':0x0,'rows':[]};var _0x52f401=_['map'](db['WhatsappAccount'][_0xbd64('0x3d')],function(_0xbfd402){return{'name':_0xbfd402['fieldName'],'type':_0xbfd402[_0xbd64('0x3e')][_0xbd64('0x3f')]};});_0x534091[_0xbd64('0x40')]=_[_0xbd64('0x41')](_0x52f401,'name');_0x534091['query']=_[_0xbd64('0x42')](_0x550221['query']);_0x534091['filters']=_[_0xbd64('0x43')](_0x534091[_0xbd64('0x40')],_0x534091[_0xbd64('0x44')]);_0x51ae42[_0xbd64('0x45')]=_[_0xbd64('0x43')](_0x534091[_0xbd64('0x40')],qs[_0xbd64('0x46')](_0x550221[_0xbd64('0x44')]['fields']));_0x51ae42[_0xbd64('0x45')]=_0x51ae42[_0xbd64('0x45')]['length']?_0x51ae42[_0xbd64('0x45')]:_0x534091[_0xbd64('0x40')];if(!_0x550221[_0xbd64('0x44')][_0xbd64('0x47')](_0xbd64('0x48'))){_0x51ae42[_0xbd64('0x2e')]=qs[_0xbd64('0x2e')](_0x550221['query'][_0xbd64('0x2e')]);_0x51ae42['offset']=qs[_0xbd64('0x2d')](_0x550221['query'][_0xbd64('0x2d')]);}_0x51ae42[_0xbd64('0x49')]=qs[_0xbd64('0x4a')](_0x550221['query'][_0xbd64('0x4a')]);_0x51ae42['where']=qs['filters'](_['pick'](_0x550221[_0xbd64('0x44')],_0x534091[_0xbd64('0x4b')]),_0x52f401);if(_0x550221[_0xbd64('0x44')][_0xbd64('0x4c')]){_0x51ae42[_0xbd64('0x4d')]=_[_0xbd64('0x4e')](_0x51ae42[_0xbd64('0x4d')],{'$or':_['map'](_0x52f401,function(_0x59ac2d){if(_0x59ac2d[_0xbd64('0x3e')]!==_0xbd64('0x4f')){var _0x4e5efe={};_0x4e5efe[_0x59ac2d[_0xbd64('0x38')]]={'$like':'%'+_0x550221[_0xbd64('0x44')][_0xbd64('0x4c')]+'%'};return _0x4e5efe;}})});}_0x51ae42=_[_0xbd64('0x4e')]({},_0x51ae42,_0x550221[_0xbd64('0x50')]);var _0x5a6b5e={'where':_0x51ae42[_0xbd64('0x4d')]};return db[_0xbd64('0x51')][_0xbd64('0x2c')](_0x5a6b5e)[_0xbd64('0x32')](function(_0x485cd1){_0x380f32['count']=_0x485cd1;if(_0x550221[_0xbd64('0x44')][_0xbd64('0x52')]){_0x51ae42[_0xbd64('0x53')]=[{'all':!![]}];}return db[_0xbd64('0x51')][_0xbd64('0x54')](_0x51ae42);})[_0xbd64('0x32')](function(_0x49cd2f){_0x380f32[_0xbd64('0x55')]=_0x49cd2f;return _0x380f32;})[_0xbd64('0x32')](respondWithFilteredResult(_0x107da1,_0x51ae42))[_0xbd64('0x29')](handleError(_0x107da1,null));};exports[_0xbd64('0x56')]=function(_0x3027bb,_0x3f81d8){var _0x152816={'raw':![],'where':{'id':_0x3027bb['params']['id']},'include':[{'model':db[_0xbd64('0x3b')],'as':'mandatoryDispositionPause'}]},_0x5dd6b6={};_0x5dd6b6['model']=_['keys'](db['WhatsappAccount'][_0xbd64('0x3d')]);_0x5dd6b6[_0xbd64('0x44')]=_['keys'](_0x3027bb[_0xbd64('0x44')]);_0x5dd6b6[_0xbd64('0x4b')]=_[_0xbd64('0x43')](_0x5dd6b6['model'],_0x5dd6b6[_0xbd64('0x44')]);_0x152816[_0xbd64('0x45')]=_[_0xbd64('0x43')](_0x5dd6b6[_0xbd64('0x40')],qs[_0xbd64('0x46')](_0x3027bb[_0xbd64('0x44')]['fields']));_0x152816['attributes']=_0x152816['attributes'][_0xbd64('0x57')]?_0x152816[_0xbd64('0x45')]:_0x5dd6b6[_0xbd64('0x40')];if(_0x3027bb[_0xbd64('0x44')]['includeAll']){_0x152816[_0xbd64('0x53')]=[{'all':!![]}];}_0x152816=_[_0xbd64('0x4e')]({},_0x152816,_0x3027bb[_0xbd64('0x50')]);return db[_0xbd64('0x51')][_0xbd64('0x58')](_0x152816)[_0xbd64('0x32')](handleEntityNotFound(_0x3f81d8,null))['then'](respondWithResult(_0x3f81d8,null))[_0xbd64('0x29')](handleError(_0x3f81d8,null));};exports[_0xbd64('0x59')]=function(_0x15f1fc,_0x1fe3e5){return db[_0xbd64('0x51')][_0xbd64('0x59')](_0x15f1fc[_0xbd64('0x5a')],{})[_0xbd64('0x32')](function(_0x430566){var _0x1e8e1c=_0x15f1fc[_0xbd64('0x5b')][_0xbd64('0x34')]({'plain':!![]});if(!_0x1e8e1c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e8e1c['role']===_0xbd64('0x5b')){var _0x2bcf68=_0x430566['get']({'plain':!![]});var _0x550f5f=_0xbd64('0x5c');return db[_0xbd64('0x5d')]['find']({'where':{'name':_0x550f5f,'userProfileId':_0x1e8e1c[_0xbd64('0x5e')]},'raw':!![]})[_0xbd64('0x32')](function(_0x45573c){if(_0x45573c&&_0x45573c[_0xbd64('0x5f')]===0x0){return db[_0xbd64('0x60')][_0xbd64('0x59')]({'name':_0x2bcf68[_0xbd64('0x38')],'resourceId':_0x2bcf68['id'],'type':_0x45573c[_0xbd64('0x38')],'sectionId':_0x45573c['id']},{})[_0xbd64('0x32')](function(){return _0x430566;});}else{return _0x430566;}})['catch'](function(_0x358ba8){logger[_0xbd64('0x26')](_0xbd64('0x61'),_0x358ba8);throw _0x358ba8;});}return _0x430566;})['then'](respondWithResult(_0x1fe3e5,0xc9))[_0xbd64('0x29')](handleError(_0x1fe3e5,null));};exports[_0xbd64('0x31')]=function(_0x4aa83e,_0x4423d9){if(_0x4aa83e[_0xbd64('0x5a')]['id']){delete _0x4aa83e[_0xbd64('0x5a')]['id'];}return db[_0xbd64('0x51')][_0xbd64('0x58')]({'where':{'id':_0x4aa83e[_0xbd64('0x62')]['id']},'include':[{'model':db['Pause'],'as':_0xbd64('0x3c')}]})[_0xbd64('0x32')](handleEntityNotFound(_0x4423d9,null))[_0xbd64('0x32')](saveUpdates(_0x4aa83e[_0xbd64('0x5a')],null))['then'](respondWithResult(_0x4423d9,null))[_0xbd64('0x29')](handleError(_0x4423d9,null));};exports[_0xbd64('0x33')]=function(_0x502d84,_0x78d88){return db['WhatsappAccount'][_0xbd64('0x58')]({'where':{'id':_0x502d84[_0xbd64('0x62')]['id']}})[_0xbd64('0x32')](handleEntityNotFound(_0x78d88,null))[_0xbd64('0x32')](removeEntity(_0x78d88,null))['catch'](handleError(_0x78d88,null));};exports[_0xbd64('0x63')]=function(_0x54a3b1,_0x30bdef){return db[_0xbd64('0x51')][_0xbd64('0x63')]()[_0xbd64('0x32')](respondWithResult(_0x30bdef,null))['catch'](handleError(_0x30bdef,null));};exports['addDisposition']=function(_0x5616bc,_0x36f3a8,_0xd1b21f){if(_0x5616bc[_0xbd64('0x5a')]['id']){delete _0x5616bc[_0xbd64('0x5a')]['id'];}return db[_0xbd64('0x51')][_0xbd64('0x58')]({'where':{'id':_0x5616bc['params']['id']}})[_0xbd64('0x32')](handleEntityNotFound(_0x36f3a8,null))[_0xbd64('0x32')](function(_0x305ffc){if(_0x305ffc){_0x5616bc[_0xbd64('0x5a')][_0xbd64('0x64')]=_0x305ffc['id'];return db[_0xbd64('0x65')][_0xbd64('0x59')](_0x5616bc[_0xbd64('0x5a')]);}})[_0xbd64('0x32')](respondWithResult(_0x36f3a8,null))[_0xbd64('0x29')](handleError(_0x36f3a8,null));};exports[_0xbd64('0x66')]=function(_0x582c85,_0x48f1a5,_0x5f16fd){var _0x7e5c1c={'raw':![],'where':{}};var _0x363da8={};var _0x2ec631={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xbd64('0x67')]({'where':{'id':_0x582c85['params']['id']}})[_0xbd64('0x32')](handleEntityNotFound(_0x48f1a5,null))[_0xbd64('0x32')](function(_0x1c2930){if(_0x1c2930){_0x363da8[_0xbd64('0x40')]=_['keys'](db[_0xbd64('0x65')]['rawAttributes']);_0x363da8[_0xbd64('0x44')]=_[_0xbd64('0x42')](_0x582c85[_0xbd64('0x44')]);_0x363da8[_0xbd64('0x4b')]=_[_0xbd64('0x43')](_0x363da8['model'],_0x363da8[_0xbd64('0x44')]);_0x7e5c1c[_0xbd64('0x45')]=_['intersection'](_0x363da8[_0xbd64('0x40')],qs[_0xbd64('0x46')](_0x582c85[_0xbd64('0x44')][_0xbd64('0x46')]));_0x7e5c1c['attributes']=_0x7e5c1c[_0xbd64('0x45')]['length']?_0x7e5c1c[_0xbd64('0x45')]:_0x363da8[_0xbd64('0x40')];if(!_0x582c85[_0xbd64('0x44')]['hasOwnProperty']('nolimit')){_0x7e5c1c['limit']=qs['limit'](_0x582c85[_0xbd64('0x44')][_0xbd64('0x2e')]);_0x7e5c1c[_0xbd64('0x2d')]=qs[_0xbd64('0x2d')](_0x582c85[_0xbd64('0x44')]['offset']);}_0x7e5c1c[_0xbd64('0x49')]=qs[_0xbd64('0x4a')](_0x582c85[_0xbd64('0x44')][_0xbd64('0x4a')]);_0x7e5c1c[_0xbd64('0x4d')]=qs['filters'](_[_0xbd64('0x68')](_0x582c85[_0xbd64('0x44')],_0x363da8[_0xbd64('0x4b')]));_0x7e5c1c[_0xbd64('0x4d')]['WhatsappAccountId']=_0x1c2930['id'];if(_0x582c85['query'][_0xbd64('0x4c')]){_0x7e5c1c[_0xbd64('0x4d')]=_[_0xbd64('0x4e')](_0x7e5c1c[_0xbd64('0x4d')],{'$or':_[_0xbd64('0x41')](_0x7e5c1c[_0xbd64('0x45')],function(_0x86124){var _0x344285={};_0x344285[_0x86124]={'$like':'%'+_0x582c85['query'][_0xbd64('0x4c')]+'%'};return _0x344285;})});}_0x7e5c1c=_['merge']({},_0x7e5c1c,_0x582c85[_0xbd64('0x50')]);return db[_0xbd64('0x65')][_0xbd64('0x2c')]({'where':_0x7e5c1c['where']})[_0xbd64('0x32')](function(_0x5c30f9){_0x2ec631['count']=_0x5c30f9;if(_0x582c85[_0xbd64('0x44')][_0xbd64('0x52')]){_0x7e5c1c[_0xbd64('0x53')]=[{'all':!![]}];}return db['Disposition'][_0xbd64('0x54')](_0x7e5c1c);})[_0xbd64('0x32')](function(_0x8150bb){_0x2ec631[_0xbd64('0x55')]=_0x8150bb;return _0x2ec631;});}})['then'](respondWithFilteredResult(_0x48f1a5,_0x7e5c1c))[_0xbd64('0x29')](handleError(_0x48f1a5,null));};exports[_0xbd64('0x69')]=function(_0x355b87,_0x1964f9,_0x339e52){return db[_0xbd64('0x51')][_0xbd64('0x58')]({'where':{'id':_0x355b87[_0xbd64('0x62')]['id']}})[_0xbd64('0x32')](handleEntityNotFound(_0x1964f9,null))[_0xbd64('0x32')](function(_0x3f49f3){if(_0x3f49f3){return _0x3f49f3[_0xbd64('0x69')](_0x355b87[_0xbd64('0x44')][_0xbd64('0x6a')]);}})['then'](respondWithStatusCode(_0x1964f9,null))['catch'](handleError(_0x1964f9,null));};exports[_0xbd64('0x6b')]=function(_0x322093,_0x155b41,_0x586056){if(_0x322093[_0xbd64('0x5a')]['id']){delete _0x322093['body']['id'];}return db[_0xbd64('0x51')][_0xbd64('0x58')]({'where':{'id':_0x322093[_0xbd64('0x62')]['id']}})[_0xbd64('0x32')](handleEntityNotFound(_0x155b41,null))['then'](function(_0x44ecf9){if(_0x44ecf9){_0x322093[_0xbd64('0x5a')]['WhatsappAccountId']=_0x44ecf9['id'];return db[_0xbd64('0x6c')]['create'](_0x322093[_0xbd64('0x5a')]);}})[_0xbd64('0x32')](respondWithResult(_0x155b41,null))[_0xbd64('0x29')](handleError(_0x155b41,null));};exports[_0xbd64('0x6d')]=function(_0x30b3a1,_0x38b974,_0x53717e){var _0x4190a3={'raw':![],'where':{}};var _0x588452={};var _0x366672={'count':0x0,'rows':[]};return db[_0xbd64('0x51')]['findOne']({'where':{'id':_0x30b3a1[_0xbd64('0x62')]['id']}})['then'](handleEntityNotFound(_0x38b974,null))[_0xbd64('0x32')](function(_0x2ac722){if(_0x2ac722){_0x588452[_0xbd64('0x40')]=_['keys'](db[_0xbd64('0x6c')][_0xbd64('0x3d')]);_0x588452[_0xbd64('0x44')]=_[_0xbd64('0x42')](_0x30b3a1[_0xbd64('0x44')]);_0x588452['filters']=_['intersection'](_0x588452[_0xbd64('0x40')],_0x588452[_0xbd64('0x44')]);_0x4190a3[_0xbd64('0x45')]=_[_0xbd64('0x43')](_0x588452[_0xbd64('0x40')],qs[_0xbd64('0x46')](_0x30b3a1[_0xbd64('0x44')][_0xbd64('0x46')]));_0x4190a3[_0xbd64('0x45')]=_0x4190a3[_0xbd64('0x45')][_0xbd64('0x57')]?_0x4190a3[_0xbd64('0x45')]:_0x588452[_0xbd64('0x40')];if(!_0x30b3a1['query'][_0xbd64('0x47')](_0xbd64('0x48'))){_0x4190a3['limit']=qs[_0xbd64('0x2e')](_0x30b3a1[_0xbd64('0x44')][_0xbd64('0x2e')]);_0x4190a3[_0xbd64('0x2d')]=qs['offset'](_0x30b3a1['query'][_0xbd64('0x2d')]);}_0x4190a3[_0xbd64('0x49')]=qs[_0xbd64('0x4a')](_0x30b3a1[_0xbd64('0x44')][_0xbd64('0x4a')]);_0x4190a3[_0xbd64('0x4d')]=qs[_0xbd64('0x4b')](_[_0xbd64('0x68')](_0x30b3a1[_0xbd64('0x44')],_0x588452[_0xbd64('0x4b')]));_0x4190a3[_0xbd64('0x4d')][_0xbd64('0x64')]=_0x2ac722['id'];if(_0x30b3a1['query'][_0xbd64('0x4c')]){_0x4190a3[_0xbd64('0x4d')]=_[_0xbd64('0x4e')](_0x4190a3['where'],{'$or':_['map'](_0x4190a3[_0xbd64('0x45')],function(_0x2dbbd4){var _0x5d9b13={};_0x5d9b13[_0x2dbbd4]={'$like':'%'+_0x30b3a1[_0xbd64('0x44')][_0xbd64('0x4c')]+'%'};return _0x5d9b13;})});}_0x4190a3=_[_0xbd64('0x4e')]({},_0x4190a3,_0x30b3a1[_0xbd64('0x50')]);return db[_0xbd64('0x6c')][_0xbd64('0x2c')]({'where':_0x4190a3[_0xbd64('0x4d')]})[_0xbd64('0x32')](function(_0x2686fe){_0x366672[_0xbd64('0x2c')]=_0x2686fe;if(_0x30b3a1[_0xbd64('0x44')][_0xbd64('0x52')]){_0x4190a3['include']=[{'all':!![]}];}return db[_0xbd64('0x6c')]['findAll'](_0x4190a3);})[_0xbd64('0x32')](function(_0x25d8d8){_0x366672[_0xbd64('0x55')]=_0x25d8d8;return _0x366672;});}})[_0xbd64('0x32')](respondWithFilteredResult(_0x38b974,_0x4190a3))[_0xbd64('0x29')](handleError(_0x38b974,null));};exports['removeAnswers']=function(_0x219149,_0x357ac2,_0x72185e){return db[_0xbd64('0x51')]['find']({'where':{'id':_0x219149[_0xbd64('0x62')]['id']}})['then'](handleEntityNotFound(_0x357ac2,null))[_0xbd64('0x32')](function(_0x993847){if(_0x993847){return _0x993847[_0xbd64('0x6e')](_0x219149[_0xbd64('0x44')][_0xbd64('0x6a')]);}})[_0xbd64('0x32')](respondWithStatusCode(_0x357ac2,null))[_0xbd64('0x29')](handleError(_0x357ac2,null));};exports['addAgents']=function(_0x2824dc,_0x2c640e,_0x33cfc8){return db[_0xbd64('0x51')]['find']({'where':{'id':_0x2824dc[_0xbd64('0x62')]['id']}})[_0xbd64('0x32')](handleEntityNotFound(_0x2c640e,null))[_0xbd64('0x32')](function(_0x19a780){if(_0x19a780){return _0x19a780[_0xbd64('0x6f')](_0x2824dc[_0xbd64('0x5a')][_0xbd64('0x6a')],_['omit'](_0x2824dc[_0xbd64('0x5a')],['ids','id'])||{})[_0xbd64('0x70')](function(_0x59cc30){for(var _0x4a7220=0x0;_0x4a7220<_0x2824dc[_0xbd64('0x5a')][_0xbd64('0x6a')][_0xbd64('0x57')];_0x4a7220+=0x1){socket['emit'](_0xbd64('0x71'),{'UserId':_0x2824dc['body'][_0xbd64('0x6a')][_0x4a7220],'WhatsappAccountId':_0x2824dc['params']['id']});}return _0x59cc30;});}})['then'](respondWithResult(_0x2c640e,null))[_0xbd64('0x29')](handleError(_0x2c640e,null));};exports[_0xbd64('0x72')]=function(_0x30a8b4,_0x310ee4,_0x34c941){return db[_0xbd64('0x51')][_0xbd64('0x58')]({'where':{'id':_0x30a8b4[_0xbd64('0x62')]['id']}})['then'](handleEntityNotFound(_0x310ee4,null))['then'](function(_0xd7e9dd){if(_0xd7e9dd){return _0xd7e9dd['removeAgents'](_0x30a8b4[_0xbd64('0x44')][_0xbd64('0x6a')])[_0xbd64('0x32')](function(){if(_['isArray'](_0x30a8b4[_0xbd64('0x44')][_0xbd64('0x6a')])){for(var _0x5f4e47=0x0;_0x5f4e47<_0x30a8b4[_0xbd64('0x44')][_0xbd64('0x6a')]['length'];_0x5f4e47+=0x1){socket['emit'](_0xbd64('0x73'),{'UserId':Number(_0x30a8b4[_0xbd64('0x44')][_0xbd64('0x6a')][_0x5f4e47]),'WhatsappAccountId':Number(_0x30a8b4[_0xbd64('0x62')]['id'])});}}else{socket[_0xbd64('0x74')](_0xbd64('0x73'),{'UserId':Number(_0x30a8b4[_0xbd64('0x44')][_0xbd64('0x6a')]),'WhatsappAccountId':Number(_0x30a8b4[_0xbd64('0x62')]['id'])});}});}})[_0xbd64('0x32')](respondWithStatusCode(_0x310ee4,null))[_0xbd64('0x29')](handleError(_0x310ee4,null));};exports[_0xbd64('0x75')]=function(_0x1f630b,_0x2d1f0c,_0x2419b7){var _0x5568cd={};var _0x2a6b2f={};var _0x4dda62;var _0x2a59da;return db[_0xbd64('0x51')]['findOne']({'where':{'id':_0x1f630b[_0xbd64('0x62')]['id']}})['then'](handleEntityNotFound(_0x2d1f0c,null))[_0xbd64('0x32')](function(_0x1fb323){if(_0x1fb323){_0x4dda62=_0x1fb323;_0x2a6b2f[_0xbd64('0x40')]=_[_0xbd64('0x42')](db['User'][_0xbd64('0x3d')]);_0x2a6b2f[_0xbd64('0x44')]=_[_0xbd64('0x42')](_0x1f630b[_0xbd64('0x44')]);_0x2a6b2f['filters']=_['intersection'](_0x2a6b2f[_0xbd64('0x40')],_0x2a6b2f[_0xbd64('0x44')]);_0x5568cd[_0xbd64('0x45')]=_['intersection'](_0x2a6b2f[_0xbd64('0x40')],qs['fields'](_0x1f630b[_0xbd64('0x44')][_0xbd64('0x46')]));_0x5568cd[_0xbd64('0x45')]=_0x5568cd[_0xbd64('0x45')][_0xbd64('0x57')]?_0x5568cd['attributes']:_0x2a6b2f['model'];_0x5568cd[_0xbd64('0x49')]=qs[_0xbd64('0x4a')](_0x1f630b[_0xbd64('0x44')]['sort']);_0x5568cd[_0xbd64('0x4d')]=qs['filters'](_[_0xbd64('0x68')](_0x1f630b[_0xbd64('0x44')],_0x2a6b2f[_0xbd64('0x4b')]));if(_0x1f630b['query'][_0xbd64('0x4c')]){_0x5568cd[_0xbd64('0x4d')]=_['merge'](_0x5568cd['where'],{'$or':_[_0xbd64('0x41')](_0x5568cd['attributes'],function(_0x4d1a95){var _0x1442ee={};_0x1442ee[_0x4d1a95]={'$like':'%'+_0x1f630b[_0xbd64('0x44')]['filter']+'%'};return _0x1442ee;})});}_0x5568cd=_[_0xbd64('0x4e')]({},_0x5568cd,_0x1f630b['options']);return _0x4dda62[_0xbd64('0x75')](_0x5568cd);}})[_0xbd64('0x32')](function(_0x38795c){if(_0x38795c){_0x2a59da=_0x38795c['length'];if(!_0x1f630b[_0xbd64('0x44')]['hasOwnProperty']('nolimit')){_0x5568cd['limit']=qs[_0xbd64('0x2e')](_0x1f630b[_0xbd64('0x44')][_0xbd64('0x2e')]);_0x5568cd['offset']=qs[_0xbd64('0x2d')](_0x1f630b['query'][_0xbd64('0x2d')]);}return _0x4dda62['getAgents'](_0x5568cd);}})['then'](function(_0x5415ed){if(_0x5415ed){return _0x5415ed?{'count':_0x2a59da,'rows':_0x5415ed}:null;}})[_0xbd64('0x32')](respondWithResult(_0x2d1f0c,null))[_0xbd64('0x29')](handleError(_0x2d1f0c,null));};exports[_0xbd64('0x76')]=function(_0x2ccf8d,_0x4d6781,_0x4094b8){return db[_0xbd64('0x51')][_0xbd64('0x67')]({'where':{'id':_0x2ccf8d['params']['id']}})[_0xbd64('0x32')](handleEntityNotFound(_0x4d6781,null))['then'](function(_0x142436){if(_0x142436){return db[_0xbd64('0x77')][_0xbd64('0x78')](function(_0x27ae4b){return db[_0xbd64('0x79')][_0xbd64('0x33')]({'where':{'WhatsappAccountId':_0x2ccf8d[_0xbd64('0x62')]['id']},'transaction':_0x27ae4b})[_0xbd64('0x32')](function(_0x3bc73d){var _0x871906=_[_0xbd64('0x41')](_0x2ccf8d[_0xbd64('0x5a')],function(_0x103561){_0x103561['WhatsappAccountId']=_0x2ccf8d['params']['id'];return _0x103561;});return db[_0xbd64('0x79')][_0xbd64('0x7a')](_0x871906,{'transaction':_0x27ae4b});});})[_0xbd64('0x32')](function(){return db[_0xbd64('0x79')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x2ccf8d[_0xbd64('0x62')]['id']},'order':'priority'});});}})[_0xbd64('0x32')](respondWithResult(_0x4d6781,null))['catch'](handleError(_0x4d6781,null));};exports['getApplications']=function(_0x421cd3,_0x762409,_0x58c849){var _0x2058c5={};var _0x494908={};var _0x40ff49;var _0x592e2c;return db[_0xbd64('0x51')][_0xbd64('0x67')]({'where':{'id':_0x421cd3[_0xbd64('0x62')]['id']}})['then'](handleEntityNotFound(_0x762409,null))[_0xbd64('0x32')](function(_0x287a9a){if(_0x287a9a){_0x40ff49=_0x287a9a;_0x494908[_0xbd64('0x40')]=_[_0xbd64('0x42')](db[_0xbd64('0x79')][_0xbd64('0x3d')]);_0x494908[_0xbd64('0x44')]=_['keys'](_0x421cd3[_0xbd64('0x44')]);_0x494908[_0xbd64('0x4b')]=_['intersection'](_0x494908['model'],_0x494908['query']);_0x2058c5[_0xbd64('0x45')]=_[_0xbd64('0x43')](_0x494908[_0xbd64('0x40')],qs['fields'](_0x421cd3[_0xbd64('0x44')]['fields']));_0x2058c5[_0xbd64('0x45')]=_0x2058c5['attributes'][_0xbd64('0x57')]?_0x2058c5[_0xbd64('0x45')]:_0x494908[_0xbd64('0x40')];_0x2058c5[_0xbd64('0x49')]=qs[_0xbd64('0x4a')](_0x421cd3[_0xbd64('0x44')][_0xbd64('0x4a')]);_0x2058c5[_0xbd64('0x4d')]=qs[_0xbd64('0x4b')](_[_0xbd64('0x68')](_0x421cd3[_0xbd64('0x44')],_0x494908['filters']));if(_0x421cd3[_0xbd64('0x44')][_0xbd64('0x4c')]){_0x2058c5[_0xbd64('0x4d')]=_[_0xbd64('0x4e')](_0x2058c5[_0xbd64('0x4d')],{'$or':_[_0xbd64('0x41')](_0x2058c5[_0xbd64('0x45')],function(_0x27eb30){var _0x2f97b5={};_0x2f97b5[_0x27eb30]={'$like':'%'+_0x421cd3['query']['filter']+'%'};return _0x2f97b5;})});}_0x2058c5=_[_0xbd64('0x4e')]({},_0x2058c5,_0x421cd3[_0xbd64('0x50')]);return _0x40ff49['getApplications'](_0x2058c5);}})[_0xbd64('0x32')](function(_0x2b78b4){if(_0x2b78b4){_0x592e2c=_0x2b78b4['length'];if(!_0x421cd3[_0xbd64('0x44')]['hasOwnProperty'](_0xbd64('0x48'))){_0x2058c5[_0xbd64('0x2e')]=qs[_0xbd64('0x2e')](_0x421cd3[_0xbd64('0x44')][_0xbd64('0x2e')]);_0x2058c5['offset']=qs['offset'](_0x421cd3['query']['offset']);}return _0x40ff49[_0xbd64('0x7b')](_0x2058c5);}})['then'](function(_0x3cf54a){if(_0x3cf54a){return _0x3cf54a?{'count':_0x592e2c,'rows':_0x3cf54a}:null;}})['then'](respondWithResult(_0x762409,null))['catch'](handleError(_0x762409,null));};exports[_0xbd64('0x7c')]=function(_0x1bcc1c,_0x45cbb6,_0x302596){var _0x24f5c0={'channel':_0xbd64('0x7d')};var _0x13fae5=[];var _0xf95ff=[];var _0x14bb25={};return db[_0xbd64('0x51')][_0xbd64('0x58')]({'where':{'id':_0x1bcc1c[_0xbd64('0x62')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0xbd64('0x7e')}]})[_0xbd64('0x32')](handleEntityNotFound(_0x45cbb6,null))[_0xbd64('0x32')](function(_0x3d2e6a){_0x24f5c0[_0xbd64('0x7f')]=_0x3d2e6a;_0x24f5c0[_0xbd64('0x80')]=_['orderBy'](_0x3d2e6a[_0xbd64('0x7e')],[_0xbd64('0x81')],[_0xbd64('0x82')]);if(_0x24f5c0[_0xbd64('0x7f')]['Applications']){delete _0x24f5c0[_0xbd64('0x7f')][_0xbd64('0x7e')];}return db[_0xbd64('0x83')][_0xbd64('0x63')]();})['then'](function(_0x3ac365){if(!_0x3ac365){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x13fae5=_[_0xbd64('0x84')](_[_0xbd64('0x42')](_0x3ac365),['createdAt','updatedAt']);_0xf95ff=_[_0xbd64('0x84')](_[_0xbd64('0x42')](_0x3ac365),[_0xbd64('0x85'),_0xbd64('0x86'),'CompanyId','ListId']);_0x24f5c0[_0xbd64('0x5a')]={'mapKey':'mobile'};if(_0x24f5c0[_0xbd64('0x7f')]['type']&&_0x24f5c0[_0xbd64('0x7f')][_0xbd64('0x3e')]===_0xbd64('0x87')){_0x24f5c0[_0xbd64('0x5a')]['from']=_0x1bcc1c[_0xbd64('0x5a')][_0xbd64('0x88')][_0xbd64('0x89')](_0xbd64('0x8a'),'');_0x24f5c0['body'][_0xbd64('0x5a')]=_0x1bcc1c[_0xbd64('0x5a')][_0xbd64('0x8b')];_0x24f5c0[_0xbd64('0x5a')][_0xbd64('0x8c')]=_0x1bcc1c[_0xbd64('0x5a')][_0xbd64('0x8d')];}if(_0x24f5c0[_0xbd64('0x5a')]['id']){delete _0x24f5c0[_0xbd64('0x5a')]['id'];}if(_['isNil'](_0x24f5c0['body'][_0xbd64('0x8e')])){throw new db['Sequelize'][(_0xbd64('0x1f'))](_0xbd64('0x8f'));}if(_[_0xbd64('0x90')](_0x24f5c0['body']['body'])||_0x24f5c0[_0xbd64('0x5a')][_0xbd64('0x5a')]===''){throw new db[(_0xbd64('0x91'))][(_0xbd64('0x1f'))](_0xbd64('0x92'));}if(_[_0xbd64('0x90')](_0x24f5c0[_0xbd64('0x5a')][_0xbd64('0x93')])){throw new db[(_0xbd64('0x91'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xf95ff);}if(!_[_0xbd64('0x94')](_0xf95ff,_0x24f5c0[_0xbd64('0x5a')][_0xbd64('0x93')])){throw new db[(_0xbd64('0x91'))]['ValidationError'](_0xbd64('0x95')+_0xf95ff);}_0x14bb25[_0x24f5c0['body'][_0xbd64('0x93')]]=_0x24f5c0['body'][_0xbd64('0x8e')];return db['CmList'][_0xbd64('0x58')]({'where':{'id':_0x24f5c0[_0xbd64('0x7f')][_0xbd64('0x96')]},'include':[{'model':db[_0xbd64('0x83')],'as':_0xbd64('0x97'),'where':_0x14bb25,'limit':0x1,'order':[[_0xbd64('0x86'),'DESC']]}]});})[_0xbd64('0x32')](handleEntityNotFound(_0x45cbb6,null))['then'](function(_0x2b3440){if(_0x2b3440){_0x24f5c0['list']=_['omit'](_0x2b3440,[_0xbd64('0x97')]);if(_0x2b3440[_0xbd64('0x97')][_0xbd64('0x57')]){return _0x2b3440['Contacts'][0x0];}var _0x4680fb=_[_0xbd64('0x16')](_0x24f5c0[_0xbd64('0x5a')],{'firstName':_0x24f5c0[_0xbd64('0x5a')][_0xbd64('0x8e')],'ListId':_0x2b3440['id']});_0x4680fb[_0x24f5c0['body'][_0xbd64('0x93')]]=_0x24f5c0['body']['from'];return db[_0xbd64('0x83')][_0xbd64('0x59')](_0x4680fb,{'fields':_0x13fae5,'raw':!![]});}})[_0xbd64('0x32')](handleEntityNotFound(_0x45cbb6,null))[_0xbd64('0x32')](function(_0x291a3e){if(_0x291a3e){_0x24f5c0[_0xbd64('0x98')]=_0x291a3e;var _0x18acee={'ContactId':_0x291a3e['id'],'phone':_0x24f5c0[_0xbd64('0x5a')][_0xbd64('0x8e')],'WhatsappAccountId':_0x1bcc1c[_0xbd64('0x62')]['id']};var _0x46e995={'ContactId':_0x291a3e['id'],'WhatsappAccountId':_0x1bcc1c['params']['id'],'closed':![]};return db[_0xbd64('0x99')][_0xbd64('0x58')]({'where':_0x46e995})[_0xbd64('0x32')](function(_0xeca842){if(_0xeca842){return[_0xeca842,![]];}return db['WhatsappInteraction'][_0xbd64('0x59')](_0x18acee)[_0xbd64('0x32')](function(_0x4a6ea9){return[_0x4a6ea9,!![]];});});}})['spread'](function(_0x34e543,_0x19ccdb){_0x24f5c0[_0xbd64('0x9a')]=_0x34e543[_0xbd64('0x34')]({'plain':!![]});_0x24f5c0[_0xbd64('0x9a')][_0xbd64('0x9b')]=![];if(_0x19ccdb){if(_0x24f5c0['account'][_0xbd64('0x9c')]){_0x24f5c0[_0xbd64('0x80')][_0xbd64('0x9d')]({'id':0x0,'priority':_0x24f5c0[_0xbd64('0x80')]['length']+0x1,'app':_0xbd64('0x9e'),'appdata':'unmanaged','interval':_0xbd64('0x9f')});}_0x24f5c0[_0xbd64('0x9a')][_0xbd64('0x9b')]=!![];}return db[_0xbd64('0xa0')]['create']({'phone':_0x24f5c0[_0xbd64('0x5a')]['from'],'messageId':_0x24f5c0[_0xbd64('0x5a')]['messageId'],'body':_0x24f5c0[_0xbd64('0x5a')]['body'],'WhatsappAccountId':_0x1bcc1c[_0xbd64('0x62')]['id'],'WhatsappInteractionId':_0x34e543['id'],'direction':'in','ContactId':_0x34e543[_0xbd64('0xa1')],'AttachmentId':_0x24f5c0['body'][_0xbd64('0xa2')]});})[_0xbd64('0x32')](function(_0x530305){_0x24f5c0[_0xbd64('0x28')]=_0x530305;if(_0x24f5c0[_0xbd64('0x9a')][_0xbd64('0xa3')]){return db['User'][_0xbd64('0x58')]({'attributes':['id',_0xbd64('0x38')],'where':{'id':_0x24f5c0[_0xbd64('0x9a')]['UserId']}})[_0xbd64('0x32')](function(_0x46f980){if(_0x46f980){_0x24f5c0['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xbd64('0xa4'),'appdata':_0x46f980['name']+','+(_0x24f5c0['account'][_0xbd64('0xa5')]||0xa),'interval':_0xbd64('0x9f')});}return respondWithRpcPromise(_0xbd64('0xa6'),'startRouting',_0x24f5c0);});}return respondWithRpcPromise(_0xbd64('0xa6'),'startRouting',_0x24f5c0);})[_0xbd64('0x32')](function(_0x4f6ace){if(_0x4f6ace){var _0x45f692=0xc8;var _0x1a899a='receiveMessage';logger[_0xbd64('0x21')](_0xbd64('0x23'),_0x1a899a,_0x45f692,_0xbd64('0xa7'));logger[_0xbd64('0x22')](_0xbd64('0xa8'),_0x1a899a,_0x45f692,_0xbd64('0xa7'),JSON['stringify'](_0x4f6ace));if(_0x24f5c0[_0xbd64('0x7f')][_0xbd64('0x3e')]===_0xbd64('0x87')){return _0x45cbb6[_0xbd64('0x2a')](_0x45f692)[_0xbd64('0xa9')](_0xbd64('0xaa'),'text/xml')['send'](_0xbd64('0xab'));}else{return _0x45cbb6[_0xbd64('0x2a')](_0x45f692)[_0xbd64('0x2b')](_0x4f6ace);}}})['catch'](handleError(_0x45cbb6,null));};exports[_0xbd64('0x39')]=function(_0x2ab4d7,_0x3067fa,_0x3a35ad){var _0xa573d0,_0x46c4a4,_0x5a0256;if(_['isNil'](_0x2ab4d7[_0xbd64('0x5a')][_0xbd64('0x5a')])||_0x2ab4d7[_0xbd64('0x5a')][_0xbd64('0x5a')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xbd64('0x90')](_0x2ab4d7['body']['to'])){throw new db[(_0xbd64('0x91'))][(_0xbd64('0x1f'))](_0xbd64('0xac'));}_0xa573d0=_0x2ab4d7['body']['to'];return db[_0xbd64('0x51')][_0xbd64('0x58')]({'where':{'id':_0x2ab4d7[_0xbd64('0x62')]['id']},'include':[{'model':db[_0xbd64('0xad')],'as':_0xbd64('0xae'),'include':[{'model':db[_0xbd64('0x83')],'as':_0xbd64('0x97'),'where':{'mobile':_0xa573d0},'limit':0x1,'order':[[_0xbd64('0x86'),_0xbd64('0xaf')]]}]}]})[_0xbd64('0x32')](handleEntityNotFound(_0x3067fa,null))[_0xbd64('0x32')](function(_0x3dc17f){if(_0x3dc17f&&_0x3dc17f[_0xbd64('0xae')]){_0x46c4a4=_0x3dc17f['get']({'plain':!![]});if(_0x46c4a4[_0xbd64('0xae')]&&_0x46c4a4['List'][_0xbd64('0x97')][_0xbd64('0x57')]){return _0x46c4a4[_0xbd64('0xae')][_0xbd64('0x97')][0x0];}return db[_0xbd64('0x83')][_0xbd64('0x59')](_['defaults'](_0x2ab4d7['body'],{'firstName':_0xa573d0,'mobile':_0xa573d0,'phone':_0xa573d0,'ListId':_0x46c4a4['ListId']}));}})['then'](handleEntityNotFound(_0x3067fa,null))[_0xbd64('0x32')](function(_0x82132a){if(_0x82132a){_0x5a0256=_0x82132a;return db[_0xbd64('0x99')][_0xbd64('0x58')]({'where':{'ContactId':_0x5a0256['id'],'closed':![],'WhatsappAccountId':_0x46c4a4['id']}})[_0xbd64('0x32')](function(_0x35d11f){if(_0x35d11f){return[_0x35d11f,![]];}return db[_0xbd64('0x99')][_0xbd64('0x59')]({'UserId':_0x2ab4d7['user']['id'],'ContactId':_0x5a0256['id'],'WhatsappAccountId':_0x46c4a4['id'],'phone':_0xa573d0,'firstMsgDirection':_0xbd64('0xb0'),'Messages':[_[_0xbd64('0x4e')](_0x2ab4d7['body'],{'read':![],'body':_0x2ab4d7[_0xbd64('0x5a')][_0xbd64('0x5a')],'phone':_0xa573d0,'WhatsappAccountId':_0x46c4a4['id'],'UserId':_0x2ab4d7[_0xbd64('0x5b')]['id'],'ContactId':_0x5a0256['id']})]},{'include':[{'model':db[_0xbd64('0xa0')],'as':_0xbd64('0xb1')}]})[_0xbd64('0x32')](function(_0x1981f6){return[_0x1981f6,!![]];});});}})[_0xbd64('0x70')](function(_0x2635a9,_0x42ef5f){if(_0x42ef5f){return _0x2635a9;}return db[_0xbd64('0xa0')]['create'](_[_0xbd64('0x4e')](_0x2ab4d7[_0xbd64('0x5a')],{'read':![],'body':_0x2ab4d7[_0xbd64('0x5a')]['body'],'phone':_0xa573d0,'WhatsappAccountId':_0x46c4a4['id'],'WhatsappInteractionId':_0x2635a9['id'],'UserId':_0x2ab4d7[_0xbd64('0x5b')]['id'],'ContactId':_0x5a0256['id']}))['then'](function(_0x35505f){_0x2635a9[_0xbd64('0xb2')][_0xbd64('0xb1')]=[];_0x2635a9['dataValues']['Messages'][_0xbd64('0x9d')](_0x35505f[_0xbd64('0xb2')]);return _0x2635a9;});})['then'](respondWithResult(_0x3067fa,null))[_0xbd64('0x29')](handleError(_0x3067fa,null));}; \ No newline at end of file +var _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 diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 8c3da52..059311c 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 _0xc6ac=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappAccount'];(function(_0x4f681f,_0x13a92a){var _0x1a42e7=function(_0x27bfda){while(--_0x27bfda){_0x4f681f['push'](_0x4f681f['shift']());}};_0x1a42e7(++_0x13a92a);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x6e5900,_0x4cce4d){_0x6e5900=_0x6e5900-0x0;var _0x1ac12c=_0xc6ac[_0x6e5900];return _0x1ac12c;};'use strict';var EventEmitter=require(_0xcc6a('0x0'));var WhatsappAccount=require(_0xcc6a('0x1'))['db'][_0xcc6a('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xcc6a('0x3')](0x0);var events={'afterCreate':_0xcc6a('0x4'),'afterUpdate':_0xcc6a('0x5'),'afterDestroy':_0xcc6a('0x6')};function emitEvent(_0x31bbcd){return function(_0x297643,_0x22ee99,_0x2f26ab){WhatsappAccountEvents[_0xcc6a('0x7')](_0x31bbcd+':'+_0x297643['id'],_0x297643);WhatsappAccountEvents[_0xcc6a('0x7')](_0x31bbcd,_0x297643);_0x2f26ab(null);};}for(var e in events){if(events[_0xcc6a('0x8')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xcc6a('0x9')]=WhatsappAccountEvents; \ No newline at end of file +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 diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 864a2b2..d417b46 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 _0xf83e=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts'];(function(_0x2df5b9,_0x1fbf0c){var _0x3f2154=function(_0x10d5d0){while(--_0x10d5d0){_0x2df5b9['push'](_0x2df5b9['shift']());}};_0x3f2154(++_0x1fbf0c);}(_0xf83e,0x1bc));var _0xef83=function(_0x24853d,_0x16931f){_0x24853d=_0x24853d-0x0;var _0x4c5cff=_0xf83e[_0x24853d];return _0x4c5cff;};'use strict';var _=require(_0xef83('0x0'));var util=require(_0xef83('0x1'));var logger=require(_0xef83('0x2'))(_0xef83('0x3'));var moment=require('moment');var BPromise=require(_0xef83('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xef83('0x5'));var rimraf=require(_0xef83('0x6'));var config=require(_0xef83('0x7'));var attributes=require(_0xef83('0x8'));module['exports']=function(_0x2a3f99,_0x5d5733){return _0x2a3f99[_0xef83('0x9')](_0xef83('0xa'),attributes,{'tableName':_0xef83('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index ed782a0..ee47914 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 _0x8623=['map','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','request','then','info','request\x20sent','debug','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','result','catch','ShowWhatsappAccount','options','raw','attributes','include'];(function(_0x4215a8,_0x1418d6){var _0x5ceeed=function(_0x4b69ba){while(--_0x4b69ba){_0x4215a8['push'](_0x4215a8['shift']());}};_0x5ceeed(++_0x1418d6);}(_0x8623,0x194));var _0x3862=function(_0x375bec,_0xae25e0){_0x375bec=_0x375bec-0x0;var _0x46d3ec=_0x8623[_0x375bec];return _0x46d3ec;};'use strict';var _=require(_0x3862('0x0'));var util=require('util');var moment=require(_0x3862('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3862('0x2'));var db=require(_0x3862('0x3'))['db'];var utils=require(_0x3862('0x4'));var logger=require(_0x3862('0x5'))(_0x3862('0x6'));var config=require(_0x3862('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3862('0x8')]({'port':0x232a});config[_0x3862('0x9')]=_[_0x3862('0xa')](config[_0x3862('0x9')],{'host':_0x3862('0xb'),'port':0x18eb});var socket=require(_0x3862('0xc'))(new Redis(config[_0x3862('0x9')]));require(_0x3862('0xd'))['register'](socket);function respondWithRpcPromise(_0x340f29,_0x1abb9e,_0x1a8828){return new BPromise(function(_0x8f500a,_0x334abf){return client[_0x3862('0xe')](_0x340f29,_0x1a8828)[_0x3862('0xf')](function(_0x3e9770){logger[_0x3862('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x1abb9e,_0x3862('0x11'));logger[_0x3862('0x12')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1abb9e,'request\x20sent',JSON[_0x3862('0x13')](_0x3e9770));if(_0x3e9770[_0x3862('0x14')]){if(_0x3e9770[_0x3862('0x14')]['code']===0x1f4){logger[_0x3862('0x14')](_0x3862('0x15'),_0x1abb9e,_0x3e9770[_0x3862('0x14')][_0x3862('0x16')]);return _0x334abf(_0x3e9770[_0x3862('0x14')]['message']);}logger[_0x3862('0x14')](_0x3862('0x15'),_0x1abb9e,_0x3e9770[_0x3862('0x14')]['message']);return _0x8f500a(_0x3e9770[_0x3862('0x14')][_0x3862('0x16')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x1abb9e,'request\x20sent');_0x8f500a(_0x3e9770[_0x3862('0x17')]['message']);}})[_0x3862('0x18')](function(_0x5a0e7e){logger['error'](_0x3862('0x15'),_0x1abb9e,_0x5a0e7e);_0x334abf(_0x5a0e7e);});});}exports[_0x3862('0x19')]=function(_0x53654b){var _0xfbb15f=this;return new Promise(function(_0x1b7872,_0x11feb){return db['WhatsappAccount']['find']({'raw':_0x53654b[_0x3862('0x1a')]?_0x53654b[_0x3862('0x1a')][_0x3862('0x1b')]===undefined?!![]:![]:!![],'where':_0x53654b[_0x3862('0x1a')]?_0x53654b[_0x3862('0x1a')]['where']||null:null,'attributes':_0x53654b[_0x3862('0x1a')]?_0x53654b[_0x3862('0x1a')][_0x3862('0x1c')]||null:null,'include':_0x53654b[_0x3862('0x1a')]?_0x53654b[_0x3862('0x1a')][_0x3862('0x1d')]?_[_0x3862('0x1e')](_0x53654b['options'][_0x3862('0x1d')],function(_0x459946){return{'model':db[_0x459946['model']],'as':_0x459946['as'],'attributes':_0x459946['attributes'],'include':_0x459946[_0x3862('0x1d')]?_['map'](_0x459946[_0x3862('0x1d')],function(_0x289787){return{'model':db[_0x289787['model']],'as':_0x289787['as'],'attributes':_0x289787[_0x3862('0x1c')],'include':_0x289787['include']?_[_0x3862('0x1e')](_0x289787[_0x3862('0x1d')],function(_0x45183b){return{'model':db[_0x45183b['model']],'as':_0x45183b['as'],'attributes':_0x45183b['attributes']};}):[]};}):[]};}):[]:[]})[_0x3862('0xf')](function(_0x45870e){logger['info'](_0x3862('0x19'),_0x53654b);logger[_0x3862('0x12')]('ShowWhatsappAccount',_0x53654b,JSON[_0x3862('0x13')](_0x45870e));_0x1b7872(_0x45870e);})[_0x3862('0x18')](function(_0x3ecdf6){logger[_0x3862('0x14')]('ShowWhatsappAccount',_0x3ecdf6[_0x3862('0x16')],_0x53654b);_0x11feb(_0xfbb15f['error'](0x1f4,_0x3ecdf6[_0x3862('0x16')]));});});}; \ No newline at end of file +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 diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 6aa32e1..16bc97f 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 _0x6222=['removeListener','register','whatsappAccount:','./whatsappAccount.events','save','remove','update','emit'];(function(_0xe23b5d,_0x350c43){var _0x3c31f1=function(_0x2b77e8){while(--_0x2b77e8){_0xe23b5d['push'](_0xe23b5d['shift']());}};_0x3c31f1(++_0x350c43);}(_0x6222,0x1cb));var _0x2622=function(_0x1fe7db,_0x1c11cd){_0x1fe7db=_0x1fe7db-0x0;var _0x4e60c9=_0x6222[_0x1fe7db];return _0x4e60c9;};'use strict';var WhatsappAccountEvents=require(_0x2622('0x0'));var events=[_0x2622('0x1'),_0x2622('0x2'),_0x2622('0x3')];function createListener(_0xde4093,_0x3bc0cf){return function(_0x27b218){_0x3bc0cf[_0x2622('0x4')](_0xde4093,_0x27b218);};}function removeListener(_0x392669,_0x391192){return function(){WhatsappAccountEvents[_0x2622('0x5')](_0x392669,_0x391192);};}exports[_0x2622('0x6')]=function(_0x328613){for(var _0x11201a=0x0,_0x28810a=events['length'];_0x11201a<_0x28810a;_0x11201a++){var _0x52a056=events[_0x11201a];var _0x2b3914=createListener(_0x2622('0x7')+_0x52a056,_0x328613);WhatsappAccountEvents['on'](_0x52a056,_0x2b3914);}}; \ No newline at end of file +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 diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 74d8be4..acc99e3 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 _0x783d=['/:id','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x222722,_0x5efed3){var _0x596a67=function(_0x3eae02){while(--_0x3eae02){_0x222722['push'](_0x222722['shift']());}};_0x596a67(++_0x5efed3);}(_0x783d,0xe5));var _0xd783=function(_0x5a9ffa,_0x2dbdcb){_0x5a9ffa=_0x5a9ffa-0x0;var _0x25dc67=_0x783d[_0x5a9ffa];return _0x25dc67;};'use strict';var multer=require(_0xd783('0x0'));var util=require('util');var path=require(_0xd783('0x1'));var timeout=require(_0xd783('0x2'));var express=require(_0xd783('0x3'));var router=express['Router']();var auth=require(_0xd783('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd783('0x5'));var controller=require('./whatsappApplication.controller');router[_0xd783('0x6')]('/',auth[_0xd783('0x7')](),controller[_0xd783('0x8')]);router[_0xd783('0x6')](_0xd783('0x9'),auth[_0xd783('0x7')](),controller['show']);router[_0xd783('0xa')]('/',auth[_0xd783('0x7')](),controller[_0xd783('0xb')]);router[_0xd783('0xc')](_0xd783('0x9'),auth[_0xd783('0x7')](),controller[_0xd783('0xd')]);router[_0xd783('0xe')](_0xd783('0x9'),auth['isAuthenticated'](),controller[_0xd783('0xf')]);module[_0xd783('0x10')]=router; \ No newline at end of file +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 diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index f03e6cf..5ee0e04 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 _0xc497=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x4aa838,_0x4aa14f){var _0x3abff0=function(_0x402d55){while(--_0x402d55){_0x4aa838['push'](_0x4aa838['shift']());}};_0x3abff0(++_0x4aa14f);}(_0xc497,0xfc));var _0x7c49=function(_0x43b12d,_0x4ddb3f){_0x43b12d=_0x43b12d-0x0;var _0x3dfbd3=_0xc497[_0x43b12d];return _0x3dfbd3;};'use strict';var Sequelize=require(_0x7c49('0x0'));module[_0x7c49('0x1')]={'priority':{'type':Sequelize[_0x7c49('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7c49('0x3')],'allowNull':![],'defaultValue':_0x7c49('0x4')},'appdata':{'type':Sequelize[_0x7c49('0x5')]()},'description':{'type':Sequelize[_0x7c49('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x7c49('0x6')}}; \ No newline at end of file +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 diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 60fb097..a5d0d4e 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 _0x1622=['findAll','catch','show','params','keys','includeAll','options','find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','count','include'];(function(_0x3c381e,_0x6bc059){var _0x508779=function(_0x482772){while(--_0x482772){_0x3c381e['push'](_0x3c381e['shift']());}};_0x508779(++_0x6bc059);}(_0x1622,0xeb));var _0x2162=function(_0x1ebc02,_0x295964){_0x1ebc02=_0x1ebc02-0x0;var _0x5d6785=_0x1622[_0x1ebc02];return _0x5d6785;};'use strict';var pdf=require(_0x2162('0x0'));var emlformat=require(_0x2162('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2162('0x2'));var jsonpatch=require(_0x2162('0x3'));var rp=require(_0x2162('0x4'));var moment=require(_0x2162('0x5'));var BPromise=require(_0x2162('0x6'));var Mustache=require(_0x2162('0x7'));var util=require('util');var path=require('path');var sox=require(_0x2162('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x2162('0x9'));var squel=require(_0x2162('0xa'));var crypto=require(_0x2162('0xb'));var jsforce=require(_0x2162('0xc'));var deskjs=require(_0x2162('0xd'));var toCsv=require(_0x2162('0xe'));var querystring=require(_0x2162('0xf'));var Papa=require(_0x2162('0x10'));var Redis=require(_0x2162('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2162('0x12'));var as=require(_0x2162('0x13'));var hardwareService=require(_0x2162('0x14'));var logger=require(_0x2162('0x15'))(_0x2162('0x16'));var utils=require(_0x2162('0x17'));var config=require('../../config/environment');var db=require(_0x2162('0x18'))['db'];function respondWithStatusCode(_0x3f73c4,_0x41e7cf){_0x41e7cf=_0x41e7cf||0xcc;return function(_0x4b1885){if(_0x4b1885){return _0x3f73c4[_0x2162('0x19')](_0x41e7cf);}return _0x3f73c4[_0x2162('0x1a')](_0x41e7cf)[_0x2162('0x1b')]();};}function respondWithResult(_0x2ffd18,_0x1970d7){_0x1970d7=_0x1970d7||0xc8;return function(_0x2965f){if(_0x2965f){return _0x2ffd18[_0x2162('0x1a')](_0x1970d7)[_0x2162('0x1c')](_0x2965f);}};}function respondWithFilteredResult(_0x4e0795,_0x9f6422){return function(_0xfb33e7){if(_0xfb33e7){var _0x194975=_0xfb33e7['count'],_0x11f1ac=_0x9f6422['offset'],_0x730791=_0x9f6422[_0x2162('0x1d')]+_0x9f6422['limit'],_0x1703d3;if(_0x730791>=_0x194975){_0x730791=_0x194975;_0x1703d3=0xc8;}else{_0x1703d3=0xce;}_0x4e0795[_0x2162('0x1a')](_0x1703d3);return _0x4e0795[_0x2162('0x1e')](_0x2162('0x1f'),_0x11f1ac+'-'+_0x730791+'/'+_0x194975)['json'](_0xfb33e7);}return null;};}function patchUpdates(_0x3e630f){return function(_0x514c61){try{jsonpatch['apply'](_0x514c61,_0x3e630f,!![]);}catch(_0x594ee6){return BPromise[_0x2162('0x20')](_0x594ee6);}return _0x514c61[_0x2162('0x21')]();};}function saveUpdates(_0x2edcb9,_0x1c9764){return function(_0x3ed8fd){if(_0x3ed8fd){return _0x3ed8fd[_0x2162('0x22')](_0x2edcb9)['then'](function(_0x5afd1b){return _0x5afd1b;});}return null;};}function removeEntity(_0xf9215f,_0x5acde1){return function(_0x435fb3){if(_0x435fb3){return _0x435fb3[_0x2162('0x23')]()[_0x2162('0x24')](function(){_0xf9215f[_0x2162('0x1a')](0xcc)[_0x2162('0x1b')]();});}};}function handleEntityNotFound(_0x14cd69,_0x49c5a3){return function(_0x2f80e5){if(!_0x2f80e5){_0x14cd69['sendStatus'](0x194);}return _0x2f80e5;};}function handleError(_0xf8ce83,_0x2aa4a2){_0x2aa4a2=_0x2aa4a2||0x1f4;return function(_0x3860e1){logger[_0x2162('0x25')](_0x3860e1[_0x2162('0x26')]);if(_0x3860e1[_0x2162('0x27')]){delete _0x3860e1[_0x2162('0x27')];}_0xf8ce83[_0x2162('0x1a')](_0x2aa4a2)[_0x2162('0x28')](_0x3860e1);};}exports[_0x2162('0x29')]=function(_0x5d8d15,_0x261c67){var _0xbf28d6={},_0x16330e={},_0x529ce7={'count':0x0,'rows':[]};var _0x1f5501=_[_0x2162('0x2a')](db[_0x2162('0x2b')][_0x2162('0x2c')],function(_0x34dd81){return{'name':_0x34dd81[_0x2162('0x2d')],'type':_0x34dd81[_0x2162('0x2e')][_0x2162('0x2f')]};});_0x16330e[_0x2162('0x30')]=_[_0x2162('0x2a')](_0x1f5501,_0x2162('0x27'));_0x16330e['query']=_['keys'](_0x5d8d15[_0x2162('0x31')]);_0x16330e[_0x2162('0x32')]=_[_0x2162('0x33')](_0x16330e[_0x2162('0x30')],_0x16330e['query']);_0xbf28d6[_0x2162('0x34')]=_[_0x2162('0x33')](_0x16330e['model'],qs[_0x2162('0x35')](_0x5d8d15[_0x2162('0x31')][_0x2162('0x35')]));_0xbf28d6[_0x2162('0x34')]=_0xbf28d6[_0x2162('0x34')][_0x2162('0x36')]?_0xbf28d6['attributes']:_0x16330e[_0x2162('0x30')];if(!_0x5d8d15[_0x2162('0x31')]['hasOwnProperty'](_0x2162('0x37'))){_0xbf28d6[_0x2162('0x38')]=qs[_0x2162('0x38')](_0x5d8d15[_0x2162('0x31')][_0x2162('0x38')]);_0xbf28d6[_0x2162('0x1d')]=qs[_0x2162('0x1d')](_0x5d8d15[_0x2162('0x31')]['offset']);}_0xbf28d6[_0x2162('0x39')]=qs['sort'](_0x5d8d15[_0x2162('0x31')][_0x2162('0x3a')]);_0xbf28d6[_0x2162('0x3b')]=qs[_0x2162('0x32')](_[_0x2162('0x3c')](_0x5d8d15[_0x2162('0x31')],_0x16330e[_0x2162('0x32')]),_0x1f5501);if(_0x5d8d15[_0x2162('0x31')]['filter']){_0xbf28d6[_0x2162('0x3b')]=_['merge'](_0xbf28d6['where'],{'$or':_[_0x2162('0x2a')](_0x1f5501,function(_0x16bce6){if(_0x16bce6['type']!=='VIRTUAL'){var _0x3be330={};_0x3be330[_0x16bce6[_0x2162('0x27')]]={'$like':'%'+_0x5d8d15[_0x2162('0x31')][_0x2162('0x3d')]+'%'};return _0x3be330;}})});}_0xbf28d6=_[_0x2162('0x3e')]({},_0xbf28d6,_0x5d8d15['options']);var _0x42d438={'where':_0xbf28d6[_0x2162('0x3b')]};return db[_0x2162('0x2b')][_0x2162('0x3f')](_0x42d438)['then'](function(_0x438fb1){_0x529ce7['count']=_0x438fb1;if(_0x5d8d15['query']['includeAll']){_0xbf28d6[_0x2162('0x40')]=[{'all':!![]}];}return db['WhatsappApplication'][_0x2162('0x41')](_0xbf28d6);})[_0x2162('0x24')](function(_0x48065f){_0x529ce7['rows']=_0x48065f;return _0x529ce7;})[_0x2162('0x24')](respondWithFilteredResult(_0x261c67,_0xbf28d6))[_0x2162('0x42')](handleError(_0x261c67,null));};exports[_0x2162('0x43')]=function(_0x275b27,_0x55cbd2){var _0x26da13={'raw':!![],'where':{'id':_0x275b27[_0x2162('0x44')]['id']}},_0x4f6487={};_0x4f6487[_0x2162('0x30')]=_['keys'](db[_0x2162('0x2b')][_0x2162('0x2c')]);_0x4f6487[_0x2162('0x31')]=_[_0x2162('0x45')](_0x275b27['query']);_0x4f6487[_0x2162('0x32')]=_[_0x2162('0x33')](_0x4f6487[_0x2162('0x30')],_0x4f6487['query']);_0x26da13[_0x2162('0x34')]=_[_0x2162('0x33')](_0x4f6487[_0x2162('0x30')],qs['fields'](_0x275b27[_0x2162('0x31')][_0x2162('0x35')]));_0x26da13[_0x2162('0x34')]=_0x26da13[_0x2162('0x34')][_0x2162('0x36')]?_0x26da13[_0x2162('0x34')]:_0x4f6487[_0x2162('0x30')];if(_0x275b27[_0x2162('0x31')][_0x2162('0x46')]){_0x26da13[_0x2162('0x40')]=[{'all':!![]}];}_0x26da13=_[_0x2162('0x3e')]({},_0x26da13,_0x275b27[_0x2162('0x47')]);return db[_0x2162('0x2b')][_0x2162('0x48')](_0x26da13)['then'](handleEntityNotFound(_0x55cbd2,null))['then'](respondWithResult(_0x55cbd2,null))[_0x2162('0x42')](handleError(_0x55cbd2,null));};exports[_0x2162('0x49')]=function(_0x38fe1f,_0x71bdcf){return db['WhatsappApplication'][_0x2162('0x49')](_0x38fe1f[_0x2162('0x4a')],{})[_0x2162('0x24')](respondWithResult(_0x71bdcf,0xc9))[_0x2162('0x42')](handleError(_0x71bdcf,null));};exports[_0x2162('0x22')]=function(_0x5a9ede,_0x95ac15){if(_0x5a9ede[_0x2162('0x4a')]['id']){delete _0x5a9ede[_0x2162('0x4a')]['id'];}return db['WhatsappApplication'][_0x2162('0x48')]({'where':{'id':_0x5a9ede[_0x2162('0x44')]['id']}})['then'](handleEntityNotFound(_0x95ac15,null))[_0x2162('0x24')](saveUpdates(_0x5a9ede[_0x2162('0x4a')],null))[_0x2162('0x24')](respondWithResult(_0x95ac15,null))[_0x2162('0x42')](handleError(_0x95ac15,null));};exports[_0x2162('0x23')]=function(_0x5d611f,_0x4ef91b){return db[_0x2162('0x2b')][_0x2162('0x48')]({'where':{'id':_0x5d611f[_0x2162('0x44')]['id']}})[_0x2162('0x24')](handleEntityNotFound(_0x4ef91b,null))[_0x2162('0x24')](removeEntity(_0x4ef91b,null))[_0x2162('0x42')](handleError(_0x4ef91b,null));}; \ No newline at end of file +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 diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index c45e986..5f09d0e 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 _0xee6b=['whatsapp_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','./whatsappApplication.attributes','define','WhatsappApplication'];(function(_0x19d422,_0xcb97a4){var _0x27576b=function(_0x44948f){while(--_0x44948f){_0x19d422['push'](_0x19d422['shift']());}};_0x27576b(++_0xcb97a4);}(_0xee6b,0x141));var _0xbee6=function(_0x110479,_0x492d7b){_0x110479=_0x110479-0x0;var _0x55335=_0xee6b[_0x110479];return _0x55335;};'use strict';var _=require(_0xbee6('0x0'));var util=require(_0xbee6('0x1'));var logger=require(_0xbee6('0x2'))(_0xbee6('0x3'));var moment=require('moment');var BPromise=require(_0xbee6('0x4'));var rp=require(_0xbee6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbee6('0x6'));module['exports']=function(_0x2827a0,_0x453e39){return _0x2827a0[_0xbee6('0x7')](_0xbee6('0x8'),attributes,{'tableName':_0xbee6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xbee6('0xa')});}; \ No newline at end of file +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 diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 8193891..ff588eb 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 _0x0734=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x3d7ac7,_0x21e5d0){var _0x2cf3b9=function(_0x6724ae){while(--_0x6724ae){_0x3d7ac7['push'](_0x3d7ac7['shift']());}};_0x2cf3b9(++_0x21e5d0);}(_0x0734,0xba));var _0x4073=function(_0x517a22,_0x2d142c){_0x517a22=_0x517a22-0x0;var _0x4f5d9e=_0x0734[_0x517a22];return _0x4f5d9e;};'use strict';var _=require(_0x4073('0x0'));var util=require(_0x4073('0x1'));var moment=require(_0x4073('0x2'));var BPromise=require(_0x4073('0x3'));var rs=require(_0x4073('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4073('0x5'))['db'];var utils=require(_0x4073('0x6'));var logger=require(_0x4073('0x7'))(_0x4073('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4073('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c3c14,_0x2195e0,_0x1251bd){return new BPromise(function(_0x22a33d,_0x51515d){return client[_0x4073('0xa')](_0x2c3c14,_0x1251bd)['then'](function(_0x5432c4){logger[_0x4073('0xb')](_0x4073('0xc'),_0x2195e0,_0x4073('0xd'));logger['debug']('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x2195e0,_0x4073('0xd'),JSON[_0x4073('0xe')](_0x5432c4));if(_0x5432c4['error']){if(_0x5432c4[_0x4073('0xf')]['code']===0x1f4){logger[_0x4073('0xf')](_0x4073('0xc'),_0x2195e0,_0x5432c4[_0x4073('0xf')][_0x4073('0x10')]);return _0x51515d(_0x5432c4['error'][_0x4073('0x10')]);}logger[_0x4073('0xf')]('WhatsappApplication,\x20%s,\x20%s',_0x2195e0,_0x5432c4[_0x4073('0xf')][_0x4073('0x10')]);return _0x22a33d(_0x5432c4[_0x4073('0xf')][_0x4073('0x10')]);}else{logger[_0x4073('0xb')](_0x4073('0xc'),_0x2195e0,'request\x20sent');_0x22a33d(_0x5432c4[_0x4073('0x11')]['message']);}})[_0x4073('0x12')](function(_0x38ea09){logger['error'](_0x4073('0xc'),_0x2195e0,_0x38ea09);_0x51515d(_0x38ea09);});});} \ No newline at end of file +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 diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index cb75a05..02e876d 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 _0x37fb=['index','/describe','isAuthenticated','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','/:id/tags','removeTags','exports','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get'];(function(_0x291af5,_0x1e6f2f){var _0x4c6572=function(_0x455d1b){while(--_0x455d1b){_0x291af5['push'](_0x291af5['shift']());}};_0x4c6572(++_0x1e6f2f);}(_0x37fb,0xf9));var _0xb37f=function(_0x2d6b54,_0x398feb){_0x2d6b54=_0x2d6b54-0x0;var _0x3adcbf=_0x37fb[_0x2d6b54];return _0x3adcbf;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb37f('0x0'));var timeout=require('connect-timeout');var express=require(_0xb37f('0x1'));var router=express['Router']();var auth=require(_0xb37f('0x2'));var interaction=require(_0xb37f('0x3'));var config=require(_0xb37f('0x4'));var controller=require(_0xb37f('0x5'));router[_0xb37f('0x6')]('/',auth['isAuthenticated'](),controller[_0xb37f('0x7')]);router[_0xb37f('0x6')](_0xb37f('0x8'),auth[_0xb37f('0x9')](),controller['describe']);router[_0xb37f('0x6')](_0xb37f('0xa'),auth[_0xb37f('0x9')](),controller[_0xb37f('0xb')]);router[_0xb37f('0x6')](_0xb37f('0xc'),auth[_0xb37f('0x9')](),controller[_0xb37f('0xd')]);router[_0xb37f('0x6')](_0xb37f('0xe'),auth[_0xb37f('0x9')](),controller[_0xb37f('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb37f('0x10')]);router[_0xb37f('0x11')](_0xb37f('0xc'),auth[_0xb37f('0x9')](),controller[_0xb37f('0x12')]);router['post']('/:id/tags',auth[_0xb37f('0x9')](),interaction[_0xb37f('0x13')](_0xb37f('0x14'),_0xb37f('0x15')),controller[_0xb37f('0x16')]);router[_0xb37f('0x17')](_0xb37f('0xa'),auth[_0xb37f('0x9')](),interaction[_0xb37f('0x13')](_0xb37f('0x14'),_0xb37f('0x18')),controller[_0xb37f('0x19')]);router[_0xb37f('0x1a')]('/:id',auth['isAuthenticated'](),interaction[_0xb37f('0x13')](_0xb37f('0x14'),_0xb37f('0x1b')),controller[_0xb37f('0x1c')]);router[_0xb37f('0x1a')](_0xb37f('0x1d'),auth['isAuthenticated'](),controller[_0xb37f('0x1e')]);module[_0xb37f('0x1f')]=router; \ No newline at end of file +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 diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 07b6f36..93b5b2b 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 _0xb87b=['exports','DATE','STRING','ENUM','out','moment'];(function(_0xffec5f,_0x1b4a3c){var _0x559276=function(_0x5558aa){while(--_0x5558aa){_0xffec5f['push'](_0xffec5f['shift']());}};_0x559276(++_0x1b4a3c);}(_0xb87b,0x10d));var _0xbb87=function(_0x5c2a0d,_0x43d12a){_0x5c2a0d=_0x5c2a0d-0x0;var _0x2d29c7=_0xb87b[_0x5c2a0d];return _0x2d29c7;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xbb87('0x0'));module[_0xbb87('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbb87('0x2')]},'disposition':{'type':Sequelize[_0xbb87('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xbb87('0x3')]},'read1stAt':{'type':Sequelize[_0xbb87('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xbb87('0x4')]('in',_0xbb87('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xbb87('0x4')]('in',_0xbb87('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +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 diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 0667a70..9163238 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 _0x814b=['index','rawAttributes','type','key','model','query','intersection','attributes','length','nolimit','limit','order','sort','filters','select','field','color','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_accounts','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','body','keys','some','compact','WhatsappAccountId','where','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$lte','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','isEmpty','t.id\x20IN\x20?','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','getWhatsappAccounts','toString','count','sequelize','fields','a.key','Account.key','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','Contact.phone','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','all','rows','show','params','WhatsappInteraction','includeAll','merge','options','create','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','hasOwnProperty','WhatsappInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','User','fullname','Contact','firstName','lastName','Attachment','Messages','direction','secret','read','WhatsappAccount','Account','Owner','get','mkdirSync','10px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Whatsapp','YYYY-MM-DD','closedAt','disposition','existsSync','basename','out','System','renderFile','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','map','TagIds','split','forEach','push','catch'];(function(_0x792dd7,_0x327da8){var _0x365276=function(_0x227c97){while(--_0x227c97){_0x792dd7['push'](_0x792dd7['shift']());}};_0x365276(++_0x327da8);}(_0x814b,0x1a2));var _0xb814=function(_0xdb357c,_0x3786b6){_0xdb357c=_0xdb357c-0x0;var _0x5c8735=_0x814b[_0xdb357c];return _0x5c8735;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var db=require(_0xb814('0x19'))['db'];config[_0xb814('0x1a')]=_[_0xb814('0x1b')](config[_0xb814('0x1a')],{'host':_0xb814('0x1c'),'port':0x18eb});var socket=require(_0xb814('0x1d'))(new Redis(config[_0xb814('0x1a')]));require(_0xb814('0x1e'))[_0xb814('0x1f')](socket);function respondWithStatusCode(_0x2ab627,_0x3f4881){_0x3f4881=_0x3f4881||0xcc;return function(_0x44fb96){if(_0x44fb96){return _0x2ab627[_0xb814('0x20')](_0x3f4881);}return _0x2ab627[_0xb814('0x21')](_0x3f4881)[_0xb814('0x22')]();};}function respondWithResult(_0x3a71d6,_0x45e0d0){_0x45e0d0=_0x45e0d0||0xc8;return function(_0x265a83){if(_0x265a83){return _0x3a71d6[_0xb814('0x21')](_0x45e0d0)[_0xb814('0x23')](_0x265a83);}};}function respondWithFilteredResult(_0x7a21ef,_0x48c9df){return function(_0x168a48){if(_0x168a48){var _0x55ba16=_0x168a48['count'],_0x270598=_0x48c9df['offset'],_0xfac75b=_0x48c9df[_0xb814('0x24')]+_0x48c9df['limit'],_0x4c3007;if(_0xfac75b>=_0x55ba16){_0xfac75b=_0x55ba16;_0x4c3007=0xc8;}else{_0x4c3007=0xce;}_0x7a21ef['status'](_0x4c3007);return _0x7a21ef[_0xb814('0x25')](_0xb814('0x26'),_0x270598+'-'+_0xfac75b+'/'+_0x55ba16)[_0xb814('0x23')](_0x168a48);}return null;};}function patchUpdates(_0x4e139e){return function(_0xf5b8aa){try{jsonpatch['apply'](_0xf5b8aa,_0x4e139e,!![]);}catch(_0x1e6393){return BPromise[_0xb814('0x27')](_0x1e6393);}return _0xf5b8aa[_0xb814('0x28')]();};}function saveUpdates(_0x470e81,_0x27352e){return function(_0x2bd039){if(_0x2bd039){return _0x2bd039[_0xb814('0x29')](_0x470e81)['then'](function(_0x2ead86){return _0x2ead86;});}return null;};}function removeEntity(_0x52b7a3,_0x3f81d0){return function(_0x457dac){if(_0x457dac){return _0x457dac[_0xb814('0x2a')]()[_0xb814('0x2b')](function(){_0x52b7a3[_0xb814('0x21')](0xcc)[_0xb814('0x22')]();});}};}function handleEntityNotFound(_0x3d836c,_0x5755ea){return function(_0x392222){if(!_0x392222){_0x3d836c[_0xb814('0x20')](0x194);}return _0x392222;};}function handleError(_0x1c2625,_0x349394){_0x349394=_0x349394||0x1f4;return function(_0x32ed56){logger[_0xb814('0x2c')](_0x32ed56[_0xb814('0x2d')]);if(_0x32ed56[_0xb814('0x2e')]){delete _0x32ed56['name'];}_0x1c2625[_0xb814('0x21')](_0x349394)[_0xb814('0x2f')](_0x32ed56);};}function getInteractionUsers(_0x52ed64,_0x9008b2){return new BPromise(function(_0x37d24d,_0x530744){try{if(_0x9008b2[_0x52ed64['id']]){_0x52ed64['Users']=_[_0xb814('0x30')](_0x9008b2[_0x52ed64['id']],function(_0x2051d0){return{'id':_0x2051d0['id'],'fullname':_0x2051d0['fullname']};});}}catch(_0x338a28){_0x530744(_0x338a28);}_0x37d24d(_0x52ed64);});}function getInteractionTags(_0x526610,_0x6efe9a){return new BPromise(function(_0x5f3e9b,_0x4cfc58){try{if(_0x526610[_0xb814('0x31')]){_0x526610['Tags']=[];_0x526610[_0xb814('0x31')][_0xb814('0x32')](',')[_0xb814('0x33')](function(_0x599f9f){_0x526610['Tags'][_0xb814('0x34')](_0x6efe9a[_0x599f9f]);});}delete _0x526610[_0xb814('0x31')];}catch(_0x523566){_0x4cfc58(_0x523566);}_0x5f3e9b(_0x526610);});}function updateWhatsappInteraction(_0x2c8943,_0xe558d5,_0x692c72){return new BPromise(function(_0x217b7e,_0x1b78de){return getInteractionUsers(_0x2c8943,_0x692c72)[_0xb814('0x2b')](function(_0x3672f3){return getInteractionTags(_0x3672f3,_0xe558d5);})['then'](function(_0x3207ec){_0x217b7e(_0x3207ec);})[_0xb814('0x35')](function(_0x30de5a){_0x1b78de(_0x30de5a);});});}exports[_0xb814('0x36')]=function(_0x14100d,_0x4ff31a){var _0x16ef82={},_0x57e6e6={},_0x43db67={'count':0x0,'rows':[]};var _0x16e21c=_[_0xb814('0x30')](db['WhatsappInteraction'][_0xb814('0x37')],function(_0xbdb3e9){return{'name':_0xbdb3e9['fieldName'],'type':_0xbdb3e9[_0xb814('0x38')][_0xb814('0x39')]};});_0x57e6e6[_0xb814('0x3a')]=_[_0xb814('0x30')](_0x16e21c,_0xb814('0x2e'));_0x57e6e6[_0xb814('0x3b')]=_['keys'](_0x14100d[_0xb814('0x3b')]);_0x57e6e6['filters']=_[_0xb814('0x3c')](_0x57e6e6['model'],_0x57e6e6[_0xb814('0x3b')]);_0x16ef82['attributes']=_[_0xb814('0x3c')](_0x57e6e6[_0xb814('0x3a')],qs['fields'](_0x14100d['query']['fields']));_0x16ef82['attributes']=_0x16ef82[_0xb814('0x3d')][_0xb814('0x3e')]?_0x16ef82[_0xb814('0x3d')]:_0x57e6e6[_0xb814('0x3a')];if(!_0x14100d['query']['hasOwnProperty'](_0xb814('0x3f'))){_0x16ef82['limit']=qs[_0xb814('0x40')](_0x14100d[_0xb814('0x3b')][_0xb814('0x40')]);_0x16ef82[_0xb814('0x24')]=qs[_0xb814('0x24')](_0x14100d[_0xb814('0x3b')][_0xb814('0x24')]);}_0x16ef82[_0xb814('0x41')]=qs[_0xb814('0x42')](_0x14100d['query']['sort']);_0x16ef82['where']=qs[_0xb814('0x43')](_['pick'](_0x14100d[_0xb814('0x3b')],_0x57e6e6['filters']),_0x16e21c);var _0x411723=[];var _0x44ff56=squel[_0xb814('0x44')]()[_0xb814('0x45')]('id')['field'](_0xb814('0x2e'))[_0xb814('0x45')](_0xb814('0x46'))[_0xb814('0x47')](_0xb814('0x48'));var _0x450a08=squel['select']()[_0xb814('0x45')](_0xb814('0x49'))[_0xb814('0x45')](_0xb814('0x4a'))[_0xb814('0x45')](_0xb814('0x4b'))[_0xb814('0x47')]('user_has_whatsapp_interactions','ui')['left_join'](_0xb814('0x4c'),'u',_0xb814('0x4d'));var _0x4c08d6=squel[_0xb814('0x44')]()[_0xb814('0x47')](_0xb814('0x4e'),'i')[_0xb814('0x4f')](_0xb814('0x50'),'c',_0xb814('0x51'))[_0xb814('0x4f')](_0xb814('0x4c'),'o','o.id\x20=\x20i.UserId')[_0xb814('0x4f')](_0xb814('0x52'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0xb814('0x4f')]('whatsapp_messages','me',_0xb814('0x53'))[_0xb814('0x4f')](_0xb814('0x54'),'it',_0xb814('0x55'))[_0xb814('0x4f')](_0xb814('0x48'),'t',_0xb814('0x56'));var _0x45480e=squel[_0xb814('0x57')]();var _0x2a422a=[];var _0x5e6df7=squel['expr']();var _0x32eca6;if(_0x14100d[_0xb814('0x3b')][_0xb814('0x58')]){_0x32eca6=as[_0xb814('0x59')](_0x14100d[_0xb814('0x3b')][_0xb814('0x58')]);var _0x135208=_0x32eca6['sqlOperator'];for(var _0x26fd0b=0x0;_0x26fd0b<_0x32eca6[_0xb814('0x5a')][_0xb814('0x3e')];_0x26fd0b++){var _0x5a916d=_0x32eca6[_0xb814('0x5a')][_0x26fd0b];var _0x4e6f3c='i';var _0x252293=_['find'](_0x16e21c,[_0xb814('0x2e'),_0x5a916d[_0xb814('0x45')]]);if(!_0x252293){switch(_0x5a916d['field']){case _0xb814('0x5b'):if(_0x5a916d[_0xb814('0x5c')]==0x1){_0x4c08d6[_0xb814('0x5d')]('`'+_0x5a916d['field']+_0xb814('0x5e'));}else{_0x4c08d6['having']('`'+_0x5a916d[_0xb814('0x45')]+_0xb814('0x5f'));}break;case'Contact':if(_0x5a916d[_0xb814('0x60')]==='$substring'){if(_0x5a916d['value'][_0xb814('0x32')]('\x20')[_0xb814('0x3e')]>0x1){_0x45480e[_0x135208](_0xb814('0x61'),qs['getFullTextValue'](_0x5a916d[_0xb814('0x5c')]),null);}else{var _0x538b0f='%'+_0x5a916d[_0xb814('0x5c')]+'%';_0x45480e[_0x135208](_0xb814('0x62'),_0x538b0f,_0x538b0f,_0x538b0f);}}else{_0x252293=_['find'](_0x16e21c,[_0xb814('0x2e'),'ContactId']);_0x5a916d[_0xb814('0x45')]=_0xb814('0x63');_0x135e13=as[_0xb814('0x64')](_0x4e6f3c,_0x252293[_0xb814('0x38')],_0x5a916d);_0x45480e[_0x135208](_0x135e13[_0xb814('0x65')],_0x135e13[_0xb814('0x5c')][_0xb814('0x66')],_0x135e13[_0xb814('0x5c')]['end']);}break;case _0xb814('0x67'):var _0x5441c5=_0x5a916d['value'][_0xb814('0x32')](',')[_0xb814('0x30')](function(_0x4d13db){return Number(_0x4d13db);});_0x5441c5[_0xb814('0x33')](function(_0x58b9a6){_0x5e6df7['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x58b9a6+',%');});_0x2a422a=_[_0xb814('0x68')](_0x2a422a,_0x5441c5);break;case'User':if(_0x5a916d[_0xb814('0x60')]===_0xb814('0x69')){_0x45480e[_0x135208](_0xb814('0x6a'),'%'+_0x5a916d['value']+'%',null);}else{_0x252293=_[_0xb814('0x6b')](_0x16e21c,['name',_0xb814('0x6c')]);_0x5a916d[_0xb814('0x45')]=_0xb814('0x6c');_0x135e13=as[_0xb814('0x64')](_0x4e6f3c,_0x252293[_0xb814('0x38')],_0x5a916d);_0x45480e[_0x135208](_0x135e13[_0xb814('0x65')],_0x135e13[_0xb814('0x5c')][_0xb814('0x66')],_0x135e13[_0xb814('0x5c')]['end']);}break;case _0xb814('0x6d'):_0x135e13=as[_0xb814('0x64')]('me',null,_0x5a916d);_0x45480e[_0x135208](_0x135e13[_0xb814('0x65')],_0x135e13[_0xb814('0x5c')][_0xb814('0x66')],_0x135e13[_0xb814('0x5c')]['end']);break;}}else{var _0x135e13=as['buildExpression'](_0x4e6f3c,_0x252293[_0xb814('0x38')],_0x5a916d);_0x45480e[_0x135208](_0x135e13[_0xb814('0x65')],_0x135e13[_0xb814('0x5c')]['start'],_0x135e13[_0xb814('0x5c')]['end']);}}}else{var _0x37e9c5=_(_0x14100d['query'])[_0xb814('0x6e')]()[_0xb814('0x30')](function(_0xa03cd2){return _[_0xb814('0x6f')](_0x16e21c,[_0xb814('0x2e'),_0xa03cd2])?_0xa03cd2:undefined;})[_0xb814('0x70')]()[_0xb814('0x5c')]();if(!_['isEmpty'](_0x37e9c5)){_0x37e9c5[_0xb814('0x33')](function(_0x51ca51){if(_0x51ca51===_0xb814('0x71')){_0x4c08d6[_0xb814('0x72')](_0xb814('0x73'),[][_0xb814('0x74')](_0x14100d[_0xb814('0x3b')][_0x51ca51]));}else if(_0x51ca51===_0xb814('0x75')){var _0x514dab=JSON[_0xb814('0x76')](_0x14100d[_0xb814('0x3b')][_0x51ca51])['$gte'];var _0x3bb2b4=JSON[_0xb814('0x76')](_0x14100d[_0xb814('0x3b')][_0x51ca51])[_0xb814('0x77')];_0x4c08d6[_0xb814('0x72')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x514dab,_0x3bb2b4);}else{if(_0x14100d[_0xb814('0x3b')][_0x51ca51]==='null'){_0x4c08d6[_0xb814('0x72')]('i.'+_0x51ca51+_0xb814('0x78'));}else{_0x4c08d6[_0xb814('0x72')]('i.'+_0x51ca51+_0xb814('0x79'),_0x14100d[_0xb814('0x3b')][_0x51ca51]);}}});}if(_0x14100d[_0xb814('0x3b')]['read']){if(_0x14100d['query']['read']==0x1){_0x4c08d6[_0xb814('0x5d')]('`unreadMessages`\x20=\x200');}else{_0x4c08d6[_0xb814('0x5d')](_0xb814('0x7a'));}}if(_0x14100d[_0xb814('0x3b')]['tag']){_0x2a422a=_[_0xb814('0x7b')](_0x14100d[_0xb814('0x3b')][_0xb814('0x7c')])?_0x14100d['query'][_0xb814('0x7c')]:new Array(_0x14100d[_0xb814('0x3b')][_0xb814('0x7c')]);_0x2a422a[_0xb814('0x33')](function(_0x555be0){_0x5e6df7['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x555be0+',%');});}if(_0x14100d[_0xb814('0x3b')][_0xb814('0x7d')]){var _0x39863d=_0x14100d[_0xb814('0x3b')][_0xb814('0x7d')][_0xb814('0x7e')]('\x5c','\x5c\x5c')[_0xb814('0x7e')]('\x27\x27',_0xb814('0x7f'));if(qs[_0xb814('0x80')](_0x39863d)){_0x45480e['or'](_0xb814('0x81'),_0x39863d+'%')['or'](_0xb814('0x82'),_0x39863d+'%');}else{_0x45480e['or'](_0xb814('0x83'),qs[_0xb814('0x84')](_0x39863d))['or'](_0xb814('0x85'),_0x39863d+'%');}}}_0x4c08d6[_0xb814('0x72')](_0x45480e);_0x4c08d6['group'](_0xb814('0x86'));var _0x33cfc4={'type':db[_0xb814('0x87')][_0xb814('0x88')][_0xb814('0x89')],'raw':!![]};var _0x283b0f=_0x4c08d6['clone']();_0x283b0f[_0xb814('0x45')]('i.id');_0x283b0f[_0xb814('0x45')](_0xb814('0x8a'),_0xb814('0x5b'));if(_0x16ef82[_0xb814('0x41')]){_0x16ef82[_0xb814('0x41')]['forEach'](function(_0x4c44ee){_0x4c08d6[_0xb814('0x41')]('i.'+_0x4c44ee[0x0],_0x4c44ee[0x1]===_0xb814('0x8b')?![]:!![]);});}if(!_[_0xb814('0x8c')](_0x2a422a)){_0x4c08d6[_0xb814('0x5d')](_0x5e6df7);_0x283b0f['where'](_0xb814('0x8d'),_0x2a422a);}BPromise['resolve']()[_0xb814('0x2b')](function(){if(!_0x32eca6){if(_0x14100d[_0xb814('0x3b')]['WhatsappAccountId']||_0x14100d['query'][_0xb814('0x8e')])return;_0x283b0f['where'](_0xb814('0x8f'));_0x4c08d6[_0xb814('0x72')](_0xb814('0x8f'));return;}return _0x14100d[_0xb814('0x90')][_0xb814('0x91')]({'attributes':['id'],'raw':!![]})[_0xb814('0x2b')](function(_0x40fe4a){if(_['isEmpty'](_0x40fe4a)){_0x283b0f[_0xb814('0x72')]('i.WhatsappAccountId\x20IS\x20NULL');_0x4c08d6[_0xb814('0x72')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x283b0f[_0xb814('0x72')](_0xb814('0x73'),_['map'](_0x40fe4a,'id'));_0x4c08d6[_0xb814('0x72')]('i.WhatsappAccountId\x20IN\x20?',_[_0xb814('0x30')](_0x40fe4a,'id'));}});})[_0xb814('0x2b')](function(){db['sequelize']['query'](_0x283b0f[_0xb814('0x92')](),_0x33cfc4)[_0xb814('0x2b')](function(_0x3309c5){_0x43db67[_0xb814('0x93')]=_0x3309c5[_0xb814('0x3e')];if(_0x43db67[_0xb814('0x93')]===0x0)return[];return db[_0xb814('0x94')][_0xb814('0x3b')](_0x44ff56[_0xb814('0x92')](),_0x33cfc4)[_0xb814('0x2b')](function(_0x53e705){_0x411723=_['keyBy'](_0x53e705,'id');_0x33cfc4=_['merge'](_0x33cfc4,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x14100d['query'][_0xb814('0x95')]){_0x16ef82[_0xb814('0x3d')][_0xb814('0x33')](function(_0x59f3ff){_0x4c08d6[_0xb814('0x45')]('i.'+_0x59f3ff);});}else{_0x4c08d6[_0xb814('0x45')](_0xb814('0x8a'),_0xb814('0x5b'));_0x4c08d6[_0xb814('0x45')](_0xb814('0x96'),_0xb814('0x97'));_0x4c08d6[_0xb814('0x45')]('a.mandatoryDisposition',_0xb814('0x98'));_0x4c08d6[_0xb814('0x45')](_0xb814('0x99'));_0x4c08d6[_0xb814('0x45')]('c.firstName',_0xb814('0x9a'));_0x4c08d6[_0xb814('0x45')](_0xb814('0x9b'),_0xb814('0x9c'));_0x4c08d6[_0xb814('0x45')]('c.email','Contact.email');_0x4c08d6[_0xb814('0x45')]('c.phone',_0xb814('0x9d'));_0x4c08d6[_0xb814('0x45')]('c.mobile',_0xb814('0x9e'));_0x4c08d6['field'](_0xb814('0x9f'),'Contact.fax');_0x4c08d6[_0xb814('0x45')](_0xb814('0xa0'),_0xb814('0xa1'));_0x4c08d6[_0xb814('0x45')](_0xb814('0xa2'),_0xb814('0xa3'));_0x4c08d6[_0xb814('0x45')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x16ef82[_0xb814('0x40')])_0x4c08d6['limit'](_0x16ef82['limit']);if(_0x16ef82[_0xb814('0x24')])_0x4c08d6[_0xb814('0x24')](_0x16ef82[_0xb814('0x24')]);return db['sequelize'][_0xb814('0x3b')](_0x4c08d6['toString'](),_0x33cfc4);})[_0xb814('0x2b')](function(_0x19d508){_0x450a08[_0xb814('0x72')](_0xb814('0xa4'),_['map'](_0x19d508,'id'));return db[_0xb814('0x94')][_0xb814('0x3b')](_0x450a08[_0xb814('0x92')](),_0x33cfc4)['then'](function(_0x1ebbf6){var _0x3fc77d=_[_0xb814('0xa5')](_0x1ebbf6,'WhatsappInteractionId');var _0x5d8626=[];_0x19d508[_0xb814('0x33')](function(_0x9dc06b){_0x5d8626[_0xb814('0x34')](updateWhatsappInteraction(_0x9dc06b,_0x411723,_0x3fc77d));});return BPromise[_0xb814('0xa6')](_0x5d8626);});});})[_0xb814('0x2b')](function(_0x37a7ab){_0x43db67[_0xb814('0xa7')]=_0x37a7ab;return _0x43db67;})[_0xb814('0x2b')](respondWithFilteredResult(_0x4ff31a,_0x16ef82));})[_0xb814('0x35')](handleError(_0x4ff31a,null));};exports[_0xb814('0xa8')]=function(_0x2569a5,_0x2a13fb){var _0x5b8d2e={'raw':![],'where':{'id':_0x2569a5[_0xb814('0xa9')]['id']}},_0x5416dc={};_0x5416dc['model']=_[_0xb814('0x6e')](db[_0xb814('0xaa')][_0xb814('0x37')]);_0x5416dc[_0xb814('0x3b')]=_[_0xb814('0x6e')](_0x2569a5[_0xb814('0x3b')]);_0x5416dc[_0xb814('0x43')]=_['intersection'](_0x5416dc['model'],_0x5416dc[_0xb814('0x3b')]);_0x5b8d2e['attributes']=_[_0xb814('0x3c')](_0x5416dc[_0xb814('0x3a')],qs[_0xb814('0x95')](_0x2569a5['query'][_0xb814('0x95')]));_0x5b8d2e[_0xb814('0x3d')]=_0x5b8d2e[_0xb814('0x3d')][_0xb814('0x3e')]?_0x5b8d2e[_0xb814('0x3d')]:_0x5416dc['model'];if(_0x2569a5[_0xb814('0x3b')][_0xb814('0xab')]){_0x5b8d2e['include']=[{'all':!![]}];}_0x5b8d2e=_[_0xb814('0xac')]({},_0x5b8d2e,_0x2569a5[_0xb814('0xad')]);return db[_0xb814('0xaa')]['find'](_0x5b8d2e)[_0xb814('0x2b')](handleEntityNotFound(_0x2a13fb,null))[_0xb814('0x2b')](respondWithResult(_0x2a13fb,null))['catch'](handleError(_0x2a13fb,null));};exports[_0xb814('0xae')]=function(_0x171f83,_0x5b5634){return db[_0xb814('0xaa')][_0xb814('0xae')](_0x171f83[_0xb814('0x6d')],{})[_0xb814('0x2b')](respondWithResult(_0x5b5634,0xc9))[_0xb814('0x35')](handleError(_0x5b5634,null));};exports[_0xb814('0x29')]=function(_0x40ae0b,_0x336a8f){if(_0x40ae0b[_0xb814('0x6d')]['id']){delete _0x40ae0b[_0xb814('0x6d')]['id'];}return db[_0xb814('0xaa')][_0xb814('0x6b')]({'where':{'id':_0x40ae0b['params']['id']}})['then'](handleEntityNotFound(_0x336a8f,null))[_0xb814('0x2b')](saveUpdates(_0x40ae0b['body'],null))['then'](respondWithResult(_0x336a8f,null))[_0xb814('0x35')](handleError(_0x336a8f,null));};exports['destroy']=function(_0x4f0427,_0x50cb34){return db[_0xb814('0xaa')][_0xb814('0x6b')]({'where':{'id':_0x4f0427[_0xb814('0xa9')]['id']}})['then'](handleEntityNotFound(_0x50cb34,null))[_0xb814('0x2b')](removeEntity(_0x50cb34,null))['catch'](handleError(_0x50cb34,null));};exports[_0xb814('0xaf')]=function(_0x2e6660,_0x49a8de){return db[_0xb814('0xaa')]['describe']()[_0xb814('0x2b')](respondWithResult(_0x49a8de,null))[_0xb814('0x35')](handleError(_0x49a8de,null));};exports[_0xb814('0xb0')]=function(_0x39ce17,_0x11efb8,_0xaf705d){return db[_0xb814('0xb1')][_0xb814('0x6b')]({'where':{'id':_0x39ce17[_0xb814('0xa9')]['id']}})[_0xb814('0x2b')](handleEntityNotFound(_0x11efb8,null))[_0xb814('0x2b')](function(_0x3e7a9a){if(_0x3e7a9a){return _0x3e7a9a[_0xb814('0xb0')](_0x39ce17[_0xb814('0x6d')][_0xb814('0xb2')],_['omit'](_0x39ce17[_0xb814('0x6d')],[_0xb814('0xb2'),'id'])||{});}})['then'](respondWithResult(_0x11efb8,null))[_0xb814('0x35')](handleError(_0x11efb8,null));};exports[_0xb814('0xb3')]=function(_0x1868d9,_0x570191,_0x56b2aa){var _0x473b30={'raw':![],'where':{}};var _0x4af71e={};var _0x2d40e6={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xb814('0xb4')]({'where':{'id':_0x1868d9['params']['id']}})['then'](handleEntityNotFound(_0x570191,null))[_0xb814('0x2b')](function(_0x32c956){if(_0x32c956){_0x4af71e[_0xb814('0x3a')]=_[_0xb814('0x6e')](db[_0xb814('0xb1')][_0xb814('0x37')]);_0x4af71e[_0xb814('0x3b')]=_[_0xb814('0x6e')](_0x1868d9[_0xb814('0x3b')]);_0x4af71e[_0xb814('0x43')]=_[_0xb814('0x3c')](_0x4af71e['model'],_0x4af71e[_0xb814('0x3b')]);_0x473b30['attributes']=_[_0xb814('0x3c')](_0x4af71e[_0xb814('0x3a')],qs[_0xb814('0x95')](_0x1868d9['query'][_0xb814('0x95')]));_0x473b30[_0xb814('0x3d')]=_0x473b30[_0xb814('0x3d')][_0xb814('0x3e')]?_0x473b30[_0xb814('0x3d')]:_0x4af71e[_0xb814('0x3a')];if(!_0x1868d9[_0xb814('0x3b')][_0xb814('0xb5')](_0xb814('0x3f'))){_0x473b30[_0xb814('0x40')]=qs[_0xb814('0x40')](_0x1868d9[_0xb814('0x3b')][_0xb814('0x40')]);_0x473b30[_0xb814('0x24')]=qs[_0xb814('0x24')](_0x1868d9['query'][_0xb814('0x24')]);}_0x473b30[_0xb814('0x41')]=qs[_0xb814('0x42')](_0x1868d9['query']['sort']);_0x473b30[_0xb814('0x72')]=qs['filters'](_['pick'](_0x1868d9['query'],_0x4af71e['filters']));_0x473b30[_0xb814('0x72')][_0xb814('0xb6')]=_0x32c956['id'];if(_0x1868d9['query'][_0xb814('0x7d')]){_0x473b30[_0xb814('0x72')]=_[_0xb814('0xac')](_0x473b30[_0xb814('0x72')],{'$or':_[_0xb814('0x30')](_0x473b30[_0xb814('0x3d')],function(_0x20e608){var _0x7b9948={};_0x7b9948[_0x20e608]={'$like':'%'+_0x1868d9[_0xb814('0x3b')][_0xb814('0x7d')]+'%'};return _0x7b9948;})});}if(_0x1868d9[_0xb814('0x3b')]['$gte']){var _0x2a5dff=_0x1868d9['query'][_0xb814('0xb7')][_0xb814('0x32')](',');var _0x35e8f7={};_0x35e8f7[_0x2a5dff[0x0]]={'$gte':moment(_0x2a5dff[0x1])[_0xb814('0xb8')](_0xb814('0xb9'))};_0x473b30[_0xb814('0x72')]=_[_0xb814('0xac')](_0x473b30[_0xb814('0x72')],_0x35e8f7);}_0x473b30=_['merge']({},_0x473b30,_0x1868d9['options']);return db['WhatsappMessage'][_0xb814('0x93')]({'where':_0x473b30[_0xb814('0x72')]})[_0xb814('0x2b')](function(_0x3b7bee){_0x2d40e6[_0xb814('0x93')]=_0x3b7bee;if(_0x1868d9[_0xb814('0x3b')][_0xb814('0xab')]){_0x473b30[_0xb814('0xba')]=[{'all':!![]}];}return db[_0xb814('0xb1')][_0xb814('0xbb')](_0x473b30);})['then'](function(_0x5c989a){_0x2d40e6[_0xb814('0xa7')]=_0x5c989a;return _0x2d40e6;});}})[_0xb814('0x2b')](respondWithFilteredResult(_0x570191,_0x473b30))[_0xb814('0x35')](handleError(_0x570191,null));};exports[_0xb814('0xbc')]=function(_0x3f0c9c,_0x2642ab,_0x48358c){return db[_0xb814('0xaa')]['find']({'where':{'id':_0x3f0c9c[_0xb814('0xa9')]['id']}})[_0xb814('0x2b')](handleEntityNotFound(_0x2642ab,null))[_0xb814('0x2b')](function(_0x94aa05){if(_0x94aa05){return _0x94aa05[_0xb814('0xbd')](_0x3f0c9c[_0xb814('0x6d')][_0xb814('0xb2')],_['omit'](_0x3f0c9c[_0xb814('0x6d')],[_0xb814('0xb2'),'id'])||{})[_0xb814('0xbe')](function(){return db[_0xb814('0x67')]['findAll']({'attributes':['id',_0xb814('0x2e'),_0xb814('0x46')],'where':{'id':_0x3f0c9c[_0xb814('0x6d')][_0xb814('0xb2')]}});})[_0xb814('0x2b')](function(_0x4a2aa5){socket[_0xb814('0xbf')](_0xb814('0xc0'),{'id':Number(_0x3f0c9c[_0xb814('0xa9')]['id']),'tags':_0x4a2aa5||[]});return{'id':Number(_0x3f0c9c['params']['id']),'tags':_0x4a2aa5||[]};});}})[_0xb814('0x2b')](respondWithResult(_0x2642ab,null))['catch'](handleError(_0x2642ab,null));};exports[_0xb814('0xc1')]=function(_0x5b4315,_0x22f6f1,_0x3467bd){return db[_0xb814('0xaa')][_0xb814('0x6b')]({'where':{'id':_0x5b4315['params']['id']}})[_0xb814('0x2b')](handleEntityNotFound(_0x22f6f1,null))[_0xb814('0x2b')](function(_0x3fda0d){if(_0x3fda0d){return _0x3fda0d[_0xb814('0xc1')](_0x5b4315[_0xb814('0x3b')][_0xb814('0xb2')]);}})[_0xb814('0x2b')](respondWithStatusCode(_0x22f6f1,null))[_0xb814('0x35')](handleError(_0x22f6f1,null));};exports[_0xb814('0xc2')]=function(_0x152260,_0x3bc03a){var _0x368696=moment()[_0xb814('0xc3')]()[_0xb814('0x92')]();var _0x8e882a=path['join'](config[_0xb814('0xc4')],_0xb814('0xc5'),_0xb814('0xc6'),_0xb814('0xc7'));var _0x4017b6=path[_0xb814('0xc8')](config['root'],_0xb814('0xc5'),_0xb814('0xc6'),_0xb814('0xc9'));var _0x31b4f5=path['join'](_0x8e882a,_0x368696);var _0x5b5a26=util[_0xb814('0xb8')](_0xb814('0xca'),_0x152260[_0xb814('0xa9')]['id'],_0x368696);var _0x667ca1=path[_0xb814('0xc8')](_0x8e882a,_0x5b5a26);var _0x2c510a=[];_0x2c510a['push']({'model':db[_0xb814('0xcb')],'as':_0xb814('0xcb'),'attributes':['id',_0xb814('0xcc')],'raw':!![]});_0x2c510a[_0xb814('0x34')]({'model':db['CmContact'],'as':_0xb814('0xcd'),'attributes':['id',_0xb814('0xce'),_0xb814('0xcf')],'raw':!![]});if(_0x152260[_0xb814('0x3b')][_0xb814('0xc9')]){_0x2c510a['push']({'model':db[_0xb814('0xd0')],'as':_0xb814('0xd0'),'raw':!![]});}var _0x371dd7=[{'model':db[_0xb814('0xb1')],'as':_0xb814('0xd1'),'attributes':['id',_0xb814('0x6d'),_0xb814('0x75'),_0xb814('0xd2'),_0xb814('0xd3'),_0xb814('0xd4')],'include':_0x2c510a}];_0x371dd7[_0xb814('0x34')]({'model':db[_0xb814('0xd5')],'as':_0xb814('0xd6'),'attributes':['id','name']});_0x371dd7['push']({'model':db[_0xb814('0xcb')],'as':_0xb814('0xd7'),'attributes':['id',_0xb814('0xcc')]});return db['WhatsappInteraction'][_0xb814('0x6b')]({'where':{'id':_0x152260[_0xb814('0xa9')]['id']},'include':_0x371dd7})[_0xb814('0x2b')](handleEntityNotFound(_0x3bc03a,null))['then'](function(_0x10537d){if(_0x10537d){var _0xa651a=_0x10537d[_0xb814('0xd8')]({'plain':!![]});fs[_0xb814('0xd9')](_0x31b4f5);var _0x6ec0f5={'format':'A4','border':_0xb814('0xda'),'header':{'height':'40px','contents':{'first':_0xb814('0xdb')}},'footer':{'height':'30px','contents':{'default':util[_0xb814('0xb8')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0xb814('0xb8')](_0xb814('0xdc'),_0xb814('0xdd'),_0xa651a['id']),moment()['format'](_0xb814('0xde'))[_0xb814('0x92')]())}}};var _0x164304={'channel':'Whatsapp','account':_0xa651a[_0xb814('0xd6')]['name'],'agent':_0xa651a[_0xb814('0xd7')]?_0xa651a[_0xb814('0xd7')][_0xb814('0xcc')]:'N.A.','createdAt':moment(_0xa651a[_0xb814('0x75')])[_0xb814('0xb8')](_0xb814('0xb9'))[_0xb814('0x92')](),'closedAt':_0xa651a['closed']?moment(_0xa651a[_0xb814('0xdf')])[_0xb814('0xb8')](_0xb814('0xb9'))[_0xb814('0x92')]():'','disposition':_0xa651a[_0xb814('0xe0')],'messages':_(_0xa651a[_0xb814('0xd1')])[_0xb814('0x7d')]({'secret':![]})[_0xb814('0x30')](function(_0x9a33d0){if(_0x9a33d0['Attachment']){var _0x2fe47b=path[_0xb814('0xc8')](_0x4017b6,_0x9a33d0[_0xb814('0xd0')]['basename']);if(fs[_0xb814('0xe1')](_0x2fe47b)){fs['createReadStream'](_0x2fe47b)['pipe'](fs['createWriteStream'](path[_0xb814('0xc8')](_0x31b4f5,_0x9a33d0['Attachment'][_0xb814('0xe2')])));}}return{'date':moment(_0x9a33d0[_0xb814('0x75')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xb814('0x92')](),'sender':_0x9a33d0['direction']===_0xb814('0xe3')?_0x9a33d0['User']?_0x9a33d0[_0xb814('0xcb')][_0xb814('0xcc')]:_0xb814('0xe4'):_0x9a33d0['Contact']['firstName']+(_0x9a33d0['Contact'][_0xb814('0xcf')]?'\x20'+_0x9a33d0['Contact']['lastName']:''),'body':_0x9a33d0[_0xb814('0xd0')]?_0x9a33d0['Attachment']['basename']:_0x9a33d0['body'],'direction':_0x9a33d0[_0xb814('0xd2')]===_0xb814('0xe3')?'A':'C','secret':_0x9a33d0[_0xb814('0xd3')],'read':_0x9a33d0['read'],'attachment':_0x9a33d0[_0xb814('0xd0')]};})[_0xb814('0x5c')]()};return ejs[_0xb814('0xe5')](path[_0xb814('0xc8')](config[_0xb814('0xc4')],_0xb814('0xc5'),'views',_0xb814('0xe6')),{'interaction':_0x164304})[_0xb814('0x2b')](function(_0x28b818){return new BPromise(function(_0x171845,_0x4f2db2){pdf[_0xb814('0xae')](_0x28b818,_0x6ec0f5)[_0xb814('0xe7')](path[_0xb814('0xc8')](_0x31b4f5,_0xb814('0xe8')+_0xa651a['id']+'-'+_0x368696+_0xb814('0xe9')),function(_0x2cb01d,_0x1f4540){if(_0x2cb01d)return _0x4f2db2(_0x2cb01d);_0x171845(_0x1f4540);});});})[_0xb814('0x2b')](function(){return new BPromise(function(_0x81ebc0,_0x2e7959){zipdir(_0x31b4f5,{'saveTo':_0x667ca1},function(_0x47f054,_0x1aa70b){if(_0x47f054)return _0x2e7959(_0x47f054);return _0x81ebc0(_0x1aa70b);});})[_0xb814('0x2b')](function(){return new BPromise(function(_0x5706ad,_0x3b8438){rimraf(_0x31b4f5,function(_0x56e231){if(_0x56e231)_0x3b8438(_0x56e231);return _0x5706ad();});});})[_0xb814('0x2b')](function(){return _0x3bc03a[_0xb814('0xc2')](_0x667ca1,_0x5b5a26,function(_0x5e2273){if(_0x5e2273){console[_0xb814('0xea')]('err',_0x5e2273);}else{fs[_0xb814('0xeb')](_0x667ca1);}});});});}else{return _0x3bc03a[_0xb814('0x20')](0xc8);}})[_0xb814('0x35')](handleError(_0x3bc03a,null));}; \ No newline at end of file +var _0xc4aa=['status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','fullname','TagIds','Tags','split','push','catch','WhatsappInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','length','getFullTextValue','ContactId','buildExpression','type','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','i.phone\x20LIKE\x20?','group','QueryTypes','SELECT','clone','order','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','fields','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','params','include','merge','create','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','options','findAll','setTags','omit','emit','whatsappInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','createdAt','secret','WhatsappAccount','Account','get','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','format','%s\x20#%d','Whatsapp','YYYY-MM-DD','Owner','N.A.','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','System','downloadInteraction.html','transcript-','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus'];(function(_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 diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 83475c6..a5e085c 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 _0x79ec=['WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','Users','map','findAll','then','setDataValue','unreadMessages','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x79ec,0x166));var _0xc79e=function(_0xd6fcb5,_0x526523){_0xd6fcb5=_0xd6fcb5-0x0;var _0x278ac7=_0x79ec[_0xd6fcb5];return _0x278ac7;};'use strict';var EventEmitter=require(_0xc79e('0x0'));var WhatsappInteraction=require(_0xc79e('0x1'))['db'][_0xc79e('0x2')];var WhatsappMessage=require(_0xc79e('0x1'))['db'][_0xc79e('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xc79e('0x4')](0x0);var events={'afterCreate':_0xc79e('0x5'),'afterUpdate':_0xc79e('0x6'),'afterDestroy':_0xc79e('0x7')};function emitEvent(_0x3a7758){return function(_0x5018e6,_0x312f61,_0x50052f){_0x5018e6[_0xc79e('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4a40b9){_0x5018e6['setDataValue'](_0xc79e('0x9'),_0x4a40b9[_0xc79e('0xa')](function(_0x33f611){return{'id':_0x33f611['id']};}));return WhatsappMessage[_0xc79e('0xb')]({'where':{'WhatsappInteractionId':_0x5018e6['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc79e('0xc')](function(_0x4012c9){_0x5018e6[_0xc79e('0xd')](_0xc79e('0xe'),_0x4012c9['length']);WhatsappInteractionEvents[_0xc79e('0xf')](_0x3a7758+':'+_0x5018e6['id'],_0x5018e6);WhatsappInteractionEvents[_0xc79e('0xf')](_0x3a7758,_0x5018e6);_0x50052f(null);})['catch'](_0x50052f(null));};}for(var e in events){if(events[_0xc79e('0x10')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xc79e('0x11')]=WhatsappInteractionEvents; \ No newline at end of file +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 diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 50ad186..44743f7 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 _0x3c6d=['YYYY-MM-DD\x20HH:mm:ss','util','api','moment','bluebird','request-promise','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','closed','closedAt','format'];(function(_0x3fa6a2,_0x1c623c){var _0x4fd4b7=function(_0xf8b3b2){while(--_0xf8b3b2){_0x3fa6a2['push'](_0x3fa6a2['shift']());}};_0x4fd4b7(++_0x1c623c);}(_0x3c6d,0x1f0));var _0xd3c6=function(_0x407f29,_0x5cb804){_0x407f29=_0x407f29-0x0;var _0x457b6e=_0x3c6d[_0x407f29];return _0x457b6e;};'use strict';var _=require('lodash');var util=require(_0xd3c6('0x0'));var logger=require('../../config/logger')(_0xd3c6('0x1'));var moment=require(_0xd3c6('0x2'));var BPromise=require(_0xd3c6('0x3'));var rp=require(_0xd3c6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd3c6('0x5'));var attributes=require(_0xd3c6('0x6'));module[_0xd3c6('0x7')]=function(_0x3f9410,_0x5f1457){return _0x3f9410[_0xd3c6('0x8')](_0xd3c6('0x9'),attributes,{'tableName':_0xd3c6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x32305c,_0x1c2677,_0x505a68){if(_0x32305c['changed'](_0xd3c6('0xb'))){_0x32305c[_0xd3c6('0xc')]=moment()[_0xd3c6('0xd')](_0xd3c6('0xe'));}_0x505a68(null,_0x32305c);}}});}; \ No newline at end of file +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 diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 952ca69..ee1bb9d 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 _0x2626=['limit','stringify','AddTagsToWhatsappInteraction','find','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','request','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes'];(function(_0x3e14a0,_0x458af7){var _0x4f0240=function(_0x10e478){while(--_0x10e478){_0x3e14a0['push'](_0x3e14a0['shift']());}};_0x4f0240(++_0x458af7);}(_0x2626,0x1b6));var _0x6262=function(_0x4b2d98,_0x9868){_0x4b2d98=_0x4b2d98-0x0;var _0x4393ed=_0x2626[_0x4b2d98];return _0x4393ed;};'use strict';var _=require(_0x6262('0x0'));var util=require(_0x6262('0x1'));var moment=require(_0x6262('0x2'));var BPromise=require(_0x6262('0x3'));var rs=require(_0x6262('0x4'));var fs=require('fs');var Redis=require(_0x6262('0x5'));var db=require(_0x6262('0x6'))['db'];var utils=require(_0x6262('0x7'));var logger=require(_0x6262('0x8'))(_0x6262('0x9'));var config=require(_0x6262('0xa'));var jayson=require(_0x6262('0xb'));var client=jayson[_0x6262('0xc')][_0x6262('0xd')]({'port':0x232a});config[_0x6262('0xe')]=_[_0x6262('0xf')](config[_0x6262('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x6262('0x10'))(new Redis(config[_0x6262('0xe')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x38fcf8,_0x57589c,_0x499510){return new BPromise(function(_0x1b5f85,_0xf3047e){return client[_0x6262('0x11')](_0x38fcf8,_0x499510)[_0x6262('0x12')](function(_0x264a08){logger[_0x6262('0x13')](_0x6262('0x14'),_0x57589c,'request\x20sent');logger[_0x6262('0x15')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x57589c,_0x6262('0x16'),JSON['stringify'](_0x264a08));if(_0x264a08[_0x6262('0x17')]){if(_0x264a08['error']['code']===0x1f4){logger[_0x6262('0x17')](_0x6262('0x14'),_0x57589c,_0x264a08[_0x6262('0x17')]['message']);return _0xf3047e(_0x264a08[_0x6262('0x17')][_0x6262('0x18')]);}logger[_0x6262('0x17')](_0x6262('0x14'),_0x57589c,_0x264a08[_0x6262('0x17')][_0x6262('0x18')]);return _0x1b5f85(_0x264a08[_0x6262('0x17')][_0x6262('0x18')]);}else{logger[_0x6262('0x13')](_0x6262('0x14'),_0x57589c,_0x6262('0x16'));_0x1b5f85(_0x264a08[_0x6262('0x19')][_0x6262('0x18')]);}})[_0x6262('0x1a')](function(_0xb9cfda){logger[_0x6262('0x17')](_0x6262('0x14'),_0x57589c,_0xb9cfda);_0xf3047e(_0xb9cfda);});});}exports[_0x6262('0x1b')]=function(_0x3566b9){var _0x133fbb=this;return new Promise(function(_0xa36551,_0x146c29){return db[_0x6262('0x1c')][_0x6262('0x1d')](_0x3566b9[_0x6262('0x1e')],{'raw':_0x3566b9[_0x6262('0x1f')]?_0x3566b9['options'][_0x6262('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3566b9[_0x6262('0x1f')]?_0x3566b9['options'][_0x6262('0x21')]||null:null,'attributes':_0x3566b9[_0x6262('0x1f')]?_0x3566b9[_0x6262('0x1f')][_0x6262('0x22')]||null:null,'limit':_0x3566b9[_0x6262('0x1f')]?_0x3566b9[_0x6262('0x1f')][_0x6262('0x23')]||null:null})[_0x6262('0x12')](function(_0x1b81e8){logger[_0x6262('0x13')](_0x6262('0x1b'),_0x3566b9);logger[_0x6262('0x15')]('UpdateWhatsappInteraction',_0x3566b9,JSON[_0x6262('0x24')](_0x1b81e8));_0xa36551(_0x1b81e8);})['catch'](function(_0x1ef9ed){logger[_0x6262('0x17')](_0x6262('0x1b'),_0x1ef9ed[_0x6262('0x18')],_0x3566b9);_0x146c29(_0x133fbb['error'](0x1f4,_0x1ef9ed[_0x6262('0x18')]));});});};exports[_0x6262('0x25')]=function(_0x4386c3){return new Promise(function(_0x2d6dd3,_0x11b515){return db[_0x6262('0x1c')][_0x6262('0x26')]({'where':_0x4386c3[_0x6262('0x1f')]?_0x4386c3['options'][_0x6262('0x21')]||null:null})[_0x6262('0x12')](function(_0xb7c63c){if(_0xb7c63c){return _0xb7c63c[_0x6262('0x27')](_0x4386c3[_0x6262('0x1e')][_0x6262('0x28')],_['omit'](_0x4386c3[_0x6262('0x1e')],[_0x6262('0x28'),'id'])||{});}})[_0x6262('0x29')](function(_0x3ecff7){logger[_0x6262('0x13')]('AddTags',_0x4386c3);logger[_0x6262('0x15')](_0x6262('0x2a'),_0x4386c3,JSON['stringify'](_0x3ecff7));_0x2d6dd3(_0x3ecff7);})[_0x6262('0x1a')](function(_0x236060){logger[_0x6262('0x17')](_0x6262('0x2a'),_0x236060['message'],_0x4386c3);_0x11b515(_this['error'](0x1f4,_0x236060[_0x6262('0x18')]));});});}; \ No newline at end of file +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 diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 8b5ea81..1b6b8ee 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 _0x1342=['register','length','./whatsappInteraction.events','save','remove','update','removeListener'];(function(_0x4b942f,_0xa505f3){var _0x177afa=function(_0x1984d2){while(--_0x1984d2){_0x4b942f['push'](_0x4b942f['shift']());}};_0x177afa(++_0xa505f3);}(_0x1342,0xe2));var _0x2134=function(_0x5c7107,_0x3c9e3a){_0x5c7107=_0x5c7107-0x0;var _0x52d2cb=_0x1342[_0x5c7107];return _0x52d2cb;};'use strict';var WhatsappInteractionEvents=require(_0x2134('0x0'));var events=[_0x2134('0x1'),_0x2134('0x2'),_0x2134('0x3')];function createListener(_0x108ec7,_0x443d5e){return function(_0x1f9e69){_0x443d5e['emit'](_0x108ec7,_0x1f9e69);};}function removeListener(_0xc382c6,_0x486f66){return function(){WhatsappInteractionEvents[_0x2134('0x4')](_0xc382c6,_0x486f66);};}exports[_0x2134('0x5')]=function(_0x33e055){for(var _0x544238=0x0,_0xfd7209=events[_0x2134('0x6')];_0x544238<_0xfd7209;_0x544238++){var _0x2822a5=events[_0x544238];var _0x5f2ba8=createListener('whatsappInteraction:'+_0x2822a5,_0x33e055);WhatsappInteractionEvents['on'](_0x2822a5,_0x5f2ba8);}}; \ No newline at end of file +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 diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 23fea7b..da26465 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 _0xd5ae=['exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','post','tracked','whatsappmessage:create','/:id/status','put','/:id','update','/:id/accept','reject','destroy'];(function(_0x19d1a2,_0x4b9f80){var _0x944db2=function(_0x419ea6){while(--_0x419ea6){_0x19d1a2['push'](_0x19d1a2['shift']());}};_0x944db2(++_0x4b9f80);}(_0xd5ae,0x169));var _0xed5a=function(_0x40b049,_0x19863b){_0x40b049=_0x40b049-0x0;var _0x5c1fef=_0xd5ae[_0x40b049];return _0x5c1fef;};'use strict';var multer=require(_0xed5a('0x0'));var util=require(_0xed5a('0x1'));var path=require(_0xed5a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xed5a('0x3')]();var auth=require(_0xed5a('0x4'));var interaction=require(_0xed5a('0x5'));var config=require(_0xed5a('0x6'));var controller=require('./whatsappMessage.controller');router[_0xed5a('0x7')]('/',auth['isAuthenticated'](),controller[_0xed5a('0x8')]);router[_0xed5a('0x7')](_0xed5a('0x9'),auth[_0xed5a('0xa')](),controller[_0xed5a('0xb')]);router['get']('/:id',auth[_0xed5a('0xa')](),controller[_0xed5a('0xc')]);router[_0xed5a('0xd')]('/',auth['isAuthenticated'](),interaction[_0xed5a('0xe')]('whatsapp',_0xed5a('0xf')),controller['create']);router[_0xed5a('0xd')](_0xed5a('0x10'),controller['status']);router[_0xed5a('0x11')](_0xed5a('0x12'),auth[_0xed5a('0xa')](),controller[_0xed5a('0x13')]);router[_0xed5a('0x11')](_0xed5a('0x14'),auth[_0xed5a('0xa')](),controller['accept']);router[_0xed5a('0x11')]('/:id/reject',auth[_0xed5a('0xa')](),controller[_0xed5a('0x15')]);router['delete'](_0xed5a('0x12'),auth[_0xed5a('0xa')](),controller[_0xed5a('0x16')]);module[_0xed5a('0x17')]=router; \ No newline at end of file +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 diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index bd04650..2ed505d 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 _0x15b7=['STRING','DATE','TEXT','BOOLEAN','ENUM','out'];(function(_0x16a659,_0x45e50d){var _0x247259=function(_0x5f5371){while(--_0x5f5371){_0x16a659['push'](_0x16a659['shift']());}};_0x247259(++_0x45e50d);}(_0x15b7,0x13a));var _0x715b=function(_0x306e9b,_0x1f24e1){_0x306e9b=_0x306e9b-0x0;var _0x4869a1=_0x15b7[_0x306e9b];return _0x4869a1;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x715b('0x0')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x715b('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x715b('0x2')]('in',_0x715b('0x3')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x715b('0x4')](0xbe)},'phone':{'type':Sequelize[_0x715b('0x4')]},'readAt':{'type':Sequelize[_0x715b('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +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 diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 1c49710..1f8ca2a 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 _0x1c38=['MessageStatus','twilio','html-pdf','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','ejs','lodash','squel','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','http','client','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','limit','set','Content-Range','reject','save','update','stack','name','send','map','WhatsappMessage','fieldName','type','key','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','show','keys','find','create','body','params','destroy','describe','whatsapp-interactions','whatsapp','read','format','UserId','user','CmContact','Contact','get','WhatsappInteraction','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','event','rejectmessage','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId'];(function(_0x350713,_0x1b09b6){var _0x36a15b=function(_0x3069f5){while(--_0x3069f5){_0x350713['push'](_0x350713['shift']());}};_0x36a15b(++_0x1b09b6);}(_0x1c38,0x100));var _0x81c3=function(_0x158d88,_0x489365){_0x158d88=_0x158d88-0x0;var _0x22e983=_0x1c38[_0x158d88];return _0x22e983;};'use strict';var pdf=require(_0x81c3('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x81c3('0x1'));var jsonpatch=require(_0x81c3('0x2'));var rp=require('request-promise');var moment=require(_0x81c3('0x3'));var BPromise=require(_0x81c3('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x81c3('0x5'));var csv=require(_0x81c3('0x6'));var ejs=require(_0x81c3('0x7'));var fs=require('fs');var _=require(_0x81c3('0x8'));var squel=require(_0x81c3('0x9'));var crypto=require('crypto');var jsforce=require(_0x81c3('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x81c3('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x81c3('0xb'));var qs=require(_0x81c3('0xc'));var as=require(_0x81c3('0xd'));var hardwareService=require(_0x81c3('0xe'));var logger=require(_0x81c3('0xf'))(_0x81c3('0x10'));var utils=require(_0x81c3('0x11'));var config=require(_0x81c3('0x12'));var db=require(_0x81c3('0x13'))['db'];config[_0x81c3('0x14')]=_[_0x81c3('0x15')](config['redis'],{'host':_0x81c3('0x16'),'port':0x18eb});var socket=require(_0x81c3('0x17'))(new Redis(config[_0x81c3('0x14')]));require(_0x81c3('0x18'))[_0x81c3('0x19')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x81c3('0x1a')]({'port':0x232c});var client9002=jayson[_0x81c3('0x1b')][_0x81c3('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x2b816b,_0x1c1719,_0x10fb03){if(_0x10fb03){var _0xa60f5a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xa60f5a['test'](_0x1c1719)){return _0x2b816b;}else{throw new db[(_0x81c3('0x1c'))]['ValidationError'](_0x81c3('0x1d'));}}else{return _0x2b816b;}}function respondWithRpcPromise(_0x5df8f5,_0x29c3aa,_0x40a4bd,_0x26b5e1){return new BPromise(function(_0x31987a,_0x446908){var _0x5b8bbd=_0x26b5e1||client;return _0x5b8bbd[_0x81c3('0x1e')](_0x5df8f5,_0x40a4bd)[_0x81c3('0x1f')](function(_0x39de84){logger[_0x81c3('0x20')](_0x81c3('0x21'),_0x29c3aa,_0x81c3('0x22'));logger['debug'](_0x81c3('0x23'),_0x29c3aa,'request\x20sent',JSON[_0x81c3('0x24')](_0x39de84));if(_0x39de84[_0x81c3('0x25')]){if(_0x39de84[_0x81c3('0x25')][_0x81c3('0x26')]===0x1f4){logger[_0x81c3('0x25')](_0x81c3('0x21'),_0x29c3aa,_0x39de84['error'][_0x81c3('0x27')]);return _0x446908(_0x39de84['error'][_0x81c3('0x27')]);}logger['error'](_0x81c3('0x21'),_0x29c3aa,_0x39de84[_0x81c3('0x25')][_0x81c3('0x27')]);return _0x31987a(_0x39de84[_0x81c3('0x25')][_0x81c3('0x27')]);}else{logger[_0x81c3('0x20')](_0x81c3('0x21'),_0x29c3aa,_0x81c3('0x22'));_0x31987a(_0x39de84[_0x81c3('0x28')]['message']);}})[_0x81c3('0x29')](function(_0x54ca1c){logger[_0x81c3('0x25')](_0x81c3('0x21'),_0x29c3aa,_0x54ca1c);_0x446908(_0x54ca1c);});});}function respondWithStatusCode(_0xe80856,_0x4c12a1){_0x4c12a1=_0x4c12a1||0xcc;return function(_0x15964e){if(_0x15964e){return _0xe80856[_0x81c3('0x2a')](_0x4c12a1);}return _0xe80856[_0x81c3('0x2b')](_0x4c12a1)[_0x81c3('0x2c')]();};}function respondWithResult(_0xaf78e3,_0x38554b){_0x38554b=_0x38554b||0xc8;return function(_0x37b424){if(_0x37b424){return _0xaf78e3[_0x81c3('0x2b')](_0x38554b)[_0x81c3('0x2d')](_0x37b424);}};}function respondWithFilteredResult(_0x4cab31,_0x143aa8){return function(_0x4d7f6f){if(_0x4d7f6f){var _0x50a1f8=_0x4d7f6f['count'],_0x42f0f7=_0x143aa8['offset'],_0xc4623e=_0x143aa8['offset']+_0x143aa8[_0x81c3('0x2e')],_0xaca372;if(_0xc4623e>=_0x50a1f8){_0xc4623e=_0x50a1f8;_0xaca372=0xc8;}else{_0xaca372=0xce;}_0x4cab31[_0x81c3('0x2b')](_0xaca372);return _0x4cab31[_0x81c3('0x2f')](_0x81c3('0x30'),_0x42f0f7+'-'+_0xc4623e+'/'+_0x50a1f8)[_0x81c3('0x2d')](_0x4d7f6f);}return null;};}function patchUpdates(_0xb4394a){return function(_0x2c8f7a){try{jsonpatch['apply'](_0x2c8f7a,_0xb4394a,!![]);}catch(_0x51ab2f){return BPromise[_0x81c3('0x31')](_0x51ab2f);}return _0x2c8f7a[_0x81c3('0x32')]();};}function saveUpdates(_0xcce11d,_0x33a0bd){return function(_0x55df5c){if(_0x55df5c){return _0x55df5c[_0x81c3('0x33')](_0xcce11d)['then'](function(_0xd9d4a1){return _0xd9d4a1;});}return null;};}function removeEntity(_0x14ddce,_0x549ae0){return function(_0x48d705){if(_0x48d705){return _0x48d705['destroy']()[_0x81c3('0x1f')](function(){_0x14ddce[_0x81c3('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5da921,_0x101521){return function(_0x1728d7){if(!_0x1728d7){_0x5da921['sendStatus'](0x194);}return _0x1728d7;};}function handleError(_0x466b94,_0x222052){_0x222052=_0x222052||0x1f4;return function(_0x51313d){logger['error'](_0x51313d[_0x81c3('0x34')]);if(_0x51313d[_0x81c3('0x35')]){delete _0x51313d[_0x81c3('0x35')];}_0x466b94[_0x81c3('0x2b')](_0x222052)[_0x81c3('0x36')](_0x51313d);};}exports['index']=function(_0x2a9300,_0x4cc56f){var _0x5875a3={},_0x57f3cc={},_0x314870={'count':0x0,'rows':[]};var _0x1536b0=_[_0x81c3('0x37')](db[_0x81c3('0x38')]['rawAttributes'],function(_0x4459fd){return{'name':_0x4459fd[_0x81c3('0x39')],'type':_0x4459fd[_0x81c3('0x3a')][_0x81c3('0x3b')]};});_0x57f3cc['model']=_[_0x81c3('0x37')](_0x1536b0,_0x81c3('0x35'));_0x57f3cc[_0x81c3('0x3c')]=_['keys'](_0x2a9300[_0x81c3('0x3c')]);_0x57f3cc[_0x81c3('0x3d')]=_['intersection'](_0x57f3cc['model'],_0x57f3cc[_0x81c3('0x3c')]);_0x5875a3[_0x81c3('0x3e')]=_[_0x81c3('0x3f')](_0x57f3cc[_0x81c3('0x40')],qs['fields'](_0x2a9300[_0x81c3('0x3c')][_0x81c3('0x41')]));_0x5875a3['attributes']=_0x5875a3['attributes'][_0x81c3('0x42')]?_0x5875a3['attributes']:_0x57f3cc[_0x81c3('0x40')];if(!_0x2a9300['query'][_0x81c3('0x43')](_0x81c3('0x44'))){_0x5875a3[_0x81c3('0x2e')]=qs[_0x81c3('0x2e')](_0x2a9300[_0x81c3('0x3c')][_0x81c3('0x2e')]);_0x5875a3[_0x81c3('0x45')]=qs[_0x81c3('0x45')](_0x2a9300['query'][_0x81c3('0x45')]);}_0x5875a3[_0x81c3('0x46')]=qs[_0x81c3('0x47')](_0x2a9300[_0x81c3('0x3c')][_0x81c3('0x47')]);_0x5875a3[_0x81c3('0x48')]=qs['filters'](_[_0x81c3('0x49')](_0x2a9300[_0x81c3('0x3c')],_0x57f3cc['filters']),_0x1536b0);if(_0x2a9300[_0x81c3('0x3c')][_0x81c3('0x4a')]){_0x5875a3['where']=_[_0x81c3('0x4b')](_0x5875a3[_0x81c3('0x48')],{'$or':_[_0x81c3('0x37')](_0x1536b0,function(_0x1702ad){if(_0x1702ad[_0x81c3('0x3a')]!==_0x81c3('0x4c')){var _0x5dbefa={};_0x5dbefa[_0x1702ad[_0x81c3('0x35')]]={'$like':'%'+_0x2a9300[_0x81c3('0x3c')][_0x81c3('0x4a')]+'%'};return _0x5dbefa;}})});}_0x5875a3=_[_0x81c3('0x4b')]({},_0x5875a3,_0x2a9300[_0x81c3('0x4d')]);var _0x3317b4={'where':_0x5875a3['where']};return db[_0x81c3('0x38')][_0x81c3('0x4e')](_0x3317b4)['then'](function(_0x1a6806){_0x314870['count']=_0x1a6806;if(_0x2a9300['query'][_0x81c3('0x4f')]){_0x5875a3[_0x81c3('0x50')]=[{'all':!![]}];}return db[_0x81c3('0x38')]['findAll'](_0x5875a3);})[_0x81c3('0x1f')](function(_0x1e6f69){_0x314870[_0x81c3('0x51')]=_0x1e6f69;return _0x314870;})[_0x81c3('0x1f')](respondWithFilteredResult(_0x4cc56f,_0x5875a3))[_0x81c3('0x29')](handleError(_0x4cc56f,null));};exports[_0x81c3('0x52')]=function(_0x1d7b5b,_0x13761e){var _0x1ea1d7={'raw':!![],'where':{'id':_0x1d7b5b['params']['id']}},_0x3c5c3a={};_0x3c5c3a['model']=_[_0x81c3('0x53')](db[_0x81c3('0x38')]['rawAttributes']);_0x3c5c3a[_0x81c3('0x3c')]=_[_0x81c3('0x53')](_0x1d7b5b[_0x81c3('0x3c')]);_0x3c5c3a[_0x81c3('0x3d')]=_[_0x81c3('0x3f')](_0x3c5c3a[_0x81c3('0x40')],_0x3c5c3a[_0x81c3('0x3c')]);_0x1ea1d7[_0x81c3('0x3e')]=_['intersection'](_0x3c5c3a[_0x81c3('0x40')],qs[_0x81c3('0x41')](_0x1d7b5b[_0x81c3('0x3c')]['fields']));_0x1ea1d7[_0x81c3('0x3e')]=_0x1ea1d7['attributes'][_0x81c3('0x42')]?_0x1ea1d7[_0x81c3('0x3e')]:_0x3c5c3a[_0x81c3('0x40')];if(_0x1d7b5b[_0x81c3('0x3c')]['includeAll']){_0x1ea1d7['include']=[{'all':!![]}];}_0x1ea1d7=_['merge']({},_0x1ea1d7,_0x1d7b5b[_0x81c3('0x4d')]);return db[_0x81c3('0x38')][_0x81c3('0x54')](_0x1ea1d7)[_0x81c3('0x1f')](handleEntityNotFound(_0x13761e,null))[_0x81c3('0x1f')](respondWithResult(_0x13761e,null))[_0x81c3('0x29')](handleError(_0x13761e,null));};exports[_0x81c3('0x55')]=function(_0x37adc2,_0x398531){return db[_0x81c3('0x38')][_0x81c3('0x55')](_0x37adc2[_0x81c3('0x56')],{})[_0x81c3('0x1f')](respondWithResult(_0x398531,0xc9))['catch'](handleError(_0x398531,null));};exports[_0x81c3('0x33')]=function(_0x16f6b5,_0x1a711e){if(_0x16f6b5[_0x81c3('0x56')]['id']){delete _0x16f6b5[_0x81c3('0x56')]['id'];}return db[_0x81c3('0x38')][_0x81c3('0x54')]({'where':{'id':_0x16f6b5[_0x81c3('0x57')]['id']}})['then'](handleEntityNotFound(_0x1a711e,null))[_0x81c3('0x1f')](saveUpdates(_0x16f6b5['body'],null))[_0x81c3('0x1f')](respondWithResult(_0x1a711e,null))['catch'](handleError(_0x1a711e,null));};exports[_0x81c3('0x58')]=function(_0x3da5b0,_0x3f940e){return db[_0x81c3('0x38')]['find']({'where':{'id':_0x3da5b0[_0x81c3('0x57')]['id']}})['then'](handleEntityNotFound(_0x3f940e,null))[_0x81c3('0x1f')](removeEntity(_0x3f940e,null))[_0x81c3('0x29')](handleError(_0x3f940e,null));};exports['describe']=function(_0x21a867,_0x4d14fd){return db['WhatsappMessage'][_0x81c3('0x59')]()[_0x81c3('0x1f')](respondWithResult(_0x4d14fd,null))['catch'](handleError(_0x4d14fd,null));};var interaction_log=require('../../config/logger')(_0x81c3('0x5a'));exports['accept']=function(_0x5a5a2b,_0xccbdf0,_0x4a27f7){var _0x53bfb6={'channel':_0x81c3('0x5b')};if(_0x5a5a2b[_0x81c3('0x56')]['id']){delete _0x5a5a2b['body']['id'];}_0x5a5a2b[_0x81c3('0x56')][_0x81c3('0x5c')]=!![];_0x5a5a2b[_0x81c3('0x56')]['readAt']=moment()[_0x81c3('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x5a5a2b[_0x81c3('0x56')]['UserId']=_0x5a5a2b['body'][_0x81c3('0x5e')]||_0x5a5a2b[_0x81c3('0x5f')]['id'];return db['WhatsappMessage'][_0x81c3('0x54')]({'where':{'id':_0x5a5a2b[_0x81c3('0x57')]['id'],'UserId':null},'include':[{'model':db[_0x81c3('0x60')],'as':_0x81c3('0x61')}]})[_0x81c3('0x1f')](handleEntityNotFound(_0xccbdf0,null))[_0x81c3('0x1f')](saveUpdates(_0x5a5a2b[_0x81c3('0x56')],null))[_0x81c3('0x1f')](function(_0x508fba){if(_0x508fba){_0x53bfb6[_0x81c3('0x27')]=_0x508fba[_0x81c3('0x62')]({'plain':!![]});return db[_0x81c3('0x63')][_0x81c3('0x54')]({'where':{'id':_0x508fba['WhatsappInteractionId']}});}return null;})[_0x81c3('0x1f')](handleEntityNotFound(_0xccbdf0,null))[_0x81c3('0x1f')](function(_0x23a8f2){if(_0x23a8f2){return _0x23a8f2['update']({'UserId':_0x5a5a2b[_0x81c3('0x56')][_0x81c3('0x5e')],'read1stAt':_[_0x81c3('0x64')](_0x23a8f2['read1stAt'])?moment()['format'](_0x81c3('0x65')):undefined});}return null;})['then'](function(_0x1440a8){if(_0x1440a8){_0x53bfb6[_0x81c3('0x66')]=_0x1440a8['get']({'plain':!![]});interaction_log['info'](_0x81c3('0x67'),_0x5a5a2b[_0x81c3('0x5f')]['id'],_0x5a5a2b[_0x81c3('0x5f')][_0x81c3('0x35')],_0x5a5a2b[_0x81c3('0x5f')][_0x81c3('0x68')],_0x53bfb6[_0x81c3('0x66')]['id'],_0x5a5a2b['body']?JSON[_0x81c3('0x24')](_0x5a5a2b[_0x81c3('0x56')]):_0x81c3('0x69'));return respondWithRpcPromise('AcceptMessage',_0x81c3('0x6a'),_0x53bfb6);}return null;})[_0x81c3('0x1f')](function(_0x28ae60){if(_0x28ae60){if(_0x5a5a2b['body'][_0x81c3('0x6b')]){_0x53bfb6[_0x81c3('0x27')][_0x81c3('0x6c')]=util[_0x81c3('0x5d')](_0x81c3('0x6d'),_0x5a5a2b[_0x81c3('0x5f')][_0x81c3('0x35')]);_0x53bfb6[_0x81c3('0x27')][_0x81c3('0x6e')]=_0x53bfb6['channel'];_0x53bfb6['message']['event']='accept';return respondWithRpcPromise(_0x81c3('0x6f'),_0x81c3('0x6f'),{'event':_0x81c3('0x70'),'message':_0x53bfb6[_0x81c3('0x27')]},client9002)[_0x81c3('0x1f')](function(){return _0x53bfb6;});}return _0x53bfb6;}return null;})['then'](respondWithResult(_0xccbdf0,null))[_0x81c3('0x29')](handleError(_0xccbdf0,null));};var interaction_log=require('../../config/logger')(_0x81c3('0x5a'));exports['reject']=function(_0x10dc1f,_0x55f471,_0x2df293){var _0x18b261={'agent':{},'channel':_0x81c3('0x5b')};if(_0x10dc1f[_0x81c3('0x56')]['id']){delete _0x10dc1f['body']['id'];}_0x10dc1f[_0x81c3('0x56')][_0x81c3('0x5e')]=_0x10dc1f['body'][_0x81c3('0x5e')]||_0x10dc1f[_0x81c3('0x5f')]['id'];_0x18b261['agent']['id']=_0x10dc1f['body'][_0x81c3('0x5e')];return db[_0x81c3('0x38')][_0x81c3('0x54')]({'where':{'id':_0x10dc1f[_0x81c3('0x57')]['id'],'UserId':null}})[_0x81c3('0x1f')](handleEntityNotFound(_0x55f471,null))[_0x81c3('0x1f')](function(_0x82af7b){if(_0x82af7b){_0x18b261['message']=_0x82af7b[_0x81c3('0x62')]({'plain':!![]});return db[_0x81c3('0x63')][_0x81c3('0x54')]({'where':{'id':_0x82af7b[_0x81c3('0x71')]}});}return null;})[_0x81c3('0x1f')](handleEntityNotFound(_0x55f471,null))[_0x81c3('0x1f')](function(_0x595ca4){if(_0x595ca4){_0x18b261[_0x81c3('0x66')]=_0x595ca4[_0x81c3('0x62')]({'plain':!![]});interaction_log[_0x81c3('0x20')](_0x81c3('0x72'),_0x10dc1f[_0x81c3('0x5f')]['id'],_0x10dc1f[_0x81c3('0x5f')][_0x81c3('0x35')],_0x10dc1f[_0x81c3('0x5f')]['role'],_0x18b261[_0x81c3('0x66')]['id'],_0x10dc1f[_0x81c3('0x56')]?JSON[_0x81c3('0x24')](_0x10dc1f['body']):_0x81c3('0x69'));return respondWithRpcPromise(_0x81c3('0x73'),'rejectMessage',_0x18b261);}return null;})[_0x81c3('0x1f')](function(_0x12366d){if(_0x12366d){_0x12366d[_0x81c3('0x27')][_0x81c3('0x6c')]=util[_0x81c3('0x5d')](_0x81c3('0x6d'),_0x10dc1f['user']['name']);_0x12366d[_0x81c3('0x27')]['channel']=_0x18b261[_0x81c3('0x6e')];_0x12366d[_0x81c3('0x27')][_0x81c3('0x74')]=_0x81c3('0x31');respondWithRpcPromise(_0x81c3('0x6f'),'EventManager',{'event':_0x81c3('0x75'),'message':_0x12366d[_0x81c3('0x27')]},client9002);return _0x18b261;}return null;})['then'](respondWithResult(_0x55f471,null))['catch'](handleError(_0x55f471,null));};exports['status']=function(_0xba9b3f,_0x26097a,_0x42382f){if(_0xba9b3f[_0x81c3('0x56')]['id']){delete _0xba9b3f[_0x81c3('0x56')]['id'];}var _0x1b792a;return db[_0x81c3('0x38')]['find']({'where':{'id':_0xba9b3f[_0x81c3('0x57')]['id']}})[_0x81c3('0x1f')](handleEntityNotFound(_0x26097a,null))[_0x81c3('0x1f')](function(_0x4e0694){if(_0x4e0694){_0x1b792a=_0x4e0694;return db['WhatsappAccount']['find']({'where':{'id':_0x4e0694[_0x81c3('0x76')]}});}})[_0x81c3('0x1f')](handleEntityNotFound(_0x26097a,null))[_0x81c3('0x1f')](function(_0x11701a){if(_0x11701a){logger[_0x81c3('0x77')](_0x81c3('0x78'),_0x81c3('0x2b'),_0x81c3('0x79'),_0x11701a['type'],util[_0x81c3('0x7a')](_0xba9b3f['body'],{'showHidden':![],'depth':null}));switch(_0x11701a['type']){case'twilio':if(_0xba9b3f[_0x81c3('0x56')][_0x81c3('0x7b')]&&_0xba9b3f[_0x81c3('0x56')][_0x81c3('0x7b')]===_0x1b792a[_0x81c3('0x7c')]&&_0xba9b3f['body']['MessageStatus']&&_0xba9b3f[_0x81c3('0x56')][_0x81c3('0x7d')]===_0x81c3('0x5c')){return _0x1b792a[_0x81c3('0x33')]({'read':!![]});}else{logger['error']('WhatsappAccount,\x20%s,\x20%s,\x20%s','status',_0x81c3('0x7e'),util['inspect'](_0xba9b3f[_0x81c3('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x1b792a;}})[_0x81c3('0x1f')](respondWithResult(_0x26097a,null))['catch'](handleError(_0x26097a,null));}; \ No newline at end of file +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 diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 74c88c3..00cb07d 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x4da0ab,_0x71b167){var _0x3adf40=function(_0x1e4b80){while(--_0x1e4b80){_0x4da0ab['push'](_0x4da0ab['shift']());}};_0x3adf40(++_0x71b167);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1b71c6,_0x5ce7e4){_0x1b71c6=_0x1b71c6-0x0;var _0x493849=_0x5f2f[_0x1b71c6];return _0x493849;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file +var _0xb10b=['hasOwnProperty','hook','events','WhatsappMessage','setMaxListeners','save','remove','emit'];(function(_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 diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 04d90fc..62f0fee 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 _0x11c7=['/api/whatsapp/messages/','/status?token=','token','sid','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','FULLTEXT','toLowerCase','out','secret','isNil','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','direction','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','messages','create','body','phone','remote'];(function(_0x13737f,_0x3d7c09){var _0x22cb37=function(_0x467fc3){while(--_0x467fc3){_0x13737f['push'](_0x13737f['shift']());}};_0x22cb37(++_0x3d7c09);}(_0x11c7,0x1a2));var _0x711c=function(_0x4886bf,_0xcaeb3b){_0x4886bf=_0x4886bf-0x0;var _0x417614=_0x11c7[_0x4886bf];return _0x417614;};'use strict';var _=require(_0x711c('0x0'));var util=require('util');var logger=require(_0x711c('0x1'))(_0x711c('0x2'));var moment=require(_0x711c('0x3'));var BPromise=require(_0x711c('0x4'));var rp=require(_0x711c('0x5'));var fs=require('fs');var path=require(_0x711c('0x6'));var rimraf=require(_0x711c('0x7'));var config=require(_0x711c('0x8'));var attributes=require(_0x711c('0x9'));module[_0x711c('0xa')]=function(_0x46d225,_0x315f0c){return _0x46d225[_0x711c('0xb')](_0x711c('0xc'),attributes,{'tableName':_0x711c('0xd'),'paranoid':![],'indexes':[{'name':_0x711c('0xe'),'fields':[_0x711c('0xe')]},{'name':'fti_whatsapp_messages','fields':['body'],'type':_0x711c('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1851f3,_0x2015de,_0x37de52){var _0xd392f9=_0x46d225['models'];var _0x501bd5=_0x1851f3['get']({'plain':!![]});if(_0x501bd5['direction'][_0x711c('0x10')]()==='in'||_0x501bd5['direction']['toLowerCase']()===_0x711c('0x11')&&!_0x501bd5[_0x711c('0x12')]&&!_[_0x711c('0x13')](_0x501bd5['UserId'])){_0xd392f9[_0x711c('0x14')][_0x711c('0x15')]({'where':{'id':_0x501bd5[_0x711c('0x16')]}})[_0x711c('0x17')](function(_0x5e67c5){if(_0x5e67c5){_0x5e67c5[_0x711c('0x18')]({'lastMsgAt':_0x501bd5[_0x711c('0x19')],'lastMsgDirection':_0x501bd5[_0x711c('0x1a')][_0x711c('0x10')]()});}})[_0x711c('0x1b')](function(_0x581b9d){console[_0x711c('0x1c')](_0x581b9d);});}if(_0x501bd5[_0x711c('0x1a')]===_0x711c('0x11')&&!_0x501bd5[_0x711c('0x12')]){var _0x14a368;_0xd392f9[_0x711c('0x1d')][_0x711c('0x1e')]({'where':{'id':_0x501bd5[_0x711c('0x1f')]},'raw':!![]})[_0x711c('0x17')](function(_0x1b3446){_0x14a368=_0x1b3446;if(_0x14a368&&_0x14a368[_0x711c('0x20')]){switch(_0x14a368[_0x711c('0x20')]){case _0x711c('0x21'):var _0x20d1b1=require(_0x711c('0x21'));if(_0x14a368[_0x711c('0x22')]&&_0x14a368[_0x711c('0x23')]&&_0x14a368['phone']){var _0x50fa1b=new _0x20d1b1(_0x14a368['accountSid'],_0x14a368[_0x711c('0x23')]);_0x50fa1b[_0x711c('0x24')][_0x711c('0x25')]({'body':_0x501bd5[_0x711c('0x26')],'to':'whatsapp:'+_0x501bd5[_0x711c('0x27')],'from':'whatsapp:'+_0x14a368[_0x711c('0x27')],'statusCallback':_0x14a368[_0x711c('0x28')]+_0x711c('0x29')+_0x501bd5['id']+_0x711c('0x2a')+_0x14a368[_0x711c('0x2b')]})[_0x711c('0x17')](function(_0x21669d){if(_0x21669d[_0x711c('0x2c')]){return _0x1851f3['update']({'messageId':_0x21669d[_0x711c('0x2c')]});}})['catch'](function(_0x279691){logger[_0x711c('0x1c')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x711c('0x2d'),_0x711c('0x21'),util[_0x711c('0x2e')](_0x279691,{'showHidden':![],'depth':null}));});}else{logger[_0x711c('0x1c')](_0x711c('0x2f'),'afterCreate','twilio',_0x711c('0x30'));}break;}}})['finally'](function(){_0x37de52();});}else{_0x37de52();}}},'charset':_0x711c('0x31'),'collate':_0x711c('0x32')});}; \ No newline at end of file +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 diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 517d176..91492ad 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 _0x66e2=['lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','WhatsappMessage','create','body','options','raw','CreateWhatsappMessage'];(function(_0x47d689,_0x28a5cb){var _0x345641=function(_0x3b3ebd){while(--_0x3b3ebd){_0x47d689['push'](_0x47d689['shift']());}};_0x345641(++_0x28a5cb);}(_0x66e2,0x1dc));var _0x266e=function(_0x43a954,_0x1d73d7){_0x43a954=_0x43a954-0x0;var _0x1973f6=_0x66e2[_0x43a954];return _0x1973f6;};'use strict';var _=require(_0x266e('0x0'));var util=require(_0x266e('0x1'));var moment=require('moment');var BPromise=require(_0x266e('0x2'));var rs=require(_0x266e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x266e('0x4'))['db'];var utils=require(_0x266e('0x5'));var logger=require(_0x266e('0x6'))(_0x266e('0x7'));var config=require(_0x266e('0x8'));var jayson=require(_0x266e('0x9'));var client=jayson[_0x266e('0xa')][_0x266e('0xb')]({'port':0x232a});config[_0x266e('0xc')]=_[_0x266e('0xd')](config[_0x266e('0xc')],{'host':_0x266e('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x266e('0xc')]));require(_0x266e('0xf'))[_0x266e('0x10')](socket);function respondWithRpcPromise(_0x384e98,_0x30586a,_0x3d5e95){return new BPromise(function(_0xbe9eca,_0x272067){return client[_0x266e('0x11')](_0x384e98,_0x3d5e95)[_0x266e('0x12')](function(_0x178384){logger[_0x266e('0x13')](_0x266e('0x14'),_0x30586a,_0x266e('0x15'));logger[_0x266e('0x16')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x30586a,_0x266e('0x15'),JSON[_0x266e('0x17')](_0x178384));if(_0x178384[_0x266e('0x18')]){if(_0x178384[_0x266e('0x18')][_0x266e('0x19')]===0x1f4){logger[_0x266e('0x18')](_0x266e('0x14'),_0x30586a,_0x178384[_0x266e('0x18')]['message']);return _0x272067(_0x178384[_0x266e('0x18')][_0x266e('0x1a')]);}logger[_0x266e('0x18')](_0x266e('0x14'),_0x30586a,_0x178384[_0x266e('0x18')][_0x266e('0x1a')]);return _0xbe9eca(_0x178384[_0x266e('0x18')][_0x266e('0x1a')]);}else{logger['info'](_0x266e('0x14'),_0x30586a,'request\x20sent');_0xbe9eca(_0x178384['result'][_0x266e('0x1a')]);}})[_0x266e('0x1b')](function(_0x39a601){logger[_0x266e('0x18')](_0x266e('0x14'),_0x30586a,_0x39a601);_0x272067(_0x39a601);});});}exports['CreateWhatsappMessage']=function(_0x33c063){var _0x57031a=this;return new Promise(function(_0x4b00dd,_0x5e62e6){return db[_0x266e('0x1c')][_0x266e('0x1d')](_0x33c063[_0x266e('0x1e')],{'raw':_0x33c063[_0x266e('0x1f')]?_0x33c063['options'][_0x266e('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x57f334){logger[_0x266e('0x13')](_0x266e('0x21'),_0x33c063);logger[_0x266e('0x16')](_0x266e('0x21'),_0x33c063,JSON[_0x266e('0x17')](_0x57f334));_0x4b00dd(_0x57f334);})[_0x266e('0x1b')](function(_0x418926){logger[_0x266e('0x18')](_0x266e('0x21'),_0x418926[_0x266e('0x1a')],_0x33c063);_0x5e62e6(_0x57031a[_0x266e('0x18')](0x1f4,_0x418926[_0x266e('0x1a')]));});});}; \ No newline at end of file +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 diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 2d57bf2..3f58efe 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 _0xad78=['./whatsappMessage.events','update','emit','removeListener','register','length','whatsappMessage:'];(function(_0xf7a88,_0x25666a){var _0x3c0552=function(_0x244ae4){while(--_0x244ae4){_0xf7a88['push'](_0xf7a88['shift']());}};_0x3c0552(++_0x25666a);}(_0xad78,0x149));var _0x8ad7=function(_0x2f2a90,_0x7b59cc){_0x2f2a90=_0x2f2a90-0x0;var _0x513bff=_0xad78[_0x2f2a90];return _0x513bff;};'use strict';var WhatsappMessageEvents=require(_0x8ad7('0x0'));var events=['save','remove',_0x8ad7('0x1')];function createListener(_0x3d980d,_0x4fdce6){return function(_0x343c1d){_0x4fdce6[_0x8ad7('0x2')](_0x3d980d,_0x343c1d);};}function removeListener(_0x2daf59,_0x296a52){return function(){WhatsappMessageEvents[_0x8ad7('0x3')](_0x2daf59,_0x296a52);};}exports[_0x8ad7('0x4')]=function(_0x160c84){for(var _0x4301d4=0x0,_0x415e9c=events[_0x8ad7('0x5')];_0x4301d4<_0x415e9c;_0x4301d4++){var _0x49aeb1=events[_0x4301d4];var _0x4822d3=createListener(_0x8ad7('0x6')+_0x49aeb1,_0x160c84);WhatsappMessageEvents['on'](_0x49aeb1,_0x4822d3);}}; \ No newline at end of file +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 diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 54887de..d782ce0 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 _0x796b=['/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','put','destroy','delete','/:id/teams','removeTeams','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x796b,0xe9));var _0xb796=function(_0x1e4a8e,_0x18022b){_0x1e4a8e=_0x1e4a8e-0x0;var _0x5408f9=_0x796b[_0x1e4a8e];return _0x5408f9;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xb796('0x0'));var express=require(_0xb796('0x1'));var router=express[_0xb796('0x2')]();var auth=require(_0xb796('0x3'));var interaction=require(_0xb796('0x4'));var config=require(_0xb796('0x5'));var controller=require(_0xb796('0x6'));router[_0xb796('0x7')]('/',auth[_0xb796('0x8')](),controller[_0xb796('0x9')]);router[_0xb796('0x7')](_0xb796('0xa'),auth['isAuthenticated'](),controller[_0xb796('0xb')]);router['get'](_0xb796('0xc'),auth[_0xb796('0x8')](),controller[_0xb796('0xd')]);router[_0xb796('0x7')](_0xb796('0xe'),auth[_0xb796('0x8')](),controller[_0xb796('0xf')]);router[_0xb796('0x7')]('/:id/teams',auth[_0xb796('0x8')](),controller[_0xb796('0x10')]);router['get'](_0xb796('0x11'),auth[_0xb796('0x8')](),controller[_0xb796('0x12')]);router[_0xb796('0x13')]('/',auth[_0xb796('0x8')](),controller[_0xb796('0x14')]);router[_0xb796('0x13')]('/:id/teams',auth[_0xb796('0x8')](),controller['addTeams']);router['post'](_0xb796('0x11'),auth[_0xb796('0x8')](),controller['addAgents']);router[_0xb796('0x15')]('/:id',auth[_0xb796('0x8')](),controller['update']);router['delete']('/:id',auth[_0xb796('0x8')](),controller[_0xb796('0x16')]);router[_0xb796('0x17')](_0xb796('0x18'),auth['isAuthenticated'](),controller[_0xb796('0x19')]);router[_0xb796('0x17')](_0xb796('0x11'),auth[_0xb796('0x8')](),controller['removeAgents']);module[_0xb796('0x1a')]=router; \ No newline at end of file +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 diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index dd92157..f9348e0 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 _0x4d60=['STRING','sequelize','exports','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x1193eb,_0x2a1969){var _0x5507f2=function(_0x3bc111){while(--_0x3bc111){_0x1193eb['push'](_0x1193eb['shift']());}};_0x5507f2(++_0x2a1969);}(_0x4d60,0x181));var _0x04d6=function(_0x3cd4e6,_0x276c36){_0x3cd4e6=_0x3cd4e6-0x0;var _0x148011=_0x4d60[_0x3cd4e6];return _0x148011;};'use strict';var Sequelize=require(_0x04d6('0x0'));module[_0x04d6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x04d6('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x04d6('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x04d6('0x4')](_0x04d6('0x5'),_0x04d6('0x6'),'roundrobin')},'description':{'type':Sequelize[_0x04d6('0x7')]}}; \ No newline at end of file +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 diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 8b64637..f5963df 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 _0xf9e4=['error','name','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','UserProfileResource','describe','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','findAndCountAll','UserId','agent','updatedAt','format','%s/%s','SIP','whatsappPause','createdAt','Team','getTeams','addTeams','ids','User','online','voicePause','flatMap','Agents','sequelize','each','forEach','emit','removeTeams','field','tq.TeamId','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','compact','transaction','isEmpty','removeAgents','addAgents','omit','spread','userWhatsappQueue:save','isArray','userWhatsappQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./whatsappQueue.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','WhatsappQueues','sendStatus'];(function(_0x13fc2a,_0x505a7d){var _0x3fb4d6=function(_0x5b4fe7){while(--_0x5b4fe7){_0x13fc2a['push'](_0x13fc2a['shift']());}};_0x3fb4d6(++_0x505a7d);}(_0xf9e4,0x164));var _0x4f9e=function(_0x4cb070,_0x54994c){_0x4cb070=_0x4cb070-0x0;var _0x4a1ed8=_0xf9e4[_0x4cb070];return _0x4a1ed8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4f9e('0x0'));var rimraf=require(_0x4f9e('0x1'));var zipdir=require(_0x4f9e('0x2'));var jsonpatch=require(_0x4f9e('0x3'));var rp=require(_0x4f9e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4f9e('0x5'));var util=require('util');var path=require(_0x4f9e('0x6'));var sox=require(_0x4f9e('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4f9e('0x8'));var jsforce=require(_0x4f9e('0x9'));var deskjs=require(_0x4f9e('0xa'));var toCsv=require('to-csv');var querystring=require(_0x4f9e('0xb'));var Papa=require(_0x4f9e('0xc'));var Redis=require(_0x4f9e('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4f9e('0xe'));var hardwareService=require(_0x4f9e('0xf'));var logger=require('../../config/logger')(_0x4f9e('0x10'));var utils=require(_0x4f9e('0x11'));var config=require(_0x4f9e('0x12'));var db=require(_0x4f9e('0x13'))['db'];config['redis']=_['defaults'](config[_0x4f9e('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x4f9e('0x15'))(new Redis(config[_0x4f9e('0x14')]));require(_0x4f9e('0x16'))[_0x4f9e('0x17')](socket);function respondWithStatusCode(_0x5c2822,_0x4e7cba){_0x4e7cba=_0x4e7cba||0xcc;return function(_0x3a4ce1){if(_0x3a4ce1){return _0x5c2822['sendStatus'](_0x4e7cba);}return _0x5c2822[_0x4f9e('0x18')](_0x4e7cba)[_0x4f9e('0x19')]();};}function respondWithResult(_0x470eaf,_0x58f831){_0x58f831=_0x58f831||0xc8;return function(_0x3681d7){if(_0x3681d7){return _0x470eaf[_0x4f9e('0x18')](_0x58f831)[_0x4f9e('0x1a')](_0x3681d7);}};}function respondWithFilteredResult(_0x59f50e,_0x4de611){return function(_0x472c20){if(_0x472c20){var _0x5a9ac7=_0x472c20[_0x4f9e('0x1b')],_0x1941ea=_0x4de611['offset'],_0x4cc195=_0x4de611[_0x4f9e('0x1c')]+_0x4de611[_0x4f9e('0x1d')],_0x8a78f;if(_0x4cc195>=_0x5a9ac7){_0x4cc195=_0x5a9ac7;_0x8a78f=0xc8;}else{_0x8a78f=0xce;}_0x59f50e[_0x4f9e('0x18')](_0x8a78f);return _0x59f50e[_0x4f9e('0x1e')](_0x4f9e('0x1f'),_0x1941ea+'-'+_0x4cc195+'/'+_0x5a9ac7)[_0x4f9e('0x1a')](_0x472c20);}return null;};}function patchUpdates(_0x1fdb95){return function(_0xeb86ba){try{jsonpatch[_0x4f9e('0x20')](_0xeb86ba,_0x1fdb95,!![]);}catch(_0x22015a){return BPromise['reject'](_0x22015a);}return _0xeb86ba[_0x4f9e('0x21')]();};}function saveUpdates(_0x3e2af9,_0x482ec9){return function(_0x4bd2d0){if(_0x4bd2d0){return _0x4bd2d0[_0x4f9e('0x22')](_0x3e2af9)[_0x4f9e('0x23')](function(_0x145b76){return _0x145b76;});}return null;};}function removeEntity(_0x2bc4ce,_0x44487d){return function(_0x51b101){if(_0x51b101){return _0x51b101[_0x4f9e('0x24')]()[_0x4f9e('0x23')](function(){var _0x222e00=_0x51b101[_0x4f9e('0x25')]({'plain':!![]});var _0x7bbe7d=_0x4f9e('0x26');return db['UserProfileResource'][_0x4f9e('0x24')]({'where':{'type':_0x7bbe7d,'resourceId':_0x222e00['id']}})[_0x4f9e('0x23')](function(){return _0x51b101;});})['then'](function(){_0x2bc4ce[_0x4f9e('0x18')](0xcc)[_0x4f9e('0x19')]();});}};}function handleEntityNotFound(_0x5dd053,_0x46a9e7){return function(_0x3d9111){if(!_0x3d9111){_0x5dd053[_0x4f9e('0x27')](0x194);}return _0x3d9111;};}function handleError(_0x5a18ee,_0x4f9239){_0x4f9239=_0x4f9239||0x1f4;return function(_0x4d6030){logger[_0x4f9e('0x28')](_0x4d6030['stack']);if(_0x4d6030['name']){delete _0x4d6030[_0x4f9e('0x29')];}_0x5a18ee[_0x4f9e('0x18')](_0x4f9239)['send'](_0x4d6030);};}exports['index']=function(_0x29dd37,_0x5a8bfe){var _0x2cfa6c={},_0x2c4230={},_0x1cf220={'count':0x0,'rows':[]};var _0x348293=_[_0x4f9e('0x2a')](db[_0x4f9e('0x2b')][_0x4f9e('0x2c')],function(_0x34aecf){return{'name':_0x34aecf[_0x4f9e('0x2d')],'type':_0x34aecf[_0x4f9e('0x2e')][_0x4f9e('0x2f')]};});_0x2c4230[_0x4f9e('0x30')]=_[_0x4f9e('0x2a')](_0x348293,_0x4f9e('0x29'));_0x2c4230[_0x4f9e('0x31')]=_[_0x4f9e('0x32')](_0x29dd37[_0x4f9e('0x31')]);_0x2c4230[_0x4f9e('0x33')]=_[_0x4f9e('0x34')](_0x2c4230[_0x4f9e('0x30')],_0x2c4230[_0x4f9e('0x31')]);_0x2cfa6c[_0x4f9e('0x35')]=_[_0x4f9e('0x34')](_0x2c4230[_0x4f9e('0x30')],qs[_0x4f9e('0x36')](_0x29dd37[_0x4f9e('0x31')][_0x4f9e('0x36')]));_0x2cfa6c[_0x4f9e('0x35')]=_0x2cfa6c[_0x4f9e('0x35')][_0x4f9e('0x37')]?_0x2cfa6c['attributes']:_0x2c4230[_0x4f9e('0x30')];if(!_0x29dd37[_0x4f9e('0x31')][_0x4f9e('0x38')](_0x4f9e('0x39'))){_0x2cfa6c[_0x4f9e('0x1d')]=qs['limit'](_0x29dd37[_0x4f9e('0x31')][_0x4f9e('0x1d')]);_0x2cfa6c[_0x4f9e('0x1c')]=qs['offset'](_0x29dd37['query'][_0x4f9e('0x1c')]);}_0x2cfa6c[_0x4f9e('0x3a')]=qs[_0x4f9e('0x3b')](_0x29dd37[_0x4f9e('0x31')]['sort']);_0x2cfa6c[_0x4f9e('0x3c')]=qs[_0x4f9e('0x33')](_[_0x4f9e('0x3d')](_0x29dd37['query'],_0x2c4230['filters']),_0x348293);if(_0x29dd37[_0x4f9e('0x31')][_0x4f9e('0x3e')]){_0x2cfa6c['where']=_[_0x4f9e('0x3f')](_0x2cfa6c[_0x4f9e('0x3c')],{'$or':_[_0x4f9e('0x2a')](_0x348293,function(_0x227899){if(_0x227899[_0x4f9e('0x2e')]!==_0x4f9e('0x40')){var _0x245212={};_0x245212[_0x227899[_0x4f9e('0x29')]]={'$like':'%'+_0x29dd37[_0x4f9e('0x31')]['filter']+'%'};return _0x245212;}})});}_0x2cfa6c=_[_0x4f9e('0x3f')]({},_0x2cfa6c,_0x29dd37[_0x4f9e('0x41')]);var _0x14e194={'where':_0x2cfa6c[_0x4f9e('0x3c')]};return db[_0x4f9e('0x2b')][_0x4f9e('0x1b')](_0x14e194)[_0x4f9e('0x23')](function(_0x92df8a){_0x1cf220[_0x4f9e('0x1b')]=_0x92df8a;if(_0x29dd37[_0x4f9e('0x31')]['includeAll']){_0x2cfa6c[_0x4f9e('0x42')]=[{'all':!![]}];}return db[_0x4f9e('0x2b')][_0x4f9e('0x43')](_0x2cfa6c);})[_0x4f9e('0x23')](function(_0x19bfc1){_0x1cf220[_0x4f9e('0x44')]=_0x19bfc1;return _0x1cf220;})['then'](respondWithFilteredResult(_0x5a8bfe,_0x2cfa6c))[_0x4f9e('0x45')](handleError(_0x5a8bfe,null));};exports[_0x4f9e('0x46')]=function(_0x567535,_0x58bfbd){var _0xdd8370={'raw':!![],'where':{'id':_0x567535[_0x4f9e('0x47')]['id']}},_0x5a1721={};_0x5a1721['model']=_[_0x4f9e('0x32')](db['WhatsappQueue'][_0x4f9e('0x2c')]);_0x5a1721[_0x4f9e('0x31')]=_[_0x4f9e('0x32')](_0x567535['query']);_0x5a1721[_0x4f9e('0x33')]=_[_0x4f9e('0x34')](_0x5a1721[_0x4f9e('0x30')],_0x5a1721[_0x4f9e('0x31')]);_0xdd8370['attributes']=_[_0x4f9e('0x34')](_0x5a1721['model'],qs['fields'](_0x567535[_0x4f9e('0x31')][_0x4f9e('0x36')]));_0xdd8370[_0x4f9e('0x35')]=_0xdd8370[_0x4f9e('0x35')][_0x4f9e('0x37')]?_0xdd8370['attributes']:_0x5a1721[_0x4f9e('0x30')];if(_0x567535[_0x4f9e('0x31')][_0x4f9e('0x48')]){_0xdd8370[_0x4f9e('0x42')]=[{'all':!![]}];}_0xdd8370=_['merge']({},_0xdd8370,_0x567535[_0x4f9e('0x41')]);return db[_0x4f9e('0x2b')][_0x4f9e('0x49')](_0xdd8370)[_0x4f9e('0x23')](handleEntityNotFound(_0x58bfbd,null))['then'](respondWithResult(_0x58bfbd,null))[_0x4f9e('0x45')](handleError(_0x58bfbd,null));};exports[_0x4f9e('0x4a')]=function(_0x10301a,_0x39fa26){return db[_0x4f9e('0x2b')][_0x4f9e('0x4a')](_0x10301a[_0x4f9e('0x4b')],{})['then'](function(_0x93a39b){var _0x16b4d5=_0x10301a[_0x4f9e('0x4c')][_0x4f9e('0x25')]({'plain':!![]});if(!_0x16b4d5)throw new Error(_0x4f9e('0x4d'));if(_0x16b4d5['role']===_0x4f9e('0x4c')){var _0x1f9014=_0x93a39b[_0x4f9e('0x25')]({'plain':!![]});var _0x2cf1fe='WhatsappQueues';return db[_0x4f9e('0x4e')]['find']({'where':{'name':_0x2cf1fe,'userProfileId':_0x16b4d5['userProfileId']},'raw':!![]})[_0x4f9e('0x23')](function(_0x22768e){if(_0x22768e&&_0x22768e['autoAssociation']===0x0){return db[_0x4f9e('0x4f')][_0x4f9e('0x4a')]({'name':_0x1f9014[_0x4f9e('0x29')],'resourceId':_0x1f9014['id'],'type':_0x22768e[_0x4f9e('0x29')],'sectionId':_0x22768e['id']},{})[_0x4f9e('0x23')](function(){return _0x93a39b;});}else{return _0x93a39b;}})[_0x4f9e('0x45')](function(_0x40bf09){logger[_0x4f9e('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x40bf09);throw _0x40bf09;});}return _0x93a39b;})[_0x4f9e('0x23')](respondWithResult(_0x39fa26,0xc9))[_0x4f9e('0x45')](handleError(_0x39fa26,null));};exports[_0x4f9e('0x22')]=function(_0xa0d94,_0x22f9f1){if(_0xa0d94[_0x4f9e('0x4b')]['id']){delete _0xa0d94[_0x4f9e('0x4b')]['id'];}return db[_0x4f9e('0x2b')][_0x4f9e('0x49')]({'where':{'id':_0xa0d94[_0x4f9e('0x47')]['id']}})[_0x4f9e('0x23')](handleEntityNotFound(_0x22f9f1,null))['then'](saveUpdates(_0xa0d94[_0x4f9e('0x4b')],null))[_0x4f9e('0x23')](respondWithResult(_0x22f9f1,null))[_0x4f9e('0x45')](handleError(_0x22f9f1,null));};exports[_0x4f9e('0x24')]=function(_0x1a9e57,_0x41df00){return db[_0x4f9e('0x2b')]['find']({'where':{'id':_0x1a9e57[_0x4f9e('0x47')]['id']}})[_0x4f9e('0x23')](handleEntityNotFound(_0x41df00,null))[_0x4f9e('0x23')](removeEntity(_0x41df00,null))[_0x4f9e('0x45')](handleError(_0x41df00,null));};exports[_0x4f9e('0x50')]=function(_0x5c4bae,_0x4e2140){return db['WhatsappQueue']['describe']()[_0x4f9e('0x23')](respondWithResult(_0x4e2140,null))[_0x4f9e('0x45')](handleError(_0x4e2140,null));};exports[_0x4f9e('0x51')]=function(_0x555267,_0x18d660,_0x4825d9){var _0x558823={'raw':!![],'where':{}},_0x2aa7bc={},_0x5d16ad;return db[_0x4f9e('0x2b')][_0x4f9e('0x52')]({'where':{'id':_0x555267[_0x4f9e('0x47')]['id']}})[_0x4f9e('0x23')](handleEntityNotFound(_0x18d660,null))[_0x4f9e('0x23')](function(_0x43c270){if(_0x43c270){_0x5d16ad=_0x43c270[_0x4f9e('0x25')]({'plain':!![]});_0x2aa7bc[_0x4f9e('0x30')]=_['keys'](db[_0x4f9e('0x53')][_0x4f9e('0x2c')]);_0x2aa7bc[_0x4f9e('0x31')]=_[_0x4f9e('0x32')](_0x555267['query']);_0x2aa7bc[_0x4f9e('0x33')]=_[_0x4f9e('0x34')](_0x2aa7bc[_0x4f9e('0x30')],_0x2aa7bc['query']);_0x558823['attributes']=_[_0x4f9e('0x34')](_0x2aa7bc['model'],qs['fields'](_0x555267['query']['fields']));_0x558823[_0x4f9e('0x35')]=_0x558823[_0x4f9e('0x35')]['length']?_0x558823['attributes']:_0x2aa7bc['model'];if(!_0x555267[_0x4f9e('0x31')][_0x4f9e('0x38')]('nolimit')){_0x558823[_0x4f9e('0x1d')]=qs[_0x4f9e('0x1d')](_0x555267[_0x4f9e('0x31')][_0x4f9e('0x1d')]);_0x558823[_0x4f9e('0x1c')]=qs[_0x4f9e('0x1c')](_0x555267['query'][_0x4f9e('0x1c')]);}_0x558823[_0x4f9e('0x3a')]=qs[_0x4f9e('0x3b')](_0x555267[_0x4f9e('0x31')]['sort']);_0x558823[_0x4f9e('0x3c')]=qs[_0x4f9e('0x33')](_[_0x4f9e('0x3d')](_0x555267[_0x4f9e('0x31')],_0x2aa7bc[_0x4f9e('0x33')]));_0x558823[_0x4f9e('0x3c')][_0x4f9e('0x54')]=_0x43c270['id'];if(_0x555267[_0x4f9e('0x31')]['filter']){_0x558823[_0x4f9e('0x3c')]=_['merge'](_0x558823[_0x4f9e('0x3c')],{'$or':_[_0x4f9e('0x2a')](_0x558823[_0x4f9e('0x35')],function(_0x11f60a){var _0x588526={};_0x588526[_0x11f60a]={'$like':'%'+_0x555267[_0x4f9e('0x31')][_0x4f9e('0x3e')]+'%'};return _0x588526;})});}_0x558823=_[_0x4f9e('0x3f')]({},_0x558823,_0x555267[_0x4f9e('0x41')]);return db[_0x4f9e('0x53')]['findAll'](_0x558823);}})[_0x4f9e('0x23')](function(_0x20e7ee){if(_0x20e7ee){return db['User'][_0x4f9e('0x55')]({'where':{'id':_[_0x4f9e('0x2a')](_0x20e7ee,_0x4f9e('0x56')),'role':_0x4f9e('0x57')},'attributes':['id',_0x4f9e('0x29'),'whatsappPause',_0x4f9e('0x58'),'createdAt']});}})[_0x4f9e('0x23')](function(_0x2ed3c8){if(_0x2ed3c8){return{'count':_0x2ed3c8['count'],'rows':_[_0x4f9e('0x2a')](_0x2ed3c8['rows'],function(_0x53ca16){return{'membername':_0x53ca16[_0x4f9e('0x29')],'UserId':_0x53ca16['id'],'queue_name':_0x5d16ad[_0x4f9e('0x29')],'WhatsappQueueId':_0x5d16ad['id'],'interface':util[_0x4f9e('0x59')](_0x4f9e('0x5a'),_0x4f9e('0x5b'),_0x53ca16[_0x4f9e('0x29')]),'penalty':0x0,'paused':_0x53ca16[_0x4f9e('0x5c')],'createdAt':_0x53ca16[_0x4f9e('0x5d')],'updatedAt':_0x53ca16[_0x4f9e('0x58')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4f9e('0x23')](respondWithFilteredResult(_0x18d660,_0x558823))['catch'](handleError(_0x18d660,null));};exports['getTeams']=function(_0x48547e,_0xf92ca6,_0x2d19c9){var _0x4fff3d={};var _0x55cc20={};var _0x3a4f3a;var _0x3f0ca4;return db[_0x4f9e('0x2b')][_0x4f9e('0x52')]({'where':{'id':_0x48547e[_0x4f9e('0x47')]['id']}})[_0x4f9e('0x23')](handleEntityNotFound(_0xf92ca6,null))['then'](function(_0x5138d7){if(_0x5138d7){_0x3a4f3a=_0x5138d7;_0x55cc20[_0x4f9e('0x30')]=_[_0x4f9e('0x32')](db[_0x4f9e('0x5e')][_0x4f9e('0x2c')]);_0x55cc20[_0x4f9e('0x31')]=_['keys'](_0x48547e[_0x4f9e('0x31')]);_0x55cc20[_0x4f9e('0x33')]=_[_0x4f9e('0x34')](_0x55cc20[_0x4f9e('0x30')],_0x55cc20['query']);_0x4fff3d['attributes']=_['intersection'](_0x55cc20['model'],qs[_0x4f9e('0x36')](_0x48547e[_0x4f9e('0x31')][_0x4f9e('0x36')]));_0x4fff3d[_0x4f9e('0x35')]=_0x4fff3d[_0x4f9e('0x35')][_0x4f9e('0x37')]?_0x4fff3d[_0x4f9e('0x35')]:_0x55cc20[_0x4f9e('0x30')];_0x4fff3d[_0x4f9e('0x3a')]=qs[_0x4f9e('0x3b')](_0x48547e['query'][_0x4f9e('0x3b')]);_0x4fff3d[_0x4f9e('0x3c')]=qs['filters'](_['pick'](_0x48547e[_0x4f9e('0x31')],_0x55cc20[_0x4f9e('0x33')]));if(_0x48547e[_0x4f9e('0x31')][_0x4f9e('0x3e')]){_0x4fff3d[_0x4f9e('0x3c')]=_[_0x4f9e('0x3f')](_0x4fff3d[_0x4f9e('0x3c')],{'$or':_[_0x4f9e('0x2a')](_0x4fff3d[_0x4f9e('0x35')],function(_0x43b2aa){var _0x1fb833={};_0x1fb833[_0x43b2aa]={'$like':'%'+_0x48547e['query']['filter']+'%'};return _0x1fb833;})});}_0x4fff3d=_[_0x4f9e('0x3f')]({},_0x4fff3d,_0x48547e[_0x4f9e('0x41')]);return _0x3a4f3a[_0x4f9e('0x5f')](_0x4fff3d);}})['then'](function(_0x4120ef){if(_0x4120ef){_0x3f0ca4=_0x4120ef[_0x4f9e('0x37')];if(!_0x48547e[_0x4f9e('0x31')][_0x4f9e('0x38')](_0x4f9e('0x39'))){_0x4fff3d[_0x4f9e('0x1d')]=qs[_0x4f9e('0x1d')](_0x48547e['query']['limit']);_0x4fff3d[_0x4f9e('0x1c')]=qs[_0x4f9e('0x1c')](_0x48547e[_0x4f9e('0x31')][_0x4f9e('0x1c')]);}return _0x3a4f3a[_0x4f9e('0x5f')](_0x4fff3d);}})['then'](function(_0x4a5c29){if(_0x4a5c29){return _0x4a5c29?{'count':_0x3f0ca4,'rows':_0x4a5c29}:null;}})['then'](respondWithResult(_0xf92ca6,null))[_0x4f9e('0x45')](handleError(_0xf92ca6,null));};exports[_0x4f9e('0x60')]=function(_0x3a38ca,_0x352269,_0x4d2b9b){var _0x560ff7=_0x3a38ca['body'][_0x4f9e('0x61')];return db['Team'][_0x4f9e('0x43')]({'where':{'id':_0x560ff7},'attributes':['id'],'include':[{'model':db[_0x4f9e('0x62')],'as':'Agents','attributes':['id',_0x4f9e('0x29'),_0x4f9e('0x63'),_0x4f9e('0x64'),'interface'],'raw':!![]}]})[_0x4f9e('0x23')](function(_0x17cf3f){if(_0x17cf3f){var _0x356180=_[_0x4f9e('0x65')](_0x17cf3f,function(_0x4c5403){var _0x20c30a=_0x4c5403[_0x4f9e('0x25')]({'plain':!![]});return _0x20c30a[_0x4f9e('0x66')];});return db[_0x4f9e('0x2b')][_0x4f9e('0x49')]({'where':{'id':_0x3a38ca['params']['id']}})['then'](function(_0x448f11){return db[_0x4f9e('0x67')]['transaction'](function(_0x26b0e0){return _0x448f11[_0x4f9e('0x60')](_0x560ff7,{'transaction':_0x26b0e0})[_0x4f9e('0x23')](function(){return BPromise[_0x4f9e('0x68')](_0x356180,function(_0x1bc39c){return db[_0x4f9e('0x53')]['findOrCreate']({'where':{'UserId':_0x1bc39c['id'],'WhatsappQueueId':_0x3a38ca[_0x4f9e('0x47')]['id']},'transaction':_0x26b0e0});});})['then'](function(){_0x356180[_0x4f9e('0x69')](function(_0x52eb8e){socket[_0x4f9e('0x6a')]('userWhatsappQueue:save',{'UserId':_0x52eb8e['id'],'WhatsappQueueId':_0x448f11['id']});});});});});}})[_0x4f9e('0x23')](respondWithStatusCode(_0x352269,null))[_0x4f9e('0x45')](handleError(_0x352269,null));};exports[_0x4f9e('0x6b')]=function(_0x5130b2,_0x4d1b85,_0x4d1996){return db['Team'][_0x4f9e('0x43')]({'where':{'id':_0x5130b2[_0x4f9e('0x31')]['ids']},'attributes':['id'],'include':[{'model':db[_0x4f9e('0x62')],'as':_0x4f9e('0x66'),'attributes':['id'],'raw':!![]}]})[_0x4f9e('0x23')](handleEntityNotFound(_0x4d1b85,null))[_0x4f9e('0x23')](function(_0x2821af){var _0x4014f2=_[_0x4f9e('0x2a')](_0x2821af,'id');var _0xe6c553=[];var _0x58cf7d=[];var _0x47a845=squel['select']();_0x47a845[_0x4f9e('0x6c')](_0x4f9e('0x6d'))['from']('team_has_whatsapp_queues','tq')['join'](_0x4f9e('0x6e'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x4f9e('0x3c')](_0x4f9e('0x6f'),_0x5130b2[_0x4f9e('0x47')]['id']);for(var _0x3b4142=0x0;_0x3b4142<_0x2821af[_0x4f9e('0x37')];_0x3b4142+=0x1){let _0x13845f=_0x2821af[_0x3b4142];for(var _0x3a8126=0x0;_0x3a8126<_0x13845f[_0x4f9e('0x66')][_0x4f9e('0x37')];_0x3a8126+=0x1){let _0x12227d=_0x13845f['Agents'][_0x3a8126];var _0x29481a=_0x47a845[_0x4f9e('0x70')]();_0x29481a['where'](_0x4f9e('0x71'),_0x12227d['id']);_0x58cf7d[_0x4f9e('0x72')](db['sequelize'][_0x4f9e('0x31')](_0x29481a[_0x4f9e('0x73')](),{'type':db[_0x4f9e('0x67')][_0x4f9e('0x74')][_0x4f9e('0x75')]})[_0x4f9e('0x23')](function(_0x571682){if(_0x571682[_0x4f9e('0x37')]===0x1){return _0x12227d['id'];}else{var _0x267e2a=_[_0x4f9e('0x76')](_[_0x4f9e('0x2a')](_0x571682,_0x4f9e('0x77')),function(_0x2360bd){return _[_0x4f9e('0x78')](_0x4014f2,_0x2360bd);});if(_0x267e2a){return _0x12227d['id'];}}}));}}return BPromise['all'](_0x58cf7d)[_0x4f9e('0x23')](function(_0x6546ee){_0xe6c553=_(_0xe6c553)['union'](_0x6546ee)[_0x4f9e('0x79')]()['value']();return db[_0x4f9e('0x2b')]['find']({'where':{'id':_0x5130b2['params']['id']}})['then'](function(_0x332ac0){return db[_0x4f9e('0x67')][_0x4f9e('0x7a')](function(_0x33b037){return _0x332ac0[_0x4f9e('0x6b')](_0x5130b2[_0x4f9e('0x31')][_0x4f9e('0x61')],{'transaction':_0x33b037})[_0x4f9e('0x23')](function(){if(!_[_0x4f9e('0x7b')](_0xe6c553)){return _0x332ac0[_0x4f9e('0x7c')](_0xe6c553,{'transaction':_0x33b037});}})['then'](function(){_0xe6c553[_0x4f9e('0x69')](function(_0x33b9ea){socket[_0x4f9e('0x6a')]('userWhatsappQueue:remove',{'UserId':_0x33b9ea,'WhatsappQueueId':_0x332ac0['id']});});});});});});})['then'](respondWithStatusCode(_0x4d1b85,null))[_0x4f9e('0x45')](handleError(_0x4d1b85,null));};exports[_0x4f9e('0x7d')]=function(_0x384325,_0x196593,_0x13797c){return db[_0x4f9e('0x2b')][_0x4f9e('0x49')]({'where':{'id':_0x384325[_0x4f9e('0x47')]['id']}})[_0x4f9e('0x23')](handleEntityNotFound(_0x196593,null))['then'](function(_0x18beb5){if(_0x18beb5){return _0x18beb5[_0x4f9e('0x7d')](_0x384325['body'][_0x4f9e('0x61')],_[_0x4f9e('0x7e')](_0x384325[_0x4f9e('0x4b')],[_0x4f9e('0x61'),'id'])||{})[_0x4f9e('0x7f')](function(_0x4ee0e8){for(var _0x24fe8c=0x0;_0x24fe8c<_0x384325['body'][_0x4f9e('0x61')][_0x4f9e('0x37')];_0x24fe8c+=0x1){socket[_0x4f9e('0x6a')](_0x4f9e('0x80'),{'UserId':_0x384325[_0x4f9e('0x4b')][_0x4f9e('0x61')][_0x24fe8c],'WhatsappQueueId':_0x384325[_0x4f9e('0x47')]['id']});}return _0x4ee0e8;});}})[_0x4f9e('0x23')](respondWithResult(_0x196593,null))[_0x4f9e('0x45')](handleError(_0x196593,null));};exports[_0x4f9e('0x7c')]=function(_0x336869,_0x2fb8d8,_0x3d15ea){return db[_0x4f9e('0x2b')][_0x4f9e('0x49')]({'where':{'id':_0x336869['params']['id']}})[_0x4f9e('0x23')](handleEntityNotFound(_0x2fb8d8,null))[_0x4f9e('0x23')](function(_0x206088){if(_0x206088){return _0x206088[_0x4f9e('0x7c')](_0x336869['query'][_0x4f9e('0x61')])[_0x4f9e('0x23')](function(){if(_[_0x4f9e('0x81')](_0x336869[_0x4f9e('0x31')][_0x4f9e('0x61')])){for(var _0x59c4d9=0x0;_0x59c4d9<_0x336869[_0x4f9e('0x31')][_0x4f9e('0x61')]['length'];_0x59c4d9+=0x1){socket[_0x4f9e('0x6a')](_0x4f9e('0x82'),{'UserId':Number(_0x336869[_0x4f9e('0x31')][_0x4f9e('0x61')][_0x59c4d9]),'WhatsappQueueId':Number(_0x336869[_0x4f9e('0x47')]['id'])});}}else{socket[_0x4f9e('0x6a')](_0x4f9e('0x82'),{'UserId':Number(_0x336869[_0x4f9e('0x31')][_0x4f9e('0x61')]),'WhatsappQueueId':Number(_0x336869[_0x4f9e('0x47')]['id'])});}});}})['then'](respondWithStatusCode(_0x2fb8d8,null))[_0x4f9e('0x45')](handleError(_0x2fb8d8,null));};exports[_0x4f9e('0x83')]=function(_0x91122d,_0x1db6f5,_0x57ae38){var _0x32b256={};var _0x4b549b={};var _0x293ca9;var _0x1c3e6c;return db['WhatsappQueue'][_0x4f9e('0x52')]({'where':{'id':_0x91122d[_0x4f9e('0x47')]['id']}})[_0x4f9e('0x23')](handleEntityNotFound(_0x1db6f5,null))[_0x4f9e('0x23')](function(_0x484e4b){if(_0x484e4b){_0x293ca9=_0x484e4b;_0x4b549b[_0x4f9e('0x30')]=_['keys'](db[_0x4f9e('0x62')]['rawAttributes']);_0x4b549b['query']=_['keys'](_0x91122d['query']);_0x4b549b['filters']=_[_0x4f9e('0x34')](_0x4b549b[_0x4f9e('0x30')],_0x4b549b[_0x4f9e('0x31')]);_0x32b256[_0x4f9e('0x35')]=_[_0x4f9e('0x34')](_0x4b549b[_0x4f9e('0x30')],qs[_0x4f9e('0x36')](_0x91122d['query'][_0x4f9e('0x36')]));_0x32b256[_0x4f9e('0x35')]=_0x32b256[_0x4f9e('0x35')][_0x4f9e('0x37')]?_0x32b256[_0x4f9e('0x35')]:_0x4b549b[_0x4f9e('0x30')];_0x32b256[_0x4f9e('0x3a')]=qs['sort'](_0x91122d['query'][_0x4f9e('0x3b')]);_0x32b256[_0x4f9e('0x3c')]=qs['filters'](_['pick'](_0x91122d[_0x4f9e('0x31')],_0x4b549b[_0x4f9e('0x33')]));if(_0x91122d[_0x4f9e('0x31')][_0x4f9e('0x3e')]){_0x32b256['where']=_[_0x4f9e('0x3f')](_0x32b256[_0x4f9e('0x3c')],{'$or':_['map'](_0x32b256['attributes'],function(_0x2ffff8){var _0x431e89={};_0x431e89[_0x2ffff8]={'$like':'%'+_0x91122d[_0x4f9e('0x31')][_0x4f9e('0x3e')]+'%'};return _0x431e89;})});}_0x32b256=_[_0x4f9e('0x3f')]({},_0x32b256,_0x91122d[_0x4f9e('0x41')]);return _0x293ca9[_0x4f9e('0x83')](_0x32b256);}})[_0x4f9e('0x23')](function(_0x23d1ea){if(_0x23d1ea){_0x1c3e6c=_0x23d1ea[_0x4f9e('0x37')];if(!_0x91122d[_0x4f9e('0x31')][_0x4f9e('0x38')]('nolimit')){_0x32b256['limit']=qs[_0x4f9e('0x1d')](_0x91122d[_0x4f9e('0x31')][_0x4f9e('0x1d')]);_0x32b256[_0x4f9e('0x1c')]=qs['offset'](_0x91122d[_0x4f9e('0x31')]['offset']);}return _0x293ca9['getAgents'](_0x32b256);}})['then'](function(_0x262a9d){if(_0x262a9d){return _0x262a9d?{'count':_0x1c3e6c,'rows':_0x262a9d}:null;}})[_0x4f9e('0x23')](respondWithResult(_0x1db6f5,null))[_0x4f9e('0x45')](handleError(_0x1db6f5,null));}; \ No newline at end of file +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 diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 141a67b..4b3f3d4 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 _0x6abd=['hook','exports','events','WhatsappQueue','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x227fe2,_0x4a5bc1){var _0x1c1f33=function(_0x396589){while(--_0x396589){_0x227fe2['push'](_0x227fe2['shift']());}};_0x1c1f33(++_0x4a5bc1);}(_0x6abd,0xa2));var _0xd6ab=function(_0x2f47ba,_0x447fc0){_0x2f47ba=_0x2f47ba-0x0;var _0x312f7e=_0x6abd[_0x2f47ba];return _0x312f7e;};'use strict';var EventEmitter=require(_0xd6ab('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0xd6ab('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xd6ab('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd6ab('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4b33b8){return function(_0xa9e617,_0x5a8a75,_0x1ad000){WhatsappQueueEvents[_0xd6ab('0x4')](_0x4b33b8+':'+_0xa9e617['id'],_0xa9e617);WhatsappQueueEvents[_0xd6ab('0x4')](_0x4b33b8,_0xa9e617);_0x1ad000(null);};}for(var e in events){if(events[_0xd6ab('0x5')](e)){var event=events[e];WhatsappQueue[_0xd6ab('0x6')](e,emitEvent(event));}}module[_0xd6ab('0x7')]=WhatsappQueueEvents; \ No newline at end of file +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 diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 2eae288..94c9660 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 _0x3527=['moment','path','rimraf','../../config/environment','define','WhatsappQueue','whatsapp_queues','lodash','../../config/logger','api'];(function(_0x229e3d,_0x3d92da){var _0x5148af=function(_0x1b2489){while(--_0x1b2489){_0x229e3d['push'](_0x229e3d['shift']());}};_0x5148af(++_0x3d92da);}(_0x3527,0xf7));var _0x7352=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x3527[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0x7352('0x0'));var util=require('util');var logger=require(_0x7352('0x1'))(_0x7352('0x2'));var moment=require(_0x7352('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7352('0x4'));var rimraf=require(_0x7352('0x5'));var config=require(_0x7352('0x6'));var attributes=require('./whatsappQueue.attributes');module['exports']=function(_0x366825,_0xc7153b){return _0x366825[_0x7352('0x7')](_0x7352('0x8'),attributes,{'tableName':_0x7352('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 3a97765..7990126 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 _0x8e1f=['options','limit','include','map','model','attributes','GetWhatsappQueue','catch','ShowWhatsappQueue','find','raw','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','WhatsappQueue','findAll'];(function(_0xa3d79b,_0x3586b8){var _0x44797b=function(_0xf95469){while(--_0xf95469){_0xa3d79b['push'](_0xa3d79b['shift']());}};_0x44797b(++_0x3586b8);}(_0x8e1f,0x164));var _0xf8e1=function(_0x152c94,_0x1b9c39){_0x152c94=_0x152c94-0x0;var _0x4c46e8=_0x8e1f[_0x152c94];return _0x4c46e8;};'use strict';var _=require(_0xf8e1('0x0'));var util=require(_0xf8e1('0x1'));var moment=require(_0xf8e1('0x2'));var BPromise=require(_0xf8e1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf8e1('0x4'));var db=require(_0xf8e1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf8e1('0x6'))(_0xf8e1('0x7'));var config=require('../../config/environment');var jayson=require(_0xf8e1('0x8'));var client=jayson[_0xf8e1('0x9')][_0xf8e1('0xa')]({'port':0x232a});config[_0xf8e1('0xb')]=_[_0xf8e1('0xc')](config['redis'],{'host':_0xf8e1('0xd'),'port':0x18eb});var socket=require(_0xf8e1('0xe'))(new Redis(config[_0xf8e1('0xb')]));require(_0xf8e1('0xf'))[_0xf8e1('0x10')](socket);function respondWithRpcPromise(_0x360bff,_0x96ef4d,_0x55abe8){return new BPromise(function(_0x28a338,_0x4f5e58){return client[_0xf8e1('0x11')](_0x360bff,_0x55abe8)[_0xf8e1('0x12')](function(_0x594c6f){logger[_0xf8e1('0x13')](_0xf8e1('0x14'),_0x96ef4d,_0xf8e1('0x15'));logger[_0xf8e1('0x16')](_0xf8e1('0x17'),_0x96ef4d,_0xf8e1('0x15'),JSON[_0xf8e1('0x18')](_0x594c6f));if(_0x594c6f[_0xf8e1('0x19')]){if(_0x594c6f[_0xf8e1('0x19')][_0xf8e1('0x1a')]===0x1f4){logger[_0xf8e1('0x19')]('WhatsappQueue,\x20%s,\x20%s',_0x96ef4d,_0x594c6f[_0xf8e1('0x19')][_0xf8e1('0x1b')]);return _0x4f5e58(_0x594c6f[_0xf8e1('0x19')][_0xf8e1('0x1b')]);}logger['error'](_0xf8e1('0x14'),_0x96ef4d,_0x594c6f['error'][_0xf8e1('0x1b')]);return _0x28a338(_0x594c6f[_0xf8e1('0x19')][_0xf8e1('0x1b')]);}else{logger[_0xf8e1('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x96ef4d,_0xf8e1('0x15'));_0x28a338(_0x594c6f[_0xf8e1('0x1c')][_0xf8e1('0x1b')]);}})['catch'](function(_0x46c45d){logger[_0xf8e1('0x19')]('WhatsappQueue,\x20%s,\x20%s',_0x96ef4d,_0x46c45d);_0x4f5e58(_0x46c45d);});});}exports['GetWhatsappQueue']=function(_0x3ec466){var _0x177bca=this;return new Promise(function(_0x328ee6,_0x1965f2){return db[_0xf8e1('0x1d')][_0xf8e1('0x1e')]({'raw':_0x3ec466[_0xf8e1('0x1f')]?_0x3ec466[_0xf8e1('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x3ec466[_0xf8e1('0x1f')]?_0x3ec466[_0xf8e1('0x1f')]['where']||null:null,'attributes':_0x3ec466[_0xf8e1('0x1f')]?_0x3ec466[_0xf8e1('0x1f')]['attributes']||null:null,'limit':_0x3ec466[_0xf8e1('0x1f')]?_0x3ec466['options'][_0xf8e1('0x20')]||null:null,'include':_0x3ec466[_0xf8e1('0x1f')]?_0x3ec466[_0xf8e1('0x1f')][_0xf8e1('0x21')]?_[_0xf8e1('0x22')](_0x3ec466[_0xf8e1('0x1f')][_0xf8e1('0x21')],function(_0x47b0f3){return{'model':db[_0x47b0f3[_0xf8e1('0x23')]],'as':_0x47b0f3['as'],'attributes':_0x47b0f3['attributes'],'include':_0x47b0f3[_0xf8e1('0x21')]?_['map'](_0x47b0f3['include'],function(_0x2eb7cd){return{'model':db[_0x2eb7cd[_0xf8e1('0x23')]],'as':_0x2eb7cd['as'],'attributes':_0x2eb7cd[_0xf8e1('0x24')],'include':_0x2eb7cd[_0xf8e1('0x21')]?_['map'](_0x2eb7cd[_0xf8e1('0x21')],function(_0x219b9e){return{'model':db[_0x219b9e['model']],'as':_0x219b9e['as'],'attributes':_0x219b9e[_0xf8e1('0x24')]};}):[]};}):[]};}):[]:[]})[_0xf8e1('0x12')](function(_0x4e49ba){logger[_0xf8e1('0x13')](_0xf8e1('0x25'),_0x3ec466);logger[_0xf8e1('0x16')](_0xf8e1('0x25'),_0x3ec466,JSON['stringify'](_0x4e49ba));_0x328ee6(_0x4e49ba);})[_0xf8e1('0x26')](function(_0x2e3158){logger[_0xf8e1('0x19')](_0xf8e1('0x25'),_0x2e3158[_0xf8e1('0x1b')],_0x3ec466);_0x1965f2(_0x177bca[_0xf8e1('0x19')](0x1f4,_0x2e3158[_0xf8e1('0x1b')]));});});};exports[_0xf8e1('0x27')]=function(_0x360efe){var _0x3e55f6=this;return new Promise(function(_0x26f582,_0x51b1b5){return db[_0xf8e1('0x1d')][_0xf8e1('0x28')]({'raw':_0x360efe['options']?_0x360efe['options'][_0xf8e1('0x29')]===undefined?!![]:![]:!![],'where':_0x360efe[_0xf8e1('0x1f')]?_0x360efe[_0xf8e1('0x1f')][_0xf8e1('0x2a')]||null:null,'attributes':_0x360efe[_0xf8e1('0x1f')]?_0x360efe[_0xf8e1('0x1f')]['attributes']||null:null,'include':_0x360efe['options']?_0x360efe[_0xf8e1('0x1f')][_0xf8e1('0x21')]?_[_0xf8e1('0x22')](_0x360efe[_0xf8e1('0x1f')][_0xf8e1('0x21')],function(_0x3ffd57){return{'model':db[_0x3ffd57['model']],'as':_0x3ffd57['as'],'attributes':_0x3ffd57[_0xf8e1('0x24')],'include':_0x3ffd57[_0xf8e1('0x21')]?_['map'](_0x3ffd57['include'],function(_0x55fadd){return{'model':db[_0x55fadd[_0xf8e1('0x23')]],'as':_0x55fadd['as'],'attributes':_0x55fadd[_0xf8e1('0x24')],'include':_0x55fadd[_0xf8e1('0x21')]?_['map'](_0x55fadd[_0xf8e1('0x21')],function(_0x52e269){return{'model':db[_0x52e269[_0xf8e1('0x23')]],'as':_0x52e269['as'],'attributes':_0x52e269[_0xf8e1('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x55f108){logger['info'](_0xf8e1('0x27'),_0x360efe);logger[_0xf8e1('0x16')](_0xf8e1('0x27'),_0x360efe,JSON['stringify'](_0x55f108));_0x26f582(_0x55f108);})[_0xf8e1('0x26')](function(_0x22a5d1){logger[_0xf8e1('0x19')](_0xf8e1('0x27'),_0x22a5d1[_0xf8e1('0x1b')],_0x360efe);_0x51b1b5(_0x3e55f6[_0xf8e1('0x19')](0x1f4,_0x22a5d1[_0xf8e1('0x1b')]));});});}; \ No newline at end of file +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 diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 983e0e3..651bd0c 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 _0x2137=['./whatsappQueue.events','save','remove','emit'];(function(_0x3b706c,_0x3e94af){var _0x473b0d=function(_0x97a0c8){while(--_0x97a0c8){_0x3b706c['push'](_0x3b706c['shift']());}};_0x473b0d(++_0x3e94af);}(_0x2137,0x134));var _0x7213=function(_0x50fa9a,_0x1da236){_0x50fa9a=_0x50fa9a-0x0;var _0x2bff39=_0x2137[_0x50fa9a];return _0x2bff39;};'use strict';var WhatsappQueueEvents=require(_0x7213('0x0'));var events=[_0x7213('0x1'),_0x7213('0x2'),'update'];function createListener(_0x4aaabf,_0x200474){return function(_0x55023e){_0x200474[_0x7213('0x3')](_0x4aaabf,_0x55023e);};}function removeListener(_0x421016,_0x15c165){return function(){WhatsappQueueEvents['removeListener'](_0x421016,_0x15c165);};}exports['register']=function(_0x4f36f0){for(var _0x2cf2d6=0x0,_0x3aa8a3=events['length'];_0x2cf2d6<_0x3aa8a3;_0x2cf2d6++){var _0x2cd831=events[_0x2cf2d6];var _0x2ad93f=createListener('whatsappQueue:'+_0x2cd831,_0x4f36f0);WhatsappQueueEvents['on'](_0x2cd831,_0x2ad93f);}}; \ No newline at end of file +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 diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index a155326..5c6b90d 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 _0x2b59=['get','/describe','describe','/:id','show','put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index'];(function(_0x2bcf5e,_0x5d9059){var _0x94e486=function(_0x24344f){while(--_0x24344f){_0x2bcf5e['push'](_0x2bcf5e['shift']());}};_0x94e486(++_0x5d9059);}(_0x2b59,0x1de));var _0x92b5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2b59[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x92b5('0x0'));var util=require(_0x92b5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x92b5('0x2'));var router=express[_0x92b5('0x3')]();var auth=require(_0x92b5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x92b5('0x5'));var controller=require('./whatsappQueueReport.controller');router['get']('/',auth[_0x92b5('0x6')](),controller[_0x92b5('0x7')]);router[_0x92b5('0x8')](_0x92b5('0x9'),auth[_0x92b5('0x6')](),controller[_0x92b5('0xa')]);router['get'](_0x92b5('0xb'),auth[_0x92b5('0x6')](),controller[_0x92b5('0xc')]);router['post']('/',auth[_0x92b5('0x6')](),controller['create']);router[_0x92b5('0xd')](_0x92b5('0xb'),auth['isAuthenticated'](),controller[_0x92b5('0xe')]);router[_0x92b5('0xf')](_0x92b5('0xb'),auth[_0x92b5('0x6')](),controller[_0x92b5('0x10')]);module[_0x92b5('0x11')]=router; \ No newline at end of file +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 diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 67316a6..b7a544f 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 _0x55ca=['DATE','STRING','sequelize','exports'];(function(_0x57589d,_0x228703){var _0x22cf0a=function(_0x16e4bd){while(--_0x16e4bd){_0x57589d['push'](_0x57589d['shift']());}};_0x22cf0a(++_0x228703);}(_0x55ca,0x126));var _0xa55c=function(_0x49b59f,_0x1f3a28){_0x49b59f=_0x49b59f-0x0;var _0x46f0de=_0x55ca[_0x49b59f];return _0x46f0de;};'use strict';var Sequelize=require(_0xa55c('0x0'));module[_0xa55c('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa55c('0x2')]},'acceptAt':{'type':Sequelize[_0xa55c('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa55c('0x3')]}}; \ No newline at end of file +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 diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 3ba270c..c7647ca 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 _0x64e6=['request-promise','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','save','then','destroy','end','error','stack','name','send','WhatsappQueueReport','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','filters','include','find','create','update','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch'];(function(_0x4e4315,_0x5d7615){var _0x31f97a=function(_0x330858){while(--_0x330858){_0x4e4315['push'](_0x4e4315['shift']());}};_0x31f97a(++_0x5d7615);}(_0x64e6,0x1b2));var _0x664e=function(_0x1c2454,_0x12cbbb){_0x1c2454=_0x1c2454-0x0;var _0x29128a=_0x64e6[_0x1c2454];return _0x29128a;};'use strict';var pdf=require(_0x664e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x664e('0x1'));var zipdir=require(_0x664e('0x2'));var jsonpatch=require(_0x664e('0x3'));var rp=require(_0x664e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x664e('0x5'));var util=require('util');var path=require(_0x664e('0x6'));var sox=require(_0x664e('0x7'));var csv=require('to-csv');var ejs=require(_0x664e('0x8'));var fs=require('fs');var _=require(_0x664e('0x9'));var squel=require(_0x664e('0xa'));var crypto=require('crypto');var jsforce=require(_0x664e('0xb'));var deskjs=require(_0x664e('0xc'));var toCsv=require(_0x664e('0xd'));var querystring=require(_0x664e('0xe'));var Papa=require(_0x664e('0xf'));var Redis=require(_0x664e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x664e('0x11'));var as=require(_0x664e('0x12'));var hardwareService=require(_0x664e('0x13'));var logger=require(_0x664e('0x14'))(_0x664e('0x15'));var utils=require('../../config/utils');var config=require(_0x664e('0x16'));var db=require(_0x664e('0x17'))['db'];function respondWithStatusCode(_0x4fad86,_0x33db77){_0x33db77=_0x33db77||0xcc;return function(_0x57ba43){if(_0x57ba43){return _0x4fad86[_0x664e('0x18')](_0x33db77);}return _0x4fad86[_0x664e('0x19')](_0x33db77)['end']();};}function respondWithResult(_0x5eb635,_0x426ef6){_0x426ef6=_0x426ef6||0xc8;return function(_0x841cba){if(_0x841cba){return _0x5eb635['status'](_0x426ef6)[_0x664e('0x1a')](_0x841cba);}};}function respondWithFilteredResult(_0x3f2fb5,_0x1ccacd){return function(_0x340b9e){if(_0x340b9e){var _0x2a967f=_0x340b9e[_0x664e('0x1b')],_0x4e9a56=_0x1ccacd['offset'],_0xb1da9e=_0x1ccacd[_0x664e('0x1c')]+_0x1ccacd['limit'],_0x47c019;if(_0xb1da9e>=_0x2a967f){_0xb1da9e=_0x2a967f;_0x47c019=0xc8;}else{_0x47c019=0xce;}_0x3f2fb5[_0x664e('0x19')](_0x47c019);return _0x3f2fb5[_0x664e('0x1d')]('Content-Range',_0x4e9a56+'-'+_0xb1da9e+'/'+_0x2a967f)[_0x664e('0x1a')](_0x340b9e);}return null;};}function patchUpdates(_0x39e9f0){return function(_0x56e47c){try{jsonpatch['apply'](_0x56e47c,_0x39e9f0,!![]);}catch(_0x312f31){return BPromise['reject'](_0x312f31);}return _0x56e47c[_0x664e('0x1e')]();};}function saveUpdates(_0x896c86,_0x3b5c0a){return function(_0x4e91ef){if(_0x4e91ef){return _0x4e91ef['update'](_0x896c86)[_0x664e('0x1f')](function(_0x52a162){return _0x52a162;});}return null;};}function removeEntity(_0x149490,_0x1a284c){return function(_0xf5f5b1){if(_0xf5f5b1){return _0xf5f5b1[_0x664e('0x20')]()[_0x664e('0x1f')](function(){_0x149490['status'](0xcc)[_0x664e('0x21')]();});}};}function handleEntityNotFound(_0xdc3890,_0x14f7f5){return function(_0x351336){if(!_0x351336){_0xdc3890[_0x664e('0x18')](0x194);}return _0x351336;};}function handleError(_0x51cbd2,_0x3fd8f9){_0x3fd8f9=_0x3fd8f9||0x1f4;return function(_0x7ab87d){logger[_0x664e('0x22')](_0x7ab87d[_0x664e('0x23')]);if(_0x7ab87d[_0x664e('0x24')]){delete _0x7ab87d['name'];}_0x51cbd2[_0x664e('0x19')](_0x3fd8f9)[_0x664e('0x25')](_0x7ab87d);};}exports['index']=function(_0x3ec4d7,_0x28980d){var _0x5582d9={},_0x6ae86e={},_0x12f3f6={'count':0x0,'rows':[]};var _0x460af4=_['map'](db[_0x664e('0x26')]['rawAttributes'],function(_0x5b5371){return{'name':_0x5b5371['fieldName'],'type':_0x5b5371[_0x664e('0x27')][_0x664e('0x28')]};});_0x6ae86e[_0x664e('0x29')]=_[_0x664e('0x2a')](_0x460af4,_0x664e('0x24'));_0x6ae86e[_0x664e('0x2b')]=_[_0x664e('0x2c')](_0x3ec4d7['query']);_0x6ae86e['filters']=_[_0x664e('0x2d')](_0x6ae86e[_0x664e('0x29')],_0x6ae86e[_0x664e('0x2b')]);_0x5582d9[_0x664e('0x2e')]=_['intersection'](_0x6ae86e[_0x664e('0x29')],qs[_0x664e('0x2f')](_0x3ec4d7[_0x664e('0x2b')][_0x664e('0x2f')]));_0x5582d9['attributes']=_0x5582d9[_0x664e('0x2e')][_0x664e('0x30')]?_0x5582d9[_0x664e('0x2e')]:_0x6ae86e[_0x664e('0x29')];if(!_0x3ec4d7[_0x664e('0x2b')][_0x664e('0x31')](_0x664e('0x32'))){_0x5582d9['limit']=qs[_0x664e('0x33')](_0x3ec4d7[_0x664e('0x2b')][_0x664e('0x33')]);_0x5582d9['offset']=qs[_0x664e('0x1c')](_0x3ec4d7[_0x664e('0x2b')]['offset']);}_0x5582d9[_0x664e('0x34')]=qs[_0x664e('0x35')](_0x3ec4d7['query'][_0x664e('0x35')]);_0x5582d9[_0x664e('0x36')]=qs['filters'](_[_0x664e('0x37')](_0x3ec4d7[_0x664e('0x2b')],_0x6ae86e['filters']),_0x460af4);if(_0x3ec4d7['query'][_0x664e('0x38')]){_0x5582d9[_0x664e('0x36')]=_[_0x664e('0x39')](_0x5582d9[_0x664e('0x36')],{'$or':_[_0x664e('0x2a')](_0x460af4,function(_0x55e72b){if(_0x55e72b[_0x664e('0x27')]!==_0x664e('0x3a')){var _0x471d3a={};_0x471d3a[_0x55e72b[_0x664e('0x24')]]={'$like':'%'+_0x3ec4d7[_0x664e('0x2b')][_0x664e('0x38')]+'%'};return _0x471d3a;}})});}_0x5582d9=_[_0x664e('0x39')]({},_0x5582d9,_0x3ec4d7[_0x664e('0x3b')]);var _0x5af41c={'where':_0x5582d9[_0x664e('0x36')]};return db[_0x664e('0x26')][_0x664e('0x1b')](_0x5af41c)['then'](function(_0x4db208){_0x12f3f6[_0x664e('0x1b')]=_0x4db208;if(_0x3ec4d7[_0x664e('0x2b')][_0x664e('0x3c')]){_0x5582d9['include']=[{'all':!![]}];}return db[_0x664e('0x26')][_0x664e('0x3d')](_0x5582d9);})[_0x664e('0x1f')](function(_0x50f21a){_0x12f3f6[_0x664e('0x3e')]=_0x50f21a;return _0x12f3f6;})[_0x664e('0x1f')](respondWithFilteredResult(_0x28980d,_0x5582d9))[_0x664e('0x3f')](handleError(_0x28980d,null));};exports[_0x664e('0x40')]=function(_0x1e4465,_0x6262fb){var _0x1d9970={'raw':!![],'where':{'id':_0x1e4465[_0x664e('0x41')]['id']}},_0x28db90={};_0x28db90['model']=_[_0x664e('0x2c')](db[_0x664e('0x26')]['rawAttributes']);_0x28db90['query']=_[_0x664e('0x2c')](_0x1e4465[_0x664e('0x2b')]);_0x28db90[_0x664e('0x42')]=_[_0x664e('0x2d')](_0x28db90[_0x664e('0x29')],_0x28db90[_0x664e('0x2b')]);_0x1d9970[_0x664e('0x2e')]=_[_0x664e('0x2d')](_0x28db90['model'],qs[_0x664e('0x2f')](_0x1e4465[_0x664e('0x2b')]['fields']));_0x1d9970['attributes']=_0x1d9970[_0x664e('0x2e')][_0x664e('0x30')]?_0x1d9970[_0x664e('0x2e')]:_0x28db90[_0x664e('0x29')];if(_0x1e4465['query']['includeAll']){_0x1d9970[_0x664e('0x43')]=[{'all':!![]}];}_0x1d9970=_[_0x664e('0x39')]({},_0x1d9970,_0x1e4465['options']);return db[_0x664e('0x26')][_0x664e('0x44')](_0x1d9970)['then'](handleEntityNotFound(_0x6262fb,null))[_0x664e('0x1f')](respondWithResult(_0x6262fb,null))[_0x664e('0x3f')](handleError(_0x6262fb,null));};exports['create']=function(_0xcc3ebc,_0x13c204){return db[_0x664e('0x26')][_0x664e('0x45')](_0xcc3ebc['body'],{})[_0x664e('0x1f')](respondWithResult(_0x13c204,0xc9))[_0x664e('0x3f')](handleError(_0x13c204,null));};exports[_0x664e('0x46')]=function(_0x3d9382,_0x8c1be9){if(_0x3d9382['body']['id']){delete _0x3d9382[_0x664e('0x47')]['id'];}return db[_0x664e('0x26')][_0x664e('0x44')]({'where':{'id':_0x3d9382['params']['id']}})[_0x664e('0x1f')](handleEntityNotFound(_0x8c1be9,null))[_0x664e('0x1f')](saveUpdates(_0x3d9382[_0x664e('0x47')],null))[_0x664e('0x1f')](respondWithResult(_0x8c1be9,null))[_0x664e('0x3f')](handleError(_0x8c1be9,null));};exports[_0x664e('0x20')]=function(_0x4d98ae,_0x3a897c){return db[_0x664e('0x26')][_0x664e('0x44')]({'where':{'id':_0x4d98ae[_0x664e('0x41')]['id']}})[_0x664e('0x1f')](handleEntityNotFound(_0x3a897c,null))['then'](removeEntity(_0x3a897c,null))['catch'](handleError(_0x3a897c,null));};exports[_0x664e('0x48')]=function(_0x28f8c9,_0x1abedf){return db['WhatsappQueueReport'][_0x664e('0x48')]()['then'](respondWithResult(_0x1abedf,null))[_0x664e('0x3f')](handleError(_0x1abedf,null));}; \ No newline at end of file +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 diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 048df43..e6f2226 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 _0x3d93=['report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define','WhatsappQueueReport'];(function(_0x2b0a1f,_0x3182d1){var _0x4fbf2c=function(_0x13b7f1){while(--_0x13b7f1){_0x2b0a1f['push'](_0x2b0a1f['shift']());}};_0x4fbf2c(++_0x3182d1);}(_0x3d93,0x13a));var _0x33d9=function(_0x48220b,_0x1b3ff5){_0x48220b=_0x48220b-0x0;var _0x26c2f3=_0x3d93[_0x48220b];return _0x26c2f3;};'use strict';var _=require(_0x33d9('0x0'));var util=require(_0x33d9('0x1'));var logger=require(_0x33d9('0x2'))(_0x33d9('0x3'));var moment=require(_0x33d9('0x4'));var BPromise=require(_0x33d9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x33d9('0x6'));var rimraf=require('rimraf');var config=require(_0x33d9('0x7'));var attributes=require('./whatsappQueueReport.attributes');module[_0x33d9('0x8')]=function(_0x237086,_0x10cb11){return _0x237086[_0x33d9('0x9')](_0x33d9('0xa'),attributes,{'tableName':_0x33d9('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x33d9('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index ee4e508..ef70301 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 _0x94a0=['CreateWhatsappQueueReport','WhatsappQueueReport','create','options','raw','UpdateWhatsappQueueReport','update','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','result','catch'];(function(_0x4b1eea,_0x393963){var _0xc2ee76=function(_0x2803f4){while(--_0x2803f4){_0x4b1eea['push'](_0x4b1eea['shift']());}};_0xc2ee76(++_0x393963);}(_0x94a0,0x72));var _0x094a=function(_0x3d368b,_0xbbc5db){_0x3d368b=_0x3d368b-0x0;var _0x579af1=_0x94a0[_0x3d368b];return _0x579af1;};'use strict';var _=require(_0x094a('0x0'));var util=require(_0x094a('0x1'));var moment=require(_0x094a('0x2'));var BPromise=require(_0x094a('0x3'));var rs=require(_0x094a('0x4'));var fs=require('fs');var Redis=require(_0x094a('0x5'));var db=require(_0x094a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x094a('0x7'))(_0x094a('0x8'));var config=require(_0x094a('0x9'));var jayson=require(_0x094a('0xa'));var client=jayson[_0x094a('0xb')][_0x094a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x338be6,_0x415c63,_0x21c37f){return new BPromise(function(_0x5e4fa5,_0x5f26f2){return client[_0x094a('0xd')](_0x338be6,_0x21c37f)[_0x094a('0xe')](function(_0x8d9dac){logger['info'](_0x094a('0xf'),_0x415c63,_0x094a('0x10'));logger[_0x094a('0x11')](_0x094a('0x12'),_0x415c63,_0x094a('0x10'),JSON[_0x094a('0x13')](_0x8d9dac));if(_0x8d9dac['error']){if(_0x8d9dac['error'][_0x094a('0x14')]===0x1f4){logger['error'](_0x094a('0xf'),_0x415c63,_0x8d9dac['error'][_0x094a('0x15')]);return _0x5f26f2(_0x8d9dac[_0x094a('0x16')][_0x094a('0x15')]);}logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x415c63,_0x8d9dac[_0x094a('0x16')][_0x094a('0x15')]);return _0x5e4fa5(_0x8d9dac[_0x094a('0x16')][_0x094a('0x15')]);}else{logger[_0x094a('0x17')](_0x094a('0xf'),_0x415c63,_0x094a('0x10'));_0x5e4fa5(_0x8d9dac[_0x094a('0x18')][_0x094a('0x15')]);}})[_0x094a('0x19')](function(_0x1af300){logger[_0x094a('0x16')](_0x094a('0xf'),_0x415c63,_0x1af300);_0x5f26f2(_0x1af300);});});}exports[_0x094a('0x1a')]=function(_0xa4fcfd){var _0xbb2d4e=this;return new Promise(function(_0x1ca08f,_0x349c97){return db[_0x094a('0x1b')][_0x094a('0x1c')](_0xa4fcfd['body'],{'raw':_0xa4fcfd[_0x094a('0x1d')]?_0xa4fcfd[_0x094a('0x1d')][_0x094a('0x1e')]===undefined?!![]:![]:!![]})[_0x094a('0xe')](function(_0x1a7b50){logger[_0x094a('0x17')](_0x094a('0x1a'),_0xa4fcfd);logger[_0x094a('0x11')](_0x094a('0x1a'),_0xa4fcfd,JSON[_0x094a('0x13')](_0x1a7b50));_0x1ca08f(_0x1a7b50);})[_0x094a('0x19')](function(_0x523dc9){logger['error'](_0x094a('0x1a'),_0x523dc9[_0x094a('0x15')],_0xa4fcfd);_0x349c97(_0xbb2d4e['error'](0x1f4,_0x523dc9[_0x094a('0x15')]));});});};exports[_0x094a('0x1f')]=function(_0x58042c){var _0x5cf6b4=this;return new Promise(function(_0x334f13,_0x2a7b58){return db[_0x094a('0x1b')][_0x094a('0x20')](_0x58042c['body'],{'raw':_0x58042c[_0x094a('0x1d')]?_0x58042c[_0x094a('0x1d')][_0x094a('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58042c['options']?_0x58042c[_0x094a('0x1d')][_0x094a('0x21')]||null:null,'attributes':_0x58042c[_0x094a('0x1d')]?_0x58042c[_0x094a('0x1d')][_0x094a('0x22')]||null:null,'limit':_0x58042c[_0x094a('0x1d')]?_0x58042c[_0x094a('0x1d')]['limit']||null:null})[_0x094a('0xe')](function(_0x1df782){logger['info'](_0x094a('0x1f'),_0x58042c);logger['debug'](_0x094a('0x1f'),_0x58042c,JSON[_0x094a('0x13')](_0x1df782));_0x334f13(_0x1df782);})[_0x094a('0x19')](function(_0x1c3ad4){logger[_0x094a('0x16')]('UpdateWhatsappQueueReport',_0x1c3ad4[_0x094a('0x15')],_0x58042c);_0x2a7b58(_0x5cf6b4['error'](0x1f4,_0x1c3ad4[_0x094a('0x15')]));});});}; \ No newline at end of file +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 diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index bdc2920..76db95d 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 _0x63bd=['Router','../../components/auth/service','./whatsappTransferReport.controller','get','index','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','connect-timeout','express'];(function(_0xe6e557,_0x4f724b){var _0x15f8a1=function(_0x50a1cf){while(--_0x50a1cf){_0xe6e557['push'](_0xe6e557['shift']());}};_0x15f8a1(++_0x4f724b);}(_0x63bd,0x163));var _0xd63b=function(_0x31f4ab,_0x5e2256){_0x31f4ab=_0x31f4ab-0x0;var _0x1f15b7=_0x63bd[_0x31f4ab];return _0x1f15b7;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd63b('0x0'));var express=require(_0xd63b('0x1'));var router=express[_0xd63b('0x2')]();var auth=require(_0xd63b('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd63b('0x4'));router[_0xd63b('0x5')]('/',auth['isAuthenticated'](),controller[_0xd63b('0x6')]);router['get']('/describe',auth[_0xd63b('0x7')](),controller[_0xd63b('0x8')]);router[_0xd63b('0x5')](_0xd63b('0x9'),auth[_0xd63b('0x7')](),controller['show']);router[_0xd63b('0xa')]('/',auth[_0xd63b('0x7')](),controller[_0xd63b('0xb')]);router[_0xd63b('0xc')](_0xd63b('0x9'),auth[_0xd63b('0x7')](),controller[_0xd63b('0xd')]);router[_0xd63b('0xe')](_0xd63b('0x9'),auth['isAuthenticated'](),controller[_0xd63b('0xf')]);module[_0xd63b('0x10')]=router; \ No newline at end of file +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 diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 83e0c6f..9e0c868 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 _0x5f2f=['agent','queue','DATE','sequelize','exports','STRING','ENUM','account'];(function(_0x38266b,_0x52e26b){var _0x1c1b43=function(_0x3e7c52){while(--_0x3e7c52){_0x38266b['push'](_0x38266b['shift']());}};_0x1c1b43(++_0x52e26b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x489c96,_0x4b90b5){_0x489c96=_0x489c96-0x0;var _0x27b5eb=_0x5f2f[_0x489c96];return _0x27b5eb;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'uniqueid':{'type':Sequelize[_0xf5f2('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf5f2('0x3')](_0xf5f2('0x4'),_0xf5f2('0x5'),_0xf5f2('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xf5f2('0x7')]}}; \ No newline at end of file +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 diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 2ad55ce..9727c47 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 _0x569c=['attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','count','offset','Content-Range','reject','update','destroy','then','error','stack','name','send','map','WhatsappTransferReport','fieldName','type','key','model','keys','filters','intersection','fields','query'];(function(_0x4bb581,_0x6f7037){var _0x316bf5=function(_0x1f6ed0){while(--_0x1f6ed0){_0x4bb581['push'](_0x4bb581['shift']());}};_0x316bf5(++_0x6f7037);}(_0x569c,0x13c));var _0xc569=function(_0xc18c35,_0x3d5f8d){_0xc18c35=_0xc18c35-0x0;var _0x2fe6d5=_0x569c[_0xc18c35];return _0x2fe6d5;};'use strict';var pdf=require(_0xc569('0x0'));var emlformat=require(_0xc569('0x1'));var rimraf=require(_0xc569('0x2'));var zipdir=require(_0xc569('0x3'));var jsonpatch=require(_0xc569('0x4'));var rp=require('request-promise');var moment=require(_0xc569('0x5'));var BPromise=require(_0xc569('0x6'));var Mustache=require(_0xc569('0x7'));var util=require(_0xc569('0x8'));var path=require(_0xc569('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xc569('0xa'));var squel=require(_0xc569('0xb'));var crypto=require(_0xc569('0xc'));var jsforce=require(_0xc569('0xd'));var deskjs=require(_0xc569('0xe'));var toCsv=require(_0xc569('0xf'));var querystring=require(_0xc569('0x10'));var Papa=require(_0xc569('0x11'));var Redis=require(_0xc569('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc569('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc569('0x14'))(_0xc569('0x15'));var utils=require(_0xc569('0x16'));var config=require('../../config/environment');var db=require(_0xc569('0x17'))['db'];function respondWithStatusCode(_0x477dff,_0x2f2041){_0x2f2041=_0x2f2041||0xcc;return function(_0xfd2e5b){if(_0xfd2e5b){return _0x477dff[_0xc569('0x18')](_0x2f2041);}return _0x477dff['status'](_0x2f2041)[_0xc569('0x19')]();};}function respondWithResult(_0x32fe2d,_0x28d01c){_0x28d01c=_0x28d01c||0xc8;return function(_0x591a32){if(_0x591a32){return _0x32fe2d[_0xc569('0x1a')](_0x28d01c)['json'](_0x591a32);}};}function respondWithFilteredResult(_0x5840bb,_0x3f1bf5){return function(_0x4fc68f){if(_0x4fc68f){var _0x5a238b=_0x4fc68f[_0xc569('0x1b')],_0x4fd1b2=_0x3f1bf5[_0xc569('0x1c')],_0x4e3dde=_0x3f1bf5[_0xc569('0x1c')]+_0x3f1bf5['limit'],_0x59cffb;if(_0x4e3dde>=_0x5a238b){_0x4e3dde=_0x5a238b;_0x59cffb=0xc8;}else{_0x59cffb=0xce;}_0x5840bb['status'](_0x59cffb);return _0x5840bb['set'](_0xc569('0x1d'),_0x4fd1b2+'-'+_0x4e3dde+'/'+_0x5a238b)['json'](_0x4fc68f);}return null;};}function patchUpdates(_0x484a34){return function(_0xab9f64){try{jsonpatch['apply'](_0xab9f64,_0x484a34,!![]);}catch(_0x3d6c39){return BPromise[_0xc569('0x1e')](_0x3d6c39);}return _0xab9f64['save']();};}function saveUpdates(_0x4292a1,_0x36a963){return function(_0x47e959){if(_0x47e959){return _0x47e959[_0xc569('0x1f')](_0x4292a1)['then'](function(_0x2cf4b8){return _0x2cf4b8;});}return null;};}function removeEntity(_0x11c213,_0xf16574){return function(_0x319270){if(_0x319270){return _0x319270[_0xc569('0x20')]()[_0xc569('0x21')](function(){_0x11c213[_0xc569('0x1a')](0xcc)[_0xc569('0x19')]();});}};}function handleEntityNotFound(_0x2ab1d7,_0x2ecdc6){return function(_0x18bed2){if(!_0x18bed2){_0x2ab1d7[_0xc569('0x18')](0x194);}return _0x18bed2;};}function handleError(_0x13e2dd,_0x430517){_0x430517=_0x430517||0x1f4;return function(_0x24a4d2){logger[_0xc569('0x22')](_0x24a4d2[_0xc569('0x23')]);if(_0x24a4d2[_0xc569('0x24')]){delete _0x24a4d2[_0xc569('0x24')];}_0x13e2dd[_0xc569('0x1a')](_0x430517)[_0xc569('0x25')](_0x24a4d2);};}exports['index']=function(_0x31fd80,_0x10f78e){var _0x57b8f4={},_0x299c39={},_0x58d8f3={'count':0x0,'rows':[]};var _0x1fc94a=_[_0xc569('0x26')](db[_0xc569('0x27')]['rawAttributes'],function(_0x5ddccf){return{'name':_0x5ddccf[_0xc569('0x28')],'type':_0x5ddccf[_0xc569('0x29')][_0xc569('0x2a')]};});_0x299c39[_0xc569('0x2b')]=_[_0xc569('0x26')](_0x1fc94a,'name');_0x299c39['query']=_[_0xc569('0x2c')](_0x31fd80['query']);_0x299c39[_0xc569('0x2d')]=_[_0xc569('0x2e')](_0x299c39[_0xc569('0x2b')],_0x299c39['query']);_0x57b8f4['attributes']=_[_0xc569('0x2e')](_0x299c39[_0xc569('0x2b')],qs[_0xc569('0x2f')](_0x31fd80[_0xc569('0x30')][_0xc569('0x2f')]));_0x57b8f4[_0xc569('0x31')]=_0x57b8f4[_0xc569('0x31')][_0xc569('0x32')]?_0x57b8f4[_0xc569('0x31')]:_0x299c39[_0xc569('0x2b')];if(!_0x31fd80[_0xc569('0x30')][_0xc569('0x33')](_0xc569('0x34'))){_0x57b8f4[_0xc569('0x35')]=qs[_0xc569('0x35')](_0x31fd80['query'][_0xc569('0x35')]);_0x57b8f4[_0xc569('0x1c')]=qs[_0xc569('0x1c')](_0x31fd80[_0xc569('0x30')][_0xc569('0x1c')]);}_0x57b8f4[_0xc569('0x36')]=qs[_0xc569('0x37')](_0x31fd80[_0xc569('0x30')][_0xc569('0x37')]);_0x57b8f4[_0xc569('0x38')]=qs[_0xc569('0x2d')](_['pick'](_0x31fd80[_0xc569('0x30')],_0x299c39[_0xc569('0x2d')]),_0x1fc94a);if(_0x31fd80[_0xc569('0x30')]['filter']){_0x57b8f4[_0xc569('0x38')]=_[_0xc569('0x39')](_0x57b8f4[_0xc569('0x38')],{'$or':_['map'](_0x1fc94a,function(_0x17efe2){if(_0x17efe2['type']!==_0xc569('0x3a')){var _0x96bbd7={};_0x96bbd7[_0x17efe2[_0xc569('0x24')]]={'$like':'%'+_0x31fd80[_0xc569('0x30')][_0xc569('0x3b')]+'%'};return _0x96bbd7;}})});}_0x57b8f4=_[_0xc569('0x39')]({},_0x57b8f4,_0x31fd80[_0xc569('0x3c')]);var _0x321f4d={'where':_0x57b8f4[_0xc569('0x38')]};return db[_0xc569('0x27')]['count'](_0x321f4d)[_0xc569('0x21')](function(_0x512d59){_0x58d8f3['count']=_0x512d59;if(_0x31fd80[_0xc569('0x30')][_0xc569('0x3d')]){_0x57b8f4['include']=[{'all':!![]}];}return db[_0xc569('0x27')][_0xc569('0x3e')](_0x57b8f4);})[_0xc569('0x21')](function(_0x1e8510){_0x58d8f3[_0xc569('0x3f')]=_0x1e8510;return _0x58d8f3;})[_0xc569('0x21')](respondWithFilteredResult(_0x10f78e,_0x57b8f4))[_0xc569('0x40')](handleError(_0x10f78e,null));};exports[_0xc569('0x41')]=function(_0x41369f,_0x429fb8){var _0x2ea624={'raw':!![],'where':{'id':_0x41369f[_0xc569('0x42')]['id']}},_0x19a1ee={};_0x19a1ee['model']=_[_0xc569('0x2c')](db[_0xc569('0x27')][_0xc569('0x43')]);_0x19a1ee[_0xc569('0x30')]=_[_0xc569('0x2c')](_0x41369f['query']);_0x19a1ee[_0xc569('0x2d')]=_[_0xc569('0x2e')](_0x19a1ee[_0xc569('0x2b')],_0x19a1ee[_0xc569('0x30')]);_0x2ea624[_0xc569('0x31')]=_['intersection'](_0x19a1ee[_0xc569('0x2b')],qs[_0xc569('0x2f')](_0x41369f[_0xc569('0x30')][_0xc569('0x2f')]));_0x2ea624['attributes']=_0x2ea624[_0xc569('0x31')][_0xc569('0x32')]?_0x2ea624[_0xc569('0x31')]:_0x19a1ee[_0xc569('0x2b')];if(_0x41369f[_0xc569('0x30')][_0xc569('0x3d')]){_0x2ea624[_0xc569('0x44')]=[{'all':!![]}];}_0x2ea624=_['merge']({},_0x2ea624,_0x41369f[_0xc569('0x3c')]);return db[_0xc569('0x27')][_0xc569('0x45')](_0x2ea624)[_0xc569('0x21')](handleEntityNotFound(_0x429fb8,null))[_0xc569('0x21')](respondWithResult(_0x429fb8,null))[_0xc569('0x40')](handleError(_0x429fb8,null));};exports[_0xc569('0x46')]=function(_0x55754e,_0x19bf74){return db[_0xc569('0x27')]['create'](_0x55754e[_0xc569('0x47')],{})[_0xc569('0x21')](respondWithResult(_0x19bf74,0xc9))['catch'](handleError(_0x19bf74,null));};exports['update']=function(_0x4908b5,_0x13591a){if(_0x4908b5[_0xc569('0x47')]['id']){delete _0x4908b5[_0xc569('0x47')]['id'];}return db[_0xc569('0x27')][_0xc569('0x45')]({'where':{'id':_0x4908b5['params']['id']}})[_0xc569('0x21')](handleEntityNotFound(_0x13591a,null))[_0xc569('0x21')](saveUpdates(_0x4908b5['body'],null))[_0xc569('0x21')](respondWithResult(_0x13591a,null))[_0xc569('0x40')](handleError(_0x13591a,null));};exports['destroy']=function(_0x8a8a57,_0x39b0ed){return db[_0xc569('0x27')][_0xc569('0x45')]({'where':{'id':_0x8a8a57[_0xc569('0x42')]['id']}})[_0xc569('0x21')](handleEntityNotFound(_0x39b0ed,null))[_0xc569('0x21')](removeEntity(_0x39b0ed,null))[_0xc569('0x40')](handleError(_0x39b0ed,null));};exports[_0xc569('0x48')]=function(_0x4f7b47,_0x2b40e3){return db['WhatsappTransferReport'][_0xc569('0x48')]()[_0xc569('0x21')](respondWithResult(_0x2b40e3,null))[_0xc569('0x40')](handleError(_0x2b40e3,null));}; \ No newline at end of file +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 diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 209ef47..926a1c6 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 _0x04ab=['./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2b3623,_0x436fee){var _0x4a8eb4=function(_0x5b0511){while(--_0x5b0511){_0x2b3623['push'](_0x2b3623['shift']());}};_0x4a8eb4(++_0x436fee);}(_0x04ab,0x148));var _0xb04a=function(_0xb47e7b,_0x283af5){_0xb47e7b=_0xb47e7b-0x0;var _0x4b895e=_0x04ab[_0xb47e7b];return _0x4b895e;};'use strict';var _=require('lodash');var util=require(_0xb04a('0x0'));var logger=require(_0xb04a('0x1'))(_0xb04a('0x2'));var moment=require(_0xb04a('0x3'));var BPromise=require(_0xb04a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb04a('0x5'));var rimraf=require(_0xb04a('0x6'));var config=require(_0xb04a('0x7'));var attributes=require(_0xb04a('0x8'));module[_0xb04a('0x9')]=function(_0x1d17e4,_0x2588c7){return _0x1d17e4[_0xb04a('0xa')](_0xb04a('0xb'),attributes,{'tableName':_0xb04a('0xc'),'paranoid':![],'indexes':[{'name':_0xb04a('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index dbd9854..8a6ddaa 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(_0x7e13c1,_0x1db8fc){var _0x343fb0=function(_0xaefa45){while(--_0xaefa45){_0x7e13c1['push'](_0x7e13c1['shift']());}};_0x343fb0(++_0x1db8fc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ 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(_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 diff --git a/server/app.js b/server/app.js index 44e32d7..1e741de 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcac4=['start','then','Online\x20apps:','map','online','name','join','filter','status','None','seedDB','./config/seedDB','default','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./rpc','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','sequelize','listen','info'];(function(_0x2db19e,_0x2f5f7b){var _0x349f66=function(_0x26fb2f){while(--_0x26fb2f){_0x2db19e['push'](_0x2db19e['shift']());}};_0x349f66(++_0x2f5f7b);}(_0xcac4,0x1c0));var _0x4cac=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0xcac4[_0x186376];return _0x2dbdd9;};'use strict';var _=require(_0x4cac('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0x4cac('0x1'));var config=require('./config/environment');var logger=require(_0x4cac('0x2'))(_0x4cac('0x3'));var pm2=require(_0x4cac('0x4'));var pm2Config=require(_0x4cac('0x5'));var schedule=require(_0x4cac('0x6'));var chat=require(_0x4cac('0x7'));function main(){return mysqldb['db'][_0x4cac('0x8')]['sync']()['then'](function(){return rpc[_0x4cac('0x9')]();})['then'](function(_0x50f1c6){logger[_0x4cac('0xa')](_0x50f1c6);return chat[_0x4cac('0xb')]();})[_0x4cac('0xc')](function(){return schedule[_0x4cac('0xb')]();})[_0x4cac('0xc')](function(_0xc10214){logger[_0x4cac('0xa')](_0xc10214);return pm2[_0x4cac('0xb')](pm2Config);})['then'](function(_0x5cc438){logger[_0x4cac('0xa')](_0x4cac('0xd'),_[_0x4cac('0xe')](_['filter'](_0x5cc438,{'status':_0x4cac('0xf')}),_0x4cac('0x10'))[_0x4cac('0x11')]());logger[_0x4cac('0xa')]('Offline\x20apps:',_[_0x4cac('0xe')](_[_0x4cac('0x12')](_0x5cc438,function(_0x2fdaea){return _0x2fdaea[_0x4cac('0x13')]!==_0x4cac('0xf');}),_0x4cac('0x10'))['join']()||_0x4cac('0x14'));config[_0x4cac('0x15')]&&require(_0x4cac('0x16'))[_0x4cac('0x17')]();require('./config/license')['default']();})[_0x4cac('0x18')](function(_0x446515){logger[_0x4cac('0x19')](_0x4cac('0x1a'),_0x446515);process['exit'](0x1);});}main(); \ No newline at end of file +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 diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 4b0287a..1895b9d 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 _0x2032=['params','closed','then','status','disposition','unmanaged','json','Unmanaged.','authorization','startsWith','headers','Basic','User','find','authenticate','catch','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','../../config/license/util','getLicense','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','promisify','sign','payload','options','verify','randomBytes','toString','../../config/environment','../../config/license/hardware','lodash','express-jwt','composable-middleware','crypto','bluebird','secrets','session','role','fullname','name','internal','email','userpic','permissions','chatPause','faxPause','smsPause','openchannelPause','showWebBar','lastPauseAt','allowmessenger','passwordResetAt','phoneBarEnableSettings','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x1e385a,_0x28aa95){_0x1e385a=_0x1e385a-0x0;var _0x3729fa=_0x2032[_0x1e385a];return _0x3729fa;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x2203('0x0'));var hardwareConf=require(_0x2203('0x1'));var _=require(_0x2203('0x2'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x2203('0x3'));var compose=require(_0x2203('0x4'));var basicAuth=require('basic-auth');var crypto=require(_0x2203('0x5'));var BPromise=require(_0x2203('0x6'));var validateJwt=expressJwt({'secret':config[_0x2203('0x7')][_0x2203('0x8')]});var userAttributes=['id',_0x2203('0x9'),_0x2203('0xa'),_0x2203('0xb'),_0x2203('0xc'),_0x2203('0xd'),_0x2203('0xe'),_0x2203('0xf'),'md5secret','voicePause',_0x2203('0x10'),'mailPause',_0x2203('0x11'),_0x2203('0x12'),_0x2203('0x13'),'pauseType',_0x2203('0x14'),'lastLoginAt',_0x2203('0x15'),'crudPermissions',_0x2203('0x16'),_0x2203('0x17'),'alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone',_0x2203('0x18'),'phoneBarExpires','phoneBarPrefixRequired',_0x2203('0x19'),_0x2203('0x1a'),_0x2203('0x1b'),_0x2203('0x1c'),_0x2203('0x1d')];exports[_0x2203('0x1e')]=function(){return this[_0x2203('0x1f')](!![])[_0x2203('0x20')](function(_0xdf9d0b,_0x3053f3,_0x5129fb){if(_0xdf9d0b[_0x2203('0x21')]){_0x5129fb();}else{return db[_0x2203('0x22')]['findOne']({'where':{'id':_0xdf9d0b[_0x2203('0x23')]['id']},'attributes':['id',_0x2203('0x24'),'disposition'],'raw':!![]})[_0x2203('0x25')](function(_0x5ee83c){if(_0x5ee83c&&_0x5ee83c[_0x2203('0x24')]){return _0x3053f3[_0x2203('0x26')](_0x5ee83c[_0x2203('0x27')]===_0x2203('0x28')?0x195:0x193)[_0x2203('0x29')]({'message':_0x5ee83c[_0x2203('0x27')]==='unmanaged'?_0x2203('0x2a'):'Forbidden.'});}else{_0x5129fb();}})['catch'](function(_0x15f543){_0x5129fb(_0x15f543);});}});};exports['isAuthenticated']=function isAuthenticated(_0x3b8ef9){return compose()[_0x2203('0x20')](function(_0x5d4c4e,_0x3ee25b,_0x5e29cd){if(_0x5d4c4e['headers'][_0x2203('0x2b')]){if(_[_0x2203('0x2c')](_0x5d4c4e[_0x2203('0x2d')][_0x2203('0x2b')],_0x2203('0x2e'))){var _0x3114ef=basicAuth(_0x5d4c4e);db[_0x2203('0x2f')][_0x2203('0x30')]({'where':{'name':_0x3114ef['name']}})[_0x2203('0x25')](function(_0x36b958){if(!_0x36b958||!_0x36b958[_0x2203('0x31')](_0x3114ef['pass'])){return _0x3ee25b[_0x2203('0x26')](0x191)[_0x2203('0x29')]({'message':'Wrong\x20credentials.'});}_0x5d4c4e[_0x2203('0x21')]={'id':_0x36b958['id']};_0x5e29cd();})[_0x2203('0x32')](function(_0x1c6a77){_0x5e29cd(_0x1c6a77);});}else if(_[_0x2203('0x2c')](_0x5d4c4e[_0x2203('0x2d')][_0x2203('0x2b')],_0x2203('0x33'))){validateJwt(_0x5d4c4e,_0x3ee25b,_0x5e29cd);}else{if(_0x3b8ef9){_0x5e29cd();}else{return _0x3ee25b['status'](0x193)[_0x2203('0x29')]({'message':_0x2203('0x34')});}}}else if(_0x5d4c4e[_0x2203('0x35')][_0x2203('0x36')]){try{var _0x52a426={'audience':hardwareConf[_0x2203('0x37')](),'issuer':hardwareConf[_0x2203('0x37')]()};verifyJwt(_0x5d4c4e[_0x2203('0x35')][_0x2203('0x36')],_0x52a426)['then'](function(_0xea1637){return db[_0x2203('0x2f')]['find']({'where':{'id':_0xea1637['sub']}})[_0x2203('0x25')](function(_0x52fafc){if(!_0x52fafc||!_['isEqual'](_0x52fafc[_0x2203('0x38')],_0xea1637[_0x2203('0x39')])){return _0x3ee25b[_0x2203('0x26')](0x191)[_0x2203('0x29')]({'message':_0x2203('0x3a')});}_0x5d4c4e['user']={'id':_0x52fafc['id']};_0x5e29cd();});})[_0x2203('0x32')](function(){return _0x3ee25b[_0x2203('0x26')](0x191)['json']({'message':_0x2203('0x3b')});});}catch(_0x20fbe1){_0x5e29cd(_0x20fbe1);}}else if(_0x3b8ef9){_0x5e29cd();}else{return _0x3ee25b[_0x2203('0x26')](0x193)[_0x2203('0x29')]({'message':_0x2203('0x34')});}})[_0x2203('0x20')](function(_0x29da55,_0x44228e,_0x708faa){if(_0x29da55['user']){db[_0x2203('0x2f')][_0x2203('0x30')]({'where':{'id':_0x29da55['user']['id']},'attributes':userAttributes})['then'](function(_0x2c58b1){if(!_0x2c58b1){return _0x44228e['status'](0x194)[_0x2203('0x29')]({'message':_0x2203('0x3c')});}_0x29da55[_0x2203('0x21')]=_0x2c58b1;_0x708faa();})['catch'](function(_0x5a2b90){_0x708faa(_0x5a2b90);});}else if(_0x3b8ef9){_0x708faa();}else{return _0x44228e[_0x2203('0x26')](0x194)['json']({'message':_0x2203('0x3d')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x2203('0x20')](function(_0x4b6fc5,_0x86097c,_0x13ed9e){return require(_0x2203('0x3e'))[_0x2203('0x3f')]()[_0x2203('0x25')](function(_0x5436d2){if(_0x5436d2['update']){_0x13ed9e();}else{return _0x86097c['status'](0x193)[_0x2203('0x29')]({'message':_0x2203('0x40')});}})[_0x2203('0x32')](function(_0x3b0c7a){_0x13ed9e(_0x3b0c7a);});});};exports[_0x2203('0x41')]=function(_0x3b250a,_0x1c7e3d,_0x590b4e){_0x3b250a[_0x2203('0x41')]=!![];return _0x590b4e();};exports[_0x2203('0x42')]=function signToken(_0x108fde){return signJwt(_0x108fde);};exports[_0x2203('0x43')]=function(_0x493d12,_0x50d74a){if(!_0x493d12[_0x2203('0x21')]){return _0x50d74a['status'](0x194)[_0x2203('0x29')]({'message':_0x2203('0x44')});}var _0x132091={'payload':{'id':_0x493d12['user']['id'],'role':_0x493d12['user'][_0x2203('0x9')]},'options':{'expiresIn':0x15180}};return signJwt(_0x132091)[_0x2203('0x25')](function(_0x368444){_0x50d74a[_0x2203('0x45')](_0x2203('0x46'),_0x368444);_0x50d74a[_0x2203('0x47')]('/dashboards/general');})[_0x2203('0x32')](function(_0x165a3f){return _0x50d74a[_0x2203('0x26')](0x1f4)[_0x2203('0x48')](_0x165a3f);});};exports[_0x2203('0x49')]=function(_0x36b99f){if(_[_0x2203('0x4a')](_0x36b99f[_0x2203('0x38')])||_[_0x2203('0x4a')](_0x36b99f[_0x2203('0x4b')])){return null;}else{return createJwt(_0x36b99f);}};exports['generateApiKey']=function(_0x2e2ca5){_0x2e2ca5[_0x2203('0x38')]=generateNonce();_0x2e2ca5[_0x2203('0x4b')]=generateIssuedAt();return createJwt(_0x2e2ca5);};exports[_0x2203('0x4c')]=function(_0x4c3259,_0x58bd5c){var _0x1c6661=_0x4c3259['query'][_0x2203('0x36')];if(_0x1c6661){var _0x15a8e8={'nonce':_0x58bd5c[_0x2203('0x38')],'iat':_0x58bd5c[_0x2203('0x4b')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x2203('0x37')]()};return verifyJwt(_0x1c6661,_0x15a8e8)[_0x2203('0x25')](function(){return generateApiKey(_0x58bd5c);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};function signJwt(_0x29bd91){var _0x381b3e=BPromise[_0x2203('0x4d')](jwt[_0x2203('0x4e')],{'context':jwt});var _0x5a71a5=_0x29bd91['secret']||config[_0x2203('0x7')]['session'];return new BPromise(function(_0x543fde,_0x450082){_0x381b3e(_0x29bd91[_0x2203('0x4f')],_0x5a71a5,_0x29bd91[_0x2203('0x50')])['then'](function(_0x4c1496){_0x543fde(_0x4c1496);})[_0x2203('0x32')](function(_0x3eecb7){_0x450082(_0x3eecb7);});});}function verifyJwt(_0x12d7fa,_0x21d2d7,_0x225b0e){var _0x21fd78=BPromise['promisify'](jwt[_0x2203('0x51')],{'context':jwt});var _0x557659=_0x225b0e||config[_0x2203('0x7')][_0x2203('0x8')];return new BPromise(function(_0x246aff,_0x1e49dd){_0x21fd78(_0x12d7fa,_0x557659,_0x21d2d7)['then'](function(_0x506795){_0x246aff(_0x506795);})[_0x2203('0x32')](function(_0x1f772d){_0x1e49dd(_0x1f772d);});});}function generateNonce(){return crypto[_0x2203('0x52')](0x10)[_0x2203('0x53')]('hex');}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x2203('0x53')]();}function createJwt(_0x1c2734){var _0x57b891={'payload':{'iat':_0x1c2734[_0x2203('0x4b')],'nonce':_0x1c2734[_0x2203('0x38')]},'options':{'algorithm':'HS512','subject':_0x1c2734['id'][_0x2203('0x53')](),'issuer':hardwareConf[_0x2203('0x37')](),'audience':hardwareConf[_0x2203('0x37')]()}};return signJwt(_0x57b891)[_0x2203('0x25')](function(_0x4bb6f1){return{'iat':_0x1c2734[_0x2203('0x4b')],'nonce':_0x1c2734['apiKeyNonce'],'token':_0x4bb6f1};});} \ No newline at end of file +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 diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index cdc15eb..bf07e53 100644 --- a/server/components/encryptor/index.js +++ b/server/components/encryptor/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['update','close','crypto','bluebird','aes192','hasOwnProperty','encryptFile','createReadStream','createCipher','algorithm','data','final','binary','write','end','unlink','decryptFile'];(function(_0x2e8059,_0x172923){var _0x54beed=function(_0x22cdbd){while(--_0x22cdbd){_0x2e8059['push'](_0x2e8059['shift']());}};_0x54beed(++_0x172923);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var crypto=require(_0x0a9e('0x0'));var fs=require('fs');var BPromise=require(_0x0a9e('0x1'));var defaultOptions={'algorithm':_0x0a9e('0x2')};function combineOptions(_0x5dd881){var _0x550fbc={};for(var _0x18d5c9 in defaultOptions){if(defaultOptions['hasOwnProperty'](_0x18d5c9)){_0x550fbc[_0x18d5c9]=defaultOptions[_0x18d5c9];}}if(_0x5dd881){for(var _0x333808 in _0x5dd881){if(_0x5dd881[_0x0a9e('0x3')](_0x333808)){_0x550fbc[_0x333808]=_0x5dd881[_0x333808];}}}return _0x550fbc;}exports[_0x0a9e('0x4')]=function(_0x991246,_0x981158,_0x57b080,_0x219af0){return new BPromise(function(_0x441e3a,_0x2cc193){_0x219af0=combineOptions(_0x219af0);var _0x5f41ea=new Buffer(_0x57b080);var _0x503809=fs[_0x0a9e('0x5')](_0x991246);var _0x56465b=fs['createWriteStream'](_0x981158);var _0x39753a=crypto[_0x0a9e('0x6')](_0x219af0[_0x0a9e('0x7')],_0x5f41ea);_0x503809['on'](_0x0a9e('0x8'),function(_0xfeb75b){var _0xbd1168=new Buffer(_0x39753a['update'](_0xfeb75b),'binary');_0x56465b['write'](_0xbd1168);});_0x503809['on']('end',function(){try{var _0x273d4d=new Buffer(_0x39753a[_0x0a9e('0x9')](_0x0a9e('0xa')),_0x0a9e('0xa'));_0x56465b[_0x0a9e('0xb')](_0x273d4d);_0x56465b[_0x0a9e('0xc')]();_0x56465b['on']('close',function(){return _0x441e3a(_0x981158);});}catch(_0x4283ce){fs[_0x0a9e('0xd')](_0x981158);return _0x2cc193(_0x4283ce);}});});};exports[_0x0a9e('0xe')]=function(_0x281129,_0x44dcfd,_0x4d5611,_0x52a03d){return new BPromise(function(_0x22dccb,_0x5d0880){_0x52a03d=combineOptions(_0x52a03d);var _0x1985b6=new Buffer(_0x4d5611);var _0x519dfd=fs[_0x0a9e('0x5')](_0x281129);var _0x12066b=fs['createWriteStream'](_0x44dcfd);var _0x225616=crypto['createDecipher'](_0x52a03d[_0x0a9e('0x7')],_0x1985b6);_0x519dfd['on'](_0x0a9e('0x8'),function(_0x106033){var _0x205fd6=new Buffer(_0x225616[_0x0a9e('0xf')](_0x106033),_0x0a9e('0xa'));_0x12066b[_0x0a9e('0xb')](_0x205fd6);});_0x519dfd['on'](_0x0a9e('0xc'),function(){try{var _0x1314ae=new Buffer(_0x225616[_0x0a9e('0x9')](_0x0a9e('0xa')),_0x0a9e('0xa'));_0x12066b['write'](_0x1314ae);_0x12066b[_0x0a9e('0xc')]();_0x12066b['on'](_0x0a9e('0x10'),function(){return _0x22dccb(_0x44dcfd);});}catch(_0x53682f){fs[_0x0a9e('0xd')](_0x44dcfd);return _0x5d0880(_0x53682f);}});});}; \ No newline at end of file +var _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 diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 49fba62..d574a3a 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 _0xe5b3=['lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','split','splitSizeCsv','then','sequelize','SELECT','Empty','length','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','query','dirname','.csv','existsSync','mkdirSync','join','%s%d.%s','%s.%s','csv','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','path'];(function(_0x826677,_0x2cb2c6){var _0x5acfac=function(_0x278673){while(--_0x278673){_0x826677['push'](_0x826677['shift']());}};_0x5acfac(++_0x2cb2c6);}(_0xe5b3,0x133));var _0x3e5b=function(_0x11af43,_0x26badb){_0x11af43=_0x11af43-0x0;var _0xc26d1=_0xe5b3[_0x11af43];return _0xc26d1;};'use strict';var util=require('util');var path=require(_0x3e5b('0x0'));var _=require(_0x3e5b('0x1'));var csv=require(_0x3e5b('0x2'));var fs=require('fs');var BPromise=require(_0x3e5b('0x3'));var zipdir=require(_0x3e5b('0x4'));var rimraf=require(_0x3e5b('0x5'));var db=require(_0x3e5b('0x6'))['db'];var dbH=require(_0x3e5b('0x6'))[_0x3e5b('0x7')];var logger=require(_0x3e5b('0x8'))(_0x3e5b('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x3e5b('0xa')][0x3];var PATH=process[_0x3e5b('0xa')][0x4];function analyticExtractedReport(_0x534e7d,_0x41d46f){var _0x3901c2={'status':_0x534e7d};var _0x3c7c2e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x41d46f){_0x3901c2[_0x3e5b('0xb')]=_0x41d46f;}return db['AnalyticExtractedReport']['update'](_0x3901c2,_0x3c7c2e);}function main(){var _0x1fef54=0x1388;var _0x3d3b6e;logger[_0x3e5b('0xc')](util[_0x3e5b('0xd')](_0x3e5b('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x3e5b('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3e5b('0x10'),_0x3e5b('0x11')]})[_0x3e5b('0x12')](function(_0x374068){if(_0x374068){_0x3d3b6e=_0x374068;_0x1fef54=_0x3d3b6e[_0x3e5b('0x11')]||0x1388;}})[_0x3e5b('0x12')](function(){return dbH[_0x3e5b('0x13')]['query'](util[_0x3e5b('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x3e5b('0x14')]});})[_0x3e5b('0x12')](function(_0x17aaa3){if(!_0x17aaa3[0x0]['num']){return analyticExtractedReport(_0x3e5b('0x15'));}var _0x59ddc0=[];var _0x56a453=0x0;var _0x258d6a=!![];if(_0x17aaa3&&_0x17aaa3[_0x3e5b('0x16')]){var _0x5e2f83=_0x17aaa3[0x0][_0x3e5b('0x17')]%(_0x56a453+_0x1fef54);if(_0x3d3b6e[_0x3e5b('0x10')]){for(;_0x258d6a;_0x56a453+=_0x1fef54,_0x5e2f83=_0x17aaa3[0x0]['num']%(_0x56a453+_0x1fef54)){if(_0x5e2f83==0x0||_0x5e2f83==_0x17aaa3[0x0][_0x3e5b('0x17')]){_0x258d6a=![];}_0x59ddc0[_0x3e5b('0x18')](dbH['sequelize']['query'](util[_0x3e5b('0xd')](_0x3e5b('0x19'),QUERY,_0x1fef54,_0x56a453),{'type':dbH[_0x3e5b('0x13')][_0x3e5b('0x1a')][_0x3e5b('0x14')]}));}}else{_0x59ddc0[_0x3e5b('0x18')](dbH[_0x3e5b('0x13')][_0x3e5b('0x1b')](QUERY,{'type':dbH[_0x3e5b('0x13')][_0x3e5b('0x1a')][_0x3e5b('0x14')]}));}}var _0x11e5cf=path[_0x3e5b('0x1c')](PATH);var _0x402873=path['basename'](PATH,_0x3e5b('0x1d'));var _0x86f19c=_0x3d3b6e[_0x3e5b('0x10')]&&_0x59ddc0[_0x3e5b('0x16')]>0x1;var _0x50039b=[];if(!fs[_0x3e5b('0x1e')](path['join'](_0x11e5cf,_0x402873))&&_0x86f19c){fs[_0x3e5b('0x1f')](path[_0x3e5b('0x20')](_0x11e5cf,_0x402873));}return BPromise['each'](_0x59ddc0,function(_0x41b684){_0x50039b[_0x3e5b('0x18')](_0x41b684);})[_0x3e5b('0x12')](function(){for(var _0x3c8965=0x0;_0x3c8965<_0x50039b[_0x3e5b('0x16')];_0x3c8965+=0x1){var _0x26c7f2;var _0x160e87=_0x50039b[_0x3c8965];if(_0x86f19c){_0x26c7f2=path[_0x3e5b('0x20')](_0x11e5cf,_0x402873,util['format'](_0x3e5b('0x21'),_0x402873,_0x3c8965,'csv'));}else{_0x26c7f2=path[_0x3e5b('0x20')](_0x11e5cf,util['format'](_0x3e5b('0x22'),_0x402873,_0x3e5b('0x23')));}fs[_0x3e5b('0x24')](_0x26c7f2,csv(_0x160e87));}})[_0x3e5b('0x12')](function(){if(_0x86f19c){zipdir(path[_0x3e5b('0x20')](_0x11e5cf,_0x402873),{'saveTo':path[_0x3e5b('0x20')](_0x11e5cf,util[_0x3e5b('0xd')](_0x3e5b('0x22'),_0x402873,_0x3e5b('0x25')))},function(_0x112dc0,_0x1e1565){});rimraf(path['join'](_0x11e5cf,_0x402873),function(){});}})[_0x3e5b('0x12')](function(){logger[_0x3e5b('0xc')](util[_0x3e5b('0xd')](_0x3e5b('0x26'),EXTRACTED_REPORT_ID,_0x3e5b('0x27')));return analyticExtractedReport(_0x3e5b('0x28'),_0x86f19c?util[_0x3e5b('0xd')]('%s.%s',_0x402873,_0x86f19c?_0x3e5b('0x25'):'csv'):null);});})['catch'](function(_0x32c6b0){logger[_0x3e5b('0xc')](util['format'](_0x3e5b('0x29'),EXTRACTED_REPORT_ID,_0x3e5b('0x27')),util[_0x3e5b('0x2a')](_0x32c6b0,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x3e5b('0x2b'));});}main(); \ No newline at end of file +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 diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index d6f50aa..4dd7493 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(_0x5ab637,_0x4543e4){var _0x370603=function(_0x538e92){while(--_0x538e92){_0x5ab637['push'](_0x5ab637['shift']());}};_0x370603(++_0x4543e4);}(_0xb10b,0x12a));var _0xbb10=function(_0x18fd0b,_0xe0f9ed){_0x18fd0b=_0x18fd0b-0x0;var _0x3b19a3=_0xb10b[_0x18fd0b];return _0x3b19a3;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file +var _0xb10b=['query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','existsSync','join','mkdirSync','each','name','startDate','endDate','landscape','black','body','content','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log','err','end','zip','info','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','then','splitSizePdf','length','sequelize'];(function(_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 diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index d155f92..a83aeef 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 _0xc8f2=['join','writeFileSync','%s.%s','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','path','lodash','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','split','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.xlsx','existsSync','mkdirSync','each','%s%d.%s','xlsx'];(function(_0x5bdbc9,_0x174bb0){var _0x3862df=function(_0x4f639e){while(--_0x4f639e){_0x5bdbc9['push'](_0x5bdbc9['shift']());}};_0x3862df(++_0x174bb0);}(_0xc8f2,0xc3));var _0x2c8f=function(_0x5026d2,_0x170f45){_0x5026d2=_0x5026d2-0x0;var _0xb03eb8=_0xc8f2[_0x5026d2];return _0xb03eb8;};'use strict';var util=require('util');var path=require(_0x2c8f('0x0'));var _=require(_0x2c8f('0x1'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x2c8f('0x2'));var zipdir=require(_0x2c8f('0x3'));var rimraf=require('rimraf');var db=require(_0x2c8f('0x4'))['db'];var dbH=require('../../mysqldb')[_0x2c8f('0x5')];var logger=require(_0x2c8f('0x6'))(_0x2c8f('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x2c8f('0x8')][0x2]);var QUERY=process[_0x2c8f('0x8')][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x10f876,_0x1f7a03){var _0x334070={'status':_0x10f876};var _0x2eb0b3={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1f7a03){_0x334070[_0x2c8f('0x9')]=_0x1f7a03;}return db['AnalyticExtractedReport'][_0x2c8f('0xa')](_0x334070,_0x2eb0b3);}function main(){var _0x3a9c0b=0x1388;var _0x347ca4;logger[_0x2c8f('0xb')](util[_0x2c8f('0xc')](_0x2c8f('0xd'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x2c8f('0xe')][_0x2c8f('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x2c8f('0x10')]})[_0x2c8f('0x11')](function(_0x1da266){if(_0x1da266){_0x347ca4=_0x1da266;_0x3a9c0b=_0x347ca4[_0x2c8f('0x10')]||0x1388;}})[_0x2c8f('0x11')](function(){return dbH[_0x2c8f('0x12')][_0x2c8f('0x13')](util[_0x2c8f('0xc')](_0x2c8f('0x14'),QUERY),{'type':dbH[_0x2c8f('0x12')][_0x2c8f('0x15')][_0x2c8f('0x16')]});})[_0x2c8f('0x11')](function(_0x14b3a3){if(!_0x14b3a3[0x0][_0x2c8f('0x17')]){return analyticExtractedReport('Empty');}var _0x5c6252=[];var _0x41bb0a=0x0;var _0x47080a=!![];if(_0x347ca4[_0x2c8f('0x18')]){if(_0x14b3a3&&_0x14b3a3[_0x2c8f('0x19')]){var _0x11cd9d=_0x14b3a3[0x0]['num']%(_0x41bb0a+_0x3a9c0b);for(;_0x47080a;_0x41bb0a+=_0x3a9c0b,_0x11cd9d=_0x14b3a3[0x0]['num']%(_0x41bb0a+_0x3a9c0b)){if(_0x11cd9d==0x0||_0x11cd9d==_0x14b3a3[0x0]['num']){_0x47080a=![];}_0x5c6252[_0x2c8f('0x1a')](dbH['sequelize']['query'](util['format'](_0x2c8f('0x1b'),QUERY,_0x3a9c0b,_0x41bb0a),{'type':dbH[_0x2c8f('0x12')][_0x2c8f('0x15')]['SELECT']}));}}}else{_0x5c6252[_0x2c8f('0x1a')](dbH['sequelize'][_0x2c8f('0x13')](QUERY,{'type':dbH[_0x2c8f('0x12')][_0x2c8f('0x15')][_0x2c8f('0x16')]}));}var _0x1b5f77=path[_0x2c8f('0x1c')](PATH);var _0x5732a2=path['basename'](PATH,_0x2c8f('0x1d'));var _0x3e1b59=_0x347ca4['split']&&_0x5c6252[_0x2c8f('0x19')]>0x1;var _0x2b83e1=[];if(!fs[_0x2c8f('0x1e')](path['join'](_0x1b5f77,_0x5732a2))&&_0x3e1b59){fs[_0x2c8f('0x1f')](path['join'](_0x1b5f77,_0x5732a2));}return BPromise[_0x2c8f('0x20')](_0x5c6252,function(_0x106737){_0x2b83e1[_0x2c8f('0x1a')](_0x106737);})['then'](function(){for(var _0x491766=0x0;_0x491766<_0x2b83e1[_0x2c8f('0x19')];_0x491766+=0x1){var _0x4d7526;var _0x40af6e=_0x2b83e1[_0x491766];if(_0x3e1b59){_0x4d7526=path['join'](_0x1b5f77,_0x5732a2,util['format'](_0x2c8f('0x21'),_0x5732a2,_0x491766,_0x2c8f('0x22')));}else{_0x4d7526=path[_0x2c8f('0x23')](_0x1b5f77,util[_0x2c8f('0xc')]('%s.%s',_0x5732a2,_0x2c8f('0x22')));}fs[_0x2c8f('0x24')](_0x4d7526,json2xls(_0x40af6e),'binary');}})[_0x2c8f('0x11')](function(){if(_0x3e1b59){zipdir(path[_0x2c8f('0x23')](_0x1b5f77,_0x5732a2),{'saveTo':path[_0x2c8f('0x23')](_0x1b5f77,util['format'](_0x2c8f('0x25'),_0x5732a2,'zip'))},function(_0x297ea4,_0x3de2ab){});rimraf(path[_0x2c8f('0x23')](_0x1b5f77,_0x5732a2),function(){});}})[_0x2c8f('0x11')](function(){logger[_0x2c8f('0xb')](util[_0x2c8f('0xc')](_0x2c8f('0x26'),EXTRACTED_REPORT_ID,_0x2c8f('0x27')));return analyticExtractedReport(_0x2c8f('0x28'),_0x3e1b59?util[_0x2c8f('0xc')](_0x2c8f('0x25'),_0x5732a2,_0x3e1b59?_0x2c8f('0x29'):_0x2c8f('0x22')):null);});})[_0x2c8f('0x2a')](function(_0x579b05){logger['info'](util[_0x2c8f('0xc')](_0x2c8f('0x2b'),EXTRACTED_REPORT_ID,'XLSX'),util[_0x2c8f('0x2c')](_0x579b05,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x2c8f('0x2d'));});}main(); \ No newline at end of file +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 diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index bb14a91..421ca30 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 _0xba8e=['Set','cutdigits','context','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','interval','*,*,*,*','IntervalId','intervals','tag','callerID','answer','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','bulkCreate','error','lodash','util','models','Interval','findAll','then','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','extension','extensions','push','type','format','priority','VoiceExtensionId','outbound'];(function(_0x1dc832,_0x1789d9){var _0x4021a5=function(_0x11abee){while(--_0x11abee){_0x1dc832['push'](_0x1dc832['shift']());}};_0x4021a5(++_0x1789d9);}(_0xba8e,0xe4));var _0xeba8=function(_0xdb357c,_0x3786b6){_0xdb357c=_0xdb357c-0x0;var _0x5c8735=_0xba8e[_0xdb357c];return _0x5c8735;};'use strict';var _=require(_0xeba8('0x0'));var util=require(_0xeba8('0x1'));function rewrite(_0x478d00,_0x58fd7d){var _0x2d8d29=this;return _0x478d00[_0xeba8('0x2')][_0xeba8('0x3')][_0xeba8('0x4')]({'raw':!![]})[_0xeba8('0x5')](function(_0x5d3829){_0x2d8d29['intervals']=_0x5d3829;return _0x478d00[_0xeba8('0x2')][_0xeba8('0x6')][_0xeba8('0x4')]({'where':{'IntervalId':_0x58fd7d['IntervalId']},'raw':!![]});})['then'](function(_0x14742a){return _0x478d00[_0xeba8('0x2')][_0xeba8('0x6')][_0xeba8('0x4')]({'where':{'exten':{'$in':_[_0xeba8('0x7')](_[_0xeba8('0x8')](_0x14742a,_0xeba8('0x9')))}},'order':[{'raw':_0xeba8('0xa')}],'raw':!![]});})[_0xeba8('0x5')](function(_0x395767){var _0x1dd5f1=_['filter'](_0x395767,{'priority':'1'});var _0x535658=_[_0xeba8('0xb')](_0x395767,{'isApp':0x1});var _0x311284=_[_0xeba8('0xc')](_0x535658,_0xeba8('0x9'));var _0x51df25=[_0xeba8('0xd'),_0xeba8('0xe')];var _0x5ed824=[];var _0x5bd100=[];for(var _0x29c989 in _0x311284){if(_0x311284[_0xeba8('0xf')](_0x29c989)){_0x2d8d29['priority']=0x2;_0x2d8d29['extensions']=[];_0x2d8d29[_0xeba8('0x10')]=_['find'](_0x1dd5f1,{'exten':_0x311284[_0x29c989][0x0][_0xeba8('0x9')]});_0x2d8d29[_0xeba8('0x11')][_0xeba8('0x12')]({'type':_0x311284[_0x29c989][0x0][_0xeba8('0x13')],'app':'Set','appdata':util[_0xeba8('0x14')]('CDR(type)=%s',_0x311284[_0x29c989][0x0]['type']),'context':_0x311284[_0x29c989][0x0]['context'],'exten':_0x311284[_0x29c989][0x0][_0xeba8('0x9')],'priority':_0x2d8d29[_0xeba8('0x15')]++,'VoiceExtensionId':_0x311284[_0x29c989][0x0][_0xeba8('0x16')]});if(_0x311284[_0x29c989][0x0][_0xeba8('0x13')]===_0xeba8('0x17')){if(_0x2d8d29[_0xeba8('0x10')]){_0x2d8d29[_0xeba8('0x11')][_0xeba8('0x12')]({'type':_0x311284[_0x29c989][0x0]['type'],'app':_0xeba8('0x18'),'appdata':'CDR(destination)='+(_0x2d8d29[_0xeba8('0x10')]['cutdigits']?'${EXTEN:'+_0x2d8d29[_0xeba8('0x10')][_0xeba8('0x19')]+'}':'${EXTEN}'),'context':_0x311284[_0x29c989][0x0][_0xeba8('0x1a')],'exten':_0x311284[_0x29c989][0x0][_0xeba8('0x9')],'priority':_0x2d8d29[_0xeba8('0x15')]++,'VoiceExtensionId':_0x311284[_0x29c989][0x0][_0xeba8('0x16')]});}_0x2d8d29[_0xeba8('0x11')][_0xeba8('0x12')]({'type':_0x311284[_0x29c989][0x0]['type'],'app':_0xeba8('0x18'),'appdata':'CDR(routeid)='+_0x311284[_0x29c989][0x0]['VoiceExtensionId'],'context':_0x311284[_0x29c989][0x0][_0xeba8('0x1a')],'exten':_0x311284[_0x29c989][0x0]['exten'],'priority':_0x2d8d29[_0xeba8('0x15')]++,'VoiceExtensionId':_0x311284[_0x29c989][0x0]['VoiceExtensionId']});var _0x3d5b2d=_0x2d8d29[_0xeba8('0x15')]++;_0x2d8d29['extensions'][_0xeba8('0x12')]({'type':_0x311284[_0x29c989][0x0][_0xeba8('0x13')],'app':_0xeba8('0x1b'),'appdata':_0xeba8('0x1c')+(_0x3d5b2d+0x2)+'):Goto('+(_0x3d5b2d+0x1)+')','context':_0x311284[_0x29c989][0x0]['context'],'exten':_0x311284[_0x29c989][0x0][_0xeba8('0x9')],'priority':_0x3d5b2d,'VoiceExtensionId':_0x311284[_0x29c989][0x0][_0xeba8('0x16')]});if(_0x2d8d29[_0xeba8('0x10')]){_0x2d8d29[_0xeba8('0x11')]['push']({'type':_0x311284[_0x29c989][0x0][_0xeba8('0x13')],'app':'Set','appdata':_0x2d8d29['extension'][_0xeba8('0x19')]?_0xeba8('0x1d')+_0x2d8d29[_0xeba8('0x10')]['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x311284[_0x29c989][0x0][_0xeba8('0x1a')],'exten':_0x311284[_0x29c989][0x0][_0xeba8('0x9')],'priority':_0x2d8d29[_0xeba8('0x15')]++,'VoiceExtensionId':_0x311284[_0x29c989][0x0][_0xeba8('0x16')]});}_0x2d8d29[_0xeba8('0x11')]['push']({'type':_0x311284[_0x29c989][0x0][_0xeba8('0x13')],'app':'Set','appdata':'outboundrouteid='+_0x311284[_0x29c989][0x0][_0xeba8('0x16')],'context':_0x311284[_0x29c989][0x0][_0xeba8('0x1a')],'exten':_0x311284[_0x29c989][0x0][_0xeba8('0x9')],'priority':_0x2d8d29[_0xeba8('0x15')]++,'VoiceExtensionId':_0x311284[_0x29c989][0x0][_0xeba8('0x16')]});if(_0x2d8d29[_0xeba8('0x10')]&&_0x2d8d29[_0xeba8('0x10')][_0xeba8('0xf')]('recordingFormat')&&_0x2d8d29[_0xeba8('0x10')][_0xeba8('0x1e')]!==_0xeba8('0x1f')){_0x2d8d29[_0xeba8('0x11')][_0xeba8('0x12')]({'type':_0x311284[_0x29c989][0x0][_0xeba8('0x13')],'app':_0xeba8('0x18'),'appdata':_0xeba8('0x20'),'context':_0x311284[_0x29c989][0x0][_0xeba8('0x1a')],'exten':_0x311284[_0x29c989][0x0]['exten'],'priority':_0x2d8d29[_0xeba8('0x15')]++,'VoiceExtensionId':_0x311284[_0x29c989][0x0]['VoiceExtensionId']});_0x2d8d29[_0xeba8('0x11')][_0xeba8('0x12')]({'type':_0x311284[_0x29c989][0x0][_0xeba8('0x13')],'app':'Set','appdata':_0xeba8('0x21')+_0x2d8d29[_0xeba8('0x10')][_0xeba8('0x1e')]||_0xeba8('0x22'),'context':_0x311284[_0x29c989][0x0]['context'],'exten':_0x311284[_0x29c989][0x0][_0xeba8('0x9')],'priority':_0x2d8d29[_0xeba8('0x15')]++,'VoiceExtensionId':_0x311284[_0x29c989][0x0][_0xeba8('0x16')]});}}_0x2d8d29['extensions']['push']({'type':_0x311284[_0x29c989][0x0][_0xeba8('0x13')],'app':_0xeba8('0x18'),'appdata':_0xeba8('0x23'),'context':_0x311284[_0x29c989][0x0][_0xeba8('0x1a')],'exten':_0x311284[_0x29c989][0x0][_0xeba8('0x9')],'priority':_0x2d8d29['priority']++,'VoiceExtensionId':_0x311284[_0x29c989][0x0][_0xeba8('0x16')]});_0x2d8d29[_0xeba8('0x11')]['push']({'type':_0x311284[_0x29c989][0x0][_0xeba8('0x13')],'app':_0xeba8('0x18'),'appdata':_0xeba8('0x24'),'context':_0x311284[_0x29c989][0x0]['context'],'exten':_0x311284[_0x29c989][0x0][_0xeba8('0x9')],'priority':_0x2d8d29[_0xeba8('0x15')]++,'VoiceExtensionId':_0x311284[_0x29c989][0x0]['VoiceExtensionId']});_0x2d8d29['extensions'][_0xeba8('0x12')]({'type':_0x311284[_0x29c989][0x0][_0xeba8('0x13')],'app':_0xeba8('0x18'),'appdata':_0xeba8('0x25'),'context':_0x311284[_0x29c989][0x0][_0xeba8('0x1a')],'exten':_0x311284[_0x29c989][0x0]['exten'],'priority':_0x2d8d29[_0xeba8('0x15')]++,'VoiceExtensionId':_0x311284[_0x29c989][0x0][_0xeba8('0x16')]});for(var _0x2d6e9a=0x0,_0x386277=0x0;_0x2d6e9a<_0x311284[_0x29c989][_0xeba8('0x26')];_0x2d6e9a+=0x1,_0x386277=0x0){var _0x484c05=_0x311284[_0x29c989][_0x2d6e9a];if(_0x484c05[_0xeba8('0x13')]){_0x484c05[_0xeba8('0x13')]=_0x484c05[_0xeba8('0x13')][_0xeba8('0x27')]();}var _0x9b3237=[];var _0xf6d5e0=[];delete _0x484c05['id'];delete _0x484c05[_0xeba8('0x28')];delete _0x484c05['updatedAt'];var _0x1502c3=_0x484c05[_0xeba8('0x29')]!==_0xeba8('0x2a')?[_0x484c05[_0xeba8('0x29')]]:_0x484c05[_0xeba8('0x2b')]?_['map'](_[_0xeba8('0xb')](_0x2d8d29[_0xeba8('0x2c')],{'IntervalId':_0x484c05[_0xeba8('0x2b')]}),_0xeba8('0x29')):[];if(_0x484c05[_0xeba8('0xf')](_0xeba8('0x2d'))){if(_0x484c05['tag']&&_0x484c05['tag']!=='--'){_0x9b3237[_0xeba8('0x12')]({'type':_0x484c05[_0xeba8('0x13')],'app':'Set','appdata':'CDR(tag)='+_0x484c05[_0xeba8('0x2d')],'context':_0x484c05[_0xeba8('0x1a')],'exten':_0x484c05['exten'],'priority':_0x1502c3[_0xeba8('0x26')]+_0x2d8d29[_0xeba8('0x15')]+_0x386277++,'VoiceExtensionId':_0x484c05['VoiceExtensionId']});}}if(_0x484c05[_0xeba8('0x13')]===_0xeba8('0x17')&&_0x484c05['hasOwnProperty'](_0xeba8('0x2e'))){if(_0x484c05[_0xeba8('0x2e')]){_0x9b3237[_0xeba8('0x12')]({'type':_0x484c05['type'],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x484c05['callerID']+')','context':_0x484c05[_0xeba8('0x1a')],'exten':_0x484c05[_0xeba8('0x9')],'priority':_0x1502c3[_0xeba8('0x26')]+_0x2d8d29[_0xeba8('0x15')]+_0x386277++,'VoiceExtensionId':_0x484c05[_0xeba8('0x16')]});}else{_0x9b3237[_0xeba8('0x12')]({'type':_0x484c05[_0xeba8('0x13')],'app':_0xeba8('0x1b'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x484c05['context'],'exten':_0x484c05[_0xeba8('0x9')],'priority':_0x1502c3[_0xeba8('0x26')]+_0x2d8d29['priority']+_0x386277++,'VoiceExtensionId':_0x484c05[_0xeba8('0x16')]});}}if(_0x484c05[_0xeba8('0xf')](_0xeba8('0x2f'))){if(_0x51df25['indexOf'](_0x484c05[_0xeba8('0x30')][_0xeba8('0x27')]())>=0x0&&_0x484c05[_0xeba8('0x31')]!==_0xeba8('0x32')){if(_0x484c05[_0xeba8('0x2f')]){_0x9b3237['push']({'type':_0x484c05[_0xeba8('0x13')],'app':_0xeba8('0x1b'),'appdata':_0xeba8('0x33'),'context':_0x484c05['context'],'exten':_0x484c05['exten'],'priority':_0x1502c3[_0xeba8('0x26')]+_0x2d8d29[_0xeba8('0x15')]+_0x386277++,'VoiceExtensionId':_0x484c05['VoiceExtensionId']});_0x9b3237[_0xeba8('0x12')]({'type':_0x484c05['type'],'app':_0xeba8('0x18'),'appdata':_0xeba8('0x34'),'context':_0x484c05['context'],'exten':_0x484c05[_0xeba8('0x9')],'priority':_0x1502c3[_0xeba8('0x26')]+_0x2d8d29[_0xeba8('0x15')]+_0x386277++,'VoiceExtensionId':_0x484c05[_0xeba8('0x16')]});}else{_0x9b3237[_0xeba8('0x12')]({'type':_0x484c05[_0xeba8('0x13')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x484c05[_0xeba8('0x1a')],'exten':_0x484c05['exten'],'priority':_0x1502c3[_0xeba8('0x26')]+_0x2d8d29[_0xeba8('0x15')]+_0x386277++,'VoiceExtensionId':_0x484c05[_0xeba8('0x16')]});_0x9b3237['push']({'type':_0x484c05[_0xeba8('0x13')],'app':_0xeba8('0x18'),'appdata':_0xeba8('0x35'),'context':_0x484c05[_0xeba8('0x1a')],'exten':_0x484c05[_0xeba8('0x9')],'priority':_0x1502c3[_0xeba8('0x26')]+_0x2d8d29[_0xeba8('0x15')]+_0x386277++,'VoiceExtensionId':_0x484c05[_0xeba8('0x16')]});}}}for(var _0x53048d=0x0;_0x53048d<_0x1502c3[_0xeba8('0x26')];_0x53048d+=0x1){var _0x3daddc=_0x2d8d29[_0xeba8('0x15')]+_0x1502c3[_0xeba8('0x26')];var _0x439544=_0x53048d===_0x1502c3[_0xeba8('0x26')]-0x1?_0x2d8d29[_0xeba8('0x15')]+_0x9b3237[_0xeba8('0x26')]+_0xf6d5e0[_0xeba8('0x26')]+0x2:_0x2d8d29[_0xeba8('0x15')]+_0x53048d+0x1;_0x9b3237[_0xeba8('0x36')](_0x53048d,0x0,{'type':_0x484c05[_0xeba8('0x13')],'app':_0xeba8('0x37'),'appdata':_0x1502c3[_0x53048d]+'?'+_0x484c05[_0xeba8('0x1a')]+_0xeba8('0x38')+_0x3daddc+':'+_0x484c05[_0xeba8('0x1a')]+',${EXTEN},'+_0x439544,'exten':_0x484c05[_0xeba8('0x9')],'context':_0x484c05[_0xeba8('0x1a')],'priority':_0x2d8d29['priority']+_0x53048d,'VoiceExtensionId':_0x311284[_0x29c989][0x0][_0xeba8('0x16')]});}_0x484c05['priority']=_0x9b3237[_0xeba8('0x26')]?_[_0xeba8('0x39')](_0x9b3237)[_0xeba8('0x15')]+0x1:_0x2d8d29[_0xeba8('0x15')];_0x2d8d29['priority']=(_0xf6d5e0[_0xeba8('0x26')]?_[_0xeba8('0x39')](_0xf6d5e0)['priority']:_0x484c05[_0xeba8('0x15')])+0x1;_0x2d8d29[_0xeba8('0x11')]=_[_0xeba8('0x3a')](_0x2d8d29[_0xeba8('0x11')],_0x9b3237,[_0x484c05],_0xf6d5e0);}_0x2d8d29[_0xeba8('0x11')][_0xeba8('0x12')]({'type':_0x311284[_0x29c989][0x0][_0xeba8('0x13')],'app':_0xeba8('0x3b'),'exten':_0x311284[_0x29c989][0x0][_0xeba8('0x9')],'context':_0x311284[_0x29c989][0x0][_0xeba8('0x1a')],'priority':_0x2d8d29['priority'],'VoiceExtensionId':_0x311284[_0x29c989][0x0]['VoiceExtensionId']});_0x5ed824[_0xeba8('0x12')](_0x311284[_0x29c989][0x0][_0xeba8('0x16')]);_0x5bd100=_['concat'](_0x5bd100,_0x2d8d29[_0xeba8('0x11')]);}}return _0x478d00[_0xeba8('0x3c')](function(_0x7f00f7){return _0x478d00[_0xeba8('0x2')][_0xeba8('0x6')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x5ed824}},'transaction':_0x7f00f7})['then'](function(_0x104a15){return _0x478d00['models'][_0xeba8('0x6')][_0xeba8('0x3d')](_['sortBy'](_0x5bd100,_0xeba8('0x15')),{'transaction':_0x7f00f7});});});})['catch'](function(_0x15fc04){console[_0xeba8('0x3e')](_0x15fc04);});}exports['rewrite']=rewrite; \ No newline at end of file +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 diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 355315b..f9b4e4e 100644 --- a/server/components/import/cm/csv.js +++ b/server/components/import/cm/csv.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['CmContact','create','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','updatedAt','select','field','NOW()','toString','createdAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','str','calleridnum','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','VoiceQueueId','onlyIfOpen','query','catch','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','contact:csv_','emit','unlinkSync','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate'];(function(_0x52a15e,_0x19cec0){var _0x2b2fb6=function(_0x8e0f07){while(--_0x8e0f07){_0x52a15e['push'](_0x52a15e['shift']());}};_0x2b2fb6(++_0x19cec0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0a9e('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var socket=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));require('../../../api/cmContact/cmContact.socket')['register'](socket);try{if(!process[_0x0a9e('0xb')][0x2]||process['argv'][0x2]==='undefined'||process[_0x0a9e('0xb')][0x2]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xd'));}var FILEPATH=process[_0x0a9e('0xb')][0x2];if(!process[_0x0a9e('0xb')][0x3]||process[_0x0a9e('0xb')][0x3]==='undefined'||process['argv'][0x3]==='null'||!process['argv'][0x4]||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xf'));}var FIELDS=_[_0x0a9e('0x10')](process['argv'][0x3][_0x0a9e('0x11')](','),process[_0x0a9e('0xb')][0x4][_0x0a9e('0x11')](','));if(!process[_0x0a9e('0xb')][0x5]||process[_0x0a9e('0xb')][0x5]===_0x0a9e('0xe')||process['argv'][0x5]===_0x0a9e('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x0a9e('0xb')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x0a9e('0xb')][0x6]!==_0x0a9e('0xe')&&process['argv'][0x6]!==_0x0a9e('0xc')?process['argv'][0x6]:null;var DUPLICATES=process[_0x0a9e('0xb')][0x7]&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xe')&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xc')?process[_0x0a9e('0xb')][0x7]:null;if(!process[_0x0a9e('0xb')][0x8]||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0x12'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x2c3407){logger[_0x0a9e('0x13')](_0x2c3407);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x53682f,_0x20f109,_0x5a09ef,_0x588269){var _0x3a02e1={'message':_0x20f109};_0x3a02e1[_0x53682f]=!![];if(_0x5a09ef){_0x3a02e1[_0x0a9e('0x14')]=_0x5a09ef;}if(_0x588269){_0x3a02e1[_0x0a9e('0x15')]=_0x588269;}return _0x3a02e1;}function isEmail(_0x30bae6){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x30bae6);}function checkRow(_0xfb6e48,_0x2fb0e4,_0x3b45bc){return new BPromise(function(_0x4d00e6,_0x370d86){if(_[_0x0a9e('0x16')](_0xfb6e48)){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3b45bc));}if(_0xfb6e48['errors']&&_0xfb6e48[_0x0a9e('0x17')][_0x0a9e('0x18')]){var _0x40c424=_[_0x0a9e('0x19')](_0xfb6e48['errors'],_0x0a9e('0x1a'))['join'](';');return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x40c424,null,_0x3b45bc));}var _0x5bfb33={};for(var _0x1dc186 in FIELDS){if(FIELDS[_0x0a9e('0x1b')](_0x1dc186)&&FIELDS[_0x1dc186]){_0x5bfb33[_0x1dc186]=_0xfb6e48[_0x0a9e('0x1c')][0x0][FIELDS[_0x1dc186]]||_0xfb6e48[_0x0a9e('0x1c')][0x0]['\ufeff'+FIELDS[_0x1dc186]];}}if(!_0x5bfb33[_0x0a9e('0x1d')]){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x1e'),null,_0x3b45bc));}if(!_0x5bfb33[_0x0a9e('0x1f')]){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x20'),null,_0x3b45bc));}if(_0x5bfb33[_0x0a9e('0x21')]){var _0x2b1f27=moment(_0x5bfb33[_0x0a9e('0x21')],'YYYY-MM-DD');if(!_0x2b1f27[_0x0a9e('0x22')]()){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x23'),null,_0x3b45bc));}}if(_0x5bfb33[_0x0a9e('0x24')]){if(!isEmail(_0x5bfb33[_0x0a9e('0x24')])){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x25'),null,_0x3b45bc));}}_0x5bfb33[_0x0a9e('0x26')]=LISTID;_0x5bfb33[_0x0a9e('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x2fb0e4){var _0x426950={};for(var _0x5d1e0e=0x0,_0x2407f9=DUPLICATES[_0x0a9e('0x18')];_0x5d1e0e<_0x2407f9;_0x5d1e0e+=0x1){_0x426950[DUPLICATES[_0x5d1e0e]]=_0x5bfb33[DUPLICATES[_0x5d1e0e]];}var _0x1122db=_[_0x0a9e('0x28')](_0x2fb0e4,_0x426950);if(_0x1122db){return _0x370d86(handleCheckRowError(_0x0a9e('0x29'),'Duplicate\x20Contact',_0x1122db,_0x3b45bc));}}return db[_0x0a9e('0x2a')][_0x0a9e('0x2b')](_0x5bfb33,{'raw':!![],'hooks':![],'fields':_[_0x0a9e('0x2c')](_0x5bfb33)})[_0x0a9e('0x2d')](function(_0x2b45ea){if(DUPLICATES&&DUPLICATES[_0x0a9e('0x18')]&&_0x2fb0e4){_0x2fb0e4[_0x0a9e('0x2e')](_[_0x0a9e('0x2f')](_0x5bfb33,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2b45ea['id'];return _0x4d00e6();})['catch'](function(_0x44295a){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x30')+(_0x44295a[_0x0a9e('0x1a')]||JSON[_0x0a9e('0x31')](_0x44295a)),null,_0x3b45bc));});});}function checkHopper(){function _0x3f3d41(){return function(_0x567193){logger[_0x0a9e('0x13')](_0x0a9e('0x32'),_0x0a9e('0x33'),util[_0x0a9e('0x34')](_0x567193,{'showHidden':![],'depth':null}));};}var _0x4853b1=function(_0x54135e,_0x1e8694){var _0x5640eb=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')](['phone',_0x0a9e('0x39'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x1e8694,'createdAt',_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')]('phone','phone')[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),'ListId')['field'](_0x54135e['id'][_0x0a9e('0x3f')](),_0x1e8694)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')](_0x0a9e('0x46'))[_0x0a9e('0x43')](_0x0a9e('0x47'),squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')['where'](_0x1e8694+_0x0a9e('0x48'),_0x54135e['id'][_0x0a9e('0x3f')]())))[_0x0a9e('0x3f')]();return _0x5640eb;};var _0x315881=function(_0x1a69dd,_0xc9a702){var _0x10b040=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),'scheduledAt',_0x0a9e('0x3a'),_0x0a9e('0x26'),_0xc9a702,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x1a69dd['id'][_0x0a9e('0x3f')](),_0xc9a702)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x3b'))[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')]('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x4a'))[_0x0a9e('0x41')](_0x0a9e('0x4b'))[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id'][_0x0a9e('0x3f')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id']['toString']())))['toString']();return _0x10b040;};function _0x2ef381(_0x59c6ff,_0x443e72){var _0x4c3845=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))['fromQuery']([_0x0a9e('0x1f'),_0x0a9e('0x39'),'ContactId','ListId',_0x443e72,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')]('phone',_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')['field']('id','ContactId')[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x59c6ff['id'][_0x0a9e('0x3f')](),_0x443e72)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID['toString']())[_0x0a9e('0x43')](_0x0a9e('0x4c'),squel['str'](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL'))[_0x0a9e('0x3f')]();return _0x4c3845;}function _0x5ba1f9(_0x4b3c1a,_0x5674ee){var _0x273cb5=squel['insert']()[_0x0a9e('0x36')](_0x0a9e('0x4d'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x5674ee,'createdAt',_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field']('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),_0x0a9e('0x26'))['field'](_0x4b3c1a['id'][_0x0a9e('0x3f')](),_0x5674ee)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x3b'))[_0x0a9e('0x41')]('cm_contacts')[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')]('ListId\x20=\x20?',LISTID[_0x0a9e('0x3f')]())['where']('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')](_0x0a9e('0x46')))[_0x0a9e('0x3f')]();return _0x273cb5;}return db[_0x0a9e('0x4e')][_0x0a9e('0x4f')]({'where':{'type':_0x0a9e('0x50')},'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x53'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x19012b){var _0x2bbb86=[];if(_0x19012b){var _0x2b8192;for(var _0x320898=0x0,_0x412a72;_0x320898<_0x19012b[_0x0a9e('0x18')];_0x320898+=0x1){_0x412a72=_0x19012b[_0x320898][_0x0a9e('0x54')]({'plain':!![]});switch(_0x412a72['dialCheckDuplicateType']){case _0x0a9e('0x55'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x315881(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x4853b1(_0x412a72,_0x0a9e('0x57')))['then'](function(){})['catch'](_0x3f3d41()));break;default:_0x2bbb86['push'](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x2ef381(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}}return _0x2bbb86;})[_0x0a9e('0x5b')]()[_0x0a9e('0x2d')](function(){return db[_0x0a9e('0x4e')]['findAll']({'where':{'type':_0x0a9e('0x50')},'attributes':['id'],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x2bdc44){var _0x583b2e=[];if(_0x2bdc44){var _0x4437ff;for(var _0x44351d=0x0,_0x4c46c1;_0x44351d<_0x2bdc44[_0x0a9e('0x18')];_0x44351d+=0x1){_0x4c46c1=_0x2bdc44[_0x44351d][_0x0a9e('0x54')]({'plain':!![]});_0x583b2e[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x5ba1f9(_0x4c46c1,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x583b2e;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':'Lists','where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x3511c9){var _0x30a4c7=[];if(_0x3511c9){for(var _0xf410e5=0x0,_0x332367;_0xf410e5<_0x3511c9[_0x0a9e('0x18')];_0xf410e5+=0x1){_0x332367=_0x3511c9[_0xf410e5][_0x0a9e('0x54')]({'plain':!![]});switch(_0x332367[_0x0a9e('0x51')]){case _0x0a9e('0x55'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x315881(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x4853b1(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));break;default:_0x30a4c7[_0x0a9e('0x2e')](db['sequelize']['query'](_0x2ef381(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));}}}return _0x30a4c7;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x2d2286){var _0x42b959=[];if(_0x2d2286){for(var _0x3755fe=0x0,_0x1f42a0;_0x3755fe<_0x2d2286[_0x0a9e('0x18')];_0x3755fe+=0x1){_0x1f42a0=_0x2d2286[_0x3755fe]['get']({'plain':!![]});_0x42b959[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x5ba1f9(_0x1f42a0,_0x0a9e('0x5e')))['then'](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x42b959;})[_0x0a9e('0x5b')]();})['catch'](function(_0x1d6834){logger['error'](_0x0a9e('0x5f'),_0x0a9e('0x60'),_0x1d6834[_0x0a9e('0x1a')]);});}var processPromises=function(_0x385d52){return BPromise['all'](promises)['then'](function(_0x353384){})[_0x0a9e('0x5a')](function(_0x94dcf5){logger['error'](_0x0a9e('0x61'),JSON[_0x0a9e('0x31')](_0x94dcf5));})['finally'](function(){socket['emit'](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x385d52){return _0x385d52['resume']();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0a9e('0x2d')](function(){socket[_0x0a9e('0x63')](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0a9e('0x64')](FILEPATH);}catch(_0x3c6dd6){logger[_0x0a9e('0x13')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x0a9e('0x31')](_0x3c6dd6));}finally{process['exit'](0x0);}});};process['on'](_0x0a9e('0x65'),function(){logger[_0x0a9e('0x66')](_0x0a9e('0x67'));endCsv();});function main(){return BPromise[_0x0a9e('0x68')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0a9e('0x11')](',');return db[_0x0a9e('0x2a')][_0x0a9e('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0xb6e411){var _0x21e592=fs[_0x0a9e('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0a9e('0x6a')](_0x21e592,{'header':!![],'skipEmptyLines':!![],'step':function(_0x255e49,_0x1910bf){total+=0x1;var _0x32b9bd=total;promises[_0x0a9e('0x2e')](checkRow(_0x255e49,_0xb6e411,_0x32b9bd)['then'](function(){success+=0x1;})[_0x0a9e('0x5a')](function(_0x3325c5){if(_0x3325c5['error']){errors+=0x1;delete _0x3325c5[_0x0a9e('0x13')];}else if(_0x3325c5[_0x0a9e('0x29')]){duplicates+=0x1;delete _0x3325c5[_0x0a9e('0x29')];}rows['push'](_0x3325c5);}));if(total%0xc8===0x0){_0x1910bf[_0x0a9e('0x6b')]();return processPromises(_0x1910bf);}},'complete':function(){return processPromises()['then'](function(){logger[_0x0a9e('0x66')](_0x0a9e('0x6c'));endCsv();});},'error':function(_0x558a87,_0x1f29bd){logger[_0x0a9e('0x66')](_0x0a9e('0x6d'),JSON[_0x0a9e('0x31')](_0x558a87));endCsv();}});})[_0x0a9e('0x5a')](function(_0x501050){logger[_0x0a9e('0x13')](_0x0a9e('0x6e'),JSON[_0x0a9e('0x31')](_0x501050));});}main(); \ No newline at end of file +var _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 diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 7e3b739..f05ddbe 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 _0xdf19=['createdAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','min_id','info','message','exit','errors','code','sequelize','query','spread','push','catch','error','main','stringify','send','binding','socket_timestamp','server/files/tmp','.csv','parse','data','length','rows','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','UserId','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','SystemRow','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','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','isNil','DROP\x20TABLE\x20','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','voice_queues','campaigns_has_cm_lists','campaigns','CampaignId','each','then','finish','affectedRows','emit','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','util','bluebird','squel','ioredis','../../../mysqldb','../../../config/logger','redis','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','select','field','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','phone','scheduledat','ContactId','ListId','updatedAt','priority','recallme','fields','from','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.phone','cm_contacts','ListId\x20=\x20?','\x20=\x20?','keys','CompanyId'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xdf19,0xcc));var _0x9df1=function(_0x58e8eb,_0x2ac0c7){_0x58e8eb=_0x58e8eb-0x0;var _0x168540=_0xdf19[_0x58e8eb];return _0x168540;};'use strict';var fs=require('fs');var path=require(_0x9df1('0x0'));var _=require(_0x9df1('0x1'));var Papa=require(_0x9df1('0x2'));var util=require(_0x9df1('0x3'));var BPromise=require(_0x9df1('0x4'));var moment=require('moment');var squel=require(_0x9df1('0x5'));var Redis=require(_0x9df1('0x6'));var db=require(_0x9df1('0x7'))['db'];var config=require('../../../config/environment');var logger=require(_0x9df1('0x8'))('import');config[_0x9df1('0x9')]=_['defaults'](config[_0x9df1('0x9')],{'host':_0x9df1('0xa'),'port':0x18eb});var socket=require(_0x9df1('0xb'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()['format'](_0x9df1('0xc'));function isEmail(_0x436ce0){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'](_0x436ce0);}function selectNotIn(_0xea05b7,_0x49cb87,_0x8743cd,_0x438641,_0x4ebd16){return squel[_0x9df1('0xd')]()[_0x9df1('0xe')]('phone')['from'](_0x438641)[_0x9df1('0xf')](_0x49cb87,null,_0x49cb87+_0x9df1('0x10')+_0x438641+'.'+_0x8743cd)[_0x9df1('0x11')](_0x438641+'.'+_0x8743cd+_0x9df1('0x12')+_0xea05b7+'.'+_0x8743cd)[_0x9df1('0x11')](_0x49cb87+_0x9df1('0x13')+_0x4ebd16[_0x9df1('0xf')]()+')');}function insertCmHopper(_0xc57f5d,_0x1a077b,_0x4c1fa7,_0x50d94d,_0x2f1b44){var _0x5542d5=['cm_contacts.phone','cm_contacts.scheduledat',_0x9df1('0x14'),_0x9df1('0x15'),_0x1a077b+'.'+_0x50d94d,_0x9df1('0x16'),_0x9df1('0x17'),_0x9df1('0x18'),_0x9df1('0x19'),'\x22'+_0x2f1b44+'\x22'];return squel[_0x9df1('0x1a')]()[_0x9df1('0x1b')](_0x9df1('0x1c'))[_0x9df1('0x1d')]([_0x9df1('0x1e'),_0x9df1('0x1f'),_0x9df1('0x20'),_0x9df1('0x21'),_0x50d94d,'createdAt',_0x9df1('0x22'),_0x9df1('0x23'),'UserId',_0x9df1('0x24')],squel[_0x9df1('0xd')]()[_0x9df1('0x25')](_0x5542d5)[_0x9df1('0x26')](_0x1a077b)[_0x9df1('0xf')]('cm_contacts',null,_0x9df1('0x27')+_0x1a077b+'.CmListId')[_0x9df1('0xf')](_0x4c1fa7,null,_0x4c1fa7+_0x9df1('0x10')+_0x1a077b+'.'+_0x50d94d)['where'](_0x1a077b+_0x9df1('0x28'),_0xc57f5d)[_0x9df1('0x11')](_0x9df1('0x29'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1a077b,_0x4c1fa7,_0x50d94d,_0x9df1('0x1c'),[_0x9df1('0x2a'),_0x9df1('0x2b')]))[_0x9df1('0x11')](_0x9df1('0x2c'),selectNotIn(_0x1a077b,_0x4c1fa7,_0x50d94d,_0x9df1('0x1c'),[_0x9df1('0x2a')])))[_0x9df1('0x2d')]();}function insertCmHopperBlack(_0x39cfee,_0x2b86c6,_0x4a8553,_0x349fb6){var _0x2bfa12=[_0x9df1('0x2e'),_0x9df1('0x14'),'cm_contacts.ListId',_0x2b86c6+'.'+_0x349fb6,_0x9df1('0x16'),'cm_contacts.updatedAt'];return squel[_0x9df1('0x1a')]()[_0x9df1('0x1b')]('cm_hopper_black')[_0x9df1('0x1d')]([_0x9df1('0x1e'),_0x9df1('0x20'),_0x9df1('0x21'),_0x349fb6,'createdAt','updatedAt'],squel[_0x9df1('0xd')]()[_0x9df1('0x25')](_0x2bfa12)[_0x9df1('0x26')](_0x2b86c6)[_0x9df1('0xf')](_0x9df1('0x2f'),null,_0x9df1('0x27')+_0x2b86c6+'.CmListId')[_0x9df1('0xf')](_0x4a8553,null,_0x4a8553+_0x9df1('0x10')+_0x2b86c6+'.'+_0x349fb6)[_0x9df1('0x11')](_0x2b86c6+_0x9df1('0x28'),_0x39cfee)['where'](_0x9df1('0x29'),NOW)[_0x9df1('0x11')](_0x9df1('0x2c'),squel[_0x9df1('0xd')]()['field'](_0x9df1('0x1e'))[_0x9df1('0x26')]('cm_hopper_black')[_0x9df1('0x11')](_0x9df1('0x30'),_0x39cfee)[_0x9df1('0x11')](_0x349fb6+_0x9df1('0x31'),_0x2b86c6+'.'+_0x349fb6)))['toString']();}function insertCmContact(_0x8c45a3,_0xc23f62,_0x5af305,_0x32532a){var _0x43b5a1=_['concat'](_[_0x9df1('0x32')](_0x32532a),[_0x9df1('0x21'),_0x9df1('0x33'),_0x9df1('0x34'),_0x9df1('0x22')]);return squel[_0x9df1('0x1a')]()[_0x9df1('0x1b')](_0x9df1('0x2f'))[_0x9df1('0x1d')](_0x43b5a1,squel[_0x9df1('0xd')]()['fields'](_0x43b5a1)['from'](_0xc23f62)[_0x9df1('0x11')]('('+_0x5af305[_0x9df1('0xf')](',')+_0x9df1('0x35'),squel[_0x9df1('0xd')]()[_0x9df1('0x25')](_0x5af305)['from'](_0x9df1('0x2f'))[_0x9df1('0x11')](_0x9df1('0x30'),_0x8c45a3)[_0x9df1('0x11')](_0x9df1('0x36')))[_0x9df1('0x11')]('id\x20IN\x20?',squel[_0x9df1('0xd')]()[_0x9df1('0xe')]('MIN(id)',_0x9df1('0x37'))[_0x9df1('0x26')](_0xc23f62)['group'](_0x5af305[_0x9df1('0xf')](','))))[_0x9df1('0x2d')]();}function handleStop(){logger[_0x9df1('0x38')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x21b4b7){logger['error'](_0x21b4b7[_0x9df1('0x39')]);process[_0x9df1('0x3a')](0x1);}function handleError(_0x4d3960,_0x1502bb){stats[_0x9df1('0x3b')]['push']({'name':_0x1502bb[_0x9df1('0x3c')],'message':_0x1502bb[_0x9df1('0x39')],'row':_0x4d3960});}function handleQuery(_0x134c21){logger[_0x9df1('0x38')](_0x134c21);return db[_0x9df1('0x3d')][_0x9df1('0x3e')](_0x134c21)[_0x9df1('0x3f')](function(_0x58a9c4){results[_0x9df1('0x40')](_0x58a9c4);})[_0x9df1('0x41')](function(_0x3a2561){logger[_0x9df1('0x42')](_0x3a2561['message']);});}function main(_0x1e70b6,_0x846c16,_0x5984e4,_0x12a8f1){logger[_0x9df1('0x38')](_0x9df1('0x43'),_0x1e70b6,JSON[_0x9df1('0x44')](_0x846c16));process[_0x9df1('0x45')]('start');var _0x2fb5d6=_0x846c16[_0x9df1('0x46')];var _0x1436c6=_0x846c16[_0x9df1('0x47')];var _0x3d531b=path[_0x9df1('0xf')](config['root'],_0x9df1('0x48'),_0x1436c6+_0x9df1('0x49'));var _0x53209a=_['keys'](_0x2fb5d6)[_0x9df1('0xf')]();logger[_0x9df1('0x38')]('header',_0x53209a);fs['writeFileSync'](_0x3d531b,_0x53209a+'\x0a');Papa[_0x9df1('0x4a')](fs['createReadStream'](_0x1e70b6),{'header':!![],'skipEmptyLines':!![],'step':function(_0x38eae6,_0x672b60){try{for(var _0x267a27=0x0,_0x2b311f=[];_0x267a27<_0x38eae6[_0x9df1('0x4b')][_0x9df1('0x4c')];_0x267a27++){stats[_0x9df1('0x4d')]+=0x1;if(_0x38eae6[_0x9df1('0x3b')][_0x267a27]){handleError(_0x38eae6['data'][_0x267a27],_0x38eae6[_0x9df1('0x3b')][_0x267a27]);}else{var _0x3051d0=[];for(var _0x1ce8b9 in _0x2fb5d6){if(_0x2fb5d6[_0x9df1('0x4e')](_0x1ce8b9)){if(_0x38eae6[_0x9df1('0x4b')][_0x267a27][_0x2fb5d6[_0x1ce8b9]]){var _0x364612=_[_0x9df1('0x4f')](_0x38eae6[_0x9df1('0x4b')][_0x267a27][_0x2fb5d6[_0x1ce8b9]][_0x9df1('0x50')](/"/g,'\x27'));switch(_0x1ce8b9){case _0x9df1('0x1f'):var _0x4db2bc=moment(_0x364612,_0x9df1('0xc'),!![]);if(_0x4db2bc['isValid']()){_0x2b311f['push']('\x22'+_0x364612+'\x22');}else{_0x3051d0[_0x9df1('0x40')](_0x9df1('0x51'));}break;case _0x9df1('0x23'):var _0xc376f4=parseInt(_0x364612);_0x364612=_['isNaN'](_0xc376f4)||_0xc376f4<0x0||_0xc376f4>0x4?_0x12a8f1?0x3:0x2:_0xc376f4;_0x2b311f[_0x9df1('0x40')]('\x22'+_0x364612+'\x22');break;case _0x9df1('0x52'):var _0xbfe81e=parseInt(_0x364612);if(_[_0x9df1('0x53')](_0xbfe81e)&&_[_0x9df1('0x54')](_0x5984e4,_0xbfe81e)){_0x2b311f[_0x9df1('0x40')]('\x22'+_0xbfe81e+'\x22');}else{_0x3051d0[_0x9df1('0x40')](_0x9df1('0x55'));}break;case _0x9df1('0x56'):if(isEmail(_0x364612)){_0x2b311f[_0x9df1('0x40')]('\x22'+_0x364612+'\x22');}else{_0x3051d0['push'](_0x9df1('0x57'));}break;case _0x9df1('0x58'):var _0x571f9c=moment(_0x364612,_0x9df1('0x59'),!![]);if(_0x571f9c['isValid']()){_0x2b311f[_0x9df1('0x40')]('\x22'+_0x364612+'\x22');}else{_0x3051d0['push'](_0x9df1('0x5a'));}break;default:_0x2b311f['push']('\x22'+_0x364612+'\x22');}}else{switch(_0x1ce8b9){case _0x9df1('0x5b'):case'phone':_0x3051d0[_0x9df1('0x40')](_0x1ce8b9+'\x20not\x20specified');break;default:_0x2b311f[_0x9df1('0x40')]('\x22\x22');}}}}if(_0x3051d0['length']){handleError(_0x38eae6[_0x9df1('0x4b')][_0x267a27],{'code':_0x9df1('0x5c'),'message':_0x3051d0[_0x9df1('0xf')]()});}else{fs['appendFileSync'](_0x3d531b,_0x2b311f[_0x9df1('0xf')]()+'\x0a');}_0x2b311f=[];}if(!(stats[_0x9df1('0x4d')]%0xc8)){socket['emit'](_0x9df1('0x5d')+_0x1436c6,stats);stats[_0x9df1('0x3b')]=[];}}if(stopped){logger[_0x9df1('0x38')](_0x9df1('0x5e'));_0x672b60[_0x9df1('0x5f')]();}}catch(_0x11aab8){handleError(_0x38eae6[_0x9df1('0x4b')][_0x267a27],{'code':_0x9df1('0x60'),'message':_0x11aab8[_0x9df1('0x39')]});logger['error'](_0x9df1('0x61'),_0x11aab8[_0x9df1('0x39')]);}},'complete':function(){try{var _0x16ee99=[];var _0x57b8f7=_0x9df1('0x2f');if(_0x846c16[_0x9df1('0x62')]&&_0x846c16[_0x9df1('0x62')][_0x9df1('0x4c')]){_0x57b8f7='cm_contacts_'+_0x1436c6;_0x16ee99['push']('CREATE\x20TABLE\x20'+_0x57b8f7+'\x20LIKE\x20cm_contacts;');}var _0x162efd=util[_0x9df1('0x63')](_0x9df1('0x64'),_0x3d531b,_0x57b8f7,_0x53209a,_0x846c16[_0x9df1('0x21')],_0x846c16[_0x9df1('0x33')]||null,NOW,NOW);if(_[_0x9df1('0x65')](_0x2fb5d6[_0x9df1('0x1f')])){_0x162efd+=',\x20scheduledAt\x20=\x20NOW()';}_0x16ee99[_0x9df1('0x40')](_0x162efd);if(_0x846c16[_0x9df1('0x62')]&&_0x846c16[_0x9df1('0x62')][_0x9df1('0x4c')]){_0x16ee99[_0x9df1('0x40')](insertCmContact(_0x846c16['ListId'],_0x57b8f7,_0x846c16[_0x9df1('0x62')],_0x2fb5d6));_0x16ee99[_0x9df1('0x40')](_0x9df1('0x66')+_0x57b8f7+';');}_0x16ee99[_0x9df1('0x40')](insertCmHopper(_0x846c16[_0x9df1('0x21')],_0x9df1('0x67'),'voice_queues',_0x9df1('0x68'),_0x12a8f1));_0x16ee99[_0x9df1('0x40')](insertCmHopperBlack(_0x846c16[_0x9df1('0x21')],_0x9df1('0x69'),_0x9df1('0x6a'),_0x9df1('0x68')));_0x16ee99[_0x9df1('0x40')](insertCmHopper(_0x846c16[_0x9df1('0x21')],_0x9df1('0x6b'),_0x9df1('0x6c'),'CampaignId',_0x12a8f1));_0x16ee99[_0x9df1('0x40')](insertCmHopperBlack(_0x846c16[_0x9df1('0x21')],'campaigns_has_cm_blacklists',_0x9df1('0x6c'),_0x9df1('0x6d')));BPromise[_0x9df1('0x6e')](_0x16ee99,handleQuery)[_0x9df1('0x6f')](function(_0x2f3ac0){stats[_0x9df1('0x70')]=!![];stats[_0x9df1('0x71')]=_0x846c16[_0x9df1('0x62')]&&_0x846c16[_0x9df1('0x62')][_0x9df1('0x4c')]?results[0x2]['affectedRows']:results[0x0]['affectedRows'];socket[_0x9df1('0x72')]('contact:import:'+_0x1436c6,stats);fs[_0x9df1('0x73')](_0x1e70b6);fs[_0x9df1('0x73')](_0x3d531b);process[_0x9df1('0x3a')](0x0);})['catch'](function(_0x53007a){logger[_0x9df1('0x42')](_0x53007a[_0x9df1('0x39')]);process[_0x9df1('0x3a')](0x1);});}catch(_0x3b60e0){logger[_0x9df1('0x42')](_0x9df1('0x74'),_0x3b60e0['message']);process[_0x9df1('0x3a')](0x1);}},'error':function(_0x34b699,_0x1da159,_0x6335b,_0x1f2930){throw new Error(_0x1f2930);}});}function validate(){if(process[_0x9df1('0x75')]&&process[_0x9df1('0x75')][_0x9df1('0x4c')]<0x4){throw new Error(_0x9df1('0x76'));}var _0x64c493=path[_0x9df1('0xf')](config['root'],_0x9df1('0x48'),process['argv'][0x2]);if(!fs[_0x9df1('0x77')](_0x64c493)){throw new Error(_0x9df1('0x78'));}var _0x2abf69={};try{_0x2abf69=JSON['parse'](process['argv'][0x3]);if(!_0x2abf69[_0x9df1('0x46')]){throw new Error(_0x9df1('0x79'));}if(!_0x2abf69[_0x9df1('0x46')][_0x9df1('0x1e')]){throw new Error(_0x9df1('0x7a'));}if(!_0x2abf69['binding'][_0x9df1('0x5b')]){throw new Error(_0x9df1('0x7b'));}var _0x5beebe=0x0;if(_0x2abf69[_0x9df1('0x46')][_0x9df1('0x52')]){_0x5beebe=0x1;}if(!_0x2abf69[_0x9df1('0x21')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x1ae469){throw new Error(_0x9df1('0x7c'));}var _0x597f41=[];try{_0x597f41=_[_0x9df1('0x7d')](JSON[_0x9df1('0x4a')](process[_0x9df1('0x75')][0x4]),'id');}catch(_0x51b5d5){logger[_0x9df1('0x38')](_0x9df1('0x7e'));}main(_0x64c493,_0x2abf69,_0x597f41,_0x5beebe);}validate();process['on']('SIGINT',handleStop);process['on'](_0x9df1('0x7f'),handleUncaughtException); \ No newline at end of file +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 diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 06b68d3..035cac2 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 _0xe820=['Agent\x20Ring','Agent\x20Connect','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Called\x20Number','destcalleridnum','Member\x20Name','Date','starttime','Complete\x20Time','duration','Billable\x20Time','billableseconds','getSubjects','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','variable','queue','push','calleridnum','string','Outbound\x20Call','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','UniqueId','uniqueid','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***'];(function(_0x5dc2ab,_0x462724){var _0x4e645c=function(_0x2c61fb){while(--_0x2c61fb){_0x5dc2ab['push'](_0x5dc2ab['shift']());}};_0x4e645c(++_0x462724);}(_0xe820,0xd2));var _0x0e82=function(_0x42f5ca,_0x40a47f){_0x42f5ca=_0x42f5ca-0x0;var _0x39ab6a=_0xe820[_0x42f5ca];return _0x39ab6a;};'use strict';exports[_0x0e82('0x0')]=function(_0x5eba64,_0x908a54){var _0x4e6b50=[{'type':'string','content':_0x0e82('0x1'),'variableName':null}];switch(_0x5eba64[_0x0e82('0x2')]()){case _0x0e82('0x3'):switch(_0x908a54['toLowerCase']()){case _0x0e82('0x4'):_0x4e6b50['push']({'type':_0x0e82('0x5'),'content':'','variableName':_0x0e82('0x6')});_0x4e6b50[_0x0e82('0x7')]({'type':_0x0e82('0x5'),'content':'','variableName':_0x0e82('0x8')});break;case'outbound':_0x4e6b50[_0x0e82('0x7')]({'type':_0x0e82('0x9'),'content':_0x0e82('0xa'),'variableName':null});_0x4e6b50[_0x0e82('0x7')]({'type':_0x0e82('0x5'),'content':'','variableName':'destcalleridnum'});break;}}return _0x4e6b50;};exports[_0x0e82('0xb')]=function(_0x38b362,_0x2dfacf){var _0x10b2e2=[];switch(_0x38b362[_0x0e82('0x2')]()){case _0x0e82('0x3'):switch(_0x2dfacf[_0x0e82('0x2')]()){case'inbound':_0x10b2e2=[{'type':_0x0e82('0x9'),'content':_0x0e82('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0x0e82('0xd'),'content':'','key':_0x0e82('0xe'),'keyType':_0x0e82('0x5'),'variableName':_0x0e82('0x8')},{'type':'keyValue','content':'','key':_0x0e82('0xf'),'keyType':'variable','variableName':'calleridname'},{'type':_0x0e82('0xd'),'content':'','key':'Call\x20To','keyType':'variable','variableName':'destexten'},{'type':_0x0e82('0xd'),'content':'','key':'Queue','keyType':'variable','variableName':_0x0e82('0x6')},{'type':'keyValue','content':'','key':_0x0e82('0x10'),'keyType':_0x0e82('0x5'),'variableName':_0x0e82('0x11')},{'type':_0x0e82('0xd'),'content':'','key':'Date','keyType':_0x0e82('0x5'),'variableName':_0x0e82('0x12')},{'type':_0x0e82('0x9'),'content':_0x0e82('0x13'),'key':null,'keyType':null,'variableName':null},{'type':_0x0e82('0xd'),'content':'','key':_0x0e82('0x14'),'keyType':_0x0e82('0x5'),'variableName':_0x0e82('0x15')},{'type':_0x0e82('0xd'),'content':'','key':_0x0e82('0x16'),'keyType':_0x0e82('0x5'),'variableName':'destcalleridnum'},{'type':'string','content':_0x0e82('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0x0e82('0xd'),'content':'','key':_0x0e82('0x18'),'keyType':_0x0e82('0x5'),'variableName':_0x0e82('0x12')},{'type':_0x0e82('0xd'),'content':'','key':_0x0e82('0x19'),'keyType':_0x0e82('0x5'),'variableName':'agentconnectAt'},{'type':_0x0e82('0xd'),'content':'','key':_0x0e82('0x1a'),'keyType':_0x0e82('0x5'),'variableName':_0x0e82('0x1b')},{'type':'keyValue','content':'','key':_0x0e82('0x1c'),'keyType':_0x0e82('0x5'),'variableName':_0x0e82('0x1d')},{'type':_0x0e82('0xd'),'content':'','key':'Talk\x20Time','keyType':_0x0e82('0x5'),'variableName':'talktime'}];break;case'outbound':_0x10b2e2=[{'type':_0x0e82('0x9'),'content':_0x0e82('0xc'),'variableName':null},{'type':'keyValue','content':'','key':_0x0e82('0x1e'),'keyType':_0x0e82('0x5'),'keyContent':'','variableName':_0x0e82('0x1f')},{'type':'keyValue','content':'','key':_0x0e82('0x20'),'keyType':_0x0e82('0x5'),'keyContent':'','variableName':'membername'},{'type':_0x0e82('0xd'),'content':'','key':'UniqueId','keyType':_0x0e82('0x5'),'keyContent':'','variableName':_0x0e82('0x11')},{'type':'keyValue','content':'','key':_0x0e82('0x21'),'keyType':_0x0e82('0x5'),'keyContent':'','variableName':_0x0e82('0x22')},{'type':'string','content':'***\x20Time\x20Info\x20***'},{'type':_0x0e82('0xd'),'content':'','key':'Answer\x20Time','keyType':_0x0e82('0x5'),'keyContent':'','variableName':'answertime'},{'type':_0x0e82('0xd'),'content':'','key':_0x0e82('0x23'),'keyType':_0x0e82('0x5'),'keyContent':'','variableName':'endtime'},{'type':_0x0e82('0xd'),'content':'','key':'Duration','keyType':_0x0e82('0x5'),'keyContent':'','variableName':_0x0e82('0x24')},{'type':_0x0e82('0xd'),'content':'','key':_0x0e82('0x25'),'keyType':_0x0e82('0x5'),'keyContent':'','variableName':_0x0e82('0x26')}];break;}}return _0x10b2e2;}; \ No newline at end of file +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 diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 4274c6c..e41922d 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 _0x487a=['../../config/logger','openchannel-interactions','fax-interactions','sms-interactions','upperFirst','InteractionId','unknown','toLowerCase','toUpperCase','name','role','stringify','null','findOne','update','then','catch','error','tracked','user','query','body','omit','html','phone','lodash','../../mysqldb'];(function(_0x10779d,_0x130ef2){var _0x2cd027=function(_0x3289b1){while(--_0x3289b1){_0x10779d['push'](_0x10779d['shift']());}};_0x2cd027(++_0x130ef2);}(_0x487a,0x193));var _0xa487=function(_0x16629d,_0x492375){_0x16629d=_0x16629d-0x0;var _0x56ccee=_0x487a[_0x16629d];return _0x56ccee;};'use strict';var _=require(_0xa487('0x0'));var db=require(_0xa487('0x1'))['db'];var loggers={'openchannel':require(_0xa487('0x2'))(_0xa487('0x3')),'mail':require(_0xa487('0x2'))('mail-interactions'),'fax':require(_0xa487('0x2'))(_0xa487('0x4')),'sms':require(_0xa487('0x2'))(_0xa487('0x5')),'chat':require(_0xa487('0x2'))('chat-interactions')};function getInteractionId(_0x4b9714,_0x3e9999,_0x3b9c1f){if(_0x4b9714&&_0x4b9714[_[_0xa487('0x6')](_0x3b9c1f)+_0xa487('0x7')]){return _0x4b9714[_[_0xa487('0x6')](_0x3b9c1f)+_0xa487('0x7')];}else if(_0x4b9714&&_0x4b9714['id']){return _0x4b9714['id'];}else if(_0x3e9999&&_0x3e9999['id']){return _0x3e9999['id'];}else{return _0xa487('0x8');}}function log(_0x54efda,_0x37b6a5,_0x206b8b,_0x24e778,_0x4c8e14,_0xadc5b5){loggers[_0x4c8e14[_0xa487('0x9')]()][_0x54efda]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xadc5b5[_0xa487('0xa')](),_0x37b6a5?_0x37b6a5['id']:null,_0x37b6a5?_0x37b6a5[_0xa487('0xb')]:null,_0x37b6a5?_0x37b6a5[_0xa487('0xc')]:null,getInteractionId(_0x206b8b,_0x24e778,_0x4c8e14),_0x206b8b?JSON[_0xa487('0xd')](_0x206b8b):_0xa487('0xe'));}function updateUser(_0x2b3352,_0x140acb,_0x885712,_0x30e595,_0x5bba0d){db[_[_0xa487('0x6')](_0x30e595)+'Interaction'][_0xa487('0xf')]({'where':{'id':getInteractionId(_0x140acb,_0x885712,_0x30e595)}})['then'](function(_0x552896){if(_0x552896){return _0x552896[_0xa487('0x10')]({'UserId':_0x2b3352?_0x2b3352['id']:null});}})[_0xa487('0x11')](function(_0x22ce7c){if(_0x22ce7c){log('info',_0x2b3352,_0x140acb,_0x885712,_0x30e595,_0x5bba0d);}})[_0xa487('0x12')](function(){log(_0xa487('0x13'),_0x2b3352,_0x140acb,_0x885712,_0x30e595,_0x5bba0d);});}exports[_0xa487('0x14')]=function(_0x521b24,_0x1a316d){return function(_0x3d6262,_0x2fea98,_0xc85b4a){var _0x337027=_0x3d6262[_0xa487('0x15')];var _0x3e0664={};var _0x5057fe=_0x3d6262[_0xa487('0x16')];if(_0x3e0664){_0x3e0664=_['clone'](_0x3d6262[_0xa487('0x17')]);_0x3e0664=_[_0xa487('0x18')](_0x3e0664,['body',_0xa487('0x19'),_0xa487('0x1a'),'fax','mobile']);}updateUser(_0x337027,_0x3e0664,_0x5057fe,_0x521b24,_0x1a316d);_0xc85b4a(null);};}; \ No newline at end of file +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 diff --git a/server/components/license/service.js b/server/components/license/service.js index d4b8529..a036c72 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 _0xee63=['status','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','aes-256-ctr','%s:%s:%s','update','base64','utf8','use','findOne','then','count'];(function(_0x2e93fc,_0x5b8261){var _0x4e81e2=function(_0x18c46){while(--_0x18c46){_0x2e93fc['push'](_0x2e93fc['shift']());}};_0x4e81e2(++_0x5b8261);}(_0xee63,0x1e7));var _0x3ee6=function(_0x38c652,_0x1ea1b7){_0x38c652=_0x38c652-0x0;var _0x218a37=_0xee63[_0x38c652];return _0x218a37;};'use strict';var crypto=require(_0x3ee6('0x0'));var util=require(_0x3ee6('0x1'));var compose=require(_0x3ee6('0x2'));var db=require(_0x3ee6('0x3'))['db'];var config=require(_0x3ee6('0x4'));function getValueFromLicense(_0x28436d,_0x3212ab){if(_0x28436d&&_0x3212ab){if(_0x3212ab[_0x3ee6('0x5')]&&_0x3212ab[_0x3ee6('0x6')]){var _0x2ea44c=_0x3212ab[_0x3ee6('0x5')];var _0xe8341d=_0x3212ab[_0x3ee6('0x6')];var _0x2eef15=_0x2ea44c[_0x3ee6('0x7')]('-')[0x4];var _0xa9ece4=_0x2ea44c[_0x3ee6('0x7')]('-')[0x0];var _0x1fecf4=crypto['createDecipher'](_0x3ee6('0x8'),util['format'](_0x3ee6('0x9'),_0x2eef15,_0x2ea44c,_0xa9ece4));var _0x1c6c7e=_0x1fecf4[_0x3ee6('0xa')](_0xe8341d,_0x3ee6('0xb'),_0x3ee6('0xc'));_0x1c6c7e+=_0x1fecf4['final'](_0x3ee6('0xc'));var _0x373121=JSON['parse'](_0x1c6c7e);return _0x373121['hasOwnProperty'](_0x28436d)?_0x373121[_0x28436d]:null;}}return null;}function isLimit(_0x5cc0ac,_0x12e507,_0x1a56de,_0x5db005){var _0x4e8e46=_0x12e507;return compose()[_0x3ee6('0xd')](function(_0x4a253d,_0x1676d6,_0x1bc117){return db['License'][_0x3ee6('0xe')]({'where':{'id':0x1},'raw':!![]})[_0x3ee6('0xf')](function(_0x4d2642){var _0x21e44c=getValueFromLicense(_0x5cc0ac,_0x4d2642);return _0x21e44c?_0x21e44c:_0x4e8e46;})[_0x3ee6('0xf')](function(_0x6843ef){_0x4e8e46=_0x6843ef;return _0x1a56de[_0x3ee6('0x10')](_0x5db005);})['then'](function(_0x587d05){if(_0x587d05>=_0x4e8e46){return _0x1676d6[_0x3ee6('0x11')](0x193)['json']({'message':util[_0x3ee6('0x12')](_0x3ee6('0x13'),_0x5cc0ac)});}_0x1bc117();})[_0x3ee6('0x14')](function(_0x38766d){_0x1bc117(_0x38766d);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x3ee6('0x15')],{'where':{'$or':[{'role':'admin'},{'role':_0x3ee6('0x16')}]}});}exports[_0x3ee6('0x17')]=isUserLimit; \ No newline at end of file +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 diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 1a5fc92..a531557 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 _0x4387=['sqlOperator','startsWith','and','replace','[$and]','[$or]','length','split','slice','forEach','shift','match','filter','indexOf','map','conditions','buildExpression','operator','$between','value','$gt','$lte','add','days','format','castTo','text','CAST(','\x20AS\x20','field','includes','$ne','$notIn','\x20IS\x20NULL)','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$endsWith','pop','DATE','utcOffset','minutes','lodash','moment','parseSearch'];(function(_0x383356,_0x33d2f5){var _0x32ee5a=function(_0x2741db){while(--_0x2741db){_0x383356['push'](_0x383356['shift']());}};_0x32ee5a(++_0x33d2f5);}(_0x4387,0x185));var _0x7438=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4387[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7438('0x0'));var moment=require(_0x7438('0x1'));exports[_0x7438('0x2')]=function(_0x1afb9e){var _0x4bfa75={'conditions':[]};_0x4bfa75[_0x7438('0x3')]=_[_0x7438('0x4')](_0x1afb9e,'[$or]')?'or':_0x7438('0x5');var _0x19993b=_0x1afb9e[_0x7438('0x6')](_0x7438('0x7'),'')['replace'](_0x7438('0x8'),'')['split']('||');for(var _0x1fb715=0x0;_0x1fb715<_0x19993b[_0x7438('0x9')];_0x1fb715++){var _0x3b8be4=_0x19993b[_0x1fb715][_0x7438('0xa')](':=');var _0x2912e6=_0x3b8be4[0x0];var _0x1c9dbc=_0x3b8be4[_0x7438('0xb')](0x1);_0x1c9dbc[_0x7438('0xc')](function(_0x575bd3){var _0x506fb8=_0x575bd3[_0x7438('0xa')]('[')[_0x7438('0xd')]();var _0x130691=_0x575bd3[_0x7438('0xe')](/\[(.*?)\]/g);_0x130691[_0x7438('0xc')](function(_0x4a7537){var _0x162f58=_0x4a7537['split']('[')[_0x7438('0xf')](function(_0x14d4bd){return _0x14d4bd[_0x7438('0x10')](']')>-0x1;})[_0x7438('0x11')](function(_0x517cbe){return _0x517cbe[_0x7438('0xa')](']')[0x0];})[0x0];_0x4bfa75[_0x7438('0x12')]['push']({'field':_0x2912e6,'operator':_0x506fb8,'value':_0x162f58});});});}return _0x4bfa75;};exports[_0x7438('0x13')]=function(_0x4364e8,_0x1c0c17,_0x14492d){var _0x130358={};if(_0x1c0c17==='DATE'){if(_0x14492d[_0x7438('0x14')]==='$eq'){_0x14492d['operator']=_0x7438('0x15');_0x14492d[_0x7438('0x16')]+=','+_0x14492d[_0x7438('0x16')];}else if(_['includes']([_0x7438('0x17'),_0x7438('0x18')],_0x14492d['operator'])){_0x14492d['value']=moment(_0x14492d[_0x7438('0x16')])[_0x7438('0x19')](0x1,_0x7438('0x1a'))[_0x7438('0x1b')]('YYYY-MM-DD');}}if(_0x14492d[_0x7438('0x1c')]){_0x1c0c17=_0x14492d['castTo'];_0x130358[_0x7438('0x1d')]=_0x7438('0x1e')+_0x4364e8+'.'+_0x14492d['field']+_0x7438('0x1f')+_0x14492d['castTo']+')\x20'+parseOperator(_0x14492d[_0x7438('0x14')]);}else{_0x130358[_0x7438('0x1d')]=_0x4364e8+'.'+_0x14492d[_0x7438('0x20')]+'\x20'+parseOperator(_0x14492d['operator']);}if(_[_0x7438('0x21')]([_0x7438('0x22'),_0x7438('0x23')],_0x14492d[_0x7438('0x14')]))_0x130358['text']='('+_0x130358[_0x7438('0x1d')]+'\x20OR\x20'+_0x4364e8+'.'+_0x14492d[_0x7438('0x20')]+_0x7438('0x24');_0x130358[_0x7438('0x16')]=parseValue(_0x1c0c17,_0x14492d[_0x7438('0x14')],_0x14492d['value']);return _0x130358;};function parseOperator(_0x37f02a){var _0x28fba1;switch(_0x37f02a){case'$in':_0x28fba1=_0x7438('0x25');break;case _0x7438('0x23'):_0x28fba1=_0x7438('0x26');break;case'$eq':_0x28fba1=_0x7438('0x27');break;case _0x7438('0x22'):_0x28fba1=_0x7438('0x28');break;case _0x7438('0x29'):case _0x7438('0x2a'):case'$endsWith':_0x28fba1=_0x7438('0x2b');break;case _0x7438('0x2c'):_0x28fba1=_0x7438('0x2d');break;case'$gt':_0x28fba1=_0x7438('0x2e');break;case _0x7438('0x18'):_0x28fba1='<=\x20?';break;case _0x7438('0x2f'):_0x28fba1=_0x7438('0x30');break;case _0x7438('0x15'):_0x28fba1=_0x7438('0x31');break;}return _0x28fba1;}function parseValue(_0x566e0a,_0x24fe9b,_0x2d8646){var _0x22e382={'start':undefined,'end':undefined};switch(_0x24fe9b){case'$in':case _0x7438('0x23'):_0x22e382[_0x7438('0x32')]=_0x2d8646['split'](',');break;case _0x7438('0x29'):_0x22e382['start']='%'+_0x2d8646+'%';break;case _0x7438('0x2a'):_0x22e382['start']=_0x2d8646+'%';break;case _0x7438('0x33'):_0x22e382[_0x7438('0x32')]='%'+_0x2d8646;break;case _0x7438('0x15'):var _0x512596=_0x2d8646[_0x7438('0xa')](',');var _0x2d8646=_0x512596[_0x7438('0xd')]();var _0x5638c6=_0x512596[_0x7438('0x34')]();if(_0x566e0a===_0x7438('0x35')){_0x2d8646=moment(_0x2d8646)[_0x7438('0x36')](0x0,!![])[_0x7438('0x1b')]();_0x5638c6=moment(_0x5638c6)['utcOffset'](0x0,!![])['add'](0x17,'hours')[_0x7438('0x19')](0x3b,_0x7438('0x37'))['add'](0x3b,'seconds')[_0x7438('0x1b')]();}_0x22e382={'start':_0x2d8646,'end':_0x5638c6};break;default:_0x22e382[_0x7438('0x32')]=_0x2d8646;break;}return _0x22e382;} \ No newline at end of file +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 diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index be60855..d1539b2 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 _0xc720=['split','forOwn','isArray','parse','limit','offset','sort','indexOf','priority','cast','col','unsigned','DESC','length','isObject','isString','unset','omit','isNumeric','match','^[0-9]*$','isEmail','getFullTextValue','forEach','toString','join','sequelize'];(function(_0x153faa,_0x75f2a){var _0x43c32a=function(_0x1c5721){while(--_0x1c5721){_0x153faa['push'](_0x153faa['shift']());}};_0x43c32a(++_0x75f2a);}(_0xc720,0x6b));var _0x0c72=function(_0x5eaed0,_0x5d12ac){_0x5eaed0=_0x5eaed0-0x0;var _0x32126f=_0xc720[_0x5eaed0];return _0x32126f;};'use strict';var _=require('lodash');var sequelize=require(_0x0c72('0x0'));var LIMIT_VALUE=0xfa;exports['fields']=function(_0x337015){var _0x27eba0=null;if(_0x337015){_0x27eba0=_0x337015[_0x0c72('0x1')](',');}return _0x27eba0;};exports['filters']=function(_0x3ac566){var _0x26ad53={};if(!_['isEmpty'](_0x3ac566)){_0x26ad53={};_[_0x0c72('0x2')](_0x3ac566,function(_0x129063,_0x272613){try{_0x26ad53[_0x272613]=_[_0x0c72('0x3')](_0x129063)?_0x129063:JSON[_0x0c72('0x4')](_0x129063);}catch(_0x4498f5){_0x26ad53[_0x272613]=_0x129063[_0x0c72('0x1')](',');}});}return _0x26ad53;};exports[_0x0c72('0x5')]=function(_0x537404){_0x537404=parseInt(_0x537404,0xa);if(!_0x537404||_0x537404<0x0){_0x537404=LIMIT_VALUE;}return _0x537404;};exports[_0x0c72('0x6')]=function(_0x1610f0){_0x1610f0=parseInt(_0x1610f0,0xa);if(!_0x1610f0||_0x1610f0<0x0){_0x1610f0=0x0;}return _0x1610f0;};exports[_0x0c72('0x7')]=function(_0x4263ad){var _0x13ed12,_0x3f29b8=null;if(_0x4263ad){_0x13ed12=_0x4263ad[_0x0c72('0x1')](',');_0x3f29b8=_['map'](_0x13ed12,function(_0x36640b){if(_0x36640b[_0x0c72('0x8')]('-')===0x0){return[_0x36640b===_0x0c72('0x9')?sequelize[_0x0c72('0xa')](sequelize[_0x0c72('0xb')]('priority'),_0x0c72('0xc')):_0x36640b['substr'](0x1),_0x0c72('0xd')];}else{return[_0x36640b===_0x0c72('0x9')?sequelize[_0x0c72('0xa')](sequelize[_0x0c72('0xb')](_0x0c72('0x9')),'unsigned'):_0x36640b,'ASC'];}});}return _0x3f29b8;};exports['omit']=function(_0x1c853f,_0xca7497){if(_['isEmpty'](_0x1c853f)){return _0x1c853f;}if(_[_0x0c72('0x3')](_0x1c853f)){for(var _0x1f8b74=0x0;_0x1f8b74<_0x1c853f[_0x0c72('0xe')];_0x1f8b74+=0x1){_0x1c853f[_0x1f8b74]=this['omit'](_0x1c853f[_0x1f8b74],_0xca7497);}return _0x1c853f;}if(!_[_0x0c72('0xf')](_0x1c853f)){return _0x1c853f;}if(_[_0x0c72('0x10')](_0xca7497)){_0xca7497=[_0xca7497];}if(!_['isArray'](_0xca7497)){return _0x1c853f;}for(var _0x402e1e=0x0;_0x402e1e<_0xca7497[_0x0c72('0xe')];_0x402e1e+=0x1){_[_0x0c72('0x11')](_0x1c853f,_0xca7497[_0x402e1e]);}for(var _0x20aecd in _0x1c853f){if(_0x1c853f['hasOwnProperty'](_0x20aecd)){_0x1c853f[_0x20aecd]=this[_0x0c72('0x12')](_0x1c853f[_0x20aecd],_0xca7497);}}return _0x1c853f;};exports[_0x0c72('0x13')]=function(_0x825719){return _0x825719[_0x0c72('0x14')](RegExp(_0x0c72('0x15')))?!![]:![];};exports[_0x0c72('0x16')]=function(_0x5f2acf){return _0x5f2acf['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x0c72('0x17')]=function(_0x15fde4){var _0x3904b6=[];_0x15fde4[_0x0c72('0x1')]('\x20')[_0x0c72('0x18')](function(_0x15745a){_0x3904b6['push']('+'+_0x15745a[_0x0c72('0x19')]()+'*');});return _0x3904b6[_0x0c72('0x1a')]('\x20');}; \ No newline at end of file +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 diff --git a/server/config/express.js b/server/config/express.js index 73c2f91..10dd49e 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe52b=['views','engine','html','ejs','renderFile','urlencoded','50mb','initialize','serve-favicon','method-override','passport','cors','moment','../mysqldb','default','get','production','set','appPath','root','public','development','test','join','client','json\x20replacer','toISOString','split','use','static'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xe52b,0x1e8));var _0xbe52=function(_0x4584b7,_0x396a41){_0x4584b7=_0x4584b7-0x0;var _0x2bbf5c=_0xe52b[_0x4584b7];return _0x2bbf5c;};'use strict';var express=require('express');var favicon=require(_0xbe52('0x0'));var bodyParser=require('body-parser');var methodOverride=require(_0xbe52('0x1'));var cookieParser=require('cookie-parser');var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0xbe52('0x2'));var cors=require(_0xbe52('0x3'));var moment=require(_0xbe52('0x4'));var config=require('./environment');var db=require(_0xbe52('0x5'))['db'];exports[_0xbe52('0x6')]=function(_0x5f23ee){var _0x1691ae=_0x5f23ee[_0xbe52('0x7')]('env');if(_0x1691ae===_0xbe52('0x8')){_0x5f23ee[_0xbe52('0x9')](_0xbe52('0xa'),path['join'](config[_0xbe52('0xb')],_0xbe52('0xc')));}if(_0x1691ae===_0xbe52('0xd')||_0x1691ae===_0xbe52('0xe')){_0x5f23ee[_0xbe52('0x9')](_0xbe52('0xa'),path[_0xbe52('0xf')](config[_0xbe52('0xb')],_0xbe52('0x10')));_0x5f23ee['use'](errorHandler());}_0x5f23ee[_0xbe52('0x9')](_0xbe52('0x11'),function(_0x2a87cb,_0x54b203){if(this[_0x2a87cb]instanceof Date){_0x54b203=this[_0x2a87cb][_0xbe52('0x12')]()[_0xbe52('0x13')]('.')[0x0]+'Z';}return _0x54b203;});_0x5f23ee[_0xbe52('0x14')](express[_0xbe52('0x15')](_0x5f23ee[_0xbe52('0x7')](_0xbe52('0xa'))));_0x5f23ee[_0xbe52('0x9')](_0xbe52('0x16'),config[_0xbe52('0xb')]+'/server/views');_0x5f23ee[_0xbe52('0x17')](_0xbe52('0x18'),require(_0xbe52('0x19'))[_0xbe52('0x1a')]);_0x5f23ee[_0xbe52('0x9')]('view\x20engine',_0xbe52('0x18'));_0x5f23ee['use'](bodyParser[_0xbe52('0x1b')]({'limit':_0xbe52('0x1c'),'extended':!![]}));_0x5f23ee[_0xbe52('0x14')](bodyParser['json']({'limit':'50mb'}));_0x5f23ee[_0xbe52('0x14')](cors());_0x5f23ee['use'](methodOverride());_0x5f23ee['use'](cookieParser());_0x5f23ee[_0xbe52('0x14')](passport[_0xbe52('0x1d')]());}; \ No newline at end of file +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 diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 76c8aa6..88be816 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 _0x72a2=['00:00:00:00:00:00','address','map','model','join','createHash','update','digest','hex','getUuid','win32','dmidecode\x20--string\x20system-uuid','macAddress','md5','substring','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','filter','family','concat','head','mac'];(function(_0x10791d,_0x2562b6){var _0x1b4f9c=function(_0x3b2815){while(--_0x3b2815){_0x10791d['push'](_0x10791d['shift']());}};_0x1b4f9c(++_0x2562b6);}(_0x72a2,0x161));var _0x272a=function(_0xdbcd8,_0x36f10f){_0xdbcd8=_0xdbcd8-0x0;var _0x1d8d41=_0x72a2[_0xdbcd8];return _0x1d8d41;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x272a('0x0'));var machine=require(_0x272a('0x1'));var exec=require(_0x272a('0x2'))[_0x272a('0x3')];function getInterfaces(){var _0xdd3cbb=[];var _0x4c36b2=os[_0x272a('0x4')]();var _0x52287e=_[_0x272a('0x5')](_['keys'](_0x4c36b2));for(var _0x497945=0x0;_0x497945<_0x52287e['length'];_0x497945++){var _0x2ba5db=_0x4c36b2[_0x52287e[_0x497945]][_0x272a('0x6')](function(_0x220b90){return _0x220b90[_0x272a('0x7')]==='IPv4'&&_0x220b90['internal']===![];});_0xdd3cbb=_0xdd3cbb[_0x272a('0x8')](_0x2ba5db);}return _0xdd3cbb;}function getFirstInterface(){var _0x5edd05=_[_0x272a('0x9')](getInterfaces());return{'macAddress':_0x5edd05&&_0x5edd05['mac']?_0x5edd05[_0x272a('0xa')]:_0x272a('0xb'),'ipAddress':_0x5edd05&&_0x5edd05[_0x272a('0xc')]?_0x5edd05[_0x272a('0xc')]:'127.0.0.1'};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x153666=_[_0x272a('0x5')](os['cpus']()[_0x272a('0xd')](function(_0x7cb1fe){return _0x7cb1fe[_0x272a('0xe')];}))[_0x272a('0xf')](':');return crypto[_0x272a('0x10')]('md5')[_0x272a('0x11')](_0x153666)[_0x272a('0x12')](_0x272a('0x13'));}exports[_0x272a('0x14')]=function(){switch(os['platform']()){case _0x272a('0x15'):return exec(_0x272a('0x16'),{'encoding':'utf8'})['replace']('\x0d\x0a','');default:var _0x4cfb67=getFirstInterface();var _0x5cd84f=getCPUhash();var _0x47dfdf=_0x5cd84f+'|'+os['hostname']()+'|'+_0x4cfb67[_0x272a('0x17')]+'|'+_0x4cfb67['ipAddress'];var _0x3eab5e=crypto[_0x272a('0x10')](_0x272a('0x18'))[_0x272a('0x11')](_0x47dfdf)['digest'](_0x272a('0x13'));return _0x3eab5e[_0x272a('0x19')](0x0,0x8)+'-'+_0x3eab5e[_0x272a('0x19')](0x8,0xc)+'-'+_0x3eab5e[_0x272a('0x19')](0xc,0x10)+'-'+_0x3eab5e[_0x272a('0x19')](0x10,0x14)+'-'+_0x3eab5e[_0x272a('0x19')](0x14);}}; \ No newline at end of file +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 diff --git a/server/config/license/index.js b/server/config/license/index.js index 623a09f..aa220c8 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 _0x01a6=['|uuid|','|email|','Alert','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','info','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','util','moment','request-promise','bluebird','pkginfo','version','../environment','../logger','license','../../api/jira/jira.controller','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','GET','then','catch','createCipher','aes-256-ctr','secrets','session','update','utf8','base64','final','createDecipher','User','findOne','admin','fullname','email'];(function(_0x3f3237,_0x3974d3){var _0x303f8d=function(_0xe4f630){while(--_0xe4f630){_0x3f3237['push'](_0x3f3237['shift']());}};_0x303f8d(++_0x3974d3);}(_0x01a6,0x162));var _0x601a=function(_0x17ccaf,_0x5dd004){_0x17ccaf=_0x17ccaf-0x0;var _0x30e7e1=_0x01a6[_0x17ccaf];return _0x30e7e1;};'use strict';var util=require(_0x601a('0x0'));var crypto=require('crypto');var moment=require(_0x601a('0x1'));var rp=require(_0x601a('0x2'));var BPromise=require(_0x601a('0x3'));var pkginfo=require(_0x601a('0x4'))(module,_0x601a('0x5'));var db=require('../../mysqldb')['db'];var config=require(_0x601a('0x6'));var hardware=require('./hardware');var logger=require(_0x601a('0x7'))(_0x601a('0x8'));var jira=require(_0x601a('0x9'));var HOST=_0x601a('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x272297){return new BPromise(function(_0x5d94b5,_0x4ec3fe){var _0x208472=util[_0x601a('0xb')](_0x601a('0xc'),HOST,_0x272297,module['exports'][_0x601a('0x5')]);if(oldToken){_0x208472=util[_0x601a('0xb')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x272297,module[_0x601a('0xd')][_0x601a('0x5')],oldToken);}var _0x51ed58={'uri':_0x208472,'method':_0x601a('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x51ed58)[_0x601a('0xf')](function(_0x3fec87){_0x5d94b5(_0x3fec87);})[_0x601a('0x10')](function(_0x11b1e3){_0x4ec3fe(_0x11b1e3);});});}function encryptDate(_0x1e25dc){var _0x43fe3c=crypto[_0x601a('0x11')](_0x601a('0x12'),config[_0x601a('0x13')][_0x601a('0x14')]);var _0x4fbf9c=_0x43fe3c[_0x601a('0x15')](_0x1e25dc,_0x601a('0x16'),_0x601a('0x17'));_0x4fbf9c+=_0x43fe3c[_0x601a('0x18')](_0x601a('0x17'));return _0x4fbf9c;}function decryptDate(_0x1dbea6){var _0x4912d3=crypto[_0x601a('0x19')](_0x601a('0x12'),config[_0x601a('0x13')][_0x601a('0x14')]);var _0x4e1ebf=_0x4912d3[_0x601a('0x15')](_0x1dbea6,'base64',_0x601a('0x16'));_0x4e1ebf+=_0x4912d3[_0x601a('0x18')](_0x601a('0x16'));return _0x4e1ebf;}function sendJiraAlert(_0x3411c3,_0x117870,_0x47230b){var _0x22a95d='||FIELD||VALUE||\x0a';return db[_0x601a('0x1a')][_0x601a('0x1b')]({'where':{'role':_0x601a('0x1c')},'attributes':[_0x601a('0x1d'),_0x601a('0x1e')],'raw':!![]})[_0x601a('0xf')](function(_0xa44be8){ADMIN=_0xa44be8;_0x22a95d+='|reason|'+_0x47230b+'|\x0a';_0x22a95d+=_0x601a('0x1f')+_0x3411c3+'|\x0a';_0x22a95d+='|machineUuid|'+_0x117870+'|\x0a';_0x22a95d+='|name|'+ADMIN[_0x601a('0x1d')]+'|\x0a';_0x22a95d+=_0x601a('0x20')+ADMIN[_0x601a('0x1e')]+'|\x0a';return _0x22a95d;})[_0x601a('0xf')](function(_0x5c9349){var _0x376012=hardware['getFirstInterface']()['ipAddress'];return jira['openIssue']({'key':'MOTLICENSE','summary':'Motion\x20License\x20Alert','description':_0x5c9349,'issuetype':_0x601a('0x21'),'oldToken':_0x3411c3,'newToken':_0x117870,'email':ADMIN['email'],'name':ADMIN[_0x601a('0x1d')],'reason':GRAY_PERIOD_REASON,'ip':_0x376012});});}function manageLicense(_0x34f4cb,_0x29ec51){var _0x233f5d=_0x29ec51['get']({'plain':!![]});httpRequest(_0x34f4cb)[_0x601a('0xf')](function(_0xac841b){if(oldToken){oldToken=undefined;}if(_0xac841b['active']){if(!_0x233f5d[_0x601a('0x8')]&&_0x233f5d[_0x601a('0x8')]!=_0xac841b[_0x601a('0x8')]||_0x233f5d[_0x601a('0x8')]&&_0x233f5d[_0x601a('0x22')]){logger['info'](_0x601a('0x23'));}if(_0x233f5d[_0x601a('0x8')]&&!_0x233f5d[_0x601a('0x22')]&&_0x233f5d[_0x601a('0x8')]!=_0xac841b[_0x601a('0x8')]){logger['info'](_0x601a('0x24'));}if(_0x233f5d[_0x601a('0x8')]&&!_0x233f5d['data2']&&_0x233f5d[_0x601a('0x8')]==_0xac841b[_0x601a('0x8')]){return _0x29ec51;}return _0x29ec51[_0x601a('0x15')]({'data1':_0x34f4cb,'data2':null,'license':_0xac841b['license']});}else{if(_0xac841b['license']||_0x233f5d[_0x601a('0x8')]){if(!_0x233f5d[_0x601a('0x22')]){if(_0x233f5d[_0x601a('0x25')]==_0x34f4cb){GRAY_PERIOD_REASON='Disabled';logger[_0x601a('0x26')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x601a('0x27');oldToken=_0x233f5d[_0x601a('0x25')];logger[_0x601a('0x26')](_0x601a('0x28'),_0x233f5d[_0x601a('0x25')],_0x34f4cb);}sendJiraAlert(_0x233f5d[_0x601a('0x25')],_0xac841b[_0x601a('0x29')],GRAY_PERIOD_REASON);logger[_0x601a('0x26')](_0x601a('0x2a'),GRAY_PERIOD_REASON[_0x601a('0x2b')](),moment()[_0x601a('0xb')](_0x601a('0x2c')));return _0x29ec51[_0x601a('0x15')]({'data2':encryptDate(moment()[_0x601a('0xb')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x601a('0x2d')](decryptDate(_0x233f5d['data2']),_0x601a('0x2e'))>DAYS){logger[_0x601a('0x26')](_0x601a('0x2f'),moment()[_0x601a('0xb')](_0x601a('0x2c')));return _0x29ec51[_0x601a('0x15')]({'data1':_0x34f4cb,'data2':null,'license':null});}}}else{if(_0x233f5d[_0x601a('0x25')]!=_0x34f4cb){logger['info'](_0x601a('0x28'),_0x233f5d[_0x601a('0x25')],_0x34f4cb);return _0x29ec51[_0x601a('0x15')]({'data1':_0x34f4cb,'data2':null,'license':null});}}}return _0x29ec51;})[_0x601a('0xf')](function(_0x2a1823){_0x29ec51=_0x2a1823;})[_0x601a('0x10')](function(_0x4fbb0a){logger[_0x601a('0x30')](_0x4fbb0a[_0x601a('0x31')]);})[_0x601a('0x32')](function(){setTimeout(function(){manageLicense(hardware[_0x601a('0x33')](),_0x29ec51);},TIME);});}function defaultLicense(){var _0xe9b1db=hardware[_0x601a('0x33')]();if(_0xe9b1db){return db[_0x601a('0x34')][_0x601a('0x35')]({'where':{'id':0x1},'defaults':{'data1':_0xe9b1db}})['spread'](function(_0x492195,_0x583db4){logger[_0x601a('0x26')](_0x601a('0x36'),_0xe9b1db);manageLicense(_0xe9b1db,_0x492195);})[_0x601a('0x10')](function(_0x21fc84){logger[_0x601a('0x30')](_0x21fc84[_0x601a('0x31')]);});}}exports['default']=defaultLicense; \ No newline at end of file +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 diff --git a/server/config/license/util.js b/server/config/license/util.js index 6a8f276..fdaf153 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 _0x3c55=['Demo\x20license','getLicense','find','defaults','then','checkLicense','crypto','util','lodash','moment','./hardware','../environment','../../mysqldb','License\x20key\x20value\x20not\x20found','data1','data2','split','createDecipher','aes-256-ctr','format','update','final','demo','uuid','machineUuid','getUuid','session','base64','utf8','gray','deadline','add','days','grayReason','changed','disabled','2027-01-01T00:00:00.000Z','message'];(function(_0xaec9e4,_0x39c2c5){var _0xc2e5fb=function(_0x378622){while(--_0x378622){_0xaec9e4['push'](_0xaec9e4['shift']());}};_0xc2e5fb(++_0x39c2c5);}(_0x3c55,0x110));var _0x53c5=function(_0xf2d485,_0x48475a){_0xf2d485=_0xf2d485-0x0;var _0x1a6a05=_0x3c55[_0xf2d485];return _0x1a6a05;};'use strict';var crypto=require(_0x53c5('0x0'));var util=require(_0x53c5('0x1'));var _=require(_0x53c5('0x2'));var moment=require(_0x53c5('0x3'));var hardware=require(_0x53c5('0x4'));var config=require(_0x53c5('0x5'));var db=require(_0x53c5('0x6'))['db'];function checkLicense(_0xd16fe9,_0x2be2ff){if(_0xd16fe9){try{var _0xb8d532=_0x2be2ff||_0xd16fe9['license'];if(_['isEmpty'](_0xb8d532)){throw new Error(_0x53c5('0x7'));}var _0x54901c=_0xd16fe9[_0x53c5('0x8')];var _0xcfefe9=_0xd16fe9[_0x53c5('0x9')];var _0x13a285=_0x54901c[_0x53c5('0xa')]('-')[0x4];var _0x415635=_0x54901c[_0x53c5('0xa')]('-')[0x0];var _0x17910d=crypto[_0x53c5('0xb')](_0x53c5('0xc'),util[_0x53c5('0xd')]('%s:%s:%s',_0x13a285,_0x54901c,_0x415635));var _0x33e57a=_0x17910d[_0x53c5('0xe')](_0xb8d532,'base64','utf8');_0x33e57a+=_0x17910d[_0x53c5('0xf')]('utf8');var _0xb2b100=JSON['parse'](_0x33e57a);_0xb2b100[_0x53c5('0x10')]=![];_0xb2b100[_0x53c5('0x11')]=_0x54901c;_0xb2b100[_0x53c5('0x12')]=hardware[_0x53c5('0x13')]();if(_0xcfefe9){var _0x318c0f=crypto[_0x53c5('0xb')](_0x53c5('0xc'),config['secrets'][_0x53c5('0x14')]);var _0x23867b=_0x318c0f[_0x53c5('0xe')](_0xcfefe9,_0x53c5('0x15'),_0x53c5('0x16'));_0x23867b+=_0x318c0f[_0x53c5('0xf')]('utf8');_0xb2b100[_0x53c5('0x17')]=_0x23867b;_0xb2b100[_0x53c5('0x18')]=moment(_0x23867b)[_0x53c5('0x19')](0x7,_0x53c5('0x1a'))['format']();_0xb2b100[_0x53c5('0x1b')]=_0xb2b100[_0x53c5('0x11')]!=_0xb2b100[_0x53c5('0x12')]?_0x53c5('0x1c'):_0x53c5('0x1d');}return _0xb2b100;}catch(_0x4afc03){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x53c5('0x1e'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','uuid':_0xd16fe9[_0x53c5('0x8')],'machineUuid':hardware['getUuid'](),'message':_0x4afc03[_0x53c5('0x1f')],'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':_0x53c5('0x20'),'uuid':_0xd16fe9['data1'],'machineUuid':hardware[_0x53c5('0x13')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![]};}exports[_0x53c5('0x21')]=function(_0x3a0c36){return db['License'][_0x53c5('0x22')](_[_0x53c5('0x23')](_0x3a0c36,{'raw':!![],'where':{'id':0x1}}))[_0x53c5('0x24')](function(_0x189206){return checkLicense(_0x189206,null);});};exports[_0x53c5('0x25')]=checkLicense; \ No newline at end of file +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 diff --git a/server/config/local.env.js b/server/config/local.env.js index 453599b..5ab3598 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 _0xa8e4=['exports','myappanuglar-secret','app-id','secret'];(function(_0x38e656,_0x21bcb0){var _0x411375=function(_0x1582c3){while(--_0x1582c3){_0x38e656['push'](_0x38e656['shift']());}};_0x411375(++_0x21bcb0);}(_0xa8e4,0x148));var _0x4a8e=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0xa8e4[_0x2aa0e7];return _0x1472c0;};'use strict';module[_0x4a8e('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x4a8e('0x1'),'GOOGLE_ID':_0x4a8e('0x2'),'GOOGLE_SECRET':_0x4a8e('0x3'),'DEBUG':''}; \ No newline at end of file +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 diff --git a/server/config/logger.js b/server/config/logger.js index 65e2507..93d8f88 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x201e=['exports','Logger','transports','File','%s-%s','error','info','Console','moment','util','path','INFO','/var','log','format','%s-%s.log','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','message'];(function(_0x3b5ce3,_0x465fc4){var _0x3682ea=function(_0x5bebe3){while(--_0x5bebe3){_0x3b5ce3['push'](_0x3b5ce3['shift']());}};_0x3682ea(++_0x465fc4);}(_0x201e,0x148));var _0xe201=function(_0x2272b5,_0x362458){_0x2272b5=_0x2272b5-0x0;var _0x110156=_0x201e[_0x2272b5];return _0x110156;};'use strict';var moment=require(_0xe201('0x0'));var winston=require('winston');var util=require(_0xe201('0x1'));var path=require(_0xe201('0x2'));var debugLevel=_0xe201('0x3');function filename(_0x1828d7,_0x49594a){return path['join'](_0xe201('0x4'),_0xe201('0x5'),'xcally',util[_0xe201('0x6')](_0xe201('0x7'),_0x1828d7,_0x49594a));}function formatter(_0x2d24c9,_0x379e1c){return util[_0xe201('0x6')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xe201('0x6')](_0xe201('0x8')),_0x379e1c[_0xe201('0x9')][_0xe201('0xa')](),_0x2d24c9,_0x379e1c[_0xe201('0xb')]);}module[_0xe201('0xc')]=function(_0x5b8d14){return new winston[(_0xe201('0xd'))]({'transports':[new winston[(_0xe201('0xe'))][(_0xe201('0xf'))]({'name':util[_0xe201('0x6')](_0xe201('0x10'),_0x5b8d14,_0xe201('0x11')),'filename':filename(_0x5b8d14,_0xe201('0x11')),'level':_0xe201('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x24be06){return formatter(_0x5b8d14,_0x24be06);}}),new winston[(_0xe201('0xe'))][(_0xe201('0xf'))]({'name':util[_0xe201('0x6')](_0xe201('0x10'),_0x5b8d14,_0xe201('0x12')),'filename':filename(_0x5b8d14,_0xe201('0x12')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2f8e96){return formatter(_0x5b8d14,_0x2f8e96);}}),new winston[(_0xe201('0xe'))][(_0xe201('0x13'))]({'level':process['env']['debugLevel']||debugLevel,'json':![],'formatter':function(_0x27a589){return formatter(_0x5b8d14,_0x27a589);}})]});}; \ No newline at end of file +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 diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 8026c68..b19ea69 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 _0x94fe=['../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','path','express','join','../../services/express/index.js','ami'];(function(_0x1ffd0f,_0x4d3c33){var _0x17cbeb=function(_0xbf1daa){while(--_0xbf1daa){_0x1ffd0f['push'](_0x1ffd0f['shift']());}};_0x17cbeb(++_0x4d3c33);}(_0x94fe,0x167));var _0xe94f=function(_0x283fb3,_0x32ec18){_0x283fb3=_0x283fb3-0x0;var _0x5f1ba4=_0x94fe[_0x283fb3];return _0x5f1ba4;};'use strict';var path=require(_0xe94f('0x0'));var os=require('os');var config={'apps':[{'name':_0xe94f('0x1'),'script':path[_0xe94f('0x2')](__dirname,_0xe94f('0x3'))},{'name':_0xe94f('0x4'),'script':path['join'](__dirname,_0xe94f('0x5'))},{'name':_0xe94f('0x6'),'script':path[_0xe94f('0x2')](__dirname,_0xe94f('0x7'))},{'name':_0xe94f('0x8'),'script':path[_0xe94f('0x2')](__dirname,_0xe94f('0x9'))},{'name':_0xe94f('0xa'),'script':path['join'](__dirname,_0xe94f('0xb'))},{'name':_0xe94f('0xc'),'script':path['join'](__dirname,_0xe94f('0xd'))}]};module['exports']=config; \ No newline at end of file +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 diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 396b2ee..5c766c0 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 _0x04f9=['connected','start','then','disconnect','stop','restart','list','describe','delete','dump','saved','bluebird','./config','connect'];(function(_0x73ba1f,_0x588ccb){var _0x2e2725=function(_0x145578){while(--_0x145578){_0x73ba1f['push'](_0x73ba1f['shift']());}};_0x2e2725(++_0x588ccb);}(_0x04f9,0xb3));var _0x904f=function(_0x110e17,_0x46f11a){_0x110e17=_0x110e17-0x0;var _0xba82=_0x04f9[_0x110e17];return _0xba82;};'use strict';var pm2=require('pm2');var BPromise=require(_0x904f('0x0'));var config=require(_0x904f('0x1'));function connect(){return new BPromise(function(_0x46d9e5,_0x563e97){return pm2[_0x904f('0x2')](function(_0x81ba22){if(_0x81ba22){return _0x563e97(_0x81ba22);}return _0x46d9e5(_0x904f('0x3'));});});};exports[_0x904f('0x4')]=function(_0x243fb2){return connect()[_0x904f('0x5')](function(){return new BPromise(function(_0x549b21,_0x4e5a0c){return pm2[_0x904f('0x4')](_0x243fb2,function(_0x175c38,_0x21dce4){if(_0x175c38){return _0x4e5a0c(_0x175c38);}pm2[_0x904f('0x6')]();return _0x549b21(_0x21dce4);});});});};exports['stop']=function(_0xa90c3f){return connect()[_0x904f('0x5')](function(){return new BPromise(function(_0x2fdd52,_0x4f8d32){return pm2[_0x904f('0x7')](_0xa90c3f,function(_0x1bcfc3,_0x12fbce){if(_0x1bcfc3){return _0x4f8d32(_0x1bcfc3);}pm2[_0x904f('0x6')]();return _0x2fdd52(_0x12fbce);});});});};exports[_0x904f('0x8')]=function(_0x17a471){return connect()[_0x904f('0x5')](function(){return new BPromise(function(_0x31e3e2,_0x245577){return pm2[_0x904f('0x8')](_0x17a471,function(_0x20cbfd,_0x2ba370){if(_0x20cbfd){return _0x245577(_0x20cbfd);}pm2[_0x904f('0x6')]();return _0x31e3e2(_0x2ba370);});});});};exports[_0x904f('0x9')]=function(){return connect()[_0x904f('0x5')](function(){return new BPromise(function(_0x13ce05,_0x1adaaa){return pm2[_0x904f('0x9')](function(_0x243abe,_0x37c745){if(_0x243abe){return _0x1adaaa(_0x243abe);}pm2[_0x904f('0x6')]();return _0x13ce05(_0x37c745);});});});};exports[_0x904f('0xa')]=function(_0x9b693c){return connect()['then'](function(){return new BPromise(function(_0x4e13bc,_0xf5268d){return pm2[_0x904f('0xa')](_0x9b693c,function(_0x5c8306,_0x58c4d6){if(_0x5c8306){return _0xf5268d(_0x5c8306);}pm2['disconnect']();return _0x4e13bc(_0x58c4d6);});});});};exports[_0x904f('0xb')]=function(_0x34770b){return connect()['then'](function(){return new BPromise(function(_0x43cf3e,_0x502f80){return pm2['delete'](_0x34770b,function(_0x5d9495,_0x47a543){if(_0x5d9495){return _0x502f80(_0x5d9495);}pm2['disconnect']();return _0x43cf3e(_0x47a543);});});});};exports['dump']=function(){return connect()[_0x904f('0x5')](function(){return new BPromise(function(_0x3e55b1,_0x4ab9b3){return pm2[_0x904f('0xc')](function(_0x8d3fce){if(_0x8d3fce){return _0x4ab9b3(_0x8d3fce);}return _0x3e55b1(_0x904f('0xd'));});});});}; \ No newline at end of file +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 diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 9db7b7c..6b47cc0 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 _0x5c69=['ChatInteraction','findAll','subtract','minutes','update','system','format','YYYY-MM-DD\x20HH:mm:ss','emit','chatInteraction:update','error','start','lodash','moment','ioredis','redis','defaults','socket.io-emitter','Setting','find','chatTimeout','then'];(function(_0xea7e13,_0x3804e5){var _0x23fda1=function(_0x26cd42){while(--_0x26cd42){_0xea7e13['push'](_0xea7e13['shift']());}};_0x23fda1(++_0x3804e5);}(_0x5c69,0x1c4));var _0x95c6=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x5c69[_0x4e9d3c];return _0x2d0825;};'use strict';var _=require(_0x95c6('0x0'));var moment=require(_0x95c6('0x1'));var Redis=require(_0x95c6('0x2'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');config[_0x95c6('0x3')]=_[_0x95c6('0x4')](config[_0x95c6('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x95c6('0x5'))(new Redis(config[_0x95c6('0x3')]));function closeInteractions(){var _0x38936a=0x0;var _0x11a7dd=[];return db[_0x95c6('0x6')][_0x95c6('0x7')]({'raw':!![],'attributes':['id',_0x95c6('0x8')],'where':{'id':0x1}})[_0x95c6('0x9')](function(_0x5d07cb){_0x38936a=_0x5d07cb[_0x95c6('0x8')];if(_0x38936a){return db[_0x95c6('0xa')][_0x95c6('0xb')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x95c6('0xc')](_0x5d07cb[_0x95c6('0x8')],_0x95c6('0xd'))}}});}else{return[];}})['then'](function(_0x51d437){_0x11a7dd=_0x51d437;if(_0x38936a){return db['ChatInteraction'][_0x95c6('0xe')]({'closeReason':_0x95c6('0xf'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x95c6('0x10')](_0x95c6('0x11'))},{'where':{'id':_['map'](_0x11a7dd||[],'id')}});}})['then'](function(_0x1ad17c){for(var _0x37a0e1=0x0;_0x37a0e1<_0x11a7dd['length'];_0x37a0e1++){io[_0x95c6('0x12')](_0x95c6('0x13'),{'id':_0x11a7dd[_0x37a0e1]['id'],'closed':!![]});}})['catch'](function(_0x574f41){console[_0x95c6('0x14')](_0x574f41);});}exports[_0x95c6('0x15')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +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 diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 162ca94..bbe6124 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 _0x97c2=['findAll','MailServerOut','keys','jobs','map','keyBy','toString','difference','intersection','stop','deleteJob','delete\x20cron','toRun','length','index','my\x20id','then','cron','active','isBetween','add\x20cron','exists','stop\x20cron','startAt','endAt','update','update\x20cron','start','util','path','moment','cron-job-manager','jayson/promise','bluebird','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','../../files/reports','savename','%s.%s','basename','join','existsSync','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','status','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','error','error\x20mail','email\x20sent','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule'];(function(_0x43f47b,_0x311636){var _0x4af9a6=function(_0x4fb7f0){while(--_0x4fb7f0){_0x43f47b['push'](_0x43f47b['shift']());}};_0x4af9a6(++_0x311636);}(_0x97c2,0x18c));var _0x297c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x97c2[_0x20a584];return _0x4b41a8;};'use strict';var fs=require('fs');var util=require(_0x297c('0x0'));var path=require(_0x297c('0x1'));var _=require('lodash');var moment=require(_0x297c('0x2'));var CronJobManager=require(_0x297c('0x3'));var jayson=require(_0x297c('0x4'));var BPromise=require(_0x297c('0x5'));var logger=require('../logger')(_0x297c('0x6'));var db=require(_0x297c('0x7'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x297c('0x8'));var client=jayson[_0x297c('0x9')][_0x297c('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2ea28a,_0x4ff9ec){return function(){logger[_0x297c('0xb')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x2ea28a[_0x297c('0xc')]);var _0x54c135=!![];var _0x2761be={'tls':{'rejectUnauthorized':![]}};if(_0x2ea28a[_0x297c('0xd')][_0x297c('0xe')][_0x297c('0xf')]){_0x2761be['service']=_0x2ea28a[_0x297c('0xd')]['Smtp'][_0x297c('0xf')];}else{_0x2761be[_0x297c('0x10')]=_0x2ea28a[_0x297c('0xd')][_0x297c('0xe')][_0x297c('0x10')];_0x2761be[_0x297c('0x11')]=_0x2ea28a['MailAccount'][_0x297c('0xe')]['port'];_0x2761be[_0x297c('0x12')]=_0x2ea28a[_0x297c('0xd')][_0x297c('0xe')]['secure'];}if(_0x2ea28a[_0x297c('0xd')][_0x297c('0xe')][_0x297c('0x13')]){_0x2761be[_0x297c('0x14')]={'user':_0x2ea28a[_0x297c('0xd')][_0x297c('0xe')][_0x297c('0x15')],'pass':_0x2ea28a[_0x297c('0xd')][_0x297c('0xe')][_0x297c('0x16')]};}var _0xd5d0ad={'account':_0x2761be,'message':{'from':util[_0x297c('0x17')](_0x297c('0x18'),_0x2ea28a[_0x297c('0xd')][_0x297c('0x19')],_0x2ea28a[_0x297c('0xd')][_0x297c('0xc')]||_0x2ea28a[_0x297c('0xd')][_0x297c('0xe')][_0x297c('0x15')]),'to':_0x2ea28a[_0x297c('0xc')],'cc':_0x2ea28a['cc'],'bcc':_0x2ea28a[_0x297c('0x1a')],'subject':util[_0x297c('0x17')](_0x297c('0x1b'),_0x4ff9ec[_0x297c('0x19')],_0x2ea28a[_0x297c('0x1c')],_0x2ea28a['subtractUnit'])}};var _0x23000f=path['join'](__dirname,_0x297c('0x1d'));var _0x5c3007=_0x4ff9ec[_0x297c('0x1e')];var _0x571303=util[_0x297c('0x17')](_0x297c('0x1f'),path[_0x297c('0x20')](_0x4ff9ec[_0x297c('0x1e')],path['extname'](_0x4ff9ec[_0x297c('0x1e')])),'zip');var _0x29751a=path[_0x297c('0x21')](_0x23000f,_0x5c3007);var _0x4d1a12=path['join'](_0x23000f,_0x571303);if(fs[_0x297c('0x22')](_0x29751a)){_0x4ff9ec['status']=_0x297c('0x23');_0xd5d0ad[_0x297c('0x24')][_0x297c('0x25')]=[{'filename':_0x5c3007,'path':_0x29751a}];_0xd5d0ad[_0x297c('0x24')][_0x297c('0x26')]=util['format'](_0x297c('0x27'),JSON[_0x297c('0x28')](_0x4ff9ec,null,0x2));}else if(fs[_0x297c('0x22')](_0x4d1a12)){_0x4ff9ec[_0x297c('0x29')]=_0x297c('0x23');_0xd5d0ad[_0x297c('0x24')][_0x297c('0x25')]=[{'filename':_0x571303,'path':_0x4d1a12}];}else{_0xd5d0ad[_0x297c('0x24')][_0x297c('0x26')]=_0x297c('0x2a');if(!_0x2ea28a[_0x297c('0x2b')]){_0x54c135=![];logger['info'](_0x297c('0x2c'));}}if(_0x54c135){return client[_0x297c('0x2d')](_0x297c('0x2e'),_0xd5d0ad)['then'](function(_0x12e4e4){if(_0x12e4e4[_0x297c('0x2f')]){return logger['error'](_0x297c('0x30'),JSON['stringify'](_0x12e4e4));}return logger[_0x297c('0xb')](_0x297c('0x31'));})['catch'](function(_0x2c78f7){return logger[_0x297c('0x2f')](_0x297c('0x30'),JSON[_0x297c('0x28')](_0x2c78f7));});}};}function handleError(){return function(_0x5abff8){return logger['error'](JSON['stringify'](_0x5abff8));};}function handleResult(_0x211e6f){return function(_0x40ea8c){logger[_0x297c('0xb')]('data',JSON[_0x297c('0x28')](_0x40ea8c));if(_0x211e6f[_0x297c('0xd')]&&_0x211e6f[_0x297c('0xd')]['Smtp']&&!_[_0x297c('0x32')](_0x211e6f[_0x297c('0xc')])){setTimeout(handleSendEmail(_0x211e6f,_0x40ea8c),0x3c*0x3e8);}};}function handleJob(_0x37dd53){return function(){try{if(_[_0x297c('0x32')](_0x37dd53[_0x297c('0x1c')])){return logger[_0x297c('0xb')](_0x297c('0x33'));}if(_[_0x297c('0x32')](_0x37dd53[_0x297c('0x34')])){return logger[_0x297c('0xb')]('subtractUnit\x20null\x20or\x20undefined');}var _0x689f85={'startDate':moment()[_0x297c('0x35')](_0x37dd53[_0x297c('0x1c')],_0x37dd53[_0x297c('0x34')])[_0x297c('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x297c('0x17')](_0x297c('0x36')),'type':'scheduled','output':_0x37dd53[_0x297c('0x37')],'name':_0x37dd53['name']};if(!_[_0x297c('0x32')](_0x37dd53[_0x297c('0x38')])){logger[_0x297c('0xb')](_0x297c('0x39'),_0x37dd53[_0x297c('0x38')]);return analyticDefaultReportController[_0x297c('0x3a')]({'id':_0x37dd53[_0x297c('0x38')]},_0x689f85)['then'](handleResult(_0x37dd53))[_0x297c('0x3b')](handleError());}if(!_[_0x297c('0x32')](_0x37dd53[_0x297c('0x3c')])){logger[_0x297c('0xb')](_0x297c('0x3d'),_0x37dd53[_0x297c('0x3c')]);return analyticCustomReportController[_0x297c('0x3a')]({'id':_0x37dd53[_0x297c('0x3c')]},_0x689f85)['then'](handleResult(_0x37dd53))['catch'](handleError());}}catch(_0x8d6506){logger[_0x297c('0x2f')](JSON[_0x297c('0x28')](_0x8d6506));}return logger[_0x297c('0xb')](_0x297c('0x3e'));};}function getJobs(_0x5ad1a7){var _0x2b3cfc={};if(_0x5ad1a7){_0x2b3cfc['id']=_0x5ad1a7;}return db[_0x297c('0x3f')][_0x297c('0x40')]({'where':_0x2b3cfc,'include':[{'model':db[_0x297c('0xd')],'attributes':['id',_0x297c('0x19'),_0x297c('0xc')],'include':[{'model':db[_0x297c('0x41')],'as':'Smtp'}]}]})['then'](function(_0x15ecac){var _0x2c436b=_[_0x297c('0x42')](manager[_0x297c('0x43')]);var _0x5c6eb8=_[_0x297c('0x44')](_0x15ecac,function(_0x2744d5){return _0x2744d5['id']['toString']();});var _0x56be7e=_[_0x297c('0x45')](_0x15ecac,function(_0x403350){return _0x403350['id'][_0x297c('0x46')]();});var _0x2abf2b=_0x5ad1a7?_0x5c6eb8:_[_0x297c('0x47')](_0x5c6eb8,_0x2c436b);var _0x25f59b=_[_0x297c('0x48')](_0x5c6eb8,_0x2c436b);var _0x23830d=_[_0x297c('0x47')](_0x2c436b,_0x5c6eb8);var _0x122abd;var _0x16e01c;for(_0x122abd=0x0;_0x122abd<_0x23830d['length']&&!_0x5ad1a7;_0x122abd+=0x1){_0x16e01c=_0x23830d[_0x122abd][_0x297c('0x46')]();if(manager['exists'](_0x16e01c)){manager[_0x297c('0x49')](_0x16e01c);manager[_0x297c('0x4a')](_0x16e01c);logger[_0x297c('0xb')](_0x297c('0x4b'),_0x16e01c);}}logger[_0x297c('0xb')](_0x297c('0x4c'),JSON[_0x297c('0x28')](_0x2abf2b));for(_0x122abd=0x0;_0x122abd<_0x2abf2b[_0x297c('0x4d')];_0x122abd+=0x1){_0x16e01c=_0x2abf2b[_0x122abd]['toString']();logger['info'](_0x297c('0x4e'),_0x16e01c);if(_0x5ad1a7){logger['info'](_0x297c('0x4f'),_0x5ad1a7);logger[_0x297c('0xb')](JSON[_0x297c('0x28')](_0x56be7e[_0x16e01c]));BPromise['resolve']()[_0x297c('0x50')](handleJob(_0x56be7e[_0x16e01c]));logger[_0x297c('0xb')]('run\x20job',_0x56be7e[_0x16e01c][_0x297c('0x19')],_0x56be7e[_0x16e01c][_0x297c('0x51')]);}else if(_0x56be7e[_0x16e01c]['cron']&&_0x56be7e[_0x16e01c][_0x297c('0x52')]&&moment()[_0x297c('0x53')](_0x56be7e[_0x16e01c]['startAt'],_0x56be7e[_0x16e01c]['endAt'])){manager['add'](_0x16e01c,_0x56be7e[_0x16e01c]['cron'],handleJob(_0x56be7e[_0x16e01c]));manager['start'](_0x16e01c);logger[_0x297c('0xb')](_0x297c('0x54'),_0x56be7e[_0x16e01c][_0x297c('0x19')],_0x56be7e[_0x16e01c]['cron']);}else if(manager[_0x297c('0x55')](_0x16e01c)){manager[_0x297c('0x49')](_0x16e01c);manager[_0x297c('0x4a')](_0x16e01c);logger[_0x297c('0xb')](_0x297c('0x56'),_0x56be7e[_0x16e01c][_0x297c('0x19')],_0x56be7e[_0x16e01c][_0x297c('0x51')]);}}for(_0x122abd=0x0,_0x16e01c;_0x122abd<_0x25f59b[_0x297c('0x4d')]&&!_0x5ad1a7;_0x122abd+=0x1){_0x16e01c=_0x25f59b[_0x122abd][_0x297c('0x46')]();if(manager[_0x297c('0x55')](_0x16e01c)){if(_0x56be7e[_0x16e01c]['cron']&&_0x56be7e[_0x16e01c][_0x297c('0x52')]&&moment()[_0x297c('0x53')](_0x56be7e[_0x16e01c][_0x297c('0x57')],_0x56be7e[_0x16e01c][_0x297c('0x58')])){manager[_0x297c('0x59')](_0x16e01c,_0x56be7e[_0x16e01c][_0x297c('0x51')],handleJob(_0x56be7e[_0x16e01c]));logger['info'](_0x297c('0x5a'),_0x56be7e[_0x16e01c][_0x297c('0x19')],_0x56be7e[_0x16e01c][_0x297c('0x51')]);}else{manager['stop'](_0x16e01c);manager[_0x297c('0x4a')](_0x16e01c);logger[_0x297c('0xb')]('stop\x20cron',_0x56be7e[_0x16e01c]['name'],_0x56be7e[_0x16e01c]['cron']);}}}})[_0x297c('0x3b')](function(_0x444e52){logger['error'](JSON[_0x297c('0x28')](_0x444e52));});}exports['run']=function(_0x18a079){return getJobs(_0x18a079);};exports[_0x297c('0x5b')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +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 diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 75e3626..4993c9c 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 _0x7b1a=['IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','error','start','lodash','aws-sdk','request-promise','bluebird','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','transcribeName','data1','data2','transcribeRegion','then','format','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','info','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','bucket','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Negative','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','Transcript\x20not\x20available','catch','name','inspect','VoiceRecording'];(function(_0x30f86d,_0x1873f2){var _0x43ee30=function(_0x59ac4c){while(--_0x59ac4c){_0x30f86d['push'](_0x30f86d['shift']());}};_0x43ee30(++_0x1873f2);}(_0x7b1a,0x95));var _0xa7b1=function(_0x260a4a,_0x6d7c5b){_0x260a4a=_0x260a4a-0x0;var _0x4f990c=_0x7b1a[_0x260a4a];return _0x4f990c;};var _=require(_0xa7b1('0x0'));var AWS=require(_0xa7b1('0x1'));var rp=require(_0xa7b1('0x2'));var util=require('util');var BPromise=require(_0xa7b1('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xa7b1('0x4'))(_0xa7b1('0x5'));function getTranscriptionJob(_0x12b77d,_0x50e88f,_0x3d7aa4,_0x1f4e0e){return new Promise(function(_0x2ba144,_0x4e5556){var _0x1bd457=new AWS[(_0xa7b1('0x6'))]({'accessKeyId':_0x50e88f,'secretAccessKey':_0x12b77d,'region':_0x3d7aa4});_0x1bd457[_0xa7b1('0x7')]({'TranscriptionJobName':_0x1f4e0e},function(_0x1d75e7,_0x5256d5){if(_0x1d75e7){return _0x4e5556(_0x1d75e7);}else{return _0x2ba144(_0x5256d5);}});});}function sentiment(_0x8b15a1,_0x1b6f50,_0x33ca94,_0x47ebb2,_0x5041c4){return new Promise(function(_0xe9d0bd,_0x2e3e98){var _0x2cfc52=new AWS[(_0xa7b1('0x8'))]({'accessKeyId':_0x1b6f50,'secretAccessKey':_0x8b15a1,'region':_0x33ca94});_0x2cfc52[_0xa7b1('0x9')]({'Text':_0x47ebb2,'LanguageCode':_0x5041c4[_0xa7b1('0xa')](0x0,0x2)},function(_0x3ef6e1,_0x2045f8){if(_0x3ef6e1){return _0x2e3e98(_0x3ef6e1);}else{return _0xe9d0bd(_0x2045f8);}});});}function checkTranscribeJob(_0x2d627c,_0x5c2fc5,_0x3deebb){var _0x12db94;return new BPromise(function(_0x1da49f,_0x45677b){logger['info'](util['format']('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x2d627c['id'],_0x2d627c[_0xa7b1('0xb')]));return getTranscriptionJob(_0x3deebb[_0xa7b1('0xc')],_0x3deebb[_0xa7b1('0xd')],_0x5c2fc5[_0xa7b1('0xe')],_0x2d627c[_0xa7b1('0xb')])[_0xa7b1('0xf')](function(_0x4a9fb9){logger['info'](util[_0xa7b1('0x10')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x2d627c['id'],_0x2d627c[_0xa7b1('0xb')],_0x4a9fb9[_0xa7b1('0x11')][_0xa7b1('0x12')]));if(!_0x2d627c[_0xa7b1('0x13')]){switch(_0x4a9fb9[_0xa7b1('0x11')][_0xa7b1('0x12')]){case _0xa7b1('0x14'):var _0x1ff3b3={'transcribeStatus':_0x4a9fb9[_0xa7b1('0x11')]['TranscriptionJobStatus'],'fileUri':_0x4a9fb9[_0xa7b1('0x11')][_0xa7b1('0x15')][_0xa7b1('0x16')]};logger[_0xa7b1('0x17')](util[_0xa7b1('0x10')](_0xa7b1('0x18'),_0x2d627c['id']));return rp({'uri':_0x4a9fb9[_0xa7b1('0x11')]['Transcript'][_0xa7b1('0x16')],'json':!![]})[_0xa7b1('0xf')](function(_0x1ce541){logger[_0xa7b1('0x17')](util[_0xa7b1('0x10')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x2d627c['id']));if(_0x1ce541&&_0x1ce541[_0xa7b1('0x19')]&&_0x1ce541[_0xa7b1('0x19')][_0xa7b1('0x1a')]&&_0x1ce541[_0xa7b1('0x19')][_0xa7b1('0x1a')][_0xa7b1('0x1b')]){_0x1ff3b3[_0xa7b1('0x13')]='';for(var _0x1a2faa=0x0;_0x1a2faa<_0x1ce541[_0xa7b1('0x19')][_0xa7b1('0x1a')]['length'];_0x1a2faa++){_0x1ff3b3[_0xa7b1('0x13')]+=_0x1ce541[_0xa7b1('0x19')][_0xa7b1('0x1a')][_0x1a2faa][_0xa7b1('0x1c')]+'';}}return _0x2d627c[_0xa7b1('0x1d')](_0x1ff3b3);})[_0xa7b1('0xf')](function(){logger[_0xa7b1('0x17')](util['format'](_0xa7b1('0x1e'),_0x2d627c['id']));if(!_0x2d627c['tempSentiment']){throw new db['Sequelize']['ValidationError'](_0xa7b1('0x1f'));}if(!_0x5c2fc5[_0xa7b1('0x20')]||!_0x5c2fc5[_0xa7b1('0x21')]||!_0x5c2fc5[_0xa7b1('0x22')]||!_0x5c2fc5['language']||!_0x5c2fc5[_0xa7b1('0x23')]){throw new db[(_0xa7b1('0x24'))][(_0xa7b1('0x25'))](_0xa7b1('0x26'));}if(!_0x1ff3b3['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x5c2fc5[_0xa7b1('0x21')]===_0x3deebb['id']){return _0x3deebb;}else{return db[_0xa7b1('0x27')][_0xa7b1('0x28')]({'where':{'id':_settings[_0xa7b1('0x21')]}});}})[_0xa7b1('0xf')](function(_0x4506c2){if(!_0x4506c2){throw new db[(_0xa7b1('0x24'))][(_0xa7b1('0x25'))](_0xa7b1('0x29'));}if(!_0x4506c2[_0xa7b1('0xc')]||!_0x4506c2[_0xa7b1('0xd')]){throw new db[(_0xa7b1('0x24'))][(_0xa7b1('0x25'))](_0xa7b1('0x2a'));}_0x12db94=_0x4506c2;logger[_0xa7b1('0x17')](util[_0xa7b1('0x10')](_0xa7b1('0x2b'),_0x2d627c['id']));return sentiment(_0x12db94[_0xa7b1('0xc')],_0x12db94[_0xa7b1('0xd')],_0x5c2fc5['sentimentRegion'],_0x1ff3b3[_0xa7b1('0x13')],_0x5c2fc5[_0xa7b1('0x2c')]);})['then'](function(_0x4d49c3){logger[_0xa7b1('0x17')](util[_0xa7b1('0x10')](_0xa7b1('0x2d'),_0x2d627c['id']));return _0x2d627c[_0xa7b1('0x1d')]({'sentiment':_0x4d49c3[_0xa7b1('0x2e')],'sPositive':_0x4d49c3['SentimentScore'][_0xa7b1('0x2f')],'sNegative':_0x4d49c3[_0xa7b1('0x30')][_0xa7b1('0x31')],'sMixed':_0x4d49c3[_0xa7b1('0x30')][_0xa7b1('0x32')],'sNeutral':_0x4d49c3['SentimentScore']['Neutral']});})[_0xa7b1('0xf')](function(){logger[_0xa7b1('0x17')](util[_0xa7b1('0x10')](_0xa7b1('0x1e'),_0x2d627c['id']));_0x1da49f();});case _0xa7b1('0x33'):return _0x2d627c[_0xa7b1('0x1d')]({'transcribeStatus':'FAILED','failureReason':_0x4a9fb9['TranscriptionJob'][_0xa7b1('0x34')]})[_0xa7b1('0xf')](function(){logger['info'](util[_0xa7b1('0x10')](_0xa7b1('0x1e'),_0x2d627c['id']));_0x1da49f();});default:logger[_0xa7b1('0x17')](util['format'](_0xa7b1('0x35'),_0x2d627c['id']));break;}}else{return BPromise[_0xa7b1('0x36')]()[_0xa7b1('0xf')](function(){if(!_0x2d627c[_0xa7b1('0x37')]){throw new db[(_0xa7b1('0x24'))]['ValidationError'](_0xa7b1('0x1f'));}if(!_0x5c2fc5['sentiment']||!_0x5c2fc5[_0xa7b1('0x21')]||!_0x5c2fc5[_0xa7b1('0x22')]||!_0x5c2fc5[_0xa7b1('0x2c')]||!_0x5c2fc5[_0xa7b1('0x23')]){throw new db['Sequelize'][(_0xa7b1('0x25'))](_0xa7b1('0x26'));}if(!_0x2d627c[_0xa7b1('0x13')]){throw new Error(_0xa7b1('0x38'));}if(_0x5c2fc5[_0xa7b1('0x21')]===_0x3deebb['id']){return _0x3deebb;}else{return db[_0xa7b1('0x27')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0xa7b1('0xf')](function(_0x4c8e86){if(!_0x4c8e86){throw new db[(_0xa7b1('0x24'))][(_0xa7b1('0x25'))](_0xa7b1('0x29'));}if(!_0x4c8e86[_0xa7b1('0xc')]||!_0x4c8e86[_0xa7b1('0xd')]){throw new db['Sequelize'][(_0xa7b1('0x25'))]('Cloud\x20Provider\x20not\x20configured');}_0x12db94=_0x4c8e86;logger[_0xa7b1('0x17')](util[_0xa7b1('0x10')](_0xa7b1('0x2b'),_0x2d627c['id']));return sentiment(_0x12db94['data1'],_0x12db94[_0xa7b1('0xd')],_0x5c2fc5[_0xa7b1('0x22')],_0x2d627c[_0xa7b1('0x13')],_0x5c2fc5[_0xa7b1('0x2c')]);})[_0xa7b1('0xf')](function(_0x51c986){logger[_0xa7b1('0x17')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x2d627c['id']));return _0x2d627c[_0xa7b1('0x1d')]({'sentiment':_0x51c986[_0xa7b1('0x2e')],'sPositive':_0x51c986['SentimentScore'][_0xa7b1('0x2f')],'sNegative':_0x51c986[_0xa7b1('0x30')][_0xa7b1('0x31')],'sMixed':_0x51c986['SentimentScore'][_0xa7b1('0x32')],'sNeutral':_0x51c986[_0xa7b1('0x30')]['Neutral'],'transcribeStatus':_0xa7b1('0x14')});})[_0xa7b1('0xf')](function(){logger['info'](util[_0xa7b1('0x10')](_0xa7b1('0x1e'),_0x2d627c['id']));_0x1da49f();});}})[_0xa7b1('0x39')](function(_0x44d316){if(_0x44d316){if(!_0x44d316[_0xa7b1('0x3a')]||_0x44d316[_0xa7b1('0x3a')]!=='SequelizeValidationError'){logger['error'](util['format']('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x2d627c['id']),util[_0xa7b1('0x3b')](_0x44d316,{'showHidden':![],'depth':null}));}}_0x1da49f();});});}function checkTranscribe(){var _0x25b972;var _0x5bd579;var _0x36231b;return db[_0xa7b1('0x3c')]['findAll']({'where':{'transcribeStatus':_0xa7b1('0x3d')}})['then'](function(_0xc76b02){if(!_0xc76b02||!_0xc76b02[_0xa7b1('0x1b')]){throw new db['Sequelize'][(_0xa7b1('0x25'))](_0xa7b1('0x3e'));}_0x25b972=_0xc76b02;return db[_0xa7b1('0x3f')][_0xa7b1('0x28')]({'where':{'id':0x1}});})[_0xa7b1('0xf')](function(_0x5b0dc5){if(!_0x5b0dc5){throw new db['Sequelize']['ValidationError']('Settings\x20not\x20available');}_0x5bd579=_0x5b0dc5;if(!_0x5bd579['transcribe']||!_0x5bd579[_0xa7b1('0x40')]||!_0x5bd579[_0xa7b1('0xe')]||!_0x5bd579[_0xa7b1('0x2c')]||!_0x5bd579[_0xa7b1('0x23')]){throw new db[(_0xa7b1('0x24'))][(_0xa7b1('0x25'))](_0xa7b1('0x41'));}return db[_0xa7b1('0x27')][_0xa7b1('0x28')]({'where':{'id':_0x5bd579[_0xa7b1('0x40')]}});})[_0xa7b1('0xf')](function(_0x42c922){if(!_0x42c922){throw new db['Sequelize'][(_0xa7b1('0x25'))](_0xa7b1('0x29'));}if(!_0x42c922[_0xa7b1('0xc')]||!_0x42c922['data2']){throw new db[(_0xa7b1('0x24'))]['ValidationError'](_0xa7b1('0x2a'));}_0x36231b=_0x42c922;var _0x561a96=[];_0x25b972[_0xa7b1('0x42')](function(_0x158986){_0x561a96[_0xa7b1('0x43')](checkTranscribeJob(_0x158986,_0x5bd579,_0x36231b));});return BPromise['all'](_0x561a96);})[_0xa7b1('0x39')](function(_0x12aa0d){if(_0x12aa0d){if(!_0x12aa0d['name']||_0x12aa0d['name']!=='SequelizeValidationError'){logger[_0xa7b1('0x44')](util[_0xa7b1('0x3b')](_0x12aa0d,{'showHidden':![],'depth':null}));}}});}exports[_0xa7b1('0x45')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +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 diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 2666509..9c40690 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x10e7=['then','finished\x20populating','contacts1','CmHopper','log','hopper1','bulkCreate','contacts2','hopper2','util','../mysqldb','Innocenzo','innocenzo.biondo','@xcally.com','push','now','Biondo','destroy','CmContact'];(function(_0x471002,_0x50a981){var _0x3b4051=function(_0x3d3928){while(--_0x3d3928){_0x471002['push'](_0x471002['shift']());}};_0x3b4051(++_0x50a981);}(_0x10e7,0x139));var _0x710e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x10e7[_0x501510];return _0x1e6ee5;};'use strict';var util=require(_0x710e('0x0'));var db=require(_0x710e('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x710e('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x710e('0x3')+i+_0x710e('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x710e('0x5')]({'id':i,'active':![],'scheduledat':Date[_0x710e('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x710e('0x2')+i,'lastName':_0x710e('0x7')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x710e('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x710e('0x5')]({'id':i,'active':![],'scheduledat':Date[_0x710e('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x710e('0x6')](),'updatedAt':Date[_0x710e('0x6')]()});}db['CmContact'][_0x710e('0x8')]({'where':{}})['then'](function(){return db[_0x710e('0x9')]['bulkCreate'](contacts);})[_0x710e('0xa')](function(){console['log'](_0x710e('0xb'),_0x710e('0xc'));return db['CmHopper'][_0x710e('0x8')]({'where':{}});})[_0x710e('0xa')](function(){return db[_0x710e('0xd')]['bulkCreate'](hopper);})['then'](function(){console[_0x710e('0xe')](_0x710e('0xb'),_0x710e('0xf'));return db['CmContact'][_0x710e('0x10')](contacts2);})[_0x710e('0xa')](function(){console[_0x710e('0xe')](_0x710e('0xb'),_0x710e('0x11'));return db[_0x710e('0xd')][_0x710e('0x10')](hopper2);})[_0x710e('0xa')](function(){console[_0x710e('0xe')](_0x710e('0xb'),_0x710e('0x12'));})['catch'](function(_0x4ae1a6){console['log'](_0x4ae1a6);}); \ No newline at end of file +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 diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index f53ec48..056c85b 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1d02=['util','../mysqldb','format','%s%s','agent','%s%s@xcally.com','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','\x22%s\x22\x20<%s>','User','bulkCreate','then','add\x20user','catch','log'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x1d02,0x12c));var _0x21d0=function(_0xfaae2d,_0x526888){_0xfaae2d=_0xfaae2d-0x0;var _0x51f77a=_0x1d02[_0xfaae2d];return _0x51f77a;};'use strict';var util=require(_0x21d0('0x0'));var db=require(_0x21d0('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x21d0('0x2')](_0x21d0('0x3'),_0x21d0('0x4'),i),'fullname':util[_0x21d0('0x2')](_0x21d0('0x3'),_0x21d0('0x4'),i),'email':util[_0x21d0('0x2')](_0x21d0('0x5'),'agent',i),'role':'agent','password':'password','internal':0xfa0+i,'type':_0x21d0('0x6'),'transport':[_0x21d0('0x7'),'ws',_0x21d0('0x8')],'disallow':[_0x21d0('0x9')],'allow':[_0x21d0('0xa')],'defaultuser':util[_0x21d0('0x2')]('%s%s',_0x21d0('0x4'),i),'encryption':_0x21d0('0xb'),'avpf':_0x21d0('0xb'),'force_avp':_0x21d0('0xb'),'icesupport':'yes','dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x21d0('0xc'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util[_0x21d0('0x2')](_0x21d0('0xd'),util[_0x21d0('0x2')]('%s%s',_0x21d0('0x4'),i),0xfa0+i)});}db[_0x21d0('0xe')][_0x21d0('0xf')](users)[_0x21d0('0x10')](function(){console['log'](_0x21d0('0x11'));})[_0x21d0('0x12')](function(_0x1abdfa){console[_0x21d0('0x13')](_0x1abdfa);}); \ No newline at end of file +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 diff --git a/server/config/socketio.js b/server/config/socketio.js index c7d9627..024a699 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcfa6=['getMailQueues','all','voice','fax','sms','telephone:%s','trunk:%s','leave','map','ChatInteractions','removeChatInteractions','emit','MailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','log','join','default','setMaxListeners','address','connection','request','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','lodash','util','bluebird','../mysqldb','name','User','role','agent','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','SmsQueues','MailQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','Campaign','where','type','ivr','format','%s:queue:%s','Agents','length','user:%s','handshake','query','find','ChatInteraction','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','push','VoiceQueue','MailQueue','OpenchannelQueue','Trunk','userProfileId','ChatQueue','FaxQueues','FaxQueue','SmsQueue','OpenchannelQueues','getVoiceQueues','getChatQueues','getSmsQueues'];(function(_0x441f7a,_0x576321){var _0x4821da=function(_0x5c5b52){while(--_0x5c5b52){_0x441f7a['push'](_0x441f7a['shift']());}};_0x4821da(++_0x576321);}(_0xcfa6,0xcd));var _0x6cfa=function(_0x56e654,_0x5625c){_0x56e654=_0x56e654-0x0;var _0x237130=_0xcfa6[_0x56e654];return _0x237130;};'use strict';var _=require(_0x6cfa('0x0'));var util=require(_0x6cfa('0x1'));var BPromise=require(_0x6cfa('0x2'));var db=require(_0x6cfa('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x6cfa('0x4')],'include':[{'as':'Agents','model':db[_0x6cfa('0x5')],'attributes':['id',_0x6cfa('0x4'),_0x6cfa('0x6')],'raw':!![],'where':{'role':_0x6cfa('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x6cfa('0x4')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x6cfa('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x6cfa('0x4'),'type'],'where':{'type':'ivr'}};function getAssociatedResources(_0x5357ad,_0x2016f0,_0x4c5f8b){return db[_0x6cfa('0x8')][_0x6cfa('0x9')]({'where':{'name':_0x5357ad,'userProfileId':_0x2016f0},'raw':!![]})[_0x6cfa('0xa')](function(_0x56bb95){if(_0x56bb95){if(_0x56bb95[_0x6cfa('0xb')]){switch(_0x5357ad){case _0x6cfa('0xc'):case _0x6cfa('0xd'):case'FaxQueues':case _0x6cfa('0xe'):case _0x6cfa('0xf'):case'OpenchannelQueues':return db[_0x4c5f8b][_0x6cfa('0x10')](queryQueues);case _0x6cfa('0x11'):return db[_0x4c5f8b][_0x6cfa('0x10')](queryTelephones);case _0x6cfa('0x12'):return db[_0x4c5f8b][_0x6cfa('0x10')](queryTrunks);case _0x6cfa('0x13'):return db[_0x4c5f8b]['findAll'](queryCampaigns);}}else{return db[_0x6cfa('0x14')]['findAll']({'attributes':[_0x6cfa('0x15')],'where':{'sectionId':_0x56bb95['id']},'raw':!![]})[_0x6cfa('0xa')](function(_0x4ee1e9){if(_0x4ee1e9){var _0x5ad739={'where':{'id':_['map'](_0x4ee1e9,_0x6cfa('0x15'))},'raw':!![]};switch(_0x4c5f8b){case _0x6cfa('0x5'):_0x5ad739['where'][_0x6cfa('0x6')]='telephone';break;case _0x6cfa('0x16'):_0x5ad739[_0x6cfa('0x17')][_0x6cfa('0x18')]=_0x6cfa('0x19');break;}return db[_0x4c5f8b][_0x6cfa('0x10')](_0x5ad739);}else{return[];}});}}else{return[];}})['then'](function(_0x520af2){return _0x520af2;});}function joinOrLeaveQueues(_0x114a62,_0x53b141,_0x997e59,_0x193cec){_0x114a62[_0x53b141](util[_0x6cfa('0x1a')](_0x6cfa('0x1b'),_0x997e59,_0x193cec['name']));if(_0x193cec[_0x6cfa('0x1c')]){for(var _0x419ce1=0x0;_0x419ce1<_0x193cec[_0x6cfa('0x1c')][_0x6cfa('0x1d')];_0x419ce1+=0x1){_0x114a62[_0x53b141](util[_0x6cfa('0x1a')](_0x6cfa('0x1e'),_0x193cec[_0x6cfa('0x1c')][_0x419ce1]['name']));}}}function joinOrLeave(_0x5da684,_0x282691,_0x34ba21){var _0x37bb2e;if(_0x5da684[_0x6cfa('0x1f')][_0x6cfa('0x20')]['id']){db[_0x6cfa('0x5')][_0x6cfa('0x21')]({'attributes':['id',_0x6cfa('0x4'),_0x6cfa('0x6'),'userProfileId'],'where':{'id':_0x5da684['handshake'][_0x6cfa('0x20')]['id']},'include':[{'model':db[_0x6cfa('0x22')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x6cfa('0x23')],'as':_0x6cfa('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x6cfa('0x25')],'as':_0x6cfa('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x6cfa('0x27')],'as':_0x6cfa('0x28'),'attributes':['id'],'raw':!![]}]})[_0x6cfa('0xa')](function(_0x14a1bf){if(_0x14a1bf){_0x37bb2e=_0x14a1bf;_0x5da684[_0x282691](util[_0x6cfa('0x1a')](_0x6cfa('0x1e'),_0x14a1bf[_0x6cfa('0x4')]));var _0x25fa8d=[];switch(_0x14a1bf[_0x6cfa('0x6')]){case _0x6cfa('0x29'):_0x5da684[_0x282691](_0x6cfa('0x2a'));_0x5da684[_0x282691](_0x6cfa('0x2b'));if(queryQueues[_0x6cfa('0x2c')]('include')){delete queryQueues['include'];}_0x25fa8d[_0x6cfa('0x2d')](db[_0x6cfa('0x2e')][_0x6cfa('0x10')](queryQueues));_0x25fa8d[_0x6cfa('0x2d')](db['ChatQueue'][_0x6cfa('0x10')](queryQueues));_0x25fa8d[_0x6cfa('0x2d')](db['FaxQueue'][_0x6cfa('0x10')](queryQueues));_0x25fa8d[_0x6cfa('0x2d')](db['SmsQueue'][_0x6cfa('0x10')](queryQueues));_0x25fa8d['push'](db[_0x6cfa('0x2f')][_0x6cfa('0x10')](queryQueues));_0x25fa8d[_0x6cfa('0x2d')](db[_0x6cfa('0x30')][_0x6cfa('0x10')](queryQueues));_0x25fa8d[_0x6cfa('0x2d')](db['User'][_0x6cfa('0x10')](queryTelephones));_0x25fa8d['push'](db[_0x6cfa('0x31')][_0x6cfa('0x10')](queryTrunks));_0x25fa8d['push'](db[_0x6cfa('0x16')][_0x6cfa('0x10')](queryCampaigns));_0x25fa8d[_0x6cfa('0x2d')](db['User']['findAll'](queryAgents));break;case'user':_0x5da684[_0x282691](_0x6cfa('0x2a'));_0x5da684[_0x282691](_0x6cfa('0x2b'));_0x25fa8d['push'](getAssociatedResources(_0x6cfa('0xc'),_0x14a1bf[_0x6cfa('0x32')],_0x6cfa('0x2e')));_0x25fa8d['push'](getAssociatedResources(_0x6cfa('0xd'),_0x14a1bf[_0x6cfa('0x32')],_0x6cfa('0x33')));_0x25fa8d[_0x6cfa('0x2d')](getAssociatedResources(_0x6cfa('0x34'),_0x14a1bf[_0x6cfa('0x32')],_0x6cfa('0x35')));_0x25fa8d[_0x6cfa('0x2d')](getAssociatedResources(_0x6cfa('0xe'),_0x14a1bf[_0x6cfa('0x32')],_0x6cfa('0x36')));_0x25fa8d['push'](getAssociatedResources('MailQueues',_0x14a1bf[_0x6cfa('0x32')],_0x6cfa('0x2f')));_0x25fa8d[_0x6cfa('0x2d')](getAssociatedResources(_0x6cfa('0x37'),_0x14a1bf[_0x6cfa('0x32')],_0x6cfa('0x30')));_0x25fa8d[_0x6cfa('0x2d')](getAssociatedResources(_0x6cfa('0x11'),_0x14a1bf['userProfileId'],_0x6cfa('0x5')));_0x25fa8d[_0x6cfa('0x2d')](getAssociatedResources(_0x6cfa('0x12'),_0x14a1bf[_0x6cfa('0x32')],_0x6cfa('0x31')));_0x25fa8d[_0x6cfa('0x2d')](getAssociatedResources(_0x6cfa('0x13'),_0x14a1bf[_0x6cfa('0x32')],_0x6cfa('0x16')));_0x25fa8d[_0x6cfa('0x2d')](db['User'][_0x6cfa('0x10')](queryAgents));break;case'agent':_0x5da684[_0x282691](_0x6cfa('0x2a'));_0x5da684[_0x282691](_0x6cfa('0x2b'));_0x25fa8d['push'](_0x14a1bf[_0x6cfa('0x38')]({'attributes':['id',_0x6cfa('0x4')]}));_0x25fa8d['push'](_0x14a1bf[_0x6cfa('0x39')]({'attributes':['id','name']}));_0x25fa8d[_0x6cfa('0x2d')](_0x14a1bf['getFaxQueues']({'attributes':['id',_0x6cfa('0x4')]}));_0x25fa8d[_0x6cfa('0x2d')](_0x14a1bf[_0x6cfa('0x3a')]({'attributes':['id',_0x6cfa('0x4')]}));_0x25fa8d['push'](_0x14a1bf[_0x6cfa('0x3b')]({'attributes':['id',_0x6cfa('0x4')]}));_0x25fa8d['push'](_0x14a1bf['getOpenchannelQueues']({'attributes':['id',_0x6cfa('0x4')]}));break;}return BPromise[_0x6cfa('0x3c')](_0x25fa8d);}})[_0x6cfa('0xa')](function(_0x28c055){if(_0x28c055&&_0x28c055['length']){for(var _0x276369=0x0;_0x276369<_0x28c055[_0x6cfa('0x1d')];_0x276369+=0x1){for(var _0x34fb1f=0x0;_0x34fb1f<_0x28c055[_0x276369]['length'];_0x34fb1f+=0x1){switch(_0x276369){case 0x0:joinOrLeaveQueues(_0x5da684,_0x282691,_0x6cfa('0x3d'),_0x28c055[_0x276369][_0x34fb1f]);break;case 0x1:joinOrLeaveQueues(_0x5da684,_0x282691,'chat',_0x28c055[_0x276369][_0x34fb1f]);break;case 0x2:joinOrLeaveQueues(_0x5da684,_0x282691,_0x6cfa('0x3e'),_0x28c055[_0x276369][_0x34fb1f]);break;case 0x3:joinOrLeaveQueues(_0x5da684,_0x282691,_0x6cfa('0x3f'),_0x28c055[_0x276369][_0x34fb1f]);break;case 0x4:joinOrLeaveQueues(_0x5da684,_0x282691,'mail',_0x28c055[_0x276369][_0x34fb1f]);break;case 0x5:joinOrLeaveQueues(_0x5da684,_0x282691,'openchannel',_0x28c055[_0x276369][_0x34fb1f]);break;case 0x6:_0x5da684[_0x282691](util[_0x6cfa('0x1a')](_0x6cfa('0x40'),_0x28c055[_0x276369][_0x34fb1f]['name']));break;case 0x7:_0x5da684[_0x282691](util[_0x6cfa('0x1a')](_0x6cfa('0x41'),_0x28c055[_0x276369][_0x34fb1f][_0x6cfa('0x4')]));break;case 0x8:_0x5da684[_0x282691](util[_0x6cfa('0x1a')]('campaign:%s:%s',_0x28c055[_0x276369][_0x34fb1f]['type'],_0x28c055[_0x276369][_0x34fb1f][_0x6cfa('0x4')]));break;case 0x9:_0x5da684[_0x282691](util['format'](_0x6cfa('0x1e'),_0x28c055[_0x276369][_0x34fb1f]['name']));break;}}}}})[_0x6cfa('0xa')](function(){if(_0x282691===_0x6cfa('0x42')){var _0x15b7c7=_[_0x6cfa('0x43')](_0x37bb2e[_0x6cfa('0x44')],'id');return _0x37bb2e[_0x6cfa('0x45')](_0x15b7c7)[_0x6cfa('0xa')](function(){for(var _0x51fafa=0x0;_0x51fafa<_0x15b7c7[_0x6cfa('0x1d')];_0x51fafa+=0x1){_0x34ba21[_0x6cfa('0x46')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x15b7c7[_0x51fafa]),'UserId':Number(_0x37bb2e['id'])});}});}})[_0x6cfa('0xa')](function(){if(_0x282691===_0x6cfa('0x42')){var _0x5771e1=_[_0x6cfa('0x43')](_0x37bb2e[_0x6cfa('0x47')],'id');return _0x37bb2e['removeMailInteractions'](_0x5771e1)[_0x6cfa('0xa')](function(){for(var _0x17daaa=0x0;_0x17daaa<_0x5771e1['length'];_0x17daaa+=0x1){_0x34ba21[_0x6cfa('0x46')](_0x6cfa('0x48'),{'MailInteractionId':Number(_0x5771e1[_0x17daaa]),'UserId':Number(_0x37bb2e['id'])});}});}})[_0x6cfa('0xa')](function(){if(_0x282691==='leave'){var _0x457320=_[_0x6cfa('0x43')](_0x37bb2e[_0x6cfa('0x24')],'id');return _0x37bb2e[_0x6cfa('0x49')](_0x457320)[_0x6cfa('0xa')](function(){for(var _0x5185fb=0x0;_0x5185fb<_0x457320[_0x6cfa('0x1d')];_0x5185fb+=0x1){_0x34ba21[_0x6cfa('0x46')](_0x6cfa('0x4a'),{'FaxInteractionId':Number(_0x457320[_0x5185fb]),'UserId':Number(_0x37bb2e['id'])});}});}})[_0x6cfa('0xa')](function(){if(_0x282691==='leave'){var _0x34bd5f=_[_0x6cfa('0x43')](_0x37bb2e[_0x6cfa('0x26')],'id');return _0x37bb2e['removeSmsInteractions'](_0x34bd5f)[_0x6cfa('0xa')](function(){for(var _0x3959ab=0x0;_0x3959ab<_0x34bd5f[_0x6cfa('0x1d')];_0x3959ab+=0x1){_0x34ba21[_0x6cfa('0x46')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x34bd5f[_0x3959ab]),'UserId':Number(_0x37bb2e['id'])});}});}})['then'](function(){if(_0x282691===_0x6cfa('0x42')){var _0xb4666f=_[_0x6cfa('0x43')](_0x37bb2e[_0x6cfa('0x28')],'id');return _0x37bb2e['removeOpenchannelInteractions'](_0xb4666f)[_0x6cfa('0xa')](function(){for(var _0x119a1e=0x0;_0x119a1e<_0xb4666f[_0x6cfa('0x1d')];_0x119a1e+=0x1){_0x34ba21[_0x6cfa('0x46')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0xb4666f[_0x119a1e]),'UserId':Number(_0x37bb2e['id'])});}});}})['catch'](function(_0x1c7374){_0x5da684[_0x6cfa('0x4b')](_0x1c7374);});}}function onDisconnect(_0x5d7cf6,_0x5723a1){joinOrLeave(_0x5d7cf6,_0x6cfa('0x42'),_0x5723a1);}function onConnect(_0x527159){joinOrLeave(_0x527159,_0x6cfa('0x4c'));}exports[_0x6cfa('0x4d')]=function(_0x2d3d8e){_0x2d3d8e['on']('connection',function(_0x3a7298){_0x3a7298[_0x6cfa('0x4e')](0x0);_0x3a7298[_0x6cfa('0x4f')]=_0x3a7298['request'][_0x6cfa('0x50')]['remoteAddress']+':'+_0x3a7298[_0x6cfa('0x51')][_0x6cfa('0x50')][_0x6cfa('0x52')];_0x3a7298[_0x6cfa('0x53')]=new Date();_0x3a7298[_0x6cfa('0x4b')]=function(_0x8c943a){console[_0x6cfa('0x4b')](_0x6cfa('0x54')+_0x3a7298[_0x6cfa('0x55')][_0x6cfa('0x4')]+'['+_0x3a7298[_0x6cfa('0x4f')]+']',_0x8c943a);};_0x3a7298['on'](_0x6cfa('0x56'),function(){onDisconnect(_0x3a7298,_0x2d3d8e);_0x3a7298[_0x6cfa('0x4b')](_0x6cfa('0x57'));});onConnect(_0x3a7298);_0x3a7298['log']('CONNECTED');});}; \ No newline at end of file +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 diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index b587046..dca1bc8 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 _0x83a0=['interface','SIP/%s','incomingmessage','outgoingmessage','opened','changed','closed','User','format','default','model','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','Sms','SmsInteraction','Fax','FaxInteraction','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','code','catch','get','channel','event','find','UserId','name'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x83a0,0x181));var _0x083a=function(_0x5f6d1c,_0x3177e7){_0x5f6d1c=_0x5f6d1c-0x0;var _0x40f048=_0x83a0[_0x5f6d1c];return _0x40f048;};'use strict';var util=require(_0x083a('0x0'));var db=require(_0x083a('0x1'))['db'];var jayson=require(_0x083a('0x2'));var logger=require(_0x083a('0x3'))(_0x083a('0x4'));var client=jayson[_0x083a('0x5')][_0x083a('0x6')]({'port':0x232a});var triggers=[{'channel':_0x083a('0x7'),'model':_0x083a('0x8'),'event':_0x083a('0x9'),'condition':_0x083a('0xa'),'callback':afterCreate},{'channel':_0x083a('0x7'),'model':'ChatInteraction','event':_0x083a('0xb'),'condition':_0x083a('0xc'),'callback':afterUpdate},{'channel':'Chat','model':_0x083a('0xd'),'event':_0x083a('0x9'),'condition':_0x083a('0xe'),'callback':afterCreateMessage},{'channel':_0x083a('0xf'),'model':_0x083a('0x10'),'event':_0x083a('0x9'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x083a('0xf'),'model':_0x083a('0x10'),'event':_0x083a('0xb'),'condition':_0x083a('0xc'),'callback':afterUpdate},{'channel':_0x083a('0xf'),'model':'SmsMessage','event':'afterCreate','condition':_0x083a('0xe'),'callback':afterCreateMessage},{'channel':_0x083a('0x11'),'model':_0x083a('0x12'),'event':_0x083a('0x9'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x083a('0x11'),'model':_0x083a('0x12'),'event':_0x083a('0xb'),'condition':_0x083a('0xc'),'callback':afterUpdate},{'channel':'Fax','model':'FaxMessage','event':'afterCreate','condition':_0x083a('0xe'),'callback':afterCreateMessage},{'channel':_0x083a('0x13'),'model':'MailInteraction','event':'afterCreate','condition':_0x083a('0xa'),'callback':afterCreate},{'channel':_0x083a('0x13'),'model':_0x083a('0x14'),'event':_0x083a('0xb'),'condition':_0x083a('0xc'),'callback':afterUpdate},{'channel':'Mail','model':_0x083a('0x15'),'event':_0x083a('0x9'),'condition':_0x083a('0xe'),'callback':afterCreateMessage},{'channel':_0x083a('0x16'),'model':_0x083a('0x17'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x083a('0x16'),'model':_0x083a('0x17'),'event':_0x083a('0xb'),'condition':_0x083a('0xc'),'callback':afterUpdate},{'channel':'Openchannel','model':_0x083a('0x18'),'event':_0x083a('0x9'),'condition':_0x083a('0xe'),'callback':afterCreateMessage}];function request(_0x1cbcc4){return client[_0x083a('0x19')](_0x083a('0x1a'),_0x1cbcc4)[_0x083a('0x1b')](function(_0x5239b7){logger[_0x083a('0x1c')](_0x083a('0x1d'),'EventManager',_0x5239b7);if(_0x5239b7[_0x083a('0x1e')]){if(_0x5239b7['error'][_0x083a('0x1f')]===0x1f4){logger[_0x083a('0x1e')](_0x083a('0x1d'),_0x083a('0x1a'),_0x5239b7['error']);}}})[_0x083a('0x20')](function(_0x56d7f0){logger[_0x083a('0x1e')](_0x083a('0x1d'),_0x083a('0x1a'),_0x56d7f0);});}function afterCreateMessage(_0x5ab809,_0x6d7635){return function(_0xfca021,_0x769579){_0xfca021=_0xfca021[_0x083a('0x21')]({'plain':!![]});_0xfca021[_0x083a('0x22')]=_0x5ab809;_0xfca021[_0x083a('0x23')]=_0xfca021['direction'];if(_0xfca021['UserId']){return db['User'][_0x083a('0x24')]({'where':{'id':_0xfca021[_0x083a('0x25')]},'attributes':['id',_0x083a('0x26')],'raw':!![]})[_0x083a('0x1b')](function(_0x3ee06d){_0xfca021[_0x083a('0x27')]=util['format'](_0x083a('0x28'),_0x3ee06d[_0x083a('0x26')]);_0xfca021[_0x083a('0x22')]=_0x5ab809;return request({'event':_0x083a('0x29'),'message':_0xfca021});})['catch'](function(_0x4803a6){console['error'](_0x4803a6);});}else{return request({'event':_0x083a('0x2a'),'message':_0xfca021});}};}function afterCreate(_0x5c25f8,_0x3124cf){return function(_0x3fc17c,_0x592641){_0x3fc17c=_0x3fc17c[_0x083a('0x21')]({'plain':!![]});_0x3fc17c['channel']=_0x5c25f8;_0x3fc17c[_0x083a('0x23')]=_0x083a('0x2b');return request({'event':_0x3124cf,'message':_0x3fc17c});};}function afterUpdate(_0x1471b5,_0xc518ad){return function(_0x17bf90,_0xb4ccad){if(_0x17bf90[_0x083a('0x2c')]('closed')&&_0x17bf90[_0x083a('0x2d')]){_0x17bf90=_0x17bf90[_0x083a('0x21')]({'plain':!![]});_0x17bf90[_0x083a('0x22')]=_0x1471b5;_0x17bf90[_0x083a('0x23')]=_0x083a('0x2d');if(_0x17bf90[_0x083a('0x25')]){return db[_0x083a('0x2e')][_0x083a('0x24')]({'where':{'id':_0x17bf90[_0x083a('0x25')]},'attributes':['id',_0x083a('0x26')],'raw':!![]})[_0x083a('0x1b')](function(_0x3298ed){_0x17bf90['interface']=util[_0x083a('0x2f')]('SIP/%s',_0x3298ed[_0x083a('0x26')]);return request({'event':_0xc518ad,'message':_0x17bf90});})[_0x083a('0x20')](function(_0x4f681a){console[_0x083a('0x1e')](_0x4f681a);});}else{return request({'event':_0xc518ad,'message':_0x17bf90});}}};}exports[_0x083a('0x30')]=function(){for(var _0x164f8c=0x0;_0x164f8c=_0x31c6bc['agents']){throw Error(_0xc7ba('0xe'));}_0xcc6666(_0x580d02);})['catch'](function(_0x509289){_0x4a5d95(_0x509289);});});}; \ No newline at end of file +var _0xf2e9=['isValidChannel','toLowerCase','includes','isUndefined','blockedAt','role','User','count','agent','then','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','lodash','../mysqldb','./license/util','mail','chat','fax','sms','openchannel','getChannels'];(function(_0x490f6b,_0x408754){var _0x529dd3=function(_0x3e004a){while(--_0x3e004a){_0x490f6b['push'](_0x490f6b['shift']());}};_0x529dd3(++_0x408754);}(_0xf2e9,0x141));var _0x9f2e=function(_0x139007,_0x5ab7aa){_0x139007=_0x139007-0x0;var _0x330d41=_0xf2e9[_0x139007];return _0x330d41;};'use strict';var _=require(_0x9f2e('0x0'));var BPromise=require('bluebird');var db=require(_0x9f2e('0x1'))['db'];var util=require(_0x9f2e('0x2'));var channels=['voice',_0x9f2e('0x3'),_0x9f2e('0x4'),_0x9f2e('0x5'),_0x9f2e('0x6'),_0x9f2e('0x7')];exports[_0x9f2e('0x8')]=function(){return channels;};exports[_0x9f2e('0x9')]=function(_0x3fe634){_0x3fe634=_0x3fe634[_0x9f2e('0xa')]();return _[_0x9f2e('0xb')](channels,_0x3fe634);};exports['clearBlockUser']=function(_0x5dca14,_0x36b2f2,_0x5f51cf,_0x527b96){var _0xff0654={'loginAttempts':_0x36b2f2,'blocked':_0x5f51cf};if(!_[_0x9f2e('0xc')](_0x527b96)){_0xff0654[_0x9f2e('0xd')]=_0x527b96;}return _0x5dca14['updateAttributes'](_0xff0654);};exports['getLicense']=function(_0x4395e3){return new BPromise(function(_0x3eb080,_0x18a356){var _0x5c1ce1=0x0;if(_0x4395e3[_0x9f2e('0xe')]!=='agent'){_0x3eb080(_0x4395e3);}db[_0x9f2e('0xf')][_0x9f2e('0x10')]({'where':{'role':_0x9f2e('0x11'),'online':!![],'id':{'$ne':_0x4395e3['id']}}})[_0x9f2e('0x12')](function(_0x68f68c){_0x5c1ce1=_0x68f68c;return util[_0x9f2e('0x13')]();})['then'](function(_0x8af49e){if(_0x8af49e&&_0x8af49e[_0x9f2e('0x14')]&&_0x5c1ce1>=_0x8af49e['agents']){throw Error(_0x9f2e('0x15'));}_0x3eb080(_0x4395e3);})['catch'](function(_0x4c186c){_0x18a356(_0x4c186c);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 6979689..360bfe6 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xca08=['404','status','send','exports'];(function(_0x1a0c2b,_0xa20a4b){var _0x1c61e1=function(_0x6f6638){while(--_0x6f6638){_0x1a0c2b['push'](_0x1a0c2b['shift']());}};_0x1c61e1(++_0xa20a4b);}(_0xca08,0xb7));var _0x8ca0=function(_0x513d29,_0x375093){_0x513d29=_0x513d29-0x0;var _0x5ce2e2=_0xca08[_0x513d29];return _0x5ce2e2;};'use strict';module[_0x8ca0('0x0')][0x194]=function pageNotFound(_0x163039,_0xbbddfd){var _0x580298=_0x8ca0('0x1');var _0x24e661=0x194;var _0x365d3a={'status':_0x24e661};_0xbbddfd['status'](_0x365d3a[_0x8ca0('0x2')]);_0xbbddfd['render'](_0x580298,{},function(_0x506c74,_0x1bb23b){if(_0x506c74){return _0xbbddfd[_0x8ca0('0x2')](_0x365d3a['status'])['json'](_0x365d3a);}_0xbbddfd[_0x8ca0('0x3')](_0x1bb23b);});}; \ No newline at end of file +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 diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 1969ff1..3ff8cc3 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x77f3=['../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','../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','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','User','hasOne','VoiceMail','hasMany','VoiceRecording','Recordings','UserId','VoiceQueuesRt','Extensions','HopperHistory','OpenchannelInteraction','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','SmsInteraction','user_has_sms_interactions','user_has_openchannel_interactions','MailQueues','ChatQueue','FaxQueues','UserFaxQueue','SmsQueues','OpenchannelQueues','VoicePrefixes','ChatWebsites','user_has_chat_websites','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccount','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','SquareProjects','user_has_square_projects','cascade','ChanSpyId','VoiceExtension','Applications','VoiceMusicOnHold','Sound','Sounds','moh_has_sounds','Members','Hoppers','VoiceQueueId','HopperFinals','HopperHistories','HopperBlacks','JscriptySessionReport','JscriptySessions','Trunk','TrunkId','TrunkBackupId','Interval','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','ScreenRecording','Messages','mailboxuser','mailbox','VoiceQueueReport','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','Imap','Smtp','Dispositions','Answers','Interactions','MailApplication','List','ListId','Template','TemplateId','team_has_mail_queues','MailInteractionId','Account','Owner','Tag','mail_interaction_has_tags','Tags','ThroughTags','restrict','TagId','Items','Disposition','FaxAccountId','FaxInteractionId','fax_interaction_has_tags','Users','Attachment','AttachmentId','team_has_fax_queues','SmsAccountId','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','Interaction','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','ChatWebsiteId','ChatProactiveAction','ChatMessage','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessage','team_has_chat_queues','ChatInternalMessage','ChatGroupId','Company','cm_contact_has_tags','CampaignId','OwnerId','Automation','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','MailApplications','ChatApplications','Schedule','CustomReportId','Mohs','AllConditions','AllCondition','AnyConditions','AnyCondition','TriggerAnyId','Fields','MetricId','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Description','Field','VariableId','Configurations','DeskConfiguration','int_desk_configuration_has_tags','ZohoAccount','Subject','ZendeskAccount','VtigerAccount','FreshsalesAccount','FreshsalesConfiguration','FromId','ToId','SessionId','ProjectId','VoiceQueues','ChatQueues','team_has_openchannel_queues','TrunkBackup','SquareProjectId','campaigns_has_cm_lists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToAccount','FromChatWebsiteId','ToAgent','ToChatQueueId','ToQueue','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Contacts','Queues','user_has_voice_prefixes','exports','path','../config/environment','jstz','sequelize','defaultsDeep','motion2','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','sequelizeHistory','xcall','database','password','username','options','import','VoiceChanSpy','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','../api/trunk/trunk.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','Action','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','../api/sound/sound.model','../api/tag/tag.model','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x77f3,0x146));var _0x377f=function(_0x490457,_0x30c8c4){_0x490457=_0x490457-0x0;var _0x1e2258=_0x77f3[_0x490457];return _0x1e2258;};'use strict';var path=require(_0x377f('0x0'));var config=require(_0x377f('0x1'));var Sequelize=require('sequelize');var _=require('lodash');var jstz=require(_0x377f('0x2'));var timezone=jstz['determine']();config[_0x377f('0x3')]=_[_0x377f('0x4')](config[_0x377f('0x3')],{'database':_0x377f('0x5'),'username':'xcall','password':_0x377f('0x6'),'options':{'host':_0x377f('0x7'),'port':0xcea,'dialect':_0x377f('0x8'),'dialectOptions':{'charset':_0x377f('0x9')},'logging':![],'timezone':timezone[_0x377f('0xa')](),'define':{'charset':_0x377f('0xb'),'collate':'utf8_general_ci'}}});config[_0x377f('0xc')]=_[_0x377f('0x4')](config[_0x377f('0xc')],{'database':'motion2','username':_0x377f('0xd'),'password':'xC@LL1234','options':{'host':_0x377f('0x7'),'port':0xcea,'dialect':_0x377f('0x8'),'dialectOptions':{'charset':_0x377f('0x9')},'logging':![],'timezone':timezone[_0x377f('0xa')](),'define':{'charset':_0x377f('0xb'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x377f('0x3')][_0x377f('0xe')],config[_0x377f('0x3')]['username'],config[_0x377f('0x3')][_0x377f('0xf')],config['sequelize']['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x377f('0xc')][_0x377f('0xe')],config[_0x377f('0xc')][_0x377f('0x10')],config['sequelizeHistory'][_0x377f('0xf')],config[_0x377f('0xc')][_0x377f('0x11')])};db['User']=db['sequelize'][_0x377f('0x12')]('../api/user/user.model');db[_0x377f('0x13')]=db[_0x377f('0x3')][_0x377f('0x12')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x377f('0x14')]=db['sequelize'][_0x377f('0x12')](_0x377f('0x15'));db['VoiceExtension']=db[_0x377f('0x3')][_0x377f('0x12')]('../api/voiceExtension/voiceExtension.model');db['VoiceMusicOnHold']=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x16'));db[_0x377f('0x17')]=db['sequelize'][_0x377f('0x12')](_0x377f('0x18'));db['VoiceRecording']=db['sequelize'][_0x377f('0x12')]('../api/voiceRecording/voiceRecording.model');db['ScreenRecording']=db[_0x377f('0x3')][_0x377f('0x12')]('../api/screenRecording/screenRecording.model');db['VoiceMail']=db[_0x377f('0x3')][_0x377f('0x12')]('../api/voiceMail/voiceMail.model');db[_0x377f('0x19')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x1a'));db[_0x377f('0x1b')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x1c'));db[_0x377f('0x1d')]=db[_0x377f('0x3')][_0x377f('0x12')]('../api/voiceDialReport/voiceDialReport.model');db[_0x377f('0x1e')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x1f'));db['VoiceQueueReport']=db['sequelize'][_0x377f('0x12')](_0x377f('0x20'));db['MemberReport']=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x21'));db['Trunk']=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x22'));db['VoiceTransferReport']=db[_0x377f('0x3')][_0x377f('0x12')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x377f('0x23')]=db['sequelize'][_0x377f('0x12')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x377f('0x24')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x25'));db[_0x377f('0x26')]=db[_0x377f('0x3')]['import']('../api/userChatQueue/userChatQueue.model');db[_0x377f('0x27')]=db['sequelize'][_0x377f('0x12')]('../api/userMailQueue/userMailQueue.model');db['UserFaxQueue']=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x28'));db[_0x377f('0x29')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x2a'));db[_0x377f('0x2b')]=db[_0x377f('0x3')][_0x377f('0x12')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x377f('0x2c')]=db['sequelize'][_0x377f('0x12')](_0x377f('0x2d'));db[_0x377f('0x2e')]=db[_0x377f('0x3')][_0x377f('0x12')]('../api/mailServerOut/mailServerOut.model');db['MailAccount']=db['sequelize']['import'](_0x377f('0x2f'));db[_0x377f('0x30')]=db['sequelize']['import']('../api/mailQueue/mailQueue.model');db[_0x377f('0x31')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x32'));db[_0x377f('0x33')]=db['sequelize']['import']('../api/mailInteraction/mailInteraction.model');db[_0x377f('0x34')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x35'));db['MailApplication']=db['sequelize']['import'](_0x377f('0x36'));db[_0x377f('0x37')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x38'));db['Dashboard']=db['sequelize'][_0x377f('0x12')]('../api/dashboard/dashboard.model');db[_0x377f('0x39')]=db[_0x377f('0x3')]['import'](_0x377f('0x3a'));db['FaxAccount']=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x3b'));db[_0x377f('0x3c')]=db[_0x377f('0x3')]['import'](_0x377f('0x3d'));db[_0x377f('0x3e')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x3f'));db[_0x377f('0x40')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x41'));db[_0x377f('0x42')]=db[_0x377f('0x3')]['import'](_0x377f('0x43'));db[_0x377f('0x44')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x45'));db[_0x377f('0x46')]=db[_0x377f('0x3')][_0x377f('0x12')]('../api/smsAccount/smsAccount.model');db[_0x377f('0x47')]=db[_0x377f('0x3')][_0x377f('0x12')]('../api/smsApplication/smsApplication.model');db['SmsInteraction']=db[_0x377f('0x3')]['import'](_0x377f('0x48'));db[_0x377f('0x49')]=db[_0x377f('0x3')]['import']('../api/smsMessage/smsMessage.model');db[_0x377f('0x4a')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x4b'));db[_0x377f('0x4c')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x4d'));db['OpenchannelApplication']=db[_0x377f('0x3')]['import'](_0x377f('0x4e'));db['OpenchannelInteraction']=db[_0x377f('0x3')][_0x377f('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x377f('0x4f')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x50'));db[_0x377f('0x51')]=db[_0x377f('0x3')][_0x377f('0x12')]('../api/openchannelQueue/openchannelQueue.model');db[_0x377f('0x52')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x53'));db[_0x377f('0x54')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x55'));db[_0x377f('0x56')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x57'));db[_0x377f('0x58')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x59'));db['ChatMessage']=db['sequelize'][_0x377f('0x12')](_0x377f('0x5a'));db['ChatOfflineMessage']=db[_0x377f('0x3')]['import']('../api/chatOfflineMessage/chatOfflineMessage.model');db['ChatQueue']=db['sequelize'][_0x377f('0x12')](_0x377f('0x5b'));db[_0x377f('0x5c')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x5d'));db['ChatProactiveAction']=db['sequelize'][_0x377f('0x12')](_0x377f('0x5e'));db[_0x377f('0x5f')]=db[_0x377f('0x3')]['import'](_0x377f('0x60'));db[_0x377f('0x61')]=db[_0x377f('0x3')][_0x377f('0x12')]('../api/cmContact/cmContact.model');db[_0x377f('0x62')]=db[_0x377f('0x3')][_0x377f('0x12')]('../api/cmHopper/cmHopper.model');db[_0x377f('0x63')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x64'));db[_0x377f('0x65')]=db['sequelize']['import'](_0x377f('0x66'));db[_0x377f('0x67')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x68'));db[_0x377f('0x69')]=db[_0x377f('0x3')][_0x377f('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x377f('0x6a')]=db[_0x377f('0x3')][_0x377f('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x377f('0x6b')]=db[_0x377f('0x3')][_0x377f('0x12')]('../api/action/action.model');db['Automation']=db['sequelize']['import'](_0x377f('0x6c'));db[_0x377f('0x6d')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x6e'));db['Disposition']=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x6f'));db[_0x377f('0x70')]=db[_0x377f('0x3')]['import'](_0x377f('0x71'));db['Interval']=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x72'));db[_0x377f('0x73')]=db['sequelize'][_0x377f('0x12')](_0x377f('0x74'));db[_0x377f('0x75')]=db['sequelize'][_0x377f('0x12')](_0x377f('0x76'));db[_0x377f('0x77')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x78'));db['Schedule']=db[_0x377f('0x3')]['import'](_0x377f('0x79'));db['Sound']=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x7a'));db['Tag']=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x7b'));db['Template']=db[_0x377f('0x3')]['import'](_0x377f('0x7c'));db[_0x377f('0x7d')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x7e'));db[_0x377f('0x7f')]=db['sequelize'][_0x377f('0x12')](_0x377f('0x80'));db[_0x377f('0x81')]=db[_0x377f('0x3')]['import'](_0x377f('0x82'));db[_0x377f('0x83')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x84'));db[_0x377f('0x85')]=db['sequelize'][_0x377f('0x12')](_0x377f('0x86'));db[_0x377f('0x87')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x88'));db['AnalyticExtractedReport']=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x89'));db[_0x377f('0x8a')]=db[_0x377f('0x3')]['import']('../api/analyticMetric/analyticMetric.model');db[_0x377f('0x8b')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x8c'));db[_0x377f('0x8d')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x8e'));db[_0x377f('0x8f')]=db['sequelize'][_0x377f('0x12')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x377f('0x90')]=db['sequelize'][_0x377f('0x12')](_0x377f('0x91'));db[_0x377f('0x92')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x93'));db[_0x377f('0x94')]=db[_0x377f('0x3')]['import'](_0x377f('0x95'));db[_0x377f('0x96')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x97'));db[_0x377f('0x98')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x99'));db[_0x377f('0x9a')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x9b'));db['DeskConfiguration']=db[_0x377f('0x3')]['import']('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x377f('0x9c')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x9d'));db['ZohoAccount']=db['sequelize'][_0x377f('0x12')](_0x377f('0x9e'));db[_0x377f('0x9f')]=db[_0x377f('0x3')]['import']('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x377f('0xa0')]=db[_0x377f('0x3')][_0x377f('0x12')]('../api/intZohoField/intZohoField.model');db['ZendeskAccount']=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0xa1'));db[_0x377f('0xa2')]=db[_0x377f('0x3')][_0x377f('0x12')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x377f('0xa3')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0xa4'));db[_0x377f('0xa5')]=db['sequelize'][_0x377f('0x12')](_0x377f('0xa6'));db[_0x377f('0xa7')]=db[_0x377f('0x3')]['import'](_0x377f('0xa8'));db[_0x377f('0xa9')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0xaa'));db['VtigerAccount']=db[_0x377f('0x3')][_0x377f('0x12')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0x377f('0xab')]=db[_0x377f('0x3')][_0x377f('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x377f('0xac')]=db[_0x377f('0x3')]['import'](_0x377f('0xad'));db[_0x377f('0xae')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0xaf'));db[_0x377f('0xb0')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0xb1'));db[_0x377f('0xb2')]=db[_0x377f('0x3')]['import'](_0x377f('0xb3'));db[_0x377f('0xb4')]=db[_0x377f('0x3')][_0x377f('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x377f('0xb5')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0xb6'));db[_0x377f('0xb7')]=db['sequelize'][_0x377f('0x12')](_0x377f('0xb8'));db['FreshsalesAccount']=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0xb9'));db['FreshsalesConfiguration']=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0xba'));db[_0x377f('0xbb')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0xbc'));db[_0x377f('0x81')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0x82'));db['Network']=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0xbd'));db[_0x377f('0xbe')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0xbf'));db['ChatInternalMessage']=db[_0x377f('0x3')][_0x377f('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x377f('0xc0')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0xc1'));db[_0x377f('0xc2')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0xc3'));db['JscriptySessionReport']=db['sequelize'][_0x377f('0x12')](_0x377f('0xc4'));db[_0x377f('0xc5')]=db['sequelize'][_0x377f('0x12')]('../api/smsQueueReport/smsQueueReport.model');db[_0x377f('0xc6')]=db[_0x377f('0x3')]['import']('../api/squareReport/squareReport.model');db[_0x377f('0xc7')]=db['sequelize'][_0x377f('0x12')]('../api/squareReportDetail/squareReportDetail.model');db[_0x377f('0xc8')]=db[_0x377f('0x3')]['import'](_0x377f('0xc9'));db[_0x377f('0xca')]=db[_0x377f('0x3')][_0x377f('0x12')]('../api/setting/setting.model');db[_0x377f('0xcb')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0xcc'));db[_0x377f('0xcd')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0xce'));db[_0x377f('0xcf')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0xd0'));db['SquareMessage']=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0xd1'));db[_0x377f('0xd2')]=db['sequelize']['import'](_0x377f('0xd3'));db[_0x377f('0xd4')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0xd5'));db[_0x377f('0xd6')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0xd7'));db[_0x377f('0xd8')]=db[_0x377f('0x3')][_0x377f('0x12')]('../api/migration/migration.model');db['Attachment']=db[_0x377f('0x3')][_0x377f('0x12')]('../api/attachment/attachment.model');db[_0x377f('0xd9')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0xda'));db[_0x377f('0xdb')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0xdc'));db[_0x377f('0xdd')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0xde'));db[_0x377f('0xdf')]=db['sequelize'][_0x377f('0x12')](_0x377f('0xe0'));db['OpenchannelTransferReport']=db[_0x377f('0x3')][_0x377f('0x12')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x377f('0xe1')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0xe2'));db[_0x377f('0xe3')]=db['sequelize']['import']('../api/cmList/cmList.model');db[_0x377f('0xe4')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0xe5'));db[_0x377f('0xe6')]=db[_0x377f('0x3')][_0x377f('0x12')]('../api/userProfile/userProfile.model');db[_0x377f('0xe7')]=db[_0x377f('0x3')][_0x377f('0x12')](_0x377f('0xe8'));db[_0x377f('0xe9')]=db[_0x377f('0x3')]['import'](_0x377f('0xea'));db[_0x377f('0xeb')][_0x377f('0xec')](db[_0x377f('0xed')],{'as':_0x377f('0xed'),'onDelete':'cascade','foreignKey':'UserId'});db[_0x377f('0xeb')][_0x377f('0xee')](db[_0x377f('0xef')],{'as':_0x377f('0xf0'),'foreignKey':_0x377f('0xf1')});db[_0x377f('0xeb')][_0x377f('0xee')](db[_0x377f('0x23')],{'as':_0x377f('0xf2'),'foreignKey':_0x377f('0xf1')});db['User']['hasMany'](db['VoiceExtension'],{'as':_0x377f('0xf3'),'onDelete':'cascade','hooks':!![]});db[_0x377f('0xeb')]['hasMany'](db[_0x377f('0x65')],{'as':'HopperFinals','foreignKey':_0x377f('0xf1')});db[_0x377f('0xeb')][_0x377f('0xee')](db[_0x377f('0x67')],{'as':_0x377f('0xf4'),'foreignKey':'UserId'});db[_0x377f('0xeb')][_0x377f('0xee')](db['ReportAgentPreview'],{'as':_0x377f('0x69'),'foreignKey':_0x377f('0xf1')});db['User'][_0x377f('0xee')](db[_0x377f('0xf5')],{'as':_0x377f('0xf6'),'foreignKey':'UserId'});db[_0x377f('0xeb')][_0x377f('0xee')](db[_0x377f('0x58')],{'as':_0x377f('0xf7'),'foreignKey':'UserId'});db['User'][_0x377f('0xee')](db['SmsInteraction'],{'as':_0x377f('0xf8'),'foreignKey':_0x377f('0xf1')});db[_0x377f('0xeb')]['hasMany'](db[_0x377f('0x3e')],{'as':_0x377f('0xf9'),'foreignKey':'UserId'});db['User'][_0x377f('0xee')](db[_0x377f('0x33')],{'as':_0x377f('0xfa'),'foreignKey':_0x377f('0xf1')});db['User'][_0x377f('0xfb')](db[_0x377f('0xe6')],{'as':_0x377f('0xe6'),'foreignKey':_0x377f('0xfc')});db[_0x377f('0xeb')][_0x377f('0xfd')](db[_0x377f('0x5c')],{'as':_0x377f('0xfe'),'through':_0x377f('0xff')});db[_0x377f('0xeb')][_0x377f('0xfd')](db[_0x377f('0x61')],{'as':'Contacts','through':_0x377f('0x100')});db[_0x377f('0xeb')]['belongsToMany'](db['CmList'],{'as':_0x377f('0x101'),'through':_0x377f('0x102')});db[_0x377f('0xeb')][_0x377f('0xfd')](db['Team'],{'through':_0x377f('0x103')});db['User'][_0x377f('0xfd')](db[_0x377f('0x33')],{'as':'MailInteractions','through':_0x377f('0x104')});db[_0x377f('0xeb')][_0x377f('0xfd')](db[_0x377f('0x58')],{'as':_0x377f('0xf7'),'through':_0x377f('0x105')});db['User'][_0x377f('0xfd')](db[_0x377f('0x3e')],{'as':'FaxInteractions','through':_0x377f('0x106')});db['User'][_0x377f('0xfd')](db[_0x377f('0x107')],{'as':_0x377f('0xf8'),'through':_0x377f('0x108')});db[_0x377f('0xeb')][_0x377f('0xfd')](db[_0x377f('0xf5')],{'as':_0x377f('0xf6'),'through':_0x377f('0x109')});db[_0x377f('0xeb')][_0x377f('0xfd')](db[_0x377f('0x17')],{'as':'VoiceQueues','through':'UserVoiceQueue','required':![]});db['User'][_0x377f('0xfd')](db[_0x377f('0x30')],{'as':_0x377f('0x10a'),'through':'UserMailQueue','required':![]});db['User']['belongsToMany'](db[_0x377f('0x10b')],{'as':'ChatQueues','through':'UserChatQueue','required':![],'hooks':!![]});db[_0x377f('0xeb')][_0x377f('0xfd')](db[_0x377f('0x42')],{'as':_0x377f('0x10c'),'through':_0x377f('0x10d'),'required':![]});db[_0x377f('0xeb')][_0x377f('0xfd')](db[_0x377f('0x4a')],{'as':_0x377f('0x10e'),'through':_0x377f('0x29'),'required':![]});db[_0x377f('0xeb')][_0x377f('0xfd')](db[_0x377f('0x51')],{'as':_0x377f('0x10f'),'through':_0x377f('0x2b'),'required':![]});db[_0x377f('0xeb')][_0x377f('0xfd')](db[_0x377f('0xe3')],{'through':_0x377f('0x102')});db[_0x377f('0xeb')]['belongsToMany'](db[_0x377f('0xe4')],{'as':_0x377f('0x110'),'through':'user_has_voice_prefixes','required':![]});db[_0x377f('0xeb')]['belongsToMany'](db[_0x377f('0x52')],{'as':_0x377f('0x111'),'through':_0x377f('0x112')});db[_0x377f('0xeb')][_0x377f('0xfd')](db[_0x377f('0x113')],{'as':_0x377f('0x114'),'through':_0x377f('0x115')});db[_0x377f('0xeb')]['belongsToMany'](db[_0x377f('0x116')],{'as':_0x377f('0x117'),'through':_0x377f('0x118')});db[_0x377f('0xeb')][_0x377f('0xfd')](db['OpenchannelAccount'],{'as':_0x377f('0x119'),'through':_0x377f('0x11a')});db['User'][_0x377f('0xfd')](db['SmsAccount'],{'as':_0x377f('0x11b'),'through':'user_has_sms_accounts'});db[_0x377f('0xeb')]['belongsToMany'](db[_0x377f('0xcd')],{'as':_0x377f('0x11c'),'through':_0x377f('0x11d')});db[_0x377f('0x13')][_0x377f('0xee')](db['VoiceExtension'],{'as':'SpiedAgents','onDelete':_0x377f('0x11e'),'foreignKey':_0x377f('0x11f')});db['VoiceContext']['hasMany'](db[_0x377f('0x120')],{'onDelete':_0x377f('0x11e')});db[_0x377f('0x120')][_0x377f('0xee')](db[_0x377f('0x120')],{'as':_0x377f('0x121'),'onDelete':'cascade'});db[_0x377f('0x122')][_0x377f('0xfd')](db[_0x377f('0x123')],{'as':_0x377f('0x124'),'through':_0x377f('0x125')});db['VoiceQueue']['hasMany'](db[_0x377f('0x23')],{'as':_0x377f('0x126'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x377f('0xee')](db[_0x377f('0x62')],{'as':_0x377f('0x127'),'foreignKey':_0x377f('0x128')});db[_0x377f('0x17')]['hasMany'](db[_0x377f('0x65')],{'as':_0x377f('0x129'),'foreignKey':_0x377f('0x128')});db['VoiceQueue']['hasMany'](db[_0x377f('0x67')],{'as':_0x377f('0x12a'),'foreignKey':_0x377f('0x128')});db[_0x377f('0x17')][_0x377f('0xee')](db[_0x377f('0x69')],{'as':_0x377f('0x69'),'foreignKey':_0x377f('0x128')});db[_0x377f('0x17')][_0x377f('0xee')](db['CmHopperBlack'],{'as':_0x377f('0x12b'),'foreignKey':_0x377f('0x128')});db[_0x377f('0x17')][_0x377f('0xee')](db[_0x377f('0x12c')],{'as':_0x377f('0x12d'),'foreignKey':_0x377f('0x128')});db[_0x377f('0x17')][_0x377f('0xfb')](db['Trunk'],{'as':_0x377f('0x12e'),'foreignKey':_0x377f('0x12f')});db[_0x377f('0x17')][_0x377f('0xfb')](db[_0x377f('0x12e')],{'as':'TrunkBackup','foreignKey':_0x377f('0x130')});db[_0x377f('0x17')]['belongsTo'](db['Interval'],{'as':_0x377f('0x131'),'foreignKey':_0x377f('0x132')});db[_0x377f('0x17')][_0x377f('0xfb')](db[_0x377f('0x73')],{'as':_0x377f('0x133'),'foreignKey':_0x377f('0x134')});db[_0x377f('0x17')][_0x377f('0xfd')](db[_0x377f('0xe3')],{'as':'Lists','through':_0x377f('0x135')});db[_0x377f('0x17')]['belongsToMany'](db[_0x377f('0xeb')],{'as':_0x377f('0x136'),'through':_0x377f('0x24')});db[_0x377f('0x17')][_0x377f('0xfd')](db[_0x377f('0xd2')],{'as':_0x377f('0x137'),'through':_0x377f('0x138')});db[_0x377f('0x17')][_0x377f('0xfd')](db[_0x377f('0xe3')],{'as':_0x377f('0x139'),'through':_0x377f('0x13a')});db['VoiceRecording'][_0x377f('0xfb')](db[_0x377f('0xeb')],{'as':_0x377f('0xeb'),'foreignKey':_0x377f('0xf1')});db[_0x377f('0x13b')][_0x377f('0xfb')](db[_0x377f('0xeb')],{'as':_0x377f('0xeb'),'foreignKey':'UserId'});db[_0x377f('0xed')][_0x377f('0xee')](db[_0x377f('0x19')],{'as':_0x377f('0x13c'),'onDelete':_0x377f('0x11e'),'foreignKey':_0x377f('0x13d'),'sourceKey':_0x377f('0x13e')});db[_0x377f('0x19')]['belongsTo'](db['VoiceMail'],{'foreignKey':_0x377f('0x13d'),'targetKey':_0x377f('0x13e')});db[_0x377f('0x1b')]['hasMany'](db[_0x377f('0x13f')],{'as':_0x377f('0x140'),'foreignKey':_0x377f('0x141'),'constraints':![]});db[_0x377f('0x1b')][_0x377f('0xee')](db[_0x377f('0x1e')],{'as':_0x377f('0x142'),'foreignKey':_0x377f('0x141'),'constraints':![]});db[_0x377f('0x1b')][_0x377f('0xfb')](db[_0x377f('0xeb')],{'as':_0x377f('0xeb'),'foreignKey':_0x377f('0xf1')});db[_0x377f('0x1b')][_0x377f('0xfb')](db['CmContact'],{'as':_0x377f('0x143'),'foreignKey':_0x377f('0x144')});db['MailServerIn'][_0x377f('0xfb')](db[_0x377f('0x116')],{'as':_0x377f('0x116'),'foreignKey':_0x377f('0x145')});db[_0x377f('0x2e')][_0x377f('0xfb')](db['MailAccount'],{'as':'MailAccount','foreignKey':_0x377f('0x145')});db[_0x377f('0x116')]['hasOne'](db[_0x377f('0x2c')],{'as':_0x377f('0x146'),'onDelete':_0x377f('0x11e')});db[_0x377f('0x116')][_0x377f('0xec')](db['MailServerOut'],{'as':_0x377f('0x147'),'onDelete':_0x377f('0x11e')});db['MailAccount']['hasMany'](db['Disposition'],{'as':_0x377f('0x148'),'foreignKey':'MailAccountId'});db[_0x377f('0x116')][_0x377f('0xee')](db['CannedAnswer'],{'as':_0x377f('0x149'),'foreignKey':'MailAccountId'});db['MailAccount']['hasMany'](db[_0x377f('0x34')],{'as':_0x377f('0x13c'),'foreignKey':_0x377f('0x145')});db[_0x377f('0x116')][_0x377f('0xee')](db[_0x377f('0x33')],{'as':_0x377f('0x14a')});db['MailAccount'][_0x377f('0xee')](db[_0x377f('0x14b')],{'as':_0x377f('0x121')});db[_0x377f('0x116')]['belongsTo'](db[_0x377f('0xe3')],{'as':_0x377f('0x14c'),'foreignKey':_0x377f('0x14d')});db[_0x377f('0x116')]['belongsTo'](db[_0x377f('0x14e')],{'as':_0x377f('0x14e'),'foreignKey':_0x377f('0x14f')});db[_0x377f('0x116')][_0x377f('0xfb')](db[_0x377f('0x73')],{'as':'mandatoryDispositionPause','foreignKey':_0x377f('0x134')});db[_0x377f('0x116')]['belongsToMany'](db[_0x377f('0xeb')],{'as':'Agents','through':'user_has_mail_accounts'});db[_0x377f('0x30')][_0x377f('0xfd')](db['User'],{'as':_0x377f('0x136'),'through':_0x377f('0x27')});db[_0x377f('0x30')][_0x377f('0xfd')](db[_0x377f('0xd2')],{'through':_0x377f('0x150'),'as':'Teams'});db[_0x377f('0x33')][_0x377f('0xee')](db[_0x377f('0x34')],{'as':_0x377f('0x13c'),'onDelete':_0x377f('0x11e'),'foreignKey':_0x377f('0x151')});db[_0x377f('0x33')][_0x377f('0xfb')](db[_0x377f('0x116')],{'as':_0x377f('0x152'),'foreignKey':_0x377f('0x145')});db[_0x377f('0x33')][_0x377f('0xfb')](db[_0x377f('0x61')],{'as':_0x377f('0x143'),'foreignKey':_0x377f('0x144')});db[_0x377f('0x33')][_0x377f('0xfb')](db[_0x377f('0xeb')],{'as':_0x377f('0x153'),'foreignKey':_0x377f('0xf1')});db['MailInteraction'][_0x377f('0xfd')](db[_0x377f('0x154')],{'through':_0x377f('0x155'),'as':_0x377f('0x156')});db[_0x377f('0x33')][_0x377f('0xfd')](db[_0x377f('0x154')],{'through':'mail_interaction_has_tags','as':_0x377f('0x157')});db[_0x377f('0x33')]['belongsToMany'](db[_0x377f('0xeb')],{'as':'Users','through':_0x377f('0x104'),'foreignKey':_0x377f('0x151')});db[_0x377f('0x34')][_0x377f('0xee')](db['Attachment'],{'as':'Attachments','onDelete':_0x377f('0x11e')});db[_0x377f('0x34')]['belongsTo'](db['User'],{'as':_0x377f('0xeb')});db[_0x377f('0x34')][_0x377f('0xfb')](db[_0x377f('0x61')],{'onDelete':_0x377f('0x11e'),'as':_0x377f('0x143')});db[_0x377f('0x34')][_0x377f('0xfb')](db[_0x377f('0x33')],{'as':'Interaction','foreignKey':_0x377f('0x151')});db[_0x377f('0x34')][_0x377f('0xfb')](db[_0x377f('0x116')],{'as':'Account','foreignKey':_0x377f('0x145')});db['MailApplication'][_0x377f('0xfb')](db[_0x377f('0xeb')],{'onDelete':_0x377f('0x158')});db['MailApplication'][_0x377f('0xfb')](db[_0x377f('0x30')],{'onDelete':_0x377f('0x158')});db[_0x377f('0x14b')][_0x377f('0xfb')](db['MailAccount'],{'onDelete':_0x377f('0x158')});db[_0x377f('0x14b')][_0x377f('0xfb')](db['Interval'],{'onDelete':_0x377f('0x158'),'foreignKey':_0x377f('0x132')});db[_0x377f('0x14b')]['belongsTo'](db[_0x377f('0x154')],{'onDelete':'restrict','foreignKey':_0x377f('0x159')});db['MailQueueReport'][_0x377f('0xfb')](db[_0x377f('0x116')],{});db[_0x377f('0x37')][_0x377f('0xfb')](db[_0x377f('0xe3')],{'as':_0x377f('0x14c'),'foreignKey':_0x377f('0x14d')});db[_0x377f('0x37')][_0x377f('0xfb')](db[_0x377f('0x61')],{'as':'Contact','foreignKey':'ContactId'});db[_0x377f('0x37')]['belongsTo'](db[_0x377f('0x33')],{});db['MailQueueReport']['belongsTo'](db[_0x377f('0x34')],{});db['MailQueueReport'][_0x377f('0xfb')](db[_0x377f('0xeb')],{});db[_0x377f('0x37')][_0x377f('0xfb')](db['MailQueue'],{});db['Dashboard'][_0x377f('0xee')](db[_0x377f('0x39')],{'as':_0x377f('0x15a'),'onDelete':_0x377f('0x11e')});db[_0x377f('0x113')]['hasMany'](db[_0x377f('0x15b')],{'as':_0x377f('0x148'),'foreignKey':_0x377f('0x15c')});db[_0x377f('0x113')][_0x377f('0xee')](db[_0x377f('0x6d')],{'as':_0x377f('0x149'),'foreignKey':_0x377f('0x15c')});db['FaxAccount'][_0x377f('0xee')](db[_0x377f('0x3e')],{'as':_0x377f('0x14a')});db[_0x377f('0x113')][_0x377f('0xee')](db[_0x377f('0x3c')],{'as':'Applications'});db[_0x377f('0x113')]['hasMany'](db[_0x377f('0x120')],{'as':'Exntensions','onDelete':_0x377f('0x11e')});db[_0x377f('0x113')][_0x377f('0xee')](db['FaxMessage'],{'as':'Messages'});db['FaxAccount'][_0x377f('0xfb')](db[_0x377f('0x12e')],{'as':_0x377f('0x12e')});db[_0x377f('0x113')][_0x377f('0xfb')](db[_0x377f('0xe3')],{'as':_0x377f('0x14c'),'foreignKey':'ListId'});db['FaxAccount'][_0x377f('0xfb')](db['Pause'],{'as':_0x377f('0x133'),'foreignKey':_0x377f('0x134')});db[_0x377f('0x113')][_0x377f('0xfd')](db[_0x377f('0xeb')],{'as':'Agents','through':_0x377f('0x115')});db[_0x377f('0x3c')][_0x377f('0xfb')](db['User'],{'onDelete':'restrict'});db[_0x377f('0x3c')][_0x377f('0xfb')](db[_0x377f('0x42')],{'onDelete':_0x377f('0x158')});db[_0x377f('0x3c')][_0x377f('0xfb')](db[_0x377f('0x113')],{'onDelete':_0x377f('0x158')});db[_0x377f('0x3c')][_0x377f('0xfb')](db['Tag'],{'onDelete':_0x377f('0x158'),'foreignKey':_0x377f('0x159')});db['FaxInteraction'][_0x377f('0xee')](db[_0x377f('0x40')],{'as':'Messages','onDelete':_0x377f('0x11e'),'foreignKey':_0x377f('0x15d')});db['FaxInteraction']['belongsTo'](db[_0x377f('0x113')],{'as':_0x377f('0x152'),'foreignKey':_0x377f('0x15c')});db[_0x377f('0x3e')]['belongsTo'](db[_0x377f('0x61')],{'as':'Contact','foreignKey':_0x377f('0x144')});db['FaxInteraction'][_0x377f('0xfb')](db[_0x377f('0xeb')],{'as':_0x377f('0x153'),'foreignKey':_0x377f('0xf1')});db[_0x377f('0x3e')][_0x377f('0xfd')](db['Tag'],{'through':_0x377f('0x15e'),'as':_0x377f('0x156')});db[_0x377f('0x3e')][_0x377f('0xfd')](db[_0x377f('0x154')],{'through':'fax_interaction_has_tags','as':'ThroughTags'});db['FaxInteraction'][_0x377f('0xfd')](db['User'],{'as':_0x377f('0x15f'),'through':'user_has_fax_interactions','foreignKey':_0x377f('0x15d')});db[_0x377f('0x40')][_0x377f('0xfb')](db[_0x377f('0xeb')],{'onDelete':'cascade','as':'User'});db[_0x377f('0x40')][_0x377f('0xfb')](db[_0x377f('0x3e')],{'as':'Interaction','foreignKey':_0x377f('0x15d')});db['FaxMessage'][_0x377f('0xfb')](db['CmContact'],{'onDelete':_0x377f('0x11e'),'as':_0x377f('0x143')});db[_0x377f('0x40')][_0x377f('0xfb')](db[_0x377f('0x160')],{'as':_0x377f('0x160'),'foreignKey':_0x377f('0x161')});db[_0x377f('0x40')][_0x377f('0xfb')](db[_0x377f('0x113')],{'as':'Account','foreignKey':'FaxAccountId'});db[_0x377f('0x42')][_0x377f('0xfd')](db[_0x377f('0xeb')],{'as':_0x377f('0x136'),'through':_0x377f('0x10d')});db[_0x377f('0x42')][_0x377f('0xfd')](db['Team'],{'through':_0x377f('0x162'),'as':_0x377f('0x137')});db['FaxQueueReport'][_0x377f('0xfb')](db[_0x377f('0x113')],{});db[_0x377f('0x44')]['belongsTo'](db[_0x377f('0xe3')],{'as':_0x377f('0x14c'),'foreignKey':_0x377f('0x14d')});db[_0x377f('0x44')][_0x377f('0xfb')](db['CmContact'],{'as':_0x377f('0x143'),'foreignKey':_0x377f('0x144')});db[_0x377f('0x44')][_0x377f('0xfb')](db['FaxInteraction'],{});db['FaxQueueReport'][_0x377f('0xfb')](db['FaxMessage'],{});db[_0x377f('0x44')][_0x377f('0xfb')](db[_0x377f('0xeb')],{});db[_0x377f('0x44')][_0x377f('0xfb')](db[_0x377f('0x42')],{});db[_0x377f('0x46')][_0x377f('0xee')](db['Disposition'],{'as':_0x377f('0x148'),'foreignKey':_0x377f('0x163')});db['SmsAccount'][_0x377f('0xee')](db[_0x377f('0x6d')],{'as':_0x377f('0x149'),'foreignKey':_0x377f('0x163')});db[_0x377f('0x46')][_0x377f('0xee')](db[_0x377f('0x49')],{'as':_0x377f('0x13c'),'foreignKey':_0x377f('0x163')});db['SmsAccount'][_0x377f('0xee')](db['SmsInteraction'],{'as':_0x377f('0x14a')});db[_0x377f('0x46')][_0x377f('0xee')](db[_0x377f('0x47')],{'as':'Applications'});db[_0x377f('0x46')]['belongsTo'](db[_0x377f('0xe3')],{'as':_0x377f('0x14c'),'foreignKey':_0x377f('0x14d')});db['SmsAccount'][_0x377f('0xfb')](db[_0x377f('0x73')],{'as':'mandatoryDispositionPause','foreignKey':_0x377f('0x134')});db[_0x377f('0x46')]['belongsToMany'](db['User'],{'as':_0x377f('0x136'),'through':_0x377f('0x164')});db[_0x377f('0x47')]['belongsTo'](db[_0x377f('0xeb')],{'onDelete':_0x377f('0x158')});db[_0x377f('0x47')][_0x377f('0xfb')](db[_0x377f('0x4a')],{'onDelete':_0x377f('0x158')});db['SmsApplication'][_0x377f('0xfb')](db[_0x377f('0x46')],{'onDelete':'restrict'});db['SmsApplication'][_0x377f('0xfb')](db['Interval'],{'onDelete':_0x377f('0x158'),'foreignKey':_0x377f('0x132')});db['SmsApplication'][_0x377f('0xfb')](db[_0x377f('0x154')],{'onDelete':_0x377f('0x158'),'foreignKey':_0x377f('0x159')});db[_0x377f('0x107')][_0x377f('0xee')](db[_0x377f('0x49')],{'as':_0x377f('0x13c'),'onDelete':_0x377f('0x11e'),'foreignKey':_0x377f('0x165')});db[_0x377f('0x107')][_0x377f('0xfb')](db['SmsAccount'],{'as':_0x377f('0x152'),'foreignKey':_0x377f('0x163')});db['SmsInteraction'][_0x377f('0xfb')](db[_0x377f('0x61')],{'as':_0x377f('0x143'),'foreignKey':_0x377f('0x144')});db[_0x377f('0x107')][_0x377f('0xfb')](db[_0x377f('0xeb')],{'as':'Owner','foreignKey':_0x377f('0xf1')});db[_0x377f('0x107')]['belongsToMany'](db[_0x377f('0x154')],{'through':_0x377f('0x166'),'as':_0x377f('0x156')});db['SmsInteraction'][_0x377f('0xfd')](db[_0x377f('0x154')],{'through':'sms_interaction_has_tags','as':_0x377f('0x157')});db[_0x377f('0x107')][_0x377f('0xfd')](db['User'],{'as':_0x377f('0x15f'),'through':_0x377f('0x108'),'foreignKey':'SmsInteractionId'});db[_0x377f('0x49')][_0x377f('0xfb')](db[_0x377f('0xeb')],{'as':_0x377f('0xeb')});db[_0x377f('0x49')]['belongsTo'](db['CmContact'],{'onDelete':_0x377f('0x11e'),'as':'Contact'});db['SmsMessage'][_0x377f('0xfb')](db[_0x377f('0x107')],{'onDelete':_0x377f('0x11e'),'as':_0x377f('0x167'),'foreignKey':_0x377f('0x165')});db[_0x377f('0x49')][_0x377f('0xfb')](db[_0x377f('0x46')],{'as':_0x377f('0x152'),'foreignKey':_0x377f('0x163')});db[_0x377f('0x4a')][_0x377f('0xfd')](db[_0x377f('0xeb')],{'as':_0x377f('0x136'),'through':_0x377f('0x29'),'foreignKey':_0x377f('0x168')});db['SmsQueue']['belongsToMany'](db[_0x377f('0xd2')],{'through':_0x377f('0x169'),'as':_0x377f('0x137')});db['OpenchannelAccount'][_0x377f('0xee')](db['Disposition'],{'as':_0x377f('0x148'),'foreignKey':_0x377f('0x16a')});db[_0x377f('0x4c')][_0x377f('0xee')](db['CannedAnswer'],{'as':_0x377f('0x149'),'foreignKey':_0x377f('0x16a')});db[_0x377f('0x4c')][_0x377f('0xee')](db[_0x377f('0xf5')],{'as':'Interactions','foreignKey':_0x377f('0x16a')});db[_0x377f('0x4c')]['hasMany'](db[_0x377f('0x4f')],{'as':_0x377f('0x13c'),'foreignKey':_0x377f('0x16a')});db[_0x377f('0x4c')][_0x377f('0xee')](db[_0x377f('0x16b')],{'as':_0x377f('0x121'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x377f('0xfb')](db[_0x377f('0xe3')],{'as':_0x377f('0x14c'),'foreignKey':_0x377f('0x14d')});db[_0x377f('0x4c')][_0x377f('0xfb')](db[_0x377f('0x73')],{'as':_0x377f('0x133'),'foreignKey':_0x377f('0x134')});db['OpenchannelAccount'][_0x377f('0xfd')](db['User'],{'as':'Agents','through':_0x377f('0x11a')});db['OpenchannelApplication']['belongsTo'](db['User'],{'onDelete':_0x377f('0x158')});db['OpenchannelApplication'][_0x377f('0xfb')](db[_0x377f('0x51')],{'onDelete':_0x377f('0x158'),'foreignKey':_0x377f('0x16c')});db[_0x377f('0x16b')][_0x377f('0xfb')](db[_0x377f('0x4c')],{'onDelete':_0x377f('0x158'),'foreignKey':_0x377f('0x16a')});db[_0x377f('0x16b')]['belongsTo'](db['Interval'],{'onDelete':'restrict','foreignKey':_0x377f('0x132')});db['OpenchannelApplication'][_0x377f('0xfb')](db[_0x377f('0x154')],{'onDelete':_0x377f('0x158'),'foreignKey':'TagId'});db[_0x377f('0xf5')]['hasMany'](db['OpenchannelMessage'],{'as':_0x377f('0x13c'),'onDelete':_0x377f('0x11e'),'foreignKey':_0x377f('0x16d')});db[_0x377f('0xf5')][_0x377f('0xfb')](db['OpenchannelAccount'],{'as':'Account','foreignKey':_0x377f('0x16a')});db['OpenchannelInteraction']['belongsTo'](db['CmContact'],{'as':_0x377f('0x143'),'foreignKey':'ContactId'});db[_0x377f('0xf5')][_0x377f('0xfb')](db[_0x377f('0xeb')],{'as':_0x377f('0x153'),'foreignKey':_0x377f('0xf1')});db[_0x377f('0xf5')]['belongsToMany'](db['Tag'],{'through':_0x377f('0x16e'),'as':_0x377f('0x156')});db[_0x377f('0xf5')]['belongsToMany'](db[_0x377f('0x154')],{'through':'openchannel_interaction_has_tags','as':_0x377f('0x157')});db['OpenchannelInteraction'][_0x377f('0xfd')](db[_0x377f('0xeb')],{'as':_0x377f('0x15f'),'through':_0x377f('0x109'),'foreignKey':_0x377f('0x16d')});db[_0x377f('0x4f')][_0x377f('0xfb')](db[_0x377f('0xeb')],{'onDelete':_0x377f('0x11e'),'as':_0x377f('0xeb')});db[_0x377f('0x4f')][_0x377f('0xfb')](db[_0x377f('0x61')],{'onDelete':_0x377f('0x11e'),'as':_0x377f('0x143')});db[_0x377f('0x4f')][_0x377f('0xfb')](db[_0x377f('0xf5')],{'onDelete':_0x377f('0x11e'),'as':_0x377f('0x167'),'foreignKey':_0x377f('0x16d')});db[_0x377f('0x4f')][_0x377f('0xfb')](db[_0x377f('0x160')],{'as':'Attachment','foreignKey':_0x377f('0x161')});db[_0x377f('0x4f')][_0x377f('0xfb')](db[_0x377f('0x4c')],{'as':_0x377f('0x152'),'foreignKey':_0x377f('0x16a')});db[_0x377f('0x51')]['belongsToMany'](db[_0x377f('0xeb')],{'as':_0x377f('0x136'),'through':_0x377f('0x2b'),'foreignKey':_0x377f('0x16c')});db['OpenchannelQueue'][_0x377f('0xfd')](db['Team'],{'through':'team_has_openchannel_queues','as':'Teams'});db[_0x377f('0x52')][_0x377f('0xee')](db[_0x377f('0x15b')],{'as':_0x377f('0x148'),'foreignKey':_0x377f('0x16f')});db[_0x377f('0x52')][_0x377f('0xee')](db[_0x377f('0x6d')],{'as':_0x377f('0x149'),'foreignKey':'ChatWebsiteId'});db[_0x377f('0x52')]['hasMany'](db[_0x377f('0x170')],{'as':'ProactiveActions'});db[_0x377f('0x52')]['hasMany'](db[_0x377f('0x58')],{'as':_0x377f('0x14a')});db[_0x377f('0x52')][_0x377f('0xee')](db[_0x377f('0x56')],{'as':_0x377f('0x121')});db['ChatWebsite'][_0x377f('0xee')](db[_0x377f('0x171')],{'as':_0x377f('0x13c')});db['ChatWebsite']['belongsTo'](db[_0x377f('0xe3')],{'as':_0x377f('0x14c'),'foreignKey':_0x377f('0x14d')});db[_0x377f('0x52')][_0x377f('0xfb')](db['Interval'],{'as':_0x377f('0x131'),'foreignKey':'IntervalId'});db['ChatWebsite'][_0x377f('0xfb')](db[_0x377f('0x73')],{'as':_0x377f('0x133'),'foreignKey':_0x377f('0x134')});db[_0x377f('0x52')]['belongsToMany'](db[_0x377f('0xeb')],{'as':_0x377f('0x136'),'through':_0x377f('0x112')});db['OpenchannelQueueReport']['belongsTo'](db[_0x377f('0x4c')],{});db[_0x377f('0x54')]['belongsTo'](db[_0x377f('0xe3')],{'as':'List','foreignKey':_0x377f('0x14d')});db[_0x377f('0x54')][_0x377f('0xfb')](db[_0x377f('0x61')],{'as':'Contact','foreignKey':_0x377f('0x144')});db[_0x377f('0x54')][_0x377f('0xfb')](db['OpenchannelInteraction'],{});db[_0x377f('0x54')]['belongsTo'](db[_0x377f('0x4f')],{});db[_0x377f('0x54')]['belongsTo'](db[_0x377f('0xeb')],{});db[_0x377f('0x54')][_0x377f('0xfb')](db[_0x377f('0x51')],{});db[_0x377f('0x56')][_0x377f('0xfb')](db['User'],{'as':_0x377f('0x172'),'foreignKey':_0x377f('0xf1'),'onDelete':'restrict'});db[_0x377f('0x56')][_0x377f('0xfb')](db['ChatQueue'],{'as':_0x377f('0x173'),'foreignKey':_0x377f('0x174'),'onDelete':'restrict'});db[_0x377f('0x56')]['belongsTo'](db[_0x377f('0x52')],{'as':_0x377f('0x175'),'foreignKey':'ChatWebsiteId','onDelete':_0x377f('0x158')});db['ChatApplication'][_0x377f('0xfb')](db[_0x377f('0x154')],{'onDelete':_0x377f('0x158'),'foreignKey':_0x377f('0x159')});db[_0x377f('0x58')]['hasMany'](db[_0x377f('0x171')],{'as':_0x377f('0x13c'),'onDelete':_0x377f('0x11e'),'foreignKey':_0x377f('0x176')});db[_0x377f('0x58')][_0x377f('0xfb')](db[_0x377f('0x52')],{'as':_0x377f('0x152'),'foreignKey':'ChatWebsiteId'});db[_0x377f('0x58')][_0x377f('0xfb')](db[_0x377f('0x61')],{'as':_0x377f('0x143'),'foreignKey':_0x377f('0x144')});db['ChatInteraction'][_0x377f('0xfb')](db['User'],{'as':_0x377f('0x153'),'foreignKey':_0x377f('0xf1')});db[_0x377f('0x58')][_0x377f('0xfd')](db[_0x377f('0x154')],{'through':_0x377f('0x177'),'as':_0x377f('0x156')});db[_0x377f('0x58')][_0x377f('0xfd')](db[_0x377f('0x154')],{'through':_0x377f('0x177'),'as':_0x377f('0x157')});db[_0x377f('0x58')][_0x377f('0xfd')](db[_0x377f('0xeb')],{'as':_0x377f('0x15f'),'through':_0x377f('0x105'),'foreignKey':_0x377f('0x176')});db[_0x377f('0x171')][_0x377f('0xfb')](db[_0x377f('0xeb')],{'onDelete':'cascade','as':'User'});db[_0x377f('0x171')][_0x377f('0xfb')](db[_0x377f('0x61')],{'onDelete':_0x377f('0x11e'),'as':_0x377f('0x143'),'foreignKey':_0x377f('0x144')});db['ChatMessage'][_0x377f('0xfb')](db[_0x377f('0x58')],{'onDelete':_0x377f('0x11e'),'as':'Interaction','foreignKey':_0x377f('0x176')});db['ChatMessage'][_0x377f('0xfb')](db[_0x377f('0x160')],{'as':'Attachment','foreignKey':_0x377f('0x161')});db['ChatMessage'][_0x377f('0xfb')](db['ChatWebsite'],{'as':_0x377f('0x152'),'foreignKey':'ChatWebsiteId'});db[_0x377f('0x178')][_0x377f('0xfb')](db[_0x377f('0x61')],{'onDelete':_0x377f('0x11e'),'as':_0x377f('0x143'),'foreignKey':'ContactId'});db[_0x377f('0x178')]['belongsTo'](db[_0x377f('0x52')],{'as':_0x377f('0x152'),'foreignKey':'ChatWebsiteId'});db[_0x377f('0x10b')][_0x377f('0xfd')](db['User'],{'as':_0x377f('0x136'),'through':'UserChatQueue','hooks':!![]});db[_0x377f('0x10b')][_0x377f('0xfd')](db[_0x377f('0xd2')],{'through':_0x377f('0x179'),'as':_0x377f('0x137')});db['ChatGroup'][_0x377f('0xee')](db[_0x377f('0x17a')],{'as':_0x377f('0x13c'),'foreignKey':_0x377f('0x17b'),'onDelete':_0x377f('0x11e')});db[_0x377f('0x5c')][_0x377f('0xfd')](db[_0x377f('0xeb')],{'as':_0x377f('0x126'),'through':'chat_group_has_users'});db[_0x377f('0x170')][_0x377f('0xfb')](db[_0x377f('0x52')],{'as':'Website','foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x377f('0xee')](db['CmContact'],{'as':'Contacts','foreignKey':'CompanyId'});db[_0x377f('0x61')]['hasMany'](db[_0x377f('0x62')],{'as':_0x377f('0x127'),'foreignKey':_0x377f('0x144')});db['CmContact'][_0x377f('0xee')](db[_0x377f('0x65')],{'as':_0x377f('0x129'),'foreignKey':'ContactId'});db['CmContact'][_0x377f('0xee')](db[_0x377f('0x67')],{'as':'HopperHistories','foreignKey':'ContactId'});db['CmContact'][_0x377f('0xee')](db['ReportAgentPreview'],{'as':_0x377f('0x69'),'foreignKey':_0x377f('0x144')});db['CmContact'][_0x377f('0xee')](db['JscriptySessionReport'],{'as':_0x377f('0x12d'),'foreignKey':_0x377f('0x144')});db[_0x377f('0x61')]['hasMany'](db[_0x377f('0xf5')],{'as':_0x377f('0xf6'),'foreignKey':_0x377f('0x144'),'onDelete':_0x377f('0x158')});db[_0x377f('0x61')][_0x377f('0xee')](db['ChatInteraction'],{'as':_0x377f('0xf7'),'foreignKey':_0x377f('0x144'),'onDelete':_0x377f('0x158')});db['CmContact'][_0x377f('0xee')](db[_0x377f('0x107')],{'as':_0x377f('0xf8'),'foreignKey':_0x377f('0x144'),'onDelete':'restrict'});db[_0x377f('0x61')][_0x377f('0xee')](db[_0x377f('0x3e')],{'as':'FaxInteractions','foreignKey':_0x377f('0x144'),'onDelete':_0x377f('0x158')});db[_0x377f('0x61')][_0x377f('0xee')](db[_0x377f('0x33')],{'as':'MailInteractions','foreignKey':_0x377f('0x144'),'onDelete':'restrict'});db[_0x377f('0x61')]['belongsTo'](db[_0x377f('0x5f')],{'as':_0x377f('0x17c'),'foreignKey':'CompanyId'});db[_0x377f('0x61')][_0x377f('0xfb')](db[_0x377f('0xe3')],{'as':_0x377f('0x14c'),'foreignKey':'ListId','onDelete':'cascade'});db['CmContact'][_0x377f('0xfd')](db[_0x377f('0xeb')],{'as':_0x377f('0x15f'),'through':'cm_user_has_contacts'});db[_0x377f('0x61')][_0x377f('0xfd')](db[_0x377f('0x154')],{'as':'Tags','through':_0x377f('0x17d')});db['CmContact'][_0x377f('0xfd')](db['Tag'],{'through':'cm_contact_has_tags','as':_0x377f('0x157')});db[_0x377f('0x62')]['belongsTo'](db[_0x377f('0x61')],{'as':'Contact','foreignKey':_0x377f('0x144'),'onDelete':_0x377f('0x11e')});db[_0x377f('0x62')][_0x377f('0xfb')](db[_0x377f('0xe3')],{'as':'List','foreignKey':_0x377f('0x14d'),'onDelete':'cascade'});db['CmHopper'][_0x377f('0xfb')](db[_0x377f('0xeb')],{'as':_0x377f('0x172'),'foreignKey':_0x377f('0xf1')});db['CmHopper'][_0x377f('0xfb')](db[_0x377f('0x17')],{'as':_0x377f('0x173'),'foreignKey':_0x377f('0x128'),'onDelete':_0x377f('0x11e')});db['CmHopper'][_0x377f('0xfb')](db[_0x377f('0xd6')],{'as':_0x377f('0xd6'),'foreignKey':_0x377f('0x17e'),'onDelete':_0x377f('0x11e')});db['CmHopper'][_0x377f('0xfb')](db[_0x377f('0xeb')],{'as':_0x377f('0x153'),'foreignKey':_0x377f('0x17f')});db[_0x377f('0x63')]['belongsTo'](db[_0x377f('0x61')],{'as':_0x377f('0x143'),'foreignKey':'ContactId','onDelete':'cascade'});db['CmHopperBlack'][_0x377f('0xfb')](db[_0x377f('0xe3')],{'as':_0x377f('0x14c'),'foreignKey':_0x377f('0x14d'),'onDelete':_0x377f('0x11e')});db[_0x377f('0x63')]['belongsTo'](db[_0x377f('0x17')],{'as':_0x377f('0x173'),'foreignKey':_0x377f('0x128'),'onDelete':_0x377f('0x11e')});db[_0x377f('0x63')]['belongsTo'](db[_0x377f('0xd6')],{'as':_0x377f('0xd6'),'foreignKey':_0x377f('0x17e'),'onDelete':'cascade'});db[_0x377f('0x180')][_0x377f('0xee')](db['Condition'],{'as':{'plural':'All','singular':'OneAll'},'foreignKey':_0x377f('0x181'),'onDelete':'cascade','hooks':!![]});db[_0x377f('0x180')][_0x377f('0xee')](db[_0x377f('0x70')],{'as':{'plural':_0x377f('0x182'),'singular':_0x377f('0x183')},'foreignKey':_0x377f('0x184'),'onDelete':_0x377f('0x11e'),'hooks':!![]});db['Automation'][_0x377f('0xee')](db[_0x377f('0x6b')],{'as':_0x377f('0x185'),'foreignKey':_0x377f('0x186'),'onDelete':_0x377f('0x11e'),'hooks':!![]});db['Interval'][_0x377f('0xee')](db['Interval'],{'as':'Intervals','foreignKey':_0x377f('0x132'),'onDelete':_0x377f('0x11e'),'hooks':!![],'required':![]});db[_0x377f('0x131')][_0x377f('0xee')](db[_0x377f('0x120')],{'as':_0x377f('0xf3'),'foreignKey':_0x377f('0x132'),'onDelete':_0x377f('0x158')});db[_0x377f('0x131')]['hasMany'](db[_0x377f('0x14b')],{'as':_0x377f('0x187'),'foreignKey':_0x377f('0x132')});db['Interval'][_0x377f('0xee')](db[_0x377f('0x56')],{'as':_0x377f('0x188'),'foreignKey':_0x377f('0x132')});db[_0x377f('0x131')][_0x377f('0xee')](db[_0x377f('0x3c')],{'as':'FaxApplications','foreignKey':_0x377f('0x132')});db[_0x377f('0x131')][_0x377f('0xee')](db['SmsApplication'],{'as':'SmsApplications','foreignKey':_0x377f('0x132')});db[_0x377f('0x189')][_0x377f('0xfb')](db[_0x377f('0x116')],{});db[_0x377f('0x189')][_0x377f('0xfb')](db['AnalyticDefaultReport'],{'foreignKey':'DefaultReportId'});db[_0x377f('0x189')][_0x377f('0xfb')](db[_0x377f('0x85')],{'foreignKey':_0x377f('0x18a')});db['Sound'][_0x377f('0xfd')](db[_0x377f('0x122')],{'as':_0x377f('0x18b'),'through':'moh_has_sounds','onDelete':_0x377f('0x158')});db[_0x377f('0x154')][_0x377f('0xfd')](db[_0x377f('0x61')],{'through':_0x377f('0x17d')});db[_0x377f('0x154')][_0x377f('0xfd')](db[_0x377f('0x58')],{'through':_0x377f('0x177')});db['Tag'][_0x377f('0xfd')](db['MailInteraction'],{'through':_0x377f('0x155')});db[_0x377f('0x154')]['belongsToMany'](db[_0x377f('0x107')],{'through':_0x377f('0x166')});db[_0x377f('0x154')][_0x377f('0xfd')](db[_0x377f('0x3e')],{'through':'fax_interaction_has_tags'});db[_0x377f('0x154')]['belongsToMany'](db[_0x377f('0xf5')],{'through':_0x377f('0x16e')});db[_0x377f('0x7d')][_0x377f('0xee')](db[_0x377f('0x70')],{'as':{'plural':_0x377f('0x18c'),'singular':_0x377f('0x18d')},'foreignKey':'TriggerAllId','onDelete':_0x377f('0x11e'),'hooks':!![]});db['Trigger'][_0x377f('0xee')](db['Condition'],{'as':{'plural':_0x377f('0x18e'),'singular':_0x377f('0x18f')},'foreignKey':_0x377f('0x190'),'onDelete':'cascade','hooks':!![]});db[_0x377f('0x7d')][_0x377f('0xee')](db['Action'],{'as':'Actions','foreignKey':'TriggerId','onDelete':'cascade','hooks':!![]});db['AnalyticCustomReport'][_0x377f('0xee')](db[_0x377f('0x8b')],{'as':_0x377f('0x191'),'onDelete':'cascade','foreignKey':'CustomReportId','hooks':!![]});db[_0x377f('0x87')][_0x377f('0xee')](db['AnalyticFieldReport'],{'as':_0x377f('0x191'),'onDelete':_0x377f('0x11e'),'foreignKey':'DefaultReportId'});db[_0x377f('0x8a')][_0x377f('0xee')](db[_0x377f('0x8b')],{'as':_0x377f('0x191'),'onDelete':_0x377f('0x11e'),'foreignKey':_0x377f('0x192')});db[_0x377f('0x8b')][_0x377f('0xfb')](db['AnalyticMetric'],{'foreignKey':_0x377f('0x192')});db[_0x377f('0x8f')][_0x377f('0xee')](db[_0x377f('0x90')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x377f('0x193')});db[_0x377f('0x90')]['hasMany'](db[_0x377f('0x92')],{'as':_0x377f('0x194'),'onDelete':_0x377f('0x11e'),'foreignKey':_0x377f('0x195')});db[_0x377f('0x90')][_0x377f('0xee')](db[_0x377f('0x92')],{'as':_0x377f('0x196'),'onDelete':_0x377f('0x11e'),'foreignKey':_0x377f('0x197')});db[_0x377f('0x90')]['hasMany'](db[_0x377f('0x92')],{'as':_0x377f('0x191'),'onDelete':_0x377f('0x11e'),'foreignKey':_0x377f('0x198')});db[_0x377f('0x90')][_0x377f('0xfb')](db[_0x377f('0x8f')],{'as':_0x377f('0x152'),'foreignKey':_0x377f('0x193')});db[_0x377f('0x92')]['hasMany'](db[_0x377f('0x92')],{'as':'Subject','foreignKey':_0x377f('0x195')});db[_0x377f('0x92')]['hasMany'](db[_0x377f('0x92')],{'as':_0x377f('0x199'),'foreignKey':_0x377f('0x197')});db['SalesforceField'][_0x377f('0xee')](db[_0x377f('0x92')],{'as':_0x377f('0x19a'),'foreignKey':_0x377f('0x198')});db[_0x377f('0x92')][_0x377f('0xfb')](db['Variable'],{'as':_0x377f('0x7f'),'foreignKey':_0x377f('0x19b')});db[_0x377f('0x94')][_0x377f('0xee')](db['SugarcrmConfiguration'],{'as':_0x377f('0x19c'),'onDelete':_0x377f('0x11e'),'foreignKey':'AccountId'});db[_0x377f('0x96')]['hasMany'](db[_0x377f('0x98')],{'as':_0x377f('0x194'),'onDelete':_0x377f('0x11e'),'foreignKey':'SubjectId'});db[_0x377f('0x96')][_0x377f('0xee')](db['SugarcrmField'],{'as':_0x377f('0x196'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['SugarcrmConfiguration'][_0x377f('0xee')](db[_0x377f('0x98')],{'as':_0x377f('0x191'),'onDelete':_0x377f('0x11e'),'foreignKey':_0x377f('0x198')});db[_0x377f('0x96')][_0x377f('0xfb')](db[_0x377f('0x94')],{'as':_0x377f('0x152'),'foreignKey':'AccountId'});db['SugarcrmField'][_0x377f('0xee')](db[_0x377f('0x98')],{'as':'Subject','foreignKey':_0x377f('0x195')});db['SugarcrmField']['hasMany'](db[_0x377f('0x98')],{'as':'Description','foreignKey':_0x377f('0x197')});db[_0x377f('0x98')]['hasMany'](db[_0x377f('0x98')],{'as':_0x377f('0x19a'),'foreignKey':_0x377f('0x198')});db[_0x377f('0x98')][_0x377f('0xfb')](db['Variable'],{'as':_0x377f('0x7f'),'foreignKey':_0x377f('0x19b')});db[_0x377f('0x9a')][_0x377f('0xee')](db[_0x377f('0x19d')],{'as':_0x377f('0x19c'),'onDelete':_0x377f('0x11e'),'foreignKey':_0x377f('0x193')});db[_0x377f('0x19d')][_0x377f('0xee')](db[_0x377f('0x9c')],{'as':_0x377f('0x194'),'onDelete':_0x377f('0x11e'),'foreignKey':_0x377f('0x195')});db[_0x377f('0x19d')]['hasMany'](db[_0x377f('0x9c')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x377f('0x197')});db[_0x377f('0x19d')][_0x377f('0xee')](db[_0x377f('0x9c')],{'as':'Fields','onDelete':_0x377f('0x11e'),'foreignKey':_0x377f('0x198')});db[_0x377f('0x19d')][_0x377f('0xfb')](db['DeskAccount'],{'as':_0x377f('0x152'),'foreignKey':'AccountId'});db[_0x377f('0x19d')][_0x377f('0xfd')](db[_0x377f('0x154')],{'through':_0x377f('0x19e')});db['DeskField'][_0x377f('0xee')](db[_0x377f('0x9c')],{'as':'Subject','foreignKey':_0x377f('0x195')});db[_0x377f('0x9c')][_0x377f('0xee')](db[_0x377f('0x9c')],{'as':_0x377f('0x199'),'foreignKey':'DescriptionId'});db[_0x377f('0x9c')][_0x377f('0xee')](db[_0x377f('0x9c')],{'as':'Field','foreignKey':'FieldId'});db[_0x377f('0x9c')][_0x377f('0xfb')](db[_0x377f('0x7f')],{'as':_0x377f('0x7f'),'foreignKey':'VariableId'});db[_0x377f('0x19f')][_0x377f('0xee')](db[_0x377f('0x9f')],{'as':'Configurations','onDelete':_0x377f('0x11e'),'foreignKey':_0x377f('0x193')});db[_0x377f('0x9f')]['hasMany'](db[_0x377f('0xa0')],{'as':_0x377f('0x194'),'onDelete':_0x377f('0x11e'),'foreignKey':_0x377f('0x195')});db[_0x377f('0x9f')][_0x377f('0xee')](db['ZohoField'],{'as':_0x377f('0x196'),'onDelete':_0x377f('0x11e'),'foreignKey':_0x377f('0x197')});db[_0x377f('0x9f')][_0x377f('0xee')](db[_0x377f('0xa0')],{'as':_0x377f('0x191'),'onDelete':'cascade','foreignKey':_0x377f('0x198')});db[_0x377f('0x9f')][_0x377f('0xfb')](db[_0x377f('0x19f')],{'as':_0x377f('0x152'),'foreignKey':'AccountId'});db[_0x377f('0xa0')][_0x377f('0xee')](db[_0x377f('0xa0')],{'as':_0x377f('0x1a0'),'foreignKey':_0x377f('0x195')});db[_0x377f('0xa0')][_0x377f('0xee')](db[_0x377f('0xa0')],{'as':_0x377f('0x199'),'foreignKey':_0x377f('0x197')});db[_0x377f('0xa0')][_0x377f('0xee')](db[_0x377f('0xa0')],{'as':_0x377f('0x19a'),'foreignKey':_0x377f('0x198')});db[_0x377f('0xa0')][_0x377f('0xfb')](db[_0x377f('0x7f')],{'as':_0x377f('0x7f'),'foreignKey':'VariableId'});db[_0x377f('0x1a1')][_0x377f('0xee')](db['ZendeskConfiguration'],{'as':'Configurations','onDelete':_0x377f('0x11e'),'foreignKey':_0x377f('0x193')});db[_0x377f('0xa2')][_0x377f('0xee')](db[_0x377f('0xa3')],{'as':_0x377f('0x194'),'foreignKey':'SubjectId'});db[_0x377f('0xa2')]['hasMany'](db[_0x377f('0xa3')],{'as':_0x377f('0x196'),'foreignKey':_0x377f('0x197')});db[_0x377f('0xa2')][_0x377f('0xee')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x377f('0xa2')][_0x377f('0xfb')](db[_0x377f('0x1a1')],{'as':'Account','foreignKey':_0x377f('0x193')});db[_0x377f('0xa2')][_0x377f('0xfd')](db[_0x377f('0x154')],{'through':'int_zendesk_configuration_has_tags'});db['ZendeskField'][_0x377f('0xee')](db['ZendeskField'],{'as':_0x377f('0x1a0'),'foreignKey':_0x377f('0x195')});db['ZendeskField'][_0x377f('0xee')](db[_0x377f('0xa3')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x377f('0xa3')][_0x377f('0xee')](db['ZendeskField'],{'as':_0x377f('0x19a'),'foreignKey':_0x377f('0x198')});db[_0x377f('0xa3')][_0x377f('0xfb')](db[_0x377f('0x7f')],{'as':_0x377f('0x7f'),'foreignKey':_0x377f('0x19b')});db[_0x377f('0xa5')]['hasMany'](db[_0x377f('0xa7')],{'as':'Configurations','onDelete':_0x377f('0x11e'),'foreignKey':_0x377f('0x193')});db[_0x377f('0xa7')][_0x377f('0xee')](db['FreshdeskField'],{'as':'Subjects','onDelete':_0x377f('0x11e'),'foreignKey':_0x377f('0x195')});db[_0x377f('0xa7')]['hasMany'](db['FreshdeskField'],{'as':_0x377f('0x196'),'onDelete':_0x377f('0x11e'),'foreignKey':_0x377f('0x197')});db[_0x377f('0xa7')]['hasMany'](db[_0x377f('0xa9')],{'as':_0x377f('0x191'),'onDelete':'cascade','foreignKey':_0x377f('0x198')});db[_0x377f('0xa7')][_0x377f('0xfb')](db[_0x377f('0xa5')],{'as':_0x377f('0x152'),'foreignKey':_0x377f('0x193')});db[_0x377f('0xa7')][_0x377f('0xfd')](db[_0x377f('0x154')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x377f('0xa9')][_0x377f('0xee')](db[_0x377f('0xa9')],{'as':_0x377f('0x1a0'),'foreignKey':'SubjectId'});db[_0x377f('0xa9')][_0x377f('0xee')](db[_0x377f('0xa9')],{'as':_0x377f('0x199'),'foreignKey':_0x377f('0x197')});db[_0x377f('0xa9')][_0x377f('0xee')](db[_0x377f('0xa9')],{'as':_0x377f('0x19a'),'foreignKey':'FieldId'});db[_0x377f('0xa9')][_0x377f('0xfb')](db[_0x377f('0x7f')],{'as':_0x377f('0x7f'),'foreignKey':_0x377f('0x19b')});db['VtigerAccount'][_0x377f('0xee')](db['VtigerConfiguration'],{'as':_0x377f('0x19c'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x377f('0xab')][_0x377f('0xee')](db[_0x377f('0xac')],{'as':_0x377f('0x194'),'foreignKey':_0x377f('0x195')});db[_0x377f('0xab')][_0x377f('0xee')](db[_0x377f('0xac')],{'as':_0x377f('0x196'),'foreignKey':_0x377f('0x197')});db[_0x377f('0xab')][_0x377f('0xee')](db[_0x377f('0xac')],{'as':_0x377f('0x191'),'foreignKey':_0x377f('0x198')});db[_0x377f('0xab')][_0x377f('0xfb')](db[_0x377f('0x1a2')],{'as':_0x377f('0x152'),'foreignKey':_0x377f('0x193')});db[_0x377f('0xac')][_0x377f('0xee')](db['VtigerField'],{'as':_0x377f('0x1a0'),'foreignKey':'SubjectId'});db[_0x377f('0xac')]['hasMany'](db['VtigerField'],{'as':_0x377f('0x199'),'foreignKey':_0x377f('0x197')});db['VtigerField']['hasMany'](db[_0x377f('0xac')],{'as':_0x377f('0x19a'),'foreignKey':_0x377f('0x198')});db[_0x377f('0xac')][_0x377f('0xfb')](db[_0x377f('0x7f')],{'as':'Variable','foreignKey':_0x377f('0x19b')});db['ServicenowAccount'][_0x377f('0xee')](db[_0x377f('0xb0')],{'as':_0x377f('0x19c'),'onDelete':'cascade','foreignKey':_0x377f('0x193')});db[_0x377f('0xb0')]['hasMany'](db[_0x377f('0xb2')],{'as':_0x377f('0x194'),'foreignKey':_0x377f('0x195')});db[_0x377f('0xb0')][_0x377f('0xee')](db[_0x377f('0xb2')],{'as':'Descriptions','foreignKey':_0x377f('0x197')});db['ServicenowConfiguration']['hasMany'](db['ServicenowField'],{'as':_0x377f('0x191'),'foreignKey':_0x377f('0x198')});db[_0x377f('0xb0')]['belongsTo'](db[_0x377f('0xae')],{'as':_0x377f('0x152'),'foreignKey':_0x377f('0x193')});db['ServicenowField'][_0x377f('0xee')](db[_0x377f('0xb2')],{'as':_0x377f('0x1a0'),'foreignKey':_0x377f('0x195')});db[_0x377f('0xb2')]['hasMany'](db['ServicenowField'],{'as':_0x377f('0x199'),'foreignKey':_0x377f('0x197')});db[_0x377f('0xb2')][_0x377f('0xee')](db[_0x377f('0xb2')],{'as':_0x377f('0x19a'),'foreignKey':_0x377f('0x198')});db['ServicenowField']['belongsTo'](db[_0x377f('0x7f')],{'as':_0x377f('0x7f'),'foreignKey':'VariableId'});db[_0x377f('0xb4')][_0x377f('0xee')](db[_0x377f('0xb5')],{'as':_0x377f('0x19c'),'onDelete':'cascade','foreignKey':'AccountId'});db['Dynamics365Configuration'][_0x377f('0xee')](db[_0x377f('0xb7')],{'as':_0x377f('0x194'),'onDelete':_0x377f('0x11e'),'foreignKey':_0x377f('0x195')});db['Dynamics365Configuration'][_0x377f('0xee')](db['Dynamics365Field'],{'as':_0x377f('0x196'),'onDelete':_0x377f('0x11e'),'foreignKey':_0x377f('0x197')});db[_0x377f('0xb5')][_0x377f('0xee')](db[_0x377f('0xb7')],{'as':_0x377f('0x191'),'onDelete':_0x377f('0x11e'),'foreignKey':_0x377f('0x198')});db['Dynamics365Configuration'][_0x377f('0xfb')](db[_0x377f('0xb4')],{'as':'Account','foreignKey':_0x377f('0x193')});db[_0x377f('0xb7')][_0x377f('0xee')](db[_0x377f('0xb7')],{'as':_0x377f('0x1a0'),'foreignKey':_0x377f('0x195')});db['Dynamics365Field'][_0x377f('0xee')](db[_0x377f('0xb7')],{'as':_0x377f('0x199'),'foreignKey':_0x377f('0x197')});db[_0x377f('0xb7')][_0x377f('0xee')](db[_0x377f('0xb7')],{'as':_0x377f('0x19a'),'foreignKey':_0x377f('0x198')});db[_0x377f('0xb7')]['belongsTo'](db['Variable'],{'as':_0x377f('0x7f'),'foreignKey':_0x377f('0x19b')});db[_0x377f('0x1a3')][_0x377f('0xee')](db['FreshsalesConfiguration'],{'as':'Configurations','onDelete':_0x377f('0x11e'),'foreignKey':_0x377f('0x193')});db[_0x377f('0x1a4')][_0x377f('0xee')](db[_0x377f('0xbb')],{'as':_0x377f('0x194'),'foreignKey':_0x377f('0x195')});db[_0x377f('0x1a4')][_0x377f('0xee')](db[_0x377f('0xbb')],{'as':_0x377f('0x196'),'foreignKey':_0x377f('0x197')});db[_0x377f('0x1a4')][_0x377f('0xee')](db[_0x377f('0xbb')],{'as':_0x377f('0x191'),'foreignKey':_0x377f('0x198')});db[_0x377f('0x1a4')][_0x377f('0xfb')](db[_0x377f('0x1a3')],{'as':_0x377f('0x152'),'foreignKey':'AccountId'});db['FreshsalesField'][_0x377f('0xee')](db['FreshsalesField'],{'as':_0x377f('0x1a0'),'foreignKey':_0x377f('0x195')});db['FreshsalesField'][_0x377f('0xee')](db[_0x377f('0xbb')],{'as':_0x377f('0x199'),'foreignKey':'DescriptionId'});db[_0x377f('0xbb')][_0x377f('0xee')](db[_0x377f('0xbb')],{'as':_0x377f('0x19a'),'foreignKey':'FieldId'});db['FreshsalesField'][_0x377f('0xfb')](db[_0x377f('0x7f')],{'as':_0x377f('0x7f'),'foreignKey':_0x377f('0x19b')});db[_0x377f('0xbe')][_0x377f('0xfb')](db['ChatWebsite'],{});db['ChatQueueReport'][_0x377f('0xfb')](db[_0x377f('0xe3')],{'as':_0x377f('0x14c'),'foreignKey':_0x377f('0x14d')});db[_0x377f('0xbe')][_0x377f('0xfb')](db['CmContact'],{'as':_0x377f('0x143'),'foreignKey':'ContactId'});db[_0x377f('0xbe')]['belongsTo'](db[_0x377f('0x58')],{});db['ChatQueueReport'][_0x377f('0xfb')](db[_0x377f('0x171')],{});db[_0x377f('0xbe')]['belongsTo'](db[_0x377f('0xeb')],{});db[_0x377f('0xbe')][_0x377f('0xfb')](db[_0x377f('0x10b')],{});db['ChatInternalMessage'][_0x377f('0xfb')](db[_0x377f('0xeb')],{'onDelete':'cascade','foreignKey':_0x377f('0x1a5')});db[_0x377f('0x17a')]['belongsTo'](db['User'],{'onDelete':_0x377f('0x11e'),'foreignKey':_0x377f('0x1a6')});db[_0x377f('0x12c')][_0x377f('0xee')](db[_0x377f('0xc2')],{'foreignKey':_0x377f('0x1a7'),'onDelete':_0x377f('0x11e')});db[_0x377f('0x12c')][_0x377f('0xee')](db[_0x377f('0xc0')],{'foreignKey':_0x377f('0x1a7'),'onDelete':_0x377f('0x11e')});db['SmsQueueReport'][_0x377f('0xfb')](db[_0x377f('0x46')],{});db[_0x377f('0xc5')]['belongsTo'](db['CmList'],{'as':_0x377f('0x14c'),'foreignKey':_0x377f('0x14d')});db[_0x377f('0xc5')][_0x377f('0xfb')](db[_0x377f('0x61')],{'as':_0x377f('0x143'),'foreignKey':_0x377f('0x144')});db[_0x377f('0xc5')][_0x377f('0xfb')](db[_0x377f('0x107')],{});db[_0x377f('0xc5')]['belongsTo'](db[_0x377f('0x49')],{});db[_0x377f('0xc5')]['belongsTo'](db[_0x377f('0xeb')],{});db[_0x377f('0xc5')][_0x377f('0xfb')](db[_0x377f('0x4a')],{});db[_0x377f('0xc8')][_0x377f('0xee')](db[_0x377f('0x12c')],{'foreignKey':_0x377f('0x1a8')});db['JscriptyProject'][_0x377f('0xee')](db[_0x377f('0xc2')],{'foreignKey':_0x377f('0x1a8')});db[_0x377f('0xc8')][_0x377f('0xee')](db[_0x377f('0xc0')],{'foreignKey':_0x377f('0x1a8')});db['SquareProject'][_0x377f('0xfd')](db[_0x377f('0xeb')],{'as':_0x377f('0x15f'),'through':_0x377f('0x11d')});db['Team']['belongsToMany'](db[_0x377f('0xeb')],{'as':_0x377f('0x136'),'through':_0x377f('0x103')});db[_0x377f('0xd2')]['belongsToMany'](db['VoiceQueue'],{'through':_0x377f('0x138'),'as':_0x377f('0x1a9')});db[_0x377f('0xd2')][_0x377f('0xfd')](db['MailQueue'],{'through':_0x377f('0x150'),'as':_0x377f('0x10a')});db['Team'][_0x377f('0xfd')](db[_0x377f('0x10b')],{'through':'team_has_chat_queues','as':_0x377f('0x1aa')});db['Team'][_0x377f('0xfd')](db[_0x377f('0x42')],{'through':_0x377f('0x162'),'as':_0x377f('0x10c')});db['Team'][_0x377f('0xfd')](db['SmsQueue'],{'through':_0x377f('0x169'),'as':'SmsQueues'});db[_0x377f('0xd2')][_0x377f('0xfd')](db[_0x377f('0x51')],{'through':_0x377f('0x1ab'),'as':_0x377f('0x10f')});db['Campaign'][_0x377f('0xee')](db[_0x377f('0x62')],{'as':_0x377f('0x127'),'foreignKey':_0x377f('0x17e')});db[_0x377f('0xd6')][_0x377f('0xee')](db['CmHopperFinal'],{'as':_0x377f('0x129'),'foreignKey':_0x377f('0x17e')});db[_0x377f('0xd6')][_0x377f('0xee')](db['CmHopperHistory'],{'as':_0x377f('0x12a'),'foreignKey':_0x377f('0x17e')});db[_0x377f('0xd6')][_0x377f('0xee')](db[_0x377f('0x63')],{'as':_0x377f('0x12b'),'foreignKey':_0x377f('0x17e')});db['Campaign'][_0x377f('0xfb')](db['Trunk'],{'as':'Trunk','foreignKey':_0x377f('0x12f')});db[_0x377f('0xd6')][_0x377f('0xfb')](db[_0x377f('0x12e')],{'as':_0x377f('0x1ac'),'foreignKey':'TrunkBackupId'});db[_0x377f('0xd6')]['belongsTo'](db['Interval'],{'as':_0x377f('0x131'),'foreignKey':'IntervalId'});db['Campaign'][_0x377f('0xfb')](db[_0x377f('0xcd')],{'as':'SquareProject','foreignKey':_0x377f('0x1ad')});db[_0x377f('0xd6')]['belongsToMany'](db['CmList'],{'as':_0x377f('0x101'),'through':_0x377f('0x1ae')});db[_0x377f('0xd6')][_0x377f('0xfd')](db['CmList'],{'as':_0x377f('0x139'),'through':'campaigns_has_cm_blacklists'});db['MailTransferReport'][_0x377f('0xfb')](db['MailMessage'],{});db[_0x377f('0xdb')][_0x377f('0xfb')](db[_0x377f('0x33')],{});db[_0x377f('0xdb')]['belongsTo'](db['MailAccount'],{'foreignKey':_0x377f('0x1af'),'as':_0x377f('0x1b0')});db['MailTransferReport'][_0x377f('0xfb')](db['User'],{'foreignKey':_0x377f('0x1b1'),'as':_0x377f('0x1b2')});db[_0x377f('0xdb')][_0x377f('0xfb')](db[_0x377f('0xeb')],{'foreignKey':_0x377f('0x1b3'),'as':'ToAgent'});db[_0x377f('0xdb')][_0x377f('0xfb')](db[_0x377f('0x30')],{'foreignKey':_0x377f('0x1b4'),'as':'ToQueue'});db[_0x377f('0xdb')][_0x377f('0xfb')](db[_0x377f('0x116')],{'foreignKey':'ToMailAccountId','as':_0x377f('0x1b5')});db[_0x377f('0xdd')]['belongsTo'](db[_0x377f('0x171')],{});db['ChatTransferReport'][_0x377f('0xfb')](db[_0x377f('0x58')],{});db['ChatTransferReport'][_0x377f('0xfb')](db[_0x377f('0x52')],{'foreignKey':_0x377f('0x1b6'),'as':'FromAccount'});db['ChatTransferReport'][_0x377f('0xfb')](db['User'],{'foreignKey':_0x377f('0x1b1'),'as':_0x377f('0x1b2')});db['ChatTransferReport'][_0x377f('0xfb')](db[_0x377f('0xeb')],{'foreignKey':'ToUserId','as':_0x377f('0x1b7')});db[_0x377f('0xdd')][_0x377f('0xfb')](db[_0x377f('0x10b')],{'foreignKey':_0x377f('0x1b8'),'as':_0x377f('0x1b9')});db[_0x377f('0xdd')][_0x377f('0xfb')](db[_0x377f('0x52')],{'foreignKey':'ToChatWebsiteId','as':_0x377f('0x1b5')});db['FaxTransferReport'][_0x377f('0xfb')](db[_0x377f('0x40')],{});db[_0x377f('0xdf')][_0x377f('0xfb')](db[_0x377f('0x3e')],{});db['FaxTransferReport'][_0x377f('0xfb')](db[_0x377f('0x113')],{'foreignKey':_0x377f('0x1ba'),'as':_0x377f('0x1b0')});db['FaxTransferReport'][_0x377f('0xfb')](db[_0x377f('0xeb')],{'foreignKey':_0x377f('0x1b1'),'as':'FromAgent'});db[_0x377f('0xdf')]['belongsTo'](db['User'],{'foreignKey':_0x377f('0x1b3'),'as':'ToAgent'});db['FaxTransferReport'][_0x377f('0xfb')](db[_0x377f('0x42')],{'foreignKey':_0x377f('0x1bb'),'as':_0x377f('0x1b9')});db[_0x377f('0xdf')][_0x377f('0xfb')](db[_0x377f('0x113')],{'foreignKey':_0x377f('0x1bc'),'as':_0x377f('0x1b5')});db[_0x377f('0x1bd')][_0x377f('0xfb')](db[_0x377f('0x4f')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x377f('0x1bd')][_0x377f('0xfb')](db['OpenchannelAccount'],{'foreignKey':_0x377f('0x1be'),'as':'FromAccount'});db['OpenchannelTransferReport'][_0x377f('0xfb')](db[_0x377f('0xeb')],{'foreignKey':_0x377f('0x1b1'),'as':_0x377f('0x1b2')});db['OpenchannelTransferReport'][_0x377f('0xfb')](db['User'],{'foreignKey':_0x377f('0x1b3'),'as':_0x377f('0x1b7')});db['OpenchannelTransferReport'][_0x377f('0xfb')](db[_0x377f('0x51')],{'foreignKey':_0x377f('0x1bf'),'as':_0x377f('0x1b9')});db[_0x377f('0x1bd')]['belongsTo'](db[_0x377f('0x4c')],{'foreignKey':_0x377f('0x1c0'),'as':_0x377f('0x1b5')});db['SmsTransferReport'][_0x377f('0xfb')](db[_0x377f('0x49')],{});db[_0x377f('0xe1')][_0x377f('0xfb')](db['SmsInteraction'],{});db[_0x377f('0xe1')][_0x377f('0xfb')](db[_0x377f('0x46')],{'foreignKey':'FromSmsAccountId','as':_0x377f('0x1b0')});db[_0x377f('0xe1')][_0x377f('0xfb')](db['User'],{'foreignKey':_0x377f('0x1b1'),'as':_0x377f('0x1b2')});db[_0x377f('0xe1')][_0x377f('0xfb')](db[_0x377f('0xeb')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x377f('0xe1')][_0x377f('0xfb')](db[_0x377f('0x4a')],{'foreignKey':_0x377f('0x1c1'),'as':_0x377f('0x1b9')});db[_0x377f('0xe1')][_0x377f('0xfb')](db[_0x377f('0x46')],{'foreignKey':_0x377f('0x1c2'),'as':_0x377f('0x1b5')});db[_0x377f('0xe3')]['hasMany'](db[_0x377f('0x15b')],{'as':_0x377f('0x148'),'foreignKey':_0x377f('0x14d')});db['CmList'][_0x377f('0xee')](db[_0x377f('0x6a')],{'as':_0x377f('0x1c3'),'foreignKey':_0x377f('0x14d')});db[_0x377f('0xe3')][_0x377f('0xee')](db[_0x377f('0x61')],{'as':_0x377f('0x1c4'),'onDelete':'cascade','foreignKey':'ListId'});db['CmList'][_0x377f('0xee')](db[_0x377f('0x65')],{'as':'HopperFinals','foreignKey':'ListId'});db[_0x377f('0xe3')][_0x377f('0xee')](db['CmHopperHistory'],{'as':_0x377f('0xf4'),'foreignKey':_0x377f('0x14d')});db[_0x377f('0xe3')][_0x377f('0xee')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x377f('0x14d')});db[_0x377f('0xe3')]['belongsToMany'](db[_0x377f('0x17')],{'as':_0x377f('0x1c5'),'through':_0x377f('0x135')});db[_0x377f('0xe3')][_0x377f('0xfd')](db[_0x377f('0xeb')],{'as':_0x377f('0x136'),'through':_0x377f('0x102')});db[_0x377f('0xe4')][_0x377f('0xee')](db[_0x377f('0x120')],{'as':_0x377f('0xf3'),'onDelete':'restrict'});db[_0x377f('0xe4')][_0x377f('0xfd')](db['User'],{'as':_0x377f('0x136'),'through':_0x377f('0x1c6')});db[_0x377f('0xe6')][_0x377f('0xee')](db['User'],{'as':_0x377f('0x15f'),'foreignKey':_0x377f('0xfc')});db[_0x377f('0xe6')]['hasMany'](db[_0x377f('0xe7')],{'as':'UserProfileSections','foreignKey':_0x377f('0xfc'),'onDelete':_0x377f('0x11e')});db['UserProfileSection'][_0x377f('0xee')](db['UserProfileResource'],{'as':'Resources','foreignKey':'sectionId','onDelete':'cascade'});module[_0x377f('0x1c7')]={'db':db,'dbH':dbH}; \ No newline at end of file +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 diff --git a/server/routes.js b/server/routes.js index 7f8ef55..ed50ed1 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3bfd=['./api/condition','./api/interval','/api/cdr','./api/cdr','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','/api/mail/reports/transfer','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/openchannelTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileResource','/api/auth/local','./api/authLocal','/api/auth/google','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','/api/pm2','./api/pm2','/apidoc','static','join','root','/www','/demo','/snippet','snippet','1.0.16','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','appPath','/index.html','path','express','express-winston','util','./config/environment','./config/logger','auth','default','format','method','x-forwarded-for','headers','connection','remoteAddress','url','responseTime','name','role','logger','%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)','user','other','agent_name','test','/api/voice/chanspy','./api/voiceChanSpy','use','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','/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/voiceDialReport','/api/voice/agents/reports','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','/api/fax/applications','./api/faxApplication','./api/faxInteraction','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','/api/sms/applications','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions'];(function(_0x7e6d00,_0x1660cf){var _0x2a81d7=function(_0x1ec515){while(--_0x1ec515){_0x7e6d00['push'](_0x7e6d00['shift']());}};_0x2a81d7(++_0x1660cf);}(_0x3bfd,0x18f));var _0xd3bf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3bfd[_0x14add3];return _0x4a174f;};'use strict';var path=require(_0xd3bf('0x0'));var express=require(_0xd3bf('0x1'));var ewinston=require(_0xd3bf('0x2'));var util=require(_0xd3bf('0x3'));var errors=require('./errors');var config=require(_0xd3bf('0x4'));var logger=require(_0xd3bf('0x5'))('api');var authLogger=require(_0xd3bf('0x5'))(_0xd3bf('0x6'));exports[_0xd3bf('0x7')]=function(_0xd81077){_0xd81077['use'](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x54a072,_0x24cd0c){return util[_0xd3bf('0x8')]('%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s',_0x54a072[_0xd3bf('0x9')],_0x54a072['headers'][_0xd3bf('0xa')]?_0x54a072[_0xd3bf('0xb')][_0xd3bf('0xa')]:_0x54a072[_0xd3bf('0xc')][_0xd3bf('0xd')]||_0x54a072['ip'],_0x54a072[_0xd3bf('0xe')],_0x24cd0c['statusCode'],_0x24cd0c[_0xd3bf('0xf')],_0x54a072['user']?_0x54a072['user']['id']:null,_0x54a072['user']?_0x54a072['user'][_0xd3bf('0x10')]:null,_0x54a072['user']?_0x54a072['user'][_0xd3bf('0x11')]:null);}}));_0xd81077['use'](ewinston[_0xd3bf('0x12')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x3e61d6,_0x385cba){var _0x53c415=_0xd3bf('0x13');if(_0x3e61d6[_0xd3bf('0x14')]&&_0x3e61d6[_0xd3bf('0x14')][_0xd3bf('0x15')]&&_0x3e61d6['body'][_0xd3bf('0x16')]){_0x53c415=_0xd3bf('0x17');}return util[_0xd3bf('0x8')](_0x53c415,_0x3e61d6['method'],_0x3e61d6[_0xd3bf('0xb')][_0xd3bf('0xa')]?_0x3e61d6[_0xd3bf('0xb')][_0xd3bf('0xa')]:_0x3e61d6[_0xd3bf('0xc')]['remoteAddress']||_0x3e61d6['ip'],_0x3e61d6[_0xd3bf('0xe')],_0x385cba['statusCode'],_0x385cba[_0xd3bf('0xf')],_0x3e61d6[_0xd3bf('0x18')]?_0x3e61d6[_0xd3bf('0x18')]['id']:null,_0x3e61d6[_0xd3bf('0x18')]?_0x3e61d6[_0xd3bf('0x18')][_0xd3bf('0x10')]:null,_0x3e61d6['user']?_0x3e61d6['user']['role']:null,_0x3e61d6['body']&&_0x3e61d6[_0xd3bf('0x14')]['device']?_0x3e61d6[_0xd3bf('0x14')][_0xd3bf('0x15')]:_0xd3bf('0x19'),_0x3e61d6['body']&&_0x3e61d6[_0xd3bf('0x14')][_0xd3bf('0x16')]?_0x3e61d6[_0xd3bf('0x14')]['agent_id']:'',_0x3e61d6[_0xd3bf('0x14')]&&_0x3e61d6[_0xd3bf('0x14')][_0xd3bf('0x1a')]?_0x3e61d6[_0xd3bf('0x14')]['agent_name']:'');},'ignoreRoute':function(_0x53f91a){var _0x10ba8e=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x10ba8e[_0xd3bf('0x1b')](_0x53f91a[_0xd3bf('0xe')]);}}));_0xd81077['use']('/api/users',require('./api/user'));_0xd81077['use'](_0xd3bf('0x1c'),require(_0xd3bf('0x1d')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x1f'),require(_0xd3bf('0x20')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x21'),require(_0xd3bf('0x22')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x23'),require(_0xd3bf('0x24')));_0xd81077[_0xd3bf('0x1e')]('/api/voice/queues',require(_0xd3bf('0x25')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x26'),require('./api/voiceRecording'));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x27'),require(_0xd3bf('0x28')));_0xd81077['use'](_0xd3bf('0x29'),require('./api/voiceMail'));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x2a'),require(_0xd3bf('0x2b')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x2c'),require(_0xd3bf('0x2d')));_0xd81077['use'](_0xd3bf('0x2e'),require(_0xd3bf('0x2f')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x30'),require('./api/voiceAgentReport'));_0xd81077['use']('/api/voice/queues/reports',require('./api/voiceQueueReport'));_0xd81077['use'](_0xd3bf('0x31'),require(_0xd3bf('0x32')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x33'),require(_0xd3bf('0x34')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x35'),require(_0xd3bf('0x36')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x37'),require('./api/mailServerOut'));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x38'),require(_0xd3bf('0x39')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x3a'),require(_0xd3bf('0x3b')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x3c'),require(_0xd3bf('0x3d')));_0xd81077['use'](_0xd3bf('0x3e'),require(_0xd3bf('0x3f')));_0xd81077[_0xd3bf('0x1e')]('/api/mail/messages',require(_0xd3bf('0x40')));_0xd81077['use'](_0xd3bf('0x41'),require(_0xd3bf('0x42')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x43'),require(_0xd3bf('0x44')));_0xd81077['use'](_0xd3bf('0x45'),require(_0xd3bf('0x46')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x47'),require('./api/dashboardItem'));_0xd81077['use'](_0xd3bf('0x48'),require('./api/faxAccount'));_0xd81077['use'](_0xd3bf('0x49'),require(_0xd3bf('0x4a')));_0xd81077[_0xd3bf('0x1e')]('/api/fax/interactions',require(_0xd3bf('0x4b')));_0xd81077[_0xd3bf('0x1e')]('/api/fax/messages',require(_0xd3bf('0x4c')));_0xd81077['use'](_0xd3bf('0x4d'),require('./api/faxQueue'));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x4e'),require('./api/faxQueueReport'));_0xd81077['use']('/api/sms/accounts',require('./api/smsAccount'));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x4f'),require('./api/smsApplication'));_0xd81077[_0xd3bf('0x1e')]('/api/sms/interactions',require(_0xd3bf('0x50')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x51'),require(_0xd3bf('0x52')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x53'),require(_0xd3bf('0x54')));_0xd81077[_0xd3bf('0x1e')]('/api/openchannel/accounts',require('./api/openchannelAccount'));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x55'),require(_0xd3bf('0x56')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x57'),require(_0xd3bf('0x58')));_0xd81077[_0xd3bf('0x1e')]('/api/openchannel/messages',require(_0xd3bf('0x59')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x5a'),require(_0xd3bf('0x5b')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x5c'),require(_0xd3bf('0x5d')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x5e'),require(_0xd3bf('0x5f')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x60'),require(_0xd3bf('0x61')));_0xd81077['use'](_0xd3bf('0x62'),require('./api/chatInteraction'));_0xd81077[_0xd3bf('0x1e')]('/api/chat/messages',require(_0xd3bf('0x63')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x64'),require(_0xd3bf('0x65')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x66'),require(_0xd3bf('0x67')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x68'),require(_0xd3bf('0x69')));_0xd81077['use'](_0xd3bf('0x6a'),require(_0xd3bf('0x6b')));_0xd81077['use']('/api/cm/companies',require(_0xd3bf('0x6c')));_0xd81077['use']('/api/cm/contacts',require('./api/cmContact'));_0xd81077['use']('/api/cm/hopper',require(_0xd3bf('0x6d')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x6e'),require(_0xd3bf('0x6f')));_0xd81077['use'](_0xd3bf('0x70'),require(_0xd3bf('0x71')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x72'),require(_0xd3bf('0x73')));_0xd81077['use'](_0xd3bf('0x74'),require(_0xd3bf('0x75')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x76'),require(_0xd3bf('0x77')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x78'),require('./api/automation'));_0xd81077[_0xd3bf('0x1e')]('/api/canned_answers',require(_0xd3bf('0x79')));_0xd81077['use'](_0xd3bf('0x7a'),require(_0xd3bf('0x7b')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x7c'),require(_0xd3bf('0x7d')));_0xd81077[_0xd3bf('0x1e')]('/api/intervals',require(_0xd3bf('0x7e')));_0xd81077[_0xd3bf('0x1e')]('/api/pauses',require('./api/pause'));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x7f'),require(_0xd3bf('0x80')));_0xd81077[_0xd3bf('0x1e')]('/api/voiceQueuesLog',require('./api/voiceQueuesLog'));_0xd81077[_0xd3bf('0x1e')]('/api/schedules',require('./api/schedule'));_0xd81077[_0xd3bf('0x1e')]('/api/sounds',require('./api/sound'));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x81'),require(_0xd3bf('0x82')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x83'),require(_0xd3bf('0x84')));_0xd81077['use'](_0xd3bf('0x85'),require(_0xd3bf('0x86')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x87'),require(_0xd3bf('0x88')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x89'),require(_0xd3bf('0x8a')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x8b'),require(_0xd3bf('0x8c')));_0xd81077[_0xd3bf('0x1e')]('/api/analytics/custom_reports',require(_0xd3bf('0x8d')));_0xd81077['use'](_0xd3bf('0x8e'),require(_0xd3bf('0x8f')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x90'),require('./api/analyticExtractedReport'));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x91'),require(_0xd3bf('0x92')));_0xd81077[_0xd3bf('0x1e')]('/api/analytics/field_reports',require(_0xd3bf('0x93')));_0xd81077['use']('/api/analytics/tree_reports',require(_0xd3bf('0x94')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x95'),require(_0xd3bf('0x96')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x97'),require(_0xd3bf('0x98')));_0xd81077['use']('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0xd81077[_0xd3bf('0x1e')]('/api/integrations/sugarcrm/accounts',require(_0xd3bf('0x99')));_0xd81077['use'](_0xd3bf('0x9a'),require(_0xd3bf('0x9b')));_0xd81077['use'](_0xd3bf('0x9c'),require(_0xd3bf('0x9d')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0x9e'),require(_0xd3bf('0x9f')));_0xd81077['use'](_0xd3bf('0xa0'),require(_0xd3bf('0xa1')));_0xd81077['use'](_0xd3bf('0xa2'),require('./api/intDeskField'));_0xd81077[_0xd3bf('0x1e')]('/api/integrations/zoho/accounts',require(_0xd3bf('0xa3')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0xa4'),require(_0xd3bf('0xa5')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0xa6'),require('./api/intZohoField'));_0xd81077[_0xd3bf('0x1e')]('/api/integrations/zendesk/accounts',require('./api/intZendeskAccount'));_0xd81077[_0xd3bf('0x1e')]('/api/integrations/zendesk/configurations',require(_0xd3bf('0xa7')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0xa8'),require(_0xd3bf('0xa9')));_0xd81077[_0xd3bf('0x1e')]('/api/integrations/freshdesk/accounts',require('./api/intFreshdeskAccount'));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0xaa'),require('./api/intFreshdeskConfiguration'));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0xab'),require(_0xd3bf('0xac')));_0xd81077['use'](_0xd3bf('0xad'),require(_0xd3bf('0xae')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0xaf'),require(_0xd3bf('0xb0')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0xb1'),require('./api/intVtigerField'));_0xd81077['use'](_0xd3bf('0xb2'),require('./api/intServicenowAccount'));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0xb3'),require(_0xd3bf('0xb4')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0xb5'),require(_0xd3bf('0xb6')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0xb7'),require('./api/intDynamics365Account'));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0xb8'),require(_0xd3bf('0xb9')));_0xd81077['use']('/api/integrations/dynamics365/fields',require('./api/intDynamics365Field'));_0xd81077['use'](_0xd3bf('0xba'),require('./api/intFreshsalesAccount'));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0xbb'),require(_0xd3bf('0xbc')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0xbd'),require(_0xd3bf('0xbe')));_0xd81077['use'](_0xd3bf('0xbf'),require(_0xd3bf('0xc0')));_0xd81077['use'](_0xd3bf('0xc1'),require('./api/chatQueueReport'));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0xc2'),require('./api/chatInternalMessage'));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0xc3'),require(_0xd3bf('0xc4')));_0xd81077[_0xd3bf('0x1e')]('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0xd81077['use']('/api/jscripty/sessions/reports',require(_0xd3bf('0xc5')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0xc6'),require(_0xd3bf('0xc7')));_0xd81077['use'](_0xd3bf('0xc8'),require(_0xd3bf('0xc9')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0xca'),require(_0xd3bf('0xcb')));_0xd81077['use']('/api/jscripty/projects',require('./api/jscriptyProject'));_0xd81077[_0xd3bf('0x1e')]('/api/settings',require(_0xd3bf('0xcc')));_0xd81077['use'](_0xd3bf('0xcd'),require(_0xd3bf('0xce')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0xcf'),require(_0xd3bf('0xd0')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0xd1'),require(_0xd3bf('0xd2')));_0xd81077['use'](_0xd3bf('0xd3'),require(_0xd3bf('0xd4')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0xd5'),require(_0xd3bf('0xd6')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0xd7'),require('./api/license'));_0xd81077['use'](_0xd3bf('0xd8'),require(_0xd3bf('0xd9')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0xda'),require(_0xd3bf('0xdb')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0xdc'),require(_0xd3bf('0xdd')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0xde'),require('./api/plugin'));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0xdf'),require('./api/mailTransferReport'));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0xe0'),require('./api/chatTransferReport'));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0xe1'),require('./api/faxTransferReport'));_0xd81077[_0xd3bf('0x1e')]('/api/openchannel/reports/transfer',require(_0xd3bf('0xe2')));_0xd81077[_0xd3bf('0x1e')]('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0xe3'),require(_0xd3bf('0xe4')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0xe5'),require(_0xd3bf('0xe6')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0xe7'),require('./api/userProfile'));_0xd81077['use'](_0xd3bf('0xe8'),require('./api/userProfileSection'));_0xd81077[_0xd3bf('0x1e')]('/api/userProfile/resources',require(_0xd3bf('0xe9')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0xea'),require(_0xd3bf('0xeb')));_0xd81077['use'](_0xd3bf('0xec'),require('./api/authGoogle'));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0xed'),require('./api/jira'));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0xee'),require(_0xd3bf('0xef')));_0xd81077['use'](_0xd3bf('0xf0'),require(_0xd3bf('0xf1')));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0xf2'),require('./api/system'));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0xf3'),require(_0xd3bf('0xf4')));_0xd81077['use'](_0xd3bf('0xf5'),express[_0xd3bf('0xf6')](path[_0xd3bf('0xf7')](config[_0xd3bf('0xf8')],_0xd3bf('0xf5'))));_0xd81077[_0xd3bf('0x1e')]('/www',express['static'](path['join'](config[_0xd3bf('0xf8')],_0xd3bf('0xf9'))));_0xd81077[_0xd3bf('0x1e')]('/demo',express[_0xd3bf('0xf6')](path['join'](config[_0xd3bf('0xf8')],_0xd3bf('0xfa'))));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0xfb'),express[_0xd3bf('0xf6')](path['join'](config[_0xd3bf('0xf8')],_0xd3bf('0xfc'),_0xd3bf('0xfd'))));_0xd81077[_0xd3bf('0x1e')](_0xd3bf('0xfe'),express[_0xd3bf('0xf6')](path[_0xd3bf('0xf7')](config[_0xd3bf('0xf8')],_0xd3bf('0xff'))));_0xd81077[_0xd3bf('0x100')](_0xd3bf('0x101'))[_0xd3bf('0x102')](errors[0x194]);_0xd81077['route']('/*')[_0xd3bf('0x102')](function(_0x1264a0,_0x14bbe2){_0x14bbe2[_0xd3bf('0x103')](path['resolve'](_0xd81077[_0xd3bf('0x102')](_0xd3bf('0x104'))+_0xd3bf('0x105')));});}; \ No newline at end of file +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 diff --git a/server/rpc/index.js b/server/rpc/index.js index 5283270..cae5d44 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa3be=['../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.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/reportAgentPreview/reportAgentPreview.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/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc'];(function(_0x1b2bde,_0x32ea63){var _0x1743b9=function(_0x1202ca){while(--_0x1202ca){_0x1b2bde['push'](_0x1b2bde['shift']());}};_0x1743b9(++_0x32ea63);}(_0xa3be,0x80));var _0xea3b=function(_0x1355ae,_0x108314){_0x1355ae=_0x1355ae-0x0;var _0x15bd53=_0xa3be[_0x1355ae];return _0x15bd53;};'use strict';var jayson=require(_0xea3b('0x0'));var BPromise=require(_0xea3b('0x1'));var _=require(_0xea3b('0x2'));var config=require(_0xea3b('0x3'));exports[_0xea3b('0x4')]=function(){return new BPromise(function(_0x3c2994,_0x58447e){var _0x1ef5ca={};_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0x6')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require('../api/voiceExtension/voiceExtension.rpc'));_0x1ef5ca=_['merge'](_0x1ef5ca,require(_0xea3b('0x7')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0x8')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0x9')));_0x1ef5ca=_['merge'](_0x1ef5ca,require(_0xea3b('0xa')));_0x1ef5ca=_['merge'](_0x1ef5ca,require(_0xea3b('0xb')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0xc')));_0x1ef5ca=_['merge'](_0x1ef5ca,require('../api/memberReport/memberReport.rpc'));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require('../api/trunk/trunk.rpc'));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0xd')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0xe')));_0x1ef5ca=_['merge'](_0x1ef5ca,require(_0xea3b('0xf')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0x10')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0x11')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0x12')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0x13')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require('../api/mailApplication/mailApplication.rpc'));_0x1ef5ca=_['merge'](_0x1ef5ca,require(_0xea3b('0x14')));_0x1ef5ca=_['merge'](_0x1ef5ca,require(_0xea3b('0x15')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require('../api/faxApplication/faxApplication.rpc'));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0x16')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require('../api/faxMessage/faxMessage.rpc'));_0x1ef5ca=_['merge'](_0x1ef5ca,require(_0xea3b('0x17')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0x18')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0x19')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require('../api/smsInteraction/smsInteraction.rpc'));_0x1ef5ca=_['merge'](_0x1ef5ca,require(_0xea3b('0x1a')));_0x1ef5ca=_['merge'](_0x1ef5ca,require(_0xea3b('0x1b')));_0x1ef5ca=_['merge'](_0x1ef5ca,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0x1c')));_0x1ef5ca=_['merge'](_0x1ef5ca,require(_0xea3b('0x1d')));_0x1ef5ca=_['merge'](_0x1ef5ca,require(_0xea3b('0x1e')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0x1f')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0x20')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0x21')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0x22')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0x23')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0x24')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0x25')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0x26')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0x27')));_0x1ef5ca=_['merge'](_0x1ef5ca,require(_0xea3b('0x28')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0x29')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require('../api/sound/sound.rpc'));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0x2a')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0x2b')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0x2c')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0x2d')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0x2e')));_0x1ef5ca=_['merge'](_0x1ef5ca,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x1ef5ca=_['merge'](_0x1ef5ca,require(_0xea3b('0x2f')));_0x1ef5ca=_['merge'](_0x1ef5ca,require(_0xea3b('0x30')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0x31')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0x32')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0x33')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0x34')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0x35')));_0x1ef5ca=_['merge'](_0x1ef5ca,require(_0xea3b('0x36')));_0x1ef5ca=_['merge'](_0x1ef5ca,require(_0xea3b('0x37')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0x38')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0x39')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0x3a')));_0x1ef5ca=_['merge'](_0x1ef5ca,require('../api/squareRecording/squareRecording.rpc'));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0x3b')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require(_0xea3b('0x3c')));_0x1ef5ca=_[_0xea3b('0x5')](_0x1ef5ca,require('../api/attachment/attachment.rpc'));_0x1ef5ca=_['merge'](_0x1ef5ca,require(_0xea3b('0x3d')));var _0x23671b=jayson[_0xea3b('0x3e')](_0x1ef5ca)[_0xea3b('0x3f')]();var _0x526252=config[_0xea3b('0x40')][_0xea3b('0x41')]||config['port']+0x1;var _0x224b40=config['rpc']['ip']||_0xea3b('0x42');_0x23671b['on'](_0xea3b('0x43'),function(_0x4fc4d0){return _0x58447e(_0x4fc4d0);});_0x23671b['listen'](_0x526252,_0x224b40,function(){console[_0xea3b('0x44')](_0xea3b('0x45'),_0x224b40,_0x526252);require(_0xea3b('0x46'))['default']();return _0x3c2994(_0xea3b('0x47')+_0x224b40+':'+_0x526252);});});}; \ No newline at end of file +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 diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 260d10e..8cda082 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 _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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xedd9,0xfc));var _0x9edd=function(_0x500b3b,_0x1f784f){_0x500b3b=_0x500b3b-0x0;var _0x3f7d17=_0xedd9[_0x500b3b];return _0x3f7d17;};'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 +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 diff --git a/server/services/agi/error.js b/server/services/agi/error.js index d312095..02c841f 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 _0x0d4e=['name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message'];(function(_0x5a8839,_0x389d74){var _0x40c068=function(_0x55c79e){while(--_0x55c79e){_0x5a8839['push'](_0x5a8839['shift']());}};_0x40c068(++_0x389d74);}(_0x0d4e,0x1ca));var _0xe0d4=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x0d4e[_0x178e48];return _0x440d7e;};'use strict';var util=require(_0xe0d4('0x0'));var error={'E_AGI_UNDEFINED':_0xe0d4('0x1'),'E_AGI_ARGUMENT_PORT':_0xe0d4('0x2'),'E_AGI_SERVER_ERROR':_0xe0d4('0x3'),'E_AGI_SERVER_CLOSE':_0xe0d4('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0xe0d4('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0xe0d4('0x6'),'E_AGI_SOCKET_ERROR':_0xe0d4('0x7'),'E_AGI_SOCKET_CLOSE':_0xe0d4('0x8'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0xe0d4('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xe0d4('0xa'),'E_AGI_IVR_ENTRY':_0xe0d4('0xb')};function AGIError(_0x25bdbe){var _0x25bdbe=_0x25bdbe||null,_0x4a2a87=_0x4a2a87||[],_0x312e09=0x1,_0x1ba14d='';if(!error[_0x25bdbe]){_0x25bdbe=_0xe0d4('0xc');}_0x4a2a87[_0xe0d4('0xd')](error[_0x25bdbe]);while(arguments[_0x312e09]){_0x4a2a87[_0xe0d4('0xd')](arguments[_0x312e09]);_0x312e09++;}_0x1ba14d=util[_0xe0d4('0xe')][_0xe0d4('0xf')](util,_0x4a2a87);this[_0xe0d4('0x10')]=_0x1ba14d;this[_0xe0d4('0x11')]=_0x25bdbe;}module[_0xe0d4('0x12')]=AGIError; \ No newline at end of file +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 diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 4fddc5e..a412628 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 _0x4b0f=['edges','numberOfEdges','prototype','addVertex','addEdge','push','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','vswitch','target','default','agicommand','invalid','default\x20on\x20switch\x20not\x20found','exports','../../../config/logger','agi','menu','getsecretdigits','vertices'];(function(_0x349fc3,_0xd9d1cf){var _0x55e7be=function(_0x59b487){while(--_0x59b487){_0x349fc3['push'](_0x349fc3['shift']());}};_0x55e7be(++_0xd9d1cf);}(_0x4b0f,0xa3));var _0xf4b0=function(_0x455e82,_0x522f6f){_0x455e82=_0x455e82-0x0;var _0x2d0520=_0x4b0f[_0x455e82];return _0x2d0520;};'use strict';var _=require('lodash');var logger=require(_0xf4b0('0x0'))(_0xf4b0('0x1'));var verticesWithRetry=[_0xf4b0('0x2'),'getdigits',_0xf4b0('0x3')];var Graph=function(){this[_0xf4b0('0x4')]={};this[_0xf4b0('0x5')]={};this[_0xf4b0('0x6')]=0x0;};Graph[_0xf4b0('0x7')][_0xf4b0('0x8')]=function(_0x3c0f87){this[_0xf4b0('0x4')][_0x3c0f87['id']]=_0x3c0f87;this[_0xf4b0('0x5')][_0x3c0f87['id']]=[];};Graph[_0xf4b0('0x7')][_0xf4b0('0x9')]=function(_0x35160f,_0x3a2236,_0xd132d8){this[_0xf4b0('0x5')][_0x35160f][_0xf4b0('0xa')]({'target':_0x3a2236,'condition':_0xd132d8});this['numberOfEdges']+=0x1;};Graph[_0xf4b0('0x7')][_0xf4b0('0xb')]=function(){return _[_0xf4b0('0xb')](this[_0xf4b0('0x4')]);};Graph[_0xf4b0('0x7')][_0xf4b0('0xc')]=function(){return this[_0xf4b0('0x6')];};Graph[_0xf4b0('0x7')][_0xf4b0('0xd')]=function(_0x16bd65){return this[_0xf4b0('0x4')][_0x16bd65];};Graph[_0xf4b0('0x7')][_0xf4b0('0xe')]=function(_0x12480f,_0x86a245){if(!this[_0xf4b0('0x4')][_0x12480f]){return logger[_0xf4b0('0xf')](_0xf4b0('0x10'));}var _0x3aa005=_0x86a245(this[_0xf4b0('0x4')][_0x12480f]);if(!_0x3aa005){return logger[_0xf4b0('0xf')](_0xf4b0('0x11'));}if(this['edges'][_0x12480f][_0xf4b0('0x12')]===0x0){return logger[_0xf4b0('0xf')](_0xf4b0('0x13'));}for(var _0x54991b=0x0,_0x252835=[],_0x1f2d74=![];_0x54991b\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','agicommand','response','code','result','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','clear','isUndefined','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','lodash','util','moment','../../config/license/util','./mailRpc','./graph','./vertices','agi','127.0.0.1','nextTick','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','[%s]\x20%s','message','[ERROR]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','retry','maxRetry','addVertex','omit','mxCell','hasOwnProperty','isArray','length','target','addEdge','source','value','getSquareProject','then','catch','indexOf','substring','inspect','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','start','root','joinAt'];(function(_0x28fe1a,_0xe80a23){var _0x3e5de9=function(_0x187532){while(--_0x187532){_0x28fe1a['push'](_0x28fe1a['shift']());}};_0x3e5de9(++_0xe80a23);}(_0x0e85,0x7c));var _0x50e8=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x0e85[_0x47aa64];return _0x549c7a;};'use strict';var parser=require(_0x50e8('0x0'));var _=require(_0x50e8('0x1'));var syncho=require('syncho');var util=require(_0x50e8('0x2'));var moment=require(_0x50e8('0x3'));var config=require('../../config/environment');var logger=require('../../config/logger')('agi');var utilLicense=require(_0x50e8('0x4'));var rpc=require('./rpc');var mailRpc=require(_0x50e8('0x5'));var Graph=require(_0x50e8('0x6'));var Vertices=require(_0x50e8('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x50e8('0x8')]=_['defaults'](config[_0x50e8('0x8')],{'ip':_0x50e8('0x9'),'port':0x11dd});function connectionHandler(_0x42665e){process[_0x50e8('0xa')](function(){syncho(function(){try{setChannelVariables(_0x42665e);agiHandler(_0x42665e);}catch(_0x1fafb0){logger[_0x50e8('0xb')](_0x1fafb0['stack']);}});});}function listeningHandler(){console[_0x50e8('0xc')](_0x50e8('0xd'),config[_0x50e8('0x8')][_0x50e8('0xe')]);logger[_0x50e8('0xf')](util[_0x50e8('0x10')](_0x50e8('0x11'),config[_0x50e8('0x8')]['ip'],config['agi']['port']));}function errorHandler(_0xfc6bb9){if(_0xfc6bb9&&_0xfc6bb9[_0x50e8('0x12')]&&_0xfc6bb9['message']){logger['error'](util[_0x50e8('0x10')](_0x50e8('0x13'),_0xfc6bb9[_0x50e8('0x12')],_0xfc6bb9[_0x50e8('0x14')]));}else{logger['error'](util[_0x50e8('0x10')](_0x50e8('0x15'),_0xfc6bb9[_0x50e8('0x16')]));}}function closeHandler(){logger['info'](util['format'](_0x50e8('0x17'),this[_0x50e8('0x18')],this[_0x50e8('0x19')],this[_0x50e8('0x1a')],this[_0x50e8('0x1b')],this[_0x50e8('0x1c')]));try{createSquareReport(this);}catch(_0x5642bf){logger['error'](_0x5642bf[_0x50e8('0x16')]);}}function timeoutHandler(){logger[_0x50e8('0xf')](util[_0x50e8('0x10')](_0x50e8('0x1d'),this[_0x50e8('0x18')],this[_0x50e8('0x19')],this[_0x50e8('0x1a')],this['dnid'],this[_0x50e8('0x1c')]));}function hangupHandler(){logger['info'](util[_0x50e8('0x10')](_0x50e8('0x1e'),this[_0x50e8('0x18')],this[_0x50e8('0x19')],this[_0x50e8('0x1a')],this['dnid'],this[_0x50e8('0x1c')]));this[_0x50e8('0x1f')]=!![];}function getRoot(_0x58110d){return parser[_0x50e8('0x20')](_0x58110d,{'object':!![]})[_0x50e8('0x21')]['root'];}function addVertex(_0x1ce7fc,_0xe7e56c,_0x4f56b7){_0xe7e56c['agicommand']=_0x4f56b7;if(_0xe7e56c['hasOwnProperty'](_0x50e8('0x22'))){_0xe7e56c[_0x50e8('0x23')]=parseInt(_0xe7e56c[_0x50e8('0x22')],0xa);}_0x1ce7fc[_0x50e8('0x24')](_[_0x50e8('0x25')](_0xe7e56c,_0x50e8('0x26')));}function initGraph(_0x53d848,_0x3a6442){var _0x396611=new Graph();for(var _0x4b3a09 in _0x53d848){if(_0x53d848[_0x50e8('0x27')](_0x4b3a09)){if(_[_0x50e8('0x28')](_0x53d848[_0x4b3a09])){for(var _0x3a14ca=0x0;_0x3a14ca<_0x53d848[_0x4b3a09][_0x50e8('0x29')];_0x3a14ca+=0x1){addVertex(_0x396611,_0x53d848[_0x4b3a09][_0x3a14ca],_0x4b3a09);}}else{addVertex(_0x396611,_0x53d848[_0x4b3a09],_0x4b3a09);}}}for(var _0x4fbf41=0x0;_0x4fbf41<_0x3a6442[_0x50e8('0x29')];_0x4fbf41+=0x1){if(_0x3a6442[_0x4fbf41]['source']&&_0x3a6442[_0x4fbf41][_0x50e8('0x2a')]){_0x396611[_0x50e8('0x2b')](_0x3a6442[_0x4fbf41][_0x50e8('0x2c')],_0x3a6442[_0x4fbf41]['target'],_0x3a6442[_0x4fbf41][_0x50e8('0x2d')]);}}return _0x396611;}function getSquareProject(_0x126c99,_0x1bed48){rpc[_0x50e8('0x2e')](_0x126c99)[_0x50e8('0x2f')](function(_0x18aa31){_0x1bed48(null,_0x18aa31);})[_0x50e8('0x30')](function(_0x54d81d){_0x1bed48(null,_0x54d81d);});}function createSquareReport(_0x290fd2,_0x123be9){rpc['createSquareReport'](_0x290fd2)['then'](function(_0x329b9c){if(_0x123be9){_0x123be9(null,_0x329b9c);}})[_0x50e8('0x30')](function(_0x32db93){if(_0x123be9){_0x123be9(null,_0x32db93);}});}function setChannelVariables(_0x47ace2){for(var _0x594187 in _0x47ace2){if(_0x47ace2[_0x50e8('0x27')](_0x594187)){if(_0x594187[_0x50e8('0x31')]('agi_')===0x0){_0x47ace2[_0x594187[_0x50e8('0x32')](0x4)]=_0x47ace2[_0x594187];delete _0x47ace2[_0x594187];}}}}function getLogFromObject(_0x17c6a5){return util[_0x50e8('0x33')](_0x17c6a5,{'showHidden':![],'depth':null});}function agiHandler(_0x40e09d){var _0x5d279c,_0x3ce0d9,_0x4ec6ad,_0x3aec30,_0x33fc5b;logger[_0x50e8('0x34')]('variables',JSON[_0x50e8('0x35')](_0x40e09d,null,0x2));logger[_0x50e8('0xf')](util['format'](_0x50e8('0x36'),_0x40e09d[_0x50e8('0x18')],_0x40e09d[_0x50e8('0x19')],_0x40e09d[_0x50e8('0x1a')],_0x40e09d['dnid'],_0x40e09d[_0x50e8('0x1c')]));_0x40e09d['on'](_0x50e8('0xb'),errorHandler);_0x40e09d['on'](_0x50e8('0x37'),closeHandler);_0x40e09d['on'](_0x50e8('0x38'),timeoutHandler);_0x40e09d['evtHangup']=![];_0x40e09d['on'](_0x50e8('0x39'),hangupHandler);var _0x2d0ccf=getSquareProject[_0x50e8('0x3a')](null,_0x40e09d['arg_1']);if(_0x2d0ccf){if(_0x2d0ccf['production']){_0x5d279c=getRoot(_0x2d0ccf['production']);if(_0x5d279c&&_0x5d279c[_0x50e8('0x3b')]){logger[_0x50e8('0x34')](_0x50e8('0x3c'),JSON[_0x50e8('0x35')](_0x5d279c,null,0x2));_0x40e09d[_0x50e8('0x3d')]=moment()[_0x50e8('0x10')](_0x50e8('0x3e'));_0x3ce0d9=initGraph(_[_0x50e8('0x25')](_0x5d279c,_0x50e8('0x26')),_0x5d279c[_0x50e8('0x26')]);_0x4ec6ad=new Vertices(_0x40e09d,rpc,mailRpc);logger['info'](util[_0x50e8('0x10')](_0x50e8('0x3f'),_0x40e09d[_0x50e8('0x18')],_0x40e09d[_0x50e8('0x19')],_0x40e09d['callerid'],_0x40e09d[_0x50e8('0x1b')],_0x40e09d[_0x50e8('0x1c')]));_0x3ce0d9[_0x50e8('0x40')](_0x5d279c[_0x50e8('0x3b')]['id'],function(_0x8e8a97){try{_0x8e8a97=_0x4ec6ad['clear'](_0x8e8a97);logger['debug'](_0x50e8('0x41'),JSON[_0x50e8('0x35')](_0x8e8a97,null,0x2));if(_0x8e8a97['agicommand']===_0x50e8('0x42')){logger[_0x50e8('0xf')](_0x50e8('0x43'));_0x40e09d[_0x50e8('0x44')]=_0x8e8a97[_0x50e8('0x44')]||_0x40e09d[_0x50e8('0x44')];_0x40e09d[_0x50e8('0x45')]=_0x8e8a97[_0x50e8('0x45')];_0x40e09d['priority']=_0x8e8a97[_0x50e8('0x46')]?_0x8e8a97[_0x50e8('0x46')]-0x1:0x1;return null;}else if(_0x8e8a97&&_0x4ec6ad[_0x8e8a97[_0x50e8('0x47')]]){_0x33fc5b=_0x4ec6ad[_0x8e8a97[_0x50e8('0x47')]](_0x8e8a97);logger['info'](_0x50e8('0x48'),JSON[_0x50e8('0x35')](_0x33fc5b,null,0x2));if(_0x33fc5b&&_0x33fc5b[_0x50e8('0x49')]===AGI_CODE_SUCCESS&&_0x33fc5b[_0x50e8('0x4a')]!==AGI_RESULT_ERROR&&!_0x40e09d['evtHangup']){logger[_0x50e8('0x34')]('response',getLogFromObject(_0x33fc5b));return _['isUndefined'](_0x33fc5b['result'])?null:_0x33fc5b[_0x50e8('0x4a')][_0x50e8('0x4b')]();}else{logger['error'](_0x50e8('0x48'),getLogFromObject(_0x33fc5b));return null;}}else{logger[_0x50e8('0xb')](_0x50e8('0x4c'));return null;}}catch(_0x6e37ad){logger[_0x50e8('0xb')](_0x6e37ad[_0x50e8('0x16')]);return null;}});if(_0x5d279c['finally']){logger[_0x50e8('0xf')](util['format'](_0x50e8('0x4d'),_0x40e09d[_0x50e8('0x18')],_0x40e09d['calleridname'],_0x40e09d[_0x50e8('0x1a')],_0x40e09d['dnid'],_0x40e09d[_0x50e8('0x1c')]));_0x3ce0d9[_0x50e8('0x40')](_0x5d279c[_0x50e8('0x4e')]['id'],function(_0x2ab0fa){try{_0x2ab0fa=_0x4ec6ad[_0x50e8('0x4f')](_0x2ab0fa);logger[_0x50e8('0x34')](_0x50e8('0x41'),JSON[_0x50e8('0x35')](_0x2ab0fa,null,0x2));if(_0x2ab0fa&&_0x4ec6ad[_0x2ab0fa[_0x50e8('0x47')]]){_0x33fc5b=_0x4ec6ad[_0x2ab0fa[_0x50e8('0x47')]](_0x2ab0fa);if(_0x33fc5b){logger[_0x50e8('0x34')]('response',getLogFromObject(_0x33fc5b));return _[_0x50e8('0x50')](_0x33fc5b[_0x50e8('0x4a')])?null:_0x33fc5b['result'][_0x50e8('0x4b')]();}else{logger['error'](_0x50e8('0x48'),getLogFromObject(_0x33fc5b));return null;}}else{logger['error'](_0x50e8('0x4c'));return null;}}catch(_0x174fde){logger[_0x50e8('0xb')](_0x174fde[_0x50e8('0x16')]);return null;}});}logger[_0x50e8('0xf')](util[_0x50e8('0x10')](_0x50e8('0x51'),_0x40e09d['arg_1'],_0x40e09d[_0x50e8('0x19')],_0x40e09d[_0x50e8('0x1a')],_0x40e09d[_0x50e8('0x1b')],_0x40e09d[_0x50e8('0x1c')]));logger[_0x50e8('0xf')](util[_0x50e8('0x10')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x40e09d[_0x50e8('0x44')],_0x40e09d[_0x50e8('0x45')],parseInt(_0x40e09d[_0x50e8('0x46')],0xa)+0x1));_0x40e09d[_0x50e8('0x52')](_0x40e09d['context'],_0x40e09d[_0x50e8('0x45')],parseInt(_0x40e09d[_0x50e8('0x46')],0xa)+0x1);_0x40e09d[_0x50e8('0x37')]();}}else{logger[_0x50e8('0xb')](util[_0x50e8('0x10')](_0x50e8('0x53'),_0x40e09d[_0x50e8('0x18')]));_0x40e09d['continueAt'](_0x40e09d['context'],_0x40e09d['extension'],parseInt(_0x40e09d[_0x50e8('0x46')],0xa)+0x1);_0x40e09d[_0x50e8('0x37')]();}}else{logger[_0x50e8('0xb')](util[_0x50e8('0x10')](_0x50e8('0x54'),_0x40e09d[_0x50e8('0x18')]));_0x40e09d['continueAt'](_0x40e09d[_0x50e8('0x44')],_0x40e09d[_0x50e8('0x45')],parseInt(_0x40e09d[_0x50e8('0x46')],0xa)+0x1);_0x40e09d[_0x50e8('0x37')]();}}function main(){var _0x4a3281;return utilLicense[_0x50e8('0x55')]()[_0x50e8('0x2f')](function(_0x373b41){if(_0x373b41){if(_0x373b41[_0x50e8('0x56')]){if(_0x373b41[_0x50e8('0x57')]&&_0x373b41[_0x50e8('0x57')]>0x0){logger['info'](util[_0x50e8('0x10')]('[LICENSE]\x20CHANNELS:\x20%s',_0x373b41['callysquare']));_0x4a3281=_0x373b41['callysquare'];}else{logger[_0x50e8('0xf')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x50e8('0xf')](_0x50e8('0x58'));_0x4a3281=-0x1;}}})[_0x50e8('0x30')](function(_0x2dd17e){logger[_0x50e8('0xb')](_0x50e8('0x59'),_0x2dd17e[_0x50e8('0x16')]);})['finally'](function(){var _0x26ab46=require(_0x50e8('0x5a'))(config[_0x50e8('0x8')]['port'],config['agi']['ip'],_0x4a3281);_0x26ab46['on']('error',errorHandler);_0x26ab46['on'](_0x50e8('0x5b'),listeningHandler);_0x26ab46['on'](_0x50e8('0x5c'),connectionHandler);_0x26ab46['on'](_0x50e8('0x37'),closeHandler);});}main(); \ No newline at end of file +var _0xc949=['gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[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 diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 2ca5cf3..7db04e2 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(_0x16382b,_0xd99a23){var _0x2e03b0=function(_0x5c53b3){while(--_0x5c53b3){_0x16382b['push'](_0x16382b['shift']());}};_0x2e03b0(++_0xd99a23);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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(_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 diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 80c441e..78d5b5a 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(_0x5c79a2,_0x4bf2c8){var _0x5ea447=function(_0x411ba7){while(--_0x411ba7){_0x5c79a2['push'](_0x5c79a2['shift']());}};_0x5ea447(++_0x4bf2c8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x218846,_0x2d0f07){_0x218846=_0x218846-0x0;var _0x25fa07=_0x5f2f[_0x218846];return _0x25fa07;};'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 _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 diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index cc33a77..9b465d9 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 _0xd795=['CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','moment','lodash','util','http','then','error','message','catch','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','email','getVoiceQueueById','ShowVoiceQueue','name','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','ShowUser','ShowTrunk','save_name','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','ListId'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xd795,0x155));var _0x5d79=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xd795[_0x1694f5];return _0x5b4321;};'use strict';var BPromise=require('bluebird');var moment=require(_0x5d79('0x0'));var _=require(_0x5d79('0x1'));var util=require(_0x5d79('0x2'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5d79('0x3')]({'port':0x2329});function request(_0x4c3ce9,_0x234727){return new BPromise(function(_0x49ec76,_0x533858){return client['request'](_0x4c3ce9,_0x234727)[_0x5d79('0x4')](function(_0x4fbafe){if(_0x4fbafe['error']){return _0x533858(_0x4fbafe[_0x5d79('0x5')][_0x5d79('0x6')]);}else{return _0x49ec76(_0x4fbafe['result']);}})[_0x5d79('0x7')](function(_0x162904){return _0x533858(_0x162904);});});}exports['getSquareProject']=function(_0x5038e6){return request(_0x5d79('0x8'),{'options':{'raw':![],'where':{'name':_0x5038e6},'attributes':[_0x5d79('0x9')]}});};exports[_0x5d79('0xa')]=function(_0x58932a){return request(_0x5d79('0xb'),{'options':{'raw':![],'where':{'id':_0x58932a},'include':[{'model':_0x5d79('0xc'),'as':'Smtp'}],'attributes':['id','name',_0x5d79('0xd')]}});};exports['getSquareProjectById']=function(_0x552d58){return request('ShowSquareProject',{'options':{'where':{'id':_0x552d58},'attributes':['name']}});};exports[_0x5d79('0xe')]=function(_0xe50cb){return request(_0x5d79('0xf'),{'options':{'where':{'id':_0xe50cb},'attributes':[_0x5d79('0x10')]}});};exports[_0x5d79('0x11')]=function(_0x3b4fa0){return request(_0x5d79('0x12'),{'options':{'where':{'id':_0x3b4fa0},'attributes':[_0x5d79('0x10')]}});};exports[_0x5d79('0x13')]=function(_0x288ff8){return request(_0x5d79('0x14'),{'options':{'where':{'id':_0x288ff8},'attributes':[_0x5d79('0x15')]}});};exports['getUserById']=function(_0x3df798){return request(_0x5d79('0x16'),{'options':{'where':{'id':_0x3df798},'attributes':['name']}});};exports['getTrunkById']=function(_0x6b4da1){return request(_0x5d79('0x17'),{'options':{'where':{'id':_0x6b4da1},'attributes':[_0x5d79('0x10')]}});};exports['getSoundById']=function(_0x255530){return request('ShowSound',{'options':{'where':{'id':_0x255530},'attributes':[_0x5d79('0x18')]}});};exports['getIntervalById']=function(_0x17db56){return request(_0x5d79('0x19'),{'options':{'raw':![],'where':{'id':_0x17db56},'include':[{'model':_0x5d79('0x1a'),'as':'Intervals'}]}});};exports[_0x5d79('0x1b')]=function(_0x4548a1){return request(_0x5d79('0x1c'),{'options':{'where':{'id':_0x4548a1},'attributes':['id','name']}});};exports[_0x5d79('0x1d')]=function(_0x1eca6f){return request('CreateSmsMessage',{'body':_0x1eca6f});};exports[_0x5d79('0x1e')]=function(_0x1c886e){return request(_0x5d79('0x1f'),{'body':_0x1c886e});};exports[_0x5d79('0x20')]=function(_0x34a3aa){return request('CreateSquareReport',{'body':_[_0x5d79('0x21')](_0x34a3aa,{'project_name':_0x34a3aa[_0x5d79('0x22')],'prev_project_name':_0x34a3aa[_0x5d79('0x23')]||'','is_subproject':_0x34a3aa[_0x5d79('0x23')]?!![]:![],'leaveAt':moment()[_0x5d79('0x24')](_0x5d79('0x25'))})});};exports[_0x5d79('0x26')]=function(_0x4da7f7){return request(_0x5d79('0x27'),{'body':_0x4da7f7});};exports[_0x5d79('0x28')]=function(_0x4440ab){return request(_0x5d79('0x29'),{'body':_0x4440ab});};exports['createCmContact']=function(_0x2608b4){return request(_0x5d79('0x2a'),{'options':{'raw':![],'where':{'phone':_0x2608b4['phone'],'ListId':_0x2608b4[_0x5d79('0x2b')]}}})['then'](function(_0x1fd557){if(_0x1fd557){return _0x1fd557;}return request(_0x5d79('0x2c'),{'body':_0x2608b4});});};exports[_0x5d79('0x2d')]=function(_0x1e5320){return request(_0x5d79('0x2e'),{'options':{'where':{'id':_0x1e5320},'attributes':[_0x5d79('0x10')]}});};exports[_0x5d79('0x2f')]=function(_0xbd84ad,_0x48e618){return request(_0x5d79('0x30'),{'body':{'interface':_0x48e618},'options':{'where':_0xbd84ad}});};exports[_0x5d79('0x31')]=function(_0x4a415d,_0x2a4ad7,_0x46ef94){return request(_0x5d79('0x32'),{'body':{'type':_0x2a4ad7,'uniqueid':_0x46ef94},'options':{'where':_0x4a415d}});};exports[_0x5d79('0x33')]=function(_0xa376a4){return request(_0x5d79('0x34'),{'body':{},'options':{'where':_0xa376a4}});};exports[_0x5d79('0x35')]=function(_0x36cccb){return request(_0x5d79('0x36'),{'body':{},'options':{'where':_0x36cccb}});}; \ No newline at end of file +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 diff --git a/server/services/agi/scripts/aws/index.js b/server/services/agi/scripts/aws/index.js index 8972268..c60dc1b 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 _0x207c=['./lex','exports'];(function(_0xee1ec9,_0x2f0599){var _0x102a53=function(_0x4e5f7f){while(--_0x4e5f7f){_0xee1ec9['push'](_0xee1ec9['shift']());}};_0x102a53(++_0x2f0599);}(_0x207c,0x1e8));var _0xc207=function(_0x28fe94,_0x120b9b){_0x28fe94=_0x28fe94-0x0;var _0x3560da=_0x207c[_0x28fe94];return _0x3560da;};var polly=require('./polly');var lex=require(_0xc207('0x0'));module[_0xc207('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +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 diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 8ee7237..ad3e793 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 _0x2333=['./lib/api','exports'];(function(_0x3d8004,_0x1eea08){var _0x3d32dc=function(_0x3d48cd){while(--_0x3d48cd){_0x3d8004['push'](_0x3d8004['shift']());}};_0x3d32dc(++_0x1eea08);}(_0x2333,0x11a));var _0x3233=function(_0x39d715,_0x6d46){_0x39d715=_0x39d715-0x0;var _0x48adad=_0x2333[_0x39d715];return _0x48adad;};'use strict';var lex=require(_0x3233('0x0'));module[_0x3233('0x1')]=function(_0x4c4ec0,_0x50fe9b,_0x170ef4,_0x42ef73,_0x5a8145,_0x8fdc58){return lex(_0x4c4ec0,_0x50fe9b,_0x170ef4,_0x42ef73,_0x5a8145,_0x8fdc58);}; \ No newline at end of file +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 diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index ace7cbc..81c6dd7 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 _0x4bef=['exports','LexRuntime','$LATEST','bluebird','aws-sdk','postText','slots','hasOwnProperty','slot_'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4bef,0x16b));var _0xf4be=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x4bef[_0x68ee8b];return _0x5148f7;};'use strict';var BPromise=require(_0xf4be('0x0'));var AWS=require(_0xf4be('0x1'));function lexResult(_0x2efaf5,_0x27e55d){return new BPromise(function(_0x385803,_0x33daaa){_0x2efaf5[_0xf4be('0x2')](_0x27e55d,function(_0x1c923f,_0x409241){if(_0x1c923f){_0x33daaa(_0x1c923f);}if(_0x409241[_0xf4be('0x3')]){for(const _0x4885d3 in _0x409241[_0xf4be('0x3')]){if(_0x409241[_0xf4be('0x3')][_0xf4be('0x4')](_0x4885d3)){var _0x4631f0=_0x409241['slots'][_0x4885d3];_0x409241[_0xf4be('0x5')+_0x4885d3]=_0x4631f0;}}}_0x385803(_0x409241);});});}module[_0xf4be('0x6')]=function(_0x5ad17c,_0x49c4f8,_0x4ab90d,_0x2ef155,_0x14f620,_0x45df84){var _0x103652=new AWS[(_0xf4be('0x7'))]({'accessKeyId':_0x49c4f8,'secretAccessKey':_0x4ab90d,'region':_0x2ef155});var _0x1fe8d6={'botAlias':_0xf4be('0x8'),'botName':_0x45df84,'inputText':_0x14f620,'userId':_0x5ad17c};return lexResult(_0x103652,_0x1fe8d6);}; \ No newline at end of file +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 diff --git a/server/services/agi/scripts/aws/polly/index.js b/server/services/agi/scripts/aws/polly/index.js index 22375ad..da2db4f 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 _0x5e66=['exports','./lib/api'];(function(_0x23e5ce,_0x57584d){var _0x2ce19b=function(_0x318e1f){while(--_0x318e1f){_0x23e5ce['push'](_0x23e5ce['shift']());}};_0x2ce19b(++_0x57584d);}(_0x5e66,0x1cb));var _0x65e6=function(_0x26eb16,_0x42a6d6){_0x26eb16=_0x26eb16-0x0;var _0x3d6f4d=_0x5e66[_0x26eb16];return _0x3d6f4d;};'use strict';var polly=require(_0x65e6('0x0'));module[_0x65e6('0x1')]=function(_0x1b762c,_0xefd66c,_0x6d26c5,_0x22b398,_0xb7849b,_0x5d2e66,_0x5652b1){return polly(_0x1b762c,_0xefd66c,_0x6d26c5,_0x22b398,_0xb7849b,_0x5d2e66,_0x5652b1);}; \ No newline at end of file +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 diff --git a/server/services/agi/scripts/aws/polly/lib/api.js b/server/services/agi/scripts/aws/polly/lib/api.js index bf35397..b366020 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 _0x5db2=['text','mp3','bluebird','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly'];(function(_0x48b810,_0x173a5e){var _0x23c17d=function(_0x38531e){while(--_0x38531e){_0x48b810['push'](_0x48b810['shift']());}};_0x23c17d(++_0x173a5e);}(_0x5db2,0xd1));var _0x25db=function(_0x4db250,_0x53ba8a){_0x4db250=_0x4db250-0x0;var _0x4e59da=_0x5db2[_0x4db250];return _0x4e59da;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x25db('0x0'));var rs=require('randomstring');var AWS=require('aws-sdk');function pollyResult(_0xceb27d,_0x5a426e,_0x5096db){return new BPromise(function(_0x4119e9,_0x452ccd){_0xceb27d[_0x25db('0x1')](_0x5a426e,function(_0x2c24ab,_0x109048){if(_0x2c24ab){_0x452ccd(_0x2c24ab);}else if(_0x109048){if(_0x109048[_0x25db('0x2')]instanceof Buffer){fs[_0x25db('0x3')](_0x5096db,_0x109048[_0x25db('0x2')],function(_0x40e4ec){if(_0x40e4ec){_0x452ccd(_0x40e4ec);}else{_0x4119e9();}});}else{_0x452ccd(new Error(_0x25db('0x4')));}}else{_0x452ccd(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x25db('0x5')]=function(_0x37660a,_0x48ee09,_0x4fc305,_0x4b9ecc,_0x38e93c,_0x2733d0,_0x46b9ed){var _0x3265ec=new AWS[(_0x25db('0x6'))]({'accessKeyId':_0x37660a,'secretAccessKey':_0x48ee09,'region':_0x4fc305});var _0x5246f5={'Text':_0x38e93c,'TextType':_0x2733d0||_0x25db('0x7'),'OutputFormat':_0x25db('0x8'),'VoiceId':_0x4b9ecc};return pollyResult(_0x3265ec,_0x5246f5,_0x46b9ed);}; \ No newline at end of file +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 diff --git a/server/services/agi/scripts/google/asr/index.js b/server/services/agi/scripts/google/asr/index.js index 7e8e04e..d8cf236 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 _0xdeb6=['exports','./lib/api'];(function(_0x2bded4,_0x5aa045){var _0x302c84=function(_0xe33874){while(--_0xe33874){_0x2bded4['push'](_0x2bded4['shift']());}};_0x302c84(++_0x5aa045);}(_0xdeb6,0x1cf));var _0x6deb=function(_0x2bca3e,_0x2baaf5){_0x2bca3e=_0x2bca3e-0x0;var _0x1177c5=_0xdeb6[_0x2bca3e];return _0x1177c5;};'use strict';var asr=require(_0x6deb('0x0'));module[_0x6deb('0x1')]=function(_0x176030,_0x3ac5c2,_0x5bbc23,_0x1e08f2){return asr(_0x176030,_0x3ac5c2,_0x5bbc23);}; \ No newline at end of file +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 diff --git a/server/services/agi/scripts/google/asr/lib/api.js b/server/services/agi/scripts/google/asr/lib/api.js index 66eb9f3..8d32802 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 _0xa9c6=['lang\x20should\x20be\x20a\x20string','readFileSync','POST','/v1/speech:recognize?key=','url','https://speech.googleapis.com','exports','length','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa9c6,0x1f3));var _0x6a9c=function(_0x1f3966,_0xb31417){_0x1f3966=_0x1f3966-0x0;var _0x3913ad=_0xa9c6[_0x1f3966];return _0x3913ad;};'use strict';var url=require(_0x6a9c('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0x6a9c('0x1');module[_0x6a9c('0x2')]=function(_0x36704c,_0xc1cc92,_0x1c82b){return new BPromise(function(_0x23d36e,_0x931a77){var _0x3385a9;if(typeof _0x36704c!=='string'||_0x36704c[_0x6a9c('0x3')]===0x0){return _0x931a77(_0x6a9c('0x4'));}if(typeof _0xc1cc92!==_0x6a9c('0x5')||_0xc1cc92[_0x6a9c('0x3')]===0x0){return _0x931a77(_0x6a9c('0x6'));}if(typeof _0x1c82b!=='undefined'&&(typeof _0x1c82b!==_0x6a9c('0x5')||_0x1c82b[_0x6a9c('0x3')]===0x0)){return _0x931a77(_0x6a9c('0x7'));}try{_0x3385a9=fs[_0x6a9c('0x8')](_0x36704c)['toString']('base64');}catch(_0x326387){return _0x931a77(_0x326387);}return _0x23d36e({'method':_0x6a9c('0x9'),'uri':host+_0x6a9c('0xa')+_0xc1cc92,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x1c82b},'audio':{'content':_0x3385a9}},'json':!![]});});}; \ No newline at end of file +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 diff --git a/server/services/agi/scripts/google/index.js b/server/services/agi/scripts/google/index.js index 600fbab..1245496 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 _0x4fc2=['exports','./asr'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x4fc2,0x111));var _0x24fc=function(_0x1cc325,_0x537298){_0x1cc325=_0x1cc325-0x0;var _0x33d644=_0x4fc2[_0x1cc325];return _0x33d644;};var asr=require(_0x24fc('0x0'));module[_0x24fc('0x1')]={'asr':asr}; \ No newline at end of file +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 diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index c526948..b2752d3 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 _0x87a0=['./tilde','../../../config/logger','agi','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','close','unlink','download\x20error','end','data','error\x20convert','finish\x20to\x20convert','start','chmodSync','777','split','readFileSync','toString','base64','https://texttospeech.googleapis.com/v1/','ssml','input','voice','audioConfig','text:synthesize','POST','then','resolve','tmp','generate','.mp3','from','audioContent','writeFile','.wav','googleCloudTTS\x20path','goggleTTS\x20path','map','alternatives','transcript','results','confidence','join','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','message','textRequest','stringify','result','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','tildeASR','asr','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','model=%s','freeform=3','sestekNDA','nda','channelData','CustomAction','CustomActionData','Data','dirName','path','http','url','parse','bluebird','randomstring','sox','request-promise','querystring'];(function(_0x16a9b9,_0x32708e){var _0x31a54b=function(_0x1ada84){while(--_0x1ada84){_0x16a9b9['push'](_0x16a9b9['shift']());}};_0x31a54b(++_0x32708e);}(_0x87a0,0xc3));var _0x087a=function(_0x1d46ca,_0xcbeac9){_0x1d46ca=_0x1d46ca-0x0;var _0x1d4f11=_0x87a0[_0x1d46ca];return _0x1d4f11;};'use strict';var fs=require('fs');var path=require(_0x087a('0x0'));var http=require(_0x087a('0x1'));var https=require('https');var urlParse=require(_0x087a('0x2'))[_0x087a('0x3')];var BPromise=require(_0x087a('0x4'));var rs=require(_0x087a('0x5'));var sox=require(_0x087a('0x6'));var rp=require(_0x087a('0x7'));var util=require('util');var querystring=require(_0x087a('0x8'));var tts=require('google-tts-api');var apiai=require('apiai-promise');var md5=require('md5');var google=require('./google');var aws=require('./aws');var tilde=require(_0x087a('0x9'));var sestek=require('./sestek');var logger=require(_0x087a('0xa'))(_0x087a('0xb'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x12a2ed,_0x5d74c2){return new BPromise(function(_0x573a92,_0x3001f8){var _0x42f4b9=urlParse(_0x12a2ed);var _0x5da9af=_0x42f4b9[_0x087a('0xc')]===_0x087a('0xd')?https:http;var _0x2f65b9={'host':_0x42f4b9[_0x087a('0xe')],'path':_0x42f4b9[_0x087a('0x0')],'headers':{'user-agent':_0x087a('0xf')}};_0x5da9af[_0x087a('0x10')](_0x2f65b9,function(_0x122f05){if(_0x122f05[_0x087a('0x11')]!==0xc8){logger[_0x087a('0x12')](_0x087a('0x13')+_0x12a2ed+_0x087a('0x14')+_0x122f05[_0x087a('0x11')]+'\x20('+_0x122f05[_0x087a('0x15')]+')');_0x3001f8(new Error(_0x087a('0x13')+_0x12a2ed+_0x087a('0x14')+_0x122f05[_0x087a('0x11')]+'\x20('+_0x122f05[_0x087a('0x15')]+')'));return;}var _0x538b96=fs[_0x087a('0x16')](_0x5d74c2);_0x538b96['on'](_0x087a('0x17'),function(){logger[_0x087a('0x18')]('finish\x20download\x20file');_0x538b96[_0x087a('0x19')](_0x573a92);});_0x538b96['on'](_0x087a('0x12'),function(_0x35b75f){fs[_0x087a('0x1a')](_0x5d74c2);logger[_0x087a('0x12')](_0x087a('0x1b'),_0x35b75f);_0x3001f8(_0x35b75f);});_0x122f05['pipe'](_0x538b96);})['on'](_0x087a('0x12'),function(_0x1f2352){logger[_0x087a('0x12')](_0x1f2352);_0x3001f8(_0x1f2352);})[_0x087a('0x1c')]();});}function uploadFile(_0x5ea426){return new BPromise(function(_0x3af559,_0x45222d){var _0x22e885=urlParse(_0x5ea426);var _0x4ee98a=_0x22e885[_0x087a('0xc')]===_0x087a('0xd')?https:http;var _0x47adfc={'host':_0x22e885[_0x087a('0xe')],'path':_0x22e885[_0x087a('0x0')],'headers':{'user-agent':'WHAT_EVER'}};_0x4ee98a[_0x087a('0x10')](_0x47adfc,function(_0x52d10d){if(_0x52d10d[_0x087a('0x11')]!==0xc8){_0x45222d(new Error('request\x20to\x20'+_0x5ea426+'\x20failed,\x20status\x20code\x20=\x20'+_0x52d10d[_0x087a('0x11')]+'\x20('+_0x52d10d[_0x087a('0x15')]+')'));return;}var _0x222dc9='';_0x52d10d['on'](_0x087a('0x1d'),function(_0x6cf13c){_0x222dc9+=_0x6cf13c;});_0x52d10d['on'](_0x087a('0x1c'),function(){_0x3af559(_0x222dc9);});})['on'](_0x087a('0x12'),function(_0x161c69){_0x45222d(_0x161c69);})['end']();});}function convertFile(_0x242c17,_0x596a8d){return new BPromise(function(_0x470636,_0x193c96){var _0x3c65d5=sox['transcode'](_0x242c17,_0x596a8d,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3c65d5['on'](_0x087a('0x12'),function(_0x59d150){logger['error'](_0x087a('0x1e'),_0x59d150);_0x193c96(_0x59d150);});_0x3c65d5['on']('end',function(){logger[_0x087a('0x18')](_0x087a('0x1f'));_0x470636();});_0x3c65d5[_0x087a('0x20')]();});}function base64Decode(_0x20d127,_0x1cf0ac){var _0x4d76f3=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+'.wav');fs['writeFileSync'](_0x4d76f3,_0x20d127,'base64');return convertFile(_0x4d76f3,_0x1cf0ac)['then'](function(){try{fs[_0x087a('0x1a')](_0x4d76f3);fs[_0x087a('0x21')](_0x1cf0ac,_0x087a('0x22'));}catch(_0x19b23){logger[_0x087a('0x12')](_0x19b23);}return _0x1cf0ac[_0x087a('0x23')]('.')[0x0];});}function base64Encode(_0xffce57){var _0x88cef9=fs[_0x087a('0x24')](_0xffce57);return new Buffer(_0x88cef9)[_0x087a('0x25')](_0x087a('0x26'));}exports['googleCloudTTS']=function(_0x4ffd29,_0x42588c,_0x2b1643,_0x189f60,_0x43db15,_0x49b03a){var _0x5f4c69,_0x2de47f;var _0x2f4c73=_0x087a('0x27');var _0x3dfde0='?key='+_0x4ffd29;var _0x462080={};if(_0x42588c===_0x087a('0x28')){_0x462080[_0x087a('0x29')]={'ssml':_0x2b1643};}else{_0x462080['input']={'text':_0x2b1643};};_0x462080[_0x087a('0x2a')]={'languageCode':_0x189f60,'ssmlGender':_0x43db15};_0x462080[_0x087a('0x2b')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x3e09b5={'url':_0x2f4c73+_0x087a('0x2c')+_0x3dfde0,'method':_0x087a('0x2d'),'json':!![],'body':_0x462080};return rp(_0x3e09b5)[_0x087a('0x2e')](function(_0x1e5366){return new BPromise(function(_0x25d3c4,_0x4b5a08){_0x5f4c69=path[_0x087a('0x2f')](__dirname,_0x087a('0x30'),rs[_0x087a('0x31')](0x4)+_0x087a('0x32'));var _0xdb8272=Buffer[_0x087a('0x33')](_0x1e5366[_0x087a('0x34')],_0x087a('0x26'));return fs[_0x087a('0x35')](_0x5f4c69,_0xdb8272,function(_0x2be61e){_0x4b5a08(_0x2be61e);},function(_0xd13d51){fs[_0x087a('0x21')](_0x5f4c69,'777');_0x25d3c4(_0xd13d51);});});})[_0x087a('0x2e')](function(_0x21eb04){_0x2de47f=path[_0x087a('0x2f')](__dirname,_0x087a('0x30'),rs['generate'](0x4)+_0x087a('0x36'));return convertFile(_0x5f4c69,_0x2de47f);})['then'](function(){try{fs[_0x087a('0x1a')](_0x5f4c69);fs[_0x087a('0x21')](_0x2de47f,_0x087a('0x22'));}catch(_0x5e47d0){logger[_0x087a('0x12')](_0x5e47d0);}logger['info'](_0x087a('0x37'),_0x2de47f[_0x087a('0x23')]('.')[0x0]);return _0x2de47f['split']('.')[0x0];});};exports['googleTTS']=function(_0x181198,_0x407554){var _0x4f1b02,_0x22550d;return tts(_0x181198,_0x407554||'en',0x1)[_0x087a('0x2e')](function(_0x4153c5){logger['info'](_0x4153c5);_0x4f1b02=path[_0x087a('0x2f')](__dirname,_0x087a('0x30'),rs[_0x087a('0x31')](0x4)+_0x087a('0x32'));return downloadFile(_0x4153c5,_0x4f1b02);})[_0x087a('0x2e')](function(){_0x22550d=path[_0x087a('0x2f')](__dirname,_0x087a('0x30'),rs[_0x087a('0x31')](0x4)+_0x087a('0x36'));return convertFile(_0x4f1b02,_0x22550d);})[_0x087a('0x2e')](function(){try{fs[_0x087a('0x1a')](_0x4f1b02);fs[_0x087a('0x21')](_0x22550d,_0x087a('0x22'));}catch(_0xa3a940){logger[_0x087a('0x12')](_0xa3a940);}logger['info'](_0x087a('0x38'),_0x22550d[_0x087a('0x23')]('.')[0x0]);return _0x22550d[_0x087a('0x23')]('.')[0x0];});};exports['googleASR']=function(_0x2bd3f7,_0x161c8d,_0x40ad18){return google['asr'](_0x2bd3f7,_0x161c8d,_0x40ad18)[_0x087a('0x2e')](function(_0xaa18b1){logger[_0x087a('0x18')](_0xaa18b1['uri']);return rp(_0xaa18b1);})[_0x087a('0x2e')](function(_0x216817){var _0x5b9d14='';var _0x196a67=0x0;try{fs[_0x087a('0x1a')](_0x2bd3f7);}catch(_0x2dbc67){logger[_0x087a('0x12')](_0x2dbc67);}if(_0x216817&&_0x216817['results']){_0x5b9d14=_0x216817['results'][_0x087a('0x39')](function(_0x1a9915){return _0x1a9915&&_0x1a9915[_0x087a('0x3a')][0x0]&&_0x1a9915[_0x087a('0x3a')][0x0][_0x087a('0x3b')]?_0x1a9915['alternatives'][0x0]['transcript']:'';})['join']('\x0a');_0x196a67=_0x216817[_0x087a('0x3c')][_0x087a('0x39')](function(_0x8e0fe2){return _0x8e0fe2&&_0x8e0fe2[_0x087a('0x3a')][0x0]&&_0x8e0fe2[_0x087a('0x3a')][0x0][_0x087a('0x3d')]?_0x8e0fe2[_0x087a('0x3a')][0x0][_0x087a('0x3d')]:0x0;})[_0x087a('0x3e')]('\x0a');}logger[_0x087a('0x18')](_0x087a('0x3f'),_0x5b9d14);logger[_0x087a('0x18')]('googleASR\x20confidence',_0x196a67);return{'transcript':_0x5b9d14,'confidence':_0x196a67};})[_0x087a('0x40')](function(_0x2c7521){logger['error'](_0x087a('0x41'),_0x2c7521[_0x087a('0x11')],_0x2c7521[_0x087a('0x42')],_0x2c7521[_0x087a('0x43')]);});};exports['googleDialogflow']=function(_0x2e6b86,_0x232ed9,_0x1ae147,_0x42ca6d){var _0x5e9e1d=apiai(_0x232ed9,{'language':_0x42ca6d||'en'});return _0x5e9e1d[_0x087a('0x44')](_0x1ae147,{'sessionId':md5(_0x2e6b86)})['then'](function(_0x4b0c0f){logger[_0x087a('0x18')](JSON[_0x087a('0x45')](_0x4b0c0f));return{'source':_0x4b0c0f[_0x087a('0x46')]['source'],'resolvedQuery':_0x4b0c0f[_0x087a('0x46')][_0x087a('0x47')],'action':_0x4b0c0f[_0x087a('0x46')][_0x087a('0x48')],'actionIncomplete':_0x4b0c0f['result'][_0x087a('0x49')],'speech':_0x4b0c0f['result'][_0x087a('0x4a')][_0x087a('0x4b')],'score':_0x4b0c0f[_0x087a('0x46')][_0x087a('0x4c')],'statusCode':_0x4b0c0f[_0x087a('0x4d')][_0x087a('0x4e')],'endConversation':_0x4b0c0f['result'][_0x087a('0x4f')][_0x087a('0x50')]||![],'isFallbackIntent':_0x4b0c0f['result'][_0x087a('0x4f')][_0x087a('0x51')]};});};exports[_0x087a('0x52')]=function(_0xdb3222,_0x20f825,_0x939730,_0x4a4061){return tilde[_0x087a('0x53')](_0xdb3222,_0x20f825,_0x939730,_0x4a4061)[_0x087a('0x2e')](function(_0x5ef045){try{fs[_0x087a('0x1a')](_0xdb3222);}catch(_0x4fa439){logger[_0x087a('0x12')](_0x4fa439);}logger[_0x087a('0x18')](_0x087a('0x54'),_0x5ef045[_0x087a('0x3b')]);logger[_0x087a('0x18')](_0x087a('0x55'),_0x5ef045[_0x087a('0x3d')]);return _0x5ef045;});};exports['awsPolly']=function(_0xff9103,_0xd945f2,_0x3fcbfa,_0x48954b,_0x4728da,_0x5cf598){var _0x18d722=path[_0x087a('0x2f')](__dirname,'tmp',rs[_0x087a('0x31')](0x4)+_0x087a('0x32'));var _0x1409b8;return aws[_0x087a('0x56')](_0xff9103,_0xd945f2,_0x3fcbfa,_0x48954b,_0x4728da,_0x5cf598,_0x18d722)[_0x087a('0x2e')](function(){_0x1409b8=path[_0x087a('0x2f')](__dirname,'tmp',rs[_0x087a('0x31')](0x4)+_0x087a('0x36'));return convertFile(_0x18d722,_0x1409b8);})['then'](function(){try{fs['unlink'](_0x18d722);fs[_0x087a('0x21')](_0x1409b8,_0x087a('0x22'));}catch(_0x56ddcc){logger[_0x087a('0x12')](_0x56ddcc);}return _0x1409b8[_0x087a('0x23')]('.')[0x0];});};exports[_0x087a('0x57')]=function(_0x4cb632,_0x4a1d2b,_0x1ebe3d,_0x132680,_0x396f50,_0x5f0c7a){return aws[_0x087a('0x58')](_0x4cb632,_0x4a1d2b,_0x1ebe3d,_0x132680,_0x396f50,_0x5f0c7a)[_0x087a('0x2e')](function(_0x2915c4){logger[_0x087a('0x18')](JSON[_0x087a('0x45')](_0x2915c4));return _0x2915c4;});};exports[_0x087a('0x59')]=function(_0x456f96,_0x5cca25,_0x324535,_0x128f08){var _0x430631=util['format'](_0x087a('0x5a'),ISPEECH_API,_0x456f96,encodeURIComponent(_0x5cca25),_0x324535,_0x128f08);var _0x799ff4=path[_0x087a('0x2f')](__dirname,_0x087a('0x30'),rs[_0x087a('0x31')](0x4)+_0x087a('0x32'));var _0x337ac7;return downloadFile(_0x430631,_0x799ff4)[_0x087a('0x2e')](function(){_0x337ac7=path[_0x087a('0x2f')](__dirname,'tmp',rs[_0x087a('0x31')](0x4)+_0x087a('0x36'));return convertFile(_0x799ff4,_0x337ac7);})[_0x087a('0x2e')](function(){try{fs[_0x087a('0x1a')](_0x799ff4);fs[_0x087a('0x21')](_0x337ac7,'777');}catch(_0x2ab6ff){logger[_0x087a('0x12')](_0x2ab6ff);}return _0x337ac7[_0x087a('0x23')]('.')[0x0];});};exports[_0x087a('0x5b')]=function(_0x2d7d4f,_0x3401c9,_0x478a3b,_0xbc1955){var _0x2e8b91=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x3401c9,_0x478a3b,base64Encode(_0x2d7d4f),_0xbc1955?util[_0x087a('0x5c')](_0x087a('0x5d'),encodeURIComponent(_0xbc1955)):_0x087a('0x5e'));return uploadFile(_0x2e8b91)[_0x087a('0x2e')](function(_0x20f25b){return querystring[_0x087a('0x3')](_0x20f25b);});};exports[_0x087a('0x5f')]=function(_0x2f8c75,_0x275d4e){return sestek[_0x087a('0x60')](_0x2f8c75,_0x275d4e)[_0x087a('0x2e')](function(_0x138f80){logger['info'](JSON[_0x087a('0x45')](_0x138f80));var _0x536197={'speech':_0x138f80['text'],'action':_0x138f80['channelData']?_0x138f80[_0x087a('0x61')][_0x087a('0x62')]:undefined,'actiondata':_0x138f80[_0x087a('0x61')]?_0x138f80[_0x087a('0x61')][_0x087a('0x63')]:undefined};if(_0x138f80[_0x087a('0x61')]&&_0x138f80[_0x087a('0x61')]['AudioFromTts']){return base64Decode(_0x138f80[_0x087a('0x61')]['AudioFromTts'][_0x087a('0x64')],path[_0x087a('0x2f')](__dirname,_0x087a('0x30'),rs[_0x087a('0x31')](0x4)+'.wav'))[_0x087a('0x2e')](function(_0x13489b){_0x536197['audiofile']=_0x13489b;return _0x536197;});}return _0x536197;});};exports[_0x087a('0x65')]=function(){return __dirname;}; \ No newline at end of file +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 diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index da5f8ec..7604aef 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 _0xc031=['./nda'];(function(_0x53152c,_0x15fbf9){var _0x1e72e8=function(_0x1a93e5){while(--_0x1a93e5){_0x53152c['push'](_0x53152c['shift']());}};_0x1e72e8(++_0x15fbf9);}(_0xc031,0x163));var _0x1c03=function(_0x49d280,_0x33d68f){_0x49d280=_0x49d280-0x0;var _0x25274a=_0xc031[_0x49d280];return _0x25274a;};var nda=require(_0x1c03('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +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 diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index a4b0cc2..9f0dbd8 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 _0xd768=['../../../../../config/logger','agi','exports','POST','ndauth_url','password','then','ndassistant_url','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','project','body','channelData','ProjectName','ndagenerate_audio','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','url'];(function(_0x1555f0,_0x17196a){var _0x187df0=function(_0x9f588e){while(--_0x9f588e){_0x1555f0['push'](_0x1555f0['shift']());}};_0x187df0(++_0x17196a);}(_0xd768,0xb2));var _0x8d76=function(_0x2e2104,_0x11287d){_0x2e2104=_0x2e2104-0x0;var _0x1280c5=_0xd768[_0x2e2104];return _0x1280c5;};'use strict';var rp=require(_0x8d76('0x0'));var url=require(_0x8d76('0x1'));var logger=require(_0x8d76('0x2'))(_0x8d76('0x3'));module[_0x8d76('0x4')]=function(_0x4d4d87,_0x8fe5db){var _0x3d0946={'method':_0x8d76('0x5'),'uri':url['resolve'](_0x8fe5db[_0x8d76('0x6')],'/token'),'form':{'grant_type':'password','username':_0x8fe5db['username'],'password':_0x8fe5db[_0x8d76('0x7')]},'json':!![]};return rp(_0x3d0946)[_0x8d76('0x8')](function(_0x5f32e0){var _0x3009d={'method':_0x8d76('0x5'),'uri':url['resolve'](_0x8fe5db[_0x8d76('0x9')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x8fe5db[_0x8d76('0xa')]||_0x8d76('0xb'),'channelId':_0x8d76('0xc'),'conversation':{'id':_0x4d4d87[_0x8d76('0xd')]},'from':{'id':_0x4d4d87[_0x8d76('0xe')],'name':_0x4d4d87[_0x8d76('0xf')]},'recipient':{'id':_0x4d4d87[_0x8d76('0x10')],'name':_0x4d4d87[_0x8d76('0x11')]},'text':_0x8fe5db[_0x8d76('0x12')],'channelData':{}},'headers':{'Authorization':_0x8d76('0x13')+_0x5f32e0['access_token']},'json':!![]};if(_0x8fe5db[_0x8d76('0x14')]){_0x3009d[_0x8d76('0x15')][_0x8d76('0x16')][_0x8d76('0x17')]=_0x8fe5db['project'];}if(_0x8fe5db[_0x8d76('0x18')]=='1'){_0x3009d[_0x8d76('0x15')][_0x8d76('0x16')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x8fe5db[_0x8d76('0x19')]){_0x3009d[_0x8d76('0x15')][_0x8d76('0x16')]['CustomAction']=_0x8fe5db[_0x8d76('0x19')];if(_0x8fe5db[_0x8d76('0x1a')]){_0x3009d[_0x8d76('0x15')][_0x8d76('0x16')][_0x8d76('0x1b')]=_0x8fe5db[_0x8d76('0x1a')];}}logger[_0x8d76('0x1c')](JSON[_0x8d76('0x1d')](_0x3009d));return rp(_0x3009d);});}; \ No newline at end of file +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 diff --git a/server/services/agi/scripts/tilde/asr/index.js b/server/services/agi/scripts/tilde/asr/index.js index 019ecc2..25c6e5a 100644 --- a/server/services/agi/scripts/tilde/asr/index.js +++ b/server/services/agi/scripts/tilde/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2161=['exports'];(function(_0x5cb1a5,_0x13016f){var _0x533f56=function(_0x1e5a46){while(--_0x1e5a46){_0x5cb1a5['push'](_0x5cb1a5['shift']());}};_0x533f56(++_0x13016f);}(_0x2161,0xcf));var _0x1216=function(_0xe033e7,_0x561a6d){_0xe033e7=_0xe033e7-0x0;var _0x63031f=_0x2161[_0xe033e7];return _0x63031f;};'use strict';var asr=require('./lib/api');module[_0x1216('0x0')]=function(_0x4f2e6b,_0x7f4e51,_0x310d3e,_0x4448ce){return asr(_0x4f2e6b,_0x7f4e51,_0x310d3e,_0x4448ce);}; \ No newline at end of file +'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 diff --git a/server/services/agi/scripts/tilde/asr/lib/api.js b/server/services/agi/scripts/tilde/asr/lib/api.js index 33945d0..e0de132 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 _0x1469=['open','message','bluebird','lodash','moment','crypto','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','parse','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','terminate','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','Error\x20Tilde\x20ASR\x20socket','isNil','isObject'];(function(_0x51c96b,_0x40f387){var _0x5b17df=function(_0x18fa56){while(--_0x18fa56){_0x51c96b['push'](_0x51c96b['shift']());}};_0x5b17df(++_0x40f387);}(_0x1469,0x16a));var _0x9146=function(_0x239c57,_0x4fb26d){_0x239c57=_0x239c57-0x0;var _0x59aa96=_0x1469[_0x239c57];return _0x59aa96;};'use strict';var BPromise=require(_0x9146('0x0'));var _=require(_0x9146('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x9146('0x2'));var crypto=require(_0x9146('0x3'));var logger=require('../../../../../../config/logger')(_0x9146('0x4'));module['exports']=function(_0xd639,_0x978331,_0x5d493b,_0x508438){return new BPromise(function(_0x25fa7e,_0x3c979a){logger[_0x9146('0x5')](_0x9146('0x6'),_0x508438||_0x9146('0x7'));var _0x5d4735=new WebSocket(_0x508438||_0x9146('0x7'),{'perMessageDeflate':![]});var _0x49e3c2='';var _0x43e4df='0';var _0x1698a7='1';var _0x31babc=_0x9146('0x8');function _0x15c4eb(_0x48fac5){var _0x51ca13=crypto[_0x9146('0x9')](_0x9146('0xa'));_0x51ca13[_0x9146('0xb')](_0x48fac5);return _0x51ca13[_0x9146('0xc')]('hex');}function _0x9d94d3(){try{logger[_0x9146('0x5')](_0x9146('0xd'));var _0x555929=moment()[_0x9146('0xe')]();var _0x12777c=_0x15c4eb(_0x555929+_0x978331+_0x5d493b);_0x5d4735[_0x9146('0xf')](JSON[_0x9146('0x10')]({'appID':_0x978331,'timestamp':_0x555929,'appKey':_0x12777c}));var _0x8748d4=fs[_0x9146('0x11')](_0xd639);_0x8748d4['on'](_0x9146('0x12'),function(_0x4d21b4){_0x5d4735[_0x9146('0xf')](_0x4d21b4);});_0x8748d4['on'](_0x9146('0x13'),function(){_0x5d4735[_0x9146('0xf')](_0x9146('0x14'));});}catch(_0x3ea28d){logger[_0x9146('0x15')](_0x9146('0x16'),JSON[_0x9146('0x10')](_0x3ea28d));_0x5d4735['terminate']();}}function _0x5850f7(_0x16ab7e){try{if(_0x16ab7e){var _0x562dea=JSON[_0x9146('0x17')](_0x16ab7e);switch(_0x562dea['status']){case 0x0:if(_0x562dea[_0x9146('0x18')]){if(_0x562dea[_0x9146('0x18')][_0x9146('0x19')]){logger[_0x9146('0x5')](_0x9146('0x1a'),JSON[_0x9146('0x10')](_0x562dea[_0x9146('0x18')][_0x9146('0x1b')]));_0x49e3c2=_0x562dea[_0x9146('0x18')]['hypotheses'][0x0][_0x9146('0x1c')];_0x43e4df=_0x562dea['result'][_0x9146('0x1b')][0x0]['likelihood'];_0x1698a7='0';_0x31babc='Success.';_0x5d4735[_0x9146('0x1d')]();}}break;case 0x1:logger[_0x9146('0x5')](_0x9146('0x8'));_0x1698a7='1';_0x31babc='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger['info']('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x1698a7='2';_0x31babc=_0x9146('0x1e');break;case 0x9:logger[_0x9146('0x5')](_0x9146('0x1f'));_0x1698a7='9';_0x31babc=_0x9146('0x1f');break;case 0xa:logger['info'](_0x9146('0x20'));_0x1698a7='10';_0x31babc=_0x9146('0x20');break;case 0xb:logger[_0x9146('0x5')](_0x9146('0x21'));_0x1698a7='11';_0x31babc='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0xc9d608){logger[_0x9146('0x15')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x9146('0x10')](_0xc9d608));_0x5d4735[_0x9146('0x1d')]();}}function _0x4c4031(){logger[_0x9146('0x5')](_0x9146('0x22'));_0x25fa7e({'transcript':_0x49e3c2,'confidence':_0x43e4df,'status':_0x1698a7,'status_message':_0x31babc});}function _0x176ab4(_0x1b2a6d){logger[_0x9146('0x15')](_0x9146('0x23'));if(!_[_0x9146('0x24')](_0x1b2a6d)){logger[_0x9146('0x15')](_[_0x9146('0x25')](_0x1b2a6d)?JSON[_0x9146('0x10')](_0x1b2a6d):_0x1b2a6d);}}_0x5d4735['on'](_0x9146('0x26'),_0x9d94d3);_0x5d4735['on'](_0x9146('0x27'),_0x5850f7);_0x5d4735['on'](_0x9146('0x13'),_0x4c4031);_0x5d4735['on'](_0x9146('0x15'),_0x176ab4);});}; \ No newline at end of file +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 diff --git a/server/services/agi/scripts/tilde/index.js b/server/services/agi/scripts/tilde/index.js index 10cb4be..b9b23dc 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 asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file +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 diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 1d968d7..9ab76a4 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 _0x639d=['nextTick','inherits','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','close'];(function(_0x77d310,_0x2b2fe7){var _0x2cdce4=function(_0xbaa481){while(--_0xbaa481){_0x77d310['push'](_0x77d310['shift']());}};_0x2cdce4(++_0x2b2fe7);}(_0x639d,0xbb));var _0xd639=function(_0x480c51,_0x37ad98){_0x480c51=_0x480c51-0x0;var _0x51a761=_0x639d[_0x480c51];return _0x51a761;};'use strict';var util=require(_0xd639('0x0'));var net=require(_0xd639('0x1'));var EventEmitter=require(_0xd639('0x2'))['EventEmitter'];var AGIError=require(_0xd639('0x3'));var AGIChannel=require(_0xd639('0x4'));var AGIServer=function(_0x5b7e8b,_0x45b72b,_0x588a30){var _0x19b990=this,_0x5b7e8b=_0x5b7e8b||0x11dd,_0x45b72b=_0x45b72b||_0xd639('0x5'),_0x2a71b9=null,_0x1cebd4=0x0;EventEmitter[_0xd639('0x6')](_0x19b990);function _0x200b82(){if(!_0x5b7e8b){_0x19b990[_0xd639('0x7')](_0xd639('0x8'),new AGIError(_0xd639('0x9')));return![];}_0x2a71b9=net['createServer']();_0x2a71b9[_0xd639('0xa')](_0x5b7e8b,_0x45b72b);_0x2a71b9['on'](_0xd639('0xb'),function(){_0x19b990[_0xd639('0x7')](_0xd639('0xb'));});_0x2a71b9['on'](_0xd639('0xc'),function(_0x2a6bf5){_0x2a71b9[_0xd639('0xd')](function(_0x1b0c87,_0x3d93dc){if(_0x1b0c87){_0x19b990['emit'](_0xd639('0x8'),new AGIError(_0xd639('0xe'),_0x1b0c87));}else if(_0x588a30&&_0x588a30<0x0){_0x19b990[_0xd639('0x7')]('error',new AGIError(_0xd639('0xf')));_0x2a6bf5[_0xd639('0x10')]();}else if(_0x588a30&&_0x588a30>0x0&&_0x588a30<_0x3d93dc){_0x1cebd4+=0x1;_0x19b990[_0xd639('0x7')]('error',new AGIError(_0xd639('0x11'),_0x1cebd4));_0x2a6bf5[_0xd639('0x10')]();}else{var _0x5c58fa=new AGIChannel(_0x2a6bf5);_0x5c58fa['on'](_0xd639('0x12'),function(){_0x19b990[_0xd639('0x7')]('connection',_0x5c58fa);});}});});_0x2a71b9['on'](_0xd639('0x8'),function(_0x1cc87b){_0x19b990[_0xd639('0x7')](_0xd639('0x8'),new AGIError(_0xd639('0xe'),_0x1cc87b['code']));});_0x2a71b9['on'](_0xd639('0x13'),function(){_0x19b990[_0xd639('0x7')](_0xd639('0x13'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0xd639('0x14')](function(){_0x200b82();});};util[_0xd639('0x15')](AGIServer,EventEmitter);module[_0xd639('0x16')]=function(_0x5cc42a,_0x85a1c6,_0x36cb0b){return new AGIServer(_0x5cc42a,_0x85a1c6,_0x36cb0b);}; \ No newline at end of file +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 diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 4b69049..bfd4342 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 _0x3916=['getQueryOdbc','error','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','callerid','createSquareRecording','context','extension','priority','dnid','arg_1','file','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','phone','list_id','Callback\x20scheduled\x20at\x20','toString','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','body','parse','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','key','dialogflow_language','sestekNDA','ispeech_tts_language','ispeechASR','ispeech_asr_language','isConfigured','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','appid','appsecret','clear','includes','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','saveRestApiResult','%s.%s','length','setVariable','split','getVariable','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','no\x20list\x20selected','scheduledAt','delay','callback_priority','noop','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','RECOG_CONFIDENCE()','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','grammar','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20found','DIAL','opts','Executed\x20command\x20%s','dialogflow','bot','googleDialogflow','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20Result\x20%s','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','response','maxdigit','test','mindigit','hiddendigitsnum','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','Trying\x20aws\x20Polly\x20%s','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','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','generate','tilde\x20%s\x20file\x20created','tildeASR','TILDE_ASR_%s','gotoc','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','no\x20key\x20configured','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Trying\x20ispeech\x20TTS\x20%s','ispeechTTS','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','no\x20variable\x20found','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','file_id','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Response:','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','email','user','bcc','subject','service','host','port','secure','authentication','auth','pass','template_id','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','start','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','path','util','lodash','shelljs','odbc','randomstring','moment','request-promise','../../config/logger','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','rpc','getVariableById','then','catch','getVoiceQueue','name','prototype','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s'];(function(_0x30886e,_0x268c37){var _0x580c47=function(_0x19875e){while(--_0x19875e){_0x30886e['push'](_0x30886e['shift']());}};_0x580c47(++_0x268c37);}(_0x3916,0x189));var _0x6391=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x3916[_0x47aa64];return _0x549c7a;};'use strict';var fs=require('fs');var path=require(_0x6391('0x0'));var util=require(_0x6391('0x1'));var _=require(_0x6391('0x2'));var sh=require(_0x6391('0x3'));var odbc=require(_0x6391('0x4'))();var rs=require(_0x6391('0x5'));var moment=require(_0x6391('0x6'));var Mustache=require('mustache');var rp=require(_0x6391('0x7'));var logger=require(_0x6391('0x8'))('agi');var config=require('../../config/environment');var scripts=require('./scripts');var FILES_PATH=_0x6391('0x9');var recursiveMapAttributes=[_0x6391('0xa'),_0x6391('0xb')];var verticesWithRetry=[_0x6391('0xc'),_0x6391('0xd'),_0x6391('0xe')];var AGIVertices=function(_0x130347,_0x3cccaf,_0x405c1e){this['channel']=_0x130347;this[_0x6391('0xf')]=_0x3cccaf;this['mailRpc']=_0x405c1e;};AGIVertices['prototype']['getVariable']=function(_0x29e56d,_0x2575bd){this['rpc'][_0x6391('0x10')](_0x29e56d)[_0x6391('0x11')](function(_0x48582e){_0x2575bd(null,_0x48582e?_0x48582e['name']:![]);})[_0x6391('0x12')](function(_0x37ca72){_0x2575bd(_0x37ca72);});};AGIVertices['prototype'][_0x6391('0x13')]=function(_0xdfa0b1,_0xde3aac){this[_0x6391('0xf')]['getVoiceQueueById'](_0xdfa0b1)[_0x6391('0x11')](function(_0x373b73){_0xde3aac(null,_0x373b73?_0x373b73[_0x6391('0x14')]:![]);})[_0x6391('0x12')](function(_0x3fdcd4){_0xde3aac(_0x3fdcd4);});};AGIVertices[_0x6391('0x15')][_0x6391('0x16')]=function(_0x90b198,_0x373e58){this[_0x6391('0xf')][_0x6391('0x17')](_0x90b198)[_0x6391('0x11')](function(_0x129eaf){_0x373e58(null,_0x129eaf?_0x129eaf[_0x6391('0x14')]:![]);})[_0x6391('0x12')](function(_0x3770a1){_0x373e58(_0x3770a1);});};AGIVertices[_0x6391('0x15')][_0x6391('0x18')]=function(_0x2e4fe4,_0x2b6c8b){this[_0x6391('0xf')][_0x6391('0x19')](_0x2e4fe4)[_0x6391('0x11')](function(_0x19e8a7){_0x2b6c8b(null,_0x19e8a7?_0x19e8a7[_0x6391('0x1a')]:![]);})['catch'](function(_0x1341fb){_0x2b6c8b(_0x1341fb);});};AGIVertices['prototype'][_0x6391('0x1b')]=function(_0x5b07c0,_0x530153){this['rpc'][_0x6391('0x1c')](_0x5b07c0)[_0x6391('0x11')](function(_0x158bf3){_0x530153(null,_0x158bf3?_0x158bf3[_0x6391('0x14')]:![]);})['catch'](function(_0x2d19d9){_0x530153(_0x2d19d9);});};AGIVertices[_0x6391('0x15')][_0x6391('0x1d')]=function(_0x1f9b9c,_0xbeff66){this['rpc'][_0x6391('0x1e')](_0x1f9b9c)['then'](function(_0x5c4cf3){_0xbeff66(null,_0x5c4cf3?_0x5c4cf3[_0x6391('0x14')]:![]);})[_0x6391('0x12')](function(_0x185160){_0xbeff66(_0x185160);});};AGIVertices[_0x6391('0x15')]['getSound']=function(_0x2a5160,_0x184f98){var _0x5c72b7=this;this[_0x6391('0xf')]['getSoundById'](_0x2a5160)[_0x6391('0x11')](function(_0x34b323){_0x184f98(null,_0x34b323?_0x5c72b7[_0x6391('0x1f')](_0x34b323[_0x6391('0x20')]):![]);})[_0x6391('0x12')](function(_0x3b29f0){_0x184f98(_0x3b29f0);});};AGIVertices[_0x6391('0x15')][_0x6391('0x21')]=function(_0x206fbc,_0x4c2309){this['rpc'][_0x6391('0x22')](_0x206fbc)[_0x6391('0x11')](function(_0x4755ad){_0x4c2309(null,_0x4755ad?_0x4755ad:![]);})[_0x6391('0x12')](function(_0x1557ee){_0x4c2309(_0x1557ee);});};AGIVertices[_0x6391('0x15')][_0x6391('0x23')]=function(_0x55efdc,_0x3671ea,_0x4c9380){this[_0x6391('0x24')][_0x6391('0x23')](_0x55efdc,_0x3671ea)[_0x6391('0x11')](function(){_0x4c9380(null);})[_0x6391('0x12')](function(_0x17f783){_0x4c9380(_0x17f783);});};AGIVertices[_0x6391('0x15')]['getIntervals']=function(_0x2d2bd4,_0x55a008){this[_0x6391('0xf')][_0x6391('0x25')](_0x2d2bd4)[_0x6391('0x11')](function(_0x416b2d){if(_0x416b2d){if(_0x416b2d[_0x6391('0x26')]){_0x55a008(null,[_0x416b2d[_0x6391('0x27')]]);}else{_0x55a008(null,_[_0x6391('0x28')](_0x416b2d[_0x6391('0x29')],_0x6391('0x27')));}}else{_0x55a008(null,![]);}})[_0x6391('0x12')](function(_0x3bb010){_0x55a008(_0x3bb010);});};AGIVertices['prototype']['getSoundPath']=function(_0x2f5435){return util[_0x6391('0x2a')](_0x6391('0x2b'),FILES_PATH,_0x2f5435);};AGIVertices['prototype'][_0x6391('0x2c')]=function(_0x559710,_0x480d4e,_0x29a7f1){odbc['open'](_0x559710,function(_0x11dbd3){if(_0x11dbd3){logger[_0x6391('0x2d')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x11dbd3);_0x29a7f1(_0x11dbd3);}else{logger[_0x6391('0x2e')](_0x6391('0x2f'));odbc[_0x6391('0x30')](_0x480d4e,function(_0x174c07,_0x35d6c0){if(_0x174c07){logger[_0x6391('0x2e')](_0x6391('0x31'),_0x480d4e);_0x29a7f1(_0x174c07);}else{logger[_0x6391('0x2e')]('Query\x20executed\x20correctly\x20%s',_0x480d4e);odbc[_0x6391('0x32')](function(_0x830c6b){if(_0x830c6b){logger[_0x6391('0x2d')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x830c6b);}_0x29a7f1(null,_0x35d6c0);});}});}});};AGIVertices[_0x6391('0x15')][_0x6391('0x33')]=function(_0x592e62,_0x15af9b){this['rpc'][_0x6391('0x34')](_0x592e62)['then'](function(_0x4d18bf){_0x15af9b(null,_0x4d18bf?_0x4d18bf:![]);})['catch'](function(_0x23cefd){_0x15af9b(_0x23cefd);});};AGIVertices[_0x6391('0x15')][_0x6391('0x35')]=function(_0x5a17c6,_0x665523){this[_0x6391('0xf')][_0x6391('0x35')](_0x5a17c6)[_0x6391('0x11')](function(_0xe8de74){_0x665523(null,_0xe8de74);})[_0x6391('0x12')](function(_0x534551){_0x665523(_0x534551);});};AGIVertices[_0x6391('0x15')]['createSquareDetailsReport']=function(_0x21090c,_0x1a643f,_0x341bf2){this['rpc'][_0x6391('0x36')]({'uniqueid':this[_0x6391('0x37')][_0x6391('0x38')],'node':_0x21090c[_0x6391('0x39')],'application':_0x21090c[_0x6391('0x3a')],'data':_0x1a643f||null,'project_name':this['channel']['arg_1'],'callerid':this[_0x6391('0x37')][_0x6391('0x3b')]})[_0x6391('0x11')](function(_0x19e2d5){if(_0x341bf2){_0x341bf2(null,_0x19e2d5);}})[_0x6391('0x12')](function(_0x2a4f87){if(_0x341bf2){_0x341bf2(_0x2a4f87);}});};AGIVertices[_0x6391('0x15')][_0x6391('0x3c')]=function(_0x6da5ca,_0x3abb2f,_0x57d136,_0x549302){this['rpc']['createSquareRecording']({'uniqueid':this[_0x6391('0x37')][_0x6391('0x38')],'callerid':this[_0x6391('0x37')][_0x6391('0x3b')],'calleridname':this[_0x6391('0x37')]['calleridname'],'context':this[_0x6391('0x37')][_0x6391('0x3d')],'extension':this[_0x6391('0x37')][_0x6391('0x3e')],'priority':this[_0x6391('0x37')][_0x6391('0x3f')],'accountcode':this[_0x6391('0x37')]['accountcode'],'dnid':this[_0x6391('0x37')][_0x6391('0x40')],'projectName':this['channel'][_0x6391('0x41')],'saveName':_0x3abb2f,'filename':_0x6da5ca[_0x6391('0x42')]||_0x3abb2f,'savePath':_0x57d136})[_0x6391('0x11')](function(_0x3249f4){_0x549302(null,_0x3249f4);})['catch'](function(_0x5009cc){_0x549302(_0x5009cc);});};AGIVertices[_0x6391('0x15')][_0x6391('0x43')]=function(_0x325f4c,_0x1ca9a4,_0x1bc864){this['rpc'][_0x6391('0x43')]({'uniqueid':this['channel'][_0x6391('0x38')],'body':_0x325f4c,'direction':_0x1ca9a4})[_0x6391('0x11')](function(_0x57703b){if(_0x1bc864){_0x1bc864(null,_0x57703b);}})['catch'](function(_0xd3c003){if(_0x1bc864){_0x1bc864(_0xd3c003);}});};AGIVertices[_0x6391('0x15')][_0x6391('0x44')]=function(_0x5e8256,_0x3fcbe0){this[_0x6391('0xf')]['createCmContact']({'firstName':_['isEmpty'](_0x5e8256[_0x6391('0x14')])||_[_0x6391('0x45')](_0x5e8256[_0x6391('0x14')])?_0x6391('0x46')+Math[_0x6391('0x47')]():_0x5e8256[_0x6391('0x14')],'lastName':_[_0x6391('0x48')](_0x5e8256['lastName'])||_[_0x6391('0x45')](_0x5e8256[_0x6391('0x49')])?null:_0x5e8256[_0x6391('0x49')],'phone':_0x5e8256[_0x6391('0x4a')],'ListId':_0x5e8256[_0x6391('0x4b')],'scheduledat':_0x5e8256['scheduledAt'],'callbackUniqueid':this['channel'][_0x6391('0x38')],'tags':'callback','description':_0x6391('0x4c')+_0x5e8256['scheduledAt'][_0x6391('0x4d')](),'priority':_0x5e8256['callback_priority']})[_0x6391('0x11')](function(_0x5225e1){_0x3fcbe0(null,_0x5225e1);})[_0x6391('0x12')](function(_0x18d9ae){_0x3fcbe0(_0x18d9ae);});};AGIVertices[_0x6391('0x15')][_0x6391('0x4e')]=function(_0x262158,_0x32e2ed){this[_0x6391('0xf')][_0x6391('0x4f')](_0x262158)[_0x6391('0x11')](function(_0x1983a0){_0x32e2ed(null,_0x1983a0?_0x1983a0['name']:![]);})['catch'](function(_0xd794d2){_0x32e2ed(_0xd794d2);});};AGIVertices[_0x6391('0x15')][_0x6391('0x50')]=function(_0xbdcefc,_0x1624f7,_0x46d5f4){var _0x5ed7a4={'role':'agent'};_0x5ed7a4[_0xbdcefc]=this[_0x6391('0x37')]['callerid'];this['rpc'][_0x6391('0x50')](_0x5ed7a4,_0x1624f7,this[_0x6391('0x37')][_0x6391('0x38')])[_0x6391('0x11')](function(_0x196878){_0x46d5f4(null,_[_0x6391('0x45')](_0x196878)?![]:!![]);})[_0x6391('0x12')](function(_0x5f4744){logger[_0x6391('0x2d')](_0x5f4744);_0x46d5f4(null,![]);});};AGIVertices['prototype']['agentUnpause']=function(_0x5ec088,_0x2b53fd){var _0x3d2c1f={'role':_0x6391('0x51')};_0x3d2c1f[_0x5ec088]=this[_0x6391('0x37')][_0x6391('0x3b')];this[_0x6391('0xf')][_0x6391('0x52')](_0x3d2c1f)[_0x6391('0x11')](function(_0x35b0b3){_0x2b53fd(null,_[_0x6391('0x45')](_0x35b0b3)?![]:!![]);})[_0x6391('0x12')](function(_0xa2ab68){logger[_0x6391('0x2d')](_0xa2ab68);_0x2b53fd(null,![]);});};AGIVertices[_0x6391('0x15')][_0x6391('0x53')]=function(_0x4d3c14,_0x49b131){var _0x5ce9ed={'role':_0x6391('0x51')};_0x5ce9ed[_0x4d3c14]=this[_0x6391('0x37')][_0x6391('0x3b')];this['rpc']['agentLogout'](_0x5ce9ed)['then'](function(_0x128779){_0x49b131(null,_[_0x6391('0x45')](_0x128779)?![]:!![]);})[_0x6391('0x12')](function(_0x554c34){logger['error'](_0x554c34);_0x49b131(null,![]);});};AGIVertices[_0x6391('0x15')][_0x6391('0x54')]=function(_0x15134b,_0x5b8c99){var _0xbadd4d={'role':_0x6391('0x51')};_0xbadd4d[_0x15134b]=this[_0x6391('0x37')][_0x6391('0x3b')];var _0x2fa2c8=_0x15134b!=_0x6391('0x55')?util['format']('%s/%s@from-sip/n','LOCAL',this['channel'][_0x6391('0x3b')]):undefined;this[_0x6391('0xf')][_0x6391('0x54')](_0xbadd4d,_0x2fa2c8)['then'](function(_0x4a7f70){_0x5b8c99(null,_[_0x6391('0x45')](_0x4a7f70)?![]:!![]);})[_0x6391('0x12')](function(_0x1e7987){logger[_0x6391('0x2d')](_0x1e7987);_0x5b8c99(null,![]);});};AGIVertices[_0x6391('0x15')][_0x6391('0x56')]=function(_0xfe1798,_0xda650f){sh[_0x6391('0x57')](_[_0x6391('0x58')](_0xfe1798),function(_0x11e12f,_0x378705){var _0x4cb206=_0x378705[_0x6391('0x59')](/(\r\n|\n|\r)/gm,'');_0xda650f(null,_0x4cb206);});};AGIVertices[_0x6391('0x15')]['googleCloudTTS']=function(_0x5b0fa0,_0x26241a){scripts[_0x6391('0x5a')](_0x5b0fa0[_0x6391('0x5b')],_0x5b0fa0[_0x6391('0x5c')]||_0x6391('0x5d'),_0x5b0fa0[_0x6391('0x5d')],_0x5b0fa0[_0x6391('0x5e')]||_0x6391('0x5f'),_0x5b0fa0[_0x6391('0x60')]||_0x6391('0x61'),_0x5b0fa0['audioEncoding']||_0x6391('0x62'))[_0x6391('0x11')](function(_0x41904a){_0x26241a(null,_0x41904a);})[_0x6391('0x12')](function(_0x1febad){_0x26241a(_0x1febad);});};AGIVertices['prototype'][_0x6391('0x63')]=function(_0x4215d4,_0x31cd6c){scripts[_0x6391('0x63')](_0x4215d4[_0x6391('0x5d')],_0x4215d4[_0x6391('0x64')]||'en',0x1)['then'](function(_0x33ef6c){_0x31cd6c(null,_0x33ef6c);})['catch'](function(_0x54d324){_0x31cd6c(_0x54d324);});};AGIVertices[_0x6391('0x15')][_0x6391('0x65')]=function(_0x101373,_0x972be9){var _0x5c60a8={'uri':_0x101373[_0x6391('0x66')],'method':_0x101373[_0x6391('0x67')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x101373[_0x6391('0x68')])===_0x6391('0x69')&&parseInt(_0x101373['timeout'])>=0x1?parseInt(_0x101373[_0x6391('0x68')])*0x3e8:0x5*0x3e8};if(_['includes'](['POST','PUT'],_0x5c60a8[_0x6391('0x67')]['toUpperCase']())){try{_0x5c60a8[_0x6391('0x6a')]=_0x101373[_0x6391('0xb')]?JSON[_0x6391('0x6b')](_0x101373[_0x6391('0xb')]):{};}catch(_0x25102c){logger['error']('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x25102c);}}try{_0x5c60a8[_0x6391('0x6c')]=_0x101373[_0x6391('0xa')]?JSON[_0x6391('0x6b')](_0x101373[_0x6391('0xa')]):{};}catch(_0x3a90f5){logger[_0x6391('0x2d')](_0x6391('0x6d'),_0x3a90f5);}if(_0x101373[_0x6391('0x6e')]){try{var _0x4d135d=require(_0x101373[_0x6391('0x6e')])[_0x6391('0x6f')](this,_0x5c60a8);_0x5c60a8[_0x6391('0x70')]=Mustache[_0x6391('0x71')](_0x101373[_0x6391('0x66')],_0x4d135d,{},['$$','$$']);if(_0x5c60a8[_0x6391('0x6c')]){_0x5c60a8[_0x6391('0x6c')]=JSON['parse'](Mustache[_0x6391('0x71')](JSON[_0x6391('0x72')](_0x5c60a8[_0x6391('0x6c')]),_0x4d135d,{},['$$','$$']));}if(_0x5c60a8[_0x6391('0x6a')]){_0x5c60a8[_0x6391('0x6a')]=JSON[_0x6391('0x6b')](Mustache[_0x6391('0x71')](JSON['stringify'](_0x5c60a8[_0x6391('0x6a')]),_0x4d135d,{},['$$','$$']));}}catch(_0x52fd75){logger[_0x6391('0x2d')](_0x6391('0x73'),_0x52fd75);}}rp(_0x5c60a8)[_0x6391('0x11')](function(_0x359de9){var _0x4e0d87={'statusCode':_0x359de9[_0x6391('0x74')]||0xc8,'statusMessage':_0x359de9[_0x6391('0x75')]||'OK','headers':_0x359de9[_0x6391('0x6c')]||{},'body':_0x359de9[_0x6391('0x6a')]||{}};_0x972be9(null,_0x4e0d87);})[_0x6391('0x12')](function(_0x1915ef){var _0x2b263b={'statusCode':_0x1915ef[_0x6391('0x74')]||0x1f4,'statusMessage':_0x1915ef[_0x6391('0x76')]||_0x6391('0x77'),'headers':_0x1915ef[_0x6391('0x78')][_0x6391('0x6c')]||{},'body':_0x1915ef[_0x6391('0x78')][_0x6391('0x6a')]||{}};_0x972be9(null,_0x2b263b);});};AGIVertices[_0x6391('0x15')]['googleDialogflow']=function(_0x65d401,_0x32aae5){scripts['googleDialogflow'](this['channel']['uniqueid'],_0x65d401[_0x6391('0x79')],_0x65d401[_0x6391('0x5d')],_0x65d401[_0x6391('0x7a')]||'en')[_0x6391('0x11')](function(_0x246724){_0x32aae5(null,_0x246724);})[_0x6391('0x12')](function(_0x1feb76){_0x32aae5(_0x1feb76);});};AGIVertices[_0x6391('0x15')][_0x6391('0x7b')]=function(_0x41482e,_0x227165){scripts[_0x6391('0x7b')](this[_0x6391('0x37')],_0x41482e)[_0x6391('0x11')](function(_0xaaf687){_0x227165(null,_0xaaf687);})[_0x6391('0x12')](function(_0x5c90fb){_0x227165(_0x5c90fb);});};AGIVertices[_0x6391('0x15')]['ispeechTTS']=function(_0x1cc335,_0x5bbdce){scripts['ispeechTTS'](_0x1cc335[_0x6391('0x79')],_0x1cc335[_0x6391('0x5d')],_0x1cc335[_0x6391('0x7c')]||_0x6391('0x5f'),_0x1cc335['speed'])[_0x6391('0x11')](function(_0x93c5e4){_0x5bbdce(null,_0x93c5e4);})[_0x6391('0x12')](function(_0x25fe4b){_0x5bbdce(_0x25fe4b);});};AGIVertices['prototype'][_0x6391('0x7d')]=function(_0x3f4651,_0x207d01,_0x5a6393){scripts[_0x6391('0x7d')](_0x207d01,_0x3f4651['key'],_0x3f4651[_0x6391('0x7e')]||'en-US',this[_0x6391('0x7f')](_0x3f4651['model'])?_0x3f4651['model']:undefined)['then'](function(_0xcefd63){_0x5a6393(null,_0xcefd63);})[_0x6391('0x12')](function(_0x4df9b6){_0x5a6393(_0x4df9b6);});};AGIVertices[_0x6391('0x15')][_0x6391('0x80')]=function(_0x1f927f,_0x386c84){scripts[_0x6391('0x80')](_0x1f927f[_0x6391('0x81')],_0x1f927f[_0x6391('0x82')],_0x1f927f[_0x6391('0x83')],_0x1f927f[_0x6391('0x84')]||_0x6391('0x85'),_0x1f927f['text'],_0x1f927f[_0x6391('0x86')]||_0x6391('0x5d'))[_0x6391('0x11')](function(_0x571209){_0x386c84(null,_0x571209);})[_0x6391('0x12')](function(_0x362fd0){_0x386c84(_0x362fd0);});};AGIVertices[_0x6391('0x15')][_0x6391('0x87')]=function(_0x4a87fa,_0xe5f080){scripts['awsLex'](this[_0x6391('0x37')][_0x6391('0x38')],_0x4a87fa[_0x6391('0x81')],_0x4a87fa['aws_secret_access_key'],_0x4a87fa[_0x6391('0x88')],_0x4a87fa[_0x6391('0x5d')],_0x4a87fa[_0x6391('0x89')])['then'](function(_0x2c4fb5){_0xe5f080(null,_0x2c4fb5);})[_0x6391('0x12')](function(_0x49387d){_0xe5f080(_0x49387d);});};AGIVertices[_0x6391('0x15')]['googleASR']=function(_0x12f191,_0x41aa72,_0x49fa4d){scripts[_0x6391('0x8a')](_0x41aa72,_0x12f191[_0x6391('0x79')],_0x12f191[_0x6391('0x8b')]||_0x6391('0x5f'))['then'](function(_0x3b6ba7){_0x49fa4d(null,_0x3b6ba7);})['catch'](function(_0x3a0ebe){_0x49fa4d(_0x3a0ebe);});};AGIVertices[_0x6391('0x15')]['tildeASR']=function(_0x50cf49,_0x3bea84,_0x27067a){scripts['tildeASR'](_0x3bea84,_0x50cf49[_0x6391('0x8c')],_0x50cf49[_0x6391('0x8d')],_0x50cf49[_0x6391('0x70')])['then'](function(_0x5e1f1d){_0x27067a(null,_0x5e1f1d);})[_0x6391('0x12')](function(_0x1728db){_0x27067a(_0x1728db);});};AGIVertices['prototype'][_0x6391('0x8e')]=function(_0x4c1039){var _0x4e8591=_[_0x6391('0x8f')](verticesWithRetry,_0x4c1039['agicommand'])?_0x4c1039:_['clone'](_0x4c1039);for(var _0x37f22a in _0x4e8591){if(_0x4e8591[_0x6391('0x90')](_0x37f22a)){if(_0x4e8591[_0x37f22a]&&_[_0x6391('0x91')](_0x4e8591[_0x37f22a])){if(_[_0x6391('0x8f')](recursiveMapAttributes,_0x37f22a)){_0x4e8591[_0x37f22a]=this[_0x6391('0x92')](_0x4e8591[_0x37f22a]);}else{_0x4e8591[_0x37f22a]=this[_0x6391('0x93')](_0x4e8591[_0x37f22a]);}}}}return _0x4e8591;};AGIVertices[_0x6391('0x15')][_0x6391('0x94')]=function(_0x13d936){for(var _0x52cb9e in _0x13d936){if(_0x13d936[_0x6391('0x90')](_0x52cb9e)){if(_[_0x6391('0x95')](_0x13d936[_0x52cb9e])){this[_0x6391('0x94')](_0x13d936[_0x52cb9e]);}else if(_[_0x6391('0x96')](_0x13d936[_0x52cb9e])){for(var _0x4ef0f3=0x0;_0x4ef0f3<_0x13d936[_0x52cb9e]['length'];_0x4ef0f3++){this[_0x6391('0x94')](_0x13d936[_0x52cb9e][_0x4ef0f3]);}}else if(_[_0x6391('0x91')](_0x13d936[_0x52cb9e])){_0x13d936[_0x52cb9e]=this[_0x6391('0x93')](_0x13d936[_0x52cb9e]);}}}};AGIVertices[_0x6391('0x15')]['saveRestApiResult']=function(_0x1a9add,_0x44cd29){for(var _0x173e8b in _0x1a9add){if(_0x1a9add[_0x6391('0x90')](_0x173e8b)){if(_[_0x6391('0x95')](_0x1a9add[_0x173e8b])){if(!_[_0x6391('0x48')](_0x1a9add[_0x173e8b])){this[_0x6391('0x97')](_0x1a9add[_0x173e8b],util['format'](_0x6391('0x98'),_0x44cd29,_0x173e8b));}}else if(_[_0x6391('0x96')](_0x1a9add[_0x173e8b])){for(var _0xc0afcb=0x0;_0xc0afcb<_0x1a9add[_0x173e8b][_0x6391('0x99')];_0xc0afcb++){this['saveRestApiResult'](_0x1a9add[_0x173e8b][_0xc0afcb],util[_0x6391('0x2a')](_0x6391('0x98'),_0x44cd29,_0x173e8b+'['+_0xc0afcb+']'));}}else{if(!_[_0x6391('0x45')](_0x1a9add[_0x173e8b])){this['channel'][_0x6391('0x9a')](util[_0x6391('0x2a')](_0x6391('0x98'),_0x44cd29,_0x173e8b),_0x1a9add[_0x173e8b]);}}}}};AGIVertices[_0x6391('0x15')][_0x6391('0x92')]=function(_0x274598){try{var _0x24beb4=JSON[_0x6391('0x6b')](_0x274598);this['recursiveNodeIndex'](_0x24beb4);return JSON['stringify'](_0x24beb4);}catch(_0xea5c12){return this[_0x6391('0x93')](_0x274598);}};AGIVertices['prototype']['replaceAllVariables']=function(_0x376587){var _0xaf63f5=_0x376587[_0x6391('0x9b')]('{');for(var _0xfbe757=0x1;_0xfbe757<_0xaf63f5[_0x6391('0x99')];_0xfbe757+=0x1){var _0x39dcac=_0xaf63f5[_0xfbe757]['split']('}');if(_0x39dcac['length']>0x1){_0x376587=_0x376587['replaceAll']('{'+_0x39dcac[0x0]+'}',this[_0x6391('0x37')][_0x6391('0x9c')](_0x39dcac[0x0])[_0x6391('0x9d')]||_0x39dcac[0x0]);}}if(_0xaf63f5['length']===0x1){return _0x376587[_0x6391('0x4d')]();}return this[_0x6391('0x93')](_0x376587);};AGIVertices[_0x6391('0x15')][_0x6391('0x9e')]=function(_0x1099b4,_0x34e55b){var _0x9b7c9f=this[_0x6391('0x37')][_0x6391('0x9c')](_0x1099b4);if(_0x9b7c9f[_0x6391('0x9f')]===-0x1){return _0x9b7c9f;}logger['info'](util[_0x6391('0x2a')](_0x6391('0xa0'),_0x34e55b,_0x9b7c9f[_0x6391('0x9d')]));return this[_0x6391('0x37')]['setVariable'](_0x34e55b,_0x9b7c9f[_0x6391('0x9d')]);};AGIVertices['prototype']['isConfigured']=function(_0x15f9b6){return _0x15f9b6&&_0x15f9b6!=='0'&&_0x15f9b6!=='-1'&&_0x15f9b6!=='';};AGIVertices[_0x6391('0x15')][_0x6391('0xa1')]=function(_0x4c30c4){this[_0x6391('0x36')]['sync'](this,_0x4c30c4,'-');_0x4c30c4[_0x6391('0xa2')]=_0x4c30c4['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x6391('0x15')][_0x6391('0xa3')]=function(_0x4a7867){logger[_0x6391('0x2e')](util[_0x6391('0x2a')](_0x6391('0xa4'),_0x4a7867[_0x6391('0x39')]));return this[_0x6391('0x37')][_0x6391('0xa3')]([_0x4a7867[_0x6391('0xa5')],_0x4a7867[_0x6391('0xa6')]]);};AGIVertices['prototype'][_0x6391('0xa7')]=function(_0x31b92c){logger[_0x6391('0x2e')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x31b92c[_0x6391('0x39')]));if(this['isConfigured'](_0x31b92c['timeout'])){logger['info'](util['format'](_0x6391('0xa8'),_0x31b92c[_0x6391('0x68')]));var _0x94a55c=this[_0x6391('0x37')][_0x6391('0xa9')](_0x31b92c['timeout']);if(_0x94a55c[_0x6391('0x9f')]===-0x1){return _0x94a55c;}}return this[_0x6391('0x37')][_0x6391('0xa7')]();};AGIVertices[_0x6391('0x15')][_0x6391('0xaa')]=function(_0x385be2){logger['info'](util['format']('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x385be2['label']));if(!this['isConfigured'](_0x385be2[_0x6391('0x4b')])){return this[_0x6391('0x37')][_0x6391('0x2d')](_0x385be2,_0x6391('0xab'));}_0x385be2[_0x6391('0xac')]=moment();if(this[_0x6391('0x7f')](_0x385be2[_0x6391('0xad')])){_0x385be2[_0x6391('0xac')]=moment()['add'](_0x385be2[_0x6391('0xad')],'minutes');}if(!this[_0x6391('0x7f')](_0x385be2['callback_priority'])){_0x385be2[_0x6391('0xae')]=0x2;}this[_0x6391('0x44')][_0x6391('0x6f')](this,_0x385be2);return this[_0x6391('0x37')][_0x6391('0xaf')](util['format'](_0x6391('0xb0'),_0x385be2[_0x6391('0x4a')],_0x385be2[_0x6391('0x4b')],_0x385be2[_0x6391('0xac')]));};AGIVertices['prototype'][_0x6391('0xb1')]=function(_0x127069){logger[_0x6391('0x2e')](util['format']('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x127069[_0x6391('0x39')]));var _0x519016=this[_0x6391('0x37')]['exec'](_0x127069[_0x6391('0xb2')],_0x127069['options']);if(_0x519016[_0x6391('0x9f')]===-0x1){return _0x519016;}return this[_0x6391('0x37')][_0x6391('0xaf')](util['format']('Executed\x20command\x20%s\x20%s',_0x127069[_0x6391('0xb2')],_0x127069['options']));};AGIVertices[_0x6391('0x15')][_0x6391('0xb3')]=function(_0x334455){logger['info'](util[_0x6391('0x2a')](_0x6391('0xb4'),_0x334455[_0x6391('0x39')]));if(!this[_0x6391('0x7f')](_0x334455[_0x6391('0x5d')])){return this['channel'][_0x6391('0xaf')](_0x6391('0xb5'));}var _0x58ad55='\x22'+_0x334455['text']+'\x22';if(this['isConfigured'](_0x334455[_0x6391('0x78')])){_0x58ad55+=','+_0x334455['options'];}var _0x1e3bc3=this['channel'][_0x6391('0x57')](_0x6391('0xb6'),_0x58ad55);if(_0x1e3bc3['result']===-0x1){return _0x1e3bc3;}return this[_0x6391('0x37')][_0x6391('0xaf')](util[_0x6391('0x2a')]('Executed\x20command\x20MRCPSynth\x20%s',_0x58ad55));};AGIVertices[_0x6391('0x15')][_0x6391('0xb7')]=function(_0xf07681){logger['info'](util[_0x6391('0x2a')](_0x6391('0xb8'),_0xf07681[_0x6391('0x39')]));if(!this['isConfigured'](_0xf07681[_0x6391('0x5d')])){return this['channel'][_0x6391('0xaf')]('no\x20text\x20configured');}var _0x136f47='\x22'+_0xf07681[_0x6391('0x5d')]+'\x22';if(this[_0x6391('0x7f')](_0xf07681[_0x6391('0x78')])){_0x136f47+=','+_0xf07681[_0x6391('0x78')];}var _0x4e4489=this['channel'][_0x6391('0x57')](_0x6391('0xb6'),_0x136f47);if(_0x4e4489[_0x6391('0x9f')]===-0x1){return _0x4e4489;}return this['channel'][_0x6391('0xaf')](util[_0x6391('0x2a')](_0x6391('0xb9'),_0x136f47));};AGIVertices['prototype'][_0x6391('0xba')]=function(_0x3b6fe5){logger[_0x6391('0x2e')](util[_0x6391('0x2a')](_0x6391('0xbb'),_0x3b6fe5['label']));if(!this[_0x6391('0x7f')](_0x3b6fe5['grammar'])){return this['channel'][_0x6391('0xaf')](_0x6391('0xbc'));}var _0x4344fb=_0x3b6fe5['grammar'];if(this[_0x6391('0x7f')](_0x3b6fe5[_0x6391('0x78')])){_0x4344fb+=','+_0x3b6fe5[_0x6391('0x78')];}var _0x49bc7a=this['channel'][_0x6391('0x57')]('MRCPRecog',_0x4344fb);if(_0x49bc7a['result']===-0x1){return _0x49bc7a;}var _0x4986a0=this['getAndSetVariable'](_0x6391('0xbd'),'LUMENVOX_ASR_CONFIDENCE');if(_0x4986a0[_0x6391('0x9f')]===-0x1){return _0x4986a0;}var _0x4a4d34=this[_0x6391('0x9e')](_0x6391('0xbe'),_0x6391('0xbf'));if(_0x4a4d34['result']===-0x1){return _0x4a4d34;}var _0x21890a=this[_0x6391('0x9e')](_0x6391('0xc0'),_0x6391('0xc1'));if(_0x21890a[_0x6391('0x9f')]===-0x1){return _0x21890a;}return this[_0x6391('0x37')][_0x6391('0xaf')](util[_0x6391('0x2a')]('Executed\x20command\x20MRCPRecog\x20%s',_0x4344fb));};AGIVertices[_0x6391('0x15')][_0x6391('0xc2')]=function(_0x100218){logger[_0x6391('0x2e')](util[_0x6391('0x2a')](_0x6391('0xc3'),_0x100218[_0x6391('0x39')]));if(!this[_0x6391('0x7f')](_0x100218[_0x6391('0xc4')])){return this[_0x6391('0x37')][_0x6391('0xaf')](_0x6391('0xbc'));}var _0x33f386=_0x100218['grammar'];if(this['isConfigured'](_0x100218[_0x6391('0x78')])){_0x33f386+=','+_0x100218[_0x6391('0x78')];}var _0x17dcad=this[_0x6391('0x37')][_0x6391('0x57')]('MRCPRecog',_0x33f386);if(_0x17dcad['result']===-0x1){return _0x17dcad;}var _0x4fc311=this[_0x6391('0x9e')](_0x6391('0xbd'),_0x6391('0xc5'));if(_0x4fc311['result']===-0x1){return _0x4fc311;}var _0x53930a=this['getAndSetVariable']('RECOG_INPUT()',_0x6391('0xc6'));if(_0x53930a[_0x6391('0x9f')]===-0x1){return _0x53930a;}var _0x94003d=this['getAndSetVariable'](_0x6391('0xc0'),'SESTEK_ASR_INSTANCE');if(_0x94003d[_0x6391('0x9f')]===-0x1){return _0x94003d;}return this[_0x6391('0x37')][_0x6391('0xaf')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x33f386));};AGIVertices[_0x6391('0x15')][_0x6391('0xc7')]=function(_0x3c6734){logger[_0x6391('0x2e')](util['format'](_0x6391('0xc8'),_0x3c6734['label']));if(!this[_0x6391('0x7f')](_0x3c6734['odbc_id'])){return this[_0x6391('0x37')][_0x6391('0x2d')](_0x3c6734,_0x6391('0xc9'));}var _0x58da80=this[_0x6391('0x18')][_0x6391('0x6f')](this,_0x3c6734[_0x6391('0xca')]);if(!_0x58da80){return this[_0x6391('0x37')]['error'](_0x3c6734,_0x6391('0xcb'));}if(!this[_0x6391('0x7f')](_0x3c6734[_0x6391('0x30')])){return this[_0x6391('0x37')]['error'](_0x3c6734,'no\x20query\x20configured');}var _0x1f4bc0=_0x3c6734['query'][_0x6391('0x59')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x6391('0xaf')](util['format'](_0x6391('0xcc'),_0x1f4bc0));var _0xb75cef=this[_0x6391('0x2c')][_0x6391('0x6f')](this,_0x58da80,_0x1f4bc0);this['createSquareDetailsReport'][_0x6391('0x6f')](this,_0x3c6734,_0x1f4bc0);if(!this[_0x6391('0x7f')](_0x3c6734[_0x6391('0xcd')])){return this[_0x6391('0x37')][_0x6391('0xaf')](_0x6391('0xce'));}var _0x32a775=this[_0x6391('0x9c')]['sync'](this,_0x3c6734[_0x6391('0xcd')]);if(!_0x32a775){return this[_0x6391('0x37')]['error'](_0x3c6734,'no\x20variable\x20found');}var _0x57d1c7=this;_0xb75cef[_0x6391('0xcf')](function(_0x380344,_0x1500bd){Object['keys'](_0x380344)['forEach'](function(_0x2a4a24){_0x57d1c7[_0x6391('0x37')][_0x6391('0x9a')](util['format'](_0x6391('0xd0'),_0x32a775,_0x1500bd,_0x2a4a24),_0x380344[_0x2a4a24]);});});this['channel']['setVariable'](util[_0x6391('0x2a')](_0x6391('0xd1'),_0x32a775),_0xb75cef[_0x6391('0x99')]);return this[_0x6391('0x37')][_0x6391('0xaf')](util[_0x6391('0x2a')](_0x6391('0xd2'),_0x32a775));};AGIVertices[_0x6391('0x15')][_0x6391('0xd3')]=function(_0x21cb97){logger[_0x6391('0xd4')](util[_0x6391('0x2a')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x21cb97[_0x6391('0x39')]));if(!this[_0x6391('0x7f')](_0x21cb97[_0x6391('0xd5')])){return this[_0x6391('0x37')]['error'](_0x21cb97,'no\x20user\x20selected');}var _0x55e2af=this[_0x6391('0x1b')]['sync'](this,_0x21cb97[_0x6391('0xd5')]);if(!_0x55e2af){return this[_0x6391('0x37')][_0x6391('0x2d')](_0x21cb97,_0x6391('0xd6'));}var _0x47378f=this[_0x6391('0x37')][_0x6391('0x57')](_0x6391('0xd7'),[util['format']('SIP/%s',_0x55e2af),_0x21cb97['timeout'],_0x21cb97[_0x6391('0xd8')],_0x21cb97['url']]);if(_0x47378f['result']===-0x1){return _0x47378f;}return this[_0x6391('0x37')][_0x6391('0xaf')](util[_0x6391('0x2a')](_0x6391('0xd9'),_0x6391('0xd7')));};AGIVertices[_0x6391('0x15')][_0x6391('0xda')]=function(_0x1d5374){logger[_0x6391('0x2e')](util[_0x6391('0x2a')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x1d5374[_0x6391('0x39')]));if(!this[_0x6391('0x7f')](_0x1d5374[_0x6391('0x79')])){return this[_0x6391('0x37')]['noop']('no\x20key\x20configured');}if(!this[_0x6391('0x7f')](_0x1d5374['text'])){return this[_0x6391('0x37')]['noop']('no\x20text\x20configured');}this['channel'][_0x6391('0xdb')]=!![];this['createSquareDetailsReport'](_0x1d5374);this[_0x6391('0x43')](_0x1d5374[_0x6391('0x5d')],'in');this['channel'][_0x6391('0xaf')](util['format']('Trying\x20Dialogflow:\x20%s',_0x1d5374[_0x6391('0x5d')]));var _0x143f7e=this[_0x6391('0xdc')]['sync'](this,_0x1d5374);if(_0x143f7e){for(var _0x43f5a8 in _0x143f7e){if(_0x143f7e[_0x6391('0x90')](_0x43f5a8)){this[_0x6391('0x37')]['setVariable'](util[_0x6391('0x2a')](_0x6391('0xdd'),_0x43f5a8[_0x6391('0xde')]()),_0x143f7e[_0x43f5a8]);}}this[_0x6391('0x43')](_0x143f7e[_0x6391('0xdf')],_0x6391('0xe0'));return this[_0x6391('0x37')]['noop'](util[_0x6391('0x2a')](_0x6391('0xe1'),_0x143f7e['speech']));}return this[_0x6391('0x37')][_0x6391('0x2d')](_0x1d5374,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x6391('0x15')]['sesteknda']=function(_0x4f525f){logger[_0x6391('0x2e')](util[_0x6391('0x2a')](_0x6391('0xe2'),_0x4f525f[_0x6391('0x39')]));if(!this[_0x6391('0x7f')](_0x4f525f['ndauth_url'])){return this[_0x6391('0x37')][_0x6391('0xaf')](_0x6391('0xe3'));}if(!this[_0x6391('0x7f')](_0x4f525f[_0x6391('0xe4')])){return this['channel']['noop'](_0x6391('0xe5'));}if(!this[_0x6391('0x7f')](_0x4f525f[_0x6391('0xe6')])){return this[_0x6391('0x37')][_0x6391('0xaf')](_0x6391('0xe7'));}if(!this[_0x6391('0x7f')](_0x4f525f['ndassistant_url'])){return this['channel'][_0x6391('0xaf')]('no\x20text\x20configured');}this['channel'][_0x6391('0xdb')]=!![];this[_0x6391('0x36')](_0x4f525f);this[_0x6391('0x43')](_0x4f525f[_0x6391('0x5d')],'in');this[_0x6391('0x37')][_0x6391('0xaf')](util[_0x6391('0x2a')](_0x6391('0xe8'),_0x4f525f[_0x6391('0x5d')]));var _0x3347f1=this['sestekNDA'][_0x6391('0x6f')](this,_0x4f525f);if(_0x3347f1){for(var _0x95d590 in _0x3347f1){if(_0x3347f1['hasOwnProperty'](_0x95d590)){this[_0x6391('0x37')][_0x6391('0x9a')](util[_0x6391('0x2a')](_0x6391('0xe9'),_0x95d590['toUpperCase']()),_0x3347f1[_0x95d590]);}}this[_0x6391('0x43')](_0x3347f1[_0x6391('0xdf')],_0x6391('0xe0'));if(_0x3347f1[_0x6391('0xea')]){this[_0x6391('0x37')][_0x6391('0xaf')](util[_0x6391('0x2a')](_0x6391('0xeb'),_0x3347f1[_0x6391('0xea')]));var _0x5dd57c=this[_0x6391('0x37')][_0x6391('0xec')](_0x3347f1['audiofile']);try{fs[_0x6391('0xed')](_0x3347f1[_0x6391('0xea')]+_0x6391('0xee'));}catch(_0x1a7a37){logger[_0x6391('0x2d')](_0x1a7a37);}return _0x5dd57c;}else{return this[_0x6391('0x37')][_0x6391('0xaf')](util[_0x6391('0x2a')](_0x6391('0xef'),_0x3347f1[_0x6391('0xdf')]));}}return this[_0x6391('0x37')][_0x6391('0x2d')](_0x4f525f,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x6391('0x15')]['end']=function(_0x519b48){logger[_0x6391('0x2e')](util['format'](_0x6391('0xf0'),_0x519b48[_0x6391('0x39')]));return this[_0x6391('0x37')][_0x6391('0xaf')]('end');};AGIVertices[_0x6391('0x15')][_0x6391('0xf1')]=function(_0x294978){logger[_0x6391('0x2e')](util['format'](_0x6391('0xf2'),_0x294978[_0x6391('0x39')]));var _0x28cfe8='';if(_0x294978['trunk_id']){if(!this[_0x6391('0x7f')](_0x294978[_0x6391('0xf3')])){return this['channel'][_0x6391('0x2d')](_0x294978,'no\x20trunk\x20selected');}else{var _0x1688d8=parseInt(_0x294978[_0x6391('0xf3')],0xa);if(isNaN(_0x1688d8)){_0x28cfe8=_0x294978[_0x6391('0xf3')];}else{_0x28cfe8=this[_0x6391('0x1d')][_0x6391('0x6f')](this,_0x294978[_0x6391('0xf3')]);if(!_0x28cfe8){return this[_0x6391('0x37')][_0x6391('0x2d')](_0x294978,'no\x20trunk\x20found');}}}}else if(_0x294978[_0x6391('0xf4')]){_0x28cfe8=_0x294978[_0x6391('0xf4')];}else{return this[_0x6391('0x37')]['error'](_0x294978,_0x6391('0xf5'));}var _0x5834ff=this['channel'][_0x6391('0x57')]('DIAL',[util['format'](_0x6391('0xf6'),_0x28cfe8,_0x294978[_0x6391('0x4a')]),_0x294978[_0x6391('0x68')],_0x294978['opts'],_0x294978[_0x6391('0x66')]]);if(_0x5834ff[_0x6391('0x9f')]===-0x1){return _0x5834ff;}return this[_0x6391('0x37')][_0x6391('0xaf')](util[_0x6391('0x2a')](_0x6391('0xd9'),_0x6391('0xd7')));};AGIVertices['prototype'][_0x6391('0xf7')]=function(_0x4698a1){logger[_0x6391('0x2e')](util['format'](_0x6391('0xf8'),_0x4698a1[_0x6391('0x39')]));return this[_0x6391('0x37')][_0x6391('0xaf')]('finally');};AGIVertices['prototype'][_0x6391('0xd')]=function(_0x4f9004){logger[_0x6391('0x2e')](util[_0x6391('0x2a')](_0x6391('0xf9'),_0x4f9004[_0x6391('0x39')]));if(_0x4f9004['retry']===0x0){return this['maxRetry'](_0x4f9004);}_0x4f9004[_0x6391('0xa2')]-=0x1;if(!this['isConfigured'](_0x4f9004['file_id'])){return this['channel'][_0x6391('0x2d')](_0x4f9004,_0x6391('0xfa'));}var _0x3b541e=this[_0x6391('0xfb')][_0x6391('0x6f')](this,_0x4f9004['file_id']);if(!_0x3b541e){return this[_0x6391('0x37')]['error'](_0x4f9004,_0x6391('0xfc'));}if(!this[_0x6391('0x7f')](_0x4f9004[_0x6391('0xcd')])){return this[_0x6391('0x37')][_0x6391('0x2d')](_0x6391('0xce'));}var _0x506e36=this[_0x6391('0x37')]['getData'](_0x3b541e,_0x4f9004[_0x6391('0xfd')],_0x4f9004[_0x6391('0xfe')]);var _0x5de585=_0x506e36['result']?_0x506e36[_0x6391('0x9f')][_0x6391('0x4d')]():'';logger[_0x6391('0x2e')](_0x6391('0xff'),JSON[_0x6391('0x72')](_0x506e36));if(_0x506e36['result']===-0x1){this[_0x6391('0x36')][_0x6391('0x6f')](this,_0x4f9004,_0x5de585);return _0x506e36;}else if(_0x506e36[_0x6391('0x9d')]===_0x6391('0x68')){_0x506e36['result']=_0x5de585['length']>=parseInt(_0x4f9004[_0x6391('0x100')])?'x':'i';}else{_0x506e36[_0x6391('0x9f')]=_0x5de585[_0x6391('0x99')]>=parseInt(_0x4f9004['mindigit'])&&_0x5de585[_0x6391('0x99')]<=parseInt(_0x4f9004[_0x6391('0xfe')])?'x':'i';}var _0x5a19a3=this['getVariable'][_0x6391('0x6f')](this,_0x4f9004['variable_id']);if(!_0x5a19a3){return this[_0x6391('0x37')]['error'](_0x4f9004,'no\x20variable\x20found');}this[_0x6391('0x37')][_0x6391('0x9a')](_0x5a19a3,_0x5de585);if(this['isConfigured'](_0x4f9004[_0x6391('0x101')])){var _0x3a1b18=parseInt(_0x4f9004['hiddendigitsnum'],0xa);var _0x250ca4=rs['generate']({'charset':'*','length':_0x3a1b18});var _0x110347=_0x5de585[_0x6391('0x99')];if(_0x110347>0x0){if(_0x110347>_0x3a1b18){this['createSquareDetailsReport']['sync'](this,_0x4f9004,_0x4f9004['hiddendigitspos']===_0x6391('0x102')?_0x250ca4+_0x5de585[_0x6391('0x103')](_0x3a1b18):_0x5de585[_0x6391('0x103')](0x0,_0x110347-_0x3a1b18)+_0x250ca4);}else{this['createSquareDetailsReport'][_0x6391('0x6f')](this,_0x4f9004,rs['generate']({'charset':'*','length':_0x110347}));}}else{this[_0x6391('0x36')]['sync'](this,_0x4f9004,'');}}else{this['createSquareDetailsReport'][_0x6391('0x6f')](this,_0x4f9004,_0x5de585);}return _0x506e36;};AGIVertices[_0x6391('0x15')][_0x6391('0xe')]=function(_0x58c920){logger[_0x6391('0x2e')](util['format'](_0x6391('0x104'),_0x58c920[_0x6391('0x39')]));return this[_0x6391('0xd')](_0x58c920);};AGIVertices['prototype'][_0x6391('0x105')]=function(_0x212bde){logger[_0x6391('0x2e')](util[_0x6391('0x2a')](_0x6391('0x106'),_0x212bde['label']));this[_0x6391('0x36')][_0x6391('0x6f')](this,_0x212bde,_0x212bde[_0x6391('0x107')]);return this[_0x6391('0x37')][_0x6391('0xaf')](util[_0x6391('0x2a')](_0x6391('0x108'),_0x212bde[_0x6391('0x107')]));};AGIVertices[_0x6391('0x15')][_0x6391('0x109')]=function(_0x570964){logger['info'](util['format'](_0x6391('0x10a'),_0x570964['label']));if(!this[_0x6391('0x7f')](_0x570964[_0x6391('0x81')])||!this['isConfigured'](_0x570964[_0x6391('0x82')])){return this[_0x6391('0x37')]['noop'](_0x6391('0x10b'));}if(!this[_0x6391('0x7f')](_0x570964[_0x6391('0x5d')])){return this[_0x6391('0x37')][_0x6391('0xaf')](_0x6391('0xb5'));}this['channel'][_0x6391('0xaf')](util[_0x6391('0x2a')](_0x6391('0x10c'),_0x570964[_0x6391('0x5d')]));var _0x80b3e3=this['awsPolly'][_0x6391('0x6f')](this,_0x570964);if(_0x80b3e3){this[_0x6391('0x37')][_0x6391('0xaf')](util['format']('aws\x20Polly\x20%s\x20file\x20created',_0x80b3e3));var _0x1e7de0=this[_0x6391('0x37')][_0x6391('0xec')](_0x80b3e3);try{fs['unlink'](_0x80b3e3+'.wav');}catch(_0x25f34c){logger['error'](_0x25f34c);}return _0x1e7de0;}return this[_0x6391('0x37')]['error'](_0x570964,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x6391('0x15')]['awslex']=function(_0x33ed6b){logger[_0x6391('0x2e')](util[_0x6391('0x2a')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x33ed6b[_0x6391('0x39')]));if(!this['isConfigured'](_0x33ed6b['aws_access_key_id'])||!this[_0x6391('0x7f')](_0x33ed6b[_0x6391('0x82')])){return this[_0x6391('0x37')][_0x6391('0xaf')](_0x6391('0x10b'));}if(!this[_0x6391('0x7f')](_0x33ed6b[_0x6391('0x89')])){return this['channel']['noop'](_0x6391('0x10d'));}if(!this[_0x6391('0x7f')](_0x33ed6b['text'])){return this[_0x6391('0x37')][_0x6391('0xaf')](_0x6391('0xb5'));}this[_0x6391('0x37')][_0x6391('0xdb')]=!![];this[_0x6391('0x36')](_0x33ed6b);this[_0x6391('0x43')](_0x33ed6b[_0x6391('0x5d')],'in');this[_0x6391('0x37')]['noop'](util['format'](_0x6391('0x10e'),_0x33ed6b[_0x6391('0x5d')]));var _0x4107ef=this[_0x6391('0x87')]['sync'](this,_0x33ed6b);if(_0x4107ef){for(var _0x465ec3 in _0x4107ef){if(_0x4107ef['hasOwnProperty'](_0x465ec3)&&_[_0x6391('0x91')](_0x4107ef[_0x465ec3])){this['channel']['setVariable'](util[_0x6391('0x2a')](_0x6391('0x10f'),_0x465ec3[_0x6391('0xde')]()),_0x4107ef[_0x465ec3]);}}if(_[_0x6391('0x45')](_0x4107ef[_0x6391('0x76')])){return this[_0x6391('0x37')]['noop'](_0x6391('0x110'));}else{this[_0x6391('0x43')](_0x4107ef[_0x6391('0x76')],'out');return this['channel'][_0x6391('0xaf')](util[_0x6391('0x2a')](_0x6391('0x111'),_0x4107ef[_0x6391('0x76')]));}}return this[_0x6391('0x37')][_0x6391('0x2d')](_0x33ed6b,_0x6391('0x112'));};AGIVertices[_0x6391('0x15')][_0x6391('0x113')]=function(_0x33407a){logger[_0x6391('0x2e')](util[_0x6391('0x2a')](_0x6391('0x114'),_0x33407a[_0x6391('0x39')],_0x33407a[_0x6391('0x68')]));if(!this[_0x6391('0x7f')](_0x33407a[_0x6391('0x79')])){return this[_0x6391('0x37')]['noop']('no\x20key\x20configured');}var _0x5ee76a=_0x6391('0x115');var _0xb25cdc=util[_0x6391('0x2a')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x408bd4=util[_0x6391('0x2a')](_0x6391('0x98'),_0xb25cdc,_0x5ee76a);var _0xebf7d8=!![];if(_0x33407a[_0x6391('0x116')]===_0x6391('0x117')){_0xebf7d8=![];}var _0x43de62=this[_0x6391('0x37')][_0x6391('0x118')](_0xb25cdc,_0x5ee76a,_0x33407a[_0x6391('0x119')],_0x33407a[_0x6391('0x68')],undefined,_0xebf7d8);if(_0x43de62[_0x6391('0x9f')]!==-0x1){this[_0x6391('0x37')][_0x6391('0xaf')](util['format'](_0x6391('0x11a'),_0x408bd4));var _0x1e677a=this[_0x6391('0x8a')]['sync'](this,_0x33407a,_0x408bd4);if(_0x1e677a){for(var _0x8c85f7 in _0x1e677a){if(_0x1e677a[_0x6391('0x90')](_0x8c85f7)){this['channel']['setVariable'](util[_0x6391('0x2a')](_0x6391('0x11b'),_0x8c85f7['toUpperCase']()),_0x1e677a[_0x8c85f7]);}}return this[_0x6391('0x37')][_0x6391('0xaf')](util[_0x6391('0x2a')](_0x6391('0x11c'),JSON['stringify'](_0x1e677a)));}}return _0x43de62;};AGIVertices[_0x6391('0x15')][_0x6391('0x11d')]=function(_0x38a965){logger['info'](util[_0x6391('0x2a')](_0x6391('0x11e'),_0x38a965['label']));if(!this[_0x6391('0x7f')](_0x38a965['appid'])){return this[_0x6391('0x37')][_0x6391('0xaf')](_0x6391('0x11f'));}if(!this['isConfigured'](_0x38a965['appsecret'])){return this[_0x6391('0x37')]['noop'](_0x6391('0x120'));}var _0x38dca1=_0x6391('0x115');var _0x5753f3=util[_0x6391('0x2a')](_0x6391('0x121'),FILES_PATH,rs[_0x6391('0x122')](0x4));var _0x5d5488=util[_0x6391('0x2a')]('%s.%s',_0x5753f3,_0x38dca1);var _0x5eb9f0=!![];if(_0x38a965[_0x6391('0x116')]===_0x6391('0x117')){_0x5eb9f0=![];}var _0x5bccf9=this[_0x6391('0x37')][_0x6391('0x118')](_0x5753f3,_0x38dca1,_0x38a965[_0x6391('0x119')],_0x38a965['timeout'],undefined,_0x5eb9f0);if(_0x5bccf9[_0x6391('0x9f')]!==-0x1){this[_0x6391('0x37')][_0x6391('0xaf')](util[_0x6391('0x2a')](_0x6391('0x123'),_0x5d5488));var _0x3a5aea=this[_0x6391('0x124')]['sync'](this,_0x38a965,_0x5d5488);if(_0x3a5aea){for(var _0x816159 in _0x3a5aea){if(_0x3a5aea[_0x6391('0x90')](_0x816159)){this['channel'][_0x6391('0x9a')](util[_0x6391('0x2a')](_0x6391('0x125'),_0x816159[_0x6391('0xde')]()),_0x3a5aea[_0x816159]);}}return this[_0x6391('0x37')][_0x6391('0xaf')](util[_0x6391('0x2a')]('TildeASR\x20Result\x20%s',JSON[_0x6391('0x72')](_0x3a5aea)));}}return _0x5bccf9;};AGIVertices[_0x6391('0x15')][_0x6391('0x126')]=function(_0x153d64){logger['info'](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x153d64['label']));return this['channel'][_0x6391('0x127')](_0x153d64['context'],_0x153d64[_0x6391('0x3e')],_0x153d64[_0x6391('0x3f')]);};AGIVertices[_0x6391('0x15')][_0x6391('0x128')]=function(_0x42d251){logger['info'](util['format'](_0x6391('0x129'),_0x42d251[_0x6391('0x39')]));if(!this[_0x6391('0x7f')](_0x42d251[_0x6391('0x12a')])){return this[_0x6391('0x37')][_0x6391('0x2d')](_0x42d251,_0x6391('0x12b'));}try{var _0x10ec6a=eval(_0x42d251[_0x6391('0x12a')])?_0x6391('0x12c'):_0x6391('0x12d');this[_0x6391('0x37')][_0x6391('0xaf')](util[_0x6391('0x2a')](_0x6391('0x12e'),_0x42d251['condition'],_0x10ec6a));return{'code':0xc8,'result':_0x10ec6a};}catch(_0x2f16c8){return{'code':0xc8,'result':_0x6391('0x12d')};}};AGIVertices[_0x6391('0x15')]['gotoiftime']=function(_0x3f0490){logger['info'](util[_0x6391('0x2a')](_0x6391('0x12f'),_0x3f0490[_0x6391('0x39')]));if(!this[_0x6391('0x7f')](_0x3f0490[_0x6391('0x130')])){return this[_0x6391('0x37')]['error'](_0x3f0490,_0x6391('0x131'));}var _0x4bd747=this['getIntervals'][_0x6391('0x6f')](this,_0x3f0490[_0x6391('0x130')]);if(!_0x4bd747){return this['channel'][_0x6391('0x2d')](_0x3f0490,'no\x20intervals\x20found');}for(var _0x58569b=0x0;_0x58569b<_0x4bd747[_0x6391('0x99')];_0x58569b+=0x1){var _0x4e8c57=this[_0x6391('0x37')][_0x6391('0x9c')](util['format']('IFTIME(%s?true:false)',_0x4bd747[_0x58569b]));if(_0x4e8c57['result']===-0x1){return _0x4e8c57;}logger['info'](util[_0x6391('0x2a')]('IFTIME\x20%s\x20%s',_0x4bd747[_0x58569b],_0x4e8c57[_0x6391('0x9d')]));if(_0x4e8c57[_0x6391('0x9d')]==='true'){logger['info'](util['format'](_0x6391('0x132'),_0x4bd747[_0x58569b],_0x6391('0x12c')));this[_0x6391('0x37')][_0x6391('0xaf')](util['format'](_0x6391('0x132'),_0x4bd747[_0x58569b],_0x6391('0x12c')));return{'code':0xc8,'result':_0x6391('0x12c')};}else{logger[_0x6391('0x2e')](util['format'](_0x6391('0x132'),_0x4bd747[_0x58569b],'false'));this[_0x6391('0x37')][_0x6391('0xaf')](util[_0x6391('0x2a')](_0x6391('0x132'),_0x4bd747[_0x58569b],_0x6391('0x12d')));}}return{'code':0xc8,'result':_0x6391('0x12d')};};AGIVertices[_0x6391('0x15')][_0x6391('0x133')]=function(_0x41e97f){logger['info'](util[_0x6391('0x2a')](_0x6391('0x134'),_0x41e97f['label']));return this[_0x6391('0x37')][_0x6391('0x133')]();};AGIVertices[_0x6391('0x15')][_0x6391('0x135')]=function(_0x2a07b7){logger[_0x6391('0x2e')](util[_0x6391('0x2a')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x2a07b7[_0x6391('0x39')]));if(!this[_0x6391('0x7f')](_0x2a07b7[_0x6391('0x79')])){return this[_0x6391('0x37')][_0x6391('0xaf')](_0x6391('0x136'));}var _0x59f0cd=_0x6391('0x115');var _0x1df1ee=util[_0x6391('0x2a')](_0x6391('0x121'),FILES_PATH,rs[_0x6391('0x122')](0x4));var _0x359297=util['format'](_0x6391('0x98'),_0x1df1ee,_0x59f0cd);var _0x5169bf=!![];if(_0x2a07b7[_0x6391('0x116')]==='NOBEEP'){_0x5169bf=![];}var _0x227fff=this['channel'][_0x6391('0x118')](_0x1df1ee,_0x59f0cd,_0x2a07b7[_0x6391('0x119')],_0x2a07b7['timeout'],undefined,_0x5169bf);if(_0x227fff[_0x6391('0x9f')]!==-0x1){this[_0x6391('0x37')][_0x6391('0xaf')](util[_0x6391('0x2a')](_0x6391('0x137'),_0x359297));var _0x478a0c=this[_0x6391('0x7d')][_0x6391('0x6f')](this,_0x2a07b7,_0x359297);if(_0x478a0c){for(var _0x549866 in _0x478a0c){if(_0x478a0c[_0x6391('0x90')](_0x549866)){this['channel'][_0x6391('0x9a')](util[_0x6391('0x2a')](_0x6391('0x138'),_0x549866['toUpperCase']()),_0x478a0c[_0x549866]);}}return this[_0x6391('0x37')][_0x6391('0xaf')](util[_0x6391('0x2a')](_0x6391('0x139'),JSON['stringify'](_0x478a0c)));}}return _0x227fff;};AGIVertices[_0x6391('0x15')]['ispeechtts']=function(_0x141f92){logger[_0x6391('0x2e')](util[_0x6391('0x2a')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x141f92['label']));if(!this['isConfigured'](_0x141f92[_0x6391('0x79')])){return this[_0x6391('0x37')]['noop'](_0x6391('0x136'));}if(!this[_0x6391('0x7f')](_0x141f92[_0x6391('0x5d')])){return this[_0x6391('0x37')][_0x6391('0xaf')](_0x6391('0xb5'));}this[_0x6391('0x37')][_0x6391('0xaf')](util[_0x6391('0x2a')](_0x6391('0x13a'),_0x141f92['text']));var _0x1ad89c=this[_0x6391('0x13b')][_0x6391('0x6f')](this,_0x141f92);if(_0x1ad89c){this['channel']['noop'](util[_0x6391('0x2a')]('ispeech\x20%s\x20file\x20created',_0x1ad89c));var _0x39e7fb=this[_0x6391('0x37')][_0x6391('0xec')](_0x1ad89c,_0x141f92['intKey']);try{fs[_0x6391('0xed')](_0x1ad89c+_0x6391('0xee'));}catch(_0x4db4aa){logger[_0x6391('0x2d')](_0x4db4aa);}return _0x39e7fb;}return this[_0x6391('0x37')]['error'](_0x141f92,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x6391('0x15')]['login']=function(_0x48c6ec){logger[_0x6391('0x2e')](util[_0x6391('0x2a')](_0x6391('0x13c'),_0x48c6ec['label']));if(!this['isConfigured'](_0x48c6ec[_0x6391('0x13d')])){return this[_0x6391('0x37')][_0x6391('0x2d')](_0x48c6ec,_0x6391('0x13e'));}logger[_0x6391('0x2e')](util[_0x6391('0x2a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x6391('0x3b')],_0x48c6ec[_0x6391('0x13d')]));var _0x27d74c=this['agentLogin'][_0x6391('0x6f')](this,_0x48c6ec[_0x6391('0x13d')]);if(_0x27d74c){logger['info'](util[_0x6391('0x2a')](_0x6391('0x13f'),this[_0x6391('0x37')]['callerid'],_0x48c6ec[_0x6391('0x13d')]));this[_0x6391('0x37')]['noop'](util['format'](_0x6391('0x13f'),this['channel'][_0x6391('0x3b')],_0x48c6ec[_0x6391('0x13d')]));return{'code':0xc8,'result':_0x6391('0x140')};}else{logger[_0x6391('0x2e')](util[_0x6391('0x2a')](_0x6391('0x141'),this['channel'][_0x6391('0x3b')],_0x48c6ec[_0x6391('0x13d')]));this[_0x6391('0x37')][_0x6391('0xaf')](util['format'](_0x6391('0x141'),this[_0x6391('0x37')][_0x6391('0x3b')],_0x48c6ec[_0x6391('0x13d')]));return{'code':0xc8,'result':_0x6391('0x142')};}};AGIVertices[_0x6391('0x15')]['logout']=function(_0x31f311){logger[_0x6391('0x2e')](util[_0x6391('0x2a')](_0x6391('0x143'),_0x31f311['label']));if(!this[_0x6391('0x7f')](_0x31f311[_0x6391('0x13d')])){return this['channel'][_0x6391('0x2d')](_0x31f311,_0x6391('0x13e'));}logger['info'](util['format'](_0x6391('0x144'),this[_0x6391('0x37')][_0x6391('0x3b')],_0x31f311[_0x6391('0x13d')]));var _0x5c1246=this[_0x6391('0x53')][_0x6391('0x6f')](this,_0x31f311['findBy']);if(_0x5c1246){logger[_0x6391('0x2e')](util[_0x6391('0x2a')](_0x6391('0x13f'),this[_0x6391('0x37')]['callerid'],_0x31f311[_0x6391('0x13d')]));this[_0x6391('0x37')]['noop'](util['format'](_0x6391('0x13f'),this['channel'][_0x6391('0x3b')],_0x31f311[_0x6391('0x13d')]));return{'code':0xc8,'result':_0x6391('0x140')};}else{logger[_0x6391('0x2e')](util[_0x6391('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x6391('0x37')][_0x6391('0x3b')],_0x31f311[_0x6391('0x13d')]));this['channel']['noop'](util[_0x6391('0x2a')](_0x6391('0x141'),this['channel'][_0x6391('0x3b')],_0x31f311[_0x6391('0x13d')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x6391('0x145')]=function(_0x327ca9){logger[_0x6391('0x2e')](util[_0x6391('0x2a')](_0x6391('0x146'),_0x327ca9['label']));if(!this[_0x6391('0x7f')](_0x327ca9[_0x6391('0x147')])){return this[_0x6391('0x37')]['error'](_0x327ca9,_0x6391('0x148'));}this[_0x6391('0x37')][_0x6391('0xaf')](util[_0x6391('0x2a')](_0x6391('0x149'),_0x327ca9[_0x6391('0x147')]));var _0x2a74c0=eval(_0x327ca9[_0x6391('0x147')]);if(!this['isConfigured'](_0x327ca9[_0x6391('0xcd')])){return this[_0x6391('0x37')][_0x6391('0xaf')](_0x6391('0xce'));}var _0x1aec1e=this['getVariable'][_0x6391('0x6f')](this,_0x327ca9[_0x6391('0xcd')]);if(!_0x1aec1e){return this[_0x6391('0x37')][_0x6391('0x2d')](_0x327ca9,_0x6391('0x14a'));}if(_[_0x6391('0x96')](_0x2a74c0)){var _0x4d80c4=this;_0x2a74c0[_0x6391('0xcf')](function(_0x5f01a0,_0x5c4b0d){_0x4d80c4[_0x6391('0x37')][_0x6391('0x9a')](util[_0x6391('0x2a')](_0x6391('0x14b'),_0x1aec1e,_0x5c4b0d),_0x5f01a0);});return this[_0x6391('0x37')][_0x6391('0xaf')](util[_0x6391('0x2a')]('variable\x20%s[key]\x20set',_0x1aec1e));}else{return this[_0x6391('0x37')][_0x6391('0x9a')](_0x1aec1e,_0x2a74c0);}};AGIVertices[_0x6391('0x15')][_0x6391('0xc')]=function(_0x13916f){logger['info'](util[_0x6391('0x2a')](_0x6391('0x14c'),_0x13916f[_0x6391('0x39')]));if(_0x13916f[_0x6391('0xa2')]===0x0){return this[_0x6391('0xa1')](_0x13916f);}_0x13916f['retry']-=0x1;if(!this['isConfigured'](_0x13916f[_0x6391('0x14d')])){return this[_0x6391('0x37')][_0x6391('0x2d')](_0x13916f,_0x6391('0xfa'));}var _0x4258d0=this[_0x6391('0xfb')]['sync'](this,_0x13916f[_0x6391('0x14d')]);if(!_0x4258d0){return this[_0x6391('0x37')][_0x6391('0x2d')](_0x13916f,_0x6391('0xfc'));}var _0x2e47b8=this[_0x6391('0x37')]['getData'](_0x4258d0,_0x13916f[_0x6391('0xfd')],_0x13916f[_0x6391('0x14e')]);var _0xeca8e8=_0x2e47b8[_0x6391('0x9f')];if(_0x2e47b8[_0x6391('0x9f')]===-0x1){this[_0x6391('0x36')][_0x6391('0x6f')](this,_0x13916f,'-1');return _0x2e47b8;}else if(_0x2e47b8[_0x6391('0x9d')]==='timeout'){_0x2e47b8[_0x6391('0x9f')]=_0x2e47b8['result'][_0x6391('0x99')]>0x0?_0x2e47b8['result']:'t';}else if(_[_0x6391('0x48')](_0x2e47b8[_0x6391('0x9f')])){_0x2e47b8['result']='#';_0xeca8e8='#';}if(!this[_0x6391('0x7f')](_0x13916f[_0x6391('0xcd')])){this[_0x6391('0x37')][_0x6391('0xaf')](_0x6391('0xce'));}else{var _0x5c1ad4=this[_0x6391('0x9c')][_0x6391('0x6f')](this,_0x13916f[_0x6391('0xcd')]);if(!_0x5c1ad4){return this[_0x6391('0x37')][_0x6391('0x2d')](_0x13916f,_0x6391('0x14a'));}this[_0x6391('0x37')][_0x6391('0x9a')](_0x5c1ad4,_0xeca8e8);}this[_0x6391('0x36')]['sync'](this,_0x13916f,_0xeca8e8);return _0x2e47b8;};AGIVertices[_0x6391('0x15')][_0x6391('0xaf')]=function(_0x3b9e28){logger[_0x6391('0x2e')](util[_0x6391('0x2a')](_0x6391('0x14f'),_0x3b9e28[_0x6391('0x39')]));return this[_0x6391('0x37')]['noop'](_0x3b9e28[_0x6391('0x150')]||_0x3b9e28[_0x6391('0x39')]);};AGIVertices[_0x6391('0x15')][_0x6391('0x151')]=function(_0xf45cad){logger['info'](util[_0x6391('0x2a')](_0x6391('0x152'),_0xf45cad[_0x6391('0x39')]));if(!this[_0x6391('0x7f')](_0xf45cad[_0x6391('0x13d')])){return this['channel'][_0x6391('0x2d')](_0xf45cad,_0x6391('0x13e'));}logger['info'](util['format'](_0x6391('0x144'),this[_0x6391('0x37')]['callerid'],_0xf45cad['findBy']));var _0x1d7aef=this[_0x6391('0x4e')]['sync'](this,_0xf45cad[_0x6391('0x153')]);var _0x43a146=this['agentPause'][_0x6391('0x6f')](this,_0xf45cad['findBy'],_0x1d7aef);if(_0x43a146){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x6391('0x3b')],_0xf45cad[_0x6391('0x13d')]));this['channel'][_0x6391('0xaf')](util['format'](_0x6391('0x13f'),this[_0x6391('0x37')][_0x6391('0x3b')],_0xf45cad[_0x6391('0x13d')]));return{'code':0xc8,'result':'success'};}else{logger[_0x6391('0x2e')](util[_0x6391('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x6391('0x3b')],_0xf45cad['findBy']));this[_0x6391('0x37')][_0x6391('0xaf')](util['format'](_0x6391('0x13f'),this[_0x6391('0x37')]['callerid'],_0xf45cad['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x6391('0x154')]=function(_0x1d9975){logger['info'](util[_0x6391('0x2a')](_0x6391('0x155'),_0x1d9975[_0x6391('0x39')]));if(!this[_0x6391('0x7f')](_0x1d9975['file_id'])){return this[_0x6391('0x37')][_0x6391('0x2d')](_0x1d9975,_0x6391('0xfa'));}var _0x4c209e=this[_0x6391('0xfb')][_0x6391('0x6f')](this,_0x1d9975[_0x6391('0x14d')]);if(!_0x4c209e){return this[_0x6391('0x37')][_0x6391('0x2d')](_0x1d9975,_0x6391('0xfc'));}var _0x8272bf=this[_0x6391('0x37')]['exec'](_0x6391('0x156'),[_0x4c209e,_0x1d9975[_0x6391('0xd8')]]);if(_0x8272bf[_0x6391('0x9f')]===-0x1){return _0x8272bf;}return this['channel'][_0x6391('0xaf')](util[_0x6391('0x2a')](_0x6391('0x157'),_0x6391('0x156'),_0x4c209e));};AGIVertices[_0x6391('0x15')]['queue']=function(_0x1e9d78){logger[_0x6391('0x2e')](util[_0x6391('0x2a')](_0x6391('0x158'),_0x1e9d78[_0x6391('0x39')]));if(!this[_0x6391('0x7f')](_0x1e9d78[_0x6391('0x159')])){return this[_0x6391('0x37')]['error'](_0x1e9d78,_0x6391('0x15a'));}var _0xee78f1='';var _0x4eea5b=parseInt(_0x1e9d78[_0x6391('0x159')],0xa);if(isNaN(_0x4eea5b)){_0xee78f1=_0x1e9d78[_0x6391('0x159')];}else{_0xee78f1=this[_0x6391('0x13')][_0x6391('0x6f')](this,_0x1e9d78['queue_id']);if(!_0xee78f1){return this[_0x6391('0x37')][_0x6391('0x2d')](_0x1e9d78,'no\x20queue\x20found');}}var _0x48494a='';if(this[_0x6391('0x7f')](_0x1e9d78[_0x6391('0x14d')])){var _0x4fae6b=this['getSound'][_0x6391('0x6f')](this,_0x1e9d78['file_id']);if(_0x4fae6b){_0x48494a=_0x4fae6b;}}this[_0x6391('0x36')]['sync'](this,_0x1e9d78,_0xee78f1);if(_0x1e9d78['opts'][_0x6391('0x15b')]('x')<0x0){_0x1e9d78[_0x6391('0xd8')]+='x';}if(_0x1e9d78['opts'][_0x6391('0x15b')]('X')<0x0){_0x1e9d78['opts']+='X';}this['channel'][_0x6391('0x9a')](_0x6391('0x15c'),_0xee78f1?_0xee78f1['toLowerCase']():'');var _0x2e6816=this[_0x6391('0x37')]['exec'](_0x6391('0x15d'),[_0xee78f1,_0x1e9d78['opts'],_0x1e9d78['url'],_0x48494a,_0x1e9d78[_0x6391('0x68')],_0x1e9d78[_0x6391('0xa3')],_0x1e9d78[_0x6391('0x15e')],_0x1e9d78[_0x6391('0x15f')],'',_0x1e9d78[_0x6391('0x160')]]);if(_0x2e6816['result']===-0x1){return _0x2e6816;}return this[_0x6391('0x37')][_0x6391('0xaf')](util['format']('Executed\x20command\x20%s\x20%s',_0x6391('0x15d'),_0xee78f1));};AGIVertices[_0x6391('0x15')][_0x6391('0x161')]=function(_0x5bfc8c){logger['info'](util['format'](_0x6391('0x162'),_0x5bfc8c[_0x6391('0x39')]));var _0xe30cf1=_0x5bfc8c[_0x6391('0x163')]||_0x6391('0x115');var _0x3fd324=util[_0x6391('0x2a')](_0x6391('0x164'),this[_0x6391('0x37')][_0x6391('0x38')],rs[_0x6391('0x122')](0x5));var _0x4a512e=util[_0x6391('0x2a')](_0x6391('0x165'),FILES_PATH,_0x3fd324,_0xe30cf1);var _0x232462=util['format'](_0x6391('0x121'),FILES_PATH,_0x3fd324);this[_0x6391('0x3c')][_0x6391('0x6f')](this,_0x5bfc8c,_0x3fd324,_0x4a512e);this[_0x6391('0x37')]['setVariable'](_0x6391('0x166'),_0x3fd324);logger[_0x6391('0x2e')](_0x6391('0x167'),_0x232462,_0xe30cf1,_0x5bfc8c[_0x6391('0x168')],_0x5bfc8c[_0x6391('0x68')]);return this[_0x6391('0x37')][_0x6391('0x118')](_0x232462,_0xe30cf1,_0x5bfc8c[_0x6391('0x168')],_0x5bfc8c[_0x6391('0x68')],undefined,!![]);};AGIVertices[_0x6391('0x15')][_0x6391('0x169')]=function(_0x4ca4b1){logger[_0x6391('0x2e')](util[_0x6391('0x2a')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x4ca4b1[_0x6391('0x39')]));if(!this[_0x6391('0x7f')](_0x4ca4b1[_0x6391('0x66')])){return this[_0x6391('0x37')]['noop']('no\x20url\x20configured');}var _0x4de781=this[_0x6391('0x65')][_0x6391('0x6f')](this,_0x4ca4b1);logger[_0x6391('0x2e')](util[_0x6391('0x2a')](_0x6391('0x16a'),util['inspect'](_0x4de781,{'showHidden':![],'depth':null})));if(!this[_0x6391('0x7f')](_0x4ca4b1[_0x6391('0xcd')])){return this[_0x6391('0x37')][_0x6391('0xaf')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x4230bb=this[_0x6391('0x9c')][_0x6391('0x6f')](this,_0x4ca4b1[_0x6391('0xcd')]);if(!_0x4230bb){return this[_0x6391('0x37')]['error'](_0x4ca4b1,_0x6391('0x14a'));}this['channel'][_0x6391('0x9a')](util[_0x6391('0x2a')](_0x6391('0x16b'),_0x4230bb),_0x4de781[_0x6391('0x74')]?_0x4de781['statusCode']:_0x6391('0x16c'));this['channel'][_0x6391('0x9a')](util['format'](_0x6391('0x16d'),_0x4230bb),_0x4de781[_0x6391('0x75')]?_0x4de781[_0x6391('0x75')]:'OK');if(_0x4de781[_0x6391('0x6a')]){try{this[_0x6391('0x97')](_0x4de781[_0x6391('0x6a')],_0x4230bb);}catch(_0x349d1b){logger[_0x6391('0x2d')](util[_0x6391('0x2a')](_0x6391('0x16e'),_0x4230bb));}}return this['channel'][_0x6391('0xaf')](util[_0x6391('0x2a')](_0x6391('0xd2'),_0x4230bb));};AGIVertices[_0x6391('0x15')][_0x6391('0x16f')]=function(_0x1c7bff){logger['info'](util[_0x6391('0x2a')](_0x6391('0x170'),_0x1c7bff[_0x6391('0x39')]));return this[_0x6391('0x37')][_0x6391('0x171')](_0x1c7bff[_0x6391('0x172')][_0x6391('0x59')](/\s+/g,''),_0x1c7bff['escape_digits']);};AGIVertices[_0x6391('0x15')][_0x6391('0x173')]=function(_0x2870c4){logger[_0x6391('0x2e')](util[_0x6391('0x2a')](_0x6391('0x174'),_0x2870c4[_0x6391('0x39')]));return this[_0x6391('0x37')][_0x6391('0x175')](_0x2870c4[_0x6391('0x69')][_0x6391('0x59')](/\s+/g,''),_0x2870c4[_0x6391('0x168')]);};AGIVertices[_0x6391('0x15')][_0x6391('0x176')]=function(_0xf5b494){logger[_0x6391('0x2e')](util['format'](_0x6391('0x177'),_0xf5b494[_0x6391('0x39')]));return this['channel'][_0x6391('0x178')](_0xf5b494[_0x6391('0x5d')],_0xf5b494[_0x6391('0x168')]);};AGIVertices[_0x6391('0x15')][_0x6391('0x179')]=function(_0x1828dd){logger[_0x6391('0x2e')](util[_0x6391('0x2a')](_0x6391('0x17a'),_0x1828dd[_0x6391('0x39')]));if(!this[_0x6391('0x7f')](_0x1828dd[_0x6391('0x17b')])){return this[_0x6391('0x37')][_0x6391('0xaf')](_0x6391('0x17c'));}var _0x380cba=this[_0x6391('0x21')]['sync'](this,_0x1828dd[_0x6391('0x17b')]);if(!_0x380cba||!_0x380cba[_0x6391('0x17d')]){return this[_0x6391('0x37')][_0x6391('0x2d')](_0x1828dd,_0x6391('0x17e'));}var _0x353dec={'from':util[_0x6391('0x2a')]('\x22%s\x22\x20<%s>',_0x380cba[_0x6391('0x14')],_0x380cba[_0x6391('0x17f')]||_0x380cba[_0x6391('0x17d')][_0x6391('0x180')]),'to':_0x1828dd['to']||'','cc':_0x1828dd['cc']||'','bcc':_0x1828dd[_0x6391('0x181')]||'','subject':_0x1828dd[_0x6391('0x182')],'html':_0x1828dd['text'],'text':_0x1828dd[_0x6391('0x5d')]};var _0x44a17b={'tls':{'rejectUnauthorized':![]}};if(_0x380cba[_0x6391('0x17d')][_0x6391('0x183')]){_0x44a17b[_0x6391('0x183')]=_0x380cba[_0x6391('0x17d')]['service'];}else{_0x44a17b[_0x6391('0x184')]=_0x380cba[_0x6391('0x17d')]['host'];_0x44a17b[_0x6391('0x185')]=_0x380cba[_0x6391('0x17d')][_0x6391('0x185')];_0x44a17b[_0x6391('0x186')]=_0x380cba[_0x6391('0x17d')][_0x6391('0x186')];}if(_0x380cba[_0x6391('0x17d')][_0x6391('0x187')]){_0x44a17b[_0x6391('0x188')]={'user':_0x380cba[_0x6391('0x17d')][_0x6391('0x180')],'pass':_0x380cba[_0x6391('0x17d')][_0x6391('0x189')]};}if(this[_0x6391('0x7f')](_0x1828dd[_0x6391('0x18a')])){}logger[_0x6391('0xd4')]('sendMail\x20message',JSON[_0x6391('0x72')](_0x353dec));this['createSquareDetailsReport'][_0x6391('0x6f')](this,_0x1828dd,_0x1828dd['account_id']);this[_0x6391('0x37')][_0x6391('0xaf')](util[_0x6391('0x2a')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x380cba[_0x6391('0x14')]));this['sendMailMessage'][_0x6391('0x6f')](this,_0x44a17b,_0x353dec);return this['channel'][_0x6391('0xaf')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x6391('0x15')][_0x6391('0x18b')]=function(_0x106f16){logger[_0x6391('0x2e')](util[_0x6391('0x2a')](_0x6391('0x18c'),_0x106f16[_0x6391('0x39')]));return this[_0x6391('0x37')]['noop'](_0x6391('0x18d'));};AGIVertices[_0x6391('0x15')][_0x6391('0x18e')]=function(_0x194c83){logger[_0x6391('0x2e')](util['format'](_0x6391('0x18f'),_0x194c83[_0x6391('0x39')]));if(!this[_0x6391('0x7f')](_0x194c83[_0x6391('0x190')])){return this[_0x6391('0x37')][_0x6391('0xaf')](_0x6391('0x191'));}var _0x3dab8a=this[_0x6391('0x33')][_0x6391('0x6f')](this,_0x194c83[_0x6391('0x190')]);if(!_0x3dab8a){return this['channel'][_0x6391('0x2d')](_0x194c83,_0x6391('0x192'));}var _0x47f5a3={'body':_0x194c83[_0x6391('0x193')],'phone':_0x194c83['to']||'','SmsAccountId':_0x3dab8a['id']};logger[_0x6391('0xd4')](_0x6391('0x194'),JSON[_0x6391('0x72')](_0x47f5a3));this['createSquareDetailsReport'][_0x6391('0x6f')](this,_0x194c83,_0x194c83[_0x6391('0x190')]);this['channel'][_0x6391('0xaf')](util[_0x6391('0x2a')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x3dab8a[_0x6391('0x14')]));this[_0x6391('0x35')][_0x6391('0x6f')](this,_0x47f5a3);return this[_0x6391('0x37')][_0x6391('0xaf')](_0x6391('0x195'));};AGIVertices['prototype'][_0x6391('0x196')]=function(_0x51e27d){logger[_0x6391('0x2e')](util['format']('Enter\x20in\x20SET\x20(%s)\x20block',_0x51e27d['label']));if(!this['isConfigured'](_0x51e27d[_0x6391('0xcd')])){return this['channel'][_0x6391('0x2d')](_0x51e27d,'no\x20variable\x20selected');}var _0x2ff3f3=this['getVariable']['sync'](this,_0x51e27d['variable_id']);if(!_0x2ff3f3){return this['channel'][_0x6391('0x2d')](_0x51e27d,_0x6391('0x14a'));}return this[_0x6391('0x37')][_0x6391('0x9a')](_0x2ff3f3,_0x51e27d['variable_value']);};AGIVertices[_0x6391('0x15')][_0x6391('0x197')]=function(_0x2ef295){logger['info'](util[_0x6391('0x2a')]('Enter\x20in\x20START\x20(%s)\x20block',_0x2ef295[_0x6391('0x39')]));this[_0x6391('0x37')][_0x6391('0xaf')](_0x6391('0x198'));if(_0x2ef295[_0x6391('0xa7')]===_0x6391('0x199')){this['channel']['noop'](_0x6391('0x19a'));return this['channel'][_0x6391('0xa7')]();}return this[_0x6391('0x37')][_0x6391('0xaf')](_0x6391('0x19b'));};AGIVertices['prototype'][_0x6391('0x19c')]=function(_0x2297ca){logger[_0x6391('0x2e')](util['format']('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x2297ca['label']));if(!this[_0x6391('0x7f')](_0x2297ca['project_id'])){return this['channel'][_0x6391('0x2d')](_0x2297ca,_0x6391('0x19d'));}var _0x461910=this[_0x6391('0x16')][_0x6391('0x6f')](this,_0x2297ca['project_id']);if(!this['isConfigured'](_0x461910)){return this[_0x6391('0x37')][_0x6391('0x2d')](_0x2297ca,util[_0x6391('0x2a')](_0x6391('0x19e'),_0x2297ca[_0x6391('0x19f')]));}if(_0x461910===this[_0x6391('0x37')][_0x6391('0x41')]){return this['channel'][_0x6391('0x2d')](_0x2297ca,_0x6391('0x1a0'));}this[_0x6391('0x36')]['sync'](this,_0x2297ca,_0x461910);var _0x198a9c=this['channel'][_0x6391('0x57')](_0x6391('0x1a1'),util[_0x6391('0x2a')](_0x6391('0x1a2'),config[_0x6391('0xa3')][_0x6391('0x184')]||_0x6391('0x1a3'),_0x461910,this[_0x6391('0x37')][_0x6391('0x41')]));if(_0x198a9c['result']===-0x1){return _0x198a9c;}return this[_0x6391('0x37')][_0x6391('0xaf')](util['format'](_0x6391('0x157'),_0x6391('0x1a1'),_0x461910));};AGIVertices[_0x6391('0x15')][_0x6391('0x1a4')]=function(_0x29cd91){logger['info'](util[_0x6391('0x2a')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x29cd91[_0x6391('0x39')]));var _0x337b44=this[_0x6391('0x56')][_0x6391('0x6f')](this,_0x29cd91[_0x6391('0xa5')]);this[_0x6391('0x36')]['sync'](this,_0x29cd91,_0x29cd91[_0x6391('0xa5')]);if(this[_0x6391('0x7f')](_0x29cd91[_0x6391('0xcd')])){var _0x1e8807=this['getVariable'][_0x6391('0x6f')](this,_0x29cd91[_0x6391('0xcd')]);if(_0x1e8807){this[_0x6391('0x37')]['setVariable'](_0x1e8807,_0x337b44);return this[_0x6391('0x37')][_0x6391('0xaf')](util['format'](_0x6391('0x1a5'),_0x29cd91[_0x6391('0xa5')],_0x1e8807));}}return this['channel']['noop'](util[_0x6391('0x2a')](_0x6391('0x1a6'),_0x29cd91[_0x6391('0xa5')]));};AGIVertices[_0x6391('0x15')]['google_cloud_tts']=function(_0xd5d35a){logger['info'](util['format'](_0x6391('0x1a7'),_0xd5d35a[_0x6391('0x39')]));if(!this[_0x6391('0x7f')](_0xd5d35a[_0x6391('0x5b')])){return this[_0x6391('0x37')][_0x6391('0xaf')](_0x6391('0x1a8'));}if(!this[_0x6391('0x7f')](_0xd5d35a[_0x6391('0x5d')])){return this['channel'][_0x6391('0xaf')](_0x6391('0xb5'));}this[_0x6391('0x37')]['noop'](util['format'](_0x6391('0x1a9'),_0xd5d35a[_0x6391('0x5d')]));var _0x15b272=this['googleCloudTTS'][_0x6391('0x6f')](this,_0xd5d35a);if(_0x15b272){this['channel']['noop'](util[_0x6391('0x2a')](_0x6391('0x1aa'),_0x15b272));var _0x19e2ad=this['channel'][_0x6391('0xec')](_0x15b272);try{fs[_0x6391('0xed')](_0x15b272+_0x6391('0xee'));}catch(_0x3a12ee){logger[_0x6391('0x2d')](_0x3a12ee);}return _0x19e2ad;}return this[_0x6391('0x37')][_0x6391('0x2d')](_0xd5d35a,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x6391('0x15')]['tts']=function(_0x2a3265){logger[_0x6391('0x2e')](util[_0x6391('0x2a')](_0x6391('0x1ab'),_0x2a3265[_0x6391('0x39')]));if(!this[_0x6391('0x7f')](_0x2a3265['text'])){return this['channel'][_0x6391('0xaf')](_0x6391('0xb5'));}this[_0x6391('0x37')][_0x6391('0xaf')](util[_0x6391('0x2a')]('Trying\x20Google\x20TTS\x20%s',_0x2a3265['text']));var _0x563f5c=this['googleTTS']['sync'](this,_0x2a3265);if(_0x563f5c){this[_0x6391('0x37')][_0x6391('0xaf')](util[_0x6391('0x2a')](_0x6391('0x1ac'),_0x563f5c));var _0x5815d0=this[_0x6391('0x37')][_0x6391('0xec')](_0x563f5c);try{fs[_0x6391('0xed')](_0x563f5c+_0x6391('0xee'));}catch(_0x4239ad){logger[_0x6391('0x2d')](_0x4239ad);}return _0x5815d0;}return this[_0x6391('0x37')][_0x6391('0x2d')](_0x2a3265,_0x6391('0x1ad'));};AGIVertices[_0x6391('0x15')][_0x6391('0x1ae')]=function(_0x57f2e1){logger['info'](util['format'](_0x6391('0x1af'),_0x57f2e1[_0x6391('0x39')]));if(!this[_0x6391('0x7f')](_0x57f2e1[_0x6391('0x13d')])){return this[_0x6391('0x37')]['error'](_0x57f2e1,_0x6391('0x13e'));}logger[_0x6391('0x2e')](util['format'](_0x6391('0x144'),this[_0x6391('0x37')][_0x6391('0x3b')],_0x57f2e1['findBy']));var _0x2a17f7=this[_0x6391('0x52')]['sync'](this,_0x57f2e1[_0x6391('0x13d')]);if(_0x2a17f7){logger[_0x6391('0x2e')](util[_0x6391('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x6391('0x3b')],_0x57f2e1[_0x6391('0x13d')]));this[_0x6391('0x37')][_0x6391('0xaf')](util[_0x6391('0x2a')](_0x6391('0x13f'),this[_0x6391('0x37')][_0x6391('0x3b')],_0x57f2e1['findBy']));return{'code':0xc8,'result':_0x6391('0x140')};}else{logger[_0x6391('0x2e')](util['format'](_0x6391('0x141'),this[_0x6391('0x37')][_0x6391('0x3b')],_0x57f2e1[_0x6391('0x13d')]));this[_0x6391('0x37')][_0x6391('0xaf')](util['format'](_0x6391('0x141'),this[_0x6391('0x37')]['callerid'],_0x57f2e1[_0x6391('0x13d')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x6391('0x15')]['voicemail']=function(_0xc3f6dc){logger['info'](util[_0x6391('0x2a')](_0x6391('0x1b0'),_0xc3f6dc[_0x6391('0x39')]));var _0x2bffc5=this[_0x6391('0x37')][_0x6391('0x57')](_0x6391('0x1b1'),[_0xc3f6dc['mailbox'],_0xc3f6dc[_0x6391('0x78')]]);if(_0x2bffc5[_0x6391('0x9f')]===-0x1){return _0x2bffc5;}return this[_0x6391('0x37')][_0x6391('0xaf')](util[_0x6391('0x2a')]('Executed\x20command\x20%s\x20%s',_0x6391('0x1b1'),_0xc3f6dc['mailbox']));};AGIVertices['prototype']['vswitch']=function(_0x38197c){logger['info'](util[_0x6391('0x2a')](_0x6391('0x1b2'),_0x38197c[_0x6391('0x39')]));if(!this[_0x6391('0x7f')](_0x38197c[_0x6391('0xcd')])){return this[_0x6391('0x37')][_0x6391('0x2d')](_0x38197c,_0x6391('0x1b3'));}var _0x2dda5d=this['getVariable']['sync'](this,_0x38197c[_0x6391('0xcd')]);if(!_0x2dda5d){return this[_0x6391('0x37')][_0x6391('0x2d')](_0x38197c,_0x6391('0x14a'));}var _0x2b9685=this[_0x6391('0x37')][_0x6391('0x9c')](_0x2dda5d);return{'code':0xc8,'result':_0x2b9685['extra']?_0x2b9685[_0x6391('0x9d')]:'-'};};String[_0x6391('0x15')]['replaceAll']=function(_0x14d6f5,_0xc0aa0d){return this[_0x6391('0x9b')](_0x14d6f5)[_0x6391('0x1b4')](_0xc0aa0d);};module['exports']=AGIVertices; \ No newline at end of file +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 diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 43a1d05..6a2eee5 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 _0x99e9=['transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','seconds','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','getAgent','then','voicePause','destlinkedid','savePause','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','timer','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','[ACW][START]\x20%s','prototype','[TIMER][STOP][AGENT:%s]','saveUnpause','update','[%s][UPDATE][ACWTIME:%s]','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','acw','[ACW][syncAgentConnect]\x20%s','isUndefined','attended','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','startAcw','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]'];(function(_0x2235c0,_0x3a7b04){var _0x159770=function(_0x521e0b){while(--_0x521e0b){_0x2235c0['push'](_0x2235c0['shift']());}};_0x159770(++_0x3a7b04);}(_0x99e9,0xb4));var _0x999e=function(_0xc1263e,_0x56d738){_0xc1263e=_0xc1263e-0x0;var _0x471f07=_0x99e9[_0xc1263e];return _0x471f07;};'use strict';var util=require('util');var _=require(_0x999e('0x0'));var moment=require(_0x999e('0x1'));var ami=require(_0x999e('0x2'));var logger=require(_0x999e('0x3'))('acw');var RpcUser=require(_0x999e('0x4'));var RpcVoiceAgentReport=require(_0x999e('0x5'));function Acw(_0x3aac27){this['voiceQueues']=_0x3aac27[_0x999e('0x6')];this['agents']=_0x3aac27[_0x999e('0x7')];this[_0x999e('0x8')]=_0x3aac27[_0x999e('0x8')];this[_0x999e('0x9')]={};ami['on']('agentconnect',this[_0x999e('0xa')][_0x999e('0xb')](this));ami['on'](_0x999e('0xc'),this[_0x999e('0xd')][_0x999e('0xb')](this));ami['on'](_0x999e('0xe'),this[_0x999e('0xf')][_0x999e('0xb')](this));ami['on'](_0x999e('0x10'),this[_0x999e('0x11')][_0x999e('0xb')](this));ami['on'](_0x999e('0x12'),this[_0x999e('0x13')][_0x999e('0xb')](this));ami['on'](_0x999e('0x14'),this[_0x999e('0x15')][_0x999e('0xb')](this));ami['on']('custom:agentConnectPreview',this[_0x999e('0x16')]['bind'](this));}function getDiff(_0x3e6f5a){var _0x387924=moment()[_0x999e('0x17')](0x0);var _0x538a92=moment(_0x3e6f5a)[_0x999e('0x17')](0x0);return _0x387924['diff'](_0x538a92,_0x999e('0x18'));}Acw['prototype']['startAcw']=function(_0x1eee64){try{var _0x22feac=this;var _0x2dd5f4=this[_0x999e('0x9')][_0x1eee64][_0x999e('0x19')];var _0x39ce36=this['channels'][_0x1eee64]['queue'];var _0x4fcdfb=this[_0x999e('0x6')][_0x39ce36];var _0x43b09e=![];var _0xc4ef74=_0x999e('0x1a');if(_0x4fcdfb[_0x999e('0x1b')]){if(_0x4fcdfb[_0x999e('0x1c')]['name']){_0x43b09e=!![];_0xc4ef74=_0x4fcdfb['mandatoryDispositionPause'][_0x999e('0x1d')];}}ami[_0x999e('0x1e')]({'action':_0x999e('0x1f'),'interface':_0x2dd5f4,'paused':!![],'reason':_0xc4ef74})['then'](function(_0x351dd7){if(_0x22feac[_0x999e('0x7')][_0x2dd5f4]){return RpcUser[_0x999e('0x20')](_0x22feac[_0x999e('0x7')][_0x2dd5f4]['id'])[_0x999e('0x21')](function(_0x3750a0){if(_0x3750a0&&!_0x3750a0[_0x999e('0x22')]){logger['info']('[%s][START][AGENT:%s][QUEUE:%s]',_0x1eee64,_0x2dd5f4,_0x39ce36);var _0x11a6bf=_0x22feac[_0x999e('0x9')][_0x1eee64]['attended']&&_0x22feac[_0x999e('0x9')][_0x1eee64][_0x999e('0x23')]?_0x22feac[_0x999e('0x9')][_0x1eee64][_0x999e('0x23')]:_0x1eee64;return RpcUser[_0x999e('0x24')](_0x22feac[_0x999e('0x7')][_0x2dd5f4],_0xc4ef74,_0x11a6bf)['then'](function(_0x2e1cc5){if(!_0x43b09e){_0x22feac[_0x999e('0x8')][_0x2dd5f4]={};logger[_0x999e('0x25')](_0x999e('0x26'),_0x1eee64,_0x22feac[_0x999e('0x6')][_0x39ce36][_0x999e('0x27')],_0x2dd5f4,_0x39ce36);_0x22feac[_0x999e('0x8')][_0x2dd5f4]['timer']=setTimeout(_0x22feac[_0x999e('0x28')]['bind'](_0x22feac,_0x2dd5f4),_0x22feac['voiceQueues'][_0x39ce36][_0x999e('0x27')]*0x3e8);_0x22feac[_0x999e('0x8')][_0x2dd5f4][_0x999e('0x29')]=moment()['format'](_0x999e('0x2a'));_0x22feac[_0x999e('0x8')][_0x2dd5f4][_0x999e('0x2b')]=_0x1eee64;_0x22feac[_0x999e('0x8')][_0x2dd5f4][_0x999e('0x2c')]=_0x39ce36;_0x22feac[_0x999e('0x8')][_0x2dd5f4][_0x999e('0x2d')]=function(){var _0x2e9b0e=getDiff(_0x22feac[_0x999e('0x8')][_0x2dd5f4][_0x999e('0x29')]);clearTimeout(_0x22feac['timers'][_0x2dd5f4][_0x999e('0x2e')]);_0x22feac[_0x999e('0x8')][_0x2dd5f4][_0x999e('0x2e')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x2e9b0e},_0x22feac[_0x999e('0x8')][_0x2dd5f4]['uniqueid'],_0x2dd5f4)['then'](function(_0x28a228){logger[_0x999e('0x25')]('[%s][UPDATE][ACWTIME:%s]',_0x1eee64,_0x2e9b0e,_0x28a228);})['catch'](function(_0x5def61){logger[_0x999e('0x2f')](_0x999e('0x30'),_0x1eee64,_0x5def61);});delete _0x22feac[_0x999e('0x8')][_0x2dd5f4];};}});}else{logger['info'](_0x999e('0x31'),_0x1eee64,_0x2dd5f4,_0x39ce36);}});}})[_0x999e('0x32')](function(_0x37f662){logger[_0x999e('0x2f')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x1eee64,_0x22feac['voiceQueues'][_0x39ce36][_0x999e('0x27')],_0x2dd5f4,_0x39ce36);})['finally'](function(){delete _0x22feac[_0x999e('0x9')][_0x1eee64];});}catch(_0x2fda68){logger[_0x999e('0x2f')](_0x999e('0x33'),_0x2fda68['message']);}};Acw[_0x999e('0x34')][_0x999e('0x28')]=function(_0x5bd468){try{var _0x4808d1=this;if(_0x4808d1[_0x999e('0x8')][_0x5bd468]){_0x4808d1['timers'][_0x5bd468][_0x999e('0x2e')]=![];var _0x5dac45=_0x4808d1['timers'][_0x5bd468]['uniqueid'];var _0x5360a3=_0x4808d1[_0x999e('0x8')][_0x5bd468]['queue'];var _0x1be117=_0x4808d1['voiceQueues'][_0x5360a3]['acwTimeout'];logger['info'](_0x999e('0x35'),_0x5bd468);RpcUser[_0x999e('0x36')](this[_0x999e('0x7')][_0x5bd468]);RpcVoiceAgentReport[_0x999e('0x37')]({'acwtime':_0x1be117,'agentacw':!![]},_0x5dac45,_0x5bd468)[_0x999e('0x21')](function(_0x368183){logger[_0x999e('0x25')](_0x999e('0x38'),_0x5dac45,_0x1be117,_0x368183);})['catch'](function(_0x3ff20a){logger[_0x999e('0x2f')](_0x999e('0x30'),_0x5dac45,_0x3ff20a);});}else{logger[_0x999e('0x2f')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x5bd468);if(_0x4808d1[_0x999e('0x8')]){logger['info'](_0x999e('0x39'),JSON[_0x999e('0x3a')](_0x4808d1[_0x999e('0x8')]));}}}catch(_0x327c7b){logger['error'](_0x999e('0x3b'),_0x327c7b[_0x999e('0x3c')]);}};Acw[_0x999e('0x34')]['syncAgentConnect']=function(_0x58dfb2){try{if(this[_0x999e('0x6')][_0x58dfb2[_0x999e('0x2c')]]&&(this[_0x999e('0x6')][_0x58dfb2[_0x999e('0x2c')]][_0x999e('0x3d')]||this[_0x999e('0x6')][_0x58dfb2[_0x999e('0x2c')]][_0x999e('0x1b')])){if(this[_0x999e('0x7')][_0x58dfb2[_0x999e('0x19')]]){this['channels'][_0x58dfb2['uniqueid']]={'queue':_0x58dfb2[_0x999e('0x2c')],'interface':_0x58dfb2[_0x999e('0x19')],'destlinkedid':_0x58dfb2[_0x999e('0x23')]};}}}catch(_0xd37b6e){logger[_0x999e('0x2f')](_0x999e('0x3e'),_0xd37b6e['message']);}};Acw[_0x999e('0x34')]['syncAgentConnectPreview']=function(_0x4caf56){try{if(this[_0x999e('0x6')][_0x4caf56['queue']]&&(this['voiceQueues'][_0x4caf56['queue']]['acw']||this[_0x999e('0x6')][_0x4caf56[_0x999e('0x2c')]]['mandatoryDisposition'])){if(this[_0x999e('0x7')][_0x4caf56[_0x999e('0x19')]]){this[_0x999e('0x9')][_0x4caf56['uniqueid']]={'queue':_0x4caf56['queue'],'interface':_0x4caf56[_0x999e('0x19')]};}}}catch(_0x2ebafe){logger[_0x999e('0x2f')]('[ACW][syncAgentConnectPreview]\x20%s',_0x2ebafe['message']);}};Acw['prototype']['syncHangupRequest']=function(_0x8f1afa){try{if(this['channels'][_0x8f1afa['uniqueid']]&&_[_0x999e('0x3f')](this[_0x999e('0x9')][_0x8f1afa['uniqueid']][_0x999e('0x40')])){logger[_0x999e('0x25')]('[%s][HANGUP:UNIQUEID]',_0x8f1afa[_0x999e('0x2b')]);this['startAcw'](_0x8f1afa[_0x999e('0x2b')]);}else if(this[_0x999e('0x9')][_0x8f1afa['linkedid']]&&_[_0x999e('0x3f')](this[_0x999e('0x9')][_0x8f1afa['linkedid']]['attended'])){logger[_0x999e('0x25')]('[%s][HANGUP:LINKEDID]',_0x8f1afa['linkedid']);this['startAcw'](_0x8f1afa[_0x999e('0x41')]);}}catch(_0x3b2023){logger[_0x999e('0x2f')](_0x999e('0x42'),_0x3b2023[_0x999e('0x3c')]);}};Acw[_0x999e('0x34')]['syncHangup']=function(_0x14f8de){try{if(this[_0x999e('0x9')][_0x14f8de['uniqueid']]&&this[_0x999e('0x9')][_0x14f8de[_0x999e('0x2b')]][_0x999e('0x40')]){logger[_0x999e('0x25')](_0x999e('0x43'),_0x14f8de[_0x999e('0x2b')]);this[_0x999e('0x44')](_0x14f8de[_0x999e('0x2b')]);}else if(this[_0x999e('0x9')][_0x14f8de['linkedid']]&&this[_0x999e('0x9')][_0x14f8de[_0x999e('0x41')]][_0x999e('0x40')]){logger[_0x999e('0x25')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x14f8de[_0x999e('0x41')]);this[_0x999e('0x44')](_0x14f8de[_0x999e('0x41')]);}}catch(_0x291b73){logger[_0x999e('0x2f')](_0x999e('0x45'),_0x291b73[_0x999e('0x3c')]);}};Acw[_0x999e('0x34')]['syncAttendedTransfer']=function(_0x56368e){try{if(!_[_0x999e('0x46')](this[_0x999e('0x9')][_0x56368e[_0x999e('0x47')]])){this[_0x999e('0x44')](_0x56368e[_0x999e('0x47')]);if(this[_0x999e('0x9')][_0x56368e[_0x999e('0x48')]]){this['channels'][_0x56368e['secondtransfereruniqueid']][_0x999e('0x40')]=!![];this[_0x999e('0x9')][_0x56368e[_0x999e('0x49')]]=this[_0x999e('0x9')][_0x56368e[_0x999e('0x48')]];delete this['channels'][_0x56368e[_0x999e('0x48')]];}}else if(!_[_0x999e('0x46')](this[_0x999e('0x9')][_0x56368e[_0x999e('0x49')]])){this[_0x999e('0x44')](_0x56368e[_0x999e('0x49')]);if(this[_0x999e('0x9')][_0x56368e['origtransfereruniqueid']]){this[_0x999e('0x9')][_0x56368e['origtransfereruniqueid']][_0x999e('0x40')]=!![];this[_0x999e('0x9')][_0x56368e[_0x999e('0x47')]]=this[_0x999e('0x9')][_0x56368e[_0x999e('0x4a')]];delete this[_0x999e('0x9')][_0x56368e['origtransfereruniqueid']];}}}catch(_0x43bd68){logger[_0x999e('0x2f')](_0x999e('0x4b'),_0x43bd68[_0x999e('0x3c')]);}};Acw[_0x999e('0x34')][_0x999e('0x15')]=function(_0x23fd58){try{if(this[_0x999e('0x9')][_0x23fd58[_0x999e('0x4c')]]){logger[_0x999e('0x25')](_0x999e('0x4d'),JSON[_0x999e('0x3a')](_0x23fd58[_0x999e('0x4c')]));this[_0x999e('0x44')](_0x23fd58[_0x999e('0x4c')]);}else if(this['channels'][_0x23fd58[_0x999e('0x4e')]]){logger[_0x999e('0x25')](_0x999e('0x4f'),JSON[_0x999e('0x3a')](_0x23fd58['transfererlinkedid']));this['startAcw'](_0x23fd58[_0x999e('0x4e')]);}}catch(_0x2d398f){logger[_0x999e('0x2f')](_0x999e('0x50'),_0x2d398f[_0x999e('0x3c')]);}};Acw[_0x999e('0x34')][_0x999e('0x11')]=function(_0x3e75a3){try{if(this[_0x999e('0x6')][_0x3e75a3['queue']]&&this[_0x999e('0x6')][_0x3e75a3['queue']][_0x999e('0x51')]===_0x999e('0x52')){if(this['agents'][_0x3e75a3[_0x999e('0x19')]]){logger[_0x999e('0x25')](_0x999e('0x53'),_0x3e75a3[_0x999e('0x2b')],_0x3e75a3[_0x999e('0x19')],_0x3e75a3['queue']);return RpcUser[_0x999e('0x24')](this[_0x999e('0x7')][_0x3e75a3['interface']],'Auto-Pause',_0x3e75a3['uniqueid']);}}}catch(_0x43ec04){logger[_0x999e('0x2f')](_0x999e('0x54'),_0x43ec04[_0x999e('0x3c')]);}};module[_0x999e('0x55')]=Acw; \ No newline at end of file +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 diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 91f7ff4..07e3556 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 _0x1547=['log','exports','asterisk-manager','bluebird','lodash','../../config/logger','ami','asterisk','username','password','keepConnected','Action','error','format','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','port','actionSipShowRegistry','actionDeviceStateList','devicestatelist','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipPeerStatus','actionQueueSummary','catch'];(function(_0x4afc31,_0x677d78){var _0x2cf1c4=function(_0x1e47da){while(--_0x1e47da){_0x4afc31['push'](_0x4afc31['shift']());}};_0x2cf1c4(++_0x677d78);}(_0x1547,0x92));var _0x7154=function(_0x2d3947,_0x19d1b7){_0x2d3947=_0x2d3947-0x0;var _0x5efbd8=_0x1547[_0x2d3947];return _0x5efbd8;};'use strict';var Manager=require(_0x7154('0x0'));var BPromise=require(_0x7154('0x1'));var moment=require('moment');var util=require('util');var _=require(_0x7154('0x2'));var logger=require(_0x7154('0x3'))(_0x7154('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x7154('0x5')]['port'],config['asterisk']['ip'],config[_0x7154('0x5')][_0x7154('0x6')],config[_0x7154('0x5')][_0x7154('0x7')],!![]);ami[_0x7154('0x8')]();ami[_0x7154('0x9')]=BPromise['promisify'](ami['action']);function error(_0x4f917b){logger[_0x7154('0xa')](util[_0x7154('0xb')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0x7154('0x6')],config[_0x7154('0x5')]['ip'],config[_0x7154('0x5')]['port'],util[_0x7154('0xc')](_0x4f917b,![],null)));}function close(){logger[_0x7154('0xa')](util[_0x7154('0xb')](_0x7154('0xd'),config[_0x7154('0x5')][_0x7154('0x6')],config[_0x7154('0x5')]['ip'],config['asterisk'][_0x7154('0xe')]));}ami[_0x7154('0xf')]=function(){return function(){return ami[_0x7154('0x9')]({'action':'sipshowregistry'});};};ami[_0x7154('0x10')]=function(){return function(){return ami[_0x7154('0x9')]({'action':_0x7154('0x11')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x7154('0x9')]({'action':_0x7154('0x12')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x7154('0x9')]({'action':_0x7154('0x13')});};};ami[_0x7154('0x14')]=function(){return function(){return ami[_0x7154('0x9')]({'action':_0x7154('0x15')});};};function connect(_0x3d3f2f){logger[_0x7154('0x16')](util[_0x7154('0xb')](_0x7154('0x17'),config[_0x7154('0x5')][_0x7154('0x6')],config[_0x7154('0x5')]['ip'],config[_0x7154('0x5')]['port']));ami[_0x7154('0x18')]('error',error);ami[_0x7154('0x18')](_0x7154('0x19'),close);}ami['on']('connect',connect);ami['on'](_0x7154('0x1a'),function(_0xe54692){logger[_0x7154('0x16')](util[_0x7154('0xb')](_0x7154('0x1b'),config[_0x7154('0x5')]['username'],config[_0x7154('0x5')]['ip'],config['asterisk'][_0x7154('0xe')],util[_0x7154('0xc')](_0xe54692,![],null)));});ami['on']('fullybooted',function(_0x2874a5){logger[_0x7154('0x16')](util[_0x7154('0xb')](_0x7154('0x1c'),config['asterisk'][_0x7154('0x6')],config['asterisk']['ip'],config['asterisk'][_0x7154('0xe')]));return BPromise[_0x7154('0x1d')]()[_0x7154('0x1e')](ami['actionSipShowRegistry']())['then'](ami['actionDeviceStateList']())['then'](ami[_0x7154('0x1f')]())[_0x7154('0x1e')](ami[_0x7154('0x20')]())[_0x7154('0x1e')](ami['actionCoreShowChannels']())[_0x7154('0x21')](function(_0x5c68ec){console[_0x7154('0x22')](_0x5c68ec);});});ami[_0x7154('0x18')]('error',error);ami[_0x7154('0x18')](_0x7154('0x19'),close);module[_0x7154('0x23')]=ami; \ No newline at end of file +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 diff --git a/server/services/ami/client.js b/server/services/ami/client.js index ac9ed32..2ac57cb 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 _0x141e=['result','exports','jayson/promise','bluebird','../../config/logger','client','http','request','then','debug','rpc','memberReport','error','message'];(function(_0x3c2253,_0xea9d33){var _0x2e63d6=function(_0x52f818){while(--_0x52f818){_0x3c2253['push'](_0x3c2253['shift']());}};_0x2e63d6(++_0xea9d33);}(_0x141e,0x152));var _0xe141=function(_0x32b13d,_0x507f6b){_0x32b13d=_0x32b13d-0x0;var _0x2faa4f=_0x141e[_0x32b13d];return _0x2faa4f;};'use strict';var jayson=require(_0xe141('0x0'));var BPromise=require(_0xe141('0x1'));var logger=require(_0xe141('0x2'))('ami');var client=jayson[_0xe141('0x3')][_0xe141('0x4')]({'port':0x2329});client['Request']=function(_0x3542fe,_0x58b035){return new BPromise(function(_0x4012d7,_0x1da87e){return client[_0xe141('0x5')](_0x3542fe,_0x58b035)[_0xe141('0x6')](function(_0x43067d){logger[_0xe141('0x7')](_0xe141('0x8'),_0xe141('0x9'),_0x3542fe,_0x58b035,_0x43067d);if(_0x43067d[_0xe141('0xa')]){logger[_0xe141('0xa')]('rpc',_0xe141('0x9'),_0x3542fe,_0x43067d[_0xe141('0xa')][_0xe141('0xb')],_0x58b035);return _0x1da87e(_0x43067d[_0xe141('0xa')][_0xe141('0xb')]);}else{return _0x4012d7(_0x43067d[_0xe141('0xc')]);}})['catch'](function(_0x288546){logger[_0xe141('0xa')](_0xe141('0x8'),_0xe141('0x9'),_0x3542fe,_0x288546,_0x58b035);return _0x1da87e(_0x288546);});});};module[_0xe141('0xd')]=client; \ No newline at end of file +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 diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 0de3a8c..04cfcce 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 _0xe495=['queue','exports','util','moment','isNil','string','voiceQueue','Contact','phone','number','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','firstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','dialCutDigit','getQueue'];(function(_0x3e7555,_0x446643){var _0x5f5c83=function(_0x25bce5){while(--_0x25bce5){_0x3e7555['push'](_0x3e7555['shift']());}};_0x5f5c83(++_0x446643);}(_0xe495,0xfe));var _0x5e49=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xe495[_0x500419];return _0x241c1a;};'use strict';var util=require(_0x5e49('0x0'));var _=require('lodash');var moment=require(_0x5e49('0x1'));function checkNameSurname(_0x35d3b0,_0x5a0d88,_0xdf0a7a){var _0x31ddfe='';if(!_[_0x5e49('0x2')](_0x5a0d88)&&'string'===typeof _0x5a0d88){_0x31ddfe+=_0x5a0d88;}if(!_[_0x5e49('0x2')](_0xdf0a7a)&&_0x5e49('0x3')===typeof _0xdf0a7a){_0x31ddfe+='\x20'+_0xdf0a7a;}if(_0x31ddfe!==''){return _0x31ddfe;}return _0x35d3b0;}function Action(_0x1a76d8,_0x131b91,_0x2e695a){this[_0x5e49('0x4')]=_0x1a76d8;this['uniqueid']=_0x2e695a||undefined;this['name']=checkNameSurname(_0x131b91[_0x5e49('0x5')][_0x5e49('0x6')],_0x131b91['Contact']['firstName'],_0x131b91[_0x5e49('0x5')]['lastName']);this[_0x5e49('0x7')]=_0x131b91[_0x5e49('0x5')][_0x5e49('0x6')];this['queue']=_0x1a76d8[_0x5e49('0x8')];this[_0x5e49('0x9')]=_0x131b91[_0x5e49('0x9')]||![];this[_0x5e49('0xa')]=_0x1a76d8[_0x5e49('0xa')];this[_0x5e49('0xb')]=_0x1a76d8[_0x5e49('0xb')]||0x3;this[_0x5e49('0xc')]=_0x131b91[_0x5e49('0xc')];this[_0x5e49('0xd')]=_0x131b91[_0x5e49('0xd')];this['countcongestionretry']=_0x131b91[_0x5e49('0xe')];this['countnoanswerretry']=_0x131b91[_0x5e49('0xf')];this[_0x5e49('0x10')]=_0x131b91[_0x5e49('0x10')];this[_0x5e49('0x11')]=_0x131b91[_0x5e49('0x11')];this[_0x5e49('0x12')]=_0x131b91['countabandonedretry'];this[_0x5e49('0x13')]=_0x131b91['countmachineretry'];this[_0x5e49('0x14')]=_0x131b91[_0x5e49('0x14')];this[_0x5e49('0x15')]=_0x131b91[_0x5e49('0x15')];this[_0x5e49('0x16')]=_0x131b91[_0x5e49('0x16')];this['UserId']=_0x131b91[_0x5e49('0x17')];this[_0x5e49('0x18')]=_0x131b91[_0x5e49('0x18')];this[_0x5e49('0x19')]=_0x131b91[_0x5e49('0x19')];this['idHopper']=_0x131b91['id'];this[_0x5e49('0x1a')]=_0x131b91['Contact'][_0x5e49('0x1b')]||'';this['starttime']=moment()[_0x5e49('0x1c')](_0x5e49('0x1d'));this[_0x5e49('0x1e')]=_0x131b91['callback'];this['callbackuniqueid']=_0x131b91[_0x5e49('0x1f')];this[_0x5e49('0x20')]=_0x131b91['callbackat'];this[_0x5e49('0x21')]=_0x131b91[_0x5e49('0x21')];this[_0x5e49('0x22')]='';this[_0x5e49('0x23')]='';}Action[_0x5e49('0x24')]['getCaller']=function(){return util['format'](_0x5e49('0x25'),this[_0x5e49('0x8')],this[_0x5e49('0x4')][_0x5e49('0x26')]>0x0?this[_0x5e49('0x7')]['substring'](this[_0x5e49('0x4')][_0x5e49('0x26')]):this['number']);};Action[_0x5e49('0x24')][_0x5e49('0x27')]=function(){return this[_0x5e49('0x28')];};module[_0x5e49('0x29')]=Action; \ No newline at end of file +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 diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index b94a625..c6e61d8 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 _0xdf35=['countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','milliseconds','diff','seconds','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry'];(function(_0x4f0c2b,_0x2c9d14){var _0x526436=function(_0x2e13b6){while(--_0x2e13b6){_0x4f0c2b['push'](_0x4f0c2b['shift']());}};_0x526436(++_0x2c9d14);}(_0xdf35,0x1bf));var _0x5df3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xdf35[_0x2641f9];return _0x585741;};'use strict';var util=require(_0x5df3('0x0'));var _=require(_0x5df3('0x1'));var moment=require('moment');function getSeconds(_0x4148c3,_0x589f4f){var _0x5cad97=moment(_0x4148c3)[_0x5df3('0x2')](0x0);var _0x57bf15=moment(_0x589f4f)[_0x5df3('0x2')](0x0);return _0x5cad97[_0x5df3('0x3')](_0x57bf15,_0x5df3('0x4'));}function AgentComplete(_0x16d91e,_0x235563){this[_0x5df3('0x5')]=0x4;this[_0x5df3('0x6')]='Answer';this[_0x5df3('0x7')]=_0x16d91e['scheduledat'];this[_0x5df3('0x8')]=_0x16d91e[_0x5df3('0x8')];this[_0x5df3('0x9')]=_0x16d91e[_0x5df3('0x8')]===_0x5df3('0xa')?_0x5df3('0xb'):_0x16d91e[_0x5df3('0x8')];this[_0x5df3('0xc')]=_0x16d91e[_0x5df3('0xc')];this[_0x5df3('0xd')]=_0x16d91e[_0x5df3('0xd')];this[_0x5df3('0xe')]=_0x16d91e[_0x5df3('0xe')];this['countglobal']=_0x16d91e[_0x5df3('0xc')]+_0x16d91e[_0x5df3('0xd')]+_0x16d91e[_0x5df3('0xe')]+_0x16d91e[_0x5df3('0xf')]+_0x16d91e[_0x5df3('0x10')]+_0x16d91e[_0x5df3('0x11')]+_0x16d91e['countmachineretry']+_0x16d91e[_0x5df3('0x12')];this['countnosuchnumberretry']=_0x16d91e['countnosuchnumberretry'];this[_0x5df3('0x10')]=_0x16d91e[_0x5df3('0x10')];this['countabandonedretry']=_0x16d91e[_0x5df3('0x11')];this[_0x5df3('0x13')]=_0x16d91e[_0x5df3('0x13')];this[_0x5df3('0x12')]=_0x16d91e[_0x5df3('0x12')];this[_0x5df3('0x14')]=_0x235563[_0x5df3('0x14')];this[_0x5df3('0x15')]=_0x16d91e[_0x5df3('0x16')];this[_0x5df3('0x17')]=_0x16d91e[_0x5df3('0x18')];this['starttime']=_0x16d91e[_0x5df3('0x19')];this[_0x5df3('0x1a')]=_0x16d91e[_0x5df3('0x1a')];this['answertime']=_0x16d91e[_0x5df3('0x1b')];this[_0x5df3('0x1c')]=moment()[_0x5df3('0x1d')](_0x5df3('0x1e'));this[_0x5df3('0x1f')]=getSeconds(_0x16d91e[_0x5df3('0x1a')],_0x16d91e[_0x5df3('0x19')]);this['holdtime']=getSeconds(_0x16d91e[_0x5df3('0x1b')],_0x16d91e[_0x5df3('0x1a')]);this[_0x5df3('0x20')]=getSeconds(this[_0x5df3('0x1c')],_0x16d91e[_0x5df3('0x1b')]);this[_0x5df3('0xb')]=_0x235563[_0x5df3('0xb')];this['membername']=_0x235563[_0x5df3('0x21')];this[_0x5df3('0x22')]=_0x235563['reason'];this[_0x5df3('0x23')]=_0x16d91e[_0x5df3('0x23')];this[_0x5df3('0x24')]=_0x16d91e['callbackuniqueid'];this[_0x5df3('0x25')]=_0x16d91e[_0x5df3('0x25')];this[_0x5df3('0x26')]=_0x16d91e[_0x5df3('0x26')];this[_0x5df3('0x27')]=_0x16d91e['ContactId'];this[_0x5df3('0x28')]=_0x16d91e['ListId'];this[_0x5df3('0x29')]=_0x16d91e[_0x5df3('0x29')];this[_0x5df3('0x2a')]=_0x16d91e[_0x5df3('0x2a')];this[_0x5df3('0x2b')]=_0x16d91e[_0x5df3('0x2b')];this[_0x5df3('0x2c')]=_0x16d91e[_0x5df3('0x2c')]||'';this[_0x5df3('0x2d')]=_0x16d91e[_0x5df3('0x2d')]||'';}module['exports']=AgentComplete; \ No newline at end of file +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 diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 3597b6b..5e3acd8 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 _0x952d=['lodash','moment','diff','seconds','uniqueid','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countabandonedretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','util'];(function(_0x1b95a9,_0x571b50){var _0x18441b=function(_0xd6d4c1){while(--_0xd6d4c1){_0x1b95a9['push'](_0x1b95a9['shift']());}};_0x18441b(++_0x571b50);}(_0x952d,0x1a3));var _0xd952=function(_0x586810,_0x2b8c78){_0x586810=_0x586810-0x0;var _0x4553a7=_0x952d[_0x586810];return _0x4553a7;};'use strict';var util=require(_0xd952('0x0'));var _=require(_0xd952('0x1'));var moment=require(_0xd952('0x2'));function getSeconds(_0x50fe5e,_0x439b46){var _0x259d18=moment(_0x50fe5e)['milliseconds'](0x0);var _0x2328da=moment(_0x439b46)['milliseconds'](0x0);return _0x259d18[_0xd952('0x3')](_0x2328da,_0xd952('0x4'));}function Final(_0x24d671){this[_0xd952('0x5')]=_0x24d671[_0xd952('0x5')];this[_0xd952('0x6')]=_0x24d671[_0xd952('0x6')];this[_0xd952('0x7')]=_0x24d671[_0xd952('0x7')];this['campaigntype']=_0x24d671[_0xd952('0x7')]==='outbound'?'queue':_0x24d671['type'];this['countbusyretry']=_0x24d671[_0xd952('0x8')];this[_0xd952('0x9')]=_0x24d671['countcongestionretry'];this['countnoanswerretry']=_0x24d671[_0xd952('0xa')];this[_0xd952('0xb')]=_0x24d671[_0xd952('0x8')]+_0x24d671[_0xd952('0x9')]+_0x24d671['countnoanswerretry']+_0x24d671[_0xd952('0xc')]+_0x24d671['countdropretry']+_0x24d671['countabandonedretry']+_0x24d671[_0xd952('0xd')]+_0x24d671[_0xd952('0xe')];this[_0xd952('0xc')]=_0x24d671[_0xd952('0xc')];this['countdropretry']=_0x24d671['countdropretry'];this[_0xd952('0xf')]=_0x24d671[_0xd952('0xf')];this['countmachineretry']=_0x24d671[_0xd952('0xd')];this['countagentrejectretry']=_0x24d671[_0xd952('0xe')];this['queue']=_0x24d671[_0xd952('0x10')];this['calleridname']=_0x24d671[_0xd952('0x11')];this[_0xd952('0x12')]=_0x24d671['calleridnum'];this[_0xd952('0x13')]=_0x24d671['starttime'];this[_0xd952('0x14')]=_0x24d671[_0xd952('0x14')];this[_0xd952('0x15')]=_0x24d671['responsetime'];this[_0xd952('0x16')]=_0x24d671[_0xd952('0x16')]||0x0;this[_0xd952('0x17')]=_0x24d671['holdtime']||0x0;this['talktime']=_0x24d671[_0xd952('0x18')]||0x0;this[_0xd952('0x19')]=_0x24d671['callback'];this[_0xd952('0x1a')]=_0x24d671[_0xd952('0x1a')];this[_0xd952('0x1b')]=_0x24d671['callbackat'];this[_0xd952('0x1c')]=_0x24d671['recallme'];this['ContactId']=_0x24d671[_0xd952('0x1d')];this[_0xd952('0x1e')]=_0x24d671[_0xd952('0x1e')];this[_0xd952('0x1f')]=_0x24d671[_0xd952('0x1f')];this[_0xd952('0x20')]=_0x24d671['VoiceQueueId'];this['CampaignId']=_0x24d671['CampaignId'];this['originatecalleridnum']=_0x24d671[_0xd952('0x21')]||'';this[_0xd952('0x22')]=_0x24d671[_0xd952('0x22')]||'';}module['exports']=Final; \ No newline at end of file +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 diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index a3f534f..ce12636 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 _0xf2a6=['endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime'];(function(_0x30f933,_0x378839){var _0x1c931a=function(_0x10a389){while(--_0x10a389){_0x30f933['push'](_0x30f933['shift']());}};_0x1c931a(++_0x378839);}(_0xf2a6,0x9f));var _0x6f2a=function(_0x4c18f6,_0x6ff02e){_0x4c18f6=_0x4c18f6-0x0;var _0x237955=_0xf2a6[_0x4c18f6];return _0x237955;};'use strict';var util=require(_0x6f2a('0x0'));var _=require(_0x6f2a('0x1'));var moment=require(_0x6f2a('0x2'));function getSeconds(_0x4362d1,_0x25fa8b){var _0x183760=moment(_0x4362d1)[_0x6f2a('0x3')](0x0);var _0xaedfbd=moment(_0x25fa8b)[_0x6f2a('0x3')](0x0);return _0x183760[_0x6f2a('0x4')](_0xaedfbd,_0x6f2a('0x5'));}function Hangup(_0x3c0b34,_0x457d34){this[_0x6f2a('0x6')]=0x4;this[_0x6f2a('0x7')]=_0x6f2a('0x8');this[_0x6f2a('0x9')]=_0x3c0b34['scheduledat'];this[_0x6f2a('0xa')]=_0x3c0b34[_0x6f2a('0xa')];this[_0x6f2a('0xb')]=_0x3c0b34[_0x6f2a('0xa')]===_0x6f2a('0xc')?'queue':_0x3c0b34['type'];this[_0x6f2a('0xd')]=_0x3c0b34[_0x6f2a('0xd')];this[_0x6f2a('0xe')]=_0x3c0b34[_0x6f2a('0xe')];this[_0x6f2a('0xf')]=_0x3c0b34[_0x6f2a('0xf')];this[_0x6f2a('0x10')]=_0x3c0b34[_0x6f2a('0xd')]+_0x3c0b34[_0x6f2a('0xe')]+_0x3c0b34[_0x6f2a('0xf')]+_0x3c0b34[_0x6f2a('0x11')]+_0x3c0b34['countdropretry']+_0x3c0b34[_0x6f2a('0x12')]+_0x3c0b34[_0x6f2a('0x13')]+_0x3c0b34[_0x6f2a('0x14')];this[_0x6f2a('0x11')]=_0x3c0b34[_0x6f2a('0x11')];this[_0x6f2a('0x15')]=_0x3c0b34['countdropretry'];this[_0x6f2a('0x12')]=_0x3c0b34[_0x6f2a('0x12')];this[_0x6f2a('0x13')]=_0x3c0b34[_0x6f2a('0x13')];this[_0x6f2a('0x14')]=_0x3c0b34[_0x6f2a('0x14')];this[_0x6f2a('0x16')]=_0x457d34[_0x6f2a('0x16')];this[_0x6f2a('0x17')]=_0x3c0b34[_0x6f2a('0x18')];this[_0x6f2a('0x19')]=_0x3c0b34[_0x6f2a('0x1a')];this[_0x6f2a('0x1b')]=_0x3c0b34[_0x6f2a('0x1b')];this[_0x6f2a('0x1c')]=_0x3c0b34[_0x6f2a('0x1c')];this[_0x6f2a('0x1d')]=moment()['format'](_0x6f2a('0x1e'));this[_0x6f2a('0x1f')]=getSeconds(_0x3c0b34['responsetime'],_0x3c0b34[_0x6f2a('0x1b')]);this[_0x6f2a('0x20')]=0x0;this[_0x6f2a('0x21')]=getSeconds(this[_0x6f2a('0x1d')],_0x3c0b34['responsetime']);this[_0x6f2a('0x22')]=_0x3c0b34['queue'];this[_0x6f2a('0x23')]=_0x6f2a('0x24');this[_0x6f2a('0x25')]=_0x457d34['cause-txt'];this[_0x6f2a('0x26')]=_0x3c0b34[_0x6f2a('0x26')];this[_0x6f2a('0x27')]=_0x3c0b34[_0x6f2a('0x27')];this[_0x6f2a('0x28')]=_0x3c0b34[_0x6f2a('0x28')];this[_0x6f2a('0x29')]=_0x3c0b34[_0x6f2a('0x29')];this[_0x6f2a('0x2a')]=_0x3c0b34[_0x6f2a('0x2a')];this[_0x6f2a('0x2b')]=_0x3c0b34[_0x6f2a('0x2b')];this[_0x6f2a('0x2c')]=_0x3c0b34[_0x6f2a('0x2c')];this[_0x6f2a('0x2d')]=_0x3c0b34[_0x6f2a('0x2d')];this['CampaignId']=_0x3c0b34[_0x6f2a('0x2e')];}module['exports']=Hangup; \ No newline at end of file +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 diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 4e356f1..f53dd6b 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 _0x11fe=['VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countglobal','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','calleridname','name','calleridnum','number','starttime','responsetime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId'];(function(_0x17c2ea,_0x529542){var _0x23a823=function(_0x584392){while(--_0x584392){_0x17c2ea['push'](_0x17c2ea['shift']());}};_0x23a823(++_0x529542);}(_0x11fe,0xb8));var _0xe11f=function(_0x17760e,_0x5e81e8){_0x17760e=_0x17760e-0x0;var _0x34a98e=_0x11fe[_0x17760e];return _0x34a98e;};'use strict';var util=require('util');var _=require(_0xe11f('0x0'));var moment=require(_0xe11f('0x1'));function getSeconds(_0xa04941,_0x1b2ba9){var _0xa221ad=moment(_0xa04941)[_0xe11f('0x2')](0x0);var _0x583bc3=moment(_0x1b2ba9)[_0xe11f('0x2')](0x0);return _0xa221ad[_0xe11f('0x3')](_0x583bc3,'seconds');}function History(_0x1b1fee){this['uniqueid']=_0x1b1fee[_0xe11f('0x4')];this['scheduledat']=_0x1b1fee[_0xe11f('0x5')]||undefined;this['type']=_0x1b1fee[_0xe11f('0x6')];this['campaigntype']=_0x1b1fee[_0xe11f('0x6')]===_0xe11f('0x7')?_0xe11f('0x8'):_0x1b1fee[_0xe11f('0x6')];this[_0xe11f('0x9')]=_0x1b1fee[_0xe11f('0x9')];this['countcongestionretry']=_0x1b1fee['countcongestionretry'];this['countnoanswerretry']=_0x1b1fee['countnoanswerretry'];this[_0xe11f('0xa')]=_0x1b1fee[_0xe11f('0x9')]+_0x1b1fee[_0xe11f('0xb')]+_0x1b1fee[_0xe11f('0xc')]+_0x1b1fee[_0xe11f('0xd')]+_0x1b1fee[_0xe11f('0xe')]+_0x1b1fee['countabandonedretry']+_0x1b1fee['countmachineretry']+_0x1b1fee[_0xe11f('0xf')];this['countnosuchnumberretry']=_0x1b1fee['countnosuchnumberretry'];this[_0xe11f('0xe')]=_0x1b1fee[_0xe11f('0xe')];this[_0xe11f('0x10')]=_0x1b1fee[_0xe11f('0x10')];this[_0xe11f('0x11')]=_0x1b1fee['countmachineretry'];this['countagentrejectretry']=_0x1b1fee['countagentrejectretry'];this[_0xe11f('0x8')]=_0x1b1fee[_0xe11f('0x8')];this[_0xe11f('0x12')]=_0x1b1fee[_0xe11f('0x13')];this[_0xe11f('0x14')]=_0x1b1fee[_0xe11f('0x15')];this[_0xe11f('0x16')]=_0x1b1fee[_0xe11f('0x16')];this[_0xe11f('0x17')]=_0x1b1fee[_0xe11f('0x17')];this['endtime']=_0x1b1fee[_0xe11f('0x17')];this['ringtime']=getSeconds(_0x1b1fee[_0xe11f('0x17')],_0x1b1fee['starttime']);this['holdtime']=0x0;this[_0xe11f('0x18')]=0x0;this[_0xe11f('0x19')]=_0x1b1fee[_0xe11f('0x19')];this['callbackuniqueid']=_0x1b1fee[_0xe11f('0x1a')];this[_0xe11f('0x1b')]=_0x1b1fee[_0xe11f('0x1b')];this[_0xe11f('0x1c')]=_0x1b1fee[_0xe11f('0x1c')];this[_0xe11f('0x1d')]=_0x1b1fee[_0xe11f('0x1d')];this[_0xe11f('0x1e')]=_0x1b1fee['ListId'];this[_0xe11f('0x1f')]=_0x1b1fee[_0xe11f('0x1f')];this[_0xe11f('0x20')]=_0x1b1fee[_0xe11f('0x20')];this[_0xe11f('0x21')]=_0x1b1fee[_0xe11f('0x21')];this[_0xe11f('0x22')]=_0x1b1fee['originatecalleridnum']||'';this[_0xe11f('0x23')]=_0x1b1fee[_0xe11f('0x23')]||'';}module['exports']=History; \ No newline at end of file +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 diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index b54ad09..cbf6de2 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 _0x87ee=['syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','syncVarSet','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','[ifTime][Action]','Error','stringify','milliseconds','seconds','emit','outbound','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','md5','format','voice:queue:%s','voice_queue:save','type','campaign:ivr:%s','campaign:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','diff','handlePredictive','ivr','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','[getContactDialer2][Empty]','sendMessageOneNotActive','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','clearZombieChannels','uniqueId','[uniqueid]','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','checkIsBlackList','checkIsBlackListIvr','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','SIP/%s','reachable','unmonitored','saveInDb','variable','amdstatus','dialAMDActive','value','HANGUP','uniqueid','HangupInAMD','membername','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','amd','[syncMachine][createHistory]','[syncMachine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncMachineIvr][createHistory]','[syncMachineIvr]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','Unknow','reason','agent','agiafterat','dialQueueProject2','YYYY-MM-DD\x20HH:mm:ss','[syncAgentComplete][createHistory]','[syncAgentComplete]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','responsetime','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','countdropretry','add','dialDropRetryFrequency','Abandoned','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','syncQueueMember','actionid','locked','paused','stateinterface','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[unlock][syncQueueStatusComplete]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','push','command','iftime\x20%s,%s','interval','indexOf','content','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialMethod','dialGlobalInterval','dialTimezone','[syncQueueSummary]','[syncCampaigns]','pow','replace','random','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialAgiAfterHangupAgent','dialQueueTimeout','ACTIVE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','starttime','[originate][error]','originate\x20action\x20Error','response','callProgressDetecting','checkRetriveMax','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','minutes','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','[rescheduleContact][Machine]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','[syncAgentComplete][createHistory][0]','stateGlobal','reason\x200\x20no\x20such\x20number....','NoAnswer','[syncAgentComplete][createHistory][3]','createStateFinal','countglobal','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','Congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','available','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','abandonmentRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','busyFactor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','dialRecallMeTimeout','Agent','voicePause','log','Contact\x20updated','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','floor','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','--------\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','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\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','[busyFactor]','p\x20=\x20','exports','lodash','bluebird','uuid','moment','ioredis','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','env','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse'];(function(_0x126665,_0x30f2bf){var _0x182300=function(_0x5d876a){while(--_0x5d876a){_0x126665['push'](_0x126665['shift']());}};_0x182300(++_0x30f2bf);}(_0x87ee,0x1de));var _0xe87e=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0x87ee[_0x5317b5];return _0x3b7ce2;};'use strict';var util=require('util');var _=require(_0xe87e('0x0'));var BPromise=require(_0xe87e('0x1'));var uuid=require(_0xe87e('0x2'));var moment=require(_0xe87e('0x3'));var rr=require('rr');var md5=require('md5');var Redis=require(_0xe87e('0x4'));var config=require(_0xe87e('0x5'));var logger=require(_0xe87e('0x6'))(_0xe87e('0x7'));var loggerBooked=require('../../../config/logger')(_0xe87e('0x8'));var loggerPredictive=require(_0xe87e('0x6'))(_0xe87e('0x9'));var loggerPredictiveCalls=require(_0xe87e('0x6'))(_0xe87e('0xa'));var loggerSyncQueueSummary=require('../../../config/logger')(_0xe87e('0xb'));var ami=require(_0xe87e('0xc'));config[_0xe87e('0xd')]=_[_0xe87e('0xe')](config['redis'],{'host':_0xe87e('0xf'),'port':0x18eb});var io=require(_0xe87e('0x10'))(new Redis(config[_0xe87e('0xd')]));var cmHopper=require(_0xe87e('0x11'));var cmHopperFinal=require(_0xe87e('0x12'));var cmHopperHistory=require(_0xe87e('0x13'));var cmHopperBlack=require(_0xe87e('0x14'));var voiceQueueRt=require(_0xe87e('0x15'));var Action=require(_0xe87e('0x16'));var History=require(_0xe87e('0x17'));var Final=require(_0xe87e('0x18'));var AgentComplete=require(_0xe87e('0x19'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require('./hangup');var ipAgi=process[_0xe87e('0x1a')]['XCALLY_IP_AGI']||_0xe87e('0x1b');var strategy={'rrmemory':_0xe87e('0x1c'),'roundrobin':_0xe87e('0x1d')};var Sequence=function(){};Sequence[_0xe87e('0x1e')][_0xe87e('0x1f')]=function(_0x3fe70c){this[_0xe87e('0x20')]=this[_0xe87e('0x20')]?this['tail'][_0xe87e('0x21')](_0x3fe70c):_0x3fe70c();};function Dialer(_0xc8ba0a,_0x405850){this[_0xe87e('0x22')]=new Sequence();this[_0xe87e('0x23')]=_0x405850;this[_0xe87e('0x24')]=_0xc8ba0a[_0xe87e('0x24')];this[_0xe87e('0x25')]=_0xc8ba0a[_0xe87e('0x25')];this[_0xe87e('0x26')]=_0xc8ba0a[_0xe87e('0x26')];this[_0xe87e('0x27')]=_0xc8ba0a[_0xe87e('0x27')];this[_0xe87e('0x28')]=config[_0xe87e('0x28')]||0x2;this[_0xe87e('0x29')]={};this[_0xe87e('0x2a')]={};this[_0xe87e('0x2b')]={};this['uniqueId']={};this[_0xe87e('0x2c')]={};this[_0xe87e('0x2d')]={};this[_0xe87e('0x2e')]={};this[_0xe87e('0x2f')]={};this[_0xe87e('0x30')]={};this[_0xe87e('0x31')]={};ami['on']('agentconnect',this[_0xe87e('0x32')][_0xe87e('0x33')](this));ami['on'](_0xe87e('0x34'),this[_0xe87e('0x35')][_0xe87e('0x33')](this));ami['on'](_0xe87e('0x36'),this[_0xe87e('0x37')][_0xe87e('0x33')](this));ami['on'](_0xe87e('0x38'),this[_0xe87e('0x39')]['bind'](this));ami['on'](_0xe87e('0x3a'),this['syncQueueSummary'][_0xe87e('0x33')](this));ami['on'](_0xe87e('0x3b'),this[_0xe87e('0x3c')][_0xe87e('0x33')](this));ami['on'](_0xe87e('0x3d'),this[_0xe87e('0x3e')][_0xe87e('0x33')](this));ami['on']('varset',this[_0xe87e('0x3f')][_0xe87e('0x33')](this));ami['on']('queuemember',this['syncQueueMember'][_0xe87e('0x33')](this));ami['on'](_0xe87e('0x40'),this['syncQueueStatusComplete']['bind'](this));this[_0xe87e('0x41')]();this[_0xe87e('0x42')]();}function isNotNull(_0x49b0c6){return _0x49b0c6!==null&&!_[_0xe87e('0x43')](_0x49b0c6);}function checkIsLoggedIn(_0x39f7f1,_0x26ebd3){return function(){if(_0x26ebd3<=0x0){_0x39f7f1[_0xe87e('0x44')]=_0xe87e('0x45');throw _0x39f7f1[_0xe87e('0x46')]+_0xe87e('0x47');}};}function isActive(_0x2060c9){return _0x2060c9;}function checkIsActive(_0x508579,_0x56f7fc){return function(){if(!isActive(_0x56f7fc)){_0x508579[_0xe87e('0x44')]='NOT_ACTIVE';throw _0x508579[_0xe87e('0x46')]+'\x20NOT\x20Active';}};}function checkInterval(_0x4a391d){return function(){if(!isNotNull(_0x4a391d[_0xe87e('0x48')])){_0x4a391d[_0xe87e('0x44')]=_0xe87e('0x49');throw _0x4a391d[_0xe87e('0x46')]+_0xe87e('0x4a');}if(!isNotNull(_0x4a391d['Interval'][_0xe87e('0x4b')])){_0x4a391d[_0xe87e('0x44')]=_0xe87e('0x49');throw _0x4a391d['name']+_0xe87e('0x4a');}if(!isNotNull(_['isEmpty'](_0x4a391d[_0xe87e('0x48')]['Intervals']))){_0x4a391d['message']=_0xe87e('0x49');throw _0x4a391d[_0xe87e('0x46')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x30a619,_0x3cd3fe,_0xff3d54){return{'action':_0x30a619,'response':_0x3cd3fe,'message':_0xff3d54,'stack':_0xff3d54};}function myreject(_0x17d09c){return function(_0x16c55e){return _0x17d09c(msgResponse(_0xe87e('0x4c'),_0xe87e('0x4d'),JSON[_0xe87e('0x4e')](_0x16c55e)));};}function getSeconds(_0x31ff93,_0x894931){var _0x2f702a=moment(_0x31ff93)[_0xe87e('0x4f')](0x0);var _0x4ac77e=moment(_0x894931)[_0xe87e('0x4f')](0x0);return _0x2f702a['diff'](_0x4ac77e,_0xe87e('0x50'));}function emit(_0x4a417d,_0x53fee3,_0x47cd92){io['to'](_0x4a417d)[_0xe87e('0x51')](_0x53fee3,_0x47cd92);}function emitVoiceQueueSummary(_0x4c57ec){if(_0x4c57ec['type']===_0xe87e('0x52')){var _0x311e5e={'id':_0x4c57ec['id'],'name':_0x4c57ec[_0xe87e('0x46')],'strategy':_0x4c57ec[_0xe87e('0x53')],'answered':_0x4c57ec[_0xe87e('0x54')],'available':_0x4c57ec['available'],'loggedIn':_0x4c57ec[_0xe87e('0x55')],'pTalking':_0x4c57ec[_0xe87e('0x56')],'sumBillable':_0x4c57ec[_0xe87e('0x57')],'sumDuration':_0x4c57ec[_0xe87e('0x58')],'sumHoldTime':_0x4c57ec[_0xe87e('0x59')]||0x0,'talking':_0x4c57ec[_0xe87e('0x5a')],'total':_0x4c57ec[_0xe87e('0x5b')],'type':_0x4c57ec['type'],'unmanaged':_0x4c57ec[_0xe87e('0x5c')],'abandoned':_0x4c57ec['abandoned'],'waiting':_0x4c57ec[_0xe87e('0x5d')],'loggedInDb':_0x4c57ec[_0xe87e('0x5e')],'dialActive':_0x4c57ec[_0xe87e('0x5f')],'dialMethod':_0x4c57ec['dialMethod'],'dialOriginateCallerIdName':_0x4c57ec[_0xe87e('0x60')],'dialOriginateCallerIdNumber':_0x4c57ec[_0xe87e('0x61')],'dialOriginateTimeout':_0x4c57ec[_0xe87e('0x62')],'dialPrefix':_0x4c57ec[_0xe87e('0x63')],'outboundAnswerAgiCallsDay':_0x4c57ec[_0xe87e('0x64')],'outboundAnswerCallsDay':_0x4c57ec[_0xe87e('0x65')],'outboundBlacklistCallsDay':_0x4c57ec[_0xe87e('0x66')],'outboundBusyCallsDay':_0x4c57ec[_0xe87e('0x67')],'outboundCongestionCallsDay':_0x4c57ec[_0xe87e('0x68')],'outboundDropCallsDayACS':_0x4c57ec[_0xe87e('0x69')],'outboundDropCallsDayCallersExit':_0x4c57ec[_0xe87e('0x6a')],'outboundDropCallsDayTimeout':_0x4c57ec[_0xe87e('0x6b')],'outboundNoAnswerCallsDay':_0x4c57ec[_0xe87e('0x6c')],'outboundNoSuchCallsDay':_0x4c57ec['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x4c57ec['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x4c57ec['outboundReCallsDay'],'outboundRejectCallsDay':_0x4c57ec[_0xe87e('0x6d')],'outboundUnknownCallsDay':_0x4c57ec[_0xe87e('0x6e')],'predictiveIntervalAnsweredCalls':_0x4c57ec['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x4c57ec[_0xe87e('0x6f')],'predictiveIntervalAvgTalktime':_0x4c57ec[_0xe87e('0x70')],'predictiveIntervalDroppedCallsCallersExit':_0x4c57ec[_0xe87e('0x71')],'predictiveIntervalDroppedCallsTimeout':_0x4c57ec[_0xe87e('0x72')],'predictiveIntervalErlangCalls':_0x4c57ec[_0xe87e('0x73')],'predictiveIntervalErlangCallsDroppedCalls':_0x4c57ec['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x4c57ec[_0xe87e('0x74')],'predictiveIntervalMultiplicativeFactor':_0x4c57ec[_0xe87e('0x75')],'predictiveIntervalPauses':_0x4c57ec[_0xe87e('0x76')],'predictiveIntervalAvailable':_0x4c57ec['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x4c57ec[_0xe87e('0x77')],'message':_0x4c57ec[_0xe87e('0x44')],'originated':_0x4c57ec[_0xe87e('0x78')],'erlangCalls':_0x4c57ec[_0xe87e('0x79')],'erlangCallToSecond':_0x4c57ec[_0xe87e('0x7a')],'erlangAbandonmentRate':_0x4c57ec[_0xe87e('0x7b')],'erlangBusyFactor':_0x4c57ec[_0xe87e('0x7c')],'startPredictive':_0x4c57ec[_0xe87e('0x2d')],'startProgressive':_0x4c57ec[_0xe87e('0x2e')]};if(_0x4c57ec[_0xe87e('0x7d')]){_0x311e5e[_0xe87e('0x7d')]={'id':_0x4c57ec[_0xe87e('0x7d')]['id'],'name':_0x4c57ec[_0xe87e('0x7d')]['name'],'active':_0x4c57ec[_0xe87e('0x7d')][_0xe87e('0x7e')],'callerid':_0x4c57ec['Trunk'][_0xe87e('0x7f')]};}if(_0x4c57ec[_0xe87e('0x48')]){_0x311e5e[_0xe87e('0x48')]={'id':_0x4c57ec[_0xe87e('0x48')]['id'],'name':_0x4c57ec['Interval'][_0xe87e('0x46')]};}var _0x85192d=md5(JSON[_0xe87e('0x4e')](_0x311e5e));if(_0x4c57ec['md5']!==_0x85192d){_0x4c57ec[_0xe87e('0x80')]=_0x85192d;emit(util[_0xe87e('0x81')](_0xe87e('0x82'),_0x311e5e[_0xe87e('0x46')]),_0xe87e('0x83'),_0x311e5e);}}}function emitCampaignSummary(_0x30052b){if(_0x30052b[_0xe87e('0x84')]==='ivr'){emit(util[_0xe87e('0x81')](_0xe87e('0x85'),_0x30052b['name']),_0xe87e('0x86'),_0x30052b);}}function checkGetDataPredictive(_0x2b2d0c){if(isNotNull(_0x2b2d0c)){if(!_[_0xe87e('0x87')](_0x2b2d0c)){loggerPredictive[_0xe87e('0x88')](_0xe87e('0x89'));loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2b2d0c['predictiveIntervalTotalCalls']);loggerPredictive[_0xe87e('0x88')](_0xe87e('0x8a'),_0x2b2d0c[_0xe87e('0x8b')]);loggerPredictive[_0xe87e('0x88')](_0xe87e('0x8c'),_0x2b2d0c[_0xe87e('0x72')]);loggerPredictive[_0xe87e('0x88')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2b2d0c['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0xe87e('0x88')](_0xe87e('0x8d'),_0x2b2d0c['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xe87e('0x88')](_0xe87e('0x8e'),_0x2b2d0c['predictiveIntervalAvgTalktime']);loggerPredictive[_0xe87e('0x88')](_0xe87e('0x8f'));if(_0x2b2d0c[_0xe87e('0x77')]>0x0){if(!_[_0xe87e('0x43')](_0x2b2d0c[_0xe87e('0x70')])&&_0x2b2d0c[_0xe87e('0x70')]>0x0){return!![];}else{loggerPredictive['info'](_0xe87e('0x90'));}if(!_[_0xe87e('0x43')](_0x2b2d0c[_0xe87e('0x6f')])&&_0x2b2d0c[_0xe87e('0x6f')]>0x0){return!![];}else{loggerPredictive['info'](_0xe87e('0x91'));}}else{loggerPredictive[_0xe87e('0x88')](_0xe87e('0x92'));}}else{loggerPredictive[_0xe87e('0x88')](_0xe87e('0x93'));}}else{loggerPredictive[_0xe87e('0x88')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x5623f1){return function(_0x8cbc9a){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive['info'](_0xe87e('0x94'),_0x8cbc9a[_0xe87e('0x79')]);loggerPredictive[_0xe87e('0x88')](_0xe87e('0x95'),_0x8cbc9a[_0xe87e('0x7a')]);loggerPredictive['info'](_0xe87e('0x96'),_0x8cbc9a[_0xe87e('0x7b')]);loggerPredictive['info'](_0xe87e('0x97'),_0x8cbc9a['erlangBusyFactor']);loggerPredictive[_0xe87e('0x88')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x8cbc9a[_0xe87e('0x7b')]);loggerPredictive['info'](_0xe87e('0x8f'));_[_0xe87e('0x98')](_0x5623f1,_0x8cbc9a);};}function getDiff(_0x2de830){var _0x23c6c6=moment()['milliseconds'](0x0);var _0x41706f=moment(_0x2de830)[_0xe87e('0x4f')](0x0);return _0x23c6c6[_0xe87e('0x99')](_0x41706f,_0xe87e('0x50'));}function ifInterval(_0x489222,_0x5b4458){if(_[_0xe87e('0x43')](_0x5b4458)){return![];}if(getDiff(_0x5b4458)<_0x489222*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x69952b){if(isNotNull(_0x69952b)){if(!_[_0xe87e('0x43')](_0x69952b['startProgressive'])){_0x69952b[_0xe87e('0x2e')]=undefined;loggerPredictive[_0xe87e('0x88')](_0x69952b[_0xe87e('0x46')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0xe87e('0x43')](_0x69952b[_0xe87e('0x2d')])){_0x69952b[_0xe87e('0x2d')]=undefined;loggerPredictive[_0xe87e('0x88')](_0x69952b[_0xe87e('0x46')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0xe87e('0x43')](_0x69952b[_0xe87e('0x9a')])){clearInterval(_0x69952b[_0xe87e('0x9a')]);_0x69952b['handlePredictive']=undefined;loggerPredictive[_0xe87e('0x88')](_0x69952b['name'],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x4fb09a,_0xfa0c8){if(_0xfa0c8===0x0){return 0x0;}var _0x3e7f56=0x1;for(var _0x567d9f=0x1;_0x567d9f<=_0xfa0c8;_0x567d9f+=0x1){_0x3e7f56=0x1+_0x3e7f56*_0x567d9f/_0x4fb09a;}return 0x1/_0x3e7f56;}function isVoiceQueueOutbound(_0x56a85e){return _0x56a85e===_0xe87e('0x52');}function isNotPreview(_0x38b6ae){return _0x38b6ae!=='preview';}function isCampaignIvr(_0x5b978e){return _0x5b978e===_0xe87e('0x9b');}function getCallerId(_0x36073e,_0x41aba6,_0x2c8976){if(!_['isUndefined'](_0x2c8976)&&_0xe87e('0x9c')===typeof _0x2c8976&&!_[_0xe87e('0x87')](_0x2c8976)){if(!_[_0xe87e('0x43')](_0x41aba6)&&_0xe87e('0x9c')===typeof _0x41aba6&&!_[_0xe87e('0x87')](_0x41aba6)){return util[_0xe87e('0x81')](_0xe87e('0x9d'),_0x41aba6,_0x2c8976);}return util[_0xe87e('0x81')](_0xe87e('0x9d'),_0x2c8976,_0x2c8976);}if(!_[_0xe87e('0x43')](_0x36073e)&&'string'===typeof _0x36073e&&!_[_0xe87e('0x87')](_0x36073e)){return _0x36073e;}return _0xe87e('0x9e');}function loggerCatchQueueSummary(_0x58d674,_0x43bff2){return function(_0x5bcec3){freeVariablesPredictive(_0x43bff2);emitVoiceQueueSummary(_0x43bff2);emitCampaignSummary(_0x43bff2);loggerSyncQueueSummary[_0xe87e('0x9f')](_0x58d674,util[_0xe87e('0xa0')](_0x5bcec3,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x408b5b,_0x205628){return function(_0x3f28f0){loggerPredictive[_0xe87e('0x9f')](_0x205628['name'],_0x408b5b);loggerPredictive[_0xe87e('0x9f')](_0x3f28f0[_0xe87e('0xa1')]);freeVariablesPredictive(_0x205628);};}function loggerCatch(_0x3bca40){return function(_0xd100a7){logger[_0xe87e('0x9f')](_0x3bca40,util[_0xe87e('0xa0')](_0xd100a7,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x582c03){return _0x582c03&&!_[_0xe87e('0x43')](_0x582c03)&&_0x582c03[_0xe87e('0xa2')]>0x0;}function decremetOriginate(_0x6fe23f){if(!_[_0xe87e('0x43')](_0x6fe23f)&&_0x6fe23f!==null){if(_0x6fe23f[_0xe87e('0xa3')]('originated')){if(_0x6fe23f['originated']>0x0){_0x6fe23f[_0xe87e('0x78')]-=0x1;}else{logger[_0xe87e('0x9f')](_0xe87e('0xa4'));}}}else{logger[_0xe87e('0x9f')](_0xe87e('0xa5'));}}function checkContactLowerLimitOriginate(_0x1377b5,_0x133a6e,_0x423016){if(_0x133a6e>_0x423016){for(var _0x4ed2dd=0x0;_0x4ed2dd<_0x133a6e-_0x423016;_0x4ed2dd+=0x1){decremetOriginate(_0x1377b5);}}}function loggerGetContactDialer(_0x277c94,_0x39842e,_0x19a1d6){return function(_0x525f62){checkContactLowerLimitOriginate(_0x39842e,_0x19a1d6,0x0);logger[_0xe87e('0x9f')](_0x277c94,util[_0xe87e('0xa0')](_0x525f62,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x217242){return function(_0x138f66){if(isNotNull(_0x138f66)&&isNotNull(_0x138f66[0x0])){if(_0x138f66[0x0][_0xe87e('0xa6')]>0x0){_0x217242[_0xe87e('0x44')]=_0xe87e('0xa7');logger[_0xe87e('0x88')](_0xe87e('0xa8')+_0x217242[_0xe87e('0x46')],_0x138f66[0x0][_0xe87e('0xa6')],'contacts');}else{_0x217242[_0xe87e('0x44')]='AVAILABLE_CONTACTS_FINISHED';logger['info'](_0xe87e('0xa9')+_0x217242['name']);}}};}function notSendMessagesQueue(_0x3a8202){if(_0x3a8202[_0xe87e('0xaa')]){freeVariablesPredictive(_0x3a8202);if(_0x3a8202[_0xe87e('0x78')]===0x0&&_0x3a8202[_0xe87e('0x5a')]===0x0&&_0x3a8202[_0xe87e('0x5d')]===0x0&&(_0x3a8202[_0xe87e('0x56')]||0x0)===0x0){_0x3a8202[_0xe87e('0xaa')]=![];_0x3a8202['available']=0x0;_0x3a8202[_0xe87e('0x44')]=_0xe87e('0xab');loggerSyncQueueSummary[_0xe87e('0x9f')](_0xe87e('0xac'),_0x3a8202[_0xe87e('0x46')],'is\x20not\x20active');}else{_0x3a8202[_0xe87e('0x44')]=_0xe87e('0xad');loggerSyncQueueSummary[_0xe87e('0x9f')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x3a8202['name'],_0xe87e('0xae'));}emitVoiceQueueSummary(_0x3a8202);}}function notSendMessagesCampaign(_0x4cb66d){if(_0x4cb66d[_0xe87e('0xaa')]){if(_0x4cb66d['originated']===0x0){_0x4cb66d[_0xe87e('0xaa')]=![];_0x4cb66d[_0xe87e('0x44')]='NOT_ACTIVE';loggerSyncQueueSummary[_0xe87e('0x9f')](_0xe87e('0xaf'),_0x4cb66d[_0xe87e('0x46')],'is\x20not\x20active');}else{_0x4cb66d['message']='IS_DISACTIVED';loggerSyncQueueSummary['error'](_0xe87e('0xaf'),_0x4cb66d[_0xe87e('0x46')],'is\x20disactive');}emitCampaignSummary(_0x4cb66d);}}function createObjHistory(_0x293d6f,_0x3d64a6,_0xd6c87a,_0x27899f,_0x203e28){_0x293d6f[_0xe87e('0x44')]=_0xd6c87a;var _0x2d264d=new Action(_0x293d6f,_0x3d64a6);var _0x3a36d2=new History(_0x2d264d);_0x3a36d2[_0xe87e('0xb0')]=_0x27899f;_0x3a36d2[_0xe87e('0xb1')]=_0x203e28;_0x3a36d2[_0xe87e('0xb2')]=_0x2d264d['starttime'];return _0x3a36d2;}Dialer[_0xe87e('0x1e')][_0xe87e('0x42')]=function(){var _0x3d8079=this;setInterval(function(){_0x3d8079[_0xe87e('0xb3')](_0x3d8079[_0xe87e('0xb4')],_0xe87e('0xb5'));_0x3d8079[_0xe87e('0xb3')](_0x3d8079[_0xe87e('0x2a')],'[actions]');},0x32c8);};Dialer['prototype'][_0xe87e('0xb3')]=function(_0x4f5744,_0x71ec7d){var _0x367c49=this;for(var _0x393e3b in _0x4f5744){if(_0x4f5744[_0xe87e('0xa3')](_0x393e3b)){this[_0xe87e('0x22')]['enqueue'](function(){if(!_[_0xe87e('0xb6')](_0x4f5744[_0x393e3b])){return ami[_0xe87e('0xb7')]({'action':_0xe87e('0xb8'),'channel':_0x4f5744[_0x393e3b][_0xe87e('0xb9')]})[_0xe87e('0xba')](function(_0x4bd511){if(_0x4bd511[_0xe87e('0x44')]===_0xe87e('0xbb')){setTimeout(function(){if(_0x4f5744[_0x393e3b]&&_0x4f5744[_0x393e3b][_0xe87e('0x84')]!=='ivr'){_0x367c49[_0xe87e('0xbc')](_0x367c49[_0xe87e('0x24')][_0x4f5744[_0x393e3b][_0xe87e('0xbd')]]);logger[_0xe87e('0x9f')](_0xe87e('0xbe'),_0x71ec7d,_0x393e3b,_0x4f5744[_0x393e3b]['queue']);delete _0x4f5744[_0x393e3b];}if(_0x4f5744[_0x393e3b]&&_0x4f5744[_0x393e3b][_0xe87e('0x84')]===_0xe87e('0x9b')){_0x367c49['updateOriginated'](_0x367c49['campaigns'][_0x4f5744[_0x393e3b][_0xe87e('0xbd')]]);logger[_0xe87e('0x9f')](_0xe87e('0xbf'),_0x71ec7d,_0x393e3b,_0x4f5744[_0x393e3b][_0xe87e('0xbd')]);delete _0x4f5744[_0x393e3b];}},0x2328);}});}});}}};Dialer['prototype'][_0xe87e('0xc0')]=function(_0x12d20f){return BPromise[_0xe87e('0xc1')]()[_0xe87e('0xc2')](cmHopper[_0xe87e('0xc0')](_0x12d20f))['catch'](loggerCatch('[countReScheduled]\x20'));};Dialer[_0xe87e('0x1e')][_0xe87e('0xc3')]=function(_0x362401){return BPromise['resolve']()[_0xe87e('0xc2')](cmHopperBlack[_0xe87e('0xc3')](_0x362401))[_0xe87e('0xba')](loggerCatch('[checkIsBlackList]\x20'));};Dialer['prototype'][_0xe87e('0xc4')]=function(_0x489e1b){return BPromise[_0xe87e('0xc1')]()[_0xe87e('0xc2')](cmHopperBlack[_0xe87e('0xc4')](_0x489e1b))[_0xe87e('0xba')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0xe87e('0x1e')][_0xe87e('0xc5')]=function(_0x32f4d3){return BPromise[_0xe87e('0xc1')]()[_0xe87e('0xc2')](cmHopperHistory['avgHandleTime'](_0x32f4d3))['catch'](loggerCatch(_0xe87e('0xc6')));};Dialer[_0xe87e('0x1e')][_0xe87e('0xc7')]=function(_0x11d9c2){return BPromise[_0xe87e('0xc1')]()[_0xe87e('0xc2')](cmHopper[_0xe87e('0xc7')](_0x11d9c2))[_0xe87e('0xba')](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0xe87e('0x1e')]['unlockContact']=function(_0x35a9b3,_0xa218c,_0x61ad42){return BPromise['resolve']()[_0xe87e('0xc2')](cmHopper[_0xe87e('0xc8')](_0x35a9b3,_0xa218c,_0x61ad42))[_0xe87e('0xba')](loggerCatch(_0xe87e('0xc9')));};Dialer[_0xe87e('0x1e')]['getContactDialer']=function(_0x20357f,_0x35f408,_0x43c7f2,_0x2a972b){return BPromise['resolve']()[_0xe87e('0xc2')](cmHopper[_0xe87e('0xca')](_0x20357f,_0x35f408,_0x43c7f2,_0x2a972b))[_0xe87e('0xba')](loggerCatch(_0xe87e('0xcb')));};Dialer[_0xe87e('0x1e')]['getContactDialerIvr']=function(_0x16f455,_0x34413b,_0x5dea31){return BPromise['resolve']()[_0xe87e('0xc2')](cmHopper[_0xe87e('0xcc')](_0x16f455,_0x34413b,_0x5dea31))['catch'](loggerCatch('[getContactDialer]\x20'));};Dialer[_0xe87e('0x1e')]['getVoiceQueueRtPauses']=function(_0x2283a2){return BPromise[_0xe87e('0xc1')]()[_0xe87e('0xc2')](voiceQueueRt[_0xe87e('0xcd')](_0x2283a2))[_0xe87e('0xba')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0xe87e('0x1e')][_0xe87e('0xce')]=function(_0x2c82b6){return BPromise['resolve']()[_0xe87e('0xc2')](cmHopper[_0xe87e('0xce')](_0x2c82b6))[_0xe87e('0xba')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0xe87e('0x1e')][_0xe87e('0xcf')]=function(_0x5d0a2e){return BPromise[_0xe87e('0xc1')]()[_0xe87e('0xc2')](cmHopperHistory[_0xe87e('0xcf')](_0x5d0a2e))[_0xe87e('0xba')](loggerCatch(_0xe87e('0xd0')));};Dialer[_0xe87e('0x1e')][_0xe87e('0xbc')]=function(_0x4cec1a){if(!_['isUndefined'](_0x4cec1a)&&_0x4cec1a!==null){if(_0x4cec1a[_0xe87e('0xa3')](_0xe87e('0x78'))){if(_0x4cec1a[_0xe87e('0x78')]>0x0){_0x4cec1a[_0xe87e('0x78')]-=0x1;}else{logger[_0xe87e('0x9f')](_0xe87e('0xd1'));}}}else{logger[_0xe87e('0x9f')](_0xe87e('0xd2'));}};Dialer[_0xe87e('0x1e')][_0xe87e('0xd3')]=function(_0x33d83f,_0x1e9bb8){var _0x50f6ad=this;return function(_0x57b2c9){_0x50f6ad[_0xe87e('0xbc')](_0x1e9bb8);logger[_0xe87e('0x9f')](_0x33d83f,util[_0xe87e('0xa0')](_0x57b2c9,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0xe87e('0xd4')]=function(_0x4a91e0,_0x53604d,_0x372a3e){var _0x4ba03b={'state':0x19,'statedesc':'notFound'};this[_0xe87e('0xbc')](_0x53604d);this['saveInDb'](_[_0xe87e('0x98')](_0x4ba03b,_[_0xe87e('0xd5')](_0x372a3e,[_0xe87e('0xd6'),_0xe87e('0xd7'),_0xe87e('0xd8'),_0xe87e('0xd9'),_0xe87e('0xda')])),_0xe87e('0xdb'),_0xe87e('0xdc'));logger[_0xe87e('0x9f')](_0x4a91e0);};Dialer['prototype'][_0xe87e('0xdd')]=function(_0x478649){return _0x478649===_0xe87e('0xde');};Dialer['prototype']['isTrunkReachable']=function(_0x54ea33){return!_[_0xe87e('0x43')](_0x54ea33)&&_0x54ea33&&!_['isUndefined'](_0x54ea33[_0xe87e('0x46')])&&!_[_0xe87e('0x43')](_0x54ea33['active'])&&_0x54ea33['active']&&(this['trunks'][util[_0xe87e('0x81')](_0xe87e('0xdf'),_0x54ea33[_0xe87e('0x46')])][_0xe87e('0xb8')]===_0xe87e('0xe0')||this[_0xe87e('0x27')][util[_0xe87e('0x81')](_0xe87e('0xdf'),_0x54ea33[_0xe87e('0x46')])][_0xe87e('0xb8')]===_0xe87e('0xe1'));};Dialer[_0xe87e('0x1e')][_0xe87e('0xe2')]=function(_0x1683fa,_0x463276,_0x39ea20){this[_0xe87e('0xcf')](_0x1683fa)[_0xe87e('0xba')](loggerCatch(_0x463276));this[_0xe87e('0xce')](_0x1683fa)[_0xe87e('0xba')](loggerCatch(_0x39ea20));};Dialer[_0xe87e('0x1e')][_0xe87e('0x3f')]=function(_0x37013d){var _0x591288=this[_0xe87e('0xb4')][_0x37013d['uniqueid']];var _0x2343fa;if(!_[_0xe87e('0xb6')](_0x37013d)&&!_[_0xe87e('0xb6')](_0x37013d[_0xe87e('0xe3')])&&!_[_0xe87e('0xb6')](_0x37013d['variable'][_0xe87e('0xe4')])&&_0x37013d['exten']==='xcally-motion-dialer'&&_0x591288){if(_0x591288['type']!==_0xe87e('0x9b')&&this[_0xe87e('0x24')][_0x591288['queue']][_0xe87e('0xe5')]&&_0x37013d[_0xe87e('0xe6')]===_0xe87e('0xe7')){delete this['uniqueId'][_0x37013d[_0xe87e('0xe8')]];this['updateOriginated'](this[_0xe87e('0x24')][_0x591288[_0xe87e('0xbd')]]);this['voiceQueues'][_0x591288['queue']][_0xe87e('0x65')]+=0x1;this[_0xe87e('0x24')][_0x591288[_0xe87e('0xbd')]][_0xe87e('0x64')]+=0x1;_0x2343fa=new Hangup(_0x591288,_0x37013d);_0x2343fa['state']=0x12;_0x2343fa[_0xe87e('0xb1')]=_0xe87e('0xe9');_0x2343fa[_0xe87e('0xea')]=_0xe87e('0xeb');this[_0xe87e('0xe2')](_0x2343fa,_0xe87e('0xec'),_0xe87e('0xed'));}if(_0x591288[_0xe87e('0x84')]!==_0xe87e('0x9b')&&this[_0xe87e('0x24')][_0x591288['queue']]['dialAMDActive']&&_0x37013d[_0xe87e('0xe6')]===_0xe87e('0xee')){delete this[_0xe87e('0xb4')][_0x37013d[_0xe87e('0xe8')]];this['updateOriginated'](this[_0xe87e('0x24')][_0x591288[_0xe87e('0xbd')]]);this[_0xe87e('0x24')][_0x591288[_0xe87e('0xbd')]][_0xe87e('0x65')]+=0x1;this['voiceQueues'][_0x591288[_0xe87e('0xbd')]][_0xe87e('0x64')]+=0x1;_0x2343fa=new Hangup(_0x591288,_0x37013d);_0x2343fa[_0xe87e('0xb0')]=0x13;_0x2343fa[_0xe87e('0xb1')]=_0xe87e('0xef');_0x2343fa[_0xe87e('0xea')]='AMD';_0x2343fa[_0xe87e('0xf0')]=!![];this[_0xe87e('0xe2')](_0x2343fa,_0xe87e('0xf1'),_0xe87e('0xf2'));}if(_0x591288[_0xe87e('0x84')]===_0xe87e('0x9b')&&this[_0xe87e('0x25')][_0x591288[_0xe87e('0xbd')]][_0xe87e('0xe5')]&&_0x37013d['value']==='HANGUP'){delete this[_0xe87e('0xb4')][_0x37013d[_0xe87e('0xe8')]];this['updateOriginated'](this['campaigns'][_0x591288[_0xe87e('0xbd')]]);_0x2343fa=new Hangup(_0x591288,_0x37013d);_0x2343fa[_0xe87e('0xb0')]=0x12;_0x2343fa['statedesc']=_0xe87e('0xe9');_0x2343fa[_0xe87e('0xea')]=_0xe87e('0xeb');this[_0xe87e('0xe2')](_0x2343fa,_0xe87e('0xf3'),_0xe87e('0xf4'));}if(_0x591288[_0xe87e('0x84')]===_0xe87e('0x9b')&&this[_0xe87e('0x25')][_0x591288[_0xe87e('0xbd')]][_0xe87e('0xe5')]&&_0x37013d[_0xe87e('0xe6')]==='MACHINE'){delete this[_0xe87e('0xb4')][_0x37013d[_0xe87e('0xe8')]];this[_0xe87e('0xbc')](this[_0xe87e('0x25')][_0x591288[_0xe87e('0xbd')]]);_0x2343fa=new Hangup(_0x591288,_0x37013d);_0x2343fa[_0xe87e('0xb0')]=0x13;_0x2343fa[_0xe87e('0xb1')]='Machine';_0x2343fa['membername']=_0xe87e('0xeb');_0x2343fa[_0xe87e('0xf0')]=!![];this['saveInDb'](_0x2343fa,_0xe87e('0xf5'),_0xe87e('0xf6'));}}};Dialer[_0xe87e('0x1e')][_0xe87e('0x3c')]=function(_0x5ab8b1){var _0xcd4432=this[_0xe87e('0xb4')][_0x5ab8b1[_0xe87e('0xe8')]];var _0x4459e4=this;var _0x152f7d;if(_0xcd4432&&_0xcd4432['type']===_0xe87e('0x9b')){delete this[_0xe87e('0xb4')][_0x5ab8b1['uniqueid']];this[_0xe87e('0xbc')](this[_0xe87e('0x25')][_0xcd4432[_0xe87e('0xbd')]]);this['campaigns'][_0xcd4432[_0xe87e('0xbd')]][_0xe87e('0xf7')]+=0x1;_0x152f7d=new Hangup(_0xcd4432,_0x5ab8b1);this[_0xe87e('0xcf')](_0x152f7d)[_0xe87e('0xba')](loggerCatch(_0xe87e('0xf8')));this['moveContactManagedDialer'](_0x152f7d)[_0xe87e('0xba')](loggerCatch(_0xe87e('0xf9')));}if(_0xcd4432&&_0xcd4432['type']!=='ivr'&&isNotNull(this[_0xe87e('0x24')][_0xcd4432[_0xe87e('0xbd')]][_0xe87e('0xfa')])){delete this[_0xe87e('0xb4')][_0x5ab8b1[_0xe87e('0xe8')]];this[_0xe87e('0xbc')](this[_0xe87e('0x24')][_0xcd4432['queue']]);this[_0xe87e('0x24')][_0xcd4432[_0xe87e('0xbd')]][_0xe87e('0x65')]+=0x1;this[_0xe87e('0x24')][_0xcd4432[_0xe87e('0xbd')]][_0xe87e('0x64')]+=0x1;_0x152f7d=new Hangup(_0xcd4432,_0x5ab8b1);_0x152f7d[_0xe87e('0xb0')]=0x10;_0x152f7d['statedesc']=_0xe87e('0xfb');_0x152f7d[_0xe87e('0xea')]=_0xe87e('0xfc');this['createHistory'](_0x152f7d)[_0xe87e('0xba')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xe87e('0xce')](_0x152f7d)[_0xe87e('0xba')](loggerCatch(_0xe87e('0xf9')));}if(_0xcd4432&&_0xcd4432['type']!==_0xe87e('0x9b')&&!isNotNull(this[_0xe87e('0x24')][_0xcd4432[_0xe87e('0xbd')]][_0xe87e('0xfa')])){delete this[_0xe87e('0xb4')][_0x5ab8b1[_0xe87e('0xe8')]];this[_0xe87e('0xbc')](this['voiceQueues'][_0xcd4432['queue']]);this[_0xe87e('0x24')][_0xcd4432[_0xe87e('0xbd')]][_0xe87e('0x6e')]+=0x1;_0x152f7d=new Hangup(_0xcd4432,_0x5ab8b1);_0x152f7d[_0xe87e('0xb0')]=0xc;_0x152f7d[_0xe87e('0xb1')]=_0x5ab8b1[_0xe87e('0xfd')];_0x152f7d[_0xe87e('0xea')]=_0xe87e('0xfe');this[_0xe87e('0xcf')](_0x152f7d)[_0xe87e('0xba')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xe87e('0xce')](_0x152f7d)[_0xe87e('0xba')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0xe87e('0x1e')][_0xe87e('0x39')]=function(_0x5eb57c){var _0x4a61e2=this[_0xe87e('0xb4')][_0x5eb57c[_0xe87e('0xe8')]];var _0x227629=this;if(this[_0xe87e('0x24')][_0x5eb57c[_0xe87e('0xbd')]]){if(_0x4a61e2&&_0x4a61e2[_0xe87e('0x84')]!==_0xe87e('0x9b')){delete this[_0xe87e('0xb4')][_0x5eb57c[_0xe87e('0xe8')]];this['voiceQueues'][_0x5eb57c[_0xe87e('0xbd')]][_0xe87e('0x65')]+=0x1;var _0x3f865a=new AgentComplete(_0x4a61e2,_0x5eb57c);if(_0x5eb57c[_0xe87e('0xff')]===_0xe87e('0x100')){_0x3f865a[_0xe87e('0x101')]=this['voiceQueues'][_0x5eb57c[_0xe87e('0xbd')]][_0xe87e('0x102')]&&this['voiceQueues'][_0x5eb57c[_0xe87e('0xbd')]]['dialAgiAfterHangupAgent']?moment()[_0xe87e('0x81')](_0xe87e('0x103')):undefined;}this['createHistory'](_0x3f865a)[_0xe87e('0xba')](loggerCatch(_0xe87e('0x104')));this[_0xe87e('0xce')](_0x3f865a)[_0xe87e('0xba')](loggerCatch(_0xe87e('0x105')));}}};Dialer[_0xe87e('0x1e')][_0xe87e('0x32')]=function(_0x2948fc){if(this[_0xe87e('0x24')][_0x2948fc[_0xe87e('0xbd')]]){if(this['uniqueId'][_0x2948fc['uniqueid']]&&this['uniqueId'][_0x2948fc[_0xe87e('0xe8')]][_0xe87e('0x84')]!==_0xe87e('0x9b')){this[_0xe87e('0xbc')](this[_0xe87e('0x24')][_0x2948fc['queue']]);this[_0xe87e('0xb4')][_0x2948fc[_0xe87e('0xe8')]]['answertime']=moment()[_0xe87e('0x81')](_0xe87e('0x103'));}}};Dialer['prototype'][_0xe87e('0x106')]=function(_0xaaffe7){this[_0xe87e('0xcf')](_0xaaffe7)['catch'](loggerCatch(_0xe87e('0x104')));this['moveContactManagedDialer'](_0xaaffe7)[_0xe87e('0xba')](loggerCatch(_0xe87e('0x107')));};Dialer[_0xe87e('0x1e')]['syncQueueCallerAbandon']=function(_0x2d98ab){var _0x11f7a4=this[_0xe87e('0xb4')][_0x2d98ab[_0xe87e('0xe8')]];var _0x5b1784=this;if(this[_0xe87e('0x24')][_0x2d98ab[_0xe87e('0xbd')]]){if(_0x11f7a4&&_0x11f7a4[_0xe87e('0x84')]!==_0xe87e('0x9b')){delete this['uniqueId'][_0x2d98ab[_0xe87e('0xe8')]];this[_0xe87e('0xbc')](this[_0xe87e('0x24')][_0x2d98ab['queue']]);_0x11f7a4['droptime']=moment()[_0xe87e('0x81')]('YYYY-MM-DD\x20HH:mm:ss');var _0x31835a=new QueueCallerAbandon(_0x11f7a4,_0x2d98ab);if(getSeconds(_0x11f7a4['droptime'],_0x11f7a4[_0xe87e('0x108')])>=_0x11f7a4['dialQueueTimeout']){this[_0xe87e('0x24')][_0x2d98ab[_0xe87e('0xbd')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0xe87e('0x24')][_0x2d98ab[_0xe87e('0xbd')]][_0xe87e('0x6b')]+=0x1;this[_0xe87e('0x24')][_0x2d98ab[_0xe87e('0xbd')]][_0xe87e('0x109')]+=0x1;_0x31835a[_0xe87e('0xb0')]=0xa;_0x31835a['statedesc']=_0xe87e('0x10a');_0x31835a[_0xe87e('0x10b')]='TIMEOUT';_0x31835a[_0xe87e('0x101')]=this[_0xe87e('0x24')][_0x2d98ab[_0xe87e('0xbd')]][_0xe87e('0x102')]?moment()[_0xe87e('0x81')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;if(_0x31835a[_0xe87e('0x10c')]>=this[_0xe87e('0x24')][_0x2d98ab['queue']]['dialDropMaxRetry']-0x1){this[_0xe87e('0x106')](_0x31835a);}else{this[_0xe87e('0xc7')]({'active':![],'countdropretry':_0x31835a[_0xe87e('0x10c')]+=0x1,'scheduledat':moment()[_0xe87e('0x10d')](this['voiceQueues'][_0x2d98ab['queue']][_0xe87e('0x10e')],'minutes')[_0xe87e('0x81')](_0xe87e('0x103')),'ContactId':_0x11f7a4['ContactId'],'ListId':_0x11f7a4['ListId'],'VoiceQueueId':_0x11f7a4[_0xe87e('0xd9')]||undefined,'CampaignId':_0x11f7a4['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));}}else{this[_0xe87e('0x24')][_0x2d98ab['queue']][_0xe87e('0x71')]+=0x1;this['voiceQueues'][_0x2d98ab['queue']]['outboundDropCallsDayCallersExit']+=0x1;_0x31835a['state']=0xb;_0x31835a[_0xe87e('0xb1')]=_0xe87e('0x10f');_0x31835a['dropreason']='CALLEREXIT';if(_0x31835a['countabandonedretry']>=this[_0xe87e('0x24')][_0x2d98ab['queue']][_0xe87e('0x110')]-0x1){this[_0xe87e('0x106')](_0x31835a);}else{this[_0xe87e('0xc7')]({'active':![],'countabandonedretry':_0x31835a['countabandonedretry']+=0x1,'scheduledat':moment()['add'](this['voiceQueues'][_0x2d98ab['queue']][_0xe87e('0x111')],'minutes')[_0xe87e('0x81')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x11f7a4[_0xe87e('0xd6')],'ListId':_0x11f7a4[_0xe87e('0xd7')],'VoiceQueueId':_0x11f7a4['VoiceQueueId']||undefined,'CampaignId':_0x11f7a4[_0xe87e('0xda')]||undefined})['catch'](loggerCatch(_0xe87e('0x112')));}}}}};Dialer[_0xe87e('0x1e')][_0xe87e('0x3e')]=function(_0x966bc5){if(this[_0xe87e('0x2a')][_0x966bc5[_0xe87e('0xe8')]]){this[_0xe87e('0x2a')][_0x966bc5[_0xe87e('0xe8')]][_0xe87e('0xb9')]=_0x966bc5[_0xe87e('0xb9')];}if(this[_0xe87e('0xb4')][_0x966bc5[_0xe87e('0xe8')]]){this[_0xe87e('0xb4')][_0x966bc5[_0xe87e('0xe8')]][_0xe87e('0xb9')]=_0x966bc5[_0xe87e('0xb9')];}};Dialer[_0xe87e('0x1e')][_0xe87e('0x113')]=function(_0x4ffa1b){if(strategy[this['voiceQueues'][this['actions'][_0x4ffa1b[_0xe87e('0x114')]][_0xe87e('0xbd')]]['strategy']]===_0xe87e('0x1d')){if(this[_0xe87e('0x2a')][_0x4ffa1b[_0xe87e('0x114')]]&&_[_0xe87e('0xb6')](this[_0xe87e('0x2a')][_0x4ffa1b['actionid']][_0xe87e('0x115')])&&_0x4ffa1b[_0xe87e('0xb8')]==='1'&&_0x4ffa1b[_0xe87e('0x116')]==='0'){if(this['agents'][_0x4ffa1b['stateinterface']]){if(!this['agents'][_0x4ffa1b[_0xe87e('0x117')]][_0xe87e('0x115')]){this[_0xe87e('0x26')][_0x4ffa1b['stateinterface']][_0xe87e('0x115')]=!![];this[_0xe87e('0x2a')][_0x4ffa1b[_0xe87e('0x114')]][_0xe87e('0x115')]=!![];this[_0xe87e('0x2a')][_0x4ffa1b[_0xe87e('0x114')]]['stateinterface']=_0x4ffa1b[_0xe87e('0x117')];}}}}else if((strategy[this[_0xe87e('0x24')][this['actions'][_0x4ffa1b['actionid']][_0xe87e('0xbd')]][_0xe87e('0x53')]]||_0xe87e('0x1c'))==='rrmemory'){if(this[_0xe87e('0x2a')][_0x4ffa1b[_0xe87e('0x114')]]){if(this[_0xe87e('0x26')][_0x4ffa1b[_0xe87e('0x117')]]){this[_0xe87e('0x2a')][_0x4ffa1b['actionid']][_0xe87e('0x117')]=_0x4ffa1b['stateinterface'];if(_[_0xe87e('0xb6')](this[_0xe87e('0x30')][this[_0xe87e('0x2a')][_0x4ffa1b[_0xe87e('0x114')]][_0xe87e('0xbd')]])){this[_0xe87e('0x30')][this[_0xe87e('0x2a')][_0x4ffa1b[_0xe87e('0x114')]][_0xe87e('0xbd')]]=[];}this['queueBooked'][this['actions'][_0x4ffa1b[_0xe87e('0x114')]]['queue']]['push'](_['merge'](_[_0xe87e('0xd5')](this[_0xe87e('0x2a')][_0x4ffa1b[_0xe87e('0x114')]],[_0xe87e('0x118'),'stateinterface']),{'status':_0x4ffa1b[_0xe87e('0xb8')],'paused':_0x4ffa1b[_0xe87e('0x116')]}));}}}};function unlockQueueStatus(_0xf03cb3,_0x2b72ab){setTimeout(function(){if(_['isUndefined'](_0xf03cb3[_0xe87e('0x119')])){loggerBooked[_0xe87e('0x9f')](_0xe87e('0x11a'),_0x2b72ab);}_0xf03cb3['queueStatusComplete']=!![];loggerBooked[_0xe87e('0x88')](_0xe87e('0x11b'),_0x2b72ab,JSON[_0xe87e('0x4e')](_[_0xe87e('0xd5')](_0xf03cb3,['name',_0xe87e('0x119')])));},0x1f3);}Dialer[_0xe87e('0x1e')]['syncQueueStatusComplete']=function(_0x40da7f){var _0x1b4aca=this;var _0x47198b=_0x1b4aca[_0xe87e('0x24')][_0x1b4aca['actions'][_0x40da7f[_0xe87e('0x114')]][_0xe87e('0xbd')]];if(strategy[this[_0xe87e('0x24')][this[_0xe87e('0x2a')][_0x40da7f[_0xe87e('0x114')]][_0xe87e('0xbd')]][_0xe87e('0x53')]]===_0xe87e('0x1d')){if(this[_0xe87e('0x2a')][_0x40da7f[_0xe87e('0x114')]]&&this[_0xe87e('0x2a')][_0x40da7f[_0xe87e('0x114')]][_0xe87e('0x117')]){this['preview'][_0xe87e('0x11c')](this[_0xe87e('0x2a')][_0x40da7f[_0xe87e('0x114')]]['idHopper'],this[_0xe87e('0x2a')][_0x40da7f[_0xe87e('0x114')]][_0xe87e('0x117')])[_0xe87e('0xba')](function(_0x51deca){logger[_0xe87e('0x9f')]('[Catch][Preview][syncQueueStatusComplete]',util[_0xe87e('0xa0')](_0x51deca,{'showHidden':![],'depth':null}));})[_0xe87e('0x21')](function(){_0x1b4aca[_0xe87e('0xbc')](_0x1b4aca['voiceQueues'][_0x1b4aca[_0xe87e('0x2a')][_0x40da7f[_0xe87e('0x114')]][_0xe87e('0xbd')]]);_0x1b4aca['agents'][_0x1b4aca[_0xe87e('0x2a')][_0x40da7f[_0xe87e('0x114')]]['stateinterface']]['locked']=![];delete _0x1b4aca[_0xe87e('0x2a')][_0x40da7f[_0xe87e('0x114')]];unlockQueueStatus(_0x47198b);});}else{this['updateOriginated'](this['voiceQueues'][this[_0xe87e('0x2a')][_0x40da7f[_0xe87e('0x114')]][_0xe87e('0xbd')]]);this[_0xe87e('0xc7')]({'active':![],'ContactId':this['actions'][_0x40da7f[_0xe87e('0x114')]][_0xe87e('0xd6')],'ListId':this[_0xe87e('0x2a')][_0x40da7f[_0xe87e('0x114')]]['ListId'],'VoiceQueueId':this[_0xe87e('0x2a')][_0x40da7f[_0xe87e('0x114')]][_0xe87e('0xd9')]||undefined,'CampaignId':this[_0xe87e('0x2a')][_0x40da7f[_0xe87e('0x114')]][_0xe87e('0xda')]||undefined})[_0xe87e('0xba')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0xe87e('0x2a')][_0x40da7f[_0xe87e('0x114')]];unlockQueueStatus(_0x47198b);}}else if((strategy[this[_0xe87e('0x24')][this[_0xe87e('0x2a')][_0x40da7f[_0xe87e('0x114')]][_0xe87e('0xbd')]][_0xe87e('0x53')]]||_0xe87e('0x1c'))===_0xe87e('0x1c')){var _0x3851b6;if(this[_0xe87e('0x2a')][_0x40da7f[_0xe87e('0x114')]]&&!_[_0xe87e('0x87')](this[_0xe87e('0x30')][this[_0xe87e('0x2a')][_0x40da7f[_0xe87e('0x114')]][_0xe87e('0xbd')]])){if(this[_0xe87e('0x31')][_0x1b4aca['actions'][_0x40da7f['actionid']]['queue']]){this['queueBookedRR'][_0x1b4aca['actions'][_0x40da7f[_0xe87e('0x114')]][_0xe87e('0xbd')]]=this[_0xe87e('0x31')][this[_0xe87e('0x2a')][_0x40da7f[_0xe87e('0x114')]][_0xe87e('0xbd')]]?this[_0xe87e('0x31')][this[_0xe87e('0x2a')][_0x40da7f[_0xe87e('0x114')]][_0xe87e('0xbd')]]:this[_0xe87e('0x30')][this[_0xe87e('0x2a')][_0x40da7f[_0xe87e('0x114')]][_0xe87e('0xbd')]]?this[_0xe87e('0x30')][this[_0xe87e('0x2a')][_0x40da7f[_0xe87e('0x114')]][_0xe87e('0xbd')]][_0xe87e('0x11d')]||0x0:0x0;}this[_0xe87e('0x30')][this[_0xe87e('0x2a')][_0x40da7f[_0xe87e('0x114')]][_0xe87e('0xbd')]][_0xe87e('0x11d')]=this[_0xe87e('0x31')][this['actions'][_0x40da7f[_0xe87e('0x114')]][_0xe87e('0xbd')]];for(var _0x2d703c=0x0;_0x2d703c=0x0?!![]:![];})[_0xe87e('0xba')](myreject(_0x4719c4)));}}else{_0x561526[_0xe87e('0x138')](ami[_0xe87e('0xb7')]({'action':_0xe87e('0x139'),'command':util[_0xe87e('0x81')](_0xe87e('0x13a'),_0x4d3df8,!_[_0xe87e('0x43')](config['timezones'][_0x52a034])?_0x52a034:'')})[_0xe87e('0xc2')](function(_0x223803){return _0x223803[_0xe87e('0x13d')][_0xe87e('0x13c')](_0xe87e('0x13e'))>=0x0?!![]:![];})[_0xe87e('0xba')](myreject(_0x4719c4)));}BPromise[_0xe87e('0x13f')](_0x561526)['then'](function(_0x4afa95){var _0x283a6b=_[_0xe87e('0x140')](_0x4afa95);if(_0x283a6b){return _0x218e78(_0x283a6b);}else{_0x4a5f31[_0xe87e('0x44')]=_0x1b1f06?_0xe87e('0x141'):_0xe87e('0x142');return _0x4719c4(msgResponse(_0xe87e('0x143'),_0xe87e('0x131'),_0xe87e('0x144')+_0x1b1f06+'\x20'+_0x3ca92c+_0xe87e('0x145')+util['inspect'](_0x4d3df8,{'showHidden':![],'depth':null})+_0xe87e('0x146')+_0x52a034));}})[_0xe87e('0xba')](function(_0x4b2088){return _0x4719c4(msgResponse('ifTime',_0xe87e('0x131'),JSON[_0xe87e('0x4e')](_0x4b2088)));});});};Dialer[_0xe87e('0x1e')][_0xe87e('0x147')]=function(_0x395618){var _0x5ec5d8=this;return function(){switch(_0x395618['dialMethod']){case _0xe87e('0x148'):freeVariablesPredictive(_0x395618);_0x5ec5d8['handlePower'](_0x395618,0x1);break;case'power':freeVariablesPredictive(_0x395618);_0x5ec5d8[_0xe87e('0x149')](_0x395618,_0x395618[_0xe87e('0x14a')]);break;case'predictive':_0x5ec5d8[_0xe87e('0x9')](_0x395618);break;case _0xe87e('0x8'):freeVariablesPredictive(_0x395618);_0x5ec5d8[_0xe87e('0x149')](_0x395618,0x1);break;default:freeVariablesPredictive(_0x395618);logger[_0xe87e('0x9f')](_0xe87e('0x14b'),_0x395618[_0xe87e('0x46')],_0xe87e('0x14c'));}};};Dialer[_0xe87e('0x1e')][_0xe87e('0x14d')]=function(_0x4c2aeb){var _0x14dcb0=this;return function(){_0x14dcb0[_0xe87e('0x14e')](_0x4c2aeb);};};Dialer['prototype'][_0xe87e('0xb')]=function(_0xf8c209){var _0xff950a=this;if(isNotPreview(_0xf8c209[_0xe87e('0x14f')])){if(isVoiceQueueOutbound(_0xf8c209['type'])&&isActive(_0xf8c209[_0xe87e('0x5f')])){_0xf8c209[_0xe87e('0xaa')]=!![];BPromise['resolve']()[_0xe87e('0xc2')](checkIsLoggedIn(_0xf8c209,_0xf8c209['loggedIn']))[_0xe87e('0xc2')](checkIsActive(_0xf8c209,_0xf8c209['dialActive']))[_0xe87e('0xc2')](checkInterval(_0xf8c209))['then'](_0xff950a['checkIsTrunkReachable'](_0xf8c209))[_0xe87e('0xc2')](_0xff950a['checkIfTime'](_0xf8c209[_0xe87e('0x150')],_0xf8c209[_0xe87e('0x151')],_0xf8c209[_0xe87e('0x46')],_0xf8c209))[_0xe87e('0xc2')](_0xff950a[_0xe87e('0x130')](_0xf8c209[_0xe87e('0x48')],_0xf8c209['dialTimezone'],_0xf8c209[_0xe87e('0x46')],_0xf8c209))[_0xe87e('0xc2')](_0xff950a[_0xe87e('0x147')](_0xf8c209))[_0xe87e('0xba')](loggerCatchQueueSummary(_0xe87e('0x152'),_0xf8c209));}else{notSendMessagesQueue(_0xf8c209);}}else{freeVariablesPredictive(_0xf8c209);}};Dialer[_0xe87e('0x1e')][_0xe87e('0x129')]=function(){var _0x35ad7b=this;var _0x1fe966;for(var _0x46a311 in this[_0xe87e('0x25')]){if(this['campaigns'][_0xe87e('0xa3')](_0x46a311)){_0x1fe966=this['campaigns'][_0x46a311];if(isCampaignIvr(_0x1fe966[_0xe87e('0x84')])&&isActive(_0x1fe966['active'])){_0x1fe966['sendMessageOneNotActive']=!![];BPromise[_0xe87e('0xc1')]()[_0xe87e('0xc2')](checkIsActive(_0x1fe966,_0x1fe966['active']))[_0xe87e('0xc2')](checkInterval(_0x1fe966))[_0xe87e('0xc2')](_0x35ad7b['checkIsTrunkReachable'](_0x1fe966))[_0xe87e('0xc2')](_0x35ad7b['checkIfTime'](_0x1fe966['dialGlobalInterval'],_0x1fe966[_0xe87e('0x151')],_0x1fe966[_0xe87e('0x46')],_0x1fe966))[_0xe87e('0xc2')](_0x35ad7b[_0xe87e('0x130')](_0x1fe966[_0xe87e('0x48')],_0x1fe966['dialTimezone'],_0x1fe966[_0xe87e('0x46')],_0x1fe966))['then'](_0x35ad7b[_0xe87e('0x14d')](_0x1fe966))[_0xe87e('0xba')](loggerCatchQueueSummary(_0xe87e('0x153'),_0x1fe966));}else{notSendMessagesCampaign(_0x1fe966);}}}};function getCallerIdRandom(_0x497f05,_0x341c4a){var _0x47f62e,_0x3eb644,_0x24a39b;if(_0x341c4a<=0x0){_0x341c4a=0x1;}_0x47f62e=new RegExp('\x5cw{0,'+_0x341c4a+'}$');_0x3eb644=Math[_0xe87e('0x154')](0xa,_0x341c4a-0x1);_0x24a39b=Math[_0xe87e('0x154')](0xa,_0x341c4a)-0x1;return util[_0xe87e('0x81')]('%s',_[_0xe87e('0x155')](_0x497f05,_0x47f62e,_[_0xe87e('0x156')](_0x3eb644,_0x24a39b)));}function extractCalleridName(_0x42bb05){var _0x210e35=_0x42bb05['match'](/"(.*?)"/);return _0x210e35?_0x210e35[0x1]:_0x42bb05;}function extractCalleridNumber(_0x2a4af3){var _0x403c45=_0x2a4af3[_0xe87e('0x157')](/<(.*?)>/);return _0x403c45?_0x403c45[0x1]:_0x2a4af3;}Dialer['prototype'][_0xe87e('0x158')]=function(_0x30d275,_0x1780c0){var _0xdf99d5=this;var _0x28118e=uuid['v4']();this[_0xe87e('0x2a')][_0x28118e]=new Action(_0x30d275,_0x1780c0,_0x28118e);return new BPromise(function(_0x261e49,_0x57f884){if(_[_0xe87e('0x43')](_0x30d275)&&'object'!==typeof _0x30d275){return _0x57f884(msgResponse(_0xe87e('0x159'),_0xe87e('0x131'),_0xe87e('0x15a')));}if(_[_0xe87e('0x43')](_0x1780c0[_0xe87e('0x15b')][_0xe87e('0x15c')])||_0x1780c0[_0xe87e('0x15b')][_0xe87e('0x15c')]===null){return _0x57f884(msgResponse(_0xe87e('0x159'),_0xe87e('0x131'),_0xe87e('0x15d')));}var _0x255df7={'XMD-CALLERID':_0xdf99d5[_0xe87e('0x2a')][_0x28118e][_0xe87e('0x15e')](),'XMD-AGI':_0x30d275[_0xe87e('0xfa')]?util[_0xe87e('0x81')](_0xe87e('0x15f'),ipAgi,_0x30d275[_0xe87e('0xfa')]):_0xe87e('0x160'),'XMD-AGIAFTER':_0x30d275[_0xe87e('0x102')]?util[_0xe87e('0x81')](_0xe87e('0x15f'),ipAgi,_0x30d275[_0xe87e('0x102')]):'NONE','XMD-QUEUE':_0x30d275['type']===_0xe87e('0x52')?util[_0xe87e('0x81')](_0xe87e('0x161'),_0x30d275[_0xe87e('0x46')],_0x30d275['dialQueueOptions']||'',_0x30d275[_0xe87e('0x162')]?'c':'',_0x30d275[_0xe87e('0x163')]||0x3):_0xe87e('0x160'),'XMD-CONTACTID':_0x1780c0[_0xe87e('0xd6')],'XMD-CDRTYPE':_0xe87e('0x7'),'CALLERID(all)':_0xdf99d5[_0xe87e('0x2a')][_0x28118e]['getCaller'](),'XMD-AMD':_0x30d275[_0xe87e('0xe5')]?_0xe87e('0x164'):_0xe87e('0x160'),'XMD-DESTINATION':_0xe87e('0x165')};if(_0x30d275[_0xe87e('0xe5')]){_0x255df7[_0xe87e('0x166')]=_0x30d275[_0xe87e('0x167')]||0x9c4;_0x255df7[_0xe87e('0x168')]=_0x30d275[_0xe87e('0x169')]||0x5dc;_0x255df7[_0xe87e('0x16a')]=_0x30d275[_0xe87e('0x16b')]||0x320;_0x255df7[_0xe87e('0x16c')]=_0x30d275[_0xe87e('0x16d')]||0x1388;_0x255df7['XMD-AMDMINWORDLENGTH']=_0x30d275[_0xe87e('0x16e')]||0x64;_0x255df7[_0xe87e('0x16f')]=_0x30d275['dialAMDBetweenWordsSilence']||0x32;_0x255df7[_0xe87e('0x170')]=_0x30d275['dialAMDMaximumNumberOfWords']||0x3;_0x255df7['XMD-AMDSILENCETHRESHOLD']=_0x30d275['dialAMDSilenceThreshold']||0x100;_0x255df7[_0xe87e('0x171')]=_0x30d275[_0xe87e('0x172')]||0x1388;}if(_0x30d275[_0xe87e('0x84')]==='outbound'){_0x255df7['XMD-VOICEQUEUEID']=_0x1780c0[_0xe87e('0xd9')];}else{_0x255df7[_0xe87e('0x173')]=_0x1780c0[_0xe87e('0xda')];}for(var _0x5d2229 in _0x1780c0[_0xe87e('0x15b')]){if(_0x1780c0[_0xe87e('0x15b')][_0xe87e('0xa3')](_0x5d2229)){if(isNotNull(_0x1780c0[_0xe87e('0x15b')][_0x5d2229])&&_0x5d2229!=='id'&&_0x5d2229!==_0xe87e('0x174')&&_0x5d2229!==_0xe87e('0x175')&&_0x5d2229!==_0xe87e('0x176')){_0x255df7[util[_0xe87e('0x81')](_0xe87e('0x177'),_0xe87e('0x178'),_[_0xe87e('0x179')](_0x5d2229))]=_0x1780c0[_0xe87e('0x15b')][_0x5d2229];}}}var _0x51a814=_0xdf99d5['isTrunkReachable'](_0x30d275['Trunk'])?getCallerId(_0x30d275['Trunk']['callerid'],_0x30d275['dialOriginateCallerIdName'],_0x30d275[_0xe87e('0x17a')]>0x0?getCallerIdRandom(_0x30d275[_0xe87e('0x61')],_0x30d275[_0xe87e('0x17a')]):_0x30d275['dialOriginateCallerIdNumber']):getCallerId(_[_0xe87e('0xb6')](_0x30d275[_0xe87e('0x12c')])?_0x30d275[_0xe87e('0x7d')]['callerid']:_0x30d275[_0xe87e('0x12c')][_0xe87e('0x7f')],_0x30d275[_0xe87e('0x60')],_0x30d275[_0xe87e('0x17a')]>0x0?getCallerIdRandom(_0x30d275['dialOriginateCallerIdNumber'],_0x30d275['dialRandomLastDigitCallerIdNumber']):_0x30d275[_0xe87e('0x61')]);if(_0x51a814){_0x255df7[_0xe87e('0x17b')]=_0xdf99d5[_0xe87e('0x2a')][_0x28118e][_0xe87e('0x17c')]=extractCalleridName(_0x51a814);_0x255df7['XMD-ORIGINATECALLERIDNUM']=_0xdf99d5[_0xe87e('0x2a')][_0x28118e][_0xe87e('0x17d')]=extractCalleridNumber(_0x51a814);}return ami[_0xe87e('0xb7')]({'actionid':_0x28118e,'action':_0xe87e('0x159'),'channel':_0xdf99d5[_0xe87e('0x12b')](_0x30d275[_0xe87e('0x7d')])?util[_0xe87e('0x81')](_0xe87e('0x17e'),_0x30d275[_0xe87e('0x7d')][_0xe87e('0x46')],isNotNull(_0x30d275[_0xe87e('0x63')])?_0x30d275[_0xe87e('0x63')][_0xe87e('0x17f')]()||'':'',_0x30d275[_0xe87e('0x180')]>0x0?_0x1780c0[_0xe87e('0x15b')][_0xe87e('0x15c')][_0xe87e('0x181')](_0x30d275[_0xe87e('0x180')]):_0x1780c0[_0xe87e('0x15b')]['phone']):util[_0xe87e('0x81')]('SIP/%s/%s%s',_['isNil'](_0x30d275[_0xe87e('0x12c')])?_0x30d275[_0xe87e('0x7d')][_0xe87e('0x46')]:_0x30d275['TrunkBackup'][_0xe87e('0x46')],isNotNull(_0x30d275['dialPrefix'])?_0x30d275[_0xe87e('0x63')]['trim']()||'':'',_0x30d275['dialCutDigit']>0x0?_0x1780c0[_0xe87e('0x15b')][_0xe87e('0x15c')]['substring'](_0x30d275['dialCutDigit']):_0x1780c0['Contact'][_0xe87e('0x15c')]),'callerid':_0x51a814,'Exten':'xcally-motion-dialer','Context':'from-sip','Priority':'1','variable':_0x255df7,'timeout':(_0x30d275[_0xe87e('0x62')]||0x1e)*0x3e8,'async':!![],'channelid':_0x28118e})[_0xe87e('0xc2')](function(_0xc2b3a8){return _0x261e49(_0xc2b3a8);})[_0xe87e('0xba')](function(_0xcd6642){_0x30d275[_0xe87e('0x182')]+=0x1;var _0x4d7f1f=new History(_0xdf99d5[_0xe87e('0x2a')][_0x28118e]);logger[_0xe87e('0x9f')](util[_0xe87e('0x81')](_0xe87e('0x183'),JSON[_0xe87e('0x4e')](_0xcd6642)));_0x4d7f1f[_0xe87e('0xb0')]=0xe;_0x4d7f1f[_0xe87e('0xb1')]=_0xe87e('0x184');_0x4d7f1f[_0xe87e('0x185')]=moment()[_0xe87e('0x81')]('YYYY-MM-DD\x20HH:mm:ss');_0x4d7f1f[_0xe87e('0xb2')]=_0x4d7f1f[_0xe87e('0x185')];_0xdf99d5[_0xe87e('0xcf')](_0x4d7f1f)['catch'](loggerCatch(_0xe87e('0x186')));_0xdf99d5[_0xe87e('0xce')](_0x4d7f1f)['catch'](loggerCatch(_0xe87e('0x186')))[_0xe87e('0x21')](function(){delete _0xdf99d5[_0xe87e('0x2a')][_0x28118e];return _0x57f884(msgResponse(_0xe87e('0x159'),'Error',_0xe87e('0x187')));});});});};Dialer['prototype']['syncOriginateResponse']=function(_0x5b015c){var _0x52d000=this['actions'][_0x5b015c[_0xe87e('0x114')]];var _0x42d7b5=this;if(_0x52d000){delete this[_0xe87e('0x2a')][_0x5b015c[_0xe87e('0x114')]];_0x52d000[_0xe87e('0x108')]=moment()['format'](_0xe87e('0x103'));var _0x4fd35f=_0x52d000[_0xe87e('0x84')]==='ivr'?this[_0xe87e('0x25')][_0x52d000[_0xe87e('0xbd')]]:this['voiceQueues'][_0x52d000['getQueue']()];if(!this[_0xe87e('0xdd')](_0x5b015c[_0xe87e('0x188')])){this[_0xe87e('0xbc')](_0x4fd35f);return this[_0xe87e('0x189')](_0x52d000,_0x4fd35f,_0x5b015c)[_0xe87e('0xc2')](function(_0x4e5551){})[_0xe87e('0xba')](loggerCatch('[callProgressDetecting]\x20'));}else{this[_0xe87e('0xb4')][_0x5b015c[_0xe87e('0xe8')]]=_0x52d000;}}};Dialer['prototype'][_0xe87e('0x18a')]=function(_0x4f5102,_0x2d17e5,_0x3a7c10){var _0x42f9f4=new History(_0x2d17e5);if(_0x42f9f4[_0xe87e('0x18b')]+_0x42f9f4[_0xe87e('0x18c')]+_0x42f9f4[_0xe87e('0x18d')]+_0x42f9f4[_0xe87e('0x18e')]+_0x42f9f4['countdropretry']+_0x42f9f4[_0xe87e('0x18f')]+_0x42f9f4[_0xe87e('0x190')]+_0x42f9f4[_0xe87e('0x191')]>=_0x3a7c10[_0xe87e('0x192')]-0x1){return!![];}switch(_0x4f5102){case 0x3:if(_0x42f9f4['countnoanswerretry']>=_0x3a7c10[_0xe87e('0x193')]-0x1){return!![];}else{this[_0xe87e('0xc7')]({'active':![],'countnoanswerretry':_0x42f9f4[_0xe87e('0x18d')]+=0x1,'scheduledat':moment()[_0xe87e('0x10d')](_0x3a7c10[_0xe87e('0x194')],_0xe87e('0x195'))[_0xe87e('0x81')](_0xe87e('0x103')),'ContactId':_0x42f9f4['ContactId'],'ListId':_0x42f9f4[_0xe87e('0xd7')],'VoiceQueueId':_0x42f9f4[_0xe87e('0xd9')]||undefined,'CampaignId':_0x42f9f4[_0xe87e('0xda')]||undefined})[_0xe87e('0xba')](loggerCatch('[rescheduleContact][NoAnswer]'));}break;case 0x5:if(_0x42f9f4[_0xe87e('0x18b')]>=_0x3a7c10['dialBusyMaxRetry']-0x1){return!![];}else{this[_0xe87e('0xc7')]({'active':![],'countbusyretry':_0x42f9f4[_0xe87e('0x18b')]+=0x1,'scheduledat':moment()[_0xe87e('0x10d')](_0x3a7c10[_0xe87e('0x196')],_0xe87e('0x195'))['format'](_0xe87e('0x103')),'ContactId':_0x42f9f4['ContactId'],'ListId':_0x42f9f4[_0xe87e('0xd7')],'VoiceQueueId':_0x42f9f4['VoiceQueueId']||undefined,'CampaignId':_0x42f9f4[_0xe87e('0xda')]||undefined})['catch'](loggerCatch(_0xe87e('0x197')));}break;case 0x8:if(_0x42f9f4[_0xe87e('0x18c')]>=_0x3a7c10[_0xe87e('0x198')]-0x1){return!![];}else{this[_0xe87e('0xc7')]({'active':![],'countcongestionretry':_0x42f9f4['countcongestionretry']+=0x1,'scheduledat':moment()['add'](_0x3a7c10[_0xe87e('0x199')],_0xe87e('0x195'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x42f9f4[_0xe87e('0xd6')],'ListId':_0x42f9f4[_0xe87e('0xd7')],'VoiceQueueId':_0x42f9f4[_0xe87e('0xd9')]||undefined,'CampaignId':_0x42f9f4[_0xe87e('0xda')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Congestion]'));}break;case 0x0:if(_0x42f9f4[_0xe87e('0x18e')]>=_0x3a7c10[_0xe87e('0x19a')]-0x1){return!![];}else{this[_0xe87e('0xc7')]({'active':![],'countnosuchnumberretry':_0x42f9f4[_0xe87e('0x18e')]+=0x1,'scheduledat':moment()[_0xe87e('0x10d')](_0x3a7c10[_0xe87e('0x19b')],_0xe87e('0x195'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x42f9f4['ContactId'],'ListId':_0x42f9f4[_0xe87e('0xd7')],'VoiceQueueId':_0x42f9f4[_0xe87e('0xd9')]||undefined,'CampaignId':_0x42f9f4[_0xe87e('0xda')]||undefined})['catch'](loggerCatch(_0xe87e('0x19c')));}break;case 0xa:if(_0x42f9f4[_0xe87e('0x10c')]>=_0x3a7c10[_0xe87e('0x19d')]-0x1){return!![];}else{this[_0xe87e('0xc7')]({'active':![],'countdropretry':_0x42f9f4[_0xe87e('0x10c')]+=0x1,'scheduledat':moment()['add'](_0x3a7c10[_0xe87e('0x10e')],'minutes')[_0xe87e('0x81')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x42f9f4[_0xe87e('0xd6')],'ListId':_0x42f9f4[_0xe87e('0xd7')],'VoiceQueueId':_0x42f9f4[_0xe87e('0xd9')]||undefined,'CampaignId':_0x42f9f4[_0xe87e('0xda')]||undefined})[_0xe87e('0xba')](loggerCatch('[rescheduleContact][Drop]'));}break;case 0xb:if(_0x42f9f4[_0xe87e('0x18f')]>=_0x3a7c10[_0xe87e('0x110')]-0x1){return!![];}else{this[_0xe87e('0xc7')]({'active':![],'countabandonedretry':_0x42f9f4[_0xe87e('0x18f')]+=0x1,'scheduledat':moment()['add'](_0x3a7c10[_0xe87e('0x111')],_0xe87e('0x195'))[_0xe87e('0x81')](_0xe87e('0x103')),'ContactId':_0x42f9f4[_0xe87e('0xd6')],'ListId':_0x42f9f4[_0xe87e('0xd7')],'VoiceQueueId':_0x42f9f4['VoiceQueueId']||undefined,'CampaignId':_0x42f9f4['CampaignId']||undefined})[_0xe87e('0xba')](loggerCatch(_0xe87e('0x112')));}break;case 0x13:if(_0x42f9f4[_0xe87e('0x190')]>=_0x3a7c10['dialMachineMaxRetry']-0x1){return!![];}else{this[_0xe87e('0xc7')]({'active':![],'countmachineretry':_0x42f9f4[_0xe87e('0x190')]+=0x1,'scheduledat':moment()[_0xe87e('0x10d')](_0x3a7c10['dialMachineRetryFrequency'],_0xe87e('0x195'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x42f9f4[_0xe87e('0xd6')],'ListId':_0x42f9f4[_0xe87e('0xd7')],'VoiceQueueId':_0x42f9f4[_0xe87e('0xd9')]||undefined,'CampaignId':_0x42f9f4[_0xe87e('0xda')]||undefined})['catch'](loggerCatch(_0xe87e('0x19e')));}break;case 0x14:if(_0x42f9f4[_0xe87e('0x191')]>=_0x3a7c10[_0xe87e('0x19f')]-0x1){return!![];}else{this[_0xe87e('0xc7')]({'active':![],'countagentrejectretry':_0x42f9f4[_0xe87e('0x191')]+=0x1,'scheduledat':moment()[_0xe87e('0x10d')](_0x3a7c10['dialAgentRejectRetryFrequency'],'minutes')[_0xe87e('0x81')](_0xe87e('0x103')),'ContactId':_0x42f9f4['ContactId'],'ListId':_0x42f9f4['ListId'],'VoiceQueueId':_0x42f9f4[_0xe87e('0xd9')]||undefined,'CampaignId':_0x42f9f4[_0xe87e('0xda')]||undefined})[_0xe87e('0xba')](loggerCatch(_0xe87e('0x1a0')));}break;default:return!![];}};Dialer[_0xe87e('0x1e')][_0xe87e('0x189')]=function(_0x288699,_0x1773be,_0x25f14e){var _0x1e3b04=this;var _0x80da5d=new History(_0x288699);return new BPromise(function(_0x227066,_0x2ed9f0){if(_[_0xe87e('0x43')](_0x1773be)&&_0xe87e('0x1a1')!==typeof _0x1773be){return _0x2ed9f0(msgResponse(_0xe87e('0x1a2'),_0xe87e('0x131'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0x25f14e)&&_0xe87e('0x1a1')!==typeof _0x25f14e){return _0x2ed9f0(msgResponse(_0xe87e('0x1a2'),_0xe87e('0x131'),_0xe87e('0x1a3')));}switch(_0x25f14e[_0xe87e('0xff')]){case'0':_0x1773be[_0xe87e('0x1a4')]+=0x1;_0x80da5d[_0xe87e('0xb0')]=0x0;_0x80da5d[_0xe87e('0xb1')]=_0xe87e('0x1a5');_0x1e3b04[_0xe87e('0xcf')](_0x80da5d)[_0xe87e('0xba')](loggerCatch(_0xe87e('0x1a6')));if(_0x1e3b04[_0xe87e('0x18a')](0x0,_0x288699,_0x1773be)){if(_0x80da5d[_0xe87e('0x18b')]+_0x80da5d[_0xe87e('0x18c')]+_0x80da5d['countnoanswerretry']+_0x80da5d['countnosuchnumberretry']+_0x80da5d[_0xe87e('0x10c')]+_0x80da5d[_0xe87e('0x18f')]+_0x80da5d[_0xe87e('0x190')]+_0x80da5d['countagentrejectretry']>=_0x1773be['dialGlobalMaxRetry']){_0x1e3b04[_0xe87e('0x1a7')](_0x80da5d,_0x227066,_0x2ed9f0,_0xe87e('0x1a8'));}else{_0x1e3b04['createStateFinal'](_0x80da5d,_0x227066,_0x2ed9f0,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x1773be[_0xe87e('0x6c')]+=0x1;_0x80da5d[_0xe87e('0xb0')]=0x3;_0x80da5d[_0xe87e('0xb1')]=_0xe87e('0x1a9');_0x80da5d[_0xe87e('0x18d')]+=0x1;_0x80da5d['countglobal']+=0x1;_0x1e3b04['createHistory'](_0x80da5d)[_0xe87e('0xba')](loggerCatch(_0xe87e('0x1aa')));if(_0x1e3b04[_0xe87e('0x18a')](0x3,_0x288699,_0x1773be)){if(_0x80da5d[_0xe87e('0x18d')]>=_0x1773be[_0xe87e('0x193')]){_0x1e3b04[_0xe87e('0x1ab')](_0x80da5d,_0x227066,_0x2ed9f0,'reason\x203\x20ringing\x20no\x20answer');}else{_0x1e3b04[_0xe87e('0x1a7')](_0x80da5d,_0x227066,_0x2ed9f0,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x1773be[_0xe87e('0x67')]+=0x1;_0x80da5d[_0xe87e('0xb0')]=0x5;_0x80da5d[_0xe87e('0xb1')]='Busy';_0x80da5d[_0xe87e('0x18b')]+=0x1;_0x80da5d[_0xe87e('0x1ac')]+=0x1;_0x1e3b04[_0xe87e('0xcf')](_0x80da5d)[_0xe87e('0xba')](loggerCatch(_0xe87e('0x1ad')));if(_0x1e3b04[_0xe87e('0x18a')](0x5,_0x288699,_0x1773be)){if(_0x80da5d[_0xe87e('0x18b')]>=_0x1773be[_0xe87e('0x1ae')]){_0x1e3b04[_0xe87e('0x1ab')](_0x80da5d,_0x227066,_0x2ed9f0,_0xe87e('0x1af'));}else{_0x1e3b04[_0xe87e('0x1a7')](_0x80da5d,_0x227066,_0x2ed9f0,_0xe87e('0x1af'));}}break;case'8':_0x1773be[_0xe87e('0x68')]+=0x1;_0x80da5d[_0xe87e('0xb0')]=0x8;_0x80da5d[_0xe87e('0xb1')]=_0xe87e('0x1b0');_0x80da5d[_0xe87e('0x18c')]+=0x1;_0x80da5d[_0xe87e('0x1ac')]+=0x1;_0x1e3b04['createHistory'](_0x80da5d)['catch'](loggerCatch(_0xe87e('0x1b1')));if(_0x1e3b04['checkRetriveMax'](0x8,_0x288699,_0x1773be)){if(_0x80da5d[_0xe87e('0x18c')]>=_0x1773be[_0xe87e('0x198')]){_0x1e3b04['createStateFinal'](_0x80da5d,_0x227066,_0x2ed9f0,_0xe87e('0x1b2'));}else{_0x1e3b04[_0xe87e('0x1a7')](_0x80da5d,_0x227066,_0x2ed9f0,_0xe87e('0x1b2'));}}break;case'11':_0x1773be[_0xe87e('0x1b3')]+=0x1;_0x80da5d['state']=0xb;_0x80da5d[_0xe87e('0xb1')]=_0xe87e('0x10f');_0x80da5d['countabandonedretry']+=0x1;_0x80da5d[_0xe87e('0x1ac')]+=0x1;_0x1e3b04['createHistory'](_0x80da5d)[_0xe87e('0xba')](loggerCatch(_0xe87e('0x1b4')));if(_0x1e3b04[_0xe87e('0x18a')](0xb,_0x288699,_0x1773be)){if(_0x80da5d[_0xe87e('0x18f')]>=_0x1773be['dialAbandonedMaxRetry']){_0x1e3b04[_0xe87e('0x1ab')](_0x80da5d,_0x227066,_0x2ed9f0,_0xe87e('0x1b5'));}else{_0x1e3b04[_0xe87e('0x1a7')](_0x80da5d,_0x227066,_0x2ed9f0,_0xe87e('0x1b5'));}}break;case'20':_0x1773be[_0xe87e('0x6d')]+=0x1;_0x80da5d['state']=0x14;_0x80da5d[_0xe87e('0xb1')]=_0xe87e('0x1b6');_0x80da5d[_0xe87e('0x191')]+=0x1;_0x80da5d[_0xe87e('0x1ac')]+=0x1;_0x1e3b04[_0xe87e('0xcf')](_0x80da5d)['catch'](loggerCatch(_0xe87e('0x1b7')));if(_0x1e3b04[_0xe87e('0x18a')](0x14,_0x288699,_0x1773be)){if(_0x80da5d[_0xe87e('0x191')]>=_0x1773be[_0xe87e('0x19f')]){_0x1e3b04['createStateFinal'](_0x80da5d,_0x227066,_0x2ed9f0,'reason\x2020\x20agentreject');}else{_0x1e3b04['stateGlobal'](_0x80da5d,_0x227066,_0x2ed9f0,_0xe87e('0x1b8'));}}break;default:_0x1773be[_0xe87e('0x6e')]+=0x1;_0x80da5d[_0xe87e('0xb0')]=0xc;_0x80da5d['statedesc']=_0x25f14e[_0xe87e('0xff')];_0x1e3b04['createHistory'](_0x80da5d)[_0xe87e('0xba')](loggerCatch(_0xe87e('0x1b9')));if(_0x1e3b04[_0xe87e('0x18a')](_0x25f14e[_0xe87e('0xff')],_0x288699,_0x1773be)){if(_0x80da5d['countbusyretry']+_0x80da5d[_0xe87e('0x18c')]+_0x80da5d[_0xe87e('0x18d')]+_0x80da5d[_0xe87e('0x18e')]+_0x80da5d[_0xe87e('0x10c')]+_0x80da5d['countabandonedretry']+_0x80da5d['countmachineretry']+_0x80da5d[_0xe87e('0x191')]>=_0x1773be[_0xe87e('0x192')]){_0x1e3b04[_0xe87e('0x1a7')](_0x80da5d,_0x227066,_0x2ed9f0,_0x25f14e['reason']);}else{_0x1e3b04[_0xe87e('0x1ab')](_0x80da5d,_0x227066,_0x2ed9f0,_0x25f14e[_0xe87e('0xff')]);}}}});};Dialer[_0xe87e('0x1e')][_0xe87e('0x1a7')]=function(_0x5179f3,_0x5c21c1,_0x49b02f,_0x22af62){var _0x3a300e=new Final(_0x5179f3);_0x3a300e[_0xe87e('0xb0')]=0xf;_0x3a300e[_0xe87e('0xb1')]=_0xe87e('0x1ba');this[_0xe87e('0x1ab')](_0x3a300e,_0x5c21c1,_0x49b02f,_0x22af62);};Dialer['prototype'][_0xe87e('0x1ab')]=function(_0x45c06b,_0x1b24b2,_0x15abc5,_0x5d053d){this[_0xe87e('0xce')](_0x45c06b)[_0xe87e('0xc2')](function(_0xb2fabc){return _0x1b24b2(msgResponse(_0xe87e('0x1a2'),_0xe87e('0xde'),_0x5d053d));})[_0xe87e('0xba')](function(_0x385db0){return _0x15abc5(msgResponse(_0xe87e('0x1bb'),_0xe87e('0x131'),_0xe87e('0x1bc')));});};Dialer[_0xe87e('0x1e')][_0xe87e('0x9')]=function(_0x3c1f4c){var _0x698d4b=this;var _0x191a5b=_0x3c1f4c[_0xe87e('0x1bd')]/0x64;var _0x436104=_0x3c1f4c[_0xe87e('0x6b')]/(_0x3c1f4c['outboundDropCallsDayTimeout']+_0x3c1f4c[_0xe87e('0x65')]);var _0x4efd73=Math[_0xe87e('0x1be')](_0x3c1f4c[_0xe87e('0x1bf')]*(_0x3c1f4c[_0xe87e('0x1c0')]/0x64));var _0x13f632=Math[_0xe87e('0x1be')](_0x3c1f4c[_0xe87e('0x1bf')]*(_0x3c1f4c[_0xe87e('0x1c1')]/0x64));var _0x2ffd79=_0x3c1f4c[_0xe87e('0x1c2')]+_0x3c1f4c[_0xe87e('0x5a')];var _0x1126fd=Math['floor'](_0x3c1f4c[_0xe87e('0x79')]*_0x3c1f4c['erlangAbandonmentRate']*_0x3c1f4c[_0xe87e('0x74')]*_0x3c1f4c[_0xe87e('0x75')]);if(_[_0xe87e('0x43')](_0x3c1f4c[_0xe87e('0x2e')])){if(!_[_0xe87e('0x43')](_0x3c1f4c[_0xe87e('0x2d')])){_0x3c1f4c[_0xe87e('0x2d')]=undefined;loggerPredictive[_0xe87e('0x9f')](_0xe87e('0x1c3'),_0xe87e('0x1c4'));}if(!_['isUndefined'](_0x3c1f4c['handlePredictive'])){loggerPredictive['error'](_0xe87e('0x1c3'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x3c1f4c[_0xe87e('0x9a')]);_0x3c1f4c[_0xe87e('0x9a')]=undefined;}_0x3c1f4c['startProgressive']=moment()[_0xe87e('0x81')](_0xe87e('0x103'));loggerPredictive[_0xe87e('0x88')](_0x3c1f4c[_0xe87e('0x46')],'collection\x20data\x20in\x20progressive\x20at',_0x3c1f4c[_0xe87e('0x2e')]);this[_0xe87e('0x149')](_0x3c1f4c,0x1);}else if(ifInterval(_0x3c1f4c[_0xe87e('0x1c5')],_0x3c1f4c[_0xe87e('0x2e')])){this[_0xe87e('0x149')](_0x3c1f4c,0x1);loggerPredictiveCalls[_0xe87e('0x88')](_0xe87e('0x1c6'),_0x3c1f4c[_0xe87e('0x2e')],_0x3c1f4c[_0xe87e('0x46')]);_0x3c1f4c[_0xe87e('0x79')]=0x0;_0x3c1f4c[_0xe87e('0x109')]=0x0;}else if(_0x191a5b<_0x436104&&_0x3c1f4c['dialPredictiveOptimization']===_0xe87e('0x1c7')){freeVariablesPredictive(_0x3c1f4c);loggerPredictive[_0xe87e('0x88')](_0xe87e('0x1c8'),_0xe87e('0x1c9'),_0x436104,'startProgressive',_0x3c1f4c[_0xe87e('0x46')]);}else if(_0x1126fd<_0x3c1f4c[_0xe87e('0x109')]&&_0x3c1f4c[_0xe87e('0x1ca')]===_0xe87e('0x1c7')){freeVariablesPredictive(_0x3c1f4c);loggerPredictive[_0xe87e('0x88')](_0xe87e('0x1cb'),_0xe87e('0x1cc'),_0x1126fd,_0xe87e('0x1cd'),_0x3c1f4c[_0xe87e('0x109')],_0xe87e('0x2e'),_0x3c1f4c['name']);}else if(!ifInterval(_0x3c1f4c[_0xe87e('0x1c5')],_0x3c1f4c[_0xe87e('0x2e')])&&_[_0xe87e('0x43')](_0x3c1f4c['startPredictive'])&&!_[_0xe87e('0x43')](_0x3c1f4c['startProgressive'])){_0x3c1f4c[_0xe87e('0x2d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xe87e('0x88')](_0x3c1f4c[_0xe87e('0x46')],_0xe87e('0x1ce'),_0x3c1f4c[_0xe87e('0x2d')]);this[_0xe87e('0xc5')](_0x3c1f4c['dialPredictiveInterval'])[_0xe87e('0xc2')](this[_0xe87e('0x1cf')](_0x3c1f4c))['then'](mergeDataErlangB(_0x3c1f4c))[_0xe87e('0xc2')](this[_0xe87e('0x1d0')](_0x3c1f4c))[_0xe87e('0xba')](loggerCatchPredictive(_0xe87e('0x1d1'),_0x3c1f4c));}else if(!ifInterval(_0x3c1f4c[_0xe87e('0x1c5')],_0x3c1f4c[_0xe87e('0x2d')])){_0x3c1f4c[_0xe87e('0x109')]=0x0;_0x3c1f4c[_0xe87e('0x2d')]=moment()[_0xe87e('0x81')](_0xe87e('0x103'));loggerPredictive[_0xe87e('0x88')](_0x3c1f4c[_0xe87e('0x46')],_0xe87e('0x1d2'),_0x3c1f4c[_0xe87e('0x2d')]);clearInterval(_0x3c1f4c['handlePredictive']);_0x3c1f4c[_0xe87e('0x9a')]=undefined;this[_0xe87e('0xc5')](_0x3c1f4c[_0xe87e('0x1c5')])[_0xe87e('0xc2')](this[_0xe87e('0x1cf')](_0x3c1f4c))[_0xe87e('0xc2')](mergeDataErlangB(_0x3c1f4c))[_0xe87e('0xc2')](this[_0xe87e('0x1d0')](_0x3c1f4c))[_0xe87e('0xba')](loggerCatchPredictive(_0xe87e('0x1d3'),_0x3c1f4c));}else if(_0x3c1f4c['predictiveIntervalAvailable']&&_0x2ffd79<_0x3c1f4c[_0xe87e('0x1bf')]-_0x13f632){freeVariablesPredictive(_0x3c1f4c);loggerPredictive[_0xe87e('0x88')](_0x3c1f4c[_0xe87e('0x46')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x2ffd79,')\x20are\x20less\x20than\x20threshold\x20(',_0x3c1f4c[_0xe87e('0x1bf')],'-',_0x13f632,'=',_0x3c1f4c[_0xe87e('0x1bf')]-_0x13f632,')');}else if(_0x3c1f4c[_0xe87e('0x1bf')]&&_0x2ffd79>_0x3c1f4c['predictiveIntervalAvailable']+_0x4efd73){freeVariablesPredictive(_0x3c1f4c);loggerPredictive[_0xe87e('0x88')](_0x3c1f4c['name'],_0xe87e('0x1d4'),_0x2ffd79,')\x20are\x20more\x20than\x20threshold\x20(',_0x3c1f4c['predictiveIntervalAvailable'],'+',_0x4efd73,'=',_0x3c1f4c['predictiveIntervalAvailable']+_0x4efd73,')');}};Dialer[_0xe87e('0x1e')][_0xe87e('0x1cf')]=function(_0x4e8ecc){var _0x2485be=this;return function(_0x1774d1){return new BPromise(function(_0x4ac7cf,_0x5eff0c){_[_0xe87e('0x98')](_0x4e8ecc,_0x1774d1[0x0]);if(checkGetDataPredictive(_0x1774d1[0x0])){var _0x303872=_0x4e8ecc[_0xe87e('0x1bf')]=_0x4e8ecc[_0xe87e('0x5a')]+_0x4e8ecc[_0xe87e('0x1c2')];var _0x1e1e68=_0x4e8ecc[_0xe87e('0x1c5')]*0x3c;var _0x4fa6c8=_0x1774d1[0x0][_0xe87e('0x70')]+_0x1774d1[0x0]['predictiveIntervalAvgHoldtime'];var _0x48eea4=(_0x1774d1[0x0][_0xe87e('0x8b')]+_0x1774d1[0x0][_0xe87e('0x72')]+_0x1774d1[0x0][_0xe87e('0x71')])/_0x1774d1[0x0][_0xe87e('0x77')];_0x4e8ecc[_0xe87e('0x74')]=_0x48eea4>0x0?_0x48eea4:0x1;switch(_0x4e8ecc[_0xe87e('0x1ca')]){case _0xe87e('0x1c7'):var _0x48d569=_0x4e8ecc[_0xe87e('0x1bd')]/0x64;return _0x2485be[_0xe87e('0x1d5')](_0x303872,_0x1e1e68,_0x4fa6c8,_0x48eea4,_0x48d569)[_0xe87e('0xc2')](function(_0x294922){return _0x4ac7cf(_0x294922);});case _0xe87e('0x1d6'):var _0x39157a=_0x4e8ecc[_0xe87e('0x1bd')]/0x64;return _0x2485be['busyFactor'](_0x303872,_0x1e1e68,_0x4fa6c8,_0x48eea4,_0x39157a)[_0xe87e('0xc2')](function(_0x271e35){return _0x4ac7cf(_0x271e35);});default:return _0x5eff0c(msgResponse(_0xe87e('0x1d7'),_0xe87e('0x131'),_0xe87e('0x1d8')));}}else{return _0x5eff0c(msgResponse(_0xe87e('0x1d7'),'Failure',_0xe87e('0x1d9')));}});};};Dialer[_0xe87e('0x1e')][_0xe87e('0x1da')]=function(_0x3855f9){var _0x5939ab=this;return function(_0x118bcb){return new BPromise(function(_0x1114f3,_0xe37a08){_[_0xe87e('0x98')](_0x3855f9,_0x118bcb[0x0]);if(checkGetDataPredictive(_0x118bcb[0x0])){loggerPredictive[_0xe87e('0x88')](JSON[_0xe87e('0x4e')](_0x118bcb[0x0]));if(_0x3855f9[_0xe87e('0x1ca')]===_0xe87e('0x1c7')){return _0x5939ab[_0xe87e('0xcd')](_0x3855f9['id'])[_0xe87e('0xc2')](function(_0x29a6ec){var _0x500864=_0x3855f9[_0xe87e('0x55')]-_0x29a6ec[0x0][_0xe87e('0x1db')];var _0x5c2153=_0x3855f9[_0xe87e('0x1c5')]*0x3c;var _0x59a5cf=_0x118bcb[0x0]['predictiveIntervalAvgTalktime']+_0x118bcb[0x0][_0xe87e('0x6f')];var _0x11d204=(_0x118bcb[0x0]['predictiveIntervalAnsweredCalls']+_0x118bcb[0x0][_0xe87e('0x72')]+_0x118bcb[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x118bcb[0x0]['predictiveIntervalTotalCalls'];var _0x59044f=_0x3855f9[_0xe87e('0x1bd')]/0x64;_0x3855f9['predictiveIntervalPauses']=_0x29a6ec[0x0]['outboundQueuePauses']||0x0;_0x3855f9[_0xe87e('0x74')]=_0x11d204>0x0?_0x11d204:0x1;return _0x5939ab['abandonmentRate'](_0x500864,_0x5c2153,_0x59a5cf,_0x11d204,_0x59044f);})[_0xe87e('0xc2')](function(_0x357710){return _0x1114f3(_0x357710);})[_0xe87e('0xba')](function(_0x5d53a6){return _0xe37a08(msgResponse(_0xe87e('0x1dc'),_0xe87e('0x131'),JSON[_0xe87e('0x4e')](_0x5d53a6)));});}if(_0x3855f9[_0xe87e('0x1ca')]===_0xe87e('0x1d6')){return _0x5939ab['getVoiceQueueRtPauses'](_0x3855f9['id'])['then'](function(_0x544f1a){var _0x33e6b7=_0x3855f9[_0xe87e('0x55')]-_0x544f1a[0x0][_0xe87e('0x1db')];var _0x3cb0a8=_0x3855f9[_0xe87e('0x1c5')]*0x3c;var _0x3785eb=_0x118bcb[0x0][_0xe87e('0x70')]+_0x118bcb[0x0]['predictiveIntervalAvgHoldtime'];var _0x4044f8=(_0x118bcb[0x0]['predictiveIntervalAnsweredCalls']+_0x118bcb[0x0][_0xe87e('0x72')]+_0x118bcb[0x0][_0xe87e('0x71')])/_0x118bcb[0x0][_0xe87e('0x77')];var _0x57a8ff=_0x3855f9['dialPredictiveOptimizationPercentage']/0x64;_0x3855f9[_0xe87e('0x76')]=_0x544f1a[0x0][_0xe87e('0x1db')]||0x0;_0x3855f9[_0xe87e('0x74')]=_0x4044f8>0x0?_0x4044f8:0x1;return _0x5939ab[_0xe87e('0x1dd')](_0x33e6b7,_0x3cb0a8,_0x3785eb,_0x4044f8,_0x57a8ff);})[_0xe87e('0xc2')](function(_0x30d7fd){return _0x1114f3(_0x30d7fd);})[_0xe87e('0xba')](function(_0x1414b5){return _0xe37a08(msgResponse(_0xe87e('0x1dc'),'Failure',JSON['stringify'](_0x1414b5)));});}}else{return _0xe37a08(msgResponse(_0xe87e('0x1d7'),'Failure',_0xe87e('0x1d9')));}});};};Dialer[_0xe87e('0x1e')]['startMethodPredictive']=function(_0x517d38){var _0x1077e4=this;return function(){var _0x252d55=0x0;var _0xe28cbc=Math['floor'](_0x517d38['erlangCallToSecond']*0x3e8);if(_0xe28cbc>0x0){_0xe28cbc=_0xe28cbc<0x64?0x64:_0xe28cbc;loggerPredictive[_0xe87e('0x88')](_0x517d38[_0xe87e('0x46')],_0xe87e('0x1de'),_0xe28cbc,_0xe87e('0x4f'));_0x517d38[_0xe87e('0x9a')]=setInterval(function(){_0x1077e4[_0xe87e('0x9a')](_0x517d38);loggerPredictiveCalls['info'](_0xe87e('0x1df'),_0x252d55+=0x1);},_0xe28cbc);}else{loggerPredictive[_0xe87e('0x88')](_0x517d38['name'],_0xe87e('0x1e0'));}};};Dialer[_0xe87e('0x1e')][_0xe87e('0x1e1')]=function(_0x5b2580,_0x21c189){var _0x58c53a=this;return function(_0x263565){if(_[_0xe87e('0x87')](_0x263565)){if(_[_0xe87e('0xb6')](_0x21c189[_0xe87e('0xd8')])||!_0x21c189[_0xe87e('0x1e2')]){if(_0x5b2580[_0xe87e('0x14f')]==='booked'){_0x5b2580[_0xe87e('0x119')]=_[_0xe87e('0x43')](_0x5b2580[_0xe87e('0x119')])?!![]:_0x5b2580[_0xe87e('0x119')];var _0xc698c3=uuid['v4']();_0x58c53a[_0xe87e('0x2a')][_0xc698c3]=new Action(_0x5b2580,_0x21c189,_0xc698c3);loggerBooked[_0xe87e('0x88')](_0xe87e('0x1e3'),_0xc698c3,'queueStatusComplete:\x20',JSON[_0xe87e('0x4e')](_0x5b2580[_0xe87e('0x119')]),_0xe87e('0x1e4'),_0x5b2580[_0xe87e('0x46')]);if(_0x5b2580['queueStatusComplete']){_0x5b2580['queueStatusComplete']=![];_0x58c53a[_0xe87e('0x30')][_0x58c53a[_0xe87e('0x2a')][_0xc698c3][_0xe87e('0xbd')]]=[];ami[_0xe87e('0xb7')]({'actionid':_0xc698c3,'action':_0xe87e('0x1e5'),'queue':_0x5b2580[_0xe87e('0x46')]})[_0xe87e('0xba')](function(_0x57194f){_0x58c53a[_0xe87e('0xbc')](_0x5b2580);_0x58c53a['rescheduleContact']({'active':![],'ContactId':_0x58c53a[_0xe87e('0x2a')][_0xc698c3]['ContactId'],'ListId':_0x58c53a[_0xe87e('0x2a')][_0xc698c3][_0xe87e('0xd7')],'VoiceQueueId':_0x58c53a[_0xe87e('0x2a')][_0xc698c3][_0xe87e('0xd9')]||undefined,'CampaignId':_0x58c53a[_0xe87e('0x2a')][_0xc698c3][_0xe87e('0xda')]||undefined})[_0xe87e('0xba')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x58c53a['actions'][_0xc698c3];});}else{loggerBooked['info'](_0xe87e('0x1e6'),JSON['stringify'](_0x5b2580['queueStatusComplete']),_0xe87e('0x1e4'),_0x5b2580['name']);_0x58c53a[_0xe87e('0xbc')](_0x5b2580);_0x58c53a[_0xe87e('0xc7')]({'active':![],'ContactId':_0x58c53a[_0xe87e('0x2a')][_0xc698c3]['ContactId'],'ListId':_0x58c53a['actions'][_0xc698c3]['ListId'],'VoiceQueueId':_0x58c53a['actions'][_0xc698c3][_0xe87e('0xd9')]||undefined,'CampaignId':_0x58c53a[_0xe87e('0x2a')][_0xc698c3]['CampaignId']||undefined})[_0xe87e('0xba')](loggerCatch(_0xe87e('0x1e7')));delete _0x58c53a[_0xe87e('0x2a')][_0xc698c3];}}else{return _0x58c53a[_0xe87e('0x158')](_0x5b2580,_0x21c189);}}else{if(getDiff(_0x21c189['scheduledat'])<_0x5b2580[_0xe87e('0x1e8')]*0x3c){if(_0x21c189[_0xe87e('0x1e9')]&&!_0x21c189[_0xe87e('0x1e9')][_0xe87e('0x1ea')]){_0x58c53a[_0xe87e('0x23')][_0xe87e('0x11c')](_0x21c189['id'])['finally'](function(){_0x58c53a[_0xe87e('0xbc')](_0x5b2580);});}else{_0x58c53a[_0xe87e('0xc8')]({'active':![]},_0x21c189['id'],0x1)[_0xe87e('0x21')](function(){console[_0xe87e('0x1eb')](_0xe87e('0x1ec'));_0x58c53a['updateOriginated'](_0x5b2580);});}}else{_0x5b2580['outboundReCallsDay']+=0x1;_0x58c53a['updateOriginated'](_0x5b2580);if(_0x5b2580[_0xe87e('0x1ed')]){_0x58c53a[_0xe87e('0xc7')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x21c189[_0xe87e('0xd6')],'ListId':_0x21c189[_0xe87e('0xd7')],'VoiceQueueId':_0x21c189['VoiceQueueId']||undefined,'CampaignId':_0x21c189[_0xe87e('0xda')]||undefined})[_0xe87e('0xba')](loggerCatch(_0xe87e('0x1ee')));_0x58c53a[_0xe87e('0xcf')](createObjHistory(_0x5b2580,_0x21c189,_0xe87e('0x1ef'),0x17,'RecallInQueue'))[_0xe87e('0xba')](loggerCatch(_0xe87e('0x1f0')));}else{_0x58c53a[_0xe87e('0xe2')](createObjHistory(_0x5b2580,_0x21c189,_0xe87e('0x1f1'),0x16,_0xe87e('0x1f2')),_0xe87e('0x1f3'),_0xe87e('0x1f4'));}}}}else{_0x5b2580[_0xe87e('0x66')]+=0x1;_0x58c53a[_0xe87e('0xe2')](createObjHistory(_0x5b2580,_0x21c189,_0xe87e('0x1f5'),0xd,_0xe87e('0x1f6')),'[Originate][historyBlacklist]',_0xe87e('0x1f7'));throw _0xe87e('0x1f8');}};};Dialer[_0xe87e('0x1e')]['handleIvr']=function(_0x33dc7b){var _0x37f837=this;var _0x43905c=[];var _0x203680=_0x33dc7b[_0xe87e('0x1f9')]-_0x33dc7b['originated']-_0x33dc7b['temp'];emitCampaignSummary(_0x33dc7b);if(_0x203680>0x0){if(_0x203680>this['maxNumberOriginate']){_0x203680=this[_0xe87e('0x28')];}_0x33dc7b[_0xe87e('0x1fa')]+=_0x203680;this['getContactDialerIvr'](_0x33dc7b['id'],_0x203680,_0x33dc7b[_0xe87e('0x1fb')])['then'](function(_0x6ebc1d){_0x33dc7b['temp']-=_0x203680;_0x33dc7b[_0xe87e('0x1fa')]=_0x33dc7b[_0xe87e('0x1fa')]>0x0?_0x33dc7b['temp']:0x0;if(!checkContactEmpty(_0x6ebc1d)){_0x33dc7b['message']=_0xe87e('0x1fc');logger[_0xe87e('0x88')](_0xe87e('0x1fd')+_0x33dc7b['name']);}else{_0x33dc7b['originated']+=_0x6ebc1d[_0xe87e('0xa2')];_0x33dc7b['message']=_0xe87e('0x1fe');for(var _0x1c5a73=0x0;_0x1c5a73<_0x6ebc1d[_0xe87e('0xa2')];_0x1c5a73+=0x1){_0x33dc7b['ivrTotalCallsDays']+=0x1;if(_[_0xe87e('0xb6')](_0x6ebc1d[_0x1c5a73])||_[_0xe87e('0xb6')](_0x6ebc1d[_0x1c5a73][_0xe87e('0x15b')])||_[_0xe87e('0xb6')](_0x6ebc1d[_0x1c5a73]['Contact'][_0xe87e('0x15c')])){_0x37f837[_0xe87e('0xd4')](_0xe87e('0x1ff'),_0x33dc7b,_0x6ebc1d[_0x1c5a73]);}else{_0x37f837['checkIsBlackListIvr'](_[_0xe87e('0xd5')](_0x6ebc1d[_0x1c5a73],['CampaignId',_0xe87e('0x200')]))[_0xe87e('0xc2')](_0x37f837[_0xe87e('0x1e1')](_0x33dc7b,_0x6ebc1d[_0x1c5a73]))[_0xe87e('0xba')](_0x37f837[_0xe87e('0xd3')](_0xe87e('0x201'),_0x33dc7b));}}}})[_0xe87e('0xba')](loggerGetContactDialer(_0xe87e('0x202'),_0x33dc7b,_0x203680));}};Dialer[_0xe87e('0x1e')][_0xe87e('0x149')]=function(_0x104bb0,_0x4f7d50){var _0x397ea8=this;var _0x5e6539=[];var _0x10ca1a=_0x4f7d50>=0x1?_0x4f7d50:0x1;var _0x30010d=[];if(_0x104bb0['dialMethod']==='booked'){_0x10ca1a=0x1;}var _0x48432a=Math[_0xe87e('0x203')](_0x104bb0['available']*_0x10ca1a)-_0x104bb0[_0xe87e('0x78')]-_0x104bb0[_0xe87e('0x1fa')];emitVoiceQueueSummary(_0x104bb0);if(_0x104bb0['dialLimitQueue']>0x0){var _0x2f2013=_0x104bb0['dialLimitQueue']-_0x104bb0[_0xe87e('0x78')]-_0x104bb0['talking']-_0x104bb0[_0xe87e('0x1fa')]-_0x104bb0[_0xe87e('0x56')];if(_0x48432a>_0x2f2013){_0x48432a=_0x2f2013;}}if(_0x48432a>0x0){if(_0x104bb0['dialMethod']===_0xe87e('0x8')){_0x48432a=0x1;}if(_0x48432a>this[_0xe87e('0x28')]){_0x48432a=this[_0xe87e('0x28')];}_0x104bb0[_0xe87e('0x1fa')]+=_0x48432a;for(var _0x59d9e9 in this[_0xe87e('0x26')]){if(this[_0xe87e('0x26')][_0xe87e('0xa3')](_0x59d9e9)){if(this['agents'][_0x59d9e9][_0xe87e('0xb0')]==='not_inuse'&&this[_0xe87e('0x26')][_0x59d9e9][_0xe87e('0xb8')]===_0xe87e('0xe0')){_0x5e6539[_0xe87e('0x138')](this[_0xe87e('0x26')][_0x59d9e9]['id']);}}}this[_0xe87e('0xca')](_0x104bb0['id'],_0x5e6539,_0x48432a,_0x104bb0['dialOrderByScheduledAt'])['then'](function(_0x35efff){_0x104bb0[_0xe87e('0x1fa')]-=_0x48432a;_0x104bb0[_0xe87e('0x1fa')]=_0x104bb0[_0xe87e('0x1fa')]>0x0?_0x104bb0['temp']:0x0;if(!checkContactEmpty(_0x35efff)){_0x397ea8[_0xe87e('0xc0')](_0x104bb0)[_0xe87e('0xc2')](sendMessageReschedule(_0x104bb0))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x104bb0[_0xe87e('0x78')]+=_0x35efff[_0xe87e('0xa2')];_0x104bb0['message']=_0x104bb0[_0xe87e('0x14f')]===_0xe87e('0x8')?_0xe87e('0x164'):'RUNNING';for(var _0x2076ce=0x0;_0x2076ce<_0x35efff[_0xe87e('0xa2')];_0x2076ce+=0x1){if(_[_0xe87e('0xb6')](_0x35efff[_0x2076ce])||_['isNil'](_0x35efff[_0x2076ce]['Contact'])||_[_0xe87e('0xb6')](_0x35efff[_0x2076ce][_0xe87e('0x15b')]['phone'])){_0x397ea8[_0xe87e('0xd4')]('[actionOriginate]\x20',_0x104bb0,_0x35efff[_0x2076ce]);}else{_0x397ea8[_0xe87e('0xc3')](_[_0xe87e('0xd5')](_0x35efff[_0x2076ce],[_0xe87e('0xd9'),_0xe87e('0x200')]))[_0xe87e('0xc2')](_0x397ea8['checkContactBlack'](_0x104bb0,_0x35efff[_0x2076ce]))[_0xe87e('0xba')](_0x397ea8[_0xe87e('0xd3')](_0xe87e('0x1ff'),_0x104bb0));}}}})['catch'](loggerGetContactDialer(_0xe87e('0x204'),_0x104bb0,_0x48432a));}};Dialer[_0xe87e('0x1e')]['handlePredictive']=function(_0x1b61a6){var _0x4b70cc=this;if(_0x1b61a6['dialLimitQueue']>0x0){var _0x153513=_0x1b61a6['dialLimitQueue']-_0x1b61a6[_0xe87e('0x78')]-_0x1b61a6[_0xe87e('0x5a')];if(_0x153513>0x0){this[_0xe87e('0x205')](_0x1b61a6);}else{loggerPredictiveCalls[_0xe87e('0x88')](_0xe87e('0x206'));}}else{this[_0xe87e('0x205')](_0x1b61a6);}};Dialer['prototype']['tryOriginatePredictive']=function(_0x2eef){var _0x1e802f=this;var _0x162035=[];_0x2eef[_0xe87e('0x78')]+=0x1;for(var _0x4698d0 in this['agents']){if(this[_0xe87e('0x26')]['hasOwnProperty'](_0x4698d0)){if(this['agents'][_0x4698d0][_0xe87e('0xb0')]==='not_inuse'&&this[_0xe87e('0x26')][_0x4698d0]['status']==='reachable'){_0x162035[_0xe87e('0x138')](this[_0xe87e('0x26')][_0x4698d0]['id']);}}}this[_0xe87e('0xca')](_0x2eef['id'],_0x162035,0x1,_0x2eef[_0xe87e('0x1fb')])['then'](function(_0x3c6340){if(!checkContactEmpty(_0x3c6340)){checkContactLowerLimitOriginate(_0x2eef,0x1,0x0);_0x1e802f[_0xe87e('0xc0')](_0x2eef)[_0xe87e('0xc2')](sendMessageReschedule(_0x2eef))[_0xe87e('0xba')](loggerCatch('[countReScheduled]\x20'));}else{_0x2eef['message']=_0xe87e('0x1fe');if(_['isNil'](_0x3c6340[0x0])||_[_0xe87e('0xb6')](_0x3c6340[0x0][_0xe87e('0x15b')])||_[_0xe87e('0xb6')](_0x3c6340[0x0]['Contact']['phone'])){_0x1e802f['emptyContact'](_0xe87e('0x1ff'),_0x2eef,_0x3c6340[0x0]);}else{_0x1e802f['checkIsBlackList'](_['pick'](_0x3c6340[0x0],[_0xe87e('0xd9'),_0xe87e('0x200')]))['then'](_0x1e802f[_0xe87e('0x1e1')](_0x2eef,_0x3c6340[0x0]))[_0xe87e('0xba')](_0x1e802f[_0xe87e('0xd3')](_0xe87e('0x207'),_0x2eef));}}})[_0xe87e('0xba')](loggerGetContactDialer('[getContactDialerPredictive]',_0x2eef,0x1));emitVoiceQueueSummary(_0x2eef);};Dialer[_0xe87e('0x1e')][_0xe87e('0x1d5')]=function(_0x3b5ccd,_0x7a5bc6,_0x2b82d5,_0xe47bac,_0x5e1d72,_0x3dfdfd){loggerPredictive['info'](_0xe87e('0x208'));loggerPredictive[_0xe87e('0x88')](_0xe87e('0x209'),_0x3b5ccd);loggerPredictive[_0xe87e('0x88')](_0xe87e('0x20a'),_0x7a5bc6);loggerPredictive['info']('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2b82d5);loggerPredictive[_0xe87e('0x88')]('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',_0xe47bac);loggerPredictive[_0xe87e('0x88')](_0xe87e('0x20b'),_0x5e1d72);loggerPredictive[_0xe87e('0x88')](_0xe87e('0x8f'));return new BPromise(function(_0x3c9468,_0x28ed48){if(_0x3b5ccd<=0x0||isNaN(_0x3b5ccd)){return _0x28ed48(msgResponse(_0xe87e('0x20c'),_0xe87e('0x4d'),'m\x20=\x20'+_0x3b5ccd));}if(_0x2b82d5<=0x0||isNaN(_0x2b82d5)){return _0x28ed48(msgResponse(_0xe87e('0x20c'),_0xe87e('0x4d'),_0xe87e('0x20d')+_0x2b82d5));}if(_0xe47bac<=0x0||isNaN(_0xe47bac)){return _0x28ed48(msgResponse(_0xe87e('0x20c'),_0xe87e('0x4d'),'p\x20=\x20'+_0xe47bac));}if(_0x7a5bc6<=0x0||isNaN(_0x7a5bc6)){return _0x28ed48(msgResponse(_0xe87e('0x20c'),'Error',_0xe87e('0x20e')+_0x7a5bc6));}if(_0x5e1d72<=0x0||isNaN(_0x5e1d72)){return _0x28ed48(msgResponse('[abandonmentRate]',_0xe87e('0x4d'),_0xe87e('0x20f')+_0x5e1d72));}_0x3dfdfd=_0x3dfdfd||0x0;var _0x2bac37=0x1/_0x2b82d5;var _0x495b3a=0x0;var _0x5d2757=0x0;var _0x1a6214=0x0;var _0x2daebd=0x0;for(var _0x16c60a=0x0;_0x1a6214<_0x5e1d72;_0x16c60a+=0x1){_0x5d2757=_0x16c60a/_0x7a5bc6;_0x495b3a=(_0xe47bac*_0x5d2757+_0x3dfdfd)/_0x2bac37;_0x1a6214=erlangb(_0x495b3a,_0x3b5ccd);_0x2daebd=_0x495b3a/_0x3b5ccd*(0x1-erlangb(_0x495b3a,_0x3b5ccd));}return _0x3c9468({'erlangCalls':_0x16c60a,'erlangCallToSecond':_0x7a5bc6/_0x16c60a,'erlangAbandonmentRate':_0x1a6214,'erlangBusyFactor':_0x2daebd});});};Dialer[_0xe87e('0x1e')][_0xe87e('0x1dd')]=function(_0x55d55b,_0x37609a,_0x30e495,_0x4a246d,_0x110b07,_0x4f62a0){loggerPredictive[_0xe87e('0x88')](_0xe87e('0x210'));loggerPredictive['info'](_0xe87e('0x209'),_0x55d55b);loggerPredictive[_0xe87e('0x88')](_0xe87e('0x20a'),_0x37609a);loggerPredictive['info'](_0xe87e('0x211'),_0x30e495);loggerPredictive[_0xe87e('0x88')]('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',_0x4a246d);loggerPredictive[_0xe87e('0x88')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x110b07);loggerPredictive[_0xe87e('0x88')](_0xe87e('0x8f'));return new BPromise(function(_0x5f13e5,_0x5cc4d1){if(_0x55d55b<=0x0||isNaN(_0x55d55b)){return _0x5cc4d1(msgResponse(_0xe87e('0x212'),_0xe87e('0x4d'),'m\x20=\x20'+_0x55d55b));}if(_0x30e495<=0x0||isNaN(_0x30e495)){return _0x5cc4d1(msgResponse('[busyFactor]',_0xe87e('0x4d'),_0xe87e('0x20d')+_0x30e495));}if(_0x4a246d<=0x0||isNaN(_0x4a246d)){return _0x5cc4d1(msgResponse(_0xe87e('0x212'),_0xe87e('0x4d'),_0xe87e('0x213')+_0x4a246d));}if(_0x37609a<=0x0||isNaN(_0x37609a)){return _0x5cc4d1(msgResponse(_0xe87e('0x212'),_0xe87e('0x4d'),'interval\x20=\x20'+_0x37609a));}if(_0x110b07<=0x0||isNaN(_0x110b07)){return _0x5cc4d1(msgResponse(_0xe87e('0x212'),_0xe87e('0x4d'),'Umin\x20=\x20'+_0x110b07));}_0x4f62a0=_0x4f62a0||0x0;var _0x2680cc=0x1/_0x30e495;var _0x1ce9f6=0x0;var _0x4730c9=0x0;var _0x434790=0x0;var _0x43b836=0x0;for(var _0x22c553=0x0;_0x43b836<_0x110b07;_0x22c553+=0x1){_0x4730c9=_0x22c553/_0x37609a;_0x1ce9f6=(_0x4a246d*_0x4730c9+_0x4f62a0)/_0x2680cc;_0x434790=erlangb(_0x1ce9f6,_0x55d55b);_0x43b836=_0x1ce9f6/_0x55d55b*(0x1-erlangb(_0x1ce9f6,_0x55d55b));}return _0x5f13e5({'erlangCalls':_0x22c553,'erlangCallToSecond':_0x37609a/_0x22c553,'erlangAbandonmentRate':_0x434790,'erlangBusyFactor':_0x43b836});});};module[_0xe87e('0x214')]=Dialer; \ No newline at end of file +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 diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index cf24f79..e46aefc 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 _0x93a6=['countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x108adb,_0x40432f){var _0x4b61f3=function(_0x7515e3){while(--_0x7515e3){_0x108adb['push'](_0x108adb['shift']());}};_0x4b61f3(++_0x40432f);}(_0x93a6,0x134));var _0x693a=function(_0x6fb7ec,_0x2cc36f){_0x6fb7ec=_0x6fb7ec-0x0;var _0x243017=_0x93a6[_0x6fb7ec];return _0x243017;};'use strict';var util=require(_0x693a('0x0'));var _=require(_0x693a('0x1'));var moment=require(_0x693a('0x2'));function getSeconds(_0x37e3a7,_0x1e3e37){var _0x357c26=moment(_0x37e3a7)[_0x693a('0x3')](0x0);var _0x22424e=moment(_0x1e3e37)['milliseconds'](0x0);return _0x357c26[_0x693a('0x4')](_0x22424e,_0x693a('0x5'));}function QueueCallerAbandon(_0x570484,_0x4287ed){this['scheduledat']=_0x570484[_0x693a('0x6')];this[_0x693a('0x7')]=_0x570484[_0x693a('0x7')];this[_0x693a('0x8')]=_0x570484[_0x693a('0x7')]===_0x693a('0x9')?_0x693a('0xa'):_0x570484['type'];this['countbusyretry']=_0x570484['countbusyretry'];this[_0x693a('0xb')]=_0x570484['countcongestionretry'];this[_0x693a('0xc')]=_0x570484[_0x693a('0xc')];this[_0x693a('0xd')]=_0x570484[_0x693a('0xe')]+_0x570484[_0x693a('0xb')]+_0x570484[_0x693a('0xc')]+_0x570484[_0x693a('0xf')]+_0x570484[_0x693a('0x10')]+_0x570484[_0x693a('0x11')]+_0x570484['countmachineretry']+_0x570484[_0x693a('0x12')];this[_0x693a('0xf')]=_0x570484[_0x693a('0xf')];this[_0x693a('0x10')]=_0x570484[_0x693a('0x10')];this['countabandonedretry']=_0x570484['countabandonedretry'];this[_0x693a('0x13')]=_0x570484[_0x693a('0x13')];this[_0x693a('0x12')]=_0x570484[_0x693a('0x12')];this[_0x693a('0x14')]=_0x4287ed['uniqueid'];this[_0x693a('0x15')]=_0x570484[_0x693a('0x16')];this[_0x693a('0x17')]=_0x570484[_0x693a('0x18')];this[_0x693a('0x19')]=_0x570484['starttime'];this[_0x693a('0x1a')]=_0x570484[_0x693a('0x1a')];this[_0x693a('0x1b')]=_0x570484[_0x693a('0x1b')];this[_0x693a('0x1c')]=this[_0x693a('0x1b')];this[_0x693a('0x1d')]=getSeconds(_0x570484[_0x693a('0x1a')],_0x570484[_0x693a('0x19')]);this[_0x693a('0x1e')]=getSeconds(this[_0x693a('0x1b')],_0x570484[_0x693a('0x1a')]);this[_0x693a('0x1f')]=0x0;this[_0x693a('0xa')]=_0x4287ed[_0x693a('0xa')];this['membername']=_0x4287ed[_0x693a('0x20')];this[_0x693a('0x21')]=_0x4287ed[_0x693a('0x21')];this[_0x693a('0x22')]=_0x570484[_0x693a('0x22')];this[_0x693a('0x23')]=_0x570484[_0x693a('0x23')];this[_0x693a('0x24')]=_0x570484[_0x693a('0x24')];this[_0x693a('0x25')]=_0x570484[_0x693a('0x25')];this['ContactId']=_0x570484[_0x693a('0x26')];this[_0x693a('0x27')]=_0x570484['ListId'];this['UserId']=_0x570484[_0x693a('0x28')];this[_0x693a('0x29')]=_0x570484[_0x693a('0x29')];this[_0x693a('0x2a')]=_0x570484[_0x693a('0x2a')];this[_0x693a('0x2b')]=_0x570484[_0x693a('0x2b')]||'';this[_0x693a('0x2c')]=_0x570484['originatecalleridname']||'';}module[_0x693a('0x2d')]=QueueCallerAbandon; \ No newline at end of file +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 diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index a99372e..24c6f08 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 _0x4c10=['tech','name','fax','localstationid','headerinfo','path','AttachmentId','exports','util','lodash','moment','uniqueid','channel','format','%s/%s/%s'];(function(_0x243b15,_0x373836){var _0x539d3a=function(_0x4e089d){while(--_0x4e089d){_0x243b15['push'](_0x243b15['shift']());}};_0x539d3a(++_0x373836);}(_0x4c10,0x1d9));var _0x04c1=function(_0x3e2769,_0x15f731){_0x3e2769=_0x3e2769-0x0;var _0x1440b8=_0x4c10[_0x3e2769];return _0x1440b8;};'use strict';var util=require(_0x04c1('0x0'));var _=require(_0x04c1('0x1'));var moment=require(_0x04c1('0x2'));function Action(_0x181d73,_0x2da95f,_0x5cc726){this[_0x04c1('0x3')]=_0x181d73||undefined;this[_0x04c1('0x4')]=util[_0x04c1('0x5')](_0x04c1('0x6'),_0x2da95f[_0x04c1('0x7')],_0x2da95f['Trunk'][_0x04c1('0x8')],_0x5cc726[_0x04c1('0x9')]);this[_0x04c1('0xa')]=_0x2da95f[_0x04c1('0xa')];this[_0x04c1('0xb')]=_0x2da95f['headerinfo'];this[_0x04c1('0xc')]=_0x5cc726['path'];this[_0x04c1('0xd')]=_0x5cc726[_0x04c1('0xd')];}module[_0x04c1('0xe')]=Action; \ No newline at end of file +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 diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index f573fbd..c862c28 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 _0x7cee=['%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','isTrunkReachable','isNil','active','SIP/%s','reachable','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Is\x20Valid','exports','lodash','uuid','moment','path','tiff2pdf','./util/gs','./channel','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','varset','newstate','syncNewState','bind','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','prototype','from-voip-provider','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','syncVarSet','variable','value','channelstate','channelstatedesc','operation','status','filename','info','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','then','notify','fax','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','reason','AttachmentId','update','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','FaxAccountId','Trunk\x20Reachable','format','execute'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x7cee,0x1c5));var _0xe7ce=function(_0x4a095e,_0x381cd5){_0x4a095e=_0x4a095e-0x0;var _0x10ef73=_0x7cee[_0x4a095e];return _0x10ef73;};'use strict';var util=require('util');var _=require(_0xe7ce('0x0'));var BPromise=require('bluebird');var uuid=require(_0xe7ce('0x1'));var moment=require(_0xe7ce('0x2'));var path=require(_0xe7ce('0x3'));var tiff2pdf=require(_0xe7ce('0x4'));var gs=require(_0xe7ce('0x5'));var logger=require('../../../config/logger')('fax');var ami=require('../ami');var rpcDb=require('./rpcDb');var Channel=require(_0xe7ce('0x6'));var ut=require('./util/util');var Action=require('./action');var faxAccount=require('../rpc/faxAccount');var attachment=require(_0xe7ce('0x7'));var faxMessage=require(_0xe7ce('0x8'));function Fax(_0x17b8ae){this[_0xe7ce('0x9')]={};this[_0xe7ce('0xa')]=_0x17b8ae[_0xe7ce('0xa')];this['trunks']=_0x17b8ae[_0xe7ce('0xb')];this[_0xe7ce('0xc')]={};ami['on'](_0xe7ce('0xd'),this[_0xe7ce('0xe')]['bind'](this));ami['on'](_0xe7ce('0xf'),this['syncVarSet']['bind'](this));ami['on'](_0xe7ce('0x10'),this[_0xe7ce('0x11')][_0xe7ce('0x12')](this));ami['on']('newexten',this[_0xe7ce('0x13')][_0xe7ce('0x12')](this));ami['on'](_0xe7ce('0x14'),this[_0xe7ce('0x15')][_0xe7ce('0x12')](this));ami['on'](_0xe7ce('0x16'),this[_0xe7ce('0x17')]['bind'](this));ami['on']('hangup',this[_0xe7ce('0x18')][_0xe7ce('0x12')](this));ami['on'](_0xe7ce('0x19'),this[_0xe7ce('0x1a')]['bind'](this));}Fax[_0xe7ce('0x1b')][_0xe7ce('0xe')]=function(_0x3ab434){if(_0x3ab434['context']===_0xe7ce('0x1c')){for(var _0x56de47 in this[_0xe7ce('0xa')]){if(this[_0xe7ce('0xa')]['hasOwnProperty'](_0x56de47)){if(_0x3ab434[_0xe7ce('0x1d')]===this[_0xe7ce('0xa')][_0x56de47][_0xe7ce('0x1e')]){this['channels'][_0x3ab434['uniqueid']]={};this['channels'][_0x3ab434[_0xe7ce('0x1f')]][_0xe7ce('0x20')]=_0x3ab434[_0xe7ce('0x20')];this['channels'][_0x3ab434['uniqueid']]['id']=this[_0xe7ce('0xa')][_0x56de47]['id'];this['channels'][_0x3ab434[_0xe7ce('0x1f')]][_0xe7ce('0x21')]=this[_0xe7ce('0xa')][_0x56de47]['name'];logger['info'](_0x3ab434['uniqueid'],_0xe7ce('0x22'));}}}}if(this[_0xe7ce('0xc')][_0x3ab434[_0xe7ce('0x1f')]]){this['channels'][_0x3ab434['uniqueid']]={};this['channels'][_0x3ab434[_0xe7ce('0x1f')]]['channel']=_0x3ab434['channel'];logger['info'](_0x3ab434['uniqueid'],_0xe7ce('0x22'));}};Fax[_0xe7ce('0x1b')][_0xe7ce('0x23')]=function(_0x4fbab3){if(this[_0xe7ce('0x9')][_0x4fbab3[_0xe7ce('0x1f')]]){for(var _0xddfde0 in _0x4fbab3['variable']){if(_0x4fbab3[_0xe7ce('0x24')]['hasOwnProperty'](_0xddfde0)){this[_0xe7ce('0x9')][_0x4fbab3[_0xe7ce('0x1f')]][_0xddfde0]=_0x4fbab3[_0xe7ce('0x25')];}}}};Fax[_0xe7ce('0x1b')][_0xe7ce('0x11')]=function(_0x4a925b){if(this[_0xe7ce('0x9')][_0x4a925b[_0xe7ce('0x1f')]]){this['channels'][_0x4a925b[_0xe7ce('0x1f')]][_0xe7ce('0x26')]=_0x4a925b[_0xe7ce('0x26')];this[_0xe7ce('0x9')][_0x4a925b[_0xe7ce('0x1f')]][_0xe7ce('0x27')]=_0x4a925b[_0xe7ce('0x27')];}};Fax[_0xe7ce('0x1b')]['syncNewExten']=function(_0x5ba824){if(this[_0xe7ce('0x9')][_0x5ba824['uniqueid']]){for(var _0x5ee9b5 in _0x5ba824[_0xe7ce('0x24')]){if(_0x5ba824[_0xe7ce('0x24')]['hasOwnProperty'](_0x5ee9b5)){this[_0xe7ce('0x9')][_0x5ba824[_0xe7ce('0x1f')]][_0x5ee9b5]=_0x5ba824[_0xe7ce('0x25')];}}}};Fax['prototype'][_0xe7ce('0x15')]=function(_0x468f4f){if(this[_0xe7ce('0x9')][_0x468f4f[_0xe7ce('0x1f')]]){this[_0xe7ce('0x9')][_0x468f4f['uniqueid']][_0xe7ce('0x28')]=_0x468f4f[_0xe7ce('0x28')];this['channels'][_0x468f4f[_0xe7ce('0x1f')]][_0xe7ce('0x29')]=_0x468f4f[_0xe7ce('0x29')];this['channels'][_0x468f4f[_0xe7ce('0x1f')]][_0xe7ce('0x1e')]=_0x468f4f[_0xe7ce('0x1e')];this[_0xe7ce('0x9')][_0x468f4f['uniqueid']][_0xe7ce('0x2a')]=_0x468f4f[_0xe7ce('0x2a')];logger[_0xe7ce('0x2b')](_0x468f4f[_0xe7ce('0x1f')],'\x20syncFaxStatus\x20');}};Fax[_0xe7ce('0x1b')][_0xe7ce('0x17')]=function(_0x407ea7){var _0x4e77c3=this;if(this[_0xe7ce('0x9')][_0x407ea7['uniqueid']]){var _0x4b3d6f=this['channels'][_0x407ea7[_0xe7ce('0x1f')]]['id'];this[_0xe7ce('0x9')][_0x407ea7[_0xe7ce('0x1f')]][_0xe7ce('0x2c')]=_0x407ea7[_0xe7ce('0x2c')];this[_0xe7ce('0x9')][_0x407ea7['uniqueid']][_0xe7ce('0x2d')]=_0x407ea7['pagestransferred'];this[_0xe7ce('0x9')][_0x407ea7['uniqueid']]['localstationid']=_0x407ea7[_0xe7ce('0x1e')];this[_0xe7ce('0x9')][_0x407ea7[_0xe7ce('0x1f')]][_0xe7ce('0x2e')]=_0x407ea7[_0xe7ce('0x2e')];this[_0xe7ce('0x9')][_0x407ea7[_0xe7ce('0x1f')]][_0xe7ce('0x2f')]=_0x407ea7[_0xe7ce('0x2f')];this[_0xe7ce('0x9')][_0x407ea7[_0xe7ce('0x1f')]][_0xe7ce('0x2a')]=_0x407ea7[_0xe7ce('0x2a')];this['channels'][_0x407ea7[_0xe7ce('0x1f')]][_0xe7ce('0x30')]=_0x407ea7[_0xe7ce('0x30')];if(this[_0xe7ce('0x9')][_0x407ea7[_0xe7ce('0x1f')]]['pagestransferred']>0x0){tiff2pdf(_0x407ea7[_0xe7ce('0x2a')],_0xe7ce('0x31'),function(_0x491015){logger[_0xe7ce('0x2b')](_0x407ea7[_0xe7ce('0x1f')],_0xe7ce('0x32'),_0x491015[_0xe7ce('0x33')]);attachment[_0xe7ce('0x34')]({'name':path['parse'](_0x407ea7['filename'])['name'],'basename':path[_0xe7ce('0x35')](_0x407ea7['filename'])[_0xe7ce('0x21')]+_0xe7ce('0x36'),'type':'application/pdf'})[_0xe7ce('0x37')](function(_0x5d17a2){faxAccount[_0xe7ce('0x38')](_0x4b3d6f,{'from':_0x407ea7[_0xe7ce('0x30')],'mapKey':_0xe7ce('0x39'),'body':path[_0xe7ce('0x35')](_0x407ea7[_0xe7ce('0x2a')])[_0xe7ce('0x21')]+_0xe7ce('0x36'),'AttachmentId':_0x5d17a2['id']})[_0xe7ce('0x3a')](function(_0x2492ea){logger[_0xe7ce('0x3b')](_0x407ea7[_0xe7ce('0x1f')],_0xe7ce('0x3c'),JSON[_0xe7ce('0x3d')](_0x2492ea));});})[_0xe7ce('0x3a')](function(_0x6ec160){logger[_0xe7ce('0x3b')](_0x407ea7[_0xe7ce('0x1f')],'\x20receiveFax\x20',JSON[_0xe7ce('0x3d')](_0x6ec160));});});}logger[_0xe7ce('0x2b')](_0x407ea7['uniqueid'],_0xe7ce('0x3e'));}};Fax['prototype'][_0xe7ce('0x1a')]=function(_0x2298da){if(this[_0xe7ce('0xc')][_0x2298da[_0xe7ce('0x1f')]]){_[_0xe7ce('0x3f')](this[_0xe7ce('0x9')][_0x2298da[_0xe7ce('0x1f')]],_[_0xe7ce('0x40')](_0x2298da,['response',_0xe7ce('0x41')]));}};function updateStatus(_0x950d2d){if(_0x950d2d[_0xe7ce('0x42')]){faxMessage[_0xe7ce('0x43')](_0x950d2d[_0xe7ce('0x42')],{'failMessage':'SENDING\x20FAILED\x20'})[_0xe7ce('0x37')](function(_0x70ca3a){ut['logger'](_0xe7ce('0x44'),_0x70ca3a);})['catch'](function(_0x42e5ba){ut[_0xe7ce('0x45')]('[Fax][Message][Error][NoUpdate1]',_0x42e5ba);});}else{ut[_0xe7ce('0x45')](_0xe7ce('0x46'));}}Fax['prototype'][_0xe7ce('0x47')]=function(_0x50cc44,_0x231ace,_0x5a4672){var _0x48c558=this;var _0x342dc6={};if(_0x231ace){_0x342dc6={'read':_0x231ace};}else{_0x342dc6={'failMessage':_0x5a4672};}if(this[_0xe7ce('0xc')][_0x50cc44][_0xe7ce('0x42')]){faxMessage[_0xe7ce('0x43')](this['actions'][_0x50cc44][_0xe7ce('0x42')],_0x342dc6)['then'](function(_0x1328df){ut[_0xe7ce('0x45')](_0xe7ce('0x48'),_0x1328df);})[_0xe7ce('0x3a')](function(_0x5efc83){ut[_0xe7ce('0x45')](_0xe7ce('0x49'),_0x5efc83);})[_0xe7ce('0x4a')](function(){delete _0x48c558[_0xe7ce('0x9')][_0x50cc44];delete _0x48c558['actions'][_0x50cc44];});}else{ut['logger']('[Fax][Message][NoUpdate2]');delete this[_0xe7ce('0x9')][_0x50cc44];delete this[_0xe7ce('0xc')][_0x50cc44];}};Fax['prototype'][_0xe7ce('0x18')]=function(_0x4184f9){var _0x4dcee3=this;if(this[_0xe7ce('0x9')][_0x4184f9['uniqueid']]){if(this[_0xe7ce('0xc')][_0x4184f9[_0xe7ce('0x1f')]]){this[_0xe7ce('0x9')][_0x4184f9['uniqueid']]['id']=this[_0xe7ce('0xc')][_0x4184f9[_0xe7ce('0x1f')]]['id'];this[_0xe7ce('0x9')][_0x4184f9[_0xe7ce('0x1f')]][_0xe7ce('0x21')]=this[_0xe7ce('0xc')][_0x4184f9[_0xe7ce('0x1f')]]['name'];}logger[_0xe7ce('0x2b')](_0x4184f9[_0xe7ce('0x1f')],this[_0xe7ce('0xc')][_0x4184f9[_0xe7ce('0x1f')]]?_0xe7ce('0x4b'):_0xe7ce('0x4c'),JSON['stringify'](this[_0xe7ce('0x9')][_0x4184f9['uniqueid']]));if(this['actions'][_0x4184f9[_0xe7ce('0x1f')]]){if(this[_0xe7ce('0x9')][_0x4184f9[_0xe7ce('0x1f')]][_0xe7ce('0x4d')]>0x0&&this['channels'][_0x4184f9[_0xe7ce('0x1f')]][_0xe7ce('0x14')]===_0xe7ce('0x4e')){this[_0xe7ce('0x47')](_0x4184f9[_0xe7ce('0x1f')],!![]);}else{this[_0xe7ce('0x47')](_0x4184f9[_0xe7ce('0x1f')],![],this[_0xe7ce('0x9')][_0x4184f9[_0xe7ce('0x1f')]][_0xe7ce('0x4f')]?_0xe7ce('0x50')+this[_0xe7ce('0x9')][_0x4184f9[_0xe7ce('0x1f')]][_0xe7ce('0x4f')]:_0xe7ce('0x51'));}}}};Fax[_0xe7ce('0x1b')]['send']=function(_0x4674bc){var _0x3e5155=this;return new BPromise(function(_0x154616,_0xcd6aa4){_0x3e5155[_0xe7ce('0x52')](_0x4674bc,_0x3e5155['faxAccounts'][_0x4674bc['FaxAccountId']])['then'](function(_0xce8279){ut[_0xe7ce('0x45')](_0xe7ce('0x53'),_0xce8279);_0x154616(ut['message'](_0xe7ce('0x54')));})['catch'](function(_0x58ab4c){ut[_0xe7ce('0x45')](_0xe7ce('0x55'),_0x58ab4c);updateStatus(_0x4674bc);_0xcd6aa4(ut[_0xe7ce('0x33')](_0xe7ce('0x56')));});});};Fax['prototype'][_0xe7ce('0x57')]=function(_0x5c9ac1){var _0x2d5835=this;return new BPromise(function(_0x4b5c0f,_0x4e445f){var _0x40bd8e=_0x2d5835['checkTrunk'](_0x2d5835['faxAccounts'][_0x5c9ac1[_0xe7ce('0x58')]]['Trunk'],_0x5c9ac1);if(_0x40bd8e['isValid']){_0x4b5c0f(ut[_0xe7ce('0x33')](_0xe7ce('0x59')));}else{_0x4e445f(ut[_0xe7ce('0x33')](_0x40bd8e[_0xe7ce('0x33')]));}});};function originate(_0x2f5617,_0x14f5ba,_0x488199){return new BPromise(function(_0x374ec4,_0x4f7808){if(_0x488199){var _0x1eee6e=util[_0xe7ce('0x5a')]('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'](_0x2f5617[_0xe7ce('0x3')])[_0xe7ce('0x21')],_0x2f5617[_0xe7ce('0x3')]);gs[_0xe7ce('0x5b')](_0x1eee6e)[_0xe7ce('0x37')](function(){_0x2f5617[_0xe7ce('0x3')]=util[_0xe7ce('0x5a')](_0xe7ce('0x5c'),path[_0xe7ce('0x35')](_0x2f5617[_0xe7ce('0x3')])[_0xe7ce('0x5d')],path[_0xe7ce('0x35')](_0x2f5617[_0xe7ce('0x3')])[_0xe7ce('0x21')]);_0x14f5ba[_0xe7ce('0x5e')]=_0x2f5617[_0xe7ce('0x3')];ut[_0xe7ce('0x45')](_0xe7ce('0x5f'),'');ami[_0xe7ce('0x60')](ut[_0xe7ce('0x61')](_0x2f5617,_0x14f5ba))['then'](function(_0x1dcb11){_0x374ec4(_0x1dcb11);})[_0xe7ce('0x3a')](function(_0x472e1c){_0x4f7808(_0x472e1c);});})[_0xe7ce('0x3a')](function(_0x33c705){_0x4f7808(_0x33c705);});}else{ami['Action'](ut[_0xe7ce('0x61')](_0x2f5617,_0x14f5ba))[_0xe7ce('0x37')](function(_0x4c4fef){_0x374ec4(_0x4c4fef);})['catch'](function(_0x3a1d9a){_0x4f7808(_0x3a1d9a);});}});}Fax[_0xe7ce('0x1b')][_0xe7ce('0x52')]=function(_0x5957c7,_0x440a44){var _0x44a7fb=this;return new BPromise(function(_0xaa1a4f,_0x2fe50d){var _0x3841bf=uuid['v4']();var _0x1b98d6=ut['addVariables'](_0x5957c7,_0x440a44);_0x44a7fb['actions'][_0x3841bf]=new Action(_0x3841bf,_0x440a44,_0x5957c7);var _0x719408=_0x44a7fb[_0xe7ce('0xc')][_0x3841bf];if(path[_0xe7ce('0x35')](_0x5957c7['path'])['ext']===_0xe7ce('0x36')){originate(_0x719408,_0x1b98d6,!![])[_0xe7ce('0x37')](function(_0x529a6c){_0xaa1a4f(_0x529a6c);})['catch'](function(_0x558371){_0x2fe50d(_0x558371);});}else{originate(_0x719408,_0x1b98d6,![])[_0xe7ce('0x37')](function(_0x205a96){_0xaa1a4f(_0x205a96);})['catch'](function(_0x21f69e){_0x2fe50d(_0x21f69e);});}});};Fax[_0xe7ce('0x1b')][_0xe7ce('0x62')]=function(_0x55ec99){return!_['isNil'](_0x55ec99)&&!_['isNil'](_0x55ec99[_0xe7ce('0x21')])&&!_[_0xe7ce('0x63')](_0x55ec99[_0xe7ce('0x64')])&&_0x55ec99[_0xe7ce('0x64')]&&!_[_0xe7ce('0x63')](this[_0xe7ce('0xb')][util[_0xe7ce('0x5a')](_0xe7ce('0x65'),_0x55ec99[_0xe7ce('0x21')])])&&!_['isNil'](this['trunks'][util[_0xe7ce('0x5a')]('SIP/%s',_0x55ec99[_0xe7ce('0x21')])]['status'])&&(this[_0xe7ce('0xb')][util['format']('SIP/%s',_0x55ec99['name'])][_0xe7ce('0x29')]===_0xe7ce('0x66')||this[_0xe7ce('0xb')][util['format'](_0xe7ce('0x65'),_0x55ec99[_0xe7ce('0x21')])][_0xe7ce('0x29')]==='unmonitored');};Fax[_0xe7ce('0x1b')]['checkTrunk']=function(_0x104996,_0x559e54){if(!this[_0xe7ce('0x62')](_0x104996)){ut['logger']('[Fax][checkTrunk][Trunk\x20not\x20work]',_['isNil'](_0x104996)?'':_0x104996[_0xe7ce('0x21')]+_0xe7ce('0x67'));return{'isValid':![],'message':_0xe7ce('0x68')};}if(_[_0xe7ce('0x63')](_0x559e54['fax'])){ut[_0xe7ce('0x45')](_0xe7ce('0x69'),JSON['stringify'](_0x559e54));return{'isValid':![],'message':_0xe7ce('0x6a')};}if(_['isNil'](_0x559e54[_0xe7ce('0x3')])){ut['logger']('[Fax][checkTrunk][Empty\x20path]',JSON['stringify'](_0x559e54));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0xe7ce('0x6b')};};module[_0xe7ce('0x6c')]=Fax; \ No newline at end of file +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 diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index f2a0ee9..0791ee0 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 _0x6906=['util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','resolve','then','notify','catch','[Notify]\x20'];(function(_0x1a4b25,_0x4ef579){var _0x2d19fd=function(_0x468f7a){while(--_0x468f7a){_0x1a4b25['push'](_0x1a4b25['shift']());}};_0x2d19fd(++_0x4ef579);}(_0x6906,0x12b));var _0x6690=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6906[_0x397e5f];return _0x5302b8;};'use strict';var util=require(_0x6690('0x0'));var BPromise=require(_0x6690('0x1'));var logger=require(_0x6690('0x2'))(_0x6690('0x3'));var _=require(_0x6690('0x4'));var faxAccount=require(_0x6690('0x5'));function loggerCatch(_0x129129){return function(_0x5b821f){logger[_0x6690('0x6')](_0x129129,util[_0x6690('0x7')](_0x5b821f,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x1d2e5a,_0x4017e4){return BPromise[_0x6690('0x8')]()[_0x6690('0x9')](faxAccount[_0x6690('0xa')](_0x1d2e5a,_0x4017e4))[_0x6690('0xb')](loggerCatch(_0x6690('0xc')));}; \ No newline at end of file +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 diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 52f9c31..c4b58f4 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 _0xc8a0=['Exec\x20gs','inspect','util','../../../../config/logger','fax','bluebird','info'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xc8a0,0x17c));var _0x0c8a=function(_0x164044,_0x2ca426){_0x164044=_0x164044-0x0;var _0x57ba10=_0xc8a0[_0x164044];return _0x57ba10;};'use strict';var util=require(_0x0c8a('0x0'));var logger=require(_0x0c8a('0x1'))(_0x0c8a('0x2'));var BPromise=require(_0x0c8a('0x3'));var exec=require('child_process')['exec'];exports['execute']=function(_0x3b6dfa){return new BPromise(function(_0x378bbd,_0x34ec3e){exec(_0x3b6dfa,function(_0x431729,_0x25644e,_0x353dfb){logger[_0x0c8a('0x4')](_0x0c8a('0x5'),_0x25644e);if(_0x431729){logger[_0x0c8a('0x4')](_0x0c8a('0x5'),'\x20Error\x20:',util[_0x0c8a('0x6')](_0x431729,{'showHidden':![],'depth':null}),_0x25644e,_0x353dfb);_0x34ec3e(_0x431729);}_0x378bbd(_0x25644e);});});}; \ No newline at end of file +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 diff --git a/server/services/ami/fax/util/util.js b/server/services/ami/fax/util/util.js index 256bc5f..3ca1751 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 _0x878f=['inspect','maxrate','modem','gateway','faxdetect','localstationid','path','uniqueid','originate','channel','from-sip','format','\x22%s\x22\x20<%s>','headerinfo','lodash','moment','../../../../config/logger','fax','message','logger','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x878f,0x173));var _0xf878=function(_0x139dba,_0x5d89af){_0x139dba=_0x139dba-0x0;var _0x4b6055=_0x878f[_0x139dba];return _0x4b6055;};'use strict';var util=require('util');var _=require(_0xf878('0x0'));var moment=require(_0xf878('0x1'));var logger=require(_0xf878('0x2'))(_0xf878('0x3'));exports[_0xf878('0x4')]=function(_0x3d74cf){return{'message':_0x3d74cf};};exports[_0xf878('0x5')]=function(_0x45a37b,_0x240b48){logger[_0xf878('0x6')](_0x45a37b,util[_0xf878('0x7')](_0x240b48,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x4ac8d8,_0x3c5f5c){var _0x62b420={'XMF-ECM':_0x3c5f5c['ecm'],'XMF-HEADERINFO':_0x3c5f5c['headerinfo'],'XMF-MINRATE':_0x3c5f5c['minrate'],'XMF-MAXRATE':_0x3c5f5c[_0xf878('0x8')],'XMF-MODEM':util['format']('\x22%s\x22',_0x3c5f5c[_0xf878('0x9')]),'XMF-GATEWAY':_0x3c5f5c[_0xf878('0xa')],'XMF-FAXDETECT':_0x3c5f5c[_0xf878('0xb')],'XMF-T38TIMEOUT':_0x3c5f5c['t38timeout'],'XMF-LOCALSTATIONID':_0x3c5f5c[_0xf878('0xc')],'XMF-PATH':_0x4ac8d8[_0xf878('0xd')]};return _0x62b420;};exports['variablesAction']=function(_0xdf76,_0x4f7e7f){return{'actionid':_0xdf76[_0xf878('0xe')],'action':_0xf878('0xf'),'channel':_0xdf76[_0xf878('0x10')],'Exten':'xcally-motion-fax','Context':_0xf878('0x11'),'Priority':'1','callerid':util[_0xf878('0x12')](_0xf878('0x13'),_0xdf76['headerinfo']?_0xdf76[_0xf878('0x14')]:'',_0xdf76[_0xf878('0xc')]),'variable':_0x4f7e7f,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0xdf76[_0xf878('0xe')]};}; \ No newline at end of file +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 diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 9e7bcdd..ae4c6f8 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 _0x2bdd=['bluebird','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./fax','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','initTriggers','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','sync'];(function(_0x1598ec,_0x5a55c0){var _0x5d7b57=function(_0x2b5573){while(--_0x2b5573){_0x1598ec['push'](_0x1598ec['shift']());}};_0x5d7b57(++_0x5a55c0);}(_0x2bdd,0x1dc));var _0xd2bd=function(_0x585133,_0x2412a1){_0x585133=_0x585133-0x0;var _0x18254a=_0x2bdd[_0x585133];return _0x18254a;};'use strict';var BPromise=require(_0xd2bd('0x0'));var util=require('util');var moment=require(_0xd2bd('0x1'));var server=require(_0xd2bd('0x2'));var Realtime=require(_0xd2bd('0x3'));var Report=require(_0xd2bd('0x4'));var Acw=require(_0xd2bd('0x5'));var Trigger=require(_0xd2bd('0x6'));var Dialer=require(_0xd2bd('0x7'));var Preview=require('./preview');var Fax=require(_0xd2bd('0x8'));var user=require('./rpc/user');var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0xd2bd('0x9'));var voiceCallReport=require(_0xd2bd('0xa'));var trunk=require(_0xd2bd('0xb'));var trigger=require(_0xd2bd('0xc'));var template=require('./rpc/template');var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0xd2bd('0xd'));var voiceExtension=require(_0xd2bd('0xe'));var faxAccount=require(_0xd2bd('0xf'));var zendesk=require(_0xd2bd('0x10'));var salesforce=require(_0xd2bd('0x11'));var sugarcrm=require(_0xd2bd('0x12'));var freshdesk=require(_0xd2bd('0x13'));var desk=require(_0xd2bd('0x14'));var zoho=require(_0xd2bd('0x15'));var vtiger=require(_0xd2bd('0x16'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0xd2bd('0x17'));var dynamics365=require(_0xd2bd('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xd2bd('0x19')](_0xd2bd('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xd2bd('0x19')](_0xd2bd('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xd2bd('0x1b')]()['then'](user['getAgents']())[_0xd2bd('0x1c')](realtime[_0xd2bd('0x1d')]())[_0xd2bd('0x1c')](user[_0xd2bd('0x1e')]())[_0xd2bd('0x1c')](realtime[_0xd2bd('0x1f')]())[_0xd2bd('0x1c')](trunk[_0xd2bd('0x20')]())[_0xd2bd('0x1c')](realtime[_0xd2bd('0x21')]())[_0xd2bd('0x1c')](voiceQueue[_0xd2bd('0x22')]())[_0xd2bd('0x1c')](realtime[_0xd2bd('0x23')]())[_0xd2bd('0x1c')](trigger['getTriggers']())[_0xd2bd('0x1c')](realtime[_0xd2bd('0x24')]())[_0xd2bd('0x1c')](template['getTemplates']())[_0xd2bd('0x1c')](realtime[_0xd2bd('0x25')]())['then'](zendesk[_0xd2bd('0x26')]())[_0xd2bd('0x1c')](realtime['initZendeskAccounts']())[_0xd2bd('0x1c')](salesforce[_0xd2bd('0x27')]())[_0xd2bd('0x1c')](realtime[_0xd2bd('0x28')]())[_0xd2bd('0x1c')](sugarcrm[_0xd2bd('0x29')]())['then'](realtime['initSugarcrmAccounts']())[_0xd2bd('0x1c')](freshdesk[_0xd2bd('0x2a')]())[_0xd2bd('0x1c')](realtime[_0xd2bd('0x2b')]())[_0xd2bd('0x1c')](desk[_0xd2bd('0x2c')]())[_0xd2bd('0x1c')](realtime[_0xd2bd('0x2d')]())[_0xd2bd('0x1c')](zoho[_0xd2bd('0x2e')]())[_0xd2bd('0x1c')](realtime[_0xd2bd('0x2f')]())[_0xd2bd('0x1c')](vtiger[_0xd2bd('0x30')]())[_0xd2bd('0x1c')](realtime['initVtigerAccounts']())[_0xd2bd('0x1c')](freshsales[_0xd2bd('0x31')]())[_0xd2bd('0x1c')](realtime[_0xd2bd('0x32')]())[_0xd2bd('0x1c')](servicenow[_0xd2bd('0x33')]())['then'](realtime[_0xd2bd('0x34')]())[_0xd2bd('0x1c')](dynamics365[_0xd2bd('0x35')]())[_0xd2bd('0x1c')](realtime[_0xd2bd('0x36')]())[_0xd2bd('0x1c')](campaign[_0xd2bd('0x37')]())[_0xd2bd('0x1c')](realtime[_0xd2bd('0x38')]())[_0xd2bd('0x1c')](voiceExtension[_0xd2bd('0x39')]())[_0xd2bd('0x1c')](realtime[_0xd2bd('0x3a')]())[_0xd2bd('0x1c')](faxAccount['getFaxAccounts']())['then'](realtime['initFaxAccounts']())['then'](function(){return realtime;});}function initParams(){return BPromise[_0xd2bd('0x1b')]()[_0xd2bd('0x1c')](voiceQueueReport['getVoiceQueueReports']())[_0xd2bd('0x1c')](realtime[_0xd2bd('0x3b')]())[_0xd2bd('0x1c')](cmHopperHistory[_0xd2bd('0x3c')]())[_0xd2bd('0x1c')](realtime[_0xd2bd('0x3d')]())[_0xd2bd('0x1c')](cmHopperHistory['getCampaignHopperHistory']())[_0xd2bd('0x1c')](realtime['initCampaignHopperHistory']())['then'](voiceCallReport[_0xd2bd('0x3e')]())['then'](realtime[_0xd2bd('0x3f')]())[_0xd2bd('0x1c')](function(_0xc6c3a5){})[_0xd2bd('0x40')](function(_0x4e0c2a){console[_0xd2bd('0x41')](_0x4e0c2a);});}function main(){return server[_0xd2bd('0x42')](realtime,preview,fax)[_0xd2bd('0x1c')](function(_0x317d7e){return initRealtime();})[_0xd2bd('0x1c')](function(){return initParams();})[_0xd2bd('0x1c')](function(){report[_0xd2bd('0x43')]();setInterval(initRealtime,0x1388);})[_0xd2bd('0x40')](function(_0x22f29f){console[_0xd2bd('0x41')](_0x22f29f);});}main(); \ No newline at end of file +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 diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 1a4d1af..9d24bea 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 _0x5f3f=['voiceStatusQueue','stringify','exports','lodash','moment','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','stateTime','unknown','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','md5','updateStatusRealtime','state','not_inuse','idle','inuse','talking','statePause','toNumber','format','status'];(function(_0x28d833,_0x116ffd){var _0x39518b=function(_0x4bb341){while(--_0x4bb341){_0x28d833['push'](_0x28d833['shift']());}};_0x39518b(++_0x116ffd);}(_0x5f3f,0x1f1));var _0xf5f3=function(_0x3d9866,_0x226ff8){_0x3d9866=_0x3d9866-0x0;var _0x1d6f97=_0x5f3f[_0x3d9866];return _0x1d6f97;};'use strict';var _=require(_0xf5f3('0x0'));var util=require('util');var moment=require(_0xf5f3('0x1'));var md5=require('md5');var Redis=require(_0xf5f3('0x2'));var config=require(_0xf5f3('0x3'));config['redis']=_[_0xf5f3('0x4')](config[_0xf5f3('0x5')],{'host':_0xf5f3('0x6'),'port':0x18eb});var io=require(_0xf5f3('0x7'))(new Redis(config[_0xf5f3('0x5')]));function Agent(_0x3ac34b){this['id']=_0x3ac34b['id']||0x0;this[_0xf5f3('0x8')]=_0x3ac34b['name']||'';this[_0xf5f3('0x9')]=_0x3ac34b['email']||'';this[_0xf5f3('0xa')]=_0x3ac34b['accountcode']||'';this[_0xf5f3('0xb')]=_0x3ac34b[_0xf5f3('0xb')]||'';this['state']='unknown';this[_0xf5f3('0xc')]=0x0;this['status']=_0xf5f3('0xd');this[_0xf5f3('0xe')]='';this[_0xf5f3('0xf')]='';this[_0xf5f3('0x10')]='';this[_0xf5f3('0x11')]='';this[_0xf5f3('0x12')]=_0x3ac34b[_0xf5f3('0x12')]||![];this[_0xf5f3('0x13')]=_0xf5f3('0xd');this[_0xf5f3('0x14')]=0x0;this[_0xf5f3('0x15')]='';this['voiceStatusQueue']='';this[_0xf5f3('0x16')]=![];this[_0xf5f3('0x17')]=![];this[_0xf5f3('0x18')]='';}Agent['prototype'][_0xf5f3('0x19')]=function(_0x873655){var _0x250114;if(_0x873655&&_0x873655[_0xf5f3('0x1a')]){_0x250114=_0x873655[_0xf5f3('0x1a')]['toLowerCase']();switch(_0x250114){case _0xf5f3('0x1b'):_0x250114=_0xf5f3('0x1c');break;case _0xf5f3('0x1d'):_0x250114=_0xf5f3('0x1e');break;}}if(_0x250114&&this[_0xf5f3('0x13')]!==_0x250114||_0x873655[_0xf5f3('0x1f')]){this[_0xf5f3('0x14')]=_[_0xf5f3('0x20')](moment()[_0xf5f3('0x21')]('x'));}if(_0x250114){this[_0xf5f3('0x13')]=_0x250114;}var _0x33ac18={'id':this['id'],'name':this['name'],'email':this[_0xf5f3('0x9')],'accountcode':this[_0xf5f3('0xa')],'fullname':this[_0xf5f3('0xb')],'state':this[_0xf5f3('0x1a')],'stateTime':this[_0xf5f3('0xc')],'status':this[_0xf5f3('0x22')],'address':this['address'],'online':this[_0xf5f3('0x12')],'voiceStatus':this[_0xf5f3('0x13')],'voiceStatusTime':this[_0xf5f3('0x14')],'voiceStatusCallerIdNumber':this[_0xf5f3('0x15')],'voiceStatusQueue':this[_0xf5f3('0x23')],'interface':this[_0xf5f3('0x11')],'onhold':this[_0xf5f3('0x16')]};var _0x4bc6cd=md5(JSON[_0xf5f3('0x24')](_0x33ac18));if(this[_0xf5f3('0x18')]!==_0x4bc6cd){this[_0xf5f3('0x18')]=_0x4bc6cd;io['to'](util['format']('user:%s',_0x33ac18[_0xf5f3('0x8')]))['emit']('user:save',_0x33ac18);}};module[_0xf5f3('0x25')]=Agent; \ No newline at end of file +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 diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index bbefa6a..2843aaf 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(_0x513a0b,_0x232ae0){var _0x208530=function(_0x1c3a56){while(--_0x1c3a56){_0x513a0b['push'](_0x513a0b['shift']());}};_0x208530(++_0x232ae0);}(_0xb10b,0x12a));var _0xbb10=function(_0x32b3c2,_0xe56fd){_0x32b3c2=_0x32b3c2-0x0;var _0x40a313=_0xb10b[_0x32b3c2];return _0x40a313;};'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 _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 diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 363802f..c2be5ec 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 _0xdcde=['monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','calleridnum','calleridname','connectedlinenum','uniqueid','linkedid','exten','answertime','endtime','unmanaged','abandoned','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','queue'];(function(_0x4ff5b5,_0x30c198){var _0x2f12f4=function(_0x2cd4e7){while(--_0x2cd4e7){_0x4ff5b5['push'](_0x4ff5b5['shift']());}};_0x2f12f4(++_0x30c198);}(_0xdcde,0x1d0));var _0xedcd=function(_0x32d15d,_0x17e5ea){_0x32d15d=_0x32d15d-0x0;var _0x2f7d21=_0xdcde[_0x32d15d];return _0x2f7d21;};'use strict';function Channel(){this[_0xedcd('0x0')]=null;this[_0xedcd('0x1')]='';this['destinationchannel']='';this[_0xedcd('0x2')]=0x0;this[_0xedcd('0x3')]='';this[_0xedcd('0x4')]=undefined;this['connectedlinename']=undefined;this['accountcode']=0x0;this['context']='';this[_0xedcd('0x5')]=0x0;this[_0xedcd('0x6')]=0x0;this[_0xedcd('0x7')]=0x0;this['answered']=![];this[_0xedcd('0x8')]=null;this[_0xedcd('0x9')]=null;this[_0xedcd('0xa')]=![];this[_0xedcd('0xb')]=![];this['lastapplication']='';this[_0xedcd('0xc')]='';this[_0xedcd('0xd')]=0x0;this[_0xedcd('0xe')]=0x0;this[_0xedcd('0xf')]=0x0;this[_0xedcd('0x10')]=null;this[_0xedcd('0x11')]=null;this[_0xedcd('0x12')]=null;this[_0xedcd('0x13')]=![];this[_0xedcd('0x14')]=null;this[_0xedcd('0x15')]=null;this[_0xedcd('0x16')]=[];this[_0xedcd('0x17')]=undefined;this[_0xedcd('0x18')]=undefined;this[_0xedcd('0x19')]=0x0;}module[_0xedcd('0x1a')]=Channel; \ No newline at end of file +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 diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 5cfe36e..109bf97 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 _0xd493=['serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type'];(function(_0x58e9e9,_0x183b06){var _0x5e6378=function(_0x317ebf){while(--_0x317ebf){_0x58e9e9['push'](_0x58e9e9['shift']());}};_0x5e6378(++_0x183b06);}(_0xd493,0x1bd));var _0x3d49=function(_0x4761c5,_0x4f74e5){_0x4761c5=_0x4761c5-0x0;var _0x257d2a=_0xd493[_0x4761c5];return _0x257d2a;};'use strict';function DeskAccount(_0x3f7f74){this['id']=_0x3f7f74['id']||0x0;this['name']=_0x3f7f74[_0x3d49('0x0')]||'';this[_0x3d49('0x1')]=_0x3f7f74['username']||'';this[_0x3d49('0x2')]=_0x3f7f74['remoteUri']||'';this['authType']=_0x3f7f74[_0x3d49('0x3')]||'';this[_0x3d49('0x4')]=_0x3f7f74['password']||'';this['consumerKey']=_0x3f7f74[_0x3d49('0x5')]||'';this[_0x3d49('0x6')]=_0x3f7f74[_0x3d49('0x6')]||'';this[_0x3d49('0x7')]=_0x3f7f74['token']||'';this[_0x3d49('0x8')]=_0x3f7f74[_0x3d49('0x8')]||'';this[_0x3d49('0x9')]=_0x3f7f74[_0x3d49('0x9')]||'';this[_0x3d49('0xa')]=_0x3f7f74[_0x3d49('0xa')]||'';this[_0x3d49('0xb')]=_0x3f7f74[_0x3d49('0xb')]||{};}module[_0x3d49('0xc')]=DeskAccount; \ No newline at end of file +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 diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 928bc6d..0624f2c 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 _0x4d08=['exports','username','password','tenantId','clientId','clientSecret','serverUrl','Configurations'];(function(_0x20629d,_0x1a6757){var _0x4ca950=function(_0x2c806c){while(--_0x2c806c){_0x20629d['push'](_0x20629d['shift']());}};_0x4ca950(++_0x1a6757);}(_0x4d08,0x1b1));var _0x84d0=function(_0x2ecc65,_0xd75c48){_0x2ecc65=_0x2ecc65-0x0;var _0x103cc3=_0x4d08[_0x2ecc65];return _0x103cc3;};'use strict';function Dynamics365Account(_0x3b4a06){this['id']=_0x3b4a06['id']||0x0;this['name']=_0x3b4a06['name']||'';this[_0x84d0('0x0')]=_0x3b4a06[_0x84d0('0x0')]||'';this[_0x84d0('0x1')]=_0x3b4a06[_0x84d0('0x1')]||'';this['remoteUri']=_0x3b4a06['remoteUri']||'';this[_0x84d0('0x2')]=_0x3b4a06[_0x84d0('0x2')]||'';this[_0x84d0('0x3')]=_0x3b4a06['clientId']||'';this[_0x84d0('0x4')]=_0x3b4a06['clientSecret']||{};this[_0x84d0('0x5')]=_0x3b4a06[_0x84d0('0x5')]||'';this[_0x84d0('0x6')]=_0x3b4a06[_0x84d0('0x6')]||{};}module[_0x84d0('0x7')]=Dynamics365Account; \ No newline at end of file +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 diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 9368b64..a7f4214 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 _0x4c99=['localstationid','minrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name','ecm','headerinfo'];(function(_0x1e29c,_0x34855d){var _0x9e5682=function(_0x371627){while(--_0x371627){_0x1e29c['push'](_0x1e29c['shift']());}};_0x9e5682(++_0x34855d);}(_0x4c99,0x1ec));var _0x94c9=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x4c99[_0xa148b7];return _0x51efd3;};'use strict';function FaxAccount(_0x18940b){this['id']=_0x18940b['id']||0x0;this['name']=_0x18940b[_0x94c9('0x0')]||'';this['description']=_0x18940b['description'];this['ecm']=_0x18940b[_0x94c9('0x1')];this[_0x94c9('0x2')]=_0x18940b['headerinfo'];this[_0x94c9('0x3')]=_0x18940b[_0x94c9('0x3')];this['minrate']=_0x18940b[_0x94c9('0x4')]||0x960;this['maxrate']=_0x18940b['maxrate']||0x3840;this['modem']=_0x18940b[_0x94c9('0x5')]||_0x94c9('0x6');this[_0x94c9('0x7')]=_0x18940b[_0x94c9('0x7')]||'no';this[_0x94c9('0x8')]=_0x18940b[_0x94c9('0x8')]||'no';this[_0x94c9('0x9')]=_0x18940b[_0x94c9('0x9')]||0x1388;this[_0x94c9('0xa')]=_0x18940b[_0x94c9('0xa')]||'SIP';this[_0x94c9('0xb')]=_0x18940b[_0x94c9('0xb')]?_0x18940b[_0x94c9('0xb')]:undefined;this['ListId']=_0x18940b[_0x94c9('0xc')];this[_0x94c9('0xd')]=_0x18940b[_0x94c9('0xd')];}module[_0x94c9('0xe')]=FaxAccount; \ No newline at end of file +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 diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 282d0e5..68e3310 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 _0xd387=['Configurations','name','username','remoteUri','serverUrl'];(function(_0x2350dd,_0x53e293){var _0x5ca2db=function(_0x5dacc7){while(--_0x5dacc7){_0x2350dd['push'](_0x2350dd['shift']());}};_0x5ca2db(++_0x53e293);}(_0xd387,0x123));var _0x7d38=function(_0x4c88fb,_0x442a53){_0x4c88fb=_0x4c88fb-0x0;var _0x451896=_0xd387[_0x4c88fb];return _0x451896;};'use strict';function FreshdeskAccount(_0x3be3d8){this['id']=_0x3be3d8['id']||0x0;this[_0x7d38('0x0')]=_0x3be3d8[_0x7d38('0x0')]||'';this['username']=_0x3be3d8[_0x7d38('0x1')]||'';this['apiKey']=_0x3be3d8['token']||'';this[_0x7d38('0x2')]=_0x3be3d8['remoteUri']||'';this[_0x7d38('0x3')]=_0x3be3d8[_0x7d38('0x3')]||'';this[_0x7d38('0x4')]=_0x3be3d8[_0x7d38('0x4')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +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 diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 26575a5..5e55113 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 _0x0599=['remoteUri','serverUrl','Configurations','exports','name','apiKey','token'];(function(_0x4a8191,_0x510ed9){var _0x5f1f2e=function(_0x150cd0){while(--_0x150cd0){_0x4a8191['push'](_0x4a8191['shift']());}};_0x5f1f2e(++_0x510ed9);}(_0x0599,0x13f));var _0x9059=function(_0x1a81e7,_0x4ac701){_0x1a81e7=_0x1a81e7-0x0;var _0x189511=_0x0599[_0x1a81e7];return _0x189511;};'use strict';function FreshsalesAccount(_0x2b9d99){this['id']=_0x2b9d99['id']||0x0;this[_0x9059('0x0')]=_0x2b9d99[_0x9059('0x0')]||'';this['username']=_0x2b9d99['username']||'';this[_0x9059('0x1')]=_0x2b9d99[_0x9059('0x2')]||'';this[_0x9059('0x3')]=_0x2b9d99[_0x9059('0x3')]||'';this[_0x9059('0x4')]=_0x2b9d99['serverUrl']||'';this[_0x9059('0x5')]=_0x2b9d99[_0x9059('0x5')]||{};}module[_0x9059('0x6')]=FreshsalesAccount; \ No newline at end of file +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 diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index d77de41..e119652 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 _0xdd79=['channel','connectedlinename','accountcode','context','exten','holdtime','assigned','lastAssignedTo','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','originalposition'];(function(_0xf38308,_0x3056e3){var _0x273583=function(_0x1eab83){while(--_0x1eab83){_0xf38308['push'](_0xf38308['shift']());}};_0x273583(++_0x3056e3);}(_0xdd79,0x10f));var _0x9dd7=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xdd79[_0x501510];return _0x1e6ee5;};'use strict';function QueueReport(){this[_0x9dd7('0x0')]=_0x9dd7('0x1');this[_0x9dd7('0x2')]='';this[_0x9dd7('0x3')]='';this[_0x9dd7('0x4')]='';this[_0x9dd7('0x5')]='';this[_0x9dd7('0x6')]=null;this['queuecallerleaveAt']=null;this[_0x9dd7('0x7')]=0x1;this[_0x9dd7('0x8')]=0x1;this[_0x9dd7('0x9')]=![];this[_0x9dd7('0xa')]=null;this[_0x9dd7('0xb')]=![];this[_0x9dd7('0xc')]=null;this[_0x9dd7('0xd')]=![];this['queuecallerexitAt']=null;this[_0x9dd7('0xe')]=0x1;this[_0x9dd7('0xf')]='';this['connectedlinenum']='';this[_0x9dd7('0x10')]='';this[_0x9dd7('0x11')]='';this[_0x9dd7('0x12')]='';this[_0x9dd7('0x13')]='';this['priority']='';this[_0x9dd7('0x14')]=0x0;this[_0x9dd7('0x15')]=![];this[_0x9dd7('0x16')]='';this[_0x9dd7('0x17')]=0x0;this[_0x9dd7('0x18')]={};}module[_0x9dd7('0x19')]=QueueReport; \ No newline at end of file +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 diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 02579eb..d0dadb8 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 _0xd939=['securityToken','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientSecret'];(function(_0xe53164,_0x4bf682){var _0x4286d9=function(_0x40d03c){while(--_0x40d03c){_0xe53164['push'](_0xe53164['shift']());}};_0x4286d9(++_0x4bf682);}(_0xd939,0xcd));var _0x9d93=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0xd939[_0x5ddaac];return _0x2a9c58;};'use strict';function SalesforceAccount(_0xf6af73){this['id']=_0xf6af73['id']||0x0;this[_0x9d93('0x0')]=_0xf6af73[_0x9d93('0x0')]||'';this[_0x9d93('0x1')]=_0xf6af73['username']||'';this[_0x9d93('0x2')]=_0xf6af73[_0x9d93('0x2')]||'';this[_0x9d93('0x3')]=_0xf6af73[_0x9d93('0x3')]||'';this['clientId']=_0xf6af73['clientId']||'';this[_0x9d93('0x4')]=_0xf6af73['clientSecret']||'';this[_0x9d93('0x5')]=_0xf6af73[_0x9d93('0x5')]||'';this['type']=_0xf6af73['type']||_0x9d93('0x6');this['serverUrl']=_0xf6af73[_0x9d93('0x7')]||'';this[_0x9d93('0x8')]=_0xf6af73[_0x9d93('0x8')]||{};}module[_0x9d93('0x9')]=SalesforceAccount; \ No newline at end of file +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 diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index a663737..aaeb560 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 _0xdbb3=['name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x17a817,_0x2efe60){var _0x95e2b8=function(_0x51912c){while(--_0x51912c){_0x17a817['push'](_0x17a817['shift']());}};_0x95e2b8(++_0x2efe60);}(_0xdbb3,0x1c2));var _0x3dbb=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xdbb3[_0x4e1d03];return _0x362d4b;};'use strict';function ServicenowAccount(_0x362cee){this['id']=_0x362cee['id']||0x0;this[_0x3dbb('0x0')]=_0x362cee[_0x3dbb('0x0')]||'';this[_0x3dbb('0x1')]=_0x362cee[_0x3dbb('0x1')]||'';this['password']=_0x362cee[_0x3dbb('0x2')]||'';this[_0x3dbb('0x3')]=_0x362cee[_0x3dbb('0x3')]||'';this['serverUrl']=_0x362cee[_0x3dbb('0x4')]||'';this[_0x3dbb('0x5')]=_0x362cee[_0x3dbb('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +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 diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 4035adc..2afa63b 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 _0x495b=['serverUrl','Configurations','name','username','password','remoteUri'];(function(_0x1abf4f,_0x4e1218){var _0x3cd2dc=function(_0x2ab3a6){while(--_0x2ab3a6){_0x1abf4f['push'](_0x1abf4f['shift']());}};_0x3cd2dc(++_0x4e1218);}(_0x495b,0x98));var _0xb495=function(_0x419d8c,_0x33a069){_0x419d8c=_0x419d8c-0x0;var _0x260b1c=_0x495b[_0x419d8c];return _0x260b1c;};'use strict';function SugarcrmAccount(_0x35601f){this['id']=_0x35601f['id']||0x0;this['name']=_0x35601f[_0xb495('0x0')]||'';this['username']=_0x35601f[_0xb495('0x1')]||'';this[_0xb495('0x2')]=_0x35601f['password']||'';this[_0xb495('0x3')]=_0x35601f[_0xb495('0x3')]||'';this['serverUrl']=_0x35601f[_0xb495('0x4')]||'';this[_0xb495('0x5')]=_0x35601f[_0xb495('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +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 diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 7d75bb7..310fb2b 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 _0x763b=['name','accountcode','state','unknown','stateTime','status','address','exports'];(function(_0x28682f,_0x4c41da){var _0xde821c=function(_0x2a6510){while(--_0x2a6510){_0x28682f['push'](_0x28682f['shift']());}};_0xde821c(++_0x4c41da);}(_0x763b,0x1d8));var _0xb763=function(_0x39f076,_0x9988fa){_0x39f076=_0x39f076-0x0;var _0x39165d=_0x763b[_0x39f076];return _0x39165d;};'use strict';function Telephone(_0x144127){this['id']=_0x144127['id']||0x0;this[_0xb763('0x0')]=_0x144127['name']||'';this[_0xb763('0x1')]=_0x144127[_0xb763('0x1')]||'';this[_0xb763('0x2')]=_0xb763('0x3');this[_0xb763('0x4')]=0x0;this[_0xb763('0x5')]=_0xb763('0x3');this[_0xb763('0x6')]='';}module[_0xb763('0x7')]=Telephone; \ No newline at end of file +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 diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 0ff093a..2972e13 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 _0x1375=['name','html','exports'];(function(_0x4c1b76,_0x2cdc2d){var _0x3ace6b=function(_0x40fac1){while(--_0x40fac1){_0x4c1b76['push'](_0x4c1b76['shift']());}};_0x3ace6b(++_0x2cdc2d);}(_0x1375,0xed));var _0x5137=function(_0x4d35e5,_0x5894d3){_0x4d35e5=_0x4d35e5-0x0;var _0x1519c8=_0x1375[_0x4d35e5];return _0x1519c8;};'use strict';function template(_0x5c0307){this['id']=_0x5c0307['id']||0x0;this[_0x5137('0x0')]=_0x5c0307[_0x5137('0x0')]||'';this[_0x5137('0x1')]=_0x5c0307[_0x5137('0x1')]||'';}module[_0x5137('0x2')]=template; \ No newline at end of file +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 diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 50a485f..69d01d5 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 _0x3e74=['Actions','name','channel','status','AllConditions','AnyConditions'];(function(_0x108b65,_0x452be4){var _0x195ab8=function(_0x4df574){while(--_0x4df574){_0x108b65['push'](_0x108b65['shift']());}};_0x195ab8(++_0x452be4);}(_0x3e74,0x175));var _0x43e7=function(_0x529fa1,_0x1f614b){_0x529fa1=_0x529fa1-0x0;var _0x503298=_0x3e74[_0x529fa1];return _0x503298;};'use strict';function Trigger(_0x284ef8){this['id']=_0x284ef8['id']||0x0;this['name']=_0x284ef8[_0x43e7('0x0')]||'';this[_0x43e7('0x1')]=_0x284ef8[_0x43e7('0x1')]||'voice';this['status']=_0x284ef8[_0x43e7('0x2')]||![];this['AllConditions']=_0x284ef8[_0x43e7('0x3')]||[];this[_0x43e7('0x4')]=_0x284ef8[_0x43e7('0x4')]||[];this[_0x43e7('0x5')]=_0x284ef8[_0x43e7('0x5')]||[];}module['exports']=Trigger; \ No newline at end of file +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 diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 5e96813..fe583b9 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 _0xe0bc=['registrationtime','address','name','state','unknown','stateTime','status','registry','indexOf','host','port','domain','domainport','stateRegistry'];(function(_0x46f739,_0x2872e6){var _0x5e4f2e=function(_0x2b486d){while(--_0x2b486d){_0x46f739['push'](_0x46f739['shift']());}};_0x5e4f2e(++_0x2872e6);}(_0xe0bc,0x1c2));var _0xce0b=function(_0x30c644,_0x361831){_0x30c644=_0x30c644-0x0;var _0x360da5=_0xe0bc[_0x30c644];return _0x360da5;};'use strict';function Trunk(_0x286503){this['id']=_0x286503['id']||0x0;this['active']=_0x286503['active']||![];this[_0xce0b('0x0')]=_0x286503[_0xce0b('0x0')]||'';this[_0xce0b('0x1')]=_0xce0b('0x2');this[_0xce0b('0x3')]=0x0;this[_0xce0b('0x4')]=_0xce0b('0x2');this[_0xce0b('0x5')]=_0x286503[_0xce0b('0x5')]&&_0x286503['registry'][_0xce0b('0x6')](':')?_0x286503[_0xce0b('0x5')]['split'](':')[0x0]:'';this[_0xce0b('0x7')]='';this[_0xce0b('0x8')]='';this[_0xce0b('0x9')]='';this[_0xce0b('0xa')]='';this['refresh']='';this[_0xce0b('0xb')]=_0xce0b('0x2');this[_0xce0b('0xc')]='';this[_0xce0b('0xd')]='';}module['exports']=Trunk; \ No newline at end of file +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 diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 874b041..42b29d4 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 _0x91d1=['exports','exten','recordingFormat'];(function(_0x2ea7b3,_0x52883b){var _0x4c90aa=function(_0x57de6f){while(--_0x57de6f){_0x2ea7b3['push'](_0x2ea7b3['shift']());}};_0x4c90aa(++_0x52883b);}(_0x91d1,0x94));var _0x191d=function(_0x44958a,_0x51e44c){_0x44958a=_0x44958a-0x0;var _0xef8f91=_0x91d1[_0x44958a];return _0xef8f91;};'use strict';function voiceExtension(_0x56f2f1){this['id']=_0x56f2f1['id']||0x0;this[_0x191d('0x0')]=_0x56f2f1[_0x191d('0x0')]||'';this['recordingFormat']=_0x56f2f1[_0x191d('0x1')]||'none';this['mandatoryDisposition']=_0x56f2f1['mandatoryDisposition']||![];}module[_0x191d('0x2')]=voiceExtension; \ No newline at end of file +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 diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 753bc65..624a6f3 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 _0x2f32=['originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialCutDigit','strategy','queueStatusComplete','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown','inuse','busy','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','total','sumDuration','sumHoldTime','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x2f32,0xd2));var _0x22f3=function(_0x4e9455,_0xf16a5){_0x4e9455=_0x4e9455-0x0;var _0x22fb47=_0x2f32[_0x4e9455];return _0x22fb47;};'use strict';var statusDesc=[_0x22f3('0x0'),'not_inuse',_0x22f3('0x1'),_0x22f3('0x2'),'invalid','unavailable',_0x22f3('0x3'),_0x22f3('0x4'),_0x22f3('0x5')];var monitorFormat={'wav':_0x22f3('0x6'),'wav49':_0x22f3('0x7'),'gsm':_0x22f3('0x8')};var strategy={'rrmemory':_0x22f3('0x9'),'roundrobin':_0x22f3('0xa')};function VoiceQueue(_0x4c71c9){this['id']=_0x4c71c9['id']||0x0;this[_0x22f3('0xb')]=_0x4c71c9['name']||'';this[_0x22f3('0xc')]=_0x4c71c9[_0x22f3('0xc')]||'';this[_0x22f3('0xd')]=_0x4c71c9[_0x22f3('0xd')]||_0x22f3('0xe');this[_0x22f3('0xf')]=0x0;this['talking']=0x0;this[_0x22f3('0x10')]=0x0;this['answered']=0x0;this[_0x22f3('0x11')]=0x0;this[_0x22f3('0x12')]=0x0;this['sumBillable']=0x0;this[_0x22f3('0x13')]=0x0;this[_0x22f3('0x14')]=0x0;this[_0x22f3('0x15')]=0x0;this[_0x22f3('0x16')]=0x0;this['acw']=_0x4c71c9[_0x22f3('0x17')]||![];this[_0x22f3('0x18')]=_0x4c71c9[_0x22f3('0x18')]||0xa;this[_0x22f3('0x19')]=_0x4c71c9[_0x22f3('0x19')]||'no';this[_0x22f3('0x1a')]=!![];this[_0x22f3('0x1b')]='';this[_0x22f3('0x1c')]=0x0;this[_0x22f3('0x1d')]=0x0;this[_0x22f3('0x1e')]=_0x4c71c9[_0x22f3('0x1e')]||null;this[_0x22f3('0x1f')]=_0x4c71c9[_0x22f3('0x1f')]?_0x4c71c9[_0x22f3('0x1f')]:null;this[_0x22f3('0x20')]=_0x4c71c9['dialActive'];this[_0x22f3('0x21')]=_0x4c71c9['dialMethod']||_0x22f3('0x22');this[_0x22f3('0x23')]=_0x4c71c9['dialLimitChannel']||0x0;this[_0x22f3('0x24')]=_0x4c71c9[_0x22f3('0x24')]||0x0;this[_0x22f3('0x25')]=_0x4c71c9[_0x22f3('0x25')]||0x1;this[_0x22f3('0x26')]=_0x4c71c9['dialPredictiveOptimization']||_0x22f3('0x27');this[_0x22f3('0x28')]=_0x4c71c9[_0x22f3('0x28')]||0.03;this[_0x22f3('0x29')]=_0x4c71c9['dialPredictiveInterval']||0x258;this['dialOriginateCallerIdName']=_0x4c71c9[_0x22f3('0x2a')]||'anonymous';this[_0x22f3('0x2b')]=_0x4c71c9[_0x22f3('0x2b')]||_0x22f3('0x2c');this['dialOriginateTimeout']=_0x4c71c9[_0x22f3('0x2d')]||0x1e;this[_0x22f3('0x2e')]=_0x4c71c9[_0x22f3('0x2e')]||'tTxX';this[_0x22f3('0x2f')]=_0x4c71c9[_0x22f3('0x2f')]||0x3;this[_0x22f3('0x30')]=_0x4c71c9['dialQueueProject']||undefined;this[_0x22f3('0x31')]=_0x4c71c9[_0x22f3('0x31')]||0x3;this[_0x22f3('0x32')]=_0x4c71c9[_0x22f3('0x32')]||0x96;this[_0x22f3('0x33')]=_0x4c71c9[_0x22f3('0x33')]||0x3;this['dialBusyRetryFrequency']=_0x4c71c9['dialBusyRetryFrequency']||0x96;this[_0x22f3('0x34')]=_0x4c71c9['dialNoAnswerMaxRetry']||0x3;this['dialNoAnswerRetryFrequency']=_0x4c71c9[_0x22f3('0x35')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x4c71c9[_0x22f3('0x36')]||0x3;this[_0x22f3('0x37')]=_0x4c71c9[_0x22f3('0x37')]||0x96;this['dialDropMaxRetry']=_0x4c71c9[_0x22f3('0x38')]||0x3;this[_0x22f3('0x39')]=_0x4c71c9[_0x22f3('0x39')]||0x96;this[_0x22f3('0x3a')]=_0x4c71c9[_0x22f3('0x3a')]||0x3;this[_0x22f3('0x3b')]=_0x4c71c9[_0x22f3('0x3b')]||0x96;this[_0x22f3('0x3c')]=_0x4c71c9[_0x22f3('0x3c')]||0x3;this[_0x22f3('0x3d')]=_0x4c71c9[_0x22f3('0x3d')]||0x96;this[_0x22f3('0x3e')]=_0x4c71c9[_0x22f3('0x3e')]||0x3;this[_0x22f3('0x3f')]=_0x4c71c9[_0x22f3('0x3f')]||0x96;this[_0x22f3('0x40')]=_0x4c71c9[_0x22f3('0x40')]||0x4;this['Trunk']=_0x4c71c9['Trunk']?_0x4c71c9[_0x22f3('0x41')]:undefined;this[_0x22f3('0x42')]=_0x4c71c9[_0x22f3('0x42')]?_0x4c71c9[_0x22f3('0x42')]:undefined;this[_0x22f3('0x43')]=_0x4c71c9[_0x22f3('0x43')]||undefined;this['Interval']=_0x4c71c9[_0x22f3('0x44')]?_0x4c71c9['Interval']:undefined;this[_0x22f3('0x45')]=_0x4c71c9[_0x22f3('0x45')]||_0x22f3('0x46');this['dialRandomLastDigitCallerIdNumber']=_0x4c71c9['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x22f3('0x47')]=_0x4c71c9[_0x22f3('0x47')]||undefined;this[_0x22f3('0x48')]=strategy[_0x4c71c9[_0x22f3('0x48')]]||_0x22f3('0x9');this[_0x22f3('0x49')]=!![];this['dialAMDActive']=_0x4c71c9['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x4c71c9['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x4c71c9[_0x22f3('0x4a')];this['dialAMDAfterGreetingSilence']=_0x4c71c9[_0x22f3('0x4b')];this['dialAMDTotalAnalysisTime']=_0x4c71c9[_0x22f3('0x4c')];this[_0x22f3('0x4d')]=_0x4c71c9[_0x22f3('0x4d')];this[_0x22f3('0x4e')]=_0x4c71c9[_0x22f3('0x4e')];this[_0x22f3('0x4f')]=_0x4c71c9[_0x22f3('0x4f')];this[_0x22f3('0x50')]=_0x4c71c9[_0x22f3('0x50')];this['dialAMDMaximumWordLength']=_0x4c71c9[_0x22f3('0x51')];this[_0x22f3('0x52')]=0x0;this['pTalking']=0x0;this[_0x22f3('0x53')]=_0x4c71c9['timeout'];this[_0x22f3('0x54')]=0x0;this[_0x22f3('0x55')]=0x0;this[_0x22f3('0x56')]=0x0;this[_0x22f3('0x57')]=0x0;this[_0x22f3('0x58')]=0x0;this[_0x22f3('0x59')]=0x0;this[_0x22f3('0x5a')]=0x0;this[_0x22f3('0x5b')]=0x0;this[_0x22f3('0x5c')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x22f3('0x5d')]=0x0;this[_0x22f3('0x5e')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x22f3('0x5f')]=undefined;this['startPredictive']=undefined;this[_0x22f3('0x60')]=undefined;this[_0x22f3('0x61')]=1.05;this[_0x22f3('0x62')]=0x0;this[_0x22f3('0x63')]=0x0;this[_0x22f3('0x64')]=0x0;this[_0x22f3('0x65')]=0x0;this[_0x22f3('0x66')]=0x0;this[_0x22f3('0x67')]=0x0;this[_0x22f3('0x68')]=0x0;this[_0x22f3('0x69')]=0x0;this[_0x22f3('0x6a')]=_0x4c71c9['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x22f3('0x6b')]=_0x4c71c9[_0x22f3('0x6c')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x22f3('0x6d')]=0x0;this['erlangCallToSecond']=0x0;this[_0x22f3('0x6e')]=0x0;this[_0x22f3('0x6f')]=0x0;this[_0x22f3('0x70')]=_0x4c71c9[_0x22f3('0x70')]||0x1e;this[_0x22f3('0x71')]=_0x4c71c9[_0x22f3('0x71')]||![];this[_0x22f3('0x72')]=_0x4c71c9[_0x22f3('0x72')]||undefined;this[_0x22f3('0x73')]=_0x4c71c9['dialAgiAfterHangupClient']||![];this[_0x22f3('0x74')]=_0x4c71c9['dialAgiAfterHangupAgent']||![];this[_0x22f3('0xc')]=monitorFormat[_0x4c71c9[_0x22f3('0xc')]]?monitorFormat[_0x4c71c9[_0x22f3('0xc')]]:undefined;this[_0x22f3('0x75')]=_0x4c71c9[_0x22f3('0x75')]||![];this[_0x22f3('0x76')]=_0x4c71c9[_0x22f3('0x76')]?_0x4c71c9[_0x22f3('0x76')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file +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 diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index f14a85b..3459566 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 _0xc994=['remoteUri','serverUrl','name','username','accessKey'];(function(_0x7d7209,_0x56198b){var _0x2c79f7=function(_0x19c7b8){while(--_0x19c7b8){_0x7d7209['push'](_0x7d7209['shift']());}};_0x2c79f7(++_0x56198b);}(_0xc994,0x1b5));var _0x4c99=function(_0x2dd1fb,_0x2777cd){_0x2dd1fb=_0x2dd1fb-0x0;var _0x3d30ae=_0xc994[_0x2dd1fb];return _0x3d30ae;};'use strict';function VtigerAccount(_0x4131b1){this['id']=_0x4131b1['id']||0x0;this['name']=_0x4131b1[_0x4c99('0x0')]||'';this[_0x4c99('0x1')]=_0x4131b1[_0x4c99('0x1')]||'';this[_0x4c99('0x2')]=_0x4131b1[_0x4c99('0x2')]||'';this[_0x4c99('0x3')]=_0x4131b1[_0x4c99('0x3')]||'';this[_0x4c99('0x4')]=_0x4131b1[_0x4c99('0x4')]||'';this['Configurations']=_0x4131b1['Configurations']||{};}module['exports']=VtigerAccount; \ No newline at end of file +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 diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index cd33b0a..3ef390b 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(_0xce9d6e,_0x49439e){_0xce9d6e=_0xce9d6e-0x0;var _0x12fde9=_0xadb5[_0xce9d6e];return _0x12fde9;};'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 _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 diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 8a17de9..c0ac795 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 _0xa2cb=['description','host','zone','serverUrl','code','refreshToken','Configurations','exports','name'];(function(_0x2184cb,_0x2c2cbd){var _0x6f8990=function(_0x418da6){while(--_0x418da6){_0x2184cb['push'](_0x2184cb['shift']());}};_0x6f8990(++_0x2c2cbd);}(_0xa2cb,0x7d));var _0xba2c=function(_0x203b47,_0x21765a){_0x203b47=_0x203b47-0x0;var _0x12a945=_0xa2cb[_0x203b47];return _0x12a945;};'use strict';function ZohoAccount(_0x4dc80e){this['id']=_0x4dc80e['id']||0x0;this[_0xba2c('0x0')]=_0x4dc80e['name']||'';this[_0xba2c('0x1')]=_0x4dc80e[_0xba2c('0x1')]||'';this[_0xba2c('0x2')]=_0x4dc80e[_0xba2c('0x2')]||'';this[_0xba2c('0x3')]=_0x4dc80e['zone']||'';this['clientId']=_0x4dc80e['clientId']||'';this['clientSecret']=_0x4dc80e['clientSecret']||'';this[_0xba2c('0x4')]=_0x4dc80e['serverUrl']||'';this[_0xba2c('0x5')]=_0x4dc80e['code']||'';this[_0xba2c('0x6')]=_0x4dc80e[_0xba2c('0x6')]||'';this['Configurations']=_0x4dc80e[_0xba2c('0x7')]||{};}module[_0xba2c('0x8')]=ZohoAccount; \ No newline at end of file +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 diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 99d9800..6ab6a71 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 _0x5572=['format','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','calleridname','exports','util','lodash','moment','isNil','string','uniqueid','idContact','campaigntype','queue','dialAnswer','membername','Agent','name','channelAgent'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5572,0x1d6));var _0x2557=function(_0x26c533,_0x19bcb8){_0x26c533=_0x26c533-0x0;var _0x4fb30b=_0x5572[_0x26c533];return _0x4fb30b;};'use strict';var util=require(_0x2557('0x0'));var _=require(_0x2557('0x1'));var moment=require(_0x2557('0x2'));function checkNameSurname(_0x2aff55,_0x1edb9f,_0x3da4bb){var _0x4425ae='';if(!_[_0x2557('0x3')](_0x1edb9f)&&_0x2557('0x4')===typeof _0x1edb9f){_0x4425ae+=_0x1edb9f;}if(!_[_0x2557('0x3')](_0x3da4bb)&&_0x2557('0x4')===typeof _0x3da4bb){_0x4425ae+='\x20'+_0x3da4bb;}if(_0x4425ae!==''){return _0x4425ae;}return _0x2aff55;}function Action(_0x376d5d,_0x316ba7,_0xa5c7eb,_0x44632e,_0x28fd47){this[_0x2557('0x5')]=_0xa5c7eb||undefined;this[_0x2557('0x6')]=_0x376d5d['id'];this['queue']=_0x316ba7['name'];this['type']=_0x316ba7['type'];this[_0x2557('0x7')]=_0x2557('0x8');this[_0x2557('0x9')]=![];this[_0x2557('0xa')]=_[_0x2557('0x3')](_0x376d5d[_0x2557('0xb')])?undefined:_0x376d5d[_0x2557('0xb')][_0x2557('0xc')];this[_0x2557('0xd')]=this[_0x2557('0xa')]?util[_0x2557('0xe')]('SIP/%s',this[_0x2557('0xa')]):_0x44632e||undefined;this['calleridname']=checkNameSurname(_0x376d5d[_0x2557('0xf')][_0x2557('0x10')],_0x376d5d[_0x2557('0xf')][_0x2557('0x11')],_0x376d5d[_0x2557('0xf')][_0x2557('0x12')]);this[_0x2557('0x13')]=_0x376d5d['active']||![];this[_0x2557('0x14')]=_0x376d5d['Contact'][_0x2557('0x10')];this[_0x2557('0x15')]=_0x376d5d[_0x2557('0x15')];this['countbusyretry']=_0x376d5d[_0x2557('0x16')]||0x0;this[_0x2557('0x17')]=_0x376d5d[_0x2557('0x17')]||0x0;this['countnoanswerretry']=_0x376d5d['countnoanswerretry']||0x0;this[_0x2557('0x18')]=(_0x376d5d[_0x2557('0x16')]||0x0)+(_0x376d5d['countcongestionretry']||0x0)+(_0x376d5d[_0x2557('0x19')]||0x0);this[_0x2557('0x1a')]=_0x376d5d[_0x2557('0x1a')]||0x0;this[_0x2557('0x1b')]=_0x376d5d[_0x2557('0x1b')]||0x0;this['countabandonedretry']=_0x376d5d[_0x2557('0x1c')]||0x0;this[_0x2557('0x1d')]=_0x376d5d[_0x2557('0x1d')]||0x0;this[_0x2557('0x1e')]=_0x376d5d[_0x2557('0x1e')]||0x0;this[_0x2557('0x1f')]=_0x376d5d[_0x2557('0x1f')];this['callbackuniqueid']=_0x376d5d[_0x2557('0x20')];this[_0x2557('0x21')]=_0x376d5d[_0x2557('0x21')];this[_0x2557('0x22')]=_0x376d5d['recallme'];this[_0x2557('0x23')]=_0x376d5d['ContactId'];this['ListId']=_0x376d5d['ListId'];this['UserId']=_[_0x2557('0x3')](_0x376d5d[_0x2557('0xb')])?_0x376d5d[_0x2557('0x24')]:_0x376d5d[_0x2557('0xb')]['id'];this[_0x2557('0x25')]=_0x376d5d['VoiceQueueId'];this['originatecalleridnum']='';this[_0x2557('0x26')]='';}Action[_0x2557('0x27')][_0x2557('0x28')]=function(){return util[_0x2557('0xe')](_0x2557('0x29'),this[_0x2557('0x2a')],this['number']);};module[_0x2557('0x2b')]=Action; \ No newline at end of file +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 diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 55ba3e1..b5be6a5 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 _0xfc5c=['paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20disactive','syncCampaigns','hasOwnProperty','outbound','clearZombieChannels','setMessage','recallMe','clearZombieChannel','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','contactId','ListId','Action','status','No\x20such\x20channel','updateOriginated','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','size','getContactRecallMe','agentReadyId','isNil','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','then','logger2','[RecallMe]','catch','disableContact','starttime','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryRecallClose]','[getContactRecallMe]','isActive','isTrunkReachable','TrunkBackup','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','ANSWER','YYYY-MM-DD\x20HH:mm:ss','answertime','custom:agentconnect','buildObj','acw','buildAcw','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','\x20Queue','BUSY','Busy','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','countbusyretry','dialBusyRetryFrequency','activeContact','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countabandonedretry','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','linkedid','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','uniqueid','destlinkedid','callProgressDetectingAgent','isUndefined','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','VoiceQueueId','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','run','execRun','pick','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','Contact.phone','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','ACTIVE','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','execCall','SIP/%s/%s%s','trim','dialCutDigit','phone','substring','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','getCallerId','extractCalleridName','originatecalleridnum','extractCalleridNumber','merge','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','channel','logLookAgent','clone','responsetime','isFailure','response','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','dialQueueProject','reason','channelstate','transfer','destuniqueid','addVariable','variables','filterKey','keys','variable','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','syncHangup','syncHangupRequest','dialend','syncDialEnd','newexten','varset','syncVarSet','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','type','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','unmanaged','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','Trunk','active','callerid','Interval','name','stringify','md5','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice_queue_channel:remove'];(function(_0x5f746f,_0x5b05ab){var _0x198d15=function(_0x58c7e7){while(--_0x58c7e7){_0x5f746f['push'](_0x5f746f['shift']());}};_0x198d15(++_0x5b05ab);}(_0xfc5c,0xe6));var _0xcfc5=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xfc5c[_0x334841];return _0x5beb4b;};'use strict';var util=require(_0xcfc5('0x0'));var _=require(_0xcfc5('0x1'));var BPromise=require(_0xcfc5('0x2'));var uuid=require(_0xcfc5('0x3'));var moment=require(_0xcfc5('0x4'));var md5=require('md5');var Redis=require(_0xcfc5('0x5'));var config=require(_0xcfc5('0x6'));var logger=require(_0xcfc5('0x7'))(_0xcfc5('0x8'));var loggerAction=require('../../../config/logger')(_0xcfc5('0x9'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Action=require(_0xcfc5('0xa'));var ut=require(_0xcfc5('0xb'));config[_0xcfc5('0xc')]=_[_0xcfc5('0xd')](config[_0xcfc5('0xc')],{'host':_0xcfc5('0xe'),'port':0x18eb});var io=require(_0xcfc5('0xf'))(new Redis(config[_0xcfc5('0xc')]));var Sequence=function(){};Sequence[_0xcfc5('0x10')][_0xcfc5('0x11')]=function(_0x7f9f9){this[_0xcfc5('0x12')]=this['tail']?this[_0xcfc5('0x12')][_0xcfc5('0x13')](_0x7f9f9):_0x7f9f9();};function Preview(_0x46db34){this[_0xcfc5('0x14')]=new Sequence();this[_0xcfc5('0x15')]=_0x46db34[_0xcfc5('0x16')];this[_0xcfc5('0x17')]=_0x46db34[_0xcfc5('0x17')];this[_0xcfc5('0x18')]={};this[_0xcfc5('0x19')]=_0x46db34[_0xcfc5('0x19')];this[_0xcfc5('0x1a')]=0x0;ami['on'](_0xcfc5('0x1b'),this[_0xcfc5('0x1c')][_0xcfc5('0x1d')](this));ami['on']('hangup',this[_0xcfc5('0x1e')][_0xcfc5('0x1d')](this));ami['on']('hanguprequest',this[_0xcfc5('0x1f')][_0xcfc5('0x1d')](this));ami['on'](_0xcfc5('0x20'),this[_0xcfc5('0x21')][_0xcfc5('0x1d')](this));ami['on'](_0xcfc5('0x22'),this['syncNewExten']['bind'](this));ami['on'](_0xcfc5('0x23'),this[_0xcfc5('0x24')]['bind'](this));ami['on']('attendedtransfer',this[_0xcfc5('0x25')][_0xcfc5('0x1d')](this));ami['on']('blindtransfer',this[_0xcfc5('0x26')][_0xcfc5('0x1d')](this));this[_0xcfc5('0x27')](this[_0xcfc5('0x15')]);}function emit(_0x588d88,_0x16eb47,_0x2430f3){io['to'](_0x588d88)[_0xcfc5('0x28')](_0x16eb47,_0x2430f3);}function emitCampaignPreview(_0x1fdb39){if(_0x1fdb39[_0xcfc5('0x29')]==='outbound'){var _0x4d29b5={'id':_0x1fdb39['id'],'name':_0x1fdb39['name'],'strategy':_0x1fdb39[_0xcfc5('0x2a')],'answered':_0x1fdb39[_0xcfc5('0x2b')],'available':_0x1fdb39[_0xcfc5('0x2c')],'loggedIn':_0x1fdb39[_0xcfc5('0x2d')],'pTalking':_0x1fdb39[_0xcfc5('0x2e')],'sumBillable':_0x1fdb39['sumBillable'],'sumDuration':_0x1fdb39[_0xcfc5('0x2f')],'sumHoldTime':_0x1fdb39[_0xcfc5('0x30')]||0x0,'talking':_0x1fdb39[_0xcfc5('0x31')],'total':_0x1fdb39[_0xcfc5('0x32')],'type':_0x1fdb39[_0xcfc5('0x29')],'unmanaged':_0x1fdb39[_0xcfc5('0x33')],'abandoned':_0x1fdb39['abandoned'],'waiting':_0x1fdb39['waiting'],'loggedInDb':_0x1fdb39[_0xcfc5('0x34')],'dialActive':_0x1fdb39[_0xcfc5('0x35')],'dialMethod':_0x1fdb39[_0xcfc5('0x36')],'dialOriginateCallerIdName':_0x1fdb39['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x1fdb39[_0xcfc5('0x37')],'dialOriginateTimeout':_0x1fdb39[_0xcfc5('0x38')],'dialPrefix':_0x1fdb39[_0xcfc5('0x39')],'outboundAnswerAgiCallsDay':_0x1fdb39[_0xcfc5('0x3a')],'outboundAnswerCallsDay':_0x1fdb39[_0xcfc5('0x3b')],'outboundBlacklistCallsDay':_0x1fdb39[_0xcfc5('0x3c')],'outboundBusyCallsDay':_0x1fdb39[_0xcfc5('0x3d')],'outboundCongestionCallsDay':_0x1fdb39['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x1fdb39['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x1fdb39[_0xcfc5('0x3e')],'outboundDropCallsDayTimeout':_0x1fdb39[_0xcfc5('0x3f')],'outboundNoAnswerCallsDay':_0x1fdb39['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x1fdb39['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x1fdb39['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x1fdb39[_0xcfc5('0x40')],'outboundRejectCallsDay':_0x1fdb39[_0xcfc5('0x41')],'outboundUnknownCallsDay':_0x1fdb39[_0xcfc5('0x42')],'outboundAbandonedCallsDay':_0x1fdb39[_0xcfc5('0x43')],'predictiveIntervalAnsweredCalls':_0x1fdb39[_0xcfc5('0x44')],'predictiveIntervalAvgHoldtime':_0x1fdb39[_0xcfc5('0x45')],'predictiveIntervalAvgTalktime':_0x1fdb39[_0xcfc5('0x46')],'predictiveIntervalDroppedCallsCallersExit':_0x1fdb39[_0xcfc5('0x47')],'predictiveIntervalDroppedCallsTimeout':_0x1fdb39[_0xcfc5('0x48')],'predictiveIntervalErlangCalls':_0x1fdb39[_0xcfc5('0x49')],'predictiveIntervalErlangCallsDroppedCalls':_0x1fdb39['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x1fdb39[_0xcfc5('0x4a')],'predictiveIntervalMultiplicativeFactor':_0x1fdb39[_0xcfc5('0x4b')],'predictiveIntervalPauses':_0x1fdb39['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x1fdb39['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x1fdb39[_0xcfc5('0x4c')],'message':_0x1fdb39[_0xcfc5('0x4d')],'originated':_0x1fdb39[_0xcfc5('0x4e')],'erlangCalls':_0x1fdb39[_0xcfc5('0x4f')],'erlangCallToSecond':_0x1fdb39[_0xcfc5('0x50')],'erlangAbandonmentRate':_0x1fdb39[_0xcfc5('0x51')],'erlangBusyFactor':_0x1fdb39['erlangBusyFactor'],'startPredictive':_0x1fdb39[_0xcfc5('0x52')],'startProgressive':_0x1fdb39['startProgressive']};if(_0x1fdb39[_0xcfc5('0x53')]){_0x4d29b5['Trunk']={'id':_0x1fdb39[_0xcfc5('0x53')]['id'],'name':_0x1fdb39[_0xcfc5('0x53')]['name'],'active':_0x1fdb39[_0xcfc5('0x53')][_0xcfc5('0x54')],'callerid':_0x1fdb39[_0xcfc5('0x53')][_0xcfc5('0x55')]};}if(_0x1fdb39[_0xcfc5('0x56')]){_0x4d29b5[_0xcfc5('0x56')]={'id':_0x1fdb39[_0xcfc5('0x56')]['id'],'name':_0x1fdb39[_0xcfc5('0x56')][_0xcfc5('0x57')]};}var _0x2edb9b=md5(JSON[_0xcfc5('0x58')](_0x4d29b5));if(_0x1fdb39[_0xcfc5('0x59')]!==_0x2edb9b){_0x1fdb39[_0xcfc5('0x59')]=_0x2edb9b;emit(util['format'](_0xcfc5('0x5a'),_0x4d29b5['name']),_0xcfc5('0x5b'),_0x4d29b5);}}}function emitVoiceQueueChannelRemove(_0x5deaff){logger[_0xcfc5('0x5c')](_0xcfc5('0x5d'),JSON[_0xcfc5('0x58')](_0x5deaff));emit(util[_0xcfc5('0x5e')](_0xcfc5('0x5a'),_0x5deaff[_0xcfc5('0x57')]),_0xcfc5('0x5f'),_0x5deaff);}function notSendMessagesQueue(_0x257aa9){if(_0x257aa9['sendMessageOneNotActive']){if(_0x257aa9[_0xcfc5('0x4e')]===0x0&&_0x257aa9[_0xcfc5('0x2e')]===0x0){_0x257aa9['sendMessageOneNotActive']=![];_0x257aa9['available']=0x0;_0x257aa9[_0xcfc5('0x60')]=0x0;_0x257aa9['message']=_0xcfc5('0x61');ut[_0xcfc5('0x62')](_0xcfc5('0x63'),_0x257aa9[_0xcfc5('0x57')]+_0xcfc5('0x64'));}else{_0x257aa9[_0xcfc5('0x4d')]='IS_DISACTIVED';ut[_0xcfc5('0x62')](_0xcfc5('0x63'),_0x257aa9[_0xcfc5('0x57')]+_0xcfc5('0x65'));}emitCampaignPreview(_0x257aa9);}}Preview['prototype'][_0xcfc5('0x27')]=function(){var _0x19f97b=this;setInterval(function(){_0x19f97b[_0xcfc5('0x66')]();},0x7cf);};Preview[_0xcfc5('0x10')][_0xcfc5('0x66')]=function(){var _0xe60977=this[_0xcfc5('0x15')];this[_0xcfc5('0x1a')]+=0x1;for(var _0x2e8e72 in _0xe60977){if(_0xe60977[_0xcfc5('0x67')](_0x2e8e72)&&(_0xe60977[_0x2e8e72][_0xcfc5('0x36')]===_0xcfc5('0x8')||_0xe60977[_0x2e8e72][_0xcfc5('0x36')]==='booked')&&_0xe60977[_0x2e8e72][_0xcfc5('0x29')]===_0xcfc5('0x68')){if(this[_0xcfc5('0x1a')]>0x7){this['clockClearZombieChannels']=0x0;this[_0xcfc5('0x69')]();}}if(_0xe60977[_0xcfc5('0x67')](_0x2e8e72)&&_0xe60977[_0x2e8e72][_0xcfc5('0x36')]===_0xcfc5('0x8')&&_0xe60977[_0x2e8e72][_0xcfc5('0x29')]===_0xcfc5('0x68')){if(_0xe60977[_0x2e8e72][_0xcfc5('0x35')]){this[_0xcfc5('0x6a')](_0xe60977[_0x2e8e72]);this[_0xcfc5('0x6b')](_0xe60977[_0x2e8e72]);}else{notSendMessagesQueue(_0xe60977[_0x2e8e72]);}}}};Preview[_0xcfc5('0x10')][_0xcfc5('0x6c')]=function(_0x580d73){var _0x58269c=this;this['sequence'][_0xcfc5('0x11')](function(){if(!_['isNil'](_0x58269c['actions'][_0x580d73])){loggerAction['info'](_0xcfc5('0x6d'),_0x580d73,_0xcfc5('0x6e'),_0x58269c['actions'][_0x580d73][_0xcfc5('0x6f')],_0xcfc5('0x70'),JSON[_0xcfc5('0x58')](_0x58269c[_0xcfc5('0x15')][_0x58269c[_0xcfc5('0x18')][_0x580d73][_0xcfc5('0x6f')]][_0xcfc5('0x4e')]),_0xcfc5('0x71'),JSON[_0xcfc5('0x58')](_0x58269c['campaignsPreview'][_0x58269c['actions'][_0x580d73][_0xcfc5('0x6f')]][_0xcfc5('0x2e')]),JSON[_0xcfc5('0x58')](_0x58269c['actions'][_0x580d73][_0xcfc5('0x72')]),JSON[_0xcfc5('0x58')](_['pick'](_0x58269c[_0xcfc5('0x18')][_0x580d73],[_0xcfc5('0x73'),'UserId','VoiceQueueId',_0xcfc5('0x74')])));return ami[_0xcfc5('0x75')]({'action':_0xcfc5('0x76'),'channel':_0x58269c[_0xcfc5('0x18')][_0x580d73]['channel']})['catch'](function(_0x227952){if(_0x227952[_0xcfc5('0x4d')]===_0xcfc5('0x77')){setTimeout(function(){if(_0x58269c['actions'][_0x580d73]){ut[_0xcfc5('0x78')](_0x58269c['campaignsPreview'][_0x58269c[_0xcfc5('0x18')][_0x580d73][_0xcfc5('0x6f')]],'[clearZombieChannel]');if(_0x58269c['actions'][_0x580d73][_0xcfc5('0x72')]===!![]){ut[_0xcfc5('0x79')](_0x58269c[_0xcfc5('0x15')][_0x58269c[_0xcfc5('0x18')][_0x580d73][_0xcfc5('0x6f')]],_0xcfc5('0x7a'));ut[_0xcfc5('0x7b')](_0xcfc5('0x7c')+_0x580d73,_0x58269c['actions'][_0x580d73]['queue']);}ut['loggerError'](_0xcfc5('0x7d')+_0x580d73,_0x58269c['actions'][_0x580d73][_0xcfc5('0x6f')]);delete _0x58269c[_0xcfc5('0x18')][_0x580d73];}},0x2328);}});}});};Preview['prototype'][_0xcfc5('0x69')]=function(){var _0x11ca25=this;loggerAction[_0xcfc5('0x5c')]('[action]',_[_0xcfc5('0x7e')](this[_0xcfc5('0x18')]));for(var _0x4dbb43 in this[_0xcfc5('0x18')]){if(_0x11ca25['actions'][_0xcfc5('0x67')](_0x4dbb43)){_0x11ca25[_0xcfc5('0x6c')](_0x4dbb43);}}};Preview[_0xcfc5('0x10')][_0xcfc5('0x6b')]=function(_0x3e2345){var _0x58ae6f=this;rpcDb[_0xcfc5('0x7f')](_0x3e2345['id'],ut[_0xcfc5('0x80')](this[_0xcfc5('0x19')]))['then'](function(_0x131909){if(!_[_0xcfc5('0x81')](_0x131909)){for(var _0x2f32d7=0x0;_0x2f32d7<_0x131909[_0xcfc5('0x82')];_0x2f32d7+=0x1){if(ut[_0xcfc5('0x83')](_0x131909[_0x2f32d7][_0xcfc5('0x84')])<_0x3e2345[_0xcfc5('0x85')]*0x3c){if(_0x131909[_0x2f32d7][_0xcfc5('0x86')]&&!_0x131909[_0x2f32d7][_0xcfc5('0x86')][_0xcfc5('0x87')]){_0x58ae6f['run'](_0x131909[_0x2f32d7]['id'])[_0xcfc5('0x88')](ut[_0xcfc5('0x89')](_0xcfc5('0x8a')))[_0xcfc5('0x8b')](ut['logger2'](_0xcfc5('0x8a')));}else{rpcDb[_0xcfc5('0x8c')](_0x131909[_0x2f32d7]['id']);}}else{var _0x1d8db0=new Action(_0x131909[_0x2f32d7],_0x3e2345);_0x1d8db0[_0xcfc5('0x8d')]=moment()[_0xcfc5('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x3e2345[_0xcfc5('0x40')]+=0x1;ut[_0xcfc5('0x8e')](_0x1d8db0,0x17,_0xcfc5('0x8f'));if(_0x3e2345[_0xcfc5('0x90')]){rpcDb[_0xcfc5('0x91')](ut[_0xcfc5('0x92')](_0x131909[_0x2f32d7]));rpcDb[_0xcfc5('0x93')](_0x1d8db0,'[HistoryDialRecallInQueue][historyCatch]');}else{ut['logCustomer'](_0x1d8db0,0x16,'RecallFailedTimeout');rpcDb[_0xcfc5('0x93')](_0x1d8db0,_0xcfc5('0x94'));rpcDb['createCustomerFinal'](_0x1d8db0,_0xcfc5('0x94'));}}}}})[_0xcfc5('0x8b')](ut[_0xcfc5('0x89')](_0xcfc5('0x95')));};Preview['prototype']['setMessage']=function(_0x7364cb){_0x7364cb['sendMessageOneNotActive']=!![];if(ut['IsNotLoggedIn'](_0x7364cb[_0xcfc5('0x2d')])){_0x7364cb[_0xcfc5('0x4d')]='AGENTS_NOT_LOGGED';}else if(!ut[_0xcfc5('0x96')](_0x7364cb['dialActive'])){_0x7364cb[_0xcfc5('0x4d')]=_0xcfc5('0x61');}else if(!this['isTrunkReachable'](_0x7364cb['Trunk'])){if(!this[_0xcfc5('0x97')](_0x7364cb[_0xcfc5('0x98')])){_0x7364cb[_0xcfc5('0x4d')]='TRUNK_IS_NOT_REACHABLE';}else{_0x7364cb[_0xcfc5('0x4d')]='ACTIVE';}}else{_0x7364cb[_0xcfc5('0x4d')]='ACTIVE';}emitCampaignPreview(_0x7364cb);};Preview[_0xcfc5('0x10')][_0xcfc5('0x99')]=function(_0x2f0d46,_0x218a37,_0x4360e2){var _0x48734f=this;var _0x8b4275=this[_0xcfc5('0x18')][_0x218a37];var _0xf0c6f5=this[_0xcfc5('0x15')][_0x8b4275[_0xcfc5('0x6f')]];var _0x17dbbe;if(_0xf0c6f5){switch(_0x4360e2){case'1':_0xf0c6f5[_0xcfc5('0x9a')]+=0x1;_0x8b4275[_0xcfc5('0x9b')]+=0x1;_0x8b4275[_0xcfc5('0x9c')]=ut[_0xcfc5('0x9d')](_0x8b4275);ut[_0xcfc5('0x8e')](_0x8b4275,0x0,_0xcfc5('0x9e'));rpcDb[_0xcfc5('0x93')](_0x8b4275,_0xcfc5('0x9f'));if(ut[_0xcfc5('0x9d')](_0x8b4275)>=_0xf0c6f5[_0xcfc5('0xa0')]){_0x17dbbe=ut[_0xcfc5('0xa1')](_0x8b4275,0xf,_0xcfc5('0xa2'));rpcDb[_0xcfc5('0xa3')](_0x17dbbe,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x8b4275[_0xcfc5('0x9b')]>=_0xf0c6f5[_0xcfc5('0xa4')]){rpcDb['createCustomerFinal'](_0x8b4275,_0xcfc5('0xa5'));}else{rpcDb[_0xcfc5('0xa6')](ut[_0xcfc5('0xa7')](_0x8b4275,_0xcfc5('0x9b'),_0xf0c6f5['dialNoSuchNumberRetryFrequency']),_0x8b4275[_0xcfc5('0xa8')],_0x8b4275['activeContact']);}}delete this[_0xcfc5('0x18')][_0x2f0d46['linkedid']];break;case _0xcfc5('0xa9'):var _0x34a2ef=moment()[_0xcfc5('0x5e')](_0xcfc5('0xaa'));_0x8b4275['responsetime']=_0x34a2ef;_0x8b4275[_0xcfc5('0xab')]=_0x34a2ef;_0x8b4275[_0xcfc5('0x72')]=!![];_0xf0c6f5[_0xcfc5('0x2e')]+=0x1;logger[_0xcfc5('0x5c')]('[syncHangup][talking][increment]',_0x8b4275['uniqueid'],'\x20Queue',_0xf0c6f5[_0xcfc5('0x57')],_0xcfc5('0x71'),_0xf0c6f5[_0xcfc5('0x2e')]);ami[_0xcfc5('0x28')](_0xcfc5('0xac'),ut[_0xcfc5('0xad')](_0x8b4275,'connect'));if(_0xf0c6f5[_0xcfc5('0xae')]){ami[_0xcfc5('0x28')]('custom:agentConnectPreview',ut[_0xcfc5('0xaf')](_0x8b4275));}break;case'16':ami[_0xcfc5('0x28')]('custom:agentcomplete',ut['buildObj'](_0x8b4275,_0xcfc5('0xb0')));emitVoiceQueueChannelRemove(ut['buildObj'](_0x8b4275,_0xcfc5('0xb0')));_0xf0c6f5[_0xcfc5('0x3b')]+=0x1;_0xf0c6f5[_0xcfc5('0x32')]+=0x1;_0xf0c6f5[_0xcfc5('0x2b')]+=0x1;ut[_0xcfc5('0x79')](_0xf0c6f5,_0xcfc5('0xb1'));_0x8b4275['countglobal']=ut[_0xcfc5('0x9d')](_0x8b4275);ut['logCustomer'](_0x8b4275,0x4,_0xcfc5('0xb2'));rpcDb[_0xcfc5('0x93')](_0x8b4275,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xcfc5('0xa3')](_0x8b4275,_0xcfc5('0xb3'));rpcDb[_0xcfc5('0xb4')](_0x8b4275);_0xf0c6f5[_0xcfc5('0x2f')]+=_0x8b4275[_0xcfc5('0xb5')];_0xf0c6f5['sumBillable']+=_0x8b4275['talktime'];logger[_0xcfc5('0x5c')]('[syncHangup][talking][decrement]',_0x8b4275['uniqueid'],_0xcfc5('0xb6'),_0xf0c6f5[_0xcfc5('0x57')],_0xcfc5('0x71'),_0xf0c6f5[_0xcfc5('0x2e')]);delete this[_0xcfc5('0x18')][_0x2f0d46['linkedid']];break;case _0xcfc5('0xb7'):_0xf0c6f5['outboundBusyCallsDay']+=0x1;_0x8b4275['countbusyretry']+=0x1;_0x8b4275[_0xcfc5('0x9c')]=ut['totalGlobal'](_0x8b4275);ut[_0xcfc5('0x8e')](_0x8b4275,0x5,_0xcfc5('0xb8'));rpcDb[_0xcfc5('0x93')](_0x8b4275,'[callProgressDetectingCustomer][logBusy]');if(ut[_0xcfc5('0x9d')](_0x8b4275)>=_0xf0c6f5[_0xcfc5('0xa0')]){_0x17dbbe=ut[_0xcfc5('0xa1')](_0x8b4275,0xf,_0xcfc5('0xa2'));rpcDb[_0xcfc5('0xa3')](_0x17dbbe,_0xcfc5('0xb9'));}else{if(_0x8b4275['countbusyretry']>=_0xf0c6f5[_0xcfc5('0xba')]){rpcDb[_0xcfc5('0xa3')](_0x8b4275,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xcfc5('0xa6')](ut[_0xcfc5('0xa7')](_0x8b4275,_0xcfc5('0xbb'),_0xf0c6f5[_0xcfc5('0xbc')]),_0x8b4275['unlockAgent'],_0x8b4275[_0xcfc5('0xbd')]);}}break;case _0xcfc5('0xbe'):_0xf0c6f5[_0xcfc5('0xbf')]+=0x1;_0x8b4275[_0xcfc5('0xc0')]+=0x1;_0x8b4275['countglobal']=ut[_0xcfc5('0x9d')](_0x8b4275);ut[_0xcfc5('0x8e')](_0x8b4275,0x3,_0xcfc5('0xc1'));rpcDb['createCustomerHistory'](_0x8b4275,_0xcfc5('0xc2'));if(ut[_0xcfc5('0x9d')](_0x8b4275)>=_0xf0c6f5['dialGlobalMaxRetry']){_0x17dbbe=ut['cloneAction'](_0x8b4275,0xf,_0xcfc5('0xa2'));rpcDb['createCustomerFinal'](_0x17dbbe,_0xcfc5('0xc3'));}else{if(_0x8b4275[_0xcfc5('0xc0')]>=_0xf0c6f5['dialNoAnswerMaxRetry']){rpcDb['createCustomerFinal'](_0x8b4275,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0xcfc5('0xa6')](ut[_0xcfc5('0xa7')](_0x8b4275,_0xcfc5('0xc0'),_0xf0c6f5['dialNoAnswerRetryFrequency']),_0x8b4275[_0xcfc5('0xa8')],_0x8b4275['activeContact']);}}break;case _0xcfc5('0xc4'):_0xf0c6f5[_0xcfc5('0xc5')]+=0x1;_0x8b4275[_0xcfc5('0xc6')]+=0x1;_0x8b4275[_0xcfc5('0x9c')]=ut[_0xcfc5('0x9d')](_0x8b4275);ut[_0xcfc5('0x8e')](_0x8b4275,0x8,_0xcfc5('0xc7'));rpcDb[_0xcfc5('0x93')](_0x8b4275,_0xcfc5('0xc8'));if(ut[_0xcfc5('0x9d')](_0x8b4275)>=_0xf0c6f5[_0xcfc5('0xa0')]){_0x17dbbe=ut[_0xcfc5('0xa1')](_0x8b4275,0xf,_0xcfc5('0xa2'));rpcDb[_0xcfc5('0xa3')](_0x17dbbe,_0xcfc5('0xc9'));}else{if(_0x8b4275[_0xcfc5('0xc6')]>=_0xf0c6f5[_0xcfc5('0xca')]){rpcDb['createCustomerFinal'](_0x8b4275,_0xcfc5('0xc8'));}else{rpcDb[_0xcfc5('0xa6')](ut[_0xcfc5('0xa7')](_0x8b4275,_0xcfc5('0xc6'),_0xf0c6f5[_0xcfc5('0xbc')]),_0x8b4275[_0xcfc5('0xa8')],_0x8b4275[_0xcfc5('0xbd')]);}}break;case _0xcfc5('0xcb'):_0xf0c6f5[_0xcfc5('0x41')]+=0x1;_0x8b4275[_0xcfc5('0xcc')]+=0x1;_0x8b4275['countglobal']=ut[_0xcfc5('0x9d')](_0x8b4275);ut['logCustomer'](_0x8b4275,0x14,'AgentReject');rpcDb[_0xcfc5('0x93')](_0x8b4275,'[syncHangupRequest][logAgentReject]');if(ut[_0xcfc5('0x9d')](_0x8b4275)>=_0xf0c6f5[_0xcfc5('0xa0')]){_0x17dbbe=ut[_0xcfc5('0xa1')](_0x8b4275,0x14,_0xcfc5('0xcd'));rpcDb[_0xcfc5('0xa3')](_0x17dbbe,_0xcfc5('0xce'));}else{if(_0x8b4275[_0xcfc5('0xcc')]>=_0xf0c6f5[_0xcfc5('0xcf')]){rpcDb[_0xcfc5('0xa3')](_0x8b4275,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0xcfc5('0xa6')](ut['scheduledAt'](_0x8b4275,_0xcfc5('0xcc'),_0xf0c6f5[_0xcfc5('0xd0')]),_0x8b4275[_0xcfc5('0xa8')],_0x8b4275['activeContact']);}}break;case _0xcfc5('0xd1'):_0xf0c6f5[_0xcfc5('0x43')]+=0x1;_0x8b4275['countabandonedretry']+=0x1;_0x8b4275[_0xcfc5('0x9c')]=ut[_0xcfc5('0x9d')](_0x8b4275);ut[_0xcfc5('0x8e')](_0x8b4275,0xb,'Abandoned');rpcDb[_0xcfc5('0x93')](_0x8b4275,_0xcfc5('0xd2'));if(ut[_0xcfc5('0x9d')](_0x8b4275)>=_0xf0c6f5[_0xcfc5('0xa0')]){_0x17dbbe=ut[_0xcfc5('0xa1')](_0x8b4275,0xf,_0xcfc5('0xa2'));rpcDb[_0xcfc5('0xa3')](_0x17dbbe,_0xcfc5('0xd2'));}else{if(_0x8b4275[_0xcfc5('0xd3')]>=_0xf0c6f5[_0xcfc5('0xd4')]){rpcDb[_0xcfc5('0xa3')](_0x8b4275,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xcfc5('0xa6')](ut[_0xcfc5('0xa7')](_0x8b4275,_0xcfc5('0xd5'),_0xf0c6f5[_0xcfc5('0xd6')]),_0x8b4275[_0xcfc5('0xa8')],_0x8b4275[_0xcfc5('0xbd')]);}}break;default:if(_0x8b4275[_0xcfc5('0x72')]){ut['decrementTalkink'](_0xf0c6f5,_0xcfc5('0xd7'));ut['loggerError'](_0xcfc5('0xd8')+_0xf0c6f5[_0xcfc5('0x57')],_0x2f0d46);}_0xf0c6f5[_0xcfc5('0x42')]+=0x1;_0x8b4275[_0xcfc5('0x9c')]=ut[_0xcfc5('0x9d')](_0x8b4275);ut[_0xcfc5('0x8e')](_0x8b4275,0xc,_0x2f0d46[_0xcfc5('0xd9')]||_0x2f0d46[_0xcfc5('0xda')]);rpcDb[_0xcfc5('0x93')](_0x8b4275,_0xcfc5('0xdb'));if(ut[_0xcfc5('0x9d')](_0x8b4275)>=_0xf0c6f5[_0xcfc5('0xa0')]){_0x17dbbe=ut[_0xcfc5('0xa1')](_0x8b4275,0xf,_0xcfc5('0xa2'));rpcDb[_0xcfc5('0xa3')](_0x17dbbe,_0xcfc5('0xdc'));}else{rpcDb[_0xcfc5('0xa3')](_0x8b4275,_0xcfc5('0xdc'));}delete this[_0xcfc5('0x18')][_0x2f0d46[_0xcfc5('0xdd')]];}if(!(_0x8b4275[_0xcfc5('0x72')]&&_0x4360e2==='16')){ut['updateOriginated'](_0xf0c6f5,_0xcfc5('0xde'));logger[_0xcfc5('0x5c')](_0xcfc5('0xdf'),_0x8b4275[_0xcfc5('0xe0')],_0xcfc5('0xb6'),_0xf0c6f5[_0xcfc5('0x57')],_0xcfc5('0x70'),_0xf0c6f5[_0xcfc5('0x4e')]);}if(_0x4360e2!==_0xcfc5('0xa9')){delete this[_0xcfc5('0x18')][_0x2f0d46['linkedid']];delete this[_0xcfc5('0x18')][_0x2f0d46[_0xcfc5('0xe1')]];}}};Preview['prototype'][_0xcfc5('0xe2')]=function(_0x28f698,_0x41647f,_0x2f398c){if(_[_0xcfc5('0xe3')](_0x41647f)&&_0xcfc5('0xe4')!==typeof _0x41647f){return;}if(_[_0xcfc5('0xe3')](_0x2f398c)&&_0xcfc5('0xe4')!==typeof _0x2f398c){return;}switch(_0x2f398c['reason']){case'0':ut[_0xcfc5('0xe5')](_0x28f698,0x0,_0xcfc5('0x9e'));rpcDb[_0xcfc5('0xe6')](_0x28f698,_0xcfc5('0xe7'));break;case'3':ut[_0xcfc5('0xe5')](_0x28f698,0x3,'NoAnswer');rpcDb['createAgentHistory'](_0x28f698,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut['logAgent'](_0x28f698,0x5,'Busy');rpcDb[_0xcfc5('0xe6')](_0x28f698,_0xcfc5('0xe8'));break;case'8':ut[_0xcfc5('0xe5')](_0x28f698,0x8,_0xcfc5('0xc7'));rpcDb[_0xcfc5('0xe6')](_0x28f698,_0xcfc5('0xe9'));break;case'22':ut[_0xcfc5('0xe5')](_0x28f698,0x16,_0xcfc5('0xea'));rpcDb['createAgentHistory'](_0x28f698,_0xcfc5('0xeb'));break;default:ut[_0xcfc5('0xe5')](_0x28f698,0xc,_0x2f398c['reason']);rpcDb['createAgentHistory'](_0x28f698,_0xcfc5('0xe9'));}ut[_0xcfc5('0x78')](_0x41647f,_0xcfc5('0xec'));logger[_0xcfc5('0x5c')](_0xcfc5('0xed'),_0x28f698['uniqueid'],_0xcfc5('0xb6'),_0x41647f[_0xcfc5('0x57')],'originated:\x20',_0x41647f[_0xcfc5('0x4e')]);delete this[_0xcfc5('0x18')][_0x28f698[_0xcfc5('0xe0')]];};Preview[_0xcfc5('0x10')][_0xcfc5('0xee')]=function(_0x168144,_0x4fa81c,_0x2a6a29,_0x3ebbba,_0x573555){var _0x4bbcb2=this;return new BPromise(function(_0x385ce7,_0x4fcfe8){if(_[_0xcfc5('0x81')](_0x4fa81c)||_[_0xcfc5('0x81')](_0x4fa81c['Contact'])||_[_0xcfc5('0x81')](_0x4fa81c[_0xcfc5('0xef')]['phone'])||_['isNil'](_0x4fa81c[_0xcfc5('0xf0')])){_0x4fcfe8(ut[_0xcfc5('0x4d')]('Contact\x20is\x20undefined',_0x3ebbba,_0x573555));return;}var _0x51264a=uuid['v4']();var _0x25be5c=_0x4bbcb2[_0xcfc5('0x15')][_0x4fa81c[_0xcfc5('0x6e')][_0xcfc5('0x57')]];var _0x12b92e=_0x2a6a29?_0x4bbcb2[_0xcfc5('0x19')][_0x2a6a29]['id']:undefined;_0x4bbcb2[_0xcfc5('0x18')][_0x51264a]=new Action(_0x4fa81c,_0x25be5c,_0x51264a,_0x2a6a29,_0x12b92e);var _0x55dcec=_0x4bbcb2[_0xcfc5('0x18')][_0x51264a];_0x55dcec['unlockAgent']=_0x3ebbba;_0x55dcec[_0xcfc5('0xbd')]=_0x573555;_0x55dcec[_0xcfc5('0xf1')]=_0x2a6a29;if(_[_0xcfc5('0xf2')](_0x168144)){_0x4bbcb2['execCall'](_0x55dcec,_0x25be5c,_0x4fa81c,_0x2a6a29)['then'](function(_0x2f0afe){logger[_0xcfc5('0x5c')](_0xcfc5('0xf3'),_0xcfc5('0xf4')+_0x55dcec[_0xcfc5('0x6f')]+_0xcfc5('0xf5')+_0x55dcec[_0xcfc5('0xf6')],JSON[_0xcfc5('0x58')](_0x2f0afe));ami[_0xcfc5('0x28')](_0xcfc5('0xf7'),ut[_0xcfc5('0xad')](_0x55dcec,_0xcfc5('0xf8')));_0x385ce7(ut[_0xcfc5('0x4d')](_0xcfc5('0xf9')));})[_0xcfc5('0x8b')](function(_0x16ae3f){ut['logger'](_0xcfc5('0xfa'),_0x16ae3f);_0x4fcfe8(ut[_0xcfc5('0x4d')](_0xcfc5('0xfb'),_0x3ebbba,_0x573555));});}else{_0x25be5c[_0xcfc5('0x3c')]+=0x1;ut[_0xcfc5('0xfc')](_0x55dcec);rpcDb[_0xcfc5('0xfd')](_0x55dcec,'[Blacklist][error]');delete _0x4bbcb2[_0xcfc5('0x18')][_0x51264a];_0x4fcfe8(ut[_0xcfc5('0x4d')](_0xcfc5('0xfe'),_0x3ebbba,_0x573555));}});};Preview['prototype'][_0xcfc5('0x97')]=function(_0x4ad5d3){return!_[_0xcfc5('0x81')](_0x4ad5d3)&&!_[_0xcfc5('0x81')](_0x4ad5d3[_0xcfc5('0x57')])&&!_[_0xcfc5('0x81')](_0x4ad5d3[_0xcfc5('0x54')])&&_0x4ad5d3[_0xcfc5('0x54')]&&!_[_0xcfc5('0x81')](this[_0xcfc5('0x17')][util[_0xcfc5('0x5e')](_0xcfc5('0xff'),_0x4ad5d3[_0xcfc5('0x57')])])&&!_[_0xcfc5('0x81')](this['trunks'][util[_0xcfc5('0x5e')](_0xcfc5('0xff'),_0x4ad5d3[_0xcfc5('0x57')])]['status'])&&(this[_0xcfc5('0x17')][util['format'](_0xcfc5('0xff'),_0x4ad5d3[_0xcfc5('0x57')])][_0xcfc5('0x76')]===_0xcfc5('0x100')||this['trunks'][util[_0xcfc5('0x5e')](_0xcfc5('0xff'),_0x4ad5d3[_0xcfc5('0x57')])][_0xcfc5('0x76')]===_0xcfc5('0x101'));};Preview['prototype'][_0xcfc5('0x102')]=function(_0x5324c5,_0x314d3d){var _0x67caf5=this;return new BPromise(function(_0x5589be,_0x219452){_0x67caf5[_0xcfc5('0x103')](_0x5324c5,_0x314d3d)['then'](function(_0x4f4883){_0x5589be(_[_0xcfc5('0x104')](_0x4f4883,['message']));})['catch'](function(_0x43ca3b){if(_0x43ca3b[_0xcfc5('0x105')]){rpcDb[_0xcfc5('0x106')](_0x5324c5);}if(_0x43ca3b[_0xcfc5('0x54')]){rpcDb[_0xcfc5('0x8c')](_0x5324c5);}_0x219452(_['pick'](_0x43ca3b,[_0xcfc5('0x4d')]));});});};Preview[_0xcfc5('0x10')][_0xcfc5('0x103')]=function(_0xa37ce6,_0x36894e){var _0x2cecc5=this;return new BPromise(function(_0x59993f,_0x3fc3b5){var _0x51b6e2,_0x571941;rpcDb[_0xcfc5('0x107')](_0xa37ce6)['then'](function(_0x484869){if(!_[_0xcfc5('0x81')](_0x484869[0x0])){_0x571941=_0x484869[0x0][_0xcfc5('0x108')]?![]:!![];_0x51b6e2=_0x484869[0x0][_0xcfc5('0x108')]?!![]:![];_0x51b6e2=_0x36894e?!![]:_0x51b6e2;}var _0xe0ac29=_0x2cecc5[_0xcfc5('0x109')](_0x484869);if(_0xe0ac29[_0xcfc5('0x10a')]){rpcDb['checkIsBlackList'](_[_0xcfc5('0x104')](_0x484869[0x0],[_0xcfc5('0xf0'),_0xcfc5('0x10b')]))[_0xcfc5('0x88')](function(_0xa229a2){_0x2cecc5['checkInBlack'](_0xa229a2,_0x484869[0x0],_0x36894e,_0x571941,_0x51b6e2)[_0xcfc5('0x88')](function(_0x1892bf){_0x59993f(_0x1892bf);})[_0xcfc5('0x8b')](function(_0x3aae5d){_0x3fc3b5(_0x3aae5d);});})[_0xcfc5('0x8b')](function(_0x494681){ut[_0xcfc5('0x62')](_0xcfc5('0x10c'),_0x494681);_0x3fc3b5(ut[_0xcfc5('0x4d')]('Call\x20unsuccessful',_0x571941,_0x51b6e2));});}else{_0x3fc3b5(ut['message'](_0xe0ac29[_0xcfc5('0x4d')],_0x571941,_0x51b6e2));}})[_0xcfc5('0x8b')](function(_0x502c90){ut[_0xcfc5('0x62')](_0xcfc5('0x10d'),_0x502c90);_0x3fc3b5(ut[_0xcfc5('0x4d')](_0xcfc5('0x10e'),![],!![]));});});};Preview[_0xcfc5('0x10')][_0xcfc5('0x109')]=function(_0x4bb55d){if(_[_0xcfc5('0x81')](_0x4bb55d)||_[_0xcfc5('0xf2')](_0x4bb55d)||!_[_0xcfc5('0x81')](_0x4bb55d[0x0][_0xcfc5('0x86')])&&_[_0xcfc5('0x81')](_0x4bb55d[0x0][_0xcfc5('0x86')]['name'])){ut[_0xcfc5('0x62')](_0xcfc5('0x10f'),_0x4bb55d);return{'isValid':![],'message':_0xcfc5('0x110')};}var _0x418eb0=this['campaignsPreview'][_0x4bb55d[0x0][_0xcfc5('0x6e')]['name']];_0x418eb0['message']=_0xcfc5('0x111');if(_[_0xcfc5('0x81')](_0x418eb0)){ut[_0xcfc5('0x62')](_0xcfc5('0x112'),_0x418eb0);return{'isValid':![],'message':_0xcfc5('0x113')};}if(!this[_0xcfc5('0x97')](_0x418eb0[_0xcfc5('0x53')])){ut[_0xcfc5('0x62')](_0xcfc5('0x114'),_0xcfc5('0x115')+_0x418eb0['name']+_0xcfc5('0x116'));if(!this[_0xcfc5('0x97')](_0x418eb0[_0xcfc5('0x98')])){ut[_0xcfc5('0x62')](_0xcfc5('0x114'),_0x418eb0[_0xcfc5('0x57')]+_0xcfc5('0x117'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut['isActive'](_0x418eb0[_0xcfc5('0x35')])){ut[_0xcfc5('0x62')](_0xcfc5('0x118'),_0x418eb0[_0xcfc5('0x57')]+_0xcfc5('0x119'));return{'isValid':![],'message':_0xcfc5('0x115')+_0x418eb0['name']+_0xcfc5('0x119')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xcfc5('0x10')][_0xcfc5('0x11a')]=function(_0x5569e0,_0x377b5a,_0x4076a6,_0x2c3a4a){var _0x4e8f68=this;return new BPromise(function(_0x154a09,_0x21a85e){var _0x5a3ffa=_0x5569e0[_0xcfc5('0xe0')];var _0x44f2eb=_0x4e8f68[_0xcfc5('0x97')](_0x377b5a[_0xcfc5('0x53')])?util[_0xcfc5('0x5e')](_0xcfc5('0x11b'),_0x377b5a[_0xcfc5('0x53')][_0xcfc5('0x57')],_[_0xcfc5('0x81')](_0x377b5a['dialPrefix'])?'':_0x377b5a[_0xcfc5('0x39')][_0xcfc5('0x11c')]()||'',_0x377b5a[_0xcfc5('0x11d')]>0x0?_0x4076a6[_0xcfc5('0xef')][_0xcfc5('0x11e')]['substring'](_0x377b5a[_0xcfc5('0x11d')]):_0x4076a6[_0xcfc5('0xef')][_0xcfc5('0x11e')]):util[_0xcfc5('0x5e')]('SIP/%s/%s%s',_[_0xcfc5('0x81')](_0x377b5a[_0xcfc5('0x98')])?_0x377b5a[_0xcfc5('0x53')][_0xcfc5('0x57')]:_0x377b5a[_0xcfc5('0x98')][_0xcfc5('0x57')],_['isNil'](_0x377b5a[_0xcfc5('0x39')])?'':_0x377b5a[_0xcfc5('0x39')][_0xcfc5('0x11c')]()||'',_0x377b5a[_0xcfc5('0x11d')]>0x0?_0x4076a6[_0xcfc5('0xef')][_0xcfc5('0x11e')][_0xcfc5('0x11f')](_0x377b5a[_0xcfc5('0x11d')]):_0x4076a6['Contact'][_0xcfc5('0x11e')]);var _0x17126f=_0x4e8f68['isTrunkReachable'](_0x377b5a[_0xcfc5('0x53')])?ut['getCallerId'](_0x377b5a[_0xcfc5('0x53')][_0xcfc5('0x55')],_0x377b5a[_0xcfc5('0x120')],_0x377b5a[_0xcfc5('0x121')]>0x0?ut[_0xcfc5('0x122')](_0x377b5a[_0xcfc5('0x37')],_0x377b5a['dialRandomLastDigitCallerIdNumber']):_0x377b5a[_0xcfc5('0x37')]):ut[_0xcfc5('0x123')](_['isNil'](_0x377b5a[_0xcfc5('0x98')])?_0x377b5a['Trunk'][_0xcfc5('0x55')]:_0x377b5a[_0xcfc5('0x98')][_0xcfc5('0x55')],_0x377b5a['dialOriginateCallerIdName'],_0x377b5a[_0xcfc5('0x121')]>0x0?ut[_0xcfc5('0x122')](_0x377b5a[_0xcfc5('0x37')],_0x377b5a[_0xcfc5('0x121')]):_0x377b5a['dialOriginateCallerIdNumber']);if(_0x17126f){_0x5569e0['originatecalleridname']=ut[_0xcfc5('0x124')](_0x17126f);_0x5569e0[_0xcfc5('0x125')]=ut[_0xcfc5('0x126')](_0x17126f);}var _0x2aca49=ut['addVariables'](_0x377b5a,_0x4076a6,_0x44f2eb,_0x17126f,_0x5a3ffa,_0x5569e0);_[_0xcfc5('0x127')](_0x5569e0,ut['toLowerVariables'](_0x2aca49));_0x5569e0[_0xcfc5('0x8d')]=moment()[_0xcfc5('0x5e')](_0xcfc5('0xaa'));ami['Action'](ut['variablesAction'](_0x5569e0,_0x377b5a,_0x2aca49,_0x5569e0['activeContact'],_0x2c3a4a))[_0xcfc5('0x88')](function(_0x3028a8){_0x377b5a[_0xcfc5('0x4e')]+=0x1;logger[_0xcfc5('0x5c')](_0xcfc5('0x128'),_0x5a3ffa,_0xcfc5('0xb6'),_0x377b5a['name'],_0xcfc5('0x70'),_0x377b5a[_0xcfc5('0x4e')]);_0x154a09(_0x3028a8);})[_0xcfc5('0x8b')](function(_0x1bc3bf){ut[_0xcfc5('0xe5')](_0x5569e0,0xe,_0xcfc5('0x129'));rpcDb[_0xcfc5('0xe6')](_0x5569e0,_0xcfc5('0x12a'));_0x21a85e(_0x1bc3bf);});});};Preview[_0xcfc5('0x10')][_0xcfc5('0x12b')]=function(_0x4acece){if(this['actions'][_0x4acece[_0xcfc5('0xdd')]]){this[_0xcfc5('0x18')][_0x4acece[_0xcfc5('0xdd')]][_0xcfc5('0x12c')]=_0x4acece[_0xcfc5('0x12c')];}};Preview[_0xcfc5('0x10')]['syncOriginateResponse']=function(_0x435e80){var _0x1ccb8b=this;var _0x456b85=this['actions'][_0x435e80['actionid']];if(_0x456b85){if(_0x456b85[_0xcfc5('0xf1')]&&this[_0xcfc5('0x19')][_0x456b85['lookAgent']]){ut[_0xcfc5('0x12d')](_0x456b85,this['agents'][_0x456b85[_0xcfc5('0xf1')]][_0xcfc5('0x57')],this[_0xcfc5('0x19')][_0x456b85[_0xcfc5('0xf1')]]['id']);}var _0x2489d3=_[_0xcfc5('0x12e')](_0x456b85);_0x2489d3[_0xcfc5('0x12f')]=moment()[_0xcfc5('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');var _0x77f9b4=_0x1ccb8b[_0xcfc5('0x15')][_0x456b85['queue']];if(ut[_0xcfc5('0x130')](_0x435e80[_0xcfc5('0x131')])){if(_0x456b85[_0xcfc5('0xa8')]){rpcDb[_0xcfc5('0x106')](_0x456b85['idContact']);}if(_0x456b85[_0xcfc5('0xbd')]){rpcDb[_0xcfc5('0x8c')](_0x456b85['idContact']);}ami[_0xcfc5('0x28')]('custom:agentringnoanswer',ut['buildObj'](_0x456b85,_0xcfc5('0x132')));this[_0xcfc5('0xe2')](_0x2489d3,_0x77f9b4,_0x435e80);}else{_0x456b85[_0xcfc5('0x8d')]=moment()[_0xcfc5('0x5e')](_0xcfc5('0xaa'));ut[_0xcfc5('0xe5')](_0x2489d3,0x4,_0xcfc5('0xb2'));rpcDb[_0xcfc5('0xe6')](_0x2489d3,_0xcfc5('0x133'));}}};Preview['prototype'][_0xcfc5('0x1e')]=function(_0x5abf64){var _0x363b38=this;var _0x187bc8=this['actions'][_0x5abf64[_0xcfc5('0xdd')]];var _0x3d1fed;if(_0x187bc8){_0x3d1fed=this[_0xcfc5('0x15')][_0x187bc8[_0xcfc5('0x6f')]];logger['info'](_0xcfc5('0x134'),_0x5abf64[_0xcfc5('0xdd')],'\x20Queue',_0x3d1fed[_0xcfc5('0x57')],_0xcfc5('0x71'),_0x3d1fed[_0xcfc5('0x2e')]);}if(this[_0xcfc5('0x18')][_0x5abf64[_0xcfc5('0xdd')]]&&_0x5abf64['linkedid']!==_0x5abf64[_0xcfc5('0xe0')]){if(_0x5abf64[_0xcfc5('0x135')]==='16'&&this[_0xcfc5('0x18')][_0x5abf64[_0xcfc5('0xdd')]][_0xcfc5('0x72')]){this['callProgressDetectingCustomer'](_0x5abf64,_0x5abf64['linkedid'],_0x5abf64[_0xcfc5('0x135')]);}else if(this[_0xcfc5('0x18')][_0x5abf64[_0xcfc5('0xdd')]][_0xcfc5('0x72')]){logger['info'](_0xcfc5('0x136'),_0x5abf64[_0xcfc5('0xdd')],_0x5abf64['cause'],_0xcfc5('0xb6'),_0x3d1fed[_0xcfc5('0x57')],_0xcfc5('0x71'),_0x3d1fed[_0xcfc5('0x2e')]);this[_0xcfc5('0x99')](_0x5abf64,_0x5abf64[_0xcfc5('0xdd')],_0x5abf64[_0xcfc5('0x135')]);}}else if(_0x187bc8&&_[_0xcfc5('0x81')](_0x187bc8['statedesc'])&&_0x3d1fed[_0xcfc5('0x137')]&&_0x5abf64[_0xcfc5('0xdd')]===_0x5abf64[_0xcfc5('0xe0')]&&_[_0xcfc5('0x81')](_0x5abf64[_0xcfc5('0x138')])&&_0x5abf64['cause']==='16'&&_0x5abf64[_0xcfc5('0x139')]==='6'&&_[_0xcfc5('0xe3')](_0x187bc8[_0xcfc5('0x13a')])){if(_0x187bc8[_0xcfc5('0xa8')]){rpcDb[_0xcfc5('0x106')](_0x187bc8[_0xcfc5('0xf6')]);}if(_0x187bc8[_0xcfc5('0xbd')]){rpcDb[_0xcfc5('0x8c')](_0x187bc8[_0xcfc5('0xf6')]);}_0x5abf64[_0xcfc5('0x138')]='22';this['callProgressDetectingAgent'](_0x187bc8,_0x3d1fed,_0x5abf64);}else if(_0x187bc8&&_0x187bc8[_0xcfc5('0x13a')]){if(_0x5abf64[_0xcfc5('0x135')]==='16'&&this[_0xcfc5('0x18')][_0x5abf64[_0xcfc5('0xdd')]]['dialAnswer']){logger[_0xcfc5('0x5c')]('[syncHangup][talking][transfer]',_0x5abf64[_0xcfc5('0xdd')],_0x5abf64[_0xcfc5('0x135')],_0xcfc5('0xb6'),_0x3d1fed[_0xcfc5('0x57')],'pTalking:\x20',_0x3d1fed[_0xcfc5('0x2e')]);this[_0xcfc5('0x99')](_0x5abf64,_0x5abf64['linkedid'],_0x5abf64[_0xcfc5('0x135')]);}else if(this[_0xcfc5('0x18')][_0x5abf64[_0xcfc5('0xdd')]][_0xcfc5('0x72')]){logger[_0xcfc5('0x5c')](_0xcfc5('0x136'),_0x5abf64[_0xcfc5('0xdd')],_0x5abf64[_0xcfc5('0x135')],'\x20Queue',_0x3d1fed[_0xcfc5('0x57')],_0xcfc5('0x71'),_0x3d1fed[_0xcfc5('0x2e')]);this[_0xcfc5('0x99')](_0x5abf64,_0x5abf64['linkedid'],_0x5abf64[_0xcfc5('0x135')]);}}};Preview[_0xcfc5('0x10')][_0xcfc5('0x21')]=function(_0x21d597){if(this[_0xcfc5('0x18')][_0x21d597[_0xcfc5('0xe1')]]&&_0x21d597['destlinkedid']!==_0x21d597[_0xcfc5('0x13b')]){this[_0xcfc5('0x99')](_0x21d597,_0x21d597[_0xcfc5('0xe1')],_0x21d597[_0xcfc5('0xda')]);}};Preview['prototype']['syncHangupRequest']=function(_0x4c3f9b){if(this[_0xcfc5('0x18')][_0x4c3f9b[_0xcfc5('0xdd')]]&&_0x4c3f9b[_0xcfc5('0xdd')]!==_0x4c3f9b['uniqueid']&&!this[_0xcfc5('0x18')][_0x4c3f9b[_0xcfc5('0xdd')]][_0xcfc5('0x72')]){if(_0x4c3f9b[_0xcfc5('0x135')]==='1'){this[_0xcfc5('0x99')](_0x4c3f9b,_0x4c3f9b[_0xcfc5('0xdd')],_0x4c3f9b[_0xcfc5('0x135')]);}}};Preview[_0xcfc5('0x10')][_0xcfc5('0x13c')]=function(_0x1c4d63,_0xb33820,_0x321936){if(this[_0xcfc5('0x18')][_0x1c4d63]){if(_[_0xcfc5('0x81')](this[_0xcfc5('0x18')][_0x1c4d63][_0xcfc5('0x13d')])){this[_0xcfc5('0x18')][_0x1c4d63][_0xcfc5('0x13d')]={};}this['actions'][_0x1c4d63][_0xcfc5('0x13d')][_0xb33820]=_0x321936;}};Preview[_0xcfc5('0x10')][_0xcfc5('0x24')]=function(_0x1e5344){try{if(!_['isNil'](_0x1e5344)){if(ut[_0xcfc5('0x13e')](_['keys'](_0x1e5344['variable'])[0x0])){this[_0xcfc5('0x13c')](_0x1e5344[_0xcfc5('0xe0')],_[_0xcfc5('0x13f')](_0x1e5344[_0xcfc5('0x140')])[0x0],_0x1e5344['value']);}}}catch(_0x3a1039){logger['error'](_0xcfc5('0x141'),util[_0xcfc5('0x142')](_0x3a1039,{'showHidden':![],'depth':null}));}};Preview[_0xcfc5('0x10')][_0xcfc5('0x25')]=function(_0x4d5c49){if(_0x4d5c49){if(this[_0xcfc5('0x18')][_0x4d5c49[_0xcfc5('0x143')]]){this['actions'][_0x4d5c49[_0xcfc5('0x143')]][_0xcfc5('0x13a')]=!![];}}};Preview[_0xcfc5('0x10')]['syncBlindTransfer']=function(_0x469714){if(_0x469714){if(this['actions'][_0x469714[_0xcfc5('0x144')]]){this['actions'][_0x469714[_0xcfc5('0x144')]]['transfer']=!![];}}};module[_0xcfc5('0x145')]=Preview; \ No newline at end of file +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 diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index c374120..0f91304 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 _0x46ed=['context','exten','xcally-motion-preview','assigned','lastAssignedTo','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','bluebird','preview','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','membername'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x46ed,0x168));var _0xd46e=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x46ed[_0x46698a];return _0x356db0;};'use strict';var util=require(_0xd46e('0x0'));var BPromise=require(_0xd46e('0x1'));var logger=require('../../../config/logger')(_0xd46e('0x2'));var _=require(_0xd46e('0x3'));var cmHopper=require(_0xd46e('0x4'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0xd46e('0x5'));var cmHopperBlack=require(_0xd46e('0x6'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0xd46e('0x7'));var voiceQueueReport=require(_0xd46e('0x8'));function loggerCatch(_0x160bcf){return function(_0x25cf78){logger[_0xd46e('0x9')](_0x160bcf,util[_0xd46e('0xa')](_0x25cf78,{'showHidden':![],'depth':null}));};}function create(_0x437ea0){return BPromise[_0xd46e('0xb')]()[_0xd46e('0xc')](cmHopperHistory[_0xd46e('0xd')](_0x437ea0))[_0xd46e('0xe')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x7b2d69){return BPromise[_0xd46e('0xb')]()['then'](agentReportPreview[_0xd46e('0xd')](_0x7b2d69))[_0xd46e('0xe')](loggerCatch(_0xd46e('0xf')));}function moveContact(_0x443000){return BPromise[_0xd46e('0xb')]()[_0xd46e('0xc')](cmHopper['moveContactManagedDialer'](_0x443000,!![]))[_0xd46e('0xe')](loggerCatch('[moveContactManagedDialer]\x20'));}exports['checkIsBlackList']=function(_0xf3048c){return BPromise[_0xd46e('0xb')]()['then'](cmHopperBlack['checkIsBlackList'](_0xf3048c))[_0xd46e('0xe')](loggerCatch(_0xd46e('0x10')));};exports[_0xd46e('0x11')]=function(_0x3fdf88){return BPromise['resolve']()[_0xd46e('0xc')](cmHopper[_0xd46e('0x11')](_0x3fdf88))[_0xd46e('0xe')](loggerCatch(_0xd46e('0x12')));};exports[_0xd46e('0xd')]=function(_0x47fa8f,_0x1d50a5){create(_0x47fa8f)[_0xd46e('0xe')](loggerCatch(_0x1d50a5));moveContact(_0x47fa8f)[_0xd46e('0xe')](loggerCatch(_0x1d50a5));};exports['createAgentHistory']=function(_0x5ddd04,_0x2e8f6d){createAgent(_0x5ddd04)[_0xd46e('0xe')](loggerCatch(_0x2e8f6d));};exports['createCustomerHistory']=function(_0x4fd1f2,_0x2d6f2c){create(_0x4fd1f2)[_0xd46e('0xe')](loggerCatch(_0x2d6f2c));};exports[_0xd46e('0x13')]=function(_0x2273c5,_0x409010){moveContact(_0x2273c5)[_0xd46e('0xe')](loggerCatch(_0x409010));};exports[_0xd46e('0x14')]=function(_0x327b7e,_0xb4940,_0x3c7e91){if(_0xb4940){_0x327b7e[_0xd46e('0x15')]=null;}if(_0x3c7e91){_0x327b7e['active']=![];}return BPromise[_0xd46e('0xb')]()[_0xd46e('0xc')](cmHopper[_0xd46e('0x14')](_0x327b7e))[_0xd46e('0xe')](loggerCatch(_0xd46e('0x16')));};exports[_0xd46e('0x17')]=function(_0x33c2e0){return BPromise[_0xd46e('0xb')]()[_0xd46e('0xc')](cmHopper['countReScheduled'](_0x33c2e0))[_0xd46e('0xe')](loggerCatch('[countReScheduled]\x20'));};exports['unlockContact']=function(_0x371054){return BPromise[_0xd46e('0xb')]()[_0xd46e('0xc')](cmHopper[_0xd46e('0x18')]({'UserId':null},_0x371054,0x1))[_0xd46e('0xe')](loggerCatch(_0xd46e('0x19')));};exports[_0xd46e('0x1a')]=function(_0x4dab6a){return BPromise[_0xd46e('0xb')]()[_0xd46e('0xc')](cmHopper[_0xd46e('0x18')]({'active':![]},_0x4dab6a,0x1))[_0xd46e('0xe')](loggerCatch(_0xd46e('0x1b')));};exports[_0xd46e('0x1c')]=function(_0x58aeef){var _0x465d54={};_0x465d54[_0xd46e('0x1d')]=_0x58aeef[_0xd46e('0x1d')];_0x465d54[_0xd46e('0x1e')]=_0x58aeef[_0xd46e('0x1e')];_0x465d54[_0xd46e('0x1f')]=_0x58aeef[_0xd46e('0x1f')];_0x465d54[_0xd46e('0x20')]=_0x58aeef[_0xd46e('0x20')];_0x465d54[_0xd46e('0x21')]=_0x58aeef[_0xd46e('0x21')];_0x465d54[_0xd46e('0x22')]=_0x58aeef[_0xd46e('0x23')];_0x465d54['queuecallerleaveAt']=_0x58aeef[_0xd46e('0x23')];_0x465d54[_0xd46e('0x24')]=0x1;_0x465d54[_0xd46e('0x25')]=_0x58aeef[_0xd46e('0x26')];_0x465d54['connectedlinename']=_0x58aeef[_0xd46e('0x27')];_0x465d54[_0xd46e('0x28')]='from-sip';_0x465d54[_0xd46e('0x29')]=_0xd46e('0x2a');_0x465d54['holdtime']=0x0;_0x465d54[_0xd46e('0x2b')]=0x1;_0x465d54[_0xd46e('0x2c')]=_0x58aeef[_0xd46e('0x27')];_0x465d54['queuecallerexitreason']='COMPLETED';return BPromise[_0xd46e('0xb')]()[_0xd46e('0xc')](voiceQueueReport[_0xd46e('0x2d')](_0x465d54))[_0xd46e('0xe')](loggerCatch(_0xd46e('0x2e')));};exports[_0xd46e('0x2f')]=function(_0xa34f09,_0xf8b746){return BPromise['resolve']()[_0xd46e('0xc')](cmHopper[_0xd46e('0x2f')](_0xa34f09,_0xf8b746))[_0xd46e('0xe')](loggerCatch(_0xd46e('0x30')));};exports[_0xd46e('0x31')]=function(_0x1e0897){return BPromise[_0xd46e('0xb')]()['then'](cmHopper[_0xd46e('0x14')](_0x1e0897,!![],!![]))[_0xd46e('0xe')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +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 diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index d4c832f..24c9046 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 _0x228c=['logAgent','statedesc','ringtime','logLookAgent','membername','UserId','logCustomer','starttime','answertime','isFailure','Failure','variablesAction','BOOKED','uniqueid','channelAgent','calleridnum','from-sip','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','queue','agentReadyId','not_inuse','status','push','getDiff','CampaignId','filterKey','type','dialAnswer','countglobal','callback','callbackuniqueid','callbackat','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','replace','random','extractCalleridName','extractCalleridNumber','match','lodash','moment','preview','env','XCALLY_IP_AGI','milliseconds','diff','seconds','loggerCatch','inspect','logger','info','loggerError','logger2','message','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','addVariables','name','calleridname','ContactId','dialer','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','updateOriginated','originated','error','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','responsetime','endtime'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x228c,0x157));var _0xc228=function(_0x5eb717,_0x3f2638){_0x5eb717=_0x5eb717-0x0;var _0x17a54c=_0x228c[_0x5eb717];return _0x17a54c;};'use strict';var util=require('util');var _=require(_0xc228('0x0'));var moment=require(_0xc228('0x1'));var logger=require('../../../../config/logger')(_0xc228('0x2'));var ipAgi=process[_0xc228('0x3')][_0xc228('0x4')]||'127.0.0.1';function getSeconds(_0x3667aa,_0x4399e0){var _0x3cc2c8=moment(_0x3667aa)[_0xc228('0x5')](0x0);var _0x191dcd=moment(_0x4399e0)[_0xc228('0x5')](0x0);return _0x3cc2c8[_0xc228('0x6')](_0x191dcd,_0xc228('0x7'));}exports[_0xc228('0x8')]=function(_0x198b9c){return function(_0x1d07f2){logger['error'](_0x198b9c,util[_0xc228('0x9')](_0x1d07f2,{'showHidden':![],'depth':null}));};};exports[_0xc228('0xa')]=function(_0x1ee81b,_0x4f74c0){logger[_0xc228('0xb')](_0x1ee81b,util[_0xc228('0x9')](_0x4f74c0,{'showHidden':![],'depth':null}));};exports[_0xc228('0xc')]=function(_0x545c27,_0x57f05b){logger['error'](_0x545c27,util['inspect'](_0x57f05b,{'showHidden':![],'depth':null}));};exports[_0xc228('0xd')]=function(_0x55b1b3){return function(_0x49110f){logger[_0xc228('0xb')](_0x55b1b3,util[_0xc228('0x9')](_0x49110f,{'showHidden':![],'depth':null}));};};exports[_0xc228('0xe')]=function(_0xee46c0,_0x1a11f1,_0x350b39){return{'message':_0xee46c0,'unlock':_0x1a11f1,'active':_0x350b39};};exports['getCallerId']=function(_0x2b3032,_0x392e30,_0x92dad2){if(!_[_0xc228('0xf')](_0x92dad2)&&_0xc228('0x10')===typeof _0x92dad2&&!_[_0xc228('0x11')](_0x92dad2)){if(!_[_0xc228('0xf')](_0x392e30)&&_0xc228('0x10')===typeof _0x392e30&&!_[_0xc228('0x11')](_0x392e30)){return util[_0xc228('0x12')](_0xc228('0x13'),_0x392e30,_0x92dad2);}return util[_0xc228('0x12')]('\x22%s\x22\x20<%s>',_0x92dad2,_0x92dad2);}if(!_[_0xc228('0xf')](_0x2b3032)&&_0xc228('0x10')===typeof _0x2b3032&&!_[_0xc228('0x11')](_0x2b3032)){return _0x2b3032;}return _0xc228('0x14');};exports['isActive']=function(_0x423a4b){if(_[_0xc228('0x15')](_0x423a4b)){return![];}return _0x423a4b;};exports[_0xc228('0x16')]=function(_0x453a87,_0x115187,_0xeb7440,_0x2c5587,_0x322379,_0x78d3f0){var _0x4ffe06={'XMD-QUEUE':_0x115187['Queue']?_0x115187['Queue'][_0xc228('0x17')]:'','XMD-CALLERID':_0x2c5587,'XMD-CALLERID-PREVIEW':_0x78d3f0?util['format'](_0xc228('0x13'),_0x78d3f0[_0xc228('0x18')],_0x78d3f0['calleridnum']):_0x2c5587,'XMD-DIALID':_0x322379,'XMD-CONTACTID':_0x115187[_0xc228('0x19')],'XMD-CDRTYPE':_0xc228('0x1a'),'CALLERID(all)':_0x2c5587,'XMD-VOICEQUEUEID':_0x115187['VoiceQueueId'],'XMD-DIALCHANNEL':_0xeb7440,'XMD-DIALTIMEOUT':_0x453a87['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xc228('0x12')]('\x22rtTxX%s%s\x22',_0x453a87[_0xc228('0x1b')]?'g':'',_[_0xc228('0x11')](_0x453a87[_0xc228('0x1c')])?'':_0xc228('0x1d')),'XMD-DIALURL':_0x453a87[_0xc228('0x1e')]||'','XMD-AGI':_0x453a87[_0xc228('0x1f')]?util[_0xc228('0x12')](_0xc228('0x20'),ipAgi,_0x453a87[_0xc228('0x1f')]):_0xc228('0x21'),'XMD-AGIAFTER':_0x453a87[_0xc228('0x1b')]?util[_0xc228('0x12')](_0xc228('0x20'),ipAgi,_0x453a87['dialQueueProject2']):_0xc228('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x78d3f0?_0x78d3f0['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x78d3f0?_0x78d3f0[_0xc228('0x22')]:'','XMD-DESTINATION':_0xc228('0x23')};if(!_[_0xc228('0x11')](_0x453a87[_0xc228('0x1c')])){_0x4ffe06[util[_0xc228('0x12')]('%s',_0xc228('0x24'))]=_0x453a87[_0xc228('0x1c')];_0x4ffe06[util[_0xc228('0x12')]('%s',_0xc228('0x25'))]=_0x322379;}if(_0x115187&&_0x115187['Contact']){for(var _0x343166 in _0x115187[_0xc228('0x26')]){if(_0x115187[_0xc228('0x26')][_0xc228('0x27')](_0x343166)){if(!_[_0xc228('0x15')](_0x115187[_0xc228('0x26')][_0x343166])&&_0x343166!=='id'&&_0x343166!=='tags'&&_0x343166!==_0xc228('0x28')&&_0x343166!==_0xc228('0x29')){_0x4ffe06[util['format'](_0xc228('0x2a'),_0xc228('0x2b'),_[_0xc228('0x2c')](_0x343166))]=_0x115187['Contact'][_0x343166];}}}}return _0x4ffe06;};exports[_0xc228('0x2d')]=function(_0xad4fcc){var _0x5c2dee={};for(var _0x4bb3d6 in _0xad4fcc){if(_0xad4fcc[_0xc228('0x27')](_0x4bb3d6)){_0x5c2dee[util[_0xc228('0x12')]('%s',_['toLower'](_0x4bb3d6))]=_0xad4fcc[_0x4bb3d6];}}return{'variables':_0x5c2dee};};exports[_0xc228('0x2e')]=function(_0x46e56a,_0x5a5f3d){if(!_[_0xc228('0x15')](_0x46e56a)){if(_0x46e56a['hasOwnProperty'](_0xc228('0x2f'))){if(_0x46e56a[_0xc228('0x2f')]>0x0){_0x46e56a[_0xc228('0x2f')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x5a5f3d);}}}else{logger[_0xc228('0x30')](_0xc228('0x31'),_0x5a5f3d);}};exports[_0xc228('0x32')]=function(_0x1b1706){var _0x36154a=moment()[_0xc228('0x12')](_0xc228('0x33'));_0x1b1706[_0xc228('0x34')]=0xd;_0x1b1706['statedesc']=_0xc228('0x35');_0x1b1706['starttime']=_0x36154a;_0x1b1706[_0xc228('0x36')]=_0x36154a;_0x1b1706[_0xc228('0x37')]=_0x36154a;};exports[_0xc228('0x38')]=function(_0x212bd9,_0x4a2129,_0x1dbe28){var _0x39e01c=moment()[_0xc228('0x12')](_0xc228('0x33'));_0x212bd9[_0xc228('0x34')]=_0x4a2129;_0x212bd9[_0xc228('0x39')]=_0x1dbe28;_0x212bd9[_0xc228('0x36')]=_0x39e01c;_0x212bd9[_0xc228('0x3a')]=getSeconds(_0x212bd9[_0xc228('0x36')],_0x212bd9['starttime']);};exports[_0xc228('0x3b')]=function(_0x13c2ea,_0x16f672,_0x4dd6a0){_0x13c2ea[_0xc228('0x3c')]=_0x16f672;_0x13c2ea[_0xc228('0x3d')]=_0x4dd6a0;};exports[_0xc228('0x3e')]=function(_0x8491cb,_0x2a2394,_0x95b47a){var _0x2183f8=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x8491cb[_0xc228('0x34')]=_0x2a2394;_0x8491cb[_0xc228('0x39')]=_0x95b47a;_0x8491cb['responsetime']=_0x8491cb[_0xc228('0x36')]?_0x8491cb['responsetime']:_0x2183f8;_0x8491cb[_0xc228('0x37')]=_0x8491cb['endtime']?_0x8491cb['endtime']:_0x2183f8;_0x8491cb['ringtime']=getSeconds(_0x8491cb[_0xc228('0x36')]||0x0,_0x8491cb[_0xc228('0x3f')]||0x0);_0x8491cb['talktime']=_0x8491cb[_0xc228('0x40')]?getSeconds(_0x8491cb[_0xc228('0x37')],_0x8491cb[_0xc228('0x40')]):0x0;};exports[_0xc228('0x41')]=function(_0x576e0d){return _0x576e0d===_0xc228('0x42');};exports[_0xc228('0x43')]=function(_0x25f382,_0xbeccf1,_0xd3528c,_0x1673e6,_0x3f675e){var _0xceb44f=_0x1673e6?'RECALL':_0x25f382['calleridname'];_0xceb44f=_0x3f675e?_0xc228('0x44'):_0xceb44f;return{'actionid':_0x25f382[_0xc228('0x45')],'action':'originate','channel':_0x25f382[_0xc228('0x46')],'callerid':util[_0xc228('0x12')](_0xc228('0x13'),_0xceb44f,_0x25f382[_0xc228('0x47')]),'Exten':_0xc228('0x23'),'Context':_0xc228('0x48'),'Priority':'1','variable':_0xd3528c,'timeout':(_0xbeccf1['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x25f382['uniqueid']};};exports[_0xc228('0x49')]=function(_0x1fb135){return _0x1fb135[_0xc228('0x4a')]+_0x1fb135[_0xc228('0x4b')]+_0x1fb135[_0xc228('0x4c')];};exports[_0xc228('0x4d')]=function(_0x15eb9e){var _0x3525e6=_[_0xc228('0x4e')](_0x15eb9e);_0x3525e6[_0xc228('0x34')]=0xf;_0x3525e6['statedesc']=_0xc228('0x4f');return _0x3525e6;};exports[_0xc228('0x50')]=function(_0x65178e,_0x432e32,_0x1f2e72){var _0x7f3cbe={};_0x7f3cbe[_0x432e32]=_0x65178e[_0x432e32];_0x7f3cbe[_0xc228('0x51')]=![];_0x7f3cbe[_0xc228('0x52')]=moment()[_0xc228('0x53')](_0x1f2e72,_0xc228('0x54'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x7f3cbe[_0xc228('0x19')]=_0x65178e[_0xc228('0x19')];_0x7f3cbe[_0xc228('0x55')]=_0x65178e['ListId'];_0x7f3cbe[_0xc228('0x56')]=_0x65178e[_0xc228('0x56')]||undefined;return _0x7f3cbe;};exports[_0xc228('0x57')]=function(_0x47af80,_0x636336){if(!_['isNil'](_0x47af80)){if(_0x47af80[_0xc228('0x58')]>0x0){_0x47af80[_0xc228('0x58')]-=0x1;}else{logger[_0xc228('0x30')](_0x636336,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xc228('0x30')](_0x636336,_0xc228('0x59'));}};exports[_0xc228('0x5a')]=function(_0x26f1fd){if(_0x26f1fd<=0x0){return!![];}return![];};exports['buildObj']=function(_0x3ab226,_0x514c1b){_0x3ab226['lastevent']=_0x514c1b;_0x3ab226[_0xc228('0x17')]=_0x3ab226[_0xc228('0x5b')];_0x3ab226['interface']=_0x3ab226[_0xc228('0x46')];return _0x3ab226;};exports['buildAcw']=function(_0x11108a){var _0x2418d2={};_0x2418d2[_0xc228('0x5b')]=_0x11108a[_0xc228('0x5b')];_0x2418d2['interface']=_0x11108a[_0xc228('0x46')];_0x2418d2[_0xc228('0x45')]=_0x11108a[_0xc228('0x45')];return _0x2418d2;};exports[_0xc228('0x5c')]=function(_0x3aed1){var _0x4c13da=[];for(var _0x2ad205 in _0x3aed1){if(_0x3aed1[_0xc228('0x27')](_0x2ad205)){if(!_[_0xc228('0x15')](_0x3aed1[_0x2ad205])&&_0x3aed1[_0x2ad205][_0xc228('0x34')]===_0xc228('0x5d')&&_0x3aed1[_0x2ad205][_0xc228('0x5e')]==='reachable'){_0x4c13da[_0xc228('0x5f')](_0x3aed1[_0x2ad205]['id']);}}}return _0x4c13da;};exports[_0xc228('0x60')]=function(_0x396bb0){var _0x362f0d=moment()['milliseconds'](0x0);var _0x2b468f=moment(_0x396bb0)['milliseconds'](0x0);return _0x362f0d[_0xc228('0x6')](_0x2b468f,_0xc228('0x7'));};exports['createBody']=function(_0x282fa6){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x282fa6[_0xc228('0x19')],'ListId':_0x282fa6[_0xc228('0x55')],'VoiceQueueId':_0x282fa6[_0xc228('0x56')]||undefined,'CampaignId':_0x282fa6[_0xc228('0x61')]||undefined};};exports[_0xc228('0x62')]=function(_0xb6b6e4){if(_0xb6b6e4===_0xc228('0x45')||_0xb6b6e4==='idContact'||_0xb6b6e4===_0xc228('0x5b')||_0xb6b6e4===_0xc228('0x63')||_0xb6b6e4==='campaigntype'||_0xb6b6e4===_0xc228('0x64')||_0xb6b6e4===_0xc228('0x3c')||_0xb6b6e4===_0xc228('0x46')||_0xb6b6e4===_0xc228('0x18')||_0xb6b6e4===_0xc228('0x51')||_0xb6b6e4===_0xc228('0x47')||_0xb6b6e4===_0xc228('0x52')||_0xb6b6e4===_0xc228('0x4a')||_0xb6b6e4==='countcongestionretry'||_0xb6b6e4===_0xc228('0x4c')||_0xb6b6e4===_0xc228('0x65')||_0xb6b6e4===_0xc228('0x66')||_0xb6b6e4===_0xc228('0x67')||_0xb6b6e4===_0xc228('0x68')||_0xb6b6e4==='recallme'||_0xb6b6e4===_0xc228('0x19')||_0xb6b6e4===_0xc228('0x55')||_0xb6b6e4===_0xc228('0x3d')||_0xb6b6e4===_0xc228('0x56')||_0xb6b6e4===_0xc228('0x69')||_0xb6b6e4===_0xc228('0x6a')||_0xb6b6e4===_0xc228('0x6b')||_0xb6b6e4===_0xc228('0x6c')||_0xb6b6e4===_0xc228('0x6d')||_0xb6b6e4==='xmd-dialurl'||_0xb6b6e4==='xmd-dialtimeout'||_0xb6b6e4==='xmd-dialoptions'||_0xb6b6e4===_0xc228('0x6e')||_0xb6b6e4===_0xc228('0x6f')||_0xb6b6e4===_0xc228('0x70')||_0xb6b6e4==='xmd-cdrtype'||_0xb6b6e4===_0xc228('0x71')||_0xb6b6e4===_0xc228('0x72')||_0xb6b6e4===_0xc228('0x73')||_0xb6b6e4==='rtpaudioqos'||_0xb6b6e4===_0xc228('0x74')||_0xb6b6e4===_0xc228('0x75')||_0xb6b6e4===_0xc228('0x76')||_0xb6b6e4===_0xc228('0x77')||_0xb6b6e4===_0xc228('0x78')||_0xb6b6e4===_0xc228('0x79')||_0xb6b6e4===_0xc228('0x7a')||_0xb6b6e4===_0xc228('0x7b')||_0xb6b6e4===_0xc228('0x74')||_0xb6b6e4===_0xc228('0x75')||_0xb6b6e4===_0xc228('0x76')||_0xb6b6e4===_0xc228('0x77')||_0xb6b6e4===_0xc228('0x78')||_0xb6b6e4==='rtpaudioqosrtt'||_0xb6b6e4==='rtpaudioqosrttbridged'||_0xb6b6e4===_0xc228('0x7c')||_0xb6b6e4===_0xc228('0x7d')||_0xb6b6e4===_0xc228('0x34')||_0xb6b6e4===_0xc228('0x39')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x53c4c9,_0x1602ae){var _0x279c1b,_0x4d735b,_0x544ea4;if(_0x1602ae<=0x0){_0x1602ae=0x1;}_0x279c1b=new RegExp(_0xc228('0x7e')+_0x1602ae+'}$');_0x4d735b=Math[_0xc228('0x7f')](0xa,_0x1602ae-0x1);_0x544ea4=Math[_0xc228('0x7f')](0xa,_0x1602ae)-0x1;return util['format']('%s',_[_0xc228('0x80')](_0x53c4c9,_0x279c1b,_[_0xc228('0x81')](_0x4d735b,_0x544ea4)));};exports[_0xc228('0x82')]=function(_0x215bdd){var _0x52a1cf=_0x215bdd['match'](/"(.*?)"/);return _0x52a1cf?_0x52a1cf[0x1]:_0x215bdd;};exports[_0xc228('0x83')]=function(_0xfaeadb){var _0x35e430=_0xfaeadb[_0xc228('0x84')](/<(.*?)>/);return _0x35e430?_0x35e430[0x1]:_0xfaeadb;}; \ No newline at end of file +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 diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index eaf1ff0..89bef8c 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(_0x17fe40,_0x5a8a92){var _0x406430=function(_0xde51a0){while(--_0xde51a0){_0x17fe40['push'](_0x17fe40['shift']());}};_0x406430(++_0x5a8a92);}(_0x5f2f,0x73));var _0xf5f2=function(_0x500a47,_0x377789){_0x500a47=_0x500a47-0x0;var _0x579a95=_0x5f2f[_0x500a47];return _0x579a95;};'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 _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 diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 485d92f..45e918f 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 _0x2395=['zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','hasOwnProperty','format','mapKeys','isNil','interface','SIP/%s','name','total','answered','sumHoldTime','sumDuration','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','prototype','mergeFromDatabase','initAgents','length','initTelephones','telephones','isUndefined','initTrunks','trunks','voiceQueues','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','queuecallercompleteAt','initVoiceCallReports','disposition','ANSWERED','duration','billableseconds','initCampaigns','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','triggers','campaigns','templates','outbound','voiceExtensions','channels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts'];(function(_0x4f576e,_0x28daa7){var _0x32cf76=function(_0x5be84e){while(--_0x5be84e){_0x4f576e['push'](_0x4f576e['shift']());}};_0x32cf76(++_0x28daa7);}(_0x2395,0x12b));var _0x5239=function(_0x2f86c0,_0x50fda2){_0x2f86c0=_0x2f86c0-0x0;var _0x6a019e=_0x2395[_0x2f86c0];return _0x6a019e;};'use strict';var BPromise=require(_0x5239('0x0'));var util=require(_0x5239('0x1'));var _=require(_0x5239('0x2'));var moment=require(_0x5239('0x3'));var Agent=require(_0x5239('0x4'));var Telephone=require('../model/telephone');var Trunk=require('../model/trunk');var VoiceQueue=require(_0x5239('0x5'));var Trigger=require('../model/trigger');var Template=require(_0x5239('0x6'));var Campaign=require(_0x5239('0x7'));var VoiceExtension=require(_0x5239('0x8'));var ZendeskAccount=require(_0x5239('0x9'));var SalesforceAccount=require(_0x5239('0xa'));var FreshdeskAccount=require(_0x5239('0xb'));var SugarcrmAccount=require(_0x5239('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0x5239('0xd'));var VtigerAccount=require(_0x5239('0xe'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0x5239('0xf'));var FreshsalesAccount=require(_0x5239('0x10'));var FaxAccount=require(_0x5239('0x11'));var Realtime=function(){this[_0x5239('0x12')]={};this['telephones']={};this['trunks']={};this['voiceQueues']={};this[_0x5239('0x13')]={};this[_0x5239('0x14')]={};this[_0x5239('0x15')]={};this[_0x5239('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x5239('0x17')]={};this[_0x5239('0x18')]={};this['queueChannels']={};this[_0x5239('0x19')]={};this[_0x5239('0x1a')]={};this[_0x5239('0x1b')]={};this[_0x5239('0x1c')]={};this[_0x5239('0x1d')]={};this[_0x5239('0x1e')]={};this[_0x5239('0x1f')]={};this[_0x5239('0x20')]={};this[_0x5239('0x21')]={};this[_0x5239('0x22')]={};this[_0x5239('0x23')]={};this[_0x5239('0x24')]={};this[_0x5239('0x25')]={};};function freeIsNotKey(_0x3ae222,_0x253327,_0x195229){var _0xcc273d=_['mapKeys'](_0x3ae222,function(_0x448add,_0x1b7fa8){return _0x448add[_0x195229];});for(var _0x4bf421 in _0x253327){if(_0x253327[_0x5239('0x26')](_0x4bf421)){if(!_0xcc273d[_0x4bf421]){delete _0x253327[_0x4bf421];}}}}function freeIsNotKeySip(_0x30a372,_0x4e8f6f){var _0x450f6f=_['mapKeys'](_0x30a372,function(_0x30e9d3,_0x3481ff){return util[_0x5239('0x27')]('SIP/%s',_0x30e9d3['name']);});for(var _0x5dbb56 in _0x4e8f6f){if(_0x4e8f6f['hasOwnProperty'](_0x5dbb56)){if(!_0x450f6f[_0x5dbb56]){delete _0x4e8f6f[_0x5dbb56];}}}}function freeIsNotKeyAgent(_0x367c84,_0x4ff1b4){var _0x58b8b4=_[_0x5239('0x28')](_0x367c84,function(_0x7a6dd4,_0xc3ab93){var _0x599726=_[_0x5239('0x29')](_0x7a6dd4[_0x5239('0x2a')])?util[_0x5239('0x27')](_0x5239('0x2b'),_0x7a6dd4[_0x5239('0x2c')]):_0x7a6dd4[_0x5239('0x2a')];return _0x599726;});for(var _0x25dc8b in _0x4ff1b4){if(_0x4ff1b4[_0x5239('0x26')](_0x25dc8b)){if(!_0x58b8b4[_0x25dc8b]){delete _0x4ff1b4[_0x25dc8b];}}}}function clearVoiceCallReports(_0x61e5a0){_0x61e5a0[_0x5239('0x2d')]=0x0;_0x61e5a0[_0x5239('0x2e')]=0x0;_0x61e5a0[_0x5239('0x2f')]=0x0;_0x61e5a0[_0x5239('0x30')]=0x0;_0x61e5a0['sumBillable']=0x0;}function clearCampaigns(_0x30e6ec){if(!_[_0x5239('0x31')](_0x30e6ec)){for(var _0x433983 in _0x30e6ec){if(_0x30e6ec['hasOwnProperty'](_0x433983)){_0x30e6ec[_0x433983]['ivrTotalCallsDays']=0x0;_0x30e6ec[_0x433983][_0x5239('0x32')]=0x0;}}}}function clearVoiceQueues(_0x3121a1){if(!_[_0x5239('0x31')](_0x3121a1)){for(var _0x2369e5 in _0x3121a1){if(_0x3121a1['hasOwnProperty'](_0x2369e5)){_0x3121a1[_0x2369e5][_0x5239('0x2d')]=0x0;_0x3121a1[_0x2369e5]['answered']=0x0;_0x3121a1[_0x2369e5][_0x5239('0x33')]=0x0;_0x3121a1[_0x2369e5][_0x5239('0x34')]=0x0;_0x3121a1[_0x2369e5]['sumHoldTime']=0x0;_0x3121a1[_0x2369e5][_0x5239('0x30')]=0x0;_0x3121a1[_0x2369e5][_0x5239('0x35')]=0x0;_0x3121a1[_0x2369e5][_0x5239('0x36')]=0x0;_0x3121a1[_0x2369e5][_0x5239('0x37')]=0x0;_0x3121a1[_0x2369e5][_0x5239('0x38')]=0x0;_0x3121a1[_0x2369e5][_0x5239('0x39')]=0x0;_0x3121a1[_0x2369e5][_0x5239('0x3a')]=0x0;_0x3121a1[_0x2369e5][_0x5239('0x3b')]=0x0;_0x3121a1[_0x2369e5]['outboundDropCallsDayTimeout']=0x0;_0x3121a1[_0x2369e5]['outboundDropCallsDayCallersExit']=0x0;_0x3121a1[_0x2369e5]['outboundBlacklistCallsDay']=0x0;_0x3121a1[_0x2369e5][_0x5239('0x3c')]=0x0;_0x3121a1[_0x2369e5][_0x5239('0x3d')]=0x0;_0x3121a1[_0x2369e5][_0x5239('0x3e')]=0x0;_0x3121a1[_0x2369e5][_0x5239('0x36')]=0x0;_0x3121a1[_0x2369e5][_0x5239('0x3f')]=0x0;_0x3121a1[_0x2369e5]['queueStatusComplete']=!![];}}}}Realtime[_0x5239('0x40')][_0x5239('0x41')]=function(_0x1fc946,_0x594bff){for(var _0x4b3343 in _0x594bff){if(_0x1fc946[_0x5239('0x26')](_0x4b3343)){_0x1fc946[_0x4b3343]=_0x594bff[_0x4b3343];}}};Realtime['prototype'][_0x5239('0x42')]=function(){var _0x1e19c6=this;return function(_0x265711){if(_0x265711){freeIsNotKeyAgent(_0x265711,_0x1e19c6[_0x5239('0x12')]);for(var _0x7c634a=0x0,_0x6e5051={},_0x3c2b94={};_0x7c634a<_0x265711[_0x5239('0x43')];_0x7c634a+=0x1){_0x6e5051=_0x265711[_0x7c634a];var _0xf7c77b=_[_0x5239('0x29')](_0x6e5051[_0x5239('0x2a')])?util['format'](_0x5239('0x2b'),_0x6e5051[_0x5239('0x2c')]):_0x6e5051[_0x5239('0x2a')];if(_['isUndefined'](_0x1e19c6['agents'][_0xf7c77b])){_0x1e19c6[_0x5239('0x12')][_0xf7c77b]=new Agent(_0x6e5051);}else{_0x1e19c6[_0x5239('0x41')](_0x1e19c6[_0x5239('0x12')][_0xf7c77b],_0x6e5051);}}}return _0x1e19c6[_0x5239('0x12')];};};Realtime[_0x5239('0x40')][_0x5239('0x44')]=function(){var _0x2f0d05=this;return function(_0x51c1db){if(_0x51c1db){freeIsNotKeySip(_0x51c1db,_0x2f0d05[_0x5239('0x45')]);for(var _0x56cd33=0x0,_0x5790f9={},_0x5d92f7={};_0x56cd33<_0x51c1db['length'];_0x56cd33+=0x1){_0x5790f9=_0x51c1db[_0x56cd33];if(_[_0x5239('0x46')](_0x2f0d05[_0x5239('0x45')][util[_0x5239('0x27')](_0x5239('0x2b'),_0x5790f9[_0x5239('0x2c')])])){_0x2f0d05['telephones'][util[_0x5239('0x27')](_0x5239('0x2b'),_0x5790f9[_0x5239('0x2c')])]=new Telephone(_0x5790f9);}else{_0x2f0d05['mergeFromDatabase'](_0x2f0d05[_0x5239('0x45')][util['format'](_0x5239('0x2b'),_0x5790f9['name'])],_0x5790f9);}}}return _0x2f0d05[_0x5239('0x45')];};};Realtime['prototype'][_0x5239('0x47')]=function(){var _0x57c51c=this;return function(_0x3afc7e){if(_0x3afc7e){freeIsNotKeySip(_0x3afc7e,_0x57c51c[_0x5239('0x48')]);for(var _0x475bd9=0x0,_0x598ebb={},_0x373931={};_0x475bd9<_0x3afc7e[_0x5239('0x43')];_0x475bd9+=0x1){_0x598ebb=_0x3afc7e[_0x475bd9];if(_[_0x5239('0x46')](_0x57c51c[_0x5239('0x48')][util['format'](_0x5239('0x2b'),_0x598ebb[_0x5239('0x2c')])])){_0x57c51c[_0x5239('0x48')][util[_0x5239('0x27')](_0x5239('0x2b'),_0x598ebb['name'])]=new Trunk(_0x598ebb);}else{_0x57c51c[_0x5239('0x41')](_0x57c51c[_0x5239('0x48')][util[_0x5239('0x27')](_0x5239('0x2b'),_0x598ebb[_0x5239('0x2c')])],_0x598ebb);}}}return _0x57c51c[_0x5239('0x48')];};};Realtime[_0x5239('0x40')]['initVoiceQueues']=function(){var _0x1a6b8d=this;return function(_0x8d73ee){if(_0x8d73ee){freeIsNotKey(_0x8d73ee,_0x1a6b8d[_0x5239('0x49')],_0x5239('0x2c'));for(var _0xd05183=0x0,_0x568964={},_0x168edd={};_0xd05183<_0x8d73ee[_0x5239('0x43')];_0xd05183+=0x1){_0x568964=_0x8d73ee[_0xd05183];if(_[_0x5239('0x46')](_0x1a6b8d[_0x5239('0x49')][_0x568964[_0x5239('0x2c')]])){_0x1a6b8d[_0x5239('0x49')][_0x568964['name']]=new VoiceQueue(_0x568964);}else{_0x1a6b8d[_0x5239('0x41')](_0x1a6b8d[_0x5239('0x49')][_0x568964[_0x5239('0x2c')]],_0x568964);}}}return _0x1a6b8d['voiceQueues'];};};Realtime[_0x5239('0x40')][_0x5239('0x4a')]=function(){var _0x39b00a=this;return function(_0x5a98fc){if(_0x5a98fc){freeIsNotKey(_0x5a98fc,_0x39b00a[_0x5239('0x13')],'id');for(var _0xfebc25=0x0,_0x373925={},_0x54b4ae={};_0xfebc25<_0x5a98fc[_0x5239('0x43')];_0xfebc25+=0x1){_0x373925=_0x5a98fc[_0xfebc25];if(_[_0x5239('0x46')](_0x39b00a[_0x5239('0x13')][_0x373925['id']])){_0x39b00a['triggers'][_0x373925['id']]=new Trigger(_0x373925);}else{_0x39b00a['mergeFromDatabase'](_0x39b00a[_0x5239('0x13')][_0x373925['id']],_0x373925);}}}return _0x39b00a[_0x5239('0x13')];};};Realtime[_0x5239('0x40')][_0x5239('0x4b')]=function(){var _0x629638=this;return function(_0x3949db){if(_0x3949db){freeIsNotKey(_0x3949db,_0x629638[_0x5239('0x15')],'id');for(var _0x4c785b=0x0,_0x3c0c65={},_0x28d10f={};_0x4c785b<_0x3949db['length'];_0x4c785b+=0x1){_0x3c0c65=_0x3949db[_0x4c785b];if(_['isUndefined'](_0x629638[_0x5239('0x15')][_0x3c0c65['id']])){_0x629638['templates'][_0x3c0c65['id']]=new Template(_0x3c0c65);}else{_0x629638[_0x5239('0x41')](_0x629638[_0x5239('0x15')][_0x3c0c65['id']],_0x3c0c65);}}}return _0x629638[_0x5239('0x15')];};};Realtime[_0x5239('0x40')][_0x5239('0x4c')]=function(){var _0x121fa0=this;return function(_0x4396ae){if(_0x4396ae){freeIsNotKey(_0x4396ae,_0x121fa0[_0x5239('0x1b')],'id');for(var _0x179126=0x0,_0x2b369a={},_0x2ade14={};_0x179126<_0x4396ae[_0x5239('0x43')];_0x179126+=0x1){_0x2b369a=_0x4396ae[_0x179126];if(_[_0x5239('0x46')](_0x121fa0[_0x5239('0x1b')][_0x2b369a['id']])){_0x121fa0[_0x5239('0x1b')][_0x2b369a['id']]=new ZendeskAccount(_0x2b369a);}else{_0x121fa0['mergeFromDatabase'](_0x121fa0['zendeskAccounts'][_0x2b369a['id']],_0x2b369a);}}}return _0x121fa0['zendeskAccounts'];};};Realtime[_0x5239('0x40')][_0x5239('0x4d')]=function(){var _0x403776=this;return function(_0x2e22ea){if(_0x2e22ea){freeIsNotKey(_0x2e22ea,_0x403776[_0x5239('0x1c')],'id');for(var _0x102edc=0x0,_0x4373e9={},_0x4296e5={};_0x102edc<_0x2e22ea['length'];_0x102edc+=0x1){_0x4373e9=_0x2e22ea[_0x102edc];if(_[_0x5239('0x46')](_0x403776[_0x5239('0x1c')][_0x4373e9['id']])){_0x403776[_0x5239('0x1c')][_0x4373e9['id']]=new SalesforceAccount(_0x4373e9);}else{_0x403776['mergeFromDatabase'](_0x403776['salesforceAccounts'][_0x4373e9['id']],_0x4373e9);}}}return _0x403776['salesforceAccounts'];};};Realtime[_0x5239('0x40')][_0x5239('0x4e')]=function(){var _0x48e487=this;return function(_0x45f296){if(_0x45f296){freeIsNotKey(_0x45f296,_0x48e487[_0x5239('0x1e')],'id');for(var _0x214210=0x0,_0x40f2a5={},_0x36a1b4={};_0x214210<_0x45f296[_0x5239('0x43')];_0x214210+=0x1){_0x40f2a5=_0x45f296[_0x214210];if(_[_0x5239('0x46')](_0x48e487[_0x5239('0x1e')][_0x40f2a5['id']])){_0x48e487[_0x5239('0x1e')][_0x40f2a5['id']]=new FreshdeskAccount(_0x40f2a5);}else{_0x48e487[_0x5239('0x41')](_0x48e487['freshdeskAccounts'][_0x40f2a5['id']],_0x40f2a5);}}}return _0x48e487[_0x5239('0x1e')];};};Realtime[_0x5239('0x40')][_0x5239('0x4f')]=function(){var _0x2882ac=this;return function(_0x3f2923){if(_0x3f2923){freeIsNotKey(_0x3f2923,_0x2882ac['zohoAccounts'],'id');for(var _0x4428b4=0x0,_0x19d1fe={},_0xbc43b2={};_0x4428b4<_0x3f2923[_0x5239('0x43')];_0x4428b4+=0x1){_0x19d1fe=_0x3f2923[_0x4428b4];if(_[_0x5239('0x46')](_0x2882ac[_0x5239('0x1f')][_0x19d1fe['id']])){_0x2882ac['zohoAccounts'][_0x19d1fe['id']]=new ZohoAccount(_0x19d1fe);}else{_0x2882ac[_0x5239('0x41')](_0x2882ac['zohoAccounts'][_0x19d1fe['id']],_0x19d1fe);}}}return _0x2882ac[_0x5239('0x1f')];};};Realtime[_0x5239('0x40')]['initDeskAccounts']=function(){var _0x3a341c=this;return function(_0x4ec838){if(_0x4ec838){freeIsNotKey(_0x4ec838,_0x3a341c[_0x5239('0x20')],'id');for(var _0x286e2b=0x0,_0x22d169={},_0x1244f5={};_0x286e2b<_0x4ec838['length'];_0x286e2b+=0x1){_0x22d169=_0x4ec838[_0x286e2b];if(_[_0x5239('0x46')](_0x3a341c[_0x5239('0x20')][_0x22d169['id']])){_0x3a341c['deskAccounts'][_0x22d169['id']]=new DeskAccount(_0x22d169);}else{_0x3a341c[_0x5239('0x41')](_0x3a341c['deskAccounts'][_0x22d169['id']],_0x22d169);}}}return _0x3a341c[_0x5239('0x20')];};};Realtime[_0x5239('0x40')][_0x5239('0x50')]=function(){var _0x11bae2=this;return function(_0x522711){if(_0x522711){freeIsNotKey(_0x522711,_0x11bae2['sugarcrmAccounts'],'id');for(var _0x56db98=0x0,_0x519f7f={},_0x375e79={};_0x56db98<_0x522711[_0x5239('0x43')];_0x56db98+=0x1){_0x519f7f=_0x522711[_0x56db98];if(_[_0x5239('0x46')](_0x11bae2[_0x5239('0x1d')][_0x519f7f['id']])){_0x11bae2[_0x5239('0x1d')][_0x519f7f['id']]=new SugarcrmAccount(_0x519f7f);}else{_0x11bae2[_0x5239('0x41')](_0x11bae2[_0x5239('0x1d')][_0x519f7f['id']],_0x519f7f);}}}return _0x11bae2['sugarcrmAccounts'];};};Realtime[_0x5239('0x40')][_0x5239('0x51')]=function(){var _0xbb9664=this;return function(_0xc36099){if(_0xc36099){freeIsNotKey(_0xc36099,_0xbb9664[_0x5239('0x21')],'id');for(var _0x35a592=0x0,_0x4c6f45={},_0x1671dc={};_0x35a592<_0xc36099[_0x5239('0x43')];_0x35a592+=0x1){_0x4c6f45=_0xc36099[_0x35a592];if(_[_0x5239('0x46')](_0xbb9664[_0x5239('0x21')][_0x4c6f45['id']])){_0xbb9664[_0x5239('0x21')][_0x4c6f45['id']]=new VtigerAccount(_0x4c6f45);}else{_0xbb9664[_0x5239('0x41')](_0xbb9664[_0x5239('0x21')][_0x4c6f45['id']],_0x4c6f45);}}}return _0xbb9664[_0x5239('0x21')];};};Realtime[_0x5239('0x40')][_0x5239('0x52')]=function(){var _0x5e5563=this;return function(_0x3e774d){if(_0x3e774d){freeIsNotKey(_0x3e774d,_0x5e5563[_0x5239('0x22')],'id');for(var _0x2b1a49=0x0,_0x1fad0f={},_0x2b9660={};_0x2b1a49<_0x3e774d['length'];_0x2b1a49+=0x1){_0x1fad0f=_0x3e774d[_0x2b1a49];if(_[_0x5239('0x46')](_0x5e5563[_0x5239('0x22')][_0x1fad0f['id']])){_0x5e5563[_0x5239('0x22')][_0x1fad0f['id']]=new ServicenowAccount(_0x1fad0f);}else{_0x5e5563[_0x5239('0x41')](_0x5e5563['servicenowAccounts'][_0x1fad0f['id']],_0x1fad0f);}}}return _0x5e5563[_0x5239('0x22')];};};Realtime[_0x5239('0x40')][_0x5239('0x53')]=function(){var _0x5cc3a5=this;return function(_0x1167ac){if(_0x1167ac){freeIsNotKey(_0x1167ac,_0x5cc3a5[_0x5239('0x23')],'id');for(var _0x5c29b8=0x0,_0x538e72={},_0xcc5aa={};_0x5c29b8<_0x1167ac[_0x5239('0x43')];_0x5c29b8+=0x1){_0x538e72=_0x1167ac[_0x5c29b8];if(_[_0x5239('0x46')](_0x5cc3a5[_0x5239('0x23')][_0x538e72['id']])){_0x5cc3a5[_0x5239('0x23')][_0x538e72['id']]=new Dynamics365Account(_0x538e72);}else{_0x5cc3a5[_0x5239('0x41')](_0x5cc3a5['dynamics365Accounts'][_0x538e72['id']],_0x538e72);}}}return _0x5cc3a5[_0x5239('0x23')];};};Realtime[_0x5239('0x40')]['initFreshsalesAccounts']=function(){var _0x3bb7c0=this;return function(_0x48851c){if(_0x48851c){freeIsNotKey(_0x48851c,_0x3bb7c0[_0x5239('0x24')],'id');for(var _0x5a95b1=0x0,_0x5014e6={},_0x3dde59={};_0x5a95b1<_0x48851c[_0x5239('0x43')];_0x5a95b1+=0x1){_0x5014e6=_0x48851c[_0x5a95b1];if(_[_0x5239('0x46')](_0x3bb7c0[_0x5239('0x24')][_0x5014e6['id']])){_0x3bb7c0[_0x5239('0x24')][_0x5014e6['id']]=new FreshsalesAccount(_0x5014e6);}else{_0x3bb7c0[_0x5239('0x41')](_0x3bb7c0[_0x5239('0x24')][_0x5014e6['id']],_0x5014e6);}}}return _0x3bb7c0[_0x5239('0x24')];};};Realtime['prototype'][_0x5239('0x54')]=function(){var _0xa7b71a=this;return function(_0x239cc0){for(var _0x5a4564=0x0;_0x5a4564<_0x239cc0[_0x5239('0x43')];_0x5a4564+=0x1){_[_0x5239('0x55')](_0xa7b71a[_0x5239('0x49')][_0x239cc0[_0x5a4564]['name']],_0x239cc0[_0x5a4564]);}return _0xa7b71a[_0x5239('0x49')];};};Realtime[_0x5239('0x40')][_0x5239('0x56')]=function(){var _0xeea0f4=this;return function(_0x14c085){clearVoiceQueues(_0xeea0f4[_0x5239('0x49')]);if(_0x14c085){_0x14c085=_[_0x5239('0x57')](_0x14c085,_0x5239('0x58'));for(var _0x3f43d8 in _0x14c085){if(_0x14c085[_0x5239('0x26')](_0x3f43d8)){var _0x396cd4={};for(var _0x5ca2bd=0x0;_0x5ca2bd<_0x14c085[_0x3f43d8][_0x5239('0x43')];_0x5ca2bd+=0x1){var _0x5ae2bf=_0x14c085[_0x3f43d8][_0x5ca2bd][_0x5239('0x59')];if(_0xeea0f4['voiceQueues'][_0x5ae2bf]){if(_0x14c085[_0x3f43d8][_0x5ca2bd][_0x5239('0x5a')]){_0xeea0f4[_0x5239('0x49')][_0x5ae2bf][_0x5239('0x33')]+=0x1;}if(_0x14c085[_0x3f43d8][_0x5ca2bd][_0x5239('0x5b')]){_0xeea0f4[_0x5239('0x49')][_0x5ae2bf][_0x5239('0x34')]+=0x1;}_0xeea0f4[_0x5239('0x49')][_0x5ae2bf][_0x5239('0x2f')]+=moment(_0x14c085[_0x3f43d8][_0x5ca2bd][_0x5239('0x5c')])[_0x5239('0x5d')](moment(_0x14c085[_0x3f43d8][_0x5ca2bd][_0x5239('0x5e')]),_0x5239('0x5f'))||0x0;if(_0x5ca2bd===_0x14c085[_0x3f43d8][_0x5239('0x43')]-0x1){_0xeea0f4['voiceQueues'][_0x5ae2bf]['sumDuration']+=moment(_0x14c085[_0x3f43d8][_0x5ca2bd]['queuecallercompleteAt']||_0x14c085[_0x3f43d8][_0x5ca2bd][_0x5239('0x60')]||_0x14c085[_0x3f43d8][_0x5ca2bd][_0x5239('0x61')])[_0x5239('0x5d')](moment(_0x14c085[_0x3f43d8][_0x5ca2bd][_0x5239('0x5e')]),_0x5239('0x5f'))||0x0;_0xeea0f4['voiceQueues'][_0x5ae2bf]['total']+=0x1;if(_0x14c085[_0x3f43d8][_0x5ca2bd][_0x5239('0x62')]){_0xeea0f4[_0x5239('0x49')][_0x5ae2bf][_0x5239('0x2e')]+=0x1;_0xeea0f4[_0x5239('0x49')][_0x5ae2bf]['sumBillable']+=moment(_0x14c085[_0x3f43d8][_0x5ca2bd][_0x5239('0x63')])[_0x5239('0x5d')](moment(_0x14c085[_0x3f43d8][_0x5ca2bd]['queuecallerleaveAt']),_0x5239('0x5f'))||0x0;}}else{_0xeea0f4[_0x5239('0x49')][_0x5ae2bf][_0x5239('0x30')]+=_0xeea0f4[_0x5239('0x49')][_0x5ae2bf][_0x5239('0x2f')]||0x0;}}}}}}return _0xeea0f4[_0x5239('0x49')];};};Realtime['prototype'][_0x5239('0x64')]=function(){var _0x5ab8eb=this;return function(_0x30c2a3){clearVoiceCallReports(_0x5ab8eb[_0x5239('0x16')]);if(_0x30c2a3){for(var _0x190d50=0x0;_0x190d50<_0x30c2a3['length'];_0x190d50+=0x1){_0x5ab8eb['outbound'][_0x5239('0x2d')]+=0x1;_0x5ab8eb['outbound'][_0x5239('0x30')]+=_0x30c2a3[_0x190d50]['duration'];if(_0x30c2a3[_0x190d50][_0x5239('0x65')]===_0x5239('0x66')){_0x5ab8eb[_0x5239('0x16')][_0x5239('0x2e')]+=0x1;_0x5ab8eb[_0x5239('0x16')]['sumHoldTime']+=_0x30c2a3[_0x190d50][_0x5239('0x67')]-_0x30c2a3[_0x190d50][_0x5239('0x68')]||0x0;_0x5ab8eb[_0x5239('0x16')][_0x5239('0x35')]+=_0x30c2a3[_0x190d50][_0x5239('0x68')];}}}return _0x5ab8eb[_0x5239('0x16')];};};Realtime[_0x5239('0x40')][_0x5239('0x69')]=function(){var _0xe69d3a=this;return function(_0x2317cc){if(_0x2317cc){freeIsNotKey(_0x2317cc,_0xe69d3a[_0x5239('0x14')],'name');for(var _0x2abf6a=0x0,_0x342800={};_0x2abf6a<_0x2317cc[_0x5239('0x43')];_0x2abf6a+=0x1){_0x342800=_0x2317cc[_0x2abf6a];if(_[_0x5239('0x46')](_0xe69d3a[_0x5239('0x14')][_0x342800['name']])){_0xe69d3a[_0x5239('0x14')][_0x342800[_0x5239('0x2c')]]=new Campaign(_0x342800);}else{_0xe69d3a[_0x5239('0x41')](_0xe69d3a[_0x5239('0x14')][_0x342800[_0x5239('0x2c')]],_0x342800);}}}return _0xe69d3a[_0x5239('0x14')];};};Realtime[_0x5239('0x40')][_0x5239('0x6a')]=function(){var _0x221e45=this;return function(_0xd84b55){if(_0xd84b55){freeIsNotKey(_0xd84b55,_0x221e45['voiceExtensions'],'id');for(var _0x5a3edd=0x0,_0x29d151={};_0x5a3edd<_0xd84b55[_0x5239('0x43')];_0x5a3edd+=0x1){_0x29d151=_0xd84b55[_0x5a3edd];if(_[_0x5239('0x46')](_0x221e45[_0x5239('0x17')][_0x29d151['id']])){_0x221e45[_0x5239('0x17')][_0x29d151['id']]=new VoiceExtension(_0x29d151);}else{_0x221e45[_0x5239('0x41')](_0x221e45['voiceExtensions'][_0x29d151['id']],_0x29d151);}}}return _0x221e45['voiceExtensions'];};};Realtime[_0x5239('0x40')][_0x5239('0x6b')]=function(){var _0xad1042=this;return function(_0x123f90){clearCampaigns(_0xad1042[_0x5239('0x14')]);for(var _0x11be85=0x0;_0x11be85<_0x123f90[_0x5239('0x43')];_0x11be85+=0x1){_[_0x5239('0x55')](_0xad1042[_0x5239('0x14')][_0x123f90[_0x11be85][_0x5239('0x2c')]],_0x123f90[_0x11be85]);}return _0xad1042[_0x5239('0x14')];};};Realtime[_0x5239('0x40')][_0x5239('0x6c')]=function(){var _0x241c31=this;return function(_0x3a010d){if(_0x3a010d){freeIsNotKey(_0x3a010d,_0x241c31[_0x5239('0x25')],'id');for(var _0x3563b0=0x0,_0x47841e={},_0x43acd8={};_0x3563b0<_0x3a010d[_0x5239('0x43')];_0x3563b0+=0x1){_0x47841e=_0x3a010d[_0x3563b0];if(_[_0x5239('0x46')](_0x241c31[_0x5239('0x25')][_0x47841e['id']])){_0x241c31['faxAccounts'][_0x47841e['id']]=new FaxAccount(_0x47841e);}else{_0x241c31[_0x5239('0x41')](_0x241c31[_0x5239('0x25')][_0x47841e['id']],_0x47841e);}}}return _0x241c31[_0x5239('0x25')];};};module[_0x5239('0x6d')]=Realtime; \ No newline at end of file +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 diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index b8d8ab6..564002c 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 _0xcc00=['lastapplication','queue','lastdata','context','from-voip-provider','callerid','xcally-motion-preview','calleridpreview','calleridnum','channel','destinationchannel','originatecalleridnum','ANSWERED','\x22%s\x22\x20<%s>','calleridname','monitorFilename','monitors','filename','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','bluebird','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','isNil','accountcode','name','format','length','connectedlinenum','lastAssignedTo','interface','SIP/%s','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','destination','exten','type','dialer'];(function(_0x2a0674,_0x45b3f4){var _0x4de2a2=function(_0x4b1078){while(--_0x4b1078){_0x2a0674['push'](_0x2a0674['shift']());}};_0x4de2a2(++_0x45b3f4);}(_0xcc00,0x125));var _0x0cc0=function(_0x38ce4c,_0xfdbe8c){_0x38ce4c=_0x38ce4c-0x0;var _0x5d4544=_0xcc00[_0x38ce4c];return _0x5d4544;};'use strict';var BPromise=require(_0x0cc0('0x0'));var _=require(_0x0cc0('0x1'));var moment=require(_0x0cc0('0x2'));var util=require(_0x0cc0('0x3'));var config=require(_0x0cc0('0x4'));var logger=require(_0x0cc0('0x5'))(_0x0cc0('0x6'));var ami=require(_0x0cc0('0x7'));var RpcVoiceAgentReport=require(_0x0cc0('0x8'));var RpcVoiceCallReport=require(_0x0cc0('0x9'));var RpcVoiceDialReport=require(_0x0cc0('0xa'));var RpcMemberReport=require(_0x0cc0('0xb'));var RpcVoiceQueueReport=require(_0x0cc0('0xc'));var RpcVoiceRecording=require(_0x0cc0('0xd'));var RpcVoiceTransferReport=require(_0x0cc0('0xe'));var VoiceQueueReport=require(_0x0cc0('0xf'));var VoiceCallReport=require(_0x0cc0('0x10'));var VoiceAgentReport=require(_0x0cc0('0x11'));var VoiceDialReport=require(_0x0cc0('0x12'));var UserReport=require(_0x0cc0('0x13'));function Report(_0x384d4){this[_0x0cc0('0x14')]=_0x384d4;this[_0x0cc0('0x15')]=_0x384d4[_0x0cc0('0x15')];this[_0x0cc0('0x16')]=_0x384d4[_0x0cc0('0x16')];}Report[_0x0cc0('0x17')][_0x0cc0('0x18')]=function(_0x2e6d9e){var _0x410a7c=new VoiceQueueReport(this[_0x0cc0('0x14')]);var _0xef9e6f=new VoiceAgentReport(this[_0x0cc0('0x14')]);var _0x4b2907=new VoiceDialReport(this[_0x0cc0('0x14')]);var _0x17952e=new VoiceCallReport(this[_0x0cc0('0x14')]);var _0x3629f9=new UserReport(this['realtime']);if(config[_0x0cc0('0x19')]&&config[_0x0cc0('0x19')][_0x0cc0('0x1a')]){ami['on']('custom:voiceQueueReport',this[_0x0cc0('0x1b')][_0x0cc0('0x1c')](this));ami['on'](_0x0cc0('0x1d'),this['voiceCallReport'][_0x0cc0('0x1c')](this));ami['on'](_0x0cc0('0x1e'),this[_0x0cc0('0x1f')][_0x0cc0('0x1c')](this));ami['on'](_0x0cc0('0x20'),this[_0x0cc0('0x21')][_0x0cc0('0x1c')](this));ami['on'](_0x0cc0('0x22'),this[_0x0cc0('0x23')][_0x0cc0('0x1c')](this));ami['on'](_0x0cc0('0x24'),this[_0x0cc0('0x25')][_0x0cc0('0x1c')](this));}};Report['prototype'][_0x0cc0('0x26')]=function(_0x237737){var _0x311529=undefined;_0x311529=_[_0x0cc0('0x27')](this[_0x0cc0('0x15')],function(_0x519902){return _0x519902['accountcode']==_0x237737||_0x519902['name']==_0x237737;});if(_[_0x0cc0('0x28')](_0x311529)){var _0x1d0fef=_['find'](this[_0x0cc0('0x16')],function(_0x2c4894){return _0x2c4894[_0x0cc0('0x29')]==_0x237737||_0x2c4894[_0x0cc0('0x2a')]==_0x237737;});if(_0x1d0fef){_0x311529=_[_0x0cc0('0x27')](this[_0x0cc0('0x15')],function(_0x92ad08){return _0x92ad08['interface']==util[_0x0cc0('0x2b')]('SIP/%s',_0x1d0fef[_0x0cc0('0x2a')]);});}}return _0x311529;};Report[_0x0cc0('0x17')]['voiceQueueReport']=function(_0x267128){for(var _0x14f6cc=0x0;_0x14f6cc<_0x267128[_0x0cc0('0x2c')];_0x14f6cc+=0x1){var _0x219ac9=this[_0x0cc0('0x26')](_0x267128[_0x14f6cc][_0x0cc0('0x2d')]);if(_0x219ac9){_0x267128[_0x14f6cc][_0x0cc0('0x29')]=_0x219ac9[_0x0cc0('0x29')];_0x267128[_0x14f6cc]['assigned']=!![];_0x267128[_0x14f6cc][_0x0cc0('0x2e')]=_0x219ac9[_0x0cc0('0x2a')];_0x267128[_0x14f6cc][_0x0cc0('0x2f')]=_[_0x0cc0('0x28')](_0x219ac9['interface'])?util[_0x0cc0('0x2b')](_0x0cc0('0x30'),_0x219ac9[_0x0cc0('0x2a')]):_0x219ac9[_0x0cc0('0x2f')];if(_0x267128[_0x14f6cc][_0x0cc0('0x31')]){_0x267128[_0x14f6cc][_0x0cc0('0x32')]=moment()[_0x0cc0('0x2b')](_0x0cc0('0x33'));}if(_0x267128[_0x14f6cc][_0x0cc0('0x34')]){_0x267128[_0x14f6cc][_0x0cc0('0x35')]=moment()[_0x0cc0('0x2b')](_0x0cc0('0x33'));}RpcMemberReport[_0x0cc0('0x1b')](_0x267128[_0x14f6cc]);}RpcVoiceQueueReport[_0x0cc0('0x36')](_0x267128[_0x14f6cc]);}};function extractCalleridNumber(_0x2ac5c2){var _0x1f1d7d=_0x2ac5c2['match'](/<(.*?)>/);return _0x1f1d7d?_0x1f1d7d[0x1]:_0x2ac5c2;}Report[_0x0cc0('0x17')]['voiceCallReport']=function(_0x5663c6){_0x5663c6[_0x0cc0('0x37')]=_0x5663c6[_0x0cc0('0x37')]||_0x5663c6[_0x0cc0('0x38')];if(_0x5663c6[_0x0cc0('0x39')]==_0x0cc0('0x3a')){_0x5663c6[_0x0cc0('0x3b')]=_0x0cc0('0x3c');_0x5663c6[_0x0cc0('0x3d')]=_0x5663c6['queue'];if(_0x5663c6[_0x0cc0('0x3e')]==_0x0cc0('0x3f')){_0x5663c6['accountcode']='';_0x5663c6[_0x0cc0('0x37')]=extractCalleridNumber(_0x5663c6[_0x0cc0('0x40')]);}else if(_0x5663c6[_0x0cc0('0x3e')]=='from-sip'){if(_0x5663c6['destination']==_0x0cc0('0x41')){_0x5663c6[_0x0cc0('0x37')]=extractCalleridNumber(_0x5663c6[_0x0cc0('0x42')]);_0x5663c6[_0x0cc0('0x43')]=_0x5663c6['originatecalleridnum'];_0x5663c6['destinationchannel']=[_0x5663c6[_0x0cc0('0x44')],_0x5663c6[_0x0cc0('0x44')]=_0x5663c6[_0x0cc0('0x45')]][0x0];_0x5663c6[_0x0cc0('0x40')]=_0x5663c6['calleridpreview'];}else{_0x5663c6[_0x0cc0('0x37')]=_0x5663c6[_0x0cc0('0x43')];_0x5663c6[_0x0cc0('0x43')]=_0x5663c6[_0x0cc0('0x46')];if(_0x5663c6['disposition']==_0x0cc0('0x47')){_0x5663c6['accountcode']=_0x5663c6['connectedlinenum'];}else{_0x5663c6[_0x0cc0('0x29')]='';}}}}else{_0x5663c6[_0x0cc0('0x40')]=util[_0x0cc0('0x2b')](_0x0cc0('0x48'),_0x5663c6[_0x0cc0('0x49')],_0x5663c6[_0x0cc0('0x43')]);}RpcVoiceCallReport[_0x0cc0('0x36')](_0x5663c6);if(_0x5663c6['monitor']){for(var _0x40aa1f=0x0;_0x40aa1f<_0x5663c6['monitors'][_0x0cc0('0x2c')];_0x40aa1f+=0x1){_0x5663c6[_0x0cc0('0x4a')]=_0x5663c6[_0x0cc0('0x4b')][_0x40aa1f][_0x0cc0('0x4c')];_0x5663c6[_0x0cc0('0x4d')]=_0x5663c6['monitors'][_0x40aa1f][_0x0cc0('0x4d')];if(_0x5663c6[_0x0cc0('0x38')]==_0x0cc0('0x41')){_0x5663c6['calleridnum']=_0x5663c6[_0x0cc0('0x2d')];_0x5663c6['calleridname']=_0x5663c6['connectedlinename'];_0x5663c6['connectedlinenum']=_0x5663c6[_0x0cc0('0x29')];_0x5663c6[_0x0cc0('0x4e')]=_0x5663c6['membername'];_0x5663c6[_0x0cc0('0x38')]=_0x5663c6['originatecalleridnum'];}else if(_0x5663c6[_0x0cc0('0x38')]==_0x0cc0('0x4f')){_0x5663c6['calleridnum']=_0x5663c6['destination'];_0x5663c6['exten']=_0x5663c6[_0x0cc0('0x46')];}RpcVoiceRecording[_0x0cc0('0x36')](_0x5663c6);}}};Report[_0x0cc0('0x17')][_0x0cc0('0x1f')]=function(_0x3a2c30){if(_[_0x0cc0('0x50')](_0x3a2c30)){_0x3a2c30[_0x0cc0('0x51')](function(_0x430c7){RpcVoiceAgentReport[_0x0cc0('0x36')](_0x430c7);});}else{RpcVoiceAgentReport[_0x0cc0('0x36')](_0x3a2c30);}};Report[_0x0cc0('0x17')][_0x0cc0('0x21')]=function(_0x338a02){RpcVoiceDialReport['create'](_0x338a02);var _0x4af120=undefined;var _0x17b123=_0x338a02[_0x0cc0('0x44')];if(_[_0x0cc0('0x52')](_0x17b123,_0x0cc0('0x53'))){var _0x9f54c8=_0x17b123[_0x0cc0('0x54')](_0x17b123[_0x0cc0('0x55')]('/')+0x1,_0x17b123['indexOf']('@'));_0x4af120=_[_0x0cc0('0x27')](this[_0x0cc0('0x15')],function(_0x510b55){return _0x510b55[_0x0cc0('0x56')]==_0x9f54c8||_0x510b55[_0x0cc0('0x57')]==_0x9f54c8||_0x510b55[_0x0cc0('0x29')]==_0x9f54c8;});}else{var _0x9f54c8=_0x17b123[_0x0cc0('0x54')](_0x17b123[_0x0cc0('0x55')]('/')+0x1,_0x17b123['lastIndexOf']('-'));_0x4af120=this[_0x0cc0('0x26')](_0x9f54c8);}if(_0x4af120){_0x338a02[_0x0cc0('0x2f')]=_[_0x0cc0('0x28')](_0x4af120[_0x0cc0('0x2f')])?util[_0x0cc0('0x2b')](_0x0cc0('0x30'),_0x4af120[_0x0cc0('0x2a')]):_0x4af120[_0x0cc0('0x2f')];_0x338a02['membername']=_0x4af120[_0x0cc0('0x2a')];_0x338a02[_0x0cc0('0x29')]=_0x4af120[_0x0cc0('0x29')];RpcMemberReport[_0x0cc0('0x21')](_0x338a02);}};Report[_0x0cc0('0x17')][_0x0cc0('0x23')]=function(_0x22709f){RpcVoiceTransferReport[_0x0cc0('0x23')](_0x22709f);};Report[_0x0cc0('0x17')][_0x0cc0('0x25')]=function(_0x8e40b3){RpcVoiceTransferReport[_0x0cc0('0x25')](_0x8e40b3);};module['exports']=Report; \ No newline at end of file +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 diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 4ba77c7..566b111 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 _0x5730=['[syncRegistry][UserReport]','inspect','device','toLowerCase','stateTime','toNumber','updateStatusRealtime','telephone:%s','startsWith','substring','indexOf','mobile','phone','accountcode','local','[syncDeviceState][UserReport]','syncPeerStatus','peer','registered','status','address','telephone:save','trunk:save','[syncPeerStatus][UserReport]','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','loopSyncRealTimeShow','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','error','prototype','actionSipPeerStatus','[loopSyncRealTimeShow]','isNotNull','isUndefined','emit','find','username','stateRegistry','state','merge','omit','event','format','trunk:%s','name'];(function(_0x308e10,_0x23866a){var _0x3f39e0=function(_0x407062){while(--_0x407062){_0x308e10['push'](_0x308e10['shift']());}};_0x3f39e0(++_0x23866a);}(_0x5730,0xa2));var _0x0573=function(_0x35b87b,_0x1a05aa){_0x35b87b=_0x35b87b-0x0;var _0x2b25a0=_0x5730[_0x35b87b];return _0x2b25a0;};'use strict';var _=require(_0x0573('0x0'));var moment=require(_0x0573('0x1'));var BPromise=require('bluebird');var util=require(_0x0573('0x2'));var Redis=require(_0x0573('0x3'));var config=require(_0x0573('0x4'));var logger=require(_0x0573('0x5'))(_0x0573('0x6'));var ami=require(_0x0573('0x7'));config[_0x0573('0x8')]=_[_0x0573('0x9')](config[_0x0573('0x8')],{'host':_0x0573('0xa'),'port':0x18eb});var io=require(_0x0573('0xb'))(new Redis(config['redis']));function UserReport(_0x3239af){this[_0x0573('0xc')]=_0x3239af[_0x0573('0xc')];this[_0x0573('0xd')]=_0x3239af[_0x0573('0xd')];this[_0x0573('0xe')]=_0x3239af[_0x0573('0xe')];ami['on'](_0x0573('0xf'),this[_0x0573('0x10')][_0x0573('0x11')](this));ami['on'](_0x0573('0x12'),this[_0x0573('0x10')][_0x0573('0x11')](this));ami['on'](_0x0573('0x13'),this[_0x0573('0x14')][_0x0573('0x11')](this));ami['on'](_0x0573('0x15'),this['syncPeerStatus'][_0x0573('0x11')](this));this[_0x0573('0x16')]();return BPromise[_0x0573('0x17')]()[_0x0573('0x18')](ami[_0x0573('0x19')]())[_0x0573('0x18')](ami[_0x0573('0x1a')]())[_0x0573('0x18')](ami['actionSipPeerStatus']())[_0x0573('0x1b')](loggerCatch('[loopSyncRealTimeShow]'));}function loggerCatch(_0x497139){return function(_0x398c04){logger[_0x0573('0x1c')](_0x497139,util['inspect'](_0x398c04,{'showHidden':![],'depth':null}));};}UserReport[_0x0573('0x1d')][_0x0573('0x16')]=function(){setInterval(function(){BPromise['resolve']()[_0x0573('0x18')](ami[_0x0573('0x19')]())[_0x0573('0x18')](ami[_0x0573('0x1a')]())[_0x0573('0x18')](ami[_0x0573('0x1e')]())[_0x0573('0x1b')](loggerCatch(_0x0573('0x1f')));},0x32c8);};UserReport[_0x0573('0x1d')][_0x0573('0x20')]=function(_0x11444c){return _0x11444c!==null&&!_[_0x0573('0x21')](_0x11444c);};UserReport[_0x0573('0x1d')][_0x0573('0x22')]=function(_0x594822,_0x2cefdd,_0x4f46e1){io['to'](_0x594822)[_0x0573('0x22')](_0x2cefdd,_0x4f46e1);};UserReport[_0x0573('0x1d')][_0x0573('0x10')]=function(_0x560597){try{if(this['isNotNull'](_0x560597)){var _0xc0ac4e=_[_0x0573('0x23')](this[_0x0573('0xc')],{'registry':_0x560597[_0x0573('0x24')]});if(_0xc0ac4e){_0x560597[_0x0573('0x25')]=_0x560597[_0x0573('0x26')];_[_0x0573('0x27')](_0xc0ac4e,_[_0x0573('0x28')](_0x560597,[_0x0573('0x29'),'actionid',_0x0573('0x24'),_0x0573('0x26')]));this[_0x0573('0x22')](util[_0x0573('0x2a')](_0x0573('0x2b'),_0xc0ac4e[_0x0573('0x2c')]),'trunk:save',_0xc0ac4e);}}}catch(_0x30172b){logger['error'](_0x0573('0x2d'),util[_0x0573('0x2e')](_0x30172b,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncDeviceState']=function(_0x275fca){try{if(this['isNotNull'](_0x275fca)){if(this['agents'][_0x275fca[_0x0573('0x2f')]]){if(!this[_0x0573('0xd')][_0x275fca[_0x0573('0x2f')]]['local']||_0x275fca[_0x0573('0x26')][_0x0573('0x30')]()=='inuse'){this[_0x0573('0xd')][_0x275fca['device']]['local']=![];if(this[_0x0573('0xd')][_0x275fca[_0x0573('0x2f')]][_0x0573('0x26')]!==_0x275fca[_0x0573('0x26')]['toLowerCase']()){this[_0x0573('0xd')][_0x275fca['device']][_0x0573('0x31')]=_[_0x0573('0x32')](moment()[_0x0573('0x2a')]('x'));}this[_0x0573('0xd')][_0x275fca[_0x0573('0x2f')]][_0x0573('0x26')]=_0x275fca['state']['toLowerCase']();this[_0x0573('0xd')][_0x275fca[_0x0573('0x2f')]][_0x0573('0x33')](_0x275fca);}}else if(this['telephones'][_0x275fca['device']]){if(this[_0x0573('0xe')][_0x275fca[_0x0573('0x2f')]][_0x0573('0x26')]!==_0x275fca['state'][_0x0573('0x30')]()){this[_0x0573('0xe')][_0x275fca[_0x0573('0x2f')]][_0x0573('0x31')]=_[_0x0573('0x32')](moment()[_0x0573('0x2a')]('x'));}this[_0x0573('0xe')][_0x275fca[_0x0573('0x2f')]][_0x0573('0x26')]=_0x275fca['state']['toLowerCase']();this[_0x0573('0x22')](util[_0x0573('0x2a')](_0x0573('0x34'),this[_0x0573('0xe')][_0x275fca['device']]['name']),'telephone:save',this['telephones'][_0x275fca[_0x0573('0x2f')]]);}else if(this[_0x0573('0xc')][_0x275fca['device']]){if(this[_0x0573('0xc')][_0x275fca[_0x0573('0x2f')]]['state']!==_0x275fca[_0x0573('0x26')][_0x0573('0x30')]()){this[_0x0573('0xc')][_0x275fca[_0x0573('0x2f')]][_0x0573('0x31')]=_[_0x0573('0x32')](moment()[_0x0573('0x2a')]('x'));}this['trunks'][_0x275fca[_0x0573('0x2f')]][_0x0573('0x26')]=_0x275fca[_0x0573('0x26')][_0x0573('0x30')]();this[_0x0573('0x22')](util['format'](_0x0573('0x2b'),this[_0x0573('0xc')][_0x275fca['device']][_0x0573('0x2c')]),'trunk:save',this[_0x0573('0xc')][_0x275fca[_0x0573('0x2f')]]);}else if(_[_0x0573('0x35')](_0x275fca[_0x0573('0x2f')],'Queue')){}else if(_[_0x0573('0x35')](_0x275fca[_0x0573('0x2f')],'Local')){var _0x5e2dd3=_0x275fca['device'];var _0x363e90=_0x5e2dd3[_0x0573('0x36')](_0x5e2dd3[_0x0573('0x37')]('/')+0x1,_0x5e2dd3[_0x0573('0x37')]('@'));var _0x4c635a=_['find'](this[_0x0573('0xd')],function(_0xc2b9ab){return _0xc2b9ab[_0x0573('0x38')]==_0x363e90||_0xc2b9ab[_0x0573('0x39')]==_0x363e90||_0xc2b9ab[_0x0573('0x3a')]==_0x363e90;});if(_0x4c635a){if(_0x4c635a[_0x0573('0x26')]!==_0x275fca[_0x0573('0x26')]['toLowerCase']()){_0x4c635a[_0x0573('0x31')]=_[_0x0573('0x32')](moment()[_0x0573('0x2a')]('x'));}_0x4c635a[_0x0573('0x26')]=_0x275fca[_0x0573('0x26')][_0x0573('0x30')]();_0x4c635a[_0x0573('0x3b')]=!![];_0x4c635a[_0x0573('0x33')](_0x275fca);}}else{}}}catch(_0x11bfad){logger['error'](_0x0573('0x3c'),util[_0x0573('0x2e')](_0x11bfad,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x0573('0x3d')]=function(_0x1c2146){try{if(this[_0x0573('0x20')](_0x1c2146)&&this[_0x0573('0x20')](_0x1c2146[_0x0573('0x15')])){if(this['agents'][_0x1c2146['peer']]){if(!this[_0x0573('0xd')][_0x1c2146[_0x0573('0x3e')]][_0x0573('0x3b')]||_0x1c2146[_0x0573('0x15')][_0x0573('0x30')]()==_0x0573('0x3f')){this['agents'][_0x1c2146[_0x0573('0x3e')]]['local']=![];this[_0x0573('0xd')][_0x1c2146[_0x0573('0x3e')]][_0x0573('0x40')]=_0x1c2146[_0x0573('0x15')][_0x0573('0x30')]();this['agents'][_0x1c2146['peer']][_0x0573('0x41')]=_0x1c2146[_0x0573('0x41')];this[_0x0573('0xd')][_0x1c2146[_0x0573('0x3e')]]['updateStatusRealtime'](_0x1c2146);}}else if(this[_0x0573('0xe')][_0x1c2146[_0x0573('0x3e')]]){this[_0x0573('0xe')][_0x1c2146['peer']][_0x0573('0x40')]=_0x1c2146[_0x0573('0x15')]['toLowerCase']();this[_0x0573('0xe')][_0x1c2146[_0x0573('0x3e')]][_0x0573('0x41')]=_0x1c2146[_0x0573('0x41')];this[_0x0573('0x22')](util[_0x0573('0x2a')]('telephone:%s',this[_0x0573('0xe')][_0x1c2146[_0x0573('0x3e')]]['name']),_0x0573('0x42'),this[_0x0573('0xe')][_0x1c2146[_0x0573('0x3e')]]);}else if(this[_0x0573('0xc')][_0x1c2146[_0x0573('0x3e')]]){this[_0x0573('0xc')][_0x1c2146[_0x0573('0x3e')]][_0x0573('0x40')]=_0x1c2146[_0x0573('0x15')][_0x0573('0x30')]();this[_0x0573('0xc')][_0x1c2146[_0x0573('0x3e')]][_0x0573('0x41')]=_0x1c2146[_0x0573('0x41')];this['emit'](util[_0x0573('0x2a')]('trunk:%s',this['trunks'][_0x1c2146[_0x0573('0x3e')]][_0x0573('0x2c')]),_0x0573('0x43'),this['trunks'][_0x1c2146[_0x0573('0x3e')]]);}else{}}}catch(_0x4fe478){logger[_0x0573('0x1c')](_0x0573('0x44'),util[_0x0573('0x2e')](_0x4fe478,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file +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 diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index cd2246a..7763402 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 _0x53b5=['rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','isNil','custom:voiceAgentReport','values','[syncHangup][VoiceAgentReport]','transfereeuniqueid','seconds','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','[syncBlindTransfer][VoiceAgentReport]','substring','channel','lastIndexOf','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','[syncMusicOnHoldStop][VoiceAgentReport]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','channels','voiceQueues','agents','syncAgentCalled','bind','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','uniqueid','isUndefined','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','variables','queue','type','inbound','omit','privilege','custom:agentcalled','user:called','error','[syncAgentCalled][VoiceAgentReport]','inspect','hasOwnProperty','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','merge','interface','membername','user:agentconnect','custom:agentconnect','agentcomplete','answered_elsewhere','answeredelsewheredestinationuniqueid','[syncAgentConnect][VoiceAgentReport]','reason','rejected','custom:agentringnoanswer','agentringnoanswerAt','abandoned','custom:agentqueuecallerabandon','[syncQueueCallerAbandon][VoiceAgentReport]','agentconnectAt','agentcompleteAt','complete','talktime','transfer','agent','acw','acwtime','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','isNotNull','addVariable','value','[syncVarSet][VoiceAgentReport]'];(function(_0x154940,_0x4a448a){var _0x401409=function(_0x45cdcf){while(--_0x45cdcf){_0x154940['push'](_0x154940['shift']());}};_0x401409(++_0x4a448a);}(_0x53b5,0x98));var _0x553b=function(_0x49a115,_0x4b1c24){_0x49a115=_0x49a115-0x0;var _0x2d2d67=_0x53b5[_0x49a115];return _0x2d2d67;};'use strict';var _=require(_0x553b('0x0'));var moment=require(_0x553b('0x1'));var util=require(_0x553b('0x2'));var Redis=require(_0x553b('0x3'));var config=require(_0x553b('0x4'));var logger=require(_0x553b('0x5'))(_0x553b('0x6'));var ami=require(_0x553b('0x7'));config[_0x553b('0x8')]=_[_0x553b('0x9')](config[_0x553b('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x553b('0xa'))(new Redis(config[_0x553b('0x8')]));function VoiceAgentReport(_0x162e26){this[_0x553b('0xb')]={};this[_0x553b('0xc')]=_0x162e26[_0x553b('0xc')];this['agents']=_0x162e26[_0x553b('0xd')];this['variables']={};ami['on']('agentcalled',this[_0x553b('0xe')][_0x553b('0xf')](this));ami['on']('agentconnect',this[_0x553b('0x10')]['bind'](this));ami['on'](_0x553b('0x11'),this[_0x553b('0x12')][_0x553b('0xf')](this));ami['on'](_0x553b('0x13'),this[_0x553b('0x14')]['bind'](this));ami['on']('agentcomplete',this[_0x553b('0x15')][_0x553b('0xf')](this));ami['on'](_0x553b('0x16'),this[_0x553b('0x17')][_0x553b('0xf')](this));ami['on'](_0x553b('0x18'),this[_0x553b('0x19')]['bind'](this));ami['on']('musiconholdstart',this[_0x553b('0x1a')][_0x553b('0xf')](this));ami['on'](_0x553b('0x1b'),this[_0x553b('0x1c')][_0x553b('0xf')](this));ami['on'](_0x553b('0x1d'),this[_0x553b('0x1e')][_0x553b('0xf')](this));ami['on'](_0x553b('0x1f'),this[_0x553b('0x20')]['bind'](this));}VoiceAgentReport[_0x553b('0x21')][_0x553b('0x22')]=function(_0x4bcd13,_0x3c3562,_0x1c106c){io['to'](_0x4bcd13)['emit'](_0x3c3562,_0x1c106c);};VoiceAgentReport[_0x553b('0x21')]['isNotNull']=function(_0x3f4025){return _0x3f4025!==null&&!_['isUndefined'](_0x3f4025);};VoiceAgentReport[_0x553b('0x21')][_0x553b('0xe')]=function(_0x2c6bda){try{if(this['isNotNull'](_0x2c6bda)){if(_['isUndefined'](this[_0x553b('0xb')][_0x2c6bda[_0x553b('0x23')]])){this[_0x553b('0xb')][_0x2c6bda['uniqueid']]={};}if(_[_0x553b('0x24')](this['channels'][_0x2c6bda[_0x553b('0x23')]][_0x2c6bda[_0x553b('0x25')]])){this['channels'][_0x2c6bda[_0x553b('0x23')]][_0x2c6bda[_0x553b('0x25')]]={'agentcalledAt':moment()[_0x553b('0x26')](_0x553b('0x27')),'lastevent':_0x553b('0x28'),'variables':this[_0x553b('0x29')][_0x2c6bda[_0x553b('0x23')]],'type':this[_0x553b('0xc')][_0x2c6bda[_0x553b('0x2a')]]?this['voiceQueues'][_0x2c6bda['queue']][_0x553b('0x2b')]||_0x553b('0x2c'):_0x553b('0x2c')};}_['merge'](this[_0x553b('0xb')][_0x2c6bda[_0x553b('0x23')]][_0x2c6bda[_0x553b('0x25')]],_[_0x553b('0x2d')](_0x2c6bda,['event',_0x553b('0x2e')]));ami[_0x553b('0x22')](_0x553b('0x2f'),this[_0x553b('0xb')][_0x2c6bda[_0x553b('0x23')]][_0x2c6bda[_0x553b('0x25')]]);this[_0x553b('0x22')](util[_0x553b('0x26')]('user:%s',_0x2c6bda['membername']),_0x553b('0x30'),this[_0x553b('0xb')][_0x2c6bda[_0x553b('0x23')]][_0x2c6bda[_0x553b('0x25')]]);}}catch(_0x55f0a0){logger[_0x553b('0x31')](_0x553b('0x32'),util[_0x553b('0x33')](_0x55f0a0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x553b('0x21')]['syncAgentConnect']=function(_0x22e1a7){try{if(this['isNotNull'](_0x22e1a7)){if(this[_0x553b('0xb')][_0x22e1a7[_0x553b('0x23')]]){for(var _0x1b8be2 in this[_0x553b('0xb')][_0x22e1a7[_0x553b('0x23')]]){if(this[_0x553b('0xb')][_0x22e1a7[_0x553b('0x23')]][_0x553b('0x34')](_0x1b8be2)){if(_0x22e1a7['destuniqueid']===_0x1b8be2){this['channels'][_0x22e1a7[_0x553b('0x23')]][_0x1b8be2]['agentconnectAt']=moment()[_0x553b('0x26')](_0x553b('0x27'));this['channels'][_0x22e1a7[_0x553b('0x23')]][_0x1b8be2][_0x553b('0x35')]=_0x553b('0x36');this[_0x553b('0xb')][_0x22e1a7[_0x553b('0x23')]][_0x1b8be2][_0x553b('0x37')]=_0x22e1a7[_0x553b('0x37')];this[_0x553b('0xb')][_0x22e1a7[_0x553b('0x23')]][_0x1b8be2]['connectedlinenum']=_0x22e1a7[_0x553b('0x38')];this[_0x553b('0xb')][_0x22e1a7['uniqueid']][_0x1b8be2][_0x553b('0x39')]=_0x22e1a7[_0x553b('0x39')];this[_0x553b('0xb')][_0x22e1a7[_0x553b('0x23')]][_0x1b8be2][_0x553b('0x3a')]=_0x22e1a7[_0x553b('0x3a')];this[_0x553b('0xb')][_0x22e1a7[_0x553b('0x23')]][_0x1b8be2][_0x553b('0x3b')]=_0x22e1a7['destchannelstatedesc'];_[_0x553b('0x3c')](this[_0x553b('0xd')][_0x22e1a7[_0x553b('0x3d')]],_['pick'](_0x22e1a7,[_0x553b('0x2a'),'destconnectedlinenum']));this['emit'](util[_0x553b('0x26')]('user:%s',_0x22e1a7[_0x553b('0x3e')]),_0x553b('0x3f'),this[_0x553b('0xb')][_0x22e1a7['uniqueid']][_0x22e1a7['destuniqueid']]);ami[_0x553b('0x22')](_0x553b('0x40'),this['channels'][_0x22e1a7[_0x553b('0x23')]][_0x1b8be2]);}else if(!this[_0x553b('0xb')][_0x22e1a7['uniqueid']][_0x1b8be2]['agentringnoanswer']&&!this[_0x553b('0xb')][_0x22e1a7['uniqueid']][_0x1b8be2][_0x553b('0x41')]){this[_0x553b('0xb')][_0x22e1a7[_0x553b('0x23')]][_0x1b8be2][_0x553b('0x11')]=!![];this[_0x553b('0xb')][_0x22e1a7['uniqueid']][_0x1b8be2]['agentringnoanswerAt']=moment()[_0x553b('0x26')](_0x553b('0x27'));this[_0x553b('0xb')][_0x22e1a7[_0x553b('0x23')]][_0x1b8be2]['reason']=_0x553b('0x42');this['channels'][_0x22e1a7[_0x553b('0x23')]][_0x1b8be2][_0x553b('0x35')]='answered_elsewhere';this[_0x553b('0xb')][_0x22e1a7[_0x553b('0x23')]][_0x1b8be2][_0x553b('0x43')]=_0x22e1a7[_0x553b('0x25')];this[_0x553b('0xb')][_0x22e1a7[_0x553b('0x23')]][_0x1b8be2]['answeredelsewheremembername']=_0x22e1a7[_0x553b('0x3e')];ami[_0x553b('0x22')]('custom:agentansweredelsewhere',this[_0x553b('0xb')][_0x22e1a7[_0x553b('0x23')]][_0x1b8be2]);}}}}}}catch(_0x5bcfb7){logger[_0x553b('0x31')](_0x553b('0x44'),util['inspect'](_0x5bcfb7,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x553b('0x21')][_0x553b('0x12')]=function(_0x4f6133){try{if(this['isNotNull'](_0x4f6133)){if(this[_0x553b('0xb')][_0x4f6133[_0x553b('0x23')]]&&this[_0x553b('0xb')][_0x4f6133[_0x553b('0x23')]][_0x4f6133[_0x553b('0x25')]]){this[_0x553b('0xb')][_0x4f6133['uniqueid']][_0x4f6133[_0x553b('0x25')]][_0x553b('0x11')]=!![];this[_0x553b('0xb')][_0x4f6133[_0x553b('0x23')]][_0x4f6133[_0x553b('0x25')]]['agentringnoanswerAt']=moment()[_0x553b('0x26')](_0x553b('0x27'));this[_0x553b('0xb')][_0x4f6133[_0x553b('0x23')]][_0x4f6133['destuniqueid']][_0x553b('0x45')]='rejected';this[_0x553b('0xb')][_0x4f6133[_0x553b('0x23')]][_0x4f6133[_0x553b('0x25')]][_0x553b('0x35')]=_0x553b('0x46');ami[_0x553b('0x22')](_0x553b('0x47'),this[_0x553b('0xb')][_0x4f6133[_0x553b('0x23')]][_0x4f6133['destuniqueid']]);}}}catch(_0x814db2){logger[_0x553b('0x31')]('[syncAgentRingNoAnswer][VoiceAgentReport]',util['inspect'](_0x814db2,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x553b('0x14')]=function(_0x152c21){try{if(this['isNotNull'](_0x152c21)){if(this[_0x553b('0xb')][_0x152c21[_0x553b('0x23')]]){for(var _0x38a40a in this['channels'][_0x152c21['uniqueid']]){if(this[_0x553b('0xb')][_0x152c21[_0x553b('0x23')]][_0x553b('0x34')](_0x38a40a)&&!this[_0x553b('0xb')][_0x152c21[_0x553b('0x23')]][_0x38a40a][_0x553b('0x11')]&&!this[_0x553b('0xb')][_0x152c21[_0x553b('0x23')]][_0x38a40a][_0x553b('0x41')]){this[_0x553b('0xb')][_0x152c21['uniqueid']][_0x38a40a][_0x553b('0x11')]=!![];this[_0x553b('0xb')][_0x152c21['uniqueid']][_0x38a40a][_0x553b('0x48')]=moment()[_0x553b('0x26')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x553b('0xb')][_0x152c21[_0x553b('0x23')]][_0x38a40a][_0x553b('0x45')]=_0x553b('0x49');this[_0x553b('0xb')][_0x152c21[_0x553b('0x23')]][_0x38a40a][_0x553b('0x35')]=_0x553b('0x49');ami[_0x553b('0x22')](_0x553b('0x4a'),this['channels'][_0x152c21[_0x553b('0x23')]][_0x38a40a]);}}}}}catch(_0x1e0149){logger[_0x553b('0x31')](_0x553b('0x4b'),util[_0x553b('0x33')](_0x1e0149,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentComplete']=function(_0x47b5b0){try{if(this['isNotNull'](_0x47b5b0)){if(this['channels'][_0x47b5b0[_0x553b('0x23')]]){for(var _0x4c8974 in this[_0x553b('0xb')][_0x47b5b0[_0x553b('0x23')]]){if(this[_0x553b('0xb')][_0x47b5b0[_0x553b('0x23')]]['hasOwnProperty'](_0x4c8974)){if(this[_0x553b('0xb')][_0x47b5b0[_0x553b('0x23')]][_0x4c8974][_0x553b('0x4c')]&&!this[_0x553b('0xb')][_0x47b5b0[_0x553b('0x23')]][_0x4c8974]['agentcomplete']){this[_0x553b('0xb')][_0x47b5b0[_0x553b('0x23')]][_0x4c8974][_0x553b('0x41')]=!![];this['channels'][_0x47b5b0[_0x553b('0x23')]][_0x4c8974][_0x553b('0x4d')]=moment()['format'](_0x553b('0x27'));this[_0x553b('0xb')][_0x47b5b0[_0x553b('0x23')]][_0x4c8974]['lastevent']=_0x553b('0x4e');this[_0x553b('0xb')][_0x47b5b0['uniqueid']][_0x4c8974][_0x553b('0x4f')]=_0x47b5b0[_0x553b('0x4f')];this['channels'][_0x47b5b0[_0x553b('0x23')]][_0x4c8974]['reason']=_0x47b5b0[_0x553b('0x45')]==_0x553b('0x50')?_0x553b('0x51'):_0x47b5b0[_0x553b('0x45')];if(this[_0x553b('0xc')][_0x47b5b0[_0x553b('0x2a')]]&&this[_0x553b('0xc')][_0x47b5b0[_0x553b('0x2a')]][_0x553b('0x52')]){this[_0x553b('0xb')][_0x47b5b0[_0x553b('0x23')]][_0x4c8974]['agentacw']=!![];this[_0x553b('0xb')][_0x47b5b0['uniqueid']][_0x4c8974][_0x553b('0x53')]=this[_0x553b('0xc')][_0x47b5b0['queue']]['acwTimeout'];}this['agents'][_0x47b5b0[_0x553b('0x3d')]]=_[_0x553b('0x2d')](this[_0x553b('0xd')][_0x47b5b0[_0x553b('0x3d')]],[_0x553b('0x2a'),'destconnectedlinenum']);this['emit'](util[_0x553b('0x26')]('user:%s',_0x47b5b0[_0x553b('0x3e')]),'user:agentcomplete',this[_0x553b('0xb')][_0x47b5b0[_0x553b('0x23')]][_0x4c8974]);ami[_0x553b('0x22')](_0x553b('0x54'),this['channels'][_0x47b5b0[_0x553b('0x23')]][_0x4c8974]);}}}}}}catch(_0x25209d){logger[_0x553b('0x31')](_0x553b('0x55'),util[_0x553b('0x33')](_0x25209d,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x553b('0x17')]=function(_0x66d558){try{if(this[_0x553b('0x56')](_0x66d558)){this[_0x553b('0x57')](_0x66d558[_0x553b('0x23')],_['keys'](_0x66d558['variable'])[0x0],_0x66d558[_0x553b('0x58')]);if(this['channels'][_0x66d558[_0x553b('0x23')]]){for(var _0x58c02b in this['channels'][_0x66d558[_0x553b('0x23')]]){if(this[_0x553b('0xb')][_0x66d558[_0x553b('0x23')]][_0x553b('0x34')](_0x58c02b)){if(_[_0x553b('0x24')](this[_0x553b('0xb')][_0x66d558[_0x553b('0x23')]][_0x58c02b][_0x553b('0x29')])){this[_0x553b('0xb')][_0x66d558['uniqueid']][_0x58c02b]['variables']={};}this['channels'][_0x66d558[_0x553b('0x23')]][_0x58c02b]['variables']=this['variables'][_0x66d558[_0x553b('0x23')]];}}}}}catch(_0x65458e){logger['error'](_0x553b('0x59'),util[_0x553b('0x33')](_0x65458e,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x553b('0x57')]=function(_0x1a0d60,_0x36edbf,_0x112c69){var _0x5121f6=[_0x553b('0x5a'),_0x553b('0x5b'),_0x553b('0x5c'),_0x553b('0x5d'),_0x553b('0x5e'),_0x553b('0x5f'),_0x553b('0x60'),_0x553b('0x61'),_0x553b('0x62'),_0x553b('0x63'),'bridgepeer',_0x553b('0x64'),_0x553b('0x65'),'memberdynamic',_0x553b('0x66'),_0x553b('0x67'),'membername',_0x553b('0x68'),'memberrealtime'];if(!_[_0x553b('0x69')](_0x36edbf)&&!_['includes'](_0x5121f6,_0x36edbf)){if(_['isUndefined'](this[_0x553b('0x29')][_0x1a0d60])){this['variables'][_0x1a0d60]={};}this[_0x553b('0x29')][_0x1a0d60][_0x36edbf]=_0x112c69;}};VoiceAgentReport[_0x553b('0x21')][_0x553b('0x19')]=function(_0x38c440){try{if(this[_0x553b('0x56')](_0x38c440)){if(this[_0x553b('0xb')][_0x38c440['uniqueid']]){for(var _0x71879a in this[_0x553b('0xb')][_0x38c440[_0x553b('0x23')]]){if(this[_0x553b('0xb')][_0x38c440[_0x553b('0x23')]]['hasOwnProperty'](_0x71879a)){if(this['channels'][_0x38c440['uniqueid']][_0x71879a][_0x553b('0x45')]=='transfer'&&this['channels'][_0x38c440[_0x553b('0x23')]][_0x71879a][_0x553b('0x41')]){this[_0x553b('0xb')][_0x38c440[_0x553b('0x23')]][_0x71879a][_0x553b('0x4d')]=moment()[_0x553b('0x26')](_0x553b('0x27'));}}}ami[_0x553b('0x22')](_0x553b('0x6a'),_[_0x553b('0x6b')](this[_0x553b('0xb')][_0x38c440[_0x553b('0x23')]]));delete this[_0x553b('0xb')][_0x38c440[_0x553b('0x23')]];}if(this[_0x553b('0x29')][_0x38c440['uniqueid']]){delete this[_0x553b('0x29')][_0x38c440['uniqueid']];}}}catch(_0x559e88){logger[_0x553b('0x31')](_0x553b('0x6c'),util[_0x553b('0x33')](_0x559e88,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x553b('0x21')][_0x553b('0x1e')]=function(_0x14f81c){try{if(this['isNotNull'](_0x14f81c)){if(this['channels'][_0x14f81c[_0x553b('0x6d')]]){for(var _0x1ac36d in this[_0x553b('0xb')][_0x14f81c[_0x553b('0x6d')]]){if(this[_0x553b('0xb')][_0x14f81c[_0x553b('0x6d')]]['hasOwnProperty'](_0x1ac36d)){if(_0x14f81c['origtransfereruniqueid']===_0x1ac36d){var _0x4ba17c=moment();this[_0x553b('0xb')][_0x14f81c[_0x553b('0x6d')]][_0x1ac36d]['agentcomplete']=!![];this['channels'][_0x14f81c[_0x553b('0x6d')]][_0x1ac36d][_0x553b('0x4d')]=moment()[_0x553b('0x26')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x553b('0xb')][_0x14f81c[_0x553b('0x6d')]][_0x1ac36d][_0x553b('0x45')]='transfer';this[_0x553b('0xb')][_0x14f81c[_0x553b('0x6d')]][_0x1ac36d][_0x553b('0x35')]=_0x553b('0x4e');this[_0x553b('0xb')][_0x14f81c[_0x553b('0x6d')]][_0x1ac36d][_0x553b('0x4f')]=_0x4ba17c['diff'](this[_0x553b('0xb')][_0x14f81c['transfereeuniqueid']][_0x1ac36d][_0x553b('0x4c')],_0x553b('0x6e'));}}}}if(this[_0x553b('0xb')][_0x14f81c[_0x553b('0x6f')]]){var _0x4c7b5d=this[_0x553b('0xb')][_0x14f81c['secondtransfereruniqueid']];this['channels'][_0x14f81c[_0x553b('0x6f')]]=this[_0x553b('0xb')][_0x14f81c[_0x553b('0x6d')]];this[_0x553b('0xb')][_0x14f81c['transfereeuniqueid']]=_0x4c7b5d;}}}catch(_0x2fb4c2){logger[_0x553b('0x31')](_0x553b('0x70'),util[_0x553b('0x33')](_0x2fb4c2,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x553b('0x20')]=function(_0x2369c0){try{if(this[_0x553b('0x56')](_0x2369c0)){if(this['channels'][_0x2369c0[_0x553b('0x6d')]]){for(var _0x22de49 in this['channels'][_0x2369c0[_0x553b('0x6d')]]){if(this[_0x553b('0xb')][_0x2369c0[_0x553b('0x6d')]][_0x553b('0x34')](_0x22de49)){if(_0x2369c0['transfereruniqueid']===_0x22de49){var _0x40c97f=moment();this['channels'][_0x2369c0['transfereeuniqueid']][_0x22de49][_0x553b('0x41')]=!![];this['channels'][_0x2369c0[_0x553b('0x6d')]][_0x22de49][_0x553b('0x4d')]=_0x40c97f;this[_0x553b('0xb')][_0x2369c0[_0x553b('0x6d')]][_0x22de49][_0x553b('0x45')]=_0x553b('0x50');this[_0x553b('0xb')][_0x2369c0[_0x553b('0x6d')]][_0x22de49]['lastevent']='complete';this['channels'][_0x2369c0['transfereeuniqueid']][_0x22de49][_0x553b('0x4f')]=_0x40c97f['diff'](this[_0x553b('0xb')][_0x2369c0['transfereeuniqueid']][_0x22de49][_0x553b('0x4c')],_0x553b('0x6e'));}}}}}}catch(_0x16dd45){logger[_0x553b('0x31')](_0x553b('0x71'),util[_0x553b('0x33')](_0x16dd45,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x553b('0x21')][_0x553b('0x1a')]=function(_0x149876){var _0x40f98e='';try{if(this[_0x553b('0x56')](_0x149876)){if(_0x149876['channel']){_0x40f98e=_0x149876['channel'][_0x553b('0x72')](0x0,_0x149876[_0x553b('0x73')][_0x553b('0x74')]('-'));if(this['agents'][_0x40f98e]){this[_0x553b('0xd')][_0x40f98e][_0x553b('0x75')]=!![];}}}}catch(_0x1f43d4){logger[_0x553b('0x31')](_0x553b('0x76'),util['inspect'](_0x1f43d4,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x553b('0x1c')]=function(_0x50c2ed){var _0x223123='';try{if(this[_0x553b('0x56')](_0x50c2ed)){if(_0x50c2ed[_0x553b('0x73')]){_0x223123=_0x50c2ed[_0x553b('0x73')]['substring'](0x0,_0x50c2ed['channel'][_0x553b('0x74')]('-'));if(this['agents'][_0x223123]){this['agents'][_0x223123][_0x553b('0x75')]=![];}}}}catch(_0x4e6896){logger[_0x553b('0x31')](_0x553b('0x77'),util[_0x553b('0x33')](_0x4e6896,{'showHidden':![],'depth':null}));}};module[_0x553b('0x78')]=VoiceAgentReport; \ No newline at end of file +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 diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 9778cf7..8c9528a 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 _0x3893=['newexten','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','resolve','actionCoreShowChannels','catch','log','isNotNull','isUndefined','prototype','emit','uniqueid','linkedid','merge','keys','error','[syncNewCallerId][VoiceCallReport]','inspect','channel','OutgoingSpoolFailed','starttime','format','channelstate','pick','context','split','exten','name','user:agentconnect','accountcode','[syncNewChannel][VoiceCallReport]','application','applicationdata','appdata','toLowerCase','duration','seconds','YYYY-MM-DD\x20HH:mm:ss','includes','lastdata','startsWith','cdr(','match','queue','[syncNewExten][VoiceCallReport]','answered','answertime','holdtime','diff','calleridnum','xcally-motion-preview','connectedlinenum','connectedlinename','destinationchannel','disposition','toNumber','membername','UserId','syncMixMonitorFilename','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','push','variable','mixmonitor_filename','value','xmd-phone','xmd-callerid','callerid','xmd-cdrtype','originatecalleridnum','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','parse','sipcallid','sipcalllinkedid','[syncVarSet][VoiceCallReport]','endtime','billableseconds','omit','destconnectedlinenum','user:agentcomplete','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum','transfererchannel','isNil','[syncMusicOnHoldStart][VoiceCallReport]','mohstarttime','mohtime','moment','util','path','ioredis','../../../config/environment','../ami','../model/channel','unknown','busy','invalid','unavailable','ringinuse','onhold','set','agi','dial','playback','voicemail','FAILED','NO\x20ANSWER','ANSWERED','redis','defaults','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind'];(function(_0x2d018d,_0x446ca0){var _0x5f49ec=function(_0x333234){while(--_0x333234){_0x2d018d['push'](_0x2d018d['shift']());}};_0x5f49ec(++_0x446ca0);}(_0x3893,0x1a1));var _0x3389=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0x3893[_0x3e112d];return _0x531c31;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var moment=require(_0x3389('0x0'));var util=require(_0x3389('0x1'));var path=require(_0x3389('0x2'));var Redis=require(_0x3389('0x3'));var config=require(_0x3389('0x4'));var logger=require('../../../config/logger')('ami');var ami=require(_0x3389('0x5'));var Channel=require(_0x3389('0x6'));var statusDesc=[_0x3389('0x7'),'not_inuse','inuse',_0x3389('0x8'),_0x3389('0x9'),_0x3389('0xa'),'ringing',_0x3389('0xb'),_0x3389('0xc')];var applications=[_0x3389('0xd'),'queue',_0x3389('0xe'),_0x3389('0xf'),_0x3389('0x10'),_0x3389('0x11')];var dispositions=['NO\x20ANSWER',_0x3389('0x12'),_0x3389('0x12'),_0x3389('0x13'),_0x3389('0x13'),_0x3389('0x13'),_0x3389('0x14'),'BUSY',_0x3389('0x12'),_0x3389('0x12'),_0x3389('0x12')];var actions={};config[_0x3389('0x15')]=_[_0x3389('0x16')](config[_0x3389('0x15')],{'host':_0x3389('0x17'),'port':0x18eb});var io=require(_0x3389('0x18'))(new Redis(config[_0x3389('0x15')]));function VoiceCallReport(_0x1d60d7){this['channels']=_0x1d60d7[_0x3389('0x19')];this['agents']=_0x1d60d7[_0x3389('0x1a')];ami['on'](_0x3389('0x1b'),this[_0x3389('0x1c')][_0x3389('0x1d')](this));ami['on'](_0x3389('0x1e'),this[_0x3389('0x1c')][_0x3389('0x1d')](this));ami['on'](_0x3389('0x1f'),this[_0x3389('0x20')][_0x3389('0x1d')](this));ami['on'](_0x3389('0x21'),this[_0x3389('0x22')]['bind'](this));ami['on'](_0x3389('0x23'),this[_0x3389('0x24')][_0x3389('0x1d')](this));ami['on'](_0x3389('0x25'),this[_0x3389('0x26')][_0x3389('0x1d')](this));ami['on'](_0x3389('0x27'),this[_0x3389('0x28')][_0x3389('0x1d')](this));ami['on'](_0x3389('0x29'),this[_0x3389('0x2a')]['bind'](this));ami['on']('blindtransfer',this[_0x3389('0x2b')]['bind'](this));ami['on']('musiconholdstart',this[_0x3389('0x2c')][_0x3389('0x1d')](this));ami['on'](_0x3389('0x2d'),this[_0x3389('0x2e')][_0x3389('0x1d')](this));return BPromise[_0x3389('0x2f')]()['then'](ami[_0x3389('0x30')]())[_0x3389('0x31')](function(_0x39092e){console[_0x3389('0x32')](_0x39092e);});}VoiceCallReport['prototype'][_0x3389('0x33')]=function(_0x20460f){return _0x20460f!==null&&!_[_0x3389('0x34')](_0x20460f);};VoiceCallReport[_0x3389('0x35')]['emit']=function(_0x4d58d9,_0x1a9cf1,_0x35e792){io['to'](_0x4d58d9)[_0x3389('0x36')](_0x1a9cf1,_0x35e792);};VoiceCallReport[_0x3389('0x35')][_0x3389('0x28')]=function(_0x2a5787){try{if(this['isNotNull'](_0x2a5787)){if(_0x2a5787[_0x3389('0x37')]===_0x2a5787[_0x3389('0x38')]){if(!_[_0x3389('0x34')](this[_0x3389('0x19')][_0x2a5787['uniqueid']])){_[_0x3389('0x39')](this[_0x3389('0x19')][_0x2a5787[_0x3389('0x37')]],_['pick'](_0x2a5787,_[_0x3389('0x3a')](this['channels'][_0x2a5787['uniqueid']])));}}}}catch(_0x16f99b){logger[_0x3389('0x3b')](_0x3389('0x3c'),util[_0x3389('0x3d')](_0x16f99b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3389('0x35')][_0x3389('0x20')]=function(_0x207f36){try{if(this[_0x3389('0x33')](_0x207f36)){if(_0x207f36[_0x3389('0x37')]===_0x207f36[_0x3389('0x38')]&&_0x207f36[_0x3389('0x3e')]!=_0x3389('0x3f')){if(_[_0x3389('0x34')](this[_0x3389('0x19')][_0x207f36[_0x3389('0x37')]])){this[_0x3389('0x19')][_0x207f36[_0x3389('0x37')]]=new Channel();this[_0x3389('0x19')][_0x207f36['uniqueid']][_0x3389('0x40')]=moment()[_0x3389('0x41')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x207f36['uniqueid']]['disposition']=dispositions[_['toNumber'](_0x207f36[_0x3389('0x42')])];_['merge'](this[_0x3389('0x19')][_0x207f36['uniqueid']],_[_0x3389('0x43')](_0x207f36,_[_0x3389('0x3a')](this[_0x3389('0x19')][_0x207f36[_0x3389('0x37')]])));if(_0x207f36[_0x3389('0x44')]==='from-sip'){if(this['agents'][_0x207f36['channel'][_0x3389('0x45')]('-')[0x0]]){this[_0x3389('0x1a')][_0x207f36['channel'][_0x3389('0x45')]('-')[0x0]]['destconnectedlinenum']=_0x207f36[_0x3389('0x46')];this[_0x3389('0x36')](util['format']('user:%s',this[_0x3389('0x1a')][_0x207f36['channel'][_0x3389('0x45')]('-')[0x0]][_0x3389('0x47')]),_0x3389('0x48'),{'destaccountcode':this[_0x3389('0x1a')][_0x207f36[_0x3389('0x3e')][_0x3389('0x45')]('-')[0x0]][_0x3389('0x49')],'destconnectedlinenum':_0x207f36[_0x3389('0x46')]});}}}}}}catch(_0x3110ad){logger[_0x3389('0x3b')](_0x3389('0x4a'),util['inspect'](_0x3110ad,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x3389('0x1c')]=function(_0x4f0b48){try{if(this[_0x3389('0x33')](_0x4f0b48)){if(_0x4f0b48[_0x3389('0x37')]===_0x4f0b48[_0x3389('0x38')]&&_0x4f0b48[_0x3389('0x46')]!='h'&&_0x4f0b48['channel']!='OutgoingSpoolFailed'){_0x4f0b48['application']=_0x4f0b48[_0x3389('0x4b')]['toLowerCase']();_0x4f0b48[_0x3389('0x4c')]=(_0x4f0b48[_0x3389('0x4d')]||_0x4f0b48[_0x3389('0x4c')])[_0x3389('0x4e')]();if(_['isUndefined'](this['channels'][_0x4f0b48[_0x3389('0x37')]])){this['channels'][_0x4f0b48[_0x3389('0x37')]]=new Channel();this[_0x3389('0x19')][_0x4f0b48[_0x3389('0x37')]]['starttime']=_0x4f0b48[_0x3389('0x4f')]?moment()['subtract'](moment[_0x3389('0x4f')](_0x4f0b48[_0x3389('0x4f')])[_0x3389('0x50')](),_0x3389('0x50'))[_0x3389('0x41')](_0x3389('0x51')):moment()['format'](_0x3389('0x51'));this[_0x3389('0x19')][_0x4f0b48[_0x3389('0x37')]]['disposition']=_0x3389('0x13');}_[_0x3389('0x39')](this['channels'][_0x4f0b48[_0x3389('0x37')]],_[_0x3389('0x43')](_0x4f0b48,_[_0x3389('0x3a')](this[_0x3389('0x19')][_0x4f0b48['uniqueid']])));if(_[_0x3389('0x52')](applications,_0x4f0b48[_0x3389('0x4b')])){this[_0x3389('0x19')][_0x4f0b48[_0x3389('0x37')]]['lastapplication']=_0x4f0b48[_0x3389('0x4b')];this['channels'][_0x4f0b48['uniqueid']][_0x3389('0x53')]=_0x4f0b48[_0x3389('0x4c')];if(_0x4f0b48['application']===_0x3389('0xd')&&_[_0x3389('0x54')](_0x4f0b48[_0x3389('0x4c')],_0x3389('0x55'))){var _0x2e4d1c=_0x4f0b48[_0x3389('0x4c')][_0x3389('0x45')]('=');var _0x3ec5a3=_0x2e4d1c[0x0][_0x3389('0x56')](/cdr\((.*)\)/);if(_0x3ec5a3){this[_0x3389('0x19')][_0x4f0b48[_0x3389('0x37')]][_0x3ec5a3[0x1]]=_0x2e4d1c[0x1];}}else if(_0x4f0b48[_0x3389('0x4b')]===_0x3389('0x57')){this[_0x3389('0x19')][_0x4f0b48['uniqueid']][_0x3389('0x57')]=_0x4f0b48[_0x3389('0x4c')][_0x3389('0x45')](',')[0x0];}}}}}catch(_0x1eb825){logger['error'](_0x3389('0x58'),util[_0x3389('0x3d')](_0x1eb825,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x3389('0x22')]=function(_0x21894e){try{if(this[_0x3389('0x33')](_0x21894e)){if(_0x21894e[_0x3389('0x37')]!==_0x21894e[_0x3389('0x38')]){if(this[_0x3389('0x19')][_0x21894e[_0x3389('0x38')]]){if(_0x21894e['channelstate']==='6'){if(!this['channels'][_0x21894e[_0x3389('0x38')]][_0x3389('0x59')]){var _0x15c35b=moment();this[_0x3389('0x19')][_0x21894e['linkedid']][_0x3389('0x59')]=!![];this['channels'][_0x21894e[_0x3389('0x38')]][_0x3389('0x5a')]=_0x15c35b[_0x3389('0x41')](_0x3389('0x51'));if(this[_0x3389('0x19')][_0x21894e[_0x3389('0x38')]][_0x3389('0x40')]){this[_0x3389('0x19')][_0x21894e[_0x3389('0x38')]][_0x3389('0x5b')]=_0x15c35b[_0x3389('0x5c')](this[_0x3389('0x19')][_0x21894e[_0x3389('0x38')]]['starttime'],_0x3389('0x50'));}}this['channels'][_0x21894e[_0x3389('0x38')]][_0x3389('0x38')]=_0x21894e[_0x3389('0x37')];if(_0x21894e[_0x3389('0x5d')]!==_0x3389('0x5e')){this[_0x3389('0x19')][_0x21894e[_0x3389('0x38')]][_0x3389('0x5f')]=_0x21894e['calleridnum'];}this['channels'][_0x21894e[_0x3389('0x38')]][_0x3389('0x60')]=_0x21894e['calleridname'];this['channels'][_0x21894e['linkedid']][_0x3389('0x61')]=_0x21894e[_0x3389('0x3e')];this['channels'][_0x21894e[_0x3389('0x38')]][_0x3389('0x62')]=dispositions[_[_0x3389('0x63')](_0x21894e['channelstate'])];if(this['agents'][_0x21894e[_0x3389('0x3e')][_0x3389('0x45')]('-')[0x0]]){this[_0x3389('0x19')][_0x21894e[_0x3389('0x38')]]['UserId']=this[_0x3389('0x1a')][_0x21894e[_0x3389('0x3e')][_0x3389('0x45')]('-')[0x0]]['id'];this['channels'][_0x21894e[_0x3389('0x38')]][_0x3389('0x64')]=this[_0x3389('0x1a')][_0x21894e[_0x3389('0x3e')][_0x3389('0x45')]('-')[0x0]][_0x3389('0x47')];}}}}else{if(this[_0x3389('0x19')][_0x21894e[_0x3389('0x37')]]){if(_0x21894e[_0x3389('0x42')]==='6'){if(this[_0x3389('0x1a')][_0x21894e[_0x3389('0x3e')][_0x3389('0x45')]('-')[0x0]]){this[_0x3389('0x19')][_0x21894e[_0x3389('0x37')]][_0x3389('0x65')]=this[_0x3389('0x1a')][_0x21894e[_0x3389('0x3e')][_0x3389('0x45')]('-')[0x0]]['id'];this[_0x3389('0x19')][_0x21894e[_0x3389('0x37')]][_0x3389('0x64')]=this[_0x3389('0x1a')][_0x21894e[_0x3389('0x3e')][_0x3389('0x45')]('-')[0x0]]['name'];}}}}}}catch(_0x4a099e){logger[_0x3389('0x3b')]('[syncNewState][VoiceCallReport]',util[_0x3389('0x3d')](_0x4a099e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3389('0x35')][_0x3389('0x66')]=function(_0x29a87e,_0x32eaa7){if(this[_0x3389('0x19')][_0x29a87e]){this[_0x3389('0x19')][_0x29a87e]['monitor']=!![];if(_[_0x3389('0x67')](_0x32eaa7,_0x3389('0x68'))){_0x32eaa7=_0x32eaa7[_0x3389('0x69')]('.wav49',_0x3389('0x6a'));}this[_0x3389('0x19')][_0x29a87e][_0x3389('0x6b')]=_0x32eaa7;var _0xbee0c7=_[_0x3389('0x6c')](this['channels'][_0x29a87e]['monitors'],{'filename':_0x32eaa7});if(_['isNil'](_0xbee0c7)){this[_0x3389('0x19')][_0x29a87e][_0x3389('0x6d')][_0x3389('0x6e')]({'filename':_0x32eaa7,'createdAt':moment()[_0x3389('0x41')](_0x3389('0x51')),'mixmonitorid':'','status':'rec'});}}};VoiceCallReport[_0x3389('0x35')][_0x3389('0x24')]=function(_0x27b9b6){try{if(this[_0x3389('0x33')](_0x27b9b6)){if(this['channels'][_0x27b9b6[_0x3389('0x37')]]&&_0x27b9b6[_0x3389('0x3e')]!=_0x3389('0x3f')){if(this['isNotNull'](_0x27b9b6[_0x3389('0x6f')])){if(this[_0x3389('0x33')](_0x27b9b6['variable'][_0x3389('0x70')])){this[_0x3389('0x66')](_0x27b9b6[_0x3389('0x37')],_0x27b9b6[_0x3389('0x71')]);}else if(this[_0x3389('0x33')](_0x27b9b6[_0x3389('0x6f')][_0x3389('0x72')])){this[_0x3389('0x19')][_0x27b9b6[_0x3389('0x37')]]['calleridnum']=_0x27b9b6['value'];}else if(this['isNotNull'](_0x27b9b6['variable'][_0x3389('0x73')])){this[_0x3389('0x19')][_0x27b9b6[_0x3389('0x37')]][_0x3389('0x74')]=_0x27b9b6[_0x3389('0x71')];}else if(this['isNotNull'](_0x27b9b6[_0x3389('0x6f')][_0x3389('0x75')])){this['channels'][_0x27b9b6[_0x3389('0x37')]]['type']=_0x27b9b6[_0x3389('0x71')];}else if(this[_0x3389('0x33')](_0x27b9b6[_0x3389('0x6f')]['xmd-queue'])){this[_0x3389('0x19')][_0x27b9b6['uniqueid']]['queue']=_0x27b9b6[_0x3389('0x71')]['split'](',')[0x0];}else if(this[_0x3389('0x33')](_0x27b9b6[_0x3389('0x6f')]['xmd-originatecalleridnum'])){this[_0x3389('0x19')][_0x27b9b6[_0x3389('0x37')]][_0x3389('0x76')]=_0x27b9b6[_0x3389('0x71')];}else if(this[_0x3389('0x33')](_0x27b9b6[_0x3389('0x6f')]['xmd-destination'])){this[_0x3389('0x19')][_0x27b9b6[_0x3389('0x37')]][_0x3389('0x77')]=_0x27b9b6['value'];}else if(this[_0x3389('0x33')](_0x27b9b6[_0x3389('0x6f')][_0x3389('0x78')])){this[_0x3389('0x19')][_0x27b9b6[_0x3389('0x37')]][_0x3389('0x79')]=_0x27b9b6[_0x3389('0x71')];}else if(this[_0x3389('0x33')](_0x27b9b6[_0x3389('0x6f')][_0x3389('0x7a')])){this[_0x3389('0x19')][_0x27b9b6[_0x3389('0x37')]][_0x3389('0x57')]=_0x27b9b6[_0x3389('0x71')];}else if(this[_0x3389('0x33')](_0x27b9b6[_0x3389('0x6f')]['sipcallid'])){this[_0x3389('0x19')][_0x27b9b6[_0x3389('0x37')]]['sipcalluniqueid']=_0x27b9b6[_0x3389('0x71')];}}}else if(this['isNotNull'](_0x27b9b6[_0x3389('0x6f')][_0x3389('0x70')])){if(_0x27b9b6[_0x3389('0x71')]){var _0x3db581=path[_0x3389('0x7b')](_0x27b9b6['value'])[_0x3389('0x47')];this['syncMixMonitorFilename'](_0x3db581,_0x27b9b6['value']);}}else if(this[_0x3389('0x19')][_0x27b9b6['linkedid']]){if(this[_0x3389('0x33')](_0x27b9b6[_0x3389('0x6f')])){if(this[_0x3389('0x33')](_0x27b9b6[_0x3389('0x6f')][_0x3389('0x7c')])){this[_0x3389('0x19')][_0x27b9b6[_0x3389('0x38')]][_0x3389('0x7d')]=_0x27b9b6[_0x3389('0x71')];}}}}}catch(_0x196c31){logger[_0x3389('0x3b')](_0x3389('0x7e'),util[_0x3389('0x3d')](_0x196c31,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3389('0x35')][_0x3389('0x26')]=function(_0x1c020b){try{if(this[_0x3389('0x33')](_0x1c020b)){if(this[_0x3389('0x19')][_0x1c020b[_0x3389('0x37')]]){var _0x28055e=moment();this[_0x3389('0x19')][_0x1c020b[_0x3389('0x37')]][_0x3389('0x7f')]=_0x28055e[_0x3389('0x41')](_0x3389('0x51'));this[_0x3389('0x19')][_0x1c020b[_0x3389('0x37')]]['duration']=_0x28055e['diff'](this[_0x3389('0x19')][_0x1c020b[_0x3389('0x37')]][_0x3389('0x40')],_0x3389('0x50'));if(this[_0x3389('0x19')][_0x1c020b[_0x3389('0x37')]][_0x3389('0x59')]){this['channels'][_0x1c020b[_0x3389('0x37')]][_0x3389('0x80')]=_0x28055e[_0x3389('0x5c')](this[_0x3389('0x19')][_0x1c020b[_0x3389('0x37')]][_0x3389('0x5a')],_0x3389('0x50'));this['channels'][_0x1c020b['uniqueid']][_0x3389('0x5b')]=this['channels'][_0x1c020b[_0x3389('0x37')]][_0x3389('0x4f')]-this[_0x3389('0x19')][_0x1c020b[_0x3389('0x37')]]['billableseconds'];}if(_0x1c020b[_0x3389('0x44')]==='from-sip'){if(this[_0x3389('0x1a')][_0x1c020b[_0x3389('0x3e')]['split']('-')[0x0]]){this[_0x3389('0x1a')][_0x1c020b['channel'][_0x3389('0x45')]('-')[0x0]]=_[_0x3389('0x81')](this['agents'][_0x1c020b[_0x3389('0x3e')][_0x3389('0x45')]('-')[0x0]],[_0x3389('0x82')]);this[_0x3389('0x36')](util[_0x3389('0x41')]('user:%s',this['agents'][_0x1c020b[_0x3389('0x3e')][_0x3389('0x45')]('-')[0x0]][_0x3389('0x47')]),_0x3389('0x83'),{'destaccountcode':this[_0x3389('0x1a')][_0x1c020b[_0x3389('0x3e')][_0x3389('0x45')]('-')[0x0]]['accountcode']});}}ami['emit'](_0x3389('0x84'),this[_0x3389('0x19')][_0x1c020b[_0x3389('0x37')]]);delete this['channels'][_0x1c020b[_0x3389('0x37')]];}}}catch(_0xffd354){logger[_0x3389('0x3b')](_0x3389('0x85'),util[_0x3389('0x3d')](_0xffd354,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3389('0x35')]['syncAttendedTransfer']=function(_0x2f17b3){try{if(this[_0x3389('0x33')](_0x2f17b3)){if(this[_0x3389('0x19')][_0x2f17b3[_0x3389('0x86')]]){this['channels'][_0x2f17b3[_0x3389('0x86')]][_0x3389('0x87')]=_0x2f17b3[_0x3389('0x88')];this[_0x3389('0x19')][_0x2f17b3[_0x3389('0x86')]][_0x3389('0x89')]=_0x2f17b3[_0x3389('0x8a')];if(this[_0x3389('0x19')][_0x2f17b3[_0x3389('0x8b')]]){var _0x34157a=this[_0x3389('0x19')][_0x2f17b3[_0x3389('0x8b')]];this['channels'][_0x2f17b3[_0x3389('0x8b')]]=this[_0x3389('0x19')][_0x2f17b3['transfereeuniqueid']];this['channels'][_0x2f17b3['transfereeuniqueid']]=_0x34157a;}}else if(this['channels'][_0x2f17b3[_0x3389('0x8c')]]){this[_0x3389('0x19')][_0x2f17b3[_0x3389('0x8c')]][_0x3389('0x87')]=_0x2f17b3[_0x3389('0x88')];this['channels'][_0x2f17b3[_0x3389('0x8c')]][_0x3389('0x89')]=_0x2f17b3[_0x3389('0x8a')];if(this[_0x3389('0x19')][_0x2f17b3[_0x3389('0x8d')]]){var _0x34157a=this[_0x3389('0x19')][_0x2f17b3[_0x3389('0x8d')]];this[_0x3389('0x19')][_0x2f17b3['origtransfereruniqueid']]=this[_0x3389('0x19')][_0x2f17b3['transfertargetuniqueid']];this['channels'][_0x2f17b3[_0x3389('0x8c')]]=_0x34157a;}}}}catch(_0xc4b3be){logger[_0x3389('0x3b')](_0x3389('0x8e'),util['inspect'](_0xc4b3be,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3389('0x35')][_0x3389('0x2b')]=function(_0x4554e5){try{if(this[_0x3389('0x33')](_0x4554e5)){if(this[_0x3389('0x19')][_0x4554e5[_0x3389('0x86')]]){this[_0x3389('0x19')][_0x4554e5[_0x3389('0x86')]][_0x3389('0x87')]=_0x4554e5[_0x3389('0x8f')];this[_0x3389('0x19')][_0x4554e5[_0x3389('0x86')]][_0x3389('0x89')]=_0x4554e5['extension'];this[_0x3389('0x26')]({'event':'BlindTransfer','uniqueid':_0x4554e5[_0x3389('0x86')],'context':_0x4554e5['context'],'channel':_0x4554e5[_0x3389('0x90')]});}}}catch(_0xd1480b){logger[_0x3389('0x3b')]('[syncBlindTransfer][VoiceCallReport]',util['inspect'](_0xd1480b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3389('0x35')][_0x3389('0x2c')]=function(_0x33731d){try{if(this['isNotNull'](_0x33731d)){if(this[_0x3389('0x19')][_0x33731d[_0x3389('0x37')]]){if(!_[_0x3389('0x91')](this['channels'][_0x33731d[_0x3389('0x37')]][_0x3389('0x5a')])){this['channels'][_0x33731d[_0x3389('0x37')]]['mohstarttime']=moment()[_0x3389('0x41')](_0x3389('0x51'));}}}}catch(_0x59e303){logger[_0x3389('0x3b')](_0x3389('0x92'),util['inspect'](_0x59e303,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x3389('0x2e')]=function(_0x36a8ef){try{if(this[_0x3389('0x33')](_0x36a8ef)){if(this[_0x3389('0x19')][_0x36a8ef[_0x3389('0x37')]]){if(!_['isNil'](this[_0x3389('0x19')][_0x36a8ef[_0x3389('0x37')]][_0x3389('0x93')])){this['channels'][_0x36a8ef[_0x3389('0x37')]][_0x3389('0x94')]+=moment()['milliseconds'](0x0)[_0x3389('0x5c')](this[_0x3389('0x19')][_0x36a8ef[_0x3389('0x37')]][_0x3389('0x93')],_0x3389('0x50'));delete this['channels'][_0x36a8ef[_0x3389('0x37')]][_0x3389('0x93')];}}}}catch(_0x759a95){logger[_0x3389('0x3b')]('[syncMusicOnHoldStop][VoiceCallReport]',util[_0x3389('0x3d')](_0x759a95,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport; \ No newline at end of file +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 diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index ff85d2a..5a3dcd9 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 _0x783c=['redis','defaults','localhost','channels','outboundChannels','outbound','variables','dialbegin','syncDialBegin','syncDialEnd','bind','varset','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','uniqueid','format','called','channel','lastIndexOf','substring','omit','event','privilege','voice:outbound','custom:dialbegin','error','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','custom:dialconnect','voice_outbound_channel:save','[syncDialEnd][VoiceDialReport]','addVariable','variable','value','outboundrouteid','[syncVarSet][VoiceDialReport]','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','endtime','YYYY-MM-DD\x20HH:mm:ss','duration','diff','starttime','seconds','complete','total','holdtime','billableseconds','sumHoldTime','sumBillable','custom:voiceDialReport','info','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','../ami'];(function(_0x3f57c4,_0x43cdc0){var _0x3a4732=function(_0x1a2156){while(--_0x1a2156){_0x3f57c4['push'](_0x3f57c4['shift']());}};_0x3a4732(++_0x43cdc0);}(_0x783c,0xa5));var _0xc783=function(_0x4bdac5,_0x3a30d5){_0x4bdac5=_0x4bdac5-0x0;var _0x19ee9d=_0x783c[_0x4bdac5];return _0x19ee9d;};'use strict';var _=require(_0xc783('0x0'));var moment=require(_0xc783('0x1'));var util=require(_0xc783('0x2'));var Redis=require(_0xc783('0x3'));var config=require(_0xc783('0x4'));var logger=require(_0xc783('0x5'))('ami');var ami=require(_0xc783('0x6'));config[_0xc783('0x7')]=_[_0xc783('0x8')](config[_0xc783('0x7')],{'host':_0xc783('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceDialReport(_0x580def){this[_0xc783('0xa')]=_0x580def[_0xc783('0xb')];this['outbound']=_0x580def[_0xc783('0xc')];this[_0xc783('0xd')]={};ami['on'](_0xc783('0xe'),this[_0xc783('0xf')]['bind'](this));ami['on']('dialend',this[_0xc783('0x10')][_0xc783('0x11')](this));ami['on'](_0xc783('0x12'),this['syncVarSet']['bind'](this));ami['on'](_0xc783('0x13'),this[_0xc783('0x14')][_0xc783('0x11')](this));}VoiceDialReport[_0xc783('0x15')][_0xc783('0x16')]=function(_0x89585){return _0x89585!==null&&!_[_0xc783('0x17')](_0x89585);};VoiceDialReport[_0xc783('0x15')][_0xc783('0x18')]=function(_0x24304b,_0x1ac58d,_0x55ea8e){io['to'](_0x24304b)[_0xc783('0x18')](_0x1ac58d,_0x55ea8e);};VoiceDialReport['prototype'][_0xc783('0xf')]=function(_0x1ee995){try{if(this['isNotNull'](_0x1ee995)){if(this[_0xc783('0xa')][_0x1ee995[_0xc783('0x19')]]){_['merge'](this[_0xc783('0xa')][_0x1ee995[_0xc783('0x19')]],{'starttime':moment()[_0xc783('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0xc783('0x1b'),'interface':_0x1ee995['channel']['substring'](0x0,_0x1ee995[_0xc783('0x1c')][_0xc783('0x1d')]('-')),'membername':_0x1ee995[_0xc783('0x1c')][_0xc783('0x1e')](_0x1ee995[_0xc783('0x1c')][_0xc783('0x1d')]('/')+0x1,_0x1ee995[_0xc783('0x1c')][_0xc783('0x1d')]('-'))},_[_0xc783('0x1f')](_0x1ee995,[_0xc783('0x20'),_0xc783('0x21')]));this[_0xc783('0x18')](_0xc783('0x22'),'voice_outbound_channel:save',this[_0xc783('0xa')][_0x1ee995[_0xc783('0x19')]]);ami[_0xc783('0x18')](_0xc783('0x23'),this[_0xc783('0xa')][_0x1ee995[_0xc783('0x19')]]);}}}catch(_0x3b0336){logger[_0xc783('0x24')](_0xc783('0x25'),util[_0xc783('0x26')](_0x3b0336,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xc783('0x10')]=function(_0x4e9140){try{if(this[_0xc783('0x16')](_0x4e9140)){if(this[_0xc783('0xa')][_0x4e9140['uniqueid']]){this[_0xc783('0xa')][_0x4e9140[_0xc783('0x19')]][_0xc783('0x27')]=_0x4e9140[_0xc783('0x27')];if(_0x4e9140[_0xc783('0x27')]===_0xc783('0x28')){this['channels'][_0x4e9140[_0xc783('0x19')]][_0xc783('0x29')]=_0x4e9140['connectedlinenum'];this[_0xc783('0xa')][_0x4e9140[_0xc783('0x19')]]['connectedlinename']=_0x4e9140[_0xc783('0x2a')];this[_0xc783('0xa')][_0x4e9140[_0xc783('0x19')]][_0xc783('0x2b')]=moment()[_0xc783('0x1a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xc783('0xa')][_0x4e9140[_0xc783('0x19')]][_0xc783('0x2c')]='connect';ami[_0xc783('0x18')](_0xc783('0x2d'),this['channels'][_0x4e9140[_0xc783('0x19')]]);}this[_0xc783('0x18')](_0xc783('0x22'),_0xc783('0x2e'),this[_0xc783('0xa')][_0x4e9140['uniqueid']]);}}}catch(_0xf627fc){logger[_0xc783('0x24')](_0xc783('0x2f'),util[_0xc783('0x26')](_0xf627fc,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xc783('0x15')]['syncVarSet']=function(_0x10e079){try{if(this[_0xc783('0x16')](_0x10e079)){this[_0xc783('0x30')](_0x10e079[_0xc783('0x19')],_['keys'](_0x10e079[_0xc783('0x31')])[0x0],_0x10e079[_0xc783('0x32')]);if(this['isNotNull'](_0x10e079['variable'])&&this[_0xc783('0x16')](_0x10e079['variable'][_0xc783('0x33')])){if(_[_0xc783('0x17')](this[_0xc783('0xa')][_0x10e079[_0xc783('0x19')]])){this[_0xc783('0xa')][_0x10e079[_0xc783('0x19')]]={'routeId':_0x10e079[_0xc783('0x32')],'variables':this['variables'][_0x10e079['uniqueid']]};this[_0xc783('0x18')](_0xc783('0x22'),'voice_outbound_channel:save',this[_0xc783('0xa')][_0x10e079[_0xc783('0x19')]]);}}}}catch(_0x42bc0b){logger[_0xc783('0x24')](_0xc783('0x34'),util[_0xc783('0x26')](_0x42bc0b,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xc783('0x15')][_0xc783('0x30')]=function(_0x1058c3,_0x84e11d,_0x758eb3){var _0xc93418=['rtpaudioqos',_0xc783('0x35'),'rtpaudioqosjitter',_0xc783('0x36'),'rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt',_0xc783('0x37'),_0xc783('0x38'),_0xc783('0x39'),_0xc783('0x3a'),_0xc783('0x3b'),_0xc783('0x3c'),_0xc783('0x3d'),_0xc783('0x3e'),_0xc783('0x3f'),'membername',_0xc783('0x40'),_0xc783('0x41')];if(!_[_0xc783('0x42')](_0x84e11d)&&!_[_0xc783('0x43')](_0xc93418,_0x84e11d)){if(_[_0xc783('0x17')](this[_0xc783('0xd')][_0x1058c3])){this[_0xc783('0xd')][_0x1058c3]={};}this[_0xc783('0xd')][_0x1058c3][_0x84e11d]=_0x758eb3;}};VoiceDialReport[_0xc783('0x15')]['syncHangup']=function(_0x78176){try{if(this[_0xc783('0x16')](_0x78176)){if(this[_0xc783('0xa')][_0x78176[_0xc783('0x19')]]){this[_0xc783('0xa')][_0x78176[_0xc783('0x19')]][_0xc783('0x44')]=moment()[_0xc783('0x1a')](_0xc783('0x45'));this['channels'][_0x78176[_0xc783('0x19')]][_0xc783('0x46')]=moment(this['channels'][_0x78176[_0xc783('0x19')]]['endtime'])[_0xc783('0x47')](this['channels'][_0x78176[_0xc783('0x19')]][_0xc783('0x48')],_0xc783('0x49'));this[_0xc783('0xa')][_0x78176[_0xc783('0x19')]][_0xc783('0x2c')]=_0xc783('0x4a');this['outbound'][_0xc783('0x4b')]+=0x1;if(this[_0xc783('0xa')][_0x78176['uniqueid']][_0xc783('0x2b')]){this[_0xc783('0xc')]['answered']+=0x1;this['channels'][_0x78176[_0xc783('0x19')]][_0xc783('0x4c')]=moment(this[_0xc783('0xa')][_0x78176[_0xc783('0x19')]][_0xc783('0x2b')])[_0xc783('0x47')](this[_0xc783('0xa')][_0x78176[_0xc783('0x19')]]['starttime'],_0xc783('0x49'));this[_0xc783('0xa')][_0x78176['uniqueid']][_0xc783('0x4d')]=moment(this['channels'][_0x78176[_0xc783('0x19')]]['endtime'])[_0xc783('0x47')](this[_0xc783('0xa')][_0x78176[_0xc783('0x19')]][_0xc783('0x2b')],_0xc783('0x49'));this[_0xc783('0xc')][_0xc783('0x4e')]+=this[_0xc783('0xa')][_0x78176[_0xc783('0x19')]][_0xc783('0x4c')]||0x0;this[_0xc783('0xc')][_0xc783('0x4f')]+=this[_0xc783('0xa')][_0x78176[_0xc783('0x19')]][_0xc783('0x4d')];}this[_0xc783('0xc')]['sumDuration']+=this[_0xc783('0xa')][_0x78176[_0xc783('0x19')]]['duration'];ami[_0xc783('0x18')](_0xc783('0x50'),this[_0xc783('0xa')][_0x78176[_0xc783('0x19')]]);ami[_0xc783('0x18')]('custom:dialend',this['channels'][_0x78176[_0xc783('0x19')]]);this[_0xc783('0x18')]('voice:outbound','voice_outbound:save',this[_0xc783('0xc')]);logger[_0xc783('0x51')](_0xc783('0x52'),JSON[_0xc783('0x53')](this[_0xc783('0xa')][_0x78176['uniqueid']]));this[_0xc783('0x18')](_0xc783('0x22'),_0xc783('0x54'),this[_0xc783('0xa')][_0x78176[_0xc783('0x19')]]);delete this[_0xc783('0xa')][_0x78176[_0xc783('0x19')]];}if(this[_0xc783('0xd')][_0x78176[_0xc783('0x19')]]){delete this[_0xc783('0xd')][_0x78176[_0xc783('0x19')]];}}}catch(_0x4c0f06){logger['error'](_0xc783('0x55'),util[_0xc783('0x26')](_0x4c0f06,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file +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 diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 5034646..0778c98 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 _0xdce2=['mohstarttime','[syncMusicOnHoldStop][VoiceQueueReport]','lodash','moment','util','md5','ioredis','../../../config/environment','../../../config/logger','redis','socket.io-emitter','prototype','enqueue','tail','sequence','agents','channels','queueChannels','voiceQueues','queuesummary','syncQueueSummary','bind','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','queuecallerleave','agentcomplete','agentconnect','syncAgentConnect','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','hasOwnProperty','isEmpty','originated','talking','waiting','queueStatusComplete','clearZombieChannels','switch','isNil','status','catch','error','[voiceQueueReport][checkChannel]','queueReports','[voiceQueueReport][checkQueueReport]','variables','[FullyBooted]\x20clear\x20realtime','clearQueueReport','campaigns','emitVoiceQueueChannelRemove','inspect','emit','emitVoiceQueueChannelSave','voice:queue:%s','name','info','stringify','format','voice_queue_channel:remove','emitVoiceQueueSummary','inbound','strategy','available','loggedIn','pTalking','sumBillable','sumDuration','total','type','abandoned','Trunk','active','callerid','Interval','voice_queue:save','isNotNull','isUndefined','Action','[queues]','then','flagQueueSummary','[queuesummary]','queue','countBy','toNumber','loggedin','[syncQueueSummary][VoiceQueueReport]','syncNewExten','uniqueid','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','merge','keys','push','[syncQueueCallerJoin][VoiceQueueReport]','syncQueueCallerAbandon','last','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','ABANDONED','lastAssignedTo','[syncQueueCallerAbandon][VoiceQueueReport]','queuecallerleaveAt','connectedlinenum','connectedlinename','[syncQueueCallerLeave][VoiceQueueReport]','queuecallercomplete','queuecallerexitreason','COMPLETEDBYAGENT','[syncAgentConnect][VoiceQueueReport]','syncAgentComplete','membername','queuecallerexit','queuecallerexitAt','transfer','reason','COMPLETED','startsWith','channel','toLowerCase','local/','linkedid','seconds','FORWARDTRANSFER','transfertype','FORWARD','destexten','transferuniqueid','COMPLETEDBY','toUpperCase','addVariable','variable','value','queuestatus','CONTINUE','queueposition','EXITWITHKEY','[syncVarSet][VoiceQueueReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','membercalls','memberdynamic','memberinterface','memberrealtime','includes','sumHoldTime','diff','length','milliseconds','answered','lastevent','unmanaged','custom:queuecallerunmanaged','custom:queuecallerabandon','[syncHangup][VoiceQueueReport]','transfereeuniqueid','transferexten','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','ATTENDED','[syncAttendedTransfer][VoiceQueueReport]','BLIND','extension','BlindTransfer','transfererchannel'];(function(_0x3bd6c4,_0x2f5e7e){var _0x43018a=function(_0x11fd7e){while(--_0x11fd7e){_0x3bd6c4['push'](_0x3bd6c4['shift']());}};_0x43018a(++_0x2f5e7e);}(_0xdce2,0x186));var _0x2dce=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xdce2[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x2dce('0x0'));var moment=require(_0x2dce('0x1'));var BPromise=require('bluebird');var util=require(_0x2dce('0x2'));var md5=require(_0x2dce('0x3'));var Redis=require(_0x2dce('0x4'));var config=require(_0x2dce('0x5'));var logger=require(_0x2dce('0x6'))('ami');var ami=require('../ami');var QueueReport=require('../model/queueReport');config[_0x2dce('0x7')]=_['defaults'](config[_0x2dce('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x2dce('0x8'))(new Redis(config[_0x2dce('0x7')]));var Sequence=function(){};Sequence[_0x2dce('0x9')][_0x2dce('0xa')]=function(_0x3b3435){this[_0x2dce('0xb')]=this[_0x2dce('0xb')]?this[_0x2dce('0xb')]['finally'](_0x3b3435):_0x3b3435();};function VoiceQueueReport(_0x3b6bf6){this[_0x2dce('0xc')]=new Sequence();this['queueReports']={};this[_0x2dce('0xd')]=_0x3b6bf6[_0x2dce('0xd')];this[_0x2dce('0xe')]=_0x3b6bf6[_0x2dce('0xf')];this[_0x2dce('0x10')]=_0x3b6bf6[_0x2dce('0x10')];this['flagQueueSummary']=!![];this['campaigns']=_0x3b6bf6['campaigns'];this['variables']={};ami['on'](_0x2dce('0x11'),this[_0x2dce('0x12')][_0x2dce('0x13')](this));ami['on']('queuesummarycomplete',this[_0x2dce('0x14')][_0x2dce('0x13')](this));ami['on'](_0x2dce('0x15'),this[_0x2dce('0x16')]['bind'](this));ami['on'](_0x2dce('0x17'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0x2dce('0x18'),this['syncQueueCallerLeave'][_0x2dce('0x13')](this));ami['on'](_0x2dce('0x19'),this['syncAgentComplete'][_0x2dce('0x13')](this));ami['on'](_0x2dce('0x1a'),this[_0x2dce('0x1b')][_0x2dce('0x13')](this));ami['on']('varset',this[_0x2dce('0x1c')][_0x2dce('0x13')](this));ami['on'](_0x2dce('0x1d'),this[_0x2dce('0x1e')][_0x2dce('0x13')](this));ami['on'](_0x2dce('0x1f'),this[_0x2dce('0x20')][_0x2dce('0x13')](this));ami['on'](_0x2dce('0x21'),this[_0x2dce('0x22')][_0x2dce('0x13')](this));ami['on'](_0x2dce('0x23'),this[_0x2dce('0x24')][_0x2dce('0x13')](this));ami['on'](_0x2dce('0x25'),this[_0x2dce('0x26')]['bind'](this));ami['on']('blindtransfer',this[_0x2dce('0x27')]['bind'](this));this[_0x2dce('0x28')]();this[_0x2dce('0x29')]();}function isNotNull(_0x255a50){return _0x255a50!==null&&!_['isUndefined'](_0x255a50);}function clearChannels(_0x48b753){if(!_['isEmpty'](_0x48b753)){for(var _0x5282e4 in _0x48b753){if(_0x48b753[_0x2dce('0x2a')](_0x5282e4)){delete _0x48b753[_0x5282e4];}}}}function clearCampaigns(_0x3c5812){if(!_[_0x2dce('0x2b')](_0x3c5812)){for(var _0x2516d5 in _0x3c5812){if(_0x3c5812[_0x2dce('0x2a')](_0x2516d5)){_0x3c5812[_0x2516d5][_0x2dce('0x2c')]=0x0;}}}}function clearVoiceQueues(_0x36fba6){if(!_[_0x2dce('0x2b')](_0x36fba6)){for(var _0x353b15 in _0x36fba6){if(_0x36fba6['hasOwnProperty'](_0x353b15)){_0x36fba6[_0x353b15][_0x2dce('0x2c')]=0x0;_0x36fba6[_0x353b15][_0x2dce('0x2d')]=0x0;_0x36fba6[_0x353b15]['pTalking']=0x0;_0x36fba6[_0x353b15][_0x2dce('0x2e')]=0x0;_0x36fba6[_0x353b15][_0x2dce('0x2f')]=!![];}}}}function clearAgentBooked(_0x2ce1c3){if(!_['isEmpty'](_0x2ce1c3)){for(var _0x315294 in _0x2ce1c3){if(_0x2ce1c3[_0x2dce('0x2a')](_0x315294)){_0x2ce1c3[_0x315294]['unlockRR']=!![];}}}}VoiceQueueReport[_0x2dce('0x9')][_0x2dce('0x30')]=function(){var _0x28b330=this;for(var _0x535ff6 in this['channels']){if(this[_0x2dce('0xe')]['hasOwnProperty'](_0x535ff6)&&!this[_0x2dce('0xe')][_0x535ff6][_0x2dce('0x31')]){this['sequence'][_0x2dce('0xa')](function(){if(!_[_0x2dce('0x32')](_0x28b330[_0x2dce('0xe')][_0x535ff6])){return ami['Action']({'action':_0x2dce('0x33'),'channel':_0x28b330[_0x2dce('0xe')][_0x535ff6]['channel']})[_0x2dce('0x34')](function(_0x42d37c){if(_0x42d37c['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x28b330[_0x2dce('0xe')][_0x535ff6]){delete _0x28b330[_0x2dce('0xe')][_0x535ff6];logger[_0x2dce('0x35')](_0x2dce('0x36'),_0x535ff6);}if(_0x28b330[_0x2dce('0x37')][_0x535ff6]){delete _0x28b330[_0x2dce('0x37')][_0x535ff6];logger['error'](_0x2dce('0x38'),_0x535ff6);}if(_0x28b330[_0x2dce('0x39')][_0x535ff6]){delete _0x28b330[_0x2dce('0x39')][_0x535ff6];logger['error']('[voiceQueueReport][checkVariables]',_0x535ff6);}},0x1f40);}});}});}}};VoiceQueueReport['prototype']['syncFullyBooted']=function(){logger[_0x2dce('0x35')](_0x2dce('0x3a'));clearChannels(this[_0x2dce('0xe')]);this[_0x2dce('0x3b')](this[_0x2dce('0x37')]);clearAgentBooked(this[_0x2dce('0xd')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this[_0x2dce('0x3c')]);};VoiceQueueReport[_0x2dce('0x9')][_0x2dce('0x3b')]=function(_0x175f7a){var _0x219c25=this;if(!_[_0x2dce('0x2b')](_0x175f7a)){for(var _0xbec700 in _0x175f7a){if(_0x175f7a['hasOwnProperty'](_0xbec700)){_0x219c25[_0x2dce('0x3d')](_0x175f7a[_0xbec700]);delete _0x175f7a[_0xbec700];}}}};function loggerCatch(_0x52b6d1){return function(_0x5d67da){logger[_0x2dce('0x35')](_0x52b6d1,util[_0x2dce('0x3e')](_0x5d67da,{'showHidden':![],'depth':null}));};}VoiceQueueReport['prototype'][_0x2dce('0x3f')]=function(_0x386d4e,_0x1dc78f,_0x15e535){io['to'](_0x386d4e)[_0x2dce('0x3f')](_0x1dc78f,_0x15e535);};VoiceQueueReport[_0x2dce('0x9')][_0x2dce('0x40')]=function(_0x31201f){this['emit'](util['format'](_0x2dce('0x41'),_0x31201f[_0x2dce('0x42')]),'voice_queue_channel:save',_0x31201f);};VoiceQueueReport[_0x2dce('0x9')]['emitVoiceQueueChannelRemove']=function(_0x14c57a){logger[_0x2dce('0x43')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x2dce('0x44')](_0x14c57a));this[_0x2dce('0x3f')](util[_0x2dce('0x45')](_0x2dce('0x41'),_0x14c57a[_0x2dce('0x42')]),_0x2dce('0x46'),_0x14c57a);};VoiceQueueReport[_0x2dce('0x9')][_0x2dce('0x47')]=function(_0x1b767d){if(_0x1b767d['type']===_0x2dce('0x48')){var _0x44f4ca={'id':_0x1b767d['id'],'name':_0x1b767d['name'],'strategy':_0x1b767d[_0x2dce('0x49')],'answered':_0x1b767d['answered'],'available':_0x1b767d[_0x2dce('0x4a')],'loggedIn':_0x1b767d[_0x2dce('0x4b')],'pTalking':_0x1b767d[_0x2dce('0x4c')],'sumBillable':_0x1b767d[_0x2dce('0x4d')],'sumDuration':_0x1b767d[_0x2dce('0x4e')],'sumHoldTime':_0x1b767d['sumHoldTime']||0x0,'talking':_0x1b767d['talking'],'total':_0x1b767d[_0x2dce('0x4f')],'type':_0x1b767d[_0x2dce('0x50')],'unmanaged':_0x1b767d['unmanaged'],'abandoned':_0x1b767d[_0x2dce('0x51')],'waiting':_0x1b767d['waiting']};if(_0x1b767d[_0x2dce('0x52')]){_0x44f4ca[_0x2dce('0x52')]={'id':_0x1b767d[_0x2dce('0x52')]['id'],'name':_0x1b767d[_0x2dce('0x52')][_0x2dce('0x42')],'active':_0x1b767d[_0x2dce('0x52')][_0x2dce('0x53')],'callerid':_0x1b767d['Trunk'][_0x2dce('0x54')]};}if(_0x1b767d[_0x2dce('0x55')]){_0x44f4ca[_0x2dce('0x55')]={'id':_0x1b767d[_0x2dce('0x55')]['id'],'name':_0x1b767d[_0x2dce('0x55')][_0x2dce('0x42')]};}var _0x5cf92a=md5(JSON[_0x2dce('0x44')](_0x44f4ca));if(_0x1b767d['md5']!==_0x5cf92a){_0x1b767d[_0x2dce('0x3')]=_0x5cf92a;this[_0x2dce('0x3f')](util['format'](_0x2dce('0x41'),_0x44f4ca[_0x2dce('0x42')]),_0x2dce('0x56'),_0x44f4ca);}}};VoiceQueueReport[_0x2dce('0x9')][_0x2dce('0x57')]=function(_0x338a44){return _0x338a44!==null&&!_[_0x2dce('0x58')](_0x338a44);};VoiceQueueReport[_0x2dce('0x9')][_0x2dce('0x29')]=function(){var _0xe137ce=this;setInterval(function(){_0xe137ce['clearZombieChannels']();ami[_0x2dce('0x59')]({'action':'queues'})[_0x2dce('0x34')](loggerCatch(_0x2dce('0x5a')));},0x2710);};VoiceQueueReport[_0x2dce('0x9')][_0x2dce('0x28')]=function(){var _0x53b3d8=this;setInterval(function(){if(_0x53b3d8['flagQueueSummary']){return ami[_0x2dce('0x59')]({'action':_0x2dce('0x11')})[_0x2dce('0x5b')](function(_0x3e60a2){_0x53b3d8[_0x2dce('0x5c')]=![];})[_0x2dce('0x34')](loggerCatch(_0x2dce('0x5d')));}},0x3e8);};VoiceQueueReport[_0x2dce('0x9')][_0x2dce('0x12')]=function(_0x55be7e){try{if(this[_0x2dce('0x57')](_0x55be7e)&&this[_0x2dce('0x57')](_0x55be7e['queue'])){if(this[_0x2dce('0x10')][_0x55be7e[_0x2dce('0x5e')]]){var _0x30ee53=_[_0x2dce('0x5f')](this[_0x2dce('0xe')],_0x2dce('0x5e'))[_0x55be7e[_0x2dce('0x5e')]]||0x0;var _0x216035=_0x30ee53-_0x55be7e['callers'];if(this['voiceQueues'][_0x55be7e['queue']][_0x2dce('0x2e')]!==_[_0x2dce('0x60')](_0x55be7e['callers'])||this[_0x2dce('0x10')][_0x55be7e[_0x2dce('0x5e')]]['loggedIn']!==_[_0x2dce('0x60')](_0x55be7e['loggedin'])||this[_0x2dce('0x10')][_0x55be7e[_0x2dce('0x5e')]][_0x2dce('0x4a')]!==_[_0x2dce('0x60')](_0x55be7e[_0x2dce('0x4a')])||this[_0x2dce('0x10')][_0x55be7e[_0x2dce('0x5e')]][_0x2dce('0x2d')]!==_0x216035){this['voiceQueues'][_0x55be7e['queue']][_0x2dce('0x2e')]=_[_0x2dce('0x60')](_0x55be7e['callers']);this['voiceQueues'][_0x55be7e[_0x2dce('0x5e')]]['loggedIn']=_[_0x2dce('0x60')](_0x55be7e[_0x2dce('0x61')]);this[_0x2dce('0x10')][_0x55be7e['queue']][_0x2dce('0x4a')]=_['toNumber'](_0x55be7e[_0x2dce('0x4a')]);this[_0x2dce('0x10')][_0x55be7e[_0x2dce('0x5e')]]['talking']=_0x216035>0x0?_0x216035:0x0;this[_0x2dce('0x10')][_0x55be7e['queue']][_0x2dce('0x2d')]=this[_0x2dce('0x10')][_0x55be7e[_0x2dce('0x5e')]]['talking']>_[_0x2dce('0x60')](_0x55be7e['loggedin'])?_[_0x2dce('0x60')](_0x55be7e[_0x2dce('0x61')]):this[_0x2dce('0x10')][_0x55be7e[_0x2dce('0x5e')]][_0x2dce('0x2d')];this[_0x2dce('0x47')](this[_0x2dce('0x10')][_0x55be7e[_0x2dce('0x5e')]]);}ami[_0x2dce('0x3f')]('custom:queuesummary',this[_0x2dce('0x10')][_0x55be7e[_0x2dce('0x5e')]]);}}}catch(_0x4fe0d4){logger['error'](_0x2dce('0x62'),util[_0x2dce('0x3e')](_0x4fe0d4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2dce('0x9')][_0x2dce('0x14')]=function(_0x3ad151){this['flagQueueSummary']=!![];};VoiceQueueReport[_0x2dce('0x9')][_0x2dce('0x63')]=function(_0x4209be){};VoiceQueueReport[_0x2dce('0x9')][_0x2dce('0x16')]=function(_0x4da39c){try{if(this[_0x2dce('0x57')](_0x4da39c)){if(_[_0x2dce('0x58')](this[_0x2dce('0x37')][_0x4da39c[_0x2dce('0x64')]])){this[_0x2dce('0x37')][_0x4da39c[_0x2dce('0x64')]]=[];this[_0x2dce('0xe')][_0x4da39c[_0x2dce('0x64')]]={};}var _0x4a1448=new QueueReport();_0x4a1448[_0x2dce('0x42')]=_0x4da39c[_0x2dce('0x5e')];_0x4a1448[_0x2dce('0x50')]=this[_0x2dce('0x10')][_0x4a1448['name']]&&this[_0x2dce('0x10')][_0x4a1448[_0x2dce('0x42')]]['type']?this[_0x2dce('0x10')][_0x4a1448[_0x2dce('0x42')]]['type']||_0x2dce('0x48'):'inbound';_0x4a1448['queue']=_0x4da39c[_0x2dce('0x5e')];_0x4a1448[_0x2dce('0x65')]=moment()[_0x2dce('0x45')](_0x2dce('0x66'));_0x4a1448['position']=_0x4da39c[_0x2dce('0x67')];_0x4a1448[_0x2dce('0x68')]=_0x4da39c[_0x2dce('0x68')];_[_0x2dce('0x69')](_0x4a1448,_['pick'](_0x4da39c,_[_0x2dce('0x6a')](_0x4a1448)));this[_0x2dce('0x37')][_0x4da39c[_0x2dce('0x64')]][_0x2dce('0x6b')](_0x4a1448);this[_0x2dce('0xe')][_0x4da39c[_0x2dce('0x64')]]=_0x4a1448;this[_0x2dce('0x40')](_0x4a1448);}}catch(_0x297b34){logger[_0x2dce('0x35')](_0x2dce('0x6c'),util['inspect'](_0x297b34,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x2dce('0x6d')]=function(_0x4a8c5e){try{if(this['isNotNull'](_0x4a8c5e)){if(this[_0x2dce('0x37')][_0x4a8c5e[_0x2dce('0x64')]]){var _0x4416b3=_[_0x2dce('0x6e')](this[_0x2dce('0x37')][_0x4a8c5e[_0x2dce('0x64')]]);_0x4416b3['queuecallercomplete']=![];_0x4416b3[_0x2dce('0x6f')]=null;_0x4416b3['holdtime']=_0x4a8c5e[_0x2dce('0x70')];_0x4416b3[_0x2dce('0x71')]=_0x4a8c5e[_0x2dce('0x71')];_0x4416b3[_0x2dce('0x17')]=!![];_0x4416b3[_0x2dce('0x72')]=moment()[_0x2dce('0x45')](_0x2dce('0x66'));_0x4416b3['queuecallerexitreason']=_0x2dce('0x73');_0x4416b3[_0x2dce('0x74')]=null;this[_0x2dce('0xe')][_0x4a8c5e['uniqueid']]=_0x4416b3;this['emitVoiceQueueChannelRemove'](_0x4416b3);}}}catch(_0x13dfb8){logger[_0x2dce('0x35')](_0x2dce('0x75'),util[_0x2dce('0x3e')](_0x13dfb8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2dce('0x9')]['syncQueueCallerLeave']=function(_0x575cb2){try{if(this['isNotNull'](_0x575cb2)){if(this[_0x2dce('0x37')][_0x575cb2[_0x2dce('0x64')]]){var _0x306557=_[_0x2dce('0x6e')](this[_0x2dce('0x37')][_0x575cb2[_0x2dce('0x64')]]);_0x306557[_0x2dce('0x76')]=moment()[_0x2dce('0x45')](_0x2dce('0x66'));_0x306557[_0x2dce('0x77')]=_0x575cb2[_0x2dce('0x77')];_0x306557[_0x2dce('0x78')]=_0x575cb2[_0x2dce('0x78')];this[_0x2dce('0xe')][_0x575cb2[_0x2dce('0x64')]]=_0x306557;this[_0x2dce('0x40')](_0x306557);}}}catch(_0x5e89fd){logger[_0x2dce('0x35')](_0x2dce('0x79'),util[_0x2dce('0x3e')](_0x5e89fd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2dce('0x9')][_0x2dce('0x1b')]=function(_0x36e079){try{if(this['isNotNull'](_0x36e079)){if(this[_0x2dce('0x37')][_0x36e079[_0x2dce('0x64')]]){var _0x2024a8=_[_0x2dce('0x6e')](this[_0x2dce('0x37')][_0x36e079['uniqueid']]);_0x2024a8[_0x2dce('0x7a')]=!![];_0x2024a8[_0x2dce('0x7b')]=_0x2dce('0x7c');}}}catch(_0x4bd3d4){logger[_0x2dce('0x35')](_0x2dce('0x7d'),util[_0x2dce('0x3e')](_0x4bd3d4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2dce('0x9')][_0x2dce('0x7e')]=function(_0x1531fb){try{if(this[_0x2dce('0x57')](_0x1531fb)){if(this[_0x2dce('0x37')][_0x1531fb[_0x2dce('0x64')]]){var _0x18c16d=_[_0x2dce('0x6e')](this['queueReports'][_0x1531fb[_0x2dce('0x64')]]);_0x18c16d[_0x2dce('0x17')]=![];_0x18c16d['queuecallerabandonAt']=null;_0x18c16d['assigned']=!![];_0x18c16d['lastAssignedTo']=_0x1531fb[_0x2dce('0x7f')];_0x18c16d['holdtime']=_0x1531fb[_0x2dce('0x70')];_0x18c16d[_0x2dce('0x7a')]=!![];_0x18c16d[_0x2dce('0x80')]=![];_0x18c16d[_0x2dce('0x81')]=null;if(!_0x18c16d[_0x2dce('0x82')]){if(_0x1531fb[_0x2dce('0x83')]==_0x2dce('0x82')){_0x18c16d[_0x2dce('0x7b')]=_0x2dce('0x84');}else{if(_[_0x2dce('0x85')](_0x1531fb[_0x2dce('0x86')][_0x2dce('0x87')](),_0x2dce('0x88'))){if(this[_0x2dce('0x37')][_0x1531fb[_0x2dce('0x89')]]){var _0x236f38=_['last'](this[_0x2dce('0x37')][_0x1531fb[_0x2dce('0x89')]]);_0x236f38[_0x2dce('0x7a')]=![];_0x236f38[_0x2dce('0x80')]=!![];_0x236f38['queuecallerexitAt']=moment(_0x18c16d[_0x2dce('0x65')])['add'](_0x1531fb[_0x2dce('0x70')],_0x2dce('0x8a'))[_0x2dce('0x45')]('YYYY-MM-DD\x20HH:mm:ss');_0x236f38[_0x2dce('0x7b')]=_0x2dce('0x8b');_0x236f38['transfer']=!![];_0x236f38[_0x2dce('0x8c')]=_0x2dce('0x8d');_0x236f38['transferexten']=_0x1531fb[_0x2dce('0x8e')];_0x236f38[_0x2dce('0x8f')]=_0x1531fb[_0x2dce('0x64')];var _0xa02408=this[_0x2dce('0x37')][_0x1531fb[_0x2dce('0x89')]];this['queueReports'][_0x1531fb[_0x2dce('0x89')]]=this[_0x2dce('0x37')][_0x1531fb[_0x2dce('0x64')]];this[_0x2dce('0x37')][_0x1531fb[_0x2dce('0x64')]]=_0xa02408;}}else{_0x18c16d[_0x2dce('0x7b')]=_0x2dce('0x90')+_0x1531fb[_0x2dce('0x83')][_0x2dce('0x91')]();}}}this['channels'][_0x1531fb[_0x2dce('0x64')]]=_0x18c16d;this[_0x2dce('0x3d')](_0x18c16d);}}}catch(_0x3fa926){logger[_0x2dce('0x35')]('[syncAgentComplete][VoiceQueueReport]',util[_0x2dce('0x3e')](_0x3fa926,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2dce('0x9')][_0x2dce('0x1c')]=function(_0x5545e9){try{if(this[_0x2dce('0x57')](_0x5545e9)){this[_0x2dce('0x92')](_0x5545e9[_0x2dce('0x64')],_[_0x2dce('0x6a')](_0x5545e9[_0x2dce('0x93')])[0x0],_0x5545e9[_0x2dce('0x94')]);if(this['queueReports'][_0x5545e9[_0x2dce('0x64')]]){var _0x57e2fa=_['last'](this[_0x2dce('0x37')][_0x5545e9['uniqueid']]);if(_0x57e2fa){if(this['isNotNull'](_0x5545e9[_0x2dce('0x93')])&&this[_0x2dce('0x57')](_0x5545e9[_0x2dce('0x93')][_0x2dce('0x95')])){switch(_0x5545e9[_0x2dce('0x94')]){case _0x2dce('0x96'):_0x57e2fa['queuecallerexit']=![];_0x57e2fa[_0x2dce('0x81')]=null;break;default:_0x57e2fa[_0x2dce('0x80')]=!![];_0x57e2fa[_0x2dce('0x81')]=moment()[_0x2dce('0x45')]('YYYY-MM-DD\x20HH:mm:ss');_0x57e2fa[_0x2dce('0x76')]=moment()[_0x2dce('0x45')]('YYYY-MM-DD\x20HH:mm:ss');}_0x57e2fa[_0x2dce('0x17')]=![];_0x57e2fa['queuecallerabandonAt']=null;_0x57e2fa['queuecallerexitreason']=_0x5545e9['value'];this[_0x2dce('0xe')][_0x5545e9[_0x2dce('0x64')]]=_0x57e2fa;this[_0x2dce('0x3d')](_0x57e2fa);}else if(this[_0x2dce('0x57')](_0x5545e9['variable'])&&this[_0x2dce('0x57')](_0x5545e9[_0x2dce('0x93')][_0x2dce('0x97')])){if(!_0x57e2fa[_0x2dce('0x17')]){_0x57e2fa[_0x2dce('0x80')]=!![];_0x57e2fa[_0x2dce('0x81')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x57e2fa['queuecallerexitreason']=_0x2dce('0x98');_0x57e2fa['queuecallerleaveAt']=moment()['format'](_0x2dce('0x66'));this['channels'][_0x5545e9[_0x2dce('0x64')]]=_0x57e2fa;}}_0x57e2fa[_0x2dce('0x39')]=this[_0x2dce('0x39')][_0x5545e9[_0x2dce('0x64')]];}}}}catch(_0x1e0f59){logger['error'](_0x2dce('0x99'),util[_0x2dce('0x3e')](_0x1e0f59,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['addVariable']=function(_0x1ff7cc,_0x1068bd,_0x4e6c62){var _0x2bedd2=[_0x2dce('0x9a'),_0x2dce('0x9b'),'rtpaudioqosjitter',_0x2dce('0x9c'),_0x2dce('0x9d'),_0x2dce('0x9e'),_0x2dce('0x9f'),_0x2dce('0xa0'),_0x2dce('0xa1'),'sipuri',_0x2dce('0xa2'),'bridgepvtcallid',_0x2dce('0xa3'),_0x2dce('0xa4'),_0x2dce('0xa5'),'memberlastcall',_0x2dce('0x7f'),'memberpenalty',_0x2dce('0xa6')];if(!_[_0x2dce('0x32')](_0x1068bd)&&!_[_0x2dce('0xa7')](_0x2bedd2,_0x1068bd)){if(_[_0x2dce('0x58')](this[_0x2dce('0x39')][_0x1ff7cc])){this[_0x2dce('0x39')][_0x1ff7cc]={};}this[_0x2dce('0x39')][_0x1ff7cc][_0x1068bd]=_0x4e6c62;}};VoiceQueueReport['prototype'][_0x2dce('0x1e')]=function(_0x5062a3){try{if(this[_0x2dce('0x57')](_0x5062a3)){if(this[_0x2dce('0x37')][_0x5062a3[_0x2dce('0x64')]]){for(var _0x1a077f=0x0,_0x559e20={};_0x1a077f0x0?_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={};_0x4a9659=0x0?moment(_0xfe92bb[_0x4671('0x1b')])[_0x4671('0xf')](_0xfe92bb[_0x4671('0x1a')],_0x4671('0x10')):null,'data1':'outbound','data2':_0xfe92bb[_0x4671('0x15')],'data3':_0xfe92bb[_0x4671('0x12')],'data4':_0xfe92bb[_0x4671('0x1c')]||null,'role':_0x4671('0x14'),'internal':_0xfe92bb[_0x4671('0x15')]?_[_0x4671('0x16')](_0xfe92bb[_0x4671('0x15')]):undefined,'uniqueid':_0xfe92bb[_0x4671('0x1d')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x47b1=['queuecallerleaveAt','diff','seconds','calleridnum','exten','queue','agent','toNumber','accountcode','uniqueid','voiceDialReport','membername','starttime','endtime','dialstring','moment','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface','TALKING'];(function(_0x60ae6,_0x1bffd3){var _0x19227a=function(_0x19aed3){while(--_0x19aed3){_0x60ae6['push'](_0x60ae6['shift']());}};_0x19227a(++_0x1bffd3);}(_0x47b1,0x188));var _0x147b=function(_0x3ab9ce,_0x4e47ed){_0x3ab9ce=_0x3ab9ce-0x0;var _0x158cae=_0x47b1[_0x3ab9ce];return _0x158cae;};'use strict';var moment=require(_0x147b('0x0'));var _=require(_0x147b('0x1'));var util=require(_0x147b('0x2'));var client=require(_0x147b('0x3'));exports[_0x147b('0x4')]=function(_0x7db216){var _0x107106=_0x7db216[_0x147b('0x5')]||_0x7db216[_0x147b('0x6')];return client[_0x147b('0x7')](_0x147b('0x8'),{'body':{'channel':_0x147b('0x9'),'membername':_0x7db216[_0x147b('0xa')],'interface':_[_0x147b('0xb')](_0x7db216['interface'])?util['format']('SIP/%s',_0x7db216[_0x147b('0xa')]):_0x7db216[_0x147b('0xc')],'type':_0x147b('0xd'),'enterAt':_0x7db216[_0x147b('0xe')],'exitAt':_0x107106,'duration':moment(_0x107106)[_0x147b('0xf')](_0x7db216['queuecallerleaveAt'],_0x147b('0x10')),'data1':'inbound','data2':_0x7db216[_0x147b('0x11')],'data3':_0x7db216[_0x147b('0x12')],'data4':null,'data5':_0x7db216[_0x147b('0x13')],'role':_0x147b('0x14'),'internal':_0x7db216['accountcode']?_[_0x147b('0x15')](_0x7db216[_0x147b('0x16')]):undefined,'uniqueid':_0x7db216[_0x147b('0x17')]},'log':_0x147b('0x8')});};exports[_0x147b('0x18')]=function(_0xacd8b1){return client[_0x147b('0x7')](_0x147b('0x8'),{'body':{'channel':_0x147b('0x9'),'membername':_0xacd8b1[_0x147b('0x19')],'interface':_0xacd8b1['interface'],'type':_0x147b('0xd'),'enterAt':_0xacd8b1[_0x147b('0x1a')],'exitAt':_0xacd8b1['endtime'],'duration':moment(_0xacd8b1[_0x147b('0x1b')])[_0x147b('0xf')](_0xacd8b1['starttime'],'seconds')>=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 diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 9a00a11..cea7ab6 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 _0x94d2=['GetTemplate','name','Request'];(function(_0x39628c,_0x2eb8c4){var _0x2b0532=function(_0x87cc3b){while(--_0x87cc3b){_0x39628c['push'](_0x39628c['shift']());}};_0x2b0532(++_0x2eb8c4);}(_0x94d2,0x1cd));var _0x294d=function(_0x533528,_0x409d05){_0x533528=_0x533528-0x0;var _0x3189f1=_0x94d2[_0x533528];return _0x3189f1;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x30eae3){return function(_0x47eb33){return client[_0x294d('0x0')](_0x294d('0x1'),{'options':{'raw':!![],'attributes':['id',_0x294d('0x2'),'html']},'log':'GetTemplate'});};}; \ No newline at end of file +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 diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 97594d9..caf0e94 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 _0xefe3=['Actions','data1','data2','data3','data4','data5','data6','../client','Request','GetTrigger','name','channel','Condition','field','value','AnyConditions','operator'];(function(_0x538ac2,_0x134918){var _0x849d5b=function(_0xd6ad8c){while(--_0xd6ad8c){_0x538ac2['push'](_0x538ac2['shift']());}};_0x849d5b(++_0x134918);}(_0xefe3,0xf5));var _0x3efe=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xefe3[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x3efe('0x0'));exports['getTriggers']=function(_0x5b1924){return function(_0x4c4932){return client[_0x3efe('0x1')](_0x3efe('0x2'),{'options':{'raw':![],'attributes':['id',_0x3efe('0x3'),_0x3efe('0x4'),'status'],'include':[{'model':_0x3efe('0x5'),'as':'AllConditions','attributes':['id',_0x3efe('0x6'),'operator',_0x3efe('0x7')]},{'model':_0x3efe('0x5'),'as':_0x3efe('0x8'),'attributes':['id',_0x3efe('0x6'),_0x3efe('0x9'),_0x3efe('0x7')]},{'model':'Action','as':_0x3efe('0xa'),'attributes':['id','action',_0x3efe('0xb'),_0x3efe('0xc'),_0x3efe('0xd'),_0x3efe('0xe'),_0x3efe('0xf'),_0x3efe('0x10'),'data7']}]},'log':'GetTrigger'});};}; \ No newline at end of file +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 diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 4aeb8ce..4c8448d 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 _0x67a7=['GetTrunk','name','registry','../client','getTrunks','Request'];(function(_0x2a27b3,_0x2f80fd){var _0x1a0c36=function(_0x4fc296){while(--_0x4fc296){_0x2a27b3['push'](_0x2a27b3['shift']());}};_0x1a0c36(++_0x2f80fd);}(_0x67a7,0x165));var _0x767a=function(_0x44bd3a,_0x2d3b79){_0x44bd3a=_0x44bd3a-0x0;var _0x1ed9d6=_0x67a7[_0x44bd3a];return _0x1ed9d6;};'use strict';var client=require(_0x767a('0x0'));exports[_0x767a('0x1')]=function(_0x53f241){return function(_0x45cdce){return client[_0x767a('0x2')](_0x767a('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x767a('0x4'),_0x767a('0x5')]},'log':_0x767a('0x3')});};}; \ No newline at end of file +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 diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index bb596ab..cf04e4c 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 _0x533b=['getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','phone','mobile','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','ShowUser','agent','email','lastPauseAt','voicePause','../client'];(function(_0x6593c5,_0x49a255){var _0x28761f=function(_0xd8f2d0){while(--_0xd8f2d0){_0x6593c5['push'](_0x6593c5['shift']());}};_0x28761f(++_0x49a255);}(_0x533b,0x89));var _0xb533=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x533b[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xb533('0x0'));exports[_0xb533('0x1')]=function(){return function(){return client[_0xb533('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0xb533('0x3'),'email',_0xb533('0x4'),_0xb533('0x5'),_0xb533('0x6'),_0xb533('0x7'),_0xb533('0x8'),'lastPauseAt','voicePause',_0xb533('0x9'),_0xb533('0xa'),'interface']},'log':_0xb533('0x1')});};};exports[_0xb533('0xb')]=function(){return function(){return client['Request'](_0xb533('0xc'),{'options':{'raw':!![],'where':{'role':_0xb533('0xd')},'attributes':['id',_0xb533('0x3'),_0xb533('0x4'),'internal']},'log':_0xb533('0xb')});};};exports[_0xb533('0xe')]=function(_0xc127ec,_0x4d8704,_0x442e55){return client[_0xb533('0x2')](_0xb533('0xf'),{'body':{'type':_0x4d8704,'uniqueid':_0x442e55},'options':{'where':{'id':_0xc127ec['id']}},'log':_0xb533('0xe')});};exports[_0xb533('0x10')]=function(_0x1c0e9d){return client[_0xb533('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x1c0e9d['id']}},'log':_0xb533('0xe')});};exports[_0xb533('0x11')]=function(_0x5ad41d){return client['Request'](_0xb533('0x12'),{'options':{'raw':![],'where':{'role':_0xb533('0x13'),'id':_0x5ad41d},'attributes':['id',_0xb533('0x3'),_0xb533('0x14'),_0xb533('0x4'),'fullname',_0xb533('0x6'),'lastLoginAt',_0xb533('0x8'),_0xb533('0x15'),_0xb533('0x16'),'interface']},'log':_0xb533('0x11')});}; \ No newline at end of file +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 diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index fe156e6..86eab6e 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 _0x7d22=['CreateVoiceAgentReport','Request','UpdateVoiceAgentReport','../client','create'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x7d22,0x1cf));var _0x27d2=function(_0x913f30,_0xebe5c6){_0x913f30=_0x913f30-0x0;var _0x216199=_0x7d22[_0x913f30];return _0x216199;};'use strict';var client=require(_0x27d2('0x0'));exports[_0x27d2('0x1')]=function(_0x2c3e66){return client['Request'](_0x27d2('0x2'),{'body':_0x2c3e66,'log':_0x27d2('0x2')});};exports['update']=function(_0x52e3f4,_0x2e5901,_0x47fb76){return client[_0x27d2('0x3')](_0x27d2('0x4'),{'body':_0x52e3f4,'options':{'where':{'uniqueid':_0x2e5901,'interface':_0x47fb76,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +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 diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index f736a38..12e8835 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 _0xc195=['startOf','day','YYYY-MM-DD\x20HH:mm:ss','format','type','disposition','billableseconds','../client','create','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','Request','GetVoiceCallReport','outbound'];(function(_0x5405da,_0x5211a4){var _0x51faee=function(_0x4c446a){while(--_0x4c446a){_0x5405da['push'](_0x5405da['shift']());}};_0x51faee(++_0x5211a4);}(_0xc195,0x8c));var _0x5c19=function(_0x1c06f4,_0x2feba6){_0x1c06f4=_0x1c06f4-0x0;var _0x1a727e=_0xc195[_0x1c06f4];return _0x1a727e;};'use strict';var moment=require('moment');var util=require('util');var _=require('lodash');var client=require(_0x5c19('0x0'));exports[_0x5c19('0x1')]=function(_0x1a785c){return client['Request'](_0x5c19('0x2'),{'body':_[_0x5c19('0x3')](_0x1a785c,{'source':_0x1a785c[_0x5c19('0x4')],'destinationcontext':_0x1a785c[_0x5c19('0x5')],'callerid':_0x1a785c[_0x5c19('0x6')],'amaflags':_0x5c19('0x7')}),'log':_0x5c19('0x2')});};exports[_0x5c19('0x8')]=function(){return function(){return client[_0x5c19('0x9')](_0x5c19('0xa'),{'options':{'where':{'type':[_0x5c19('0xb')],'createdAt':{'$between':[moment()[_0x5c19('0xc')](_0x5c19('0xd'))['format'](_0x5c19('0xe')),moment()['endOf'](_0x5c19('0xd'))[_0x5c19('0xf')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x5c19('0x10'),_0x5c19('0x11'),'duration',_0x5c19('0x12')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +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 diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 5507b26..9030db1 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 _0x122e=['create','Request','CreateVoiceDialReport','../client'];(function(_0x557d11,_0x4a8be8){var _0x1198c2=function(_0x23bc24){while(--_0x23bc24){_0x557d11['push'](_0x557d11['shift']());}};_0x1198c2(++_0x4a8be8);}(_0x122e,0x103));var _0xe122=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x122e[_0x2641f9];return _0x585741;};'use strict';var client=require(_0xe122('0x0'));exports[_0xe122('0x1')]=function(_0x5311ae){return client[_0xe122('0x2')](_0xe122('0x3'),{'body':_0x5311ae,'log':_0xe122('0x3')});}; \ No newline at end of file +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 diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index e584b43..f9511e6 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 _0x4e52=['../client','getVoiceExtensions','Request','GetVoiceExtension','exten'];(function(_0x1a5140,_0x3cf13c){var _0x4747c6=function(_0x5b326a){while(--_0x5b326a){_0x1a5140['push'](_0x1a5140['shift']());}};_0x4747c6(++_0x3cf13c);}(_0x4e52,0x6e));var _0x24e5=function(_0x8e4447,_0x59d25a){_0x8e4447=_0x8e4447-0x0;var _0xbe1cb8=_0x4e52[_0x8e4447];return _0xbe1cb8;};'use strict';var client=require(_0x24e5('0x0'));exports[_0x24e5('0x1')]=function(){return function(){return client[_0x24e5('0x2')](_0x24e5('0x3'),{'options':{'raw':!![],'attributes':['id',_0x24e5('0x4'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x24e5('0x1')});};}; \ No newline at end of file +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 diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 3b628ca..2f22f0a 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 _0x0e5b=['dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','Pause','name','callerid','active','Interval','interval','getVoiceQueues','Request','GetVoiceQueue','acw','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0e5b,0x95));var _0xb0e5=function(_0x112e0c,_0x3994c2){_0x112e0c=_0x112e0c-0x0;var _0x3153b3=_0x0e5b[_0x112e0c];return _0x3153b3;};'use strict';var client=require('../client');exports['getVoiceQueues']=function(){return function(){return client[_0xb0e5('0x0')](_0xb0e5('0x1'),{'options':{'raw':![],'attributes':['id','name',_0xb0e5('0x2'),'acwTimeout',_0xb0e5('0x3'),_0xb0e5('0x4'),_0xb0e5('0x5'),_0xb0e5('0x6'),_0xb0e5('0x7'),_0xb0e5('0x8'),_0xb0e5('0x9'),_0xb0e5('0xa'),_0xb0e5('0xb'),_0xb0e5('0xc'),'dialPredictiveInterval',_0xb0e5('0xd'),_0xb0e5('0xe'),_0xb0e5('0xf'),_0xb0e5('0x10'),_0xb0e5('0x11'),_0xb0e5('0x12'),_0xb0e5('0x13'),_0xb0e5('0x14'),'dialBusyMaxRetry','dialBusyRetryFrequency',_0xb0e5('0x15'),_0xb0e5('0x16'),_0xb0e5('0x17'),_0xb0e5('0x18'),_0xb0e5('0x19'),_0xb0e5('0x1a'),'dialCheckDuplicateType','dialAMDActive',_0xb0e5('0x1b'),'dialAMDGreeting',_0xb0e5('0x1c'),_0xb0e5('0x1d'),'dialAMDMinWordLength',_0xb0e5('0x1e'),_0xb0e5('0x1f'),_0xb0e5('0x20'),'dialAMDMaximumWordLength',_0xb0e5('0x21'),_0xb0e5('0x22'),_0xb0e5('0x23'),'dialOrderByScheduledAt',_0xb0e5('0x24'),_0xb0e5('0x25'),_0xb0e5('0x26'),_0xb0e5('0x4'),'strategy','dialRandomLastDigitCallerIdNumber',_0xb0e5('0x27'),_0xb0e5('0x28'),_0xb0e5('0x29'),_0xb0e5('0x2a'),_0xb0e5('0x2b'),_0xb0e5('0x2c'),_0xb0e5('0x2d'),_0xb0e5('0x2e'),'dialMachineRetryFrequency',_0xb0e5('0x2f'),_0xb0e5('0x30'),_0xb0e5('0x31'),_0xb0e5('0x32'),_0xb0e5('0x33')],'include':[{'model':_0xb0e5('0x34'),'as':_0xb0e5('0x34'),'attributes':['id','name','callerid','active']},{'model':_0xb0e5('0x35'),'as':'mandatoryDispositionPause','attributes':['id',_0xb0e5('0x36')]},{'model':_0xb0e5('0x34'),'as':'TrunkBackup','attributes':['id',_0xb0e5('0x36'),_0xb0e5('0x37'),_0xb0e5('0x38')]},{'model':_0xb0e5('0x39'),'as':_0xb0e5('0x39'),'attributes':['id',_0xb0e5('0x36')],'include':[{'model':_0xb0e5('0x39'),'as':'Intervals','attributes':['id',_0xb0e5('0x36'),_0xb0e5('0x3a')]}]}]},'log':_0xb0e5('0x3b')});};}; \ No newline at end of file +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 diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 82171cb..ff53d62 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 _0x17fa=['queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','../client','create','Request','CreateVoiceQueueReport','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete'];(function(_0x177938,_0x119e07){var _0x5d289b=function(_0x1f7e94){while(--_0x1f7e94){_0x177938['push'](_0x177938['shift']());}};_0x5d289b(++_0x119e07);}(_0x17fa,0x13a));var _0xa17f=function(_0x19e9cc,_0x579907){_0x19e9cc=_0x19e9cc-0x0;var _0x47c240=_0x17fa[_0x19e9cc];return _0x47c240;};'use strict';var moment=require(_0xa17f('0x0'));var _=require(_0xa17f('0x1'));var client=require(_0xa17f('0x2'));exports[_0xa17f('0x3')]=function(_0x45f871){return client[_0xa17f('0x4')](_0xa17f('0x5'),{'body':_0x45f871,'log':'CreateVoiceQueueReport'});};exports['getVoiceQueueReports']=function(){return function(){return client[_0xa17f('0x4')](_0xa17f('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xa17f('0x7')]('day')[_0xa17f('0x8')](_0xa17f('0x9')),moment()[_0xa17f('0xa')](_0xa17f('0xb'))[_0xa17f('0x8')](_0xa17f('0x9'))]}},'attributes':['uniqueid',_0xa17f('0xc'),_0xa17f('0xd'),_0xa17f('0xe'),_0xa17f('0xf'),_0xa17f('0x10'),_0xa17f('0x11'),_0xa17f('0x12'),_0xa17f('0x13'),_0xa17f('0x14')]},'log':_0xa17f('0x15')});};}; \ No newline at end of file +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 diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 757b290..1bee035 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 _0x1e68=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x1e68,0x1d0));var _0x81e6=function(_0x22f9cb,_0x4cae74){_0x22f9cb=_0x22f9cb-0x0;var _0x47dd6e=_0x1e68[_0x22f9cb];return _0x47dd6e;};'use strict';var client=require(_0x81e6('0x0'));exports[_0x81e6('0x1')]=function(_0xcf4f21){return function(){return client[_0x81e6('0x2')](_0x81e6('0x3'),{'options':{'where':{'VoiceQueueId':_0xcf4f21,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +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 diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 2cf6c6e..3ba8d7b 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 _0xda6a=['CreateVoiceRecording','lodash','../client','Request','merge','monitorFilename'];(function(_0x9b0317,_0x54b09b){var _0x296a3b=function(_0x497e61){while(--_0x497e61){_0x9b0317['push'](_0x9b0317['shift']());}};_0x296a3b(++_0x54b09b);}(_0xda6a,0x1ab));var _0xada6=function(_0x15c993,_0xabc0b9){_0x15c993=_0x15c993-0x0;var _0x54a7de=_0xda6a[_0x15c993];return _0x54a7de;};'use strict';var _=require(_0xada6('0x0'));var client=require(_0xada6('0x1'));exports['create']=function(_0x1c00f8){return client[_0xada6('0x2')]('CreateVoiceRecording',{'body':_[_0xada6('0x3')](_0x1c00f8,{'value':_0x1c00f8[_0xada6('0x4')]}),'log':_0xada6('0x5')});}; \ No newline at end of file +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 diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 4ad5cc6..600868c 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 _0x8f36=['extension','blind','attendedTransfer','Request','result','origtransfererchannel','secondtransfererconnectedlinename','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','blindTransfer','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x8f36,0xa7));var _0x68f3=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x8f36[_0x167cc1];return _0x10bc4b;};'use strict';var client=require(_0x68f3('0x0'));exports[_0x68f3('0x1')]=function(_0x366824){return client['Request'](_0x68f3('0x2'),{'body':{'result':_0x366824['result'],'transfererchannel':_0x366824[_0x68f3('0x3')],'transferercalleridnum':_0x366824[_0x68f3('0x4')],'transferercalleridname':_0x366824[_0x68f3('0x5')],'transfererconnectedlinenum':_0x366824[_0x68f3('0x6')],'transfererconnectedlinename':_0x366824[_0x68f3('0x7')],'transfereraccountcode':_0x366824['transfereraccountcode'],'transferercontext':_0x366824[_0x68f3('0x8')],'transfererexten':_0x366824[_0x68f3('0x9')],'transfererlinkedid':_0x366824['transfererlinkedid'],'transfereechannel':_0x366824[_0x68f3('0xa')],'transfereecalleridnum':_0x366824[_0x68f3('0xb')],'transfereecalleridname':_0x366824[_0x68f3('0xc')],'transfereeconnectedlinenum':_0x366824['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x366824[_0x68f3('0xd')],'transfereeaccountcode':_0x366824[_0x68f3('0xe')],'transfereecontext':_0x366824['transfereecontext'],'transfereeexten':_0x366824[_0x68f3('0xf')],'transfereelinkedid':_0x366824[_0x68f3('0x10')],'isexternal':_0x366824[_0x68f3('0x11')],'context':_0x366824['context'],'extension':_0x366824[_0x68f3('0x12')],'type':_0x68f3('0x13')},'log':_0x68f3('0x2')});};exports[_0x68f3('0x14')]=function(_0x263140){return client[_0x68f3('0x15')]('CreateVoiceTransferReport',{'body':{'result':_0x263140[_0x68f3('0x16')],'transfererchannel':_0x263140[_0x68f3('0x17')],'transferercalleridnum':_0x263140['origtransferercalleridnum'],'transferercalleridname':_0x263140['origtransferercalleridname'],'transfererconnectedlinenum':_0x263140['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x263140[_0x68f3('0x18')],'transfereraccountcode':_0x263140['origtransfereraccountcode'],'transferercontext':_0x263140[_0x68f3('0x19')],'transfererexten':_0x263140['secondtransfererexten'],'transfererlinkedid':_0x263140[_0x68f3('0x1a')],'transfereechannel':_0x263140[_0x68f3('0x1b')],'transfereecalleridnum':_0x263140['transfertargetcalleridnum'],'transfereecalleridname':_0x263140[_0x68f3('0x1c')],'transfereeconnectedlinenum':_0x263140[_0x68f3('0x1d')],'transfereeconnectedlinename':_0x263140[_0x68f3('0x1e')],'transfereeaccountcode':_0x263140['transfertargetaccountcode'],'transfereecontext':_0x263140[_0x68f3('0x1f')],'transfereeexten':_0x263140[_0x68f3('0x20')],'transfereelinkedid':_0x263140[_0x68f3('0x21')],'isexternal':_0x263140[_0x68f3('0x11')],'context':_0x263140[_0x68f3('0x22')],'extension':_0x263140[_0x68f3('0x23')],'type':_0x68f3('0x24')},'log':_0x68f3('0x2')});}; \ No newline at end of file +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 diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index f4437e0..2d592b0 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 _0xadc6=['outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','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','format','%s.%s','wav','MixMonitor','channel','ai(mixmonitorid)','find','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','Channel\x20doesn\x27t\x20exist','validate','resolve','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','util','jayson/promise','bluebird','moment','../ami','listen','%s/%s','SIP','name','timers','timer','updateAcw','agents','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','pick','module','action','then','message','catch','join','command','Action','content','voiceQueues','hasOwnProperty','strategy','answered','available','sumHoldTime','talking','total','type','abandoned','waiting'];(function(_0x148879,_0x5b4c11){var _0x4f7027=function(_0xad056b){while(--_0xad056b){_0x148879['push'](_0x148879['shift']());}};_0x4f7027(++_0x5b4c11);}(_0xadc6,0x1df));var _0x6adc=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xadc6[_0x42245d];return _0x4b211a;};'use strict';var _=require('lodash');var util=require(_0x6adc('0x0'));var jayson=require(_0x6adc('0x1'));var schema=require('validate');var BPromise=require(_0x6adc('0x2'));var moment=require(_0x6adc('0x3'));var config=require('../../../config/environment');var properties=require('../properties');var ami=require(_0x6adc('0x4'));exports[_0x6adc('0x5')]=function(_0xdcf85a,_0x20b47b,_0x9582d8){return new BPromise(function(_0x57eb4f,_0x13be1b){var _0x7a4357={'QueuePause':function(_0x49a596){return new Promise(function(_0x37682a,_0x4cdbd9){var _0x4ef001=util['format'](_0x6adc('0x6'),_0x6adc('0x7'),_0x49a596[_0x6adc('0x8')]);if(_0xdcf85a['timers']&&_0xdcf85a[_0x6adc('0x9')][_0x4ef001]&&_0xdcf85a['timers'][_0x4ef001][_0x6adc('0xa')]){_0xdcf85a[_0x6adc('0x9')][_0x4ef001][_0x6adc('0xb')]();}if(_0xdcf85a[_0x6adc('0xc')][_0x4ef001]){_0xdcf85a[_0x6adc('0xc')][_0x4ef001]['updateStatusRealtime']({'statePause':_0x49a596[_0x6adc('0xd')]?!![]:![]});}_0x37682a({'code':0xc8,'message':_0x6adc('0xe')});});},'Reload':function(_0x2d00a3){var _0x11f9f5=this;return new Promise(function(_0x33ba84,_0x169e3a){if(ami[_0x6adc('0xf')]()==![]){return _0x169e3a(_0x11f9f5[_0x6adc('0x10')](0x1f4,[config[_0x6adc('0x11')]['ip'],config[_0x6adc('0x11')][_0x6adc('0x12')],_0x6adc('0x13')]['join']('\x20')));}_0x2d00a3=_[_0x6adc('0x14')](_0x2d00a3,_['keys'](properties[_0x6adc('0x15')]));_0x2d00a3[_0x6adc('0x16')]='Reload';return ami['Action'](_0x2d00a3)[_0x6adc('0x17')](function(_0x4c2e87){_0x33ba84({'code':0xc8,'message':_0x4c2e87[_0x6adc('0x18')]});})[_0x6adc('0x19')](function(_0x262d90){_0x169e3a(_0x11f9f5['error'](0x1f5,_0x262d90[_0x6adc('0x18')]));});});},'Command':function(_0x3aba9e){var _0x5e935b=this;return new Promise(function(_0x3e0d4b,_0x9c646){if(ami[_0x6adc('0xf')]()==![]){return _0x9c646(_0x5e935b[_0x6adc('0x10')](0x1f4,[config[_0x6adc('0x11')]['ip'],config[_0x6adc('0x11')][_0x6adc('0x12')],_0x6adc('0x13')][_0x6adc('0x1a')]('\x20')));}_0x3aba9e=_['pick'](_0x3aba9e,_0x6adc('0x1b'));_0x3aba9e[_0x6adc('0x16')]='Command';return ami[_0x6adc('0x1c')](_0x3aba9e)[_0x6adc('0x17')](function(_0x54f369){_0x3e0d4b({'code':0xc8,'message':_0x54f369[_0x6adc('0x1d')]});})[_0x6adc('0x19')](function(_0x28c1c6){_0x9c646(_0x5e935b[_0x6adc('0x10')](0x1f5,_0x28c1c6[_0x6adc('0x18')]));});});},'VoiceQueues':function(_0x30cce5){return new Promise(function(_0x556d2e,_0x5286f6){var _0x33fbdf=[];for(var _0xb93e34 in _0xdcf85a['voiceQueues']){if(_0xdcf85a[_0x6adc('0x1e')][_0x6adc('0x1f')](_0xb93e34)){var _0x34cb50=_0xdcf85a['voiceQueues'][_0xb93e34];var _0x1f3e83={'id':_0x34cb50['id'],'name':_0x34cb50[_0x6adc('0x8')],'strategy':_0x34cb50[_0x6adc('0x20')],'answered':_0x34cb50[_0x6adc('0x21')],'available':_0x34cb50[_0x6adc('0x22')],'loggedIn':_0x34cb50['loggedIn'],'pTalking':_0x34cb50['pTalking'],'sumBillable':_0x34cb50['sumBillable'],'sumDuration':_0x34cb50['sumDuration'],'sumHoldTime':_0x34cb50[_0x6adc('0x23')]||0x0,'talking':_0x34cb50[_0x6adc('0x24')],'total':_0x34cb50[_0x6adc('0x25')],'type':_0x34cb50[_0x6adc('0x26')],'unmanaged':_0x34cb50['unmanaged'],'abandoned':_0x34cb50[_0x6adc('0x27')],'waiting':_0x34cb50[_0x6adc('0x28')],'loggedInDb':_0x34cb50['loggedInDb']};if(_0x34cb50[_0x6adc('0x26')]===_0x6adc('0x29')){_0x1f3e83[_0x6adc('0x2a')]=_0x34cb50[_0x6adc('0x2a')];_0x1f3e83[_0x6adc('0x2b')]=_0x34cb50[_0x6adc('0x2b')];_0x1f3e83['dialOriginateCallerIdName']=_0x34cb50[_0x6adc('0x2c')];_0x1f3e83['dialOriginateCallerIdNumber']=_0x34cb50['dialOriginateCallerIdNumber'];_0x1f3e83['dialOriginateTimeout']=_0x34cb50[_0x6adc('0x2d')];_0x1f3e83['dialPrefix']=_0x34cb50[_0x6adc('0x2e')];_0x1f3e83['outboundAnswerAgiCallsDay']=_0x34cb50['outboundAnswerAgiCallsDay'];_0x1f3e83['outboundAnswerCallsDay']=_0x34cb50[_0x6adc('0x2f')];_0x1f3e83[_0x6adc('0x30')]=_0x34cb50[_0x6adc('0x30')];_0x1f3e83['outboundBusyCallsDay']=_0x34cb50[_0x6adc('0x31')];_0x1f3e83[_0x6adc('0x32')]=_0x34cb50[_0x6adc('0x32')];_0x1f3e83[_0x6adc('0x33')]=_0x34cb50[_0x6adc('0x33')];_0x1f3e83['outboundDropCallsDayCallersExit']=_0x34cb50['outboundDropCallsDayCallersExit'];_0x1f3e83[_0x6adc('0x34')]=_0x34cb50[_0x6adc('0x34')];_0x1f3e83['outboundNoAnswerCallsDay']=_0x34cb50['outboundNoAnswerCallsDay'];_0x1f3e83[_0x6adc('0x35')]=_0x34cb50[_0x6adc('0x35')];_0x1f3e83['outboundOriginateFailureCallsDay']=_0x34cb50['outboundOriginateFailureCallsDay'];_0x1f3e83['outboundReCallsDay']=_0x34cb50[_0x6adc('0x36')];_0x1f3e83['outboundRejectCallsDay']=_0x34cb50[_0x6adc('0x37')];_0x1f3e83[_0x6adc('0x38')]=_0x34cb50[_0x6adc('0x38')];_0x1f3e83[_0x6adc('0x39')]=_0x34cb50[_0x6adc('0x39')];_0x1f3e83['predictiveIntervalAvgHoldtime']=_0x34cb50[_0x6adc('0x3a')];_0x1f3e83['predictiveIntervalAvgTalktime']=_0x34cb50[_0x6adc('0x3b')];_0x1f3e83[_0x6adc('0x3c')]=_0x34cb50['predictiveIntervalDroppedCallsCallersExit'];_0x1f3e83[_0x6adc('0x3d')]=_0x34cb50['predictiveIntervalDroppedCallsTimeout'];_0x1f3e83[_0x6adc('0x3e')]=_0x34cb50[_0x6adc('0x3e')];_0x1f3e83[_0x6adc('0x3f')]=_0x34cb50['predictiveIntervalErlangCallsDroppedCalls'];_0x1f3e83[_0x6adc('0x40')]=_0x34cb50['predictiveIntervalHitRate'];_0x1f3e83['predictiveIntervalMultiplicativeFactor']=_0x34cb50[_0x6adc('0x41')];_0x1f3e83[_0x6adc('0x42')]=_0x34cb50[_0x6adc('0x42')];_0x1f3e83[_0x6adc('0x43')]=_0x34cb50[_0x6adc('0x43')];_0x1f3e83['predictiveIntervalTotalCalls']=_0x34cb50[_0x6adc('0x44')];_0x1f3e83['message']=_0x34cb50[_0x6adc('0x18')];_0x1f3e83[_0x6adc('0x45')]=_0x34cb50[_0x6adc('0x45')];_0x1f3e83[_0x6adc('0x46')]=_0x34cb50[_0x6adc('0x46')];_0x1f3e83[_0x6adc('0x47')]=_0x34cb50['erlangCallToSecond'];_0x1f3e83[_0x6adc('0x48')]=_0x34cb50[_0x6adc('0x48')];_0x1f3e83['erlangBusyFactor']=_0x34cb50[_0x6adc('0x49')];_0x1f3e83[_0x6adc('0x4a')]=_0x34cb50[_0x6adc('0x4a')];_0x1f3e83[_0x6adc('0x4b')]=_0x34cb50[_0x6adc('0x4b')];}if(_0x34cb50[_0x6adc('0x4c')]){_0x1f3e83[_0x6adc('0x4c')]={'id':_0x34cb50[_0x6adc('0x4c')]['id'],'name':_0x34cb50[_0x6adc('0x4c')][_0x6adc('0x8')],'active':_0x34cb50[_0x6adc('0x4c')][_0x6adc('0x4d')],'callerid':_0x34cb50['Trunk'][_0x6adc('0x4e')]};}if(_0x34cb50[_0x6adc('0x4f')]){_0x1f3e83[_0x6adc('0x4f')]={'id':_0x34cb50[_0x6adc('0x4f')]['id'],'name':_0x34cb50['Interval'][_0x6adc('0x8')]};}_0x33fbdf[_0x6adc('0x50')](_0x1f3e83);}}_0x556d2e({'count':_0x33fbdf[_0x6adc('0x51')],'rows':_0x33fbdf});});},'VoiceChannels':function(_0x2ece42){return new Promise(function(_0x1b8627,_0x573e8a){var _0x58b9bf=_[_0x6adc('0x52')](_0xdcf85a[_0x6adc('0x53')]);_0x1b8627({'count':_0x58b9bf[_0x6adc('0x51')],'rows':_0x58b9bf});});},'VoiceChannelMixMonitor':function(_0xc0b6e2){var _0x8a21be=this;return new Promise(function(_0x239719,_0x5e0248){if(ami[_0x6adc('0xf')]()==![]){return _0x5e0248(_0x8a21be[_0x6adc('0x10')](0x1f4,[config[_0x6adc('0x11')]['ip'],config['asterisk'][_0x6adc('0x12')],_0x6adc('0x13')][_0x6adc('0x1a')]('\x20')));}var _0x4e33fb=schema(properties[_0x6adc('0x54')])['validate'](_0xc0b6e2);if(_0x4e33fb['length']>0x0){return _0x5e0248(_0x8a21be[_0x6adc('0x10')](0x1f4,_[_0x6adc('0x55')](_0x4e33fb,_0x6adc('0x18'))[_0x6adc('0x1a')](',\x20')));}var _0x259f97=_['find'](_0xdcf85a['channels'],{'uniqueid':_0xc0b6e2[_0x6adc('0x56')]});if(_0x259f97&&_0x259f97['channel']){var _0x35fd26=util[_0x6adc('0x57')](_0x6adc('0x58'),_0xc0b6e2['filename']||_0xc0b6e2[_0x6adc('0x56')],_0xc0b6e2[_0x6adc('0x57')]||_0x6adc('0x59'));return ami[_0x6adc('0x1c')]({'action':_0x6adc('0x5a'),'channel':_0x259f97[_0x6adc('0x5b')],'file':_0x35fd26,'options':_0x6adc('0x5c')})[_0x6adc('0x17')](function(_0xe63bc8){var _0x1b6e09=_[_0x6adc('0x5d')](_0x259f97[_0x6adc('0x5e')],{'filename':_0x6adc('0x5f')+_0x35fd26[_0x6adc('0x60')]()});if(_[_0x6adc('0x61')](_0x1b6e09)){_0x259f97[_0x6adc('0x5e')][_0x6adc('0x50')]({'filename':_0x6adc('0x5f')+_0x35fd26[_0x6adc('0x60')](),'createdAt':moment()[_0x6adc('0x57')](_0x6adc('0x62')),'mixmonitorid':_0xe63bc8[_0x6adc('0x63')],'status':'rec'});}else{_0x1b6e09[_0x6adc('0x63')]=_0xe63bc8[_0x6adc('0x63')];_0x1b6e09[_0x6adc('0x64')]='rec';}_0x239719({'code':0xc8,'message':[_0xc0b6e2[_0x6adc('0x56')],'MixMonitor\x20Success',_0xe63bc8[_0x6adc('0x63')]][_0x6adc('0x1a')]('\x20'),'mixmonitorid':_0xe63bc8['mixmonitorid']});})[_0x6adc('0x19')](function(_0x4fae0e){_0x5e0248(_0x8a21be['error'](0x1f5,[_0xc0b6e2[_0x6adc('0x56')],_0x4fae0e['message']['toLowerCase']()][_0x6adc('0x1a')]('\x20')));});}else{return _0x5e0248(_0x8a21be[_0x6adc('0x10')](0x1f5,_0x6adc('0x65')));}});},'VoiceChannelStopMixMonitor':function(_0x444c40){var _0xa1edd0=this;return new Promise(function(_0x41e667,_0x3a9dce){if(ami[_0x6adc('0xf')]()==![]){return _0x3a9dce(_0xa1edd0[_0x6adc('0x10')](0x1f4,[config[_0x6adc('0x11')]['ip'],config[_0x6adc('0x11')]['username'],'ami\x20disconnected'][_0x6adc('0x1a')]('\x20')));}var _0x25e9ca=schema(properties[_0x6adc('0x54')])[_0x6adc('0x66')](_0x444c40);if(_0x25e9ca[_0x6adc('0x51')]>0x0){return _0x3a9dce(_0xa1edd0[_0x6adc('0x10')](0x1f4,_[_0x6adc('0x55')](_0x25e9ca,_0x6adc('0x18'))[_0x6adc('0x1a')](',\x20')));}var _0x5de853=_['find'](_0xdcf85a['channels'],{'uniqueid':_0x444c40[_0x6adc('0x56')]});if(_0x5de853){return BPromise[_0x6adc('0x67')]()[_0x6adc('0x17')](function(){if(_0x5de853[_0x6adc('0x5b')]){return ami[_0x6adc('0x1c')]({'action':_0x6adc('0x68'),'channel':_0x5de853['channel'],'mixmonitorid':_0x444c40[_0x6adc('0x63')]})[_0x6adc('0x19')](function(_0x3d59f6){});}})['then'](function(){if(_0x5de853[_0x6adc('0x69')]){return ami[_0x6adc('0x1c')]({'action':_0x6adc('0x68'),'channel':_0x5de853[_0x6adc('0x69')],'mixmonitorid':_0x444c40[_0x6adc('0x63')]})[_0x6adc('0x19')](function(_0x45cab4){});}})['then'](function(_0x246bbd){var _0x27d60a=_['find'](_0x5de853['monitors'],{'mixmonitorid':_0x444c40['mixmonitorid']});if(_0x27d60a){_0x27d60a[_0x6adc('0x64')]=_0x6adc('0x6a');}})[_0x6adc('0x17')](function(){var _0x281902=util['format'](_0x6adc('0x58'),_0x444c40['filename']||_0x444c40[_0x6adc('0x56')],_0x444c40[_0x6adc('0x57')]||_0x6adc('0x59'));var _0x68c2c7=_[_0x6adc('0x5d')](_0x5de853['monitors'],{'filename':_0x6adc('0x5f')+_0x281902[_0x6adc('0x60')]()});if(_0x68c2c7){_0x68c2c7[_0x6adc('0x64')]='stop';}})[_0x6adc('0x17')](function(){_0x41e667({'code':0xc8,'message':[_0x444c40['uniqueid'],_0x6adc('0x6b')][_0x6adc('0x1a')]('\x20')});})[_0x6adc('0x19')](function(_0x1695c0){_0x3a9dce(_0xa1edd0[_0x6adc('0x10')](0x1f5,[_0x444c40[_0x6adc('0x56')],_0x1695c0[_0x6adc('0x18')][_0x6adc('0x60')]()][_0x6adc('0x1a')]('\x20')));});}else{return _0x3a9dce(_0xa1edd0[_0x6adc('0x10')](0x1f5,_0x6adc('0x65')));}});},'VoiceQueuesChannels':function(_0x23da91){return new Promise(function(_0x3c438d,_0x1952d1){var _0x53e0a4=_['values'](_0xdcf85a[_0x6adc('0x6c')]);_0x3c438d({'count':_0x53e0a4['length'],'rows':_0x53e0a4});});},'VoiceQueuesChannel':function(_0x576d39){var _0x50b5fd=this;return new Promise(function(_0x54ed2a,_0x474e00){var _0x420381=schema(properties[_0x6adc('0x6d')])[_0x6adc('0x66')](_0x576d39);if(_0x420381[_0x6adc('0x51')]>0x0){return _0x474e00(_0x50b5fd[_0x6adc('0x10')](0x1f4,_[_0x6adc('0x55')](_0x420381,_0x6adc('0x18'))['join'](',\x20')));}var _0x52447a=_[_0x6adc('0x5d')](_0xdcf85a[_0x6adc('0x6c')],{'uniqueid':_0x576d39[_0x6adc('0x56')]});if(_0x52447a){_0x54ed2a(_0x52447a);}else{return _0x474e00(_0x50b5fd[_0x6adc('0x10')](0x1f5,_0x6adc('0x65')));}});},'VoiceQueuesChannelHangup':function(_0x3d2a1f){var _0x43c676=this;return new Promise(function(_0x8dfbac,_0x50d8a3){if(ami[_0x6adc('0xf')]()==![]){return _0x50d8a3(_0x43c676[_0x6adc('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x6adc('0x11')][_0x6adc('0x12')],_0x6adc('0x13')][_0x6adc('0x1a')]('\x20')));}var _0x1df890=schema(properties['voicequeuechannelhangup'])[_0x6adc('0x66')](_0x3d2a1f);if(_0x1df890[_0x6adc('0x51')]>0x0){return _0x50d8a3(_0x43c676[_0x6adc('0x10')](0x1f4,_[_0x6adc('0x55')](_0x1df890,_0x6adc('0x18'))[_0x6adc('0x1a')](',\x20')));}var _0x74cbb9=_[_0x6adc('0x5d')](_0xdcf85a['queueChannels'],{'uniqueid':_0x3d2a1f[_0x6adc('0x56')]});if(_0x74cbb9&&_0x74cbb9[_0x6adc('0x5b')]){return ami[_0x6adc('0x1c')]({'action':_0x6adc('0x6e'),'channel':_0x74cbb9[_0x6adc('0x5b')]})[_0x6adc('0x17')](function(_0x13cb83){_0x8dfbac({'code':0xc8,'message':[_0x3d2a1f[_0x6adc('0x56')],_0x13cb83[_0x6adc('0x18')]['toLowerCase']()][_0x6adc('0x1a')]('\x20')});})[_0x6adc('0x19')](function(_0x4d7c19){_0x50d8a3(_0x43c676[_0x6adc('0x10')](0x1f5,[_0x3d2a1f[_0x6adc('0x56')],_0x4d7c19[_0x6adc('0x18')][_0x6adc('0x60')]()][_0x6adc('0x1a')]('\x20')));});}else{return _0x50d8a3(_0x43c676[_0x6adc('0x10')](0x1f5,_0x6adc('0x65')));}});},'VoiceQueuesChannelRedirect':function(_0x4f514d){var _0xfa29b5=this;return new Promise(function(_0x1b4eee,_0x49e7fb){if(ami[_0x6adc('0xf')]()==![]){return _0x49e7fb(_0xfa29b5[_0x6adc('0x10')](0x1f4,[config[_0x6adc('0x11')]['ip'],config[_0x6adc('0x11')][_0x6adc('0x12')],_0x6adc('0x13')][_0x6adc('0x1a')]('\x20')));}var _0x45b6f9=schema(properties[_0x6adc('0x6f')])[_0x6adc('0x66')](_0x4f514d);if(_0x45b6f9[_0x6adc('0x51')]>0x0){return _0x49e7fb(_0xfa29b5['error'](0x1f4,_[_0x6adc('0x55')](_0x45b6f9,_0x6adc('0x18'))[_0x6adc('0x1a')](',\x20')));}var _0x4bdb42=_[_0x6adc('0x5d')](_0xdcf85a[_0x6adc('0x6c')],{'uniqueid':_0x4f514d[_0x6adc('0x56')]});if(_0x4bdb42&&_0x4bdb42['channel']){return ami[_0x6adc('0x1c')]({'action':_0x6adc('0x70'),'channel':_0x4bdb42[_0x6adc('0x5b')],'exten':_0x4f514d[_0x6adc('0x71')],'context':_0x4f514d[_0x6adc('0x72')]||_0x4bdb42['context'],'priority':0x1})[_0x6adc('0x17')](function(_0x13353c){_0x1b4eee({'code':0xc8,'message':[_0x4f514d[_0x6adc('0x56')],_0x13353c[_0x6adc('0x18')][_0x6adc('0x60')]()][_0x6adc('0x1a')]('\x20')});})[_0x6adc('0x19')](function(_0x343233){_0x49e7fb(_0xfa29b5[_0x6adc('0x10')](0x1f5,[_0x4f514d[_0x6adc('0x56')],_0x343233[_0x6adc('0x18')]['toLowerCase']()][_0x6adc('0x1a')]('\x20')));});}else{return _0x49e7fb(_0xfa29b5['error'](0x1f5,_0x6adc('0x65')));}});},'Agents':function(_0x1c0341){return new Promise(function(_0x2a7ac5,_0x4f46bd){var _0x54a9d1=_[_0x6adc('0x52')](_0xdcf85a[_0x6adc('0xc')]);_0x2a7ac5({'count':_0x54a9d1[_0x6adc('0x51')],'rows':_0x54a9d1});});},'Telephones':function(_0x563dc6){return new Promise(function(_0x550b75,_0x388f28){var _0x87837b=_[_0x6adc('0x52')](_0xdcf85a[_0x6adc('0x73')]);_0x550b75({'count':_0x87837b['length'],'rows':_0x87837b});});},'Trunks':function(_0x577998){return new Promise(function(_0x237ca2,_0x4fb423){var _0xb3be7a=_[_0x6adc('0x52')](_0xdcf85a[_0x6adc('0x74')]);_0x237ca2({'count':_0xb3be7a[_0x6adc('0x51')],'rows':_0xb3be7a});});},'OutboundChannels':function(_0xe8649c){return new Promise(function(_0x2a3394,_0xe34094){var _0x302f2f=_[_0x6adc('0x52')](_0xdcf85a[_0x6adc('0x75')]);_0x2a3394({'count':_0x302f2f[_0x6adc('0x51')],'rows':_0x302f2f});});},'Outbound':function(_0x383966){return new Promise(function(_0x48a7f7,_0x2f3973){_0x48a7f7(_0xdcf85a[_0x6adc('0x29')]);});},'Campaigns':function(_0x4d55b4){return new Promise(function(_0x490b58,_0x155dc7){var _0x5312db=_[_0x6adc('0x52')](_0xdcf85a['campaigns']);_0x490b58({'count':_0x5312db[_0x6adc('0x51')],'rows':_0x5312db});});},'VoiceQueuesPreview':function(_0x56943c){var _0x393886=this;return new Promise(function(_0x28860,_0xa83917){_0x20b47b['run'](_0x56943c['id'])[_0x6adc('0x17')](function(_0x353041){_0x28860({'code':0xc8,'message':_0x353041['message']});})[_0x6adc('0x19')](function(_0x39c6da){_0xa83917(_0x393886[_0x6adc('0x10')](0x1f4,_0x39c6da[_0x6adc('0x18')]));});});},'EventManager':function(_0x59f9f2){var _0x4293a8=this;return new Promise(function(_0x135107,_0x46403a){if(!_0x59f9f2[_0x6adc('0x76')]){return _0x46403a(_0x4293a8['error'](0x1f4,_0x6adc('0x77')));}ami[_0x6adc('0x78')](_0x6adc('0x79')+_0x59f9f2[_0x6adc('0x76')],_0x59f9f2[_0x6adc('0x18')]);_0x135107({'code':0xc8,'message':_0x59f9f2});});},'FaxAccounts':function(_0x43e062){return new Promise(function(_0x15cd41,_0x5475a3){var _0x474a5f=_[_0x6adc('0x52')](_0xdcf85a[_0x6adc('0x7a')]);_0x15cd41({'count':_0x474a5f['length'],'rows':_0x474a5f});});},'SendFax':function(_0x24ff55){var _0x5d9f38=this;return new Promise(function(_0x2d6ef9,_0x4151cb){_0x9582d8[_0x6adc('0x7b')](_0x24ff55)[_0x6adc('0x17')](function(_0x302a68){_0x2d6ef9({'code':0xc8,'message':_0x302a68[_0x6adc('0x18')]});})[_0x6adc('0x19')](function(_0x51ebd3){_0x4151cb(_0x5d9f38[_0x6adc('0x10')](0x1f4,_0x51ebd3['message']));});});},'CheckAfterSend':function(_0x3cee17){var _0x1a9d56=this;return new Promise(function(_0x4d6ace,_0x1bc6bc){_0x9582d8[_0x6adc('0x7c')](_0x3cee17)[_0x6adc('0x17')](function(_0x123a11){_0x4d6ace({'code':0xc8,'message':_0x123a11['message']});})[_0x6adc('0x19')](function(_0x44702e){_0x1bc6bc(_0x1a9d56[_0x6adc('0x10')](0x1f4,_0x44702e['message']));});});}};var _0xa10e15=jayson[_0x6adc('0x7d')](_0x7a4357)[_0x6adc('0x7e')]();_0xa10e15['on']('error',function(_0x47640c){return _0x13be1b(_0x47640c);});_0xa10e15[_0x6adc('0x5')](0x232a,_0x6adc('0x7f'),function(){console[_0x6adc('0x80')](_0x6adc('0x81'),0x232a);return _0x57eb4f('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +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 diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 2f23044..cc55639 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 _0x3419=['data1','isNil','routeId','firstName','calleridname','','uniqueid','destcalleridname','destcalleridnum','phone','resolve','then','showContact','omit','xmd-contactid2','name','format','trigger:%s','toLowerCase','merge','catch','error','user:%s','bluebird','util','lodash','ioredis','../../../../config/environment','trigger','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','stringify','emit','exec','autoCreate','data2'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x3419,0xb3));var _0x9341=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0x3419[_0x3c8e9a];return _0x2d4c57;};'use strict';var BPromise=require(_0x9341('0x0'));var util=require(_0x9341('0x1'));var _=require(_0x9341('0x2'));var Redis=require(_0x9341('0x3'));var config=require(_0x9341('0x4'));var logger=require('../../../../config/logger')(_0x9341('0x5'));var cmContactRpc=require(_0x9341('0x6'));config[_0x9341('0x7')]=_[_0x9341('0x8')](config[_0x9341('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x9341('0x9'))(new Redis(config[_0x9341('0x7')]));function emit(_0x5e3e79,_0x2efc5a,_0x1c30cf){logger[_0x9341('0xa')](_0x5e3e79,_0x2efc5a,JSON[_0x9341('0xb')](_0x1c30cf));io['to'](_0x5e3e79)[_0x9341('0xc')](_0x2efc5a,_0x1c30cf);}exports[_0x9341('0xd')]=function(_0x51826c,_0x1a34e2,_0x54f6db){_0x54f6db[_0x9341('0xe')]=0x0;if(_0x1a34e2[_0x9341('0xf')]&&parseInt(_0x1a34e2[_0x9341('0xf')],0xa)){var _0x522b66={'ListId':parseInt(_0x1a34e2[_0x9341('0x10')],0xa),'phone':_0x54f6db['calleridnum']};if(_[_0x9341('0x11')](_0x54f6db[_0x9341('0x12')])){_0x522b66[_0x9341('0x13')]=_0x54f6db[_0x9341('0x14')]&&_0x54f6db['calleridname']!==_0x9341('0x15')?_0x54f6db['calleridname']:_0x54f6db['calleridnum']||_0x54f6db[_0x9341('0x16')];}else{_0x522b66[_0x9341('0x13')]=_0x54f6db['destcalleridname']&&_0x54f6db[_0x9341('0x17')]!==_0x9341('0x15')?_0x54f6db['destcalleridname']:_0x54f6db[_0x9341('0x18')]||_0x54f6db[_0x9341('0x16')];_0x522b66[_0x9341('0x19')]=_0x54f6db['destcalleridname']&&_0x54f6db[_0x9341('0x17')]!==_0x9341('0x15')?_0x54f6db[_0x9341('0x17')]:_0x54f6db[_0x9341('0x18')]||_0x54f6db[_0x9341('0x16')];}BPromise[_0x9341('0x1a')]()[_0x9341('0x1b')](cmContactRpc[_0x9341('0x1c')]({'where':_[_0x9341('0x1d')](_0x522b66,['firstName'])}))['then'](function(_0x5ba251){if(_0x5ba251){_0x54f6db[_0x9341('0x1e')]=_0x5ba251['id'];emit(util['format']('user:%s',_0x51826c[_0x9341('0x1f')]),util[_0x9341('0x20')](_0x9341('0x21'),_0x1a34e2['action']['toLowerCase']()),_['merge'](_0x54f6db,{'ListId':parseInt(_0x1a34e2['data1'],0xa)}));return;}else{return BPromise['resolve']()[_0x9341('0x1b')](cmContactRpc['createContact'](_0x522b66));}})['then'](function(_0x50b1ab){if(_0x50b1ab){_0x54f6db[_0x9341('0x1e')]=_0x50b1ab['id'];emit(util[_0x9341('0x20')]('user:%s',_0x51826c['name']),util[_0x9341('0x20')]('trigger:%s',_0x1a34e2['action'][_0x9341('0x22')]()),_[_0x9341('0x23')](_0x54f6db,{'ListId':parseInt(_0x1a34e2['data1'],0xa)}));}})[_0x9341('0x24')](function(_0x3761a1){logger[_0x9341('0x25')]('Error\x20creating\x20contact',JSON[_0x9341('0xb')](_0x3761a1));});}else{if(_0x51826c){emit(util[_0x9341('0x20')](_0x9341('0x26'),_0x51826c['name']),util[_0x9341('0x20')](_0x9341('0x21'),_0x1a34e2['action'][_0x9341('0x22')]()),_[_0x9341('0x23')]({'ListId':parseInt(_0x1a34e2[_0x9341('0x10')],0xa)},_0x54f6db));}}}; \ No newline at end of file +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 diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index a16d09f..e5c61a3 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 _0xc96f=['data2','html','render','buildUri','isNil','data3','data4','uriLocation','windowWidth','data5','data6','winApplication','format','user:%s','trigger:%s:%s','jscripty','name','trigger:%s','exec','queue','routeId','urlforward','script','query','search','checkTrigger','AllConditions','every','channel','AnyConditions','some','checkConditions','chat','ChatWebsiteId','upperFirst','operator','value','AccountId','interaction','message','event','membername','lastevent','exports','util','lodash','mustache','ioredis','./integration','./cmContact','./script','../rpc/cmContact','../../../config/environment','../../../config/logger','trigger','../ami','defaults','localhost','popup','url','winapp','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','accounts','custom:agentcalled','bind','custom:agentconnect','syncCustomEvent','custom:agentcomplete','custom:queuecallerabandon','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:acceptmessage','custom:rejectmessage','emit','stringify','prototype','clone','interface','checkTriggers','triggers','hasOwnProperty','status','merge','variables','Actions','length','action','toLowerCase','contactmanager','motionbar','data1','TemplateId'];(function(_0x21cf98,_0x278645){var _0x10778f=function(_0x3fa8d4){while(--_0x3fa8d4){_0x21cf98['push'](_0x21cf98['shift']());}};_0x10778f(++_0x278645);}(_0xc96f,0x97));var _0xfc96=function(_0xe97201,_0x1407b2){_0xe97201=_0xe97201-0x0;var _0x289bec=_0xc96f[_0xe97201];return _0x289bec;};'use strict';var util=require(_0xfc96('0x0'));var _=require(_0xfc96('0x1'));var url=require('url');var Mustache=require(_0xfc96('0x2'));var Redis=require(_0xfc96('0x3'));var urlforward=require('./urlforward');var integration=require(_0xfc96('0x4'));var cmContact=require(_0xfc96('0x5'));var script=require(_0xfc96('0x6'));var cmContactRpc=require(_0xfc96('0x7'));var config=require(_0xfc96('0x8'));var logger=require(_0xfc96('0x9'))(_0xfc96('0xa'));var ami=require(_0xfc96('0xb'));config['redis']=_[_0xfc96('0xc')](config['redis'],{'host':_0xfc96('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var operators={'equals':function(_0x5627b4,_0x771451){return _0x5627b4==_0x771451;},'not_equals':function(_0x26e235,_0x502ff8){return _0x26e235!=_0x502ff8;}};var barAndWebActions=[_0xfc96('0xe'),_0xfc96('0xf'),_0xfc96('0x10')];function Trigger(_0x377e31){this['triggers']=_0x377e31['triggers'];this[_0xfc96('0x11')]=_0x377e31['agents'];this[_0xfc96('0x12')]=_0x377e31[_0xfc96('0x12')];this[_0xfc96('0x13')]=_0x377e31[_0xfc96('0x13')];this[_0xfc96('0x14')]=_0x377e31['voiceExtensions'];this[_0xfc96('0x15')]=_0x377e31[_0xfc96('0x15')];this['freshdeskAccounts']=_0x377e31['freshdeskAccounts'];this['salesforceAccounts']=_0x377e31[_0xfc96('0x16')];this[_0xfc96('0x17')]=_0x377e31[_0xfc96('0x17')];this[_0xfc96('0x18')]=_0x377e31[_0xfc96('0x18')];this[_0xfc96('0x19')]=_0x377e31[_0xfc96('0x19')];this[_0xfc96('0x1a')]=_0x377e31[_0xfc96('0x1a')];this['servicenowAccounts']=_0x377e31[_0xfc96('0x1b')];this[_0xfc96('0x1c')]=_0x377e31[_0xfc96('0x1c')];this['freshsalesAccounts']=_0x377e31['freshsalesAccounts'];this[_0xfc96('0x1d')]={'zendesk':this['zendeskAccounts'],'salesforce':this['salesforceAccounts'],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0xfc96('0x17')],'zoho':this[_0xfc96('0x18')],'desk':this[_0xfc96('0x19')],'vtiger':this[_0xfc96('0x1a')],'dynamics365':this[_0xfc96('0x1c')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0xfc96('0x1b')]};ami['on'](_0xfc96('0x1e'),this['syncCustomEvent'][_0xfc96('0x1f')](this));ami['on'](_0xfc96('0x20'),this[_0xfc96('0x21')]['bind'](this));ami['on']('custom:agentringnoanswer',this[_0xfc96('0x21')][_0xfc96('0x1f')](this));ami['on'](_0xfc96('0x22'),this[_0xfc96('0x21')][_0xfc96('0x1f')](this));ami['on'](_0xfc96('0x23'),this[_0xfc96('0x21')][_0xfc96('0x1f')](this));ami['on'](_0xfc96('0x24'),this[_0xfc96('0x25')][_0xfc96('0x1f')](this));ami['on'](_0xfc96('0x26'),this[_0xfc96('0x25')][_0xfc96('0x1f')](this));ami['on']('custom:dialend',this['syncAgentDial'][_0xfc96('0x1f')](this));ami['on'](_0xfc96('0x27'),this['syncCustomEvent']['bind'](this));ami['on'](_0xfc96('0x28'),this[_0xfc96('0x21')][_0xfc96('0x1f')](this));ami['on'](_0xfc96('0x29'),this[_0xfc96('0x21')]['bind'](this));ami['on']('custom:outgoingmessage',this[_0xfc96('0x21')][_0xfc96('0x1f')](this));ami['on'](_0xfc96('0x2a'),this[_0xfc96('0x21')][_0xfc96('0x1f')](this));ami['on'](_0xfc96('0x2b'),this['syncCustomEvent'][_0xfc96('0x1f')](this));}Trigger['prototype'][_0xfc96('0x2c')]=function(_0x5da75e,_0x4b34f2,_0x49f3bb){logger['info'](_0x5da75e,_0x4b34f2,JSON[_0xfc96('0x2d')](_0x49f3bb));io['to'](_0x5da75e)[_0xfc96('0x2c')](_0x4b34f2,_0x49f3bb);};Trigger[_0xfc96('0x2e')][_0xfc96('0x21')]=function(_0x3da4ea){var _0x5ee9b4=_[_0xfc96('0x2f')](_0x3da4ea);this['checkTriggers'](_0x5ee9b4);};Trigger[_0xfc96('0x2e')][_0xfc96('0x25')]=function(_0x598082){if(this['agents'][_0x598082[_0xfc96('0x30')]]){this['syncCustomEvent'](_0x598082);}};Trigger[_0xfc96('0x2e')][_0xfc96('0x31')]=function(_0x36f84c){var _0x3bb77f;for(var _0x2edd79 in this[_0xfc96('0x32')]){if(this['triggers'][_0xfc96('0x33')](_0x2edd79)){if(this['triggers'][_0x2edd79][_0xfc96('0x34')]){_0x3bb77f=this['checkTrigger'](this[_0xfc96('0x32')][_0x2edd79],_0x36f84c);if(_0x3bb77f){_[_0xfc96('0x35')](_0x36f84c,_0x36f84c[_0xfc96('0x36')]);for(var _0x964fe2=0x0,_0xb6755a,_0x516a9d,_0x27d1ad;_0x964fe20x0){_0x52fd41=_[_0x3421('0x2b')](_0x5df4dc,_0x332017);}return _0x52fd41;}function getCustomFields(_0x5aa96b,_0x5074a2){var _0xb4eaf4=[];var _0x4ee4aa={'custom_fields':{}};if(_0x5aa96b[_0x3421('0x2c')]>0x0){_['forEach'](_0x5aa96b,function(_0xc7f9fb){if(_0xc7f9fb[_0x3421('0x2d')]==='string'&&_0xc7f9fb[_0x3421('0x2e')]&&!_0xc7f9fb[_0x3421('0x2f')]){_0x4ee4aa[_0xc7f9fb[_0x3421('0x2e')]['toLowerCase']()]=_0xc7f9fb[_0x3421('0x30')]['toString']();}else if(_0xc7f9fb[_0x3421('0x2d')]===_0x3421('0x31')&&_0xc7f9fb[_0x3421('0x32')]&&_0xc7f9fb[_0x3421('0x2f')]){_0x4ee4aa[_0x3421('0x33')][_0xc7f9fb[_0x3421('0x32')]]=_0xc7f9fb[_0x3421('0x30')][_0x3421('0x24')]();}else if(_0xc7f9fb[_0x3421('0x2d')]===_0x3421('0x34')&&_0xc7f9fb['variableName']&&_0xc7f9fb['idField']&&_0xc7f9fb[_0x3421('0x2f')]){_0x5074a2[_0xc7f9fb[_0x3421('0x35')]]&&(_0x4ee4aa['custom_fields'][_0xc7f9fb[_0x3421('0x32')]]=_0x5074a2[_0xc7f9fb[_0x3421('0x35')]][_0x3421('0x24')]());}else if(_0xc7f9fb[_0x3421('0x2d')]===_0x3421('0x36')&&_0xc7f9fb['Variable']&&_0xc7f9fb[_0x3421('0x37')][_0x3421('0x38')]&&_0xc7f9fb[_0x3421('0x32')]&&_0xc7f9fb['customField']){_0x5074a2[_0xc7f9fb[_0x3421('0x37')]['name'][_0x3421('0x39')]()]&&(_0x4ee4aa[_0x3421('0x33')][_0xc7f9fb[_0x3421('0x32')]]=_0x5074a2[_0xc7f9fb[_0x3421('0x37')][_0x3421('0x38')][_0x3421('0x39')]()][_0x3421('0x24')]());}});}if(_0x4ee4aa['priority']){_0x4ee4aa['priority']=Number(_0x4ee4aa['priority']);}return _0x4ee4aa;}function getTicket(_0x4696f3,_0x4edf62,_0x5a56b8,_0xbe9181,_0x4e76e0){logger[_0x3421('0xe')](_0x3421('0x3a'));var _0x497aa3=_[_0x3421('0x3b')]({'subject':intUtil[_0x3421('0x3c')](_0xbe9181[_0x3421('0x3d')],_0x4e76e0,'\x20'),'type':_0x3421('0x3e'),'status':'new','labels':[_0x3421('0x3f'),_0x3421('0x40'),_0x3421('0x41')][_0x3421('0x42')](getTags(_0xbe9181[_0x3421('0x43')],'name')),'description':intUtil[_0x3421('0x3c')](_0xbe9181[_0x3421('0x44')],_0x4e76e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x3421('0x45'),_0x4edf62['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0xbe9181['Descriptions'],_0x4e76e0,'\x0a')}},getCustomFields(_0xbe9181[_0x3421('0x46')],_0x4e76e0));return request({'uri':util[_0x3421('0xf')](_0x3421('0x47'),_0x4696f3[_0x3421('0x11')],_0x5a56b8['id']),'method':_0x3421('0x29'),'body':_0x497aa3});}exports[_0x3421('0x48')]=function(_0xe7fdfb,_0x4e3f1e,_0x33198f,_0x14e30c,_0x3b9d15,_0x12e610){var _0x431643,_0x3d016d;_0x12e610['remoteUri']=intUtil[_0x3421('0x49')](_0x12e610[_0x3421('0x11')]);_0x12e610[_0x3421('0x4a')]=intUtil[_0x3421('0x49')](_0x12e610['serverUrl']);if(_0x3b9d15&&_0x3b9d15[_0x3421('0x4b')]){logger['info'](_0x3421('0x4c'),_0x3421('0x4d'));_0x4e3f1e[_0x3421('0x4e')]=util[_0x3421('0xf')](_0x3421('0x4f'),_0x12e610[_0x3421('0x4a')],_0x4e3f1e[_0x3421('0x50')],md5(_0x4e3f1e[_0x3421('0x50')]));}else{_0x4e3f1e[_0x3421('0x4e')]='';}headers[_0x3421('0x51')]=getAuth(_0x12e610);return getUser(_0x12e610,_0x14e30c[_0x3421('0x52')])[_0x3421('0x12')](function(_0x475918){_0x431643=_0x475918;logger['info'](_0x3421('0x53'),_0x431643['id']);return getEndUser(_0x12e610,_0x4e3f1e['calleridname'],_0x4e3f1e[_0x3421('0x54')]);})[_0x3421('0x12')](function(_0x3e3cca){_0x3d016d=_0x3e3cca;logger[_0x3421('0xe')](_0x3421('0x55'),_0x3d016d['id']);return getTicket(_0x12e610,_0x431643,_0x3d016d,_0x33198f,_0x4e3f1e);})[_0x3421('0x12')](function(_0x2a11a3){if(_0x2a11a3){logger[_0x3421('0xe')](_0x3421('0x56'));logger[_0x3421('0xe')]('The\x20Ticket\x20ID\x20is:',_0x2a11a3['id']);switch(_0x12e610[_0x3421('0x2d')]){case _0x3421('0x57'):logger[_0x3421('0xe')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util[_0x3421('0xf')](_0x3421('0x58'),_0x14e30c[_0x3421('0x38')]),'trigger:desk:display',{'recordId':_0x2a11a3['id']});break;case _0x3421('0x59'):logger[_0x3421('0xe')](_0x3421('0x4c'),_0x3421('0x5a'));emit(util['format'](_0x3421('0x58'),_0x14e30c[_0x3421('0x38')]),_0x3421('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x2a11a3['id'])});break;default:logger['error'](_0x3421('0x4c'),_0x3421('0x5c'));}}})['catch'](function(_0x4d8fe4){console[_0x3421('0x5d')](_0x4d8fe4);logger[_0x3421('0x5d')](_0x3421('0x4c'),JSON[_0x3421('0x1b')](_0x4d8fe4));});};exports[_0x3421('0x5e')]=function(_0x4987e3,_0x27d284,_0x2a81fa,_0x3e6e36,_0x2f9ce1,_0x535934,_0x1d243f){var _0x400a2c,_0x219e1d;_0x535934['remoteUri']=intUtil[_0x3421('0x49')](_0x535934['remoteUri']);_0x535934['serverUrl']=intUtil[_0x3421('0x49')](_0x535934['serverUrl']);if(_0x1d243f&&_0x1d243f[_0x3421('0x5f')]&&_0x1d243f[_0x3421('0x5f')]!==_0x3421('0x60')){logger['info'](_0x3421('0x61'),_0x3421('0x4d'));_0x27d284[_0x3421('0x4e')]=util[_0x3421('0xf')](_0x3421('0x4f'),_0x535934[_0x3421('0x4a')],_0x27d284[_0x3421('0x50')],md5(_0x27d284[_0x3421('0x50')]));}headers[_0x3421('0x51')]=getAuth(_0x535934);return getUser(_0x535934,_0x3e6e36['email'])[_0x3421('0x12')](function(_0x23ddd5){_0x400a2c=_0x23ddd5;logger['info'](_0x3421('0x53'),_0x400a2c['id']);return getEndUser(_0x535934,_0x27d284[_0x3421('0x62')],_0x27d284[_0x3421('0x63')]);})['then'](function(_0x3204a0){_0x219e1d=_0x3204a0;logger[_0x3421('0xe')](_0x3421('0x55'),_0x219e1d['id']);return getTicket(_0x535934,_0x400a2c,_0x219e1d,_0x2a81fa,_0x27d284);})[_0x3421('0x12')](function(_0x1bca2c){if(_0x1bca2c){logger[_0x3421('0xe')](_0x3421('0x56'));logger[_0x3421('0xe')](_0x3421('0x64'),_0x1bca2c['id']);switch(_0x535934[_0x3421('0x2d')]){case _0x3421('0x57'):logger[_0x3421('0xe')](_0x3421('0x4c'),_0x3421('0x65'));emit(util[_0x3421('0xf')]('user:%s',_0x3e6e36[_0x3421('0x38')]),_0x3421('0x66'),{'recordId':_0x1bca2c['id']});break;case _0x3421('0x59'):logger[_0x3421('0xe')](_0x3421('0x4c'),_0x3421('0x5a'));emit(util[_0x3421('0xf')](_0x3421('0x58'),_0x3e6e36['name']),_0x3421('0x5b'),{'uri':util['format'](_0x3421('0x67'),_0x535934[_0x3421('0x11')],_0x1bca2c['id'])});break;default:logger[_0x3421('0x5d')](_0x3421('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x3421('0x68')](function(_0x21e11b){logger[_0x3421('0x5d')](_0x3421('0x61'),JSON[_0x3421('0x1b')](_0x21e11b));});};exports[_0x3421('0x69')]=function(_0x5e6c4d,_0x8a35b5,_0x1d23f1,_0x1e9971,_0x278bbf,_0x443b0a){var _0x1ba5e1,_0x102119;_0x443b0a[_0x3421('0x11')]=intUtil['stripTrailingSlash'](_0x443b0a[_0x3421('0x11')]);_0x443b0a[_0x3421('0x4a')]=intUtil[_0x3421('0x49')](_0x443b0a[_0x3421('0x4a')]);if(_0x278bbf&&_0x278bbf[_0x3421('0x4b')]){logger['info']('[ABANDONED]',_0x3421('0x4d'));_0x8a35b5[_0x3421('0x4e')]=util[_0x3421('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x443b0a[_0x3421('0x4a')],_0x8a35b5['uniqueid'],md5(_0x8a35b5[_0x3421('0x50')]));}else{_0x8a35b5['recordingURL']='';}headers['Authorization']=getAuth(_0x443b0a);return getUser(_0x443b0a)['then'](function(_0x5c1a53){_0x1ba5e1=_0x5c1a53;logger['info'](_0x3421('0x53'),_0x1ba5e1['id']);return getEndUser(_0x443b0a,_0x8a35b5[_0x3421('0x6a')],_0x8a35b5[_0x3421('0x54')]);})[_0x3421('0x12')](function(_0xa05828){_0x102119=_0xa05828;logger[_0x3421('0xe')](_0x3421('0x55'),_0x102119['id']);return getTicket(_0x443b0a,_0x1ba5e1,_0x102119,_0x1d23f1,_0x8a35b5);})[_0x3421('0x12')](function(_0xd9edb3){if(_0xd9edb3){logger[_0x3421('0xe')]('Ticket\x20created!');logger[_0x3421('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd9edb3['id']);}})[_0x3421('0x68')](function(_0x41e5f8){logger[_0x3421('0x5d')](_0x3421('0x6b'),JSON[_0x3421('0x1b')](_0x41e5f8));});}; \ No newline at end of file +var _0x28f2=['Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','[HTTP]','stringify','GET','basic','username','authType','token','%s/token:%s','Basic\x20%s','toString','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','work','length','map','forEach','type','string','customField','nameField','toLowerCase','idField','custom_fields','variable','variableName','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','merge','Subjects','phone','Motion','CTI','Tags','user','getString','Descriptions','Fields','%s/customers/%d/cases','POST','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','https://xcally.desk.com/web/agent/case/%d','error','outbound','recordingFormat','none','[OUTBOUND]','Authorization','The\x20User\x20ID\x20is:','destcalleridname','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','Desk\x20account\x20type\x20not\x20recognized','catch','monitor_format','[ABANDONED]','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','desk','redis','defaults','localhost','emit','application/json','validateEmail','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','then','total_entries','find','_embedded','entries','info','Agent\x20found!'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x28f2,0x193));var _0x228f=function(_0xddd893,_0x54d633){_0xddd893=_0xddd893-0x0;var _0x35f8ff=_0x28f2[_0xddd893];return _0x35f8ff;};'use strict';var _=require(_0x228f('0x0'));var rp=require(_0x228f('0x1'));var md5=require(_0x228f('0x2'));var util=require(_0x228f('0x3'));var Redis=require(_0x228f('0x4'));var intUtil=require('./util');var config=require(_0x228f('0x5'));var logger=require(_0x228f('0x6'))(_0x228f('0x7'));config[_0x228f('0x8')]=_[_0x228f('0x9')](config[_0x228f('0x8')],{'host':_0x228f('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x228f('0x8')]));function emit(_0x4a4a44,_0x3ca074,_0x455eb6){io['to'](_0x4a4a44)[_0x228f('0xb')](_0x3ca074,_0x455eb6);}var headers={'Content-Type':'application/json','Accept':_0x228f('0xc')};function getUser(_0x4d0038,_0x212c90){if(intUtil[_0x228f('0xd')](_0x212c90)===!![]){logger['info'](_0x228f('0xe'),_0x212c90);return request({'uri':util[_0x228f('0xf')](_0x228f('0x10'),_0x4d0038[_0x228f('0x11')])})[_0x228f('0x12')](function(_0x4f22af){if(_0x4f22af[_0x228f('0x13')]){return _[_0x228f('0x14')](_0x4f22af[_0x228f('0x15')][_0x228f('0x16')],{'email':_0x212c90});}})[_0x228f('0x12')](function(_0x244d42){if(_0x244d42){logger[_0x228f('0x17')](_0x228f('0x18'));return _0x244d42;}else{logger['info'](_0x228f('0x19'));return request({'uri':util[_0x228f('0xf')](_0x228f('0x1a'),_0x4d0038[_0x228f('0x11')])});}});}else{logger[_0x228f('0x17')](_0x228f('0x1b'));return request({'uri':util[_0x228f('0xf')]('%s/users/me',_0x4d0038[_0x228f('0x11')])});}}function request(_0x4cae4a){logger[_0x228f('0x1c')](_0x228f('0x1d'),JSON[_0x228f('0x1e')](_0x4cae4a));return rp(_['defaults'](_0x4cae4a,{'method':_0x228f('0x1f'),'headers':headers,'json':!![]}));}function getAuth(_0x4e1968){var _0x33e32e;if(_0x4e1968['authType']===_0x228f('0x20')){_0x33e32e=util['format']('%s:%s',_0x4e1968[_0x228f('0x21')],_0x4e1968['password']);}else if(_0x4e1968[_0x228f('0x22')]===_0x228f('0x23')){_0x33e32e=util[_0x228f('0xf')](_0x228f('0x24'),_0x4e1968[_0x228f('0x21')],_0x4e1968[_0x228f('0x23')]);}return util[_0x228f('0xf')](_0x228f('0x25'),new Buffer(_0x33e32e)[_0x228f('0x26')]('base64'));}function getEndUser(_0x1e96d4,_0x8f7004,_0x3127ab){logger[_0x228f('0x17')](_0x228f('0x27'),_0x3127ab);return request({'uri':util[_0x228f('0xf')](_0x228f('0x28'),_0x1e96d4[_0x228f('0x11')]),'qs':{'phone':_0x3127ab}})[_0x228f('0x12')](function(_0x56fbc2){if(_0x56fbc2[_0x228f('0x13')]){logger[_0x228f('0x17')](_0x228f('0x29'));return _0x56fbc2[_0x228f('0x15')][_0x228f('0x16')][0x0];}else{logger['info'](_0x228f('0x2a'));return request({'uri':util['format'](_0x228f('0x2b'),_0x1e96d4['remoteUri']),'method':'POST','body':{'first_name':_0x8f7004,'title':_0x8f7004,'phone_numbers':[{'type':_0x228f('0x2c'),'value':_0x3127ab}]}});}});}function getTags(_0x160f68,_0x2a7842){var _0x3ab339=[];if(_0x160f68&&_0x160f68[_0x228f('0x2d')]>0x0){_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 diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index f77919d..e83788e 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 _0xdfe5=['string','nameField','customField','idField','indexOf','content','ticketType','incidents','getString','/contacts(','Fields','phonecall','Subjects','Descriptions','callDirection','queue','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','trigger:browser:url','stripTrailingSlash','serverUrl','abandoned','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','util','./util','md5','ioredis','../../../../config/logger','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','error',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','length','internalemailaddress','isdisabled','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','catch','toLowerCase','outbound','destcalleridnum','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','calleridnum','telephone1','contactid',']\x20Enduser\x20created!','enduserId',']\x20Enduser\x20Created!','forEach','type'];(function(_0x5dbb84,_0x1bbce9){var _0x1d6eae=function(_0xd93967){while(--_0xd93967){_0x5dbb84['push'](_0x5dbb84['shift']());}};_0x1d6eae(++_0x1bbce9);}(_0xdfe5,0xe9));var _0x5dfe=function(_0x2de921,_0x33aa92){_0x2de921=_0x2de921-0x0;var _0x1f4953=_0xdfe5[_0x2de921];return _0x1f4953;};'use strict';var _=require(_0x5dfe('0x0'));var BPromise=require(_0x5dfe('0x1'));var rp=require('request-promise');var util=require(_0x5dfe('0x2'));var intUtil=require(_0x5dfe('0x3'));var md5=require(_0x5dfe('0x4'));var Redis=require(_0x5dfe('0x5'));var logger=require(_0x5dfe('0x6'))('dynamics365');var config=require(_0x5dfe('0x7'));config[_0x5dfe('0x8')]=_[_0x5dfe('0x9')](config['redis'],{'host':_0x5dfe('0xa'),'port':0x18eb});var io=require(_0x5dfe('0xb'))(new Redis(config[_0x5dfe('0x8')]));function getAuthToken(_0x44e4e3,_0x1f8175,_0x34a2c7){var _0x10df5d={'method':_0x5dfe('0xc'),'uri':_0x1f8175,'form':{'client_id':_0x44e4e3[_0x5dfe('0xd')],'resource':_0x44e4e3[_0x5dfe('0xe')],'username':_0x44e4e3[_0x5dfe('0xf')],'password':_0x44e4e3[_0x5dfe('0x10')],'grant_type':_0x5dfe('0x10'),'client_secret':_0x44e4e3[_0x5dfe('0x11')]},'json':!![]};return rp(_0x10df5d)[_0x5dfe('0x12')](function(_0x3891ef){return _0x3891ef[_0x5dfe('0x13')];})['catch'](function(_0x2c06e2){logger[_0x5dfe('0x14')]('['+[_0x34a2c7['toUpperCase']()]+_0x5dfe('0x15'));return _0x2c06e2[_0x5dfe('0x16')];});}function getUser(_0x278f10,_0xb152f1,_0x3b95ff,_0x50ed0e,_0x139889,_0x1f6925){return new BPromise(function(_0x56ba51,_0x1698c4){return getAuthToken(_0xb152f1,_0x50ed0e,_0x1f6925)['then'](function(_0x1c3463){var _0x1840b0={'method':_0x5dfe('0x17'),'uri':_0x139889+_0x5dfe('0x18'),'headers':{'Authorization':_0x5dfe('0x19')+_0x1c3463,'OData-Version':_0x5dfe('0x1a')},'json':!![]};return rp(_0x1840b0);})[_0x5dfe('0x12')](function(_0x4a140f){var _0x58a412=_0x4a140f[_0x5dfe('0x1b')];var _0x2c8018=![];var _0x740e5e=null;if(!_[_0x5dfe('0x1c')](_0x3b95ff)){if(intUtil[_0x5dfe('0x1d')](_0x3b95ff[_0x5dfe('0x1e')])){_0x278f10['userEmail']=_0x3b95ff[_0x5dfe('0x1e')];for(_0x740e5e=0x0;_0x740e5e<_0x58a412[_0x5dfe('0x1f')];_0x740e5e++){if(_0x58a412[_0x740e5e][_0x5dfe('0x20')]===_0x3b95ff['email']&&!_0x58a412[_0x740e5e][_0x5dfe('0x21')]){_0x2c8018=!![];logger[_0x5dfe('0x22')]('['+[_0x1f6925[_0x5dfe('0x23')]()]+_0x5dfe('0x24')+_0x58a412[_0x740e5e][_0x5dfe('0x25')]+'!');_0x278f10[_0x5dfe('0x26')]=_0x58a412[_0x740e5e][_0x5dfe('0x25')];}}}}if(!_0x2c8018){logger[_0x5dfe('0x22')]('['+[_0x1f6925[_0x5dfe('0x23')]()]+_0x5dfe('0x27'));_0x278f10['userEmail']=_0xb152f1[_0x5dfe('0xf')];for(_0x740e5e=0x0;_0x740e5e<_0x58a412['length'];_0x740e5e++){if(_0x58a412[_0x740e5e][_0x5dfe('0x20')]===_0xb152f1[_0x5dfe('0xf')]){_0x278f10[_0x5dfe('0x26')]=_0x58a412[_0x740e5e][_0x5dfe('0x25')];}}}_0x56ba51(_0x278f10);})[_0x5dfe('0x28')](function(_0xbd68bc){_0x1698c4(_0xbd68bc[_0x5dfe('0x16')]);});});}function createEndUser(_0x25e742,_0xf4be8e,_0x4a7973,_0x18511d,_0x5b2cba,_0x3cdc8e){return new BPromise(function(_0x484072,_0x189159){return getAuthToken(_0xf4be8e,_0x4a7973,_0x3cdc8e)[_0x5dfe('0x12')](function(_0x48f618){var _0x3d0f73=_0x3cdc8e[_0x5dfe('0x29')]()===_0x5dfe('0x2a')?_0x5b2cba[_0x5dfe('0x2b')]:_0x5b2cba['calleridnum'];var _0x5f172c={'method':_0x5dfe('0xc'),'uri':_0x18511d+_0x5dfe('0x2c'),'body':{'telephone1':_0x3d0f73,'fullname':_0x3d0f73,'firstname':_0x3d0f73,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x5dfe('0x2d')+_0x25e742[_0x5dfe('0x26')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x48f618,'OData-Version':_0x5dfe('0x1a')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x5f172c);})[_0x5dfe('0x12')](function(_0x1a6358){var _0x52ae1e=_0x1a6358[_0x5dfe('0x2e')][_0x5dfe('0x2f')];var _0x1e87de=_0x52ae1e[_0x5dfe('0x30')](_0x52ae1e[_0x5dfe('0x31')]('(')+0x1,_0x52ae1e['lastIndexOf'](')'));_0x25e742['enduserId']=_0x1e87de;_0x484072(_0x25e742);})[_0x5dfe('0x28')](function(_0x338635){_0x189159(_0x338635[_0x5dfe('0x16')]);});});}function getEndUser(_0x322464,_0x73e6fe,_0x223628,_0x21a89f,_0x5d5e7e,_0x2014ef){return new BPromise(function(_0x11b43e,_0x51748e){return getAuthToken(_0x73e6fe,_0x223628,_0x2014ef)[_0x5dfe('0x12')](function(_0x137c28){var _0x230912={'method':_0x5dfe('0x17'),'uri':_0x21a89f+'contacts?$select=telephone1','headers':{'Authorization':'Bearer\x20'+_0x137c28,'If-None-Match':null,'OData-Version':_0x5dfe('0x1a')},'json':!![]};return rp(_0x230912);})[_0x5dfe('0x12')](function(_0x58caaf){var _0x7f0a69=null;if(_0x58caaf){var _0x3d03cb=_0x58caaf[_0x5dfe('0x1b')];var _0x113bcb=![];for(_0x7f0a69=0x0;_0x7f0a69<_0x3d03cb[_0x5dfe('0x1f')];_0x7f0a69++){var _0xc0d6a5=_0x2014ef[_0x5dfe('0x29')]()==='outbound'?_0x5d5e7e['destcalleridnum']:_0x5d5e7e[_0x5dfe('0x32')];if(_0x3d03cb[_0x7f0a69][_0x5dfe('0x33')]===_0xc0d6a5){_0x113bcb=!![];_0x322464['enduserId']=_0x3d03cb[_0x7f0a69][_0x5dfe('0x34')];}}if(_0x113bcb){_0x11b43e(_0x322464);}else{return createEndUser(_0x322464,_0x73e6fe,_0x223628,_0x21a89f,_0x5d5e7e,_0x2014ef)[_0x5dfe('0x12')](function(_0x3962f1){logger[_0x5dfe('0x22')]('['+[_0x2014ef[_0x5dfe('0x23')]()]+_0x5dfe('0x35'),_0x3962f1[_0x5dfe('0x36')]);_0x11b43e(_0x3962f1);});}}else{return createEndUser(_0x322464,_0x73e6fe,_0x223628,_0x21a89f,_0x5d5e7e,_0x2014ef)[_0x5dfe('0x12')](function(_0x71a1bd){logger[_0x5dfe('0x22')]('['+[_0x2014ef[_0x5dfe('0x23')]()]+_0x5dfe('0x37'),_0x71a1bd[_0x5dfe('0x36')]);_0x11b43e(_0x71a1bd);});}});});}function getCustomFields(_0x3d1381,_0x227f70,_0x547137){var _0x6bc192={};if(_0x3d1381[_0x5dfe('0x1f')]>0x0){_[_0x5dfe('0x38')](_0x3d1381,function(_0x5a9c0d){if(_0x5a9c0d[_0x5dfe('0x39')]===_0x5dfe('0x3a')&&_0x5a9c0d[_0x5dfe('0x3b')]&&!_0x5a9c0d[_0x5dfe('0x3c')]){var _0x143f6f=_0x5a9c0d[_0x5dfe('0x3d')]['toLowerCase']();var _0x275de1=_0x143f6f[_0x5dfe('0x30')](0x0,_0x143f6f[_0x5dfe('0x3e')]('_'));var _0x9d4ee7=_0x143f6f[_0x5dfe('0x30')](_0x143f6f[_0x5dfe('0x3e')]('_')+0x1);if(_0x275de1===_0x547137){_0x6bc192[_0x9d4ee7]=_0x5a9c0d[_0x5dfe('0x3f')];}}});}return _0x6bc192;}function getTicket(_0x1dc803,_0x43cae2,_0xfd7a9c,_0x3b1c49,_0x1d1d3e,_0x40716e,_0x3eeed7){return new BPromise(function(_0x39f9ff,_0x5711e3){var _0x28bc37;return getAuthToken(_0x43cae2,_0xfd7a9c,_0x3eeed7)['then'](function(_0x142f9a){if(_0x40716e[_0x5dfe('0x40')]==='incident'){_0x28bc37={'method':'POST','uri':_0x3b1c49+_0x5dfe('0x41'),'body':Object['assign']({},{'title':intUtil[_0x5dfe('0x42')](_0x40716e['Subjects'],_0x1d1d3e,'\x20'),'description':intUtil[_0x5dfe('0x42')](_0x40716e['Descriptions'],_0x1d1d3e,'\x0a'),'customerid_contact@odata.bind':_0x5dfe('0x43')+_0x1dc803['enduserId']+')','ownerid@odata.bind':'/systemusers('+_0x1dc803[_0x5dfe('0x26')]+')','caseorigincode':'1'},getCustomFields(_0x40716e[_0x5dfe('0x44')],_0x1d1d3e,_0x40716e[_0x5dfe('0x40')])),'headers':{'Authorization':_0x5dfe('0x19')+_0x142f9a,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x40716e[_0x5dfe('0x40')]===_0x5dfe('0x45')){_0x28bc37={'method':_0x5dfe('0xc'),'uri':_0x3b1c49+'phonecalls','body':Object['assign']({},{'subject':intUtil[_0x5dfe('0x42')](_0x40716e[_0x5dfe('0x46')],_0x1d1d3e,'\x20'),'phonenumber':String(_0x1d1d3e[_0x5dfe('0x32')]),'description':intUtil[_0x5dfe('0x42')](_0x40716e[_0x5dfe('0x47')],_0x1d1d3e,'\x0a'),'regardingobjectid_contact@odata.bind':_0x5dfe('0x43')+_0x1dc803[_0x5dfe('0x36')]+')','ownerid@odata.bind':_0x5dfe('0x2d')+_0x1dc803[_0x5dfe('0x26')]+')','directioncode':_0x1dc803[_0x5dfe('0x48')]==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x1dc803[_0x5dfe('0x26')]+')','participationtypemask':_0x1dc803[_0x5dfe('0x48')]===_0x5dfe('0x49')?0x2:0x1},{'partyid_contact@odata.bind':_0x5dfe('0x43')+_0x1dc803[_0x5dfe('0x36')]+')','participationtypemask':_0x1dc803[_0x5dfe('0x48')]==='queue'?0x1:0x2}]},getCustomFields(_0x40716e[_0x5dfe('0x44')],_0x1d1d3e,_0x40716e[_0x5dfe('0x40')])),'headers':{'Authorization':_0x5dfe('0x19')+_0x142f9a,'OData-Version':_0x5dfe('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x28bc37);})[_0x5dfe('0x12')](function(_0x57a08f){var _0x45c8be=_0x57a08f[_0x5dfe('0x2e')][_0x5dfe('0x2f')];var _0x5c0e00=_0x45c8be[_0x5dfe('0x30')](_0x45c8be['lastIndexOf']('(')+0x1,_0x45c8be[_0x5dfe('0x31')](')'));_0x1dc803['ticketId']=_0x5c0e00;_0x39f9ff(_0x1dc803);})[_0x5dfe('0x28')](function(_0x57b75d){_0x5711e3(_0x57b75d[_0x5dfe('0x16')]);});});}function emit(_0x5be6e2,_0x4a1e6e,_0x56b770,_0xc65b6e){var _0x4787ea={'uri':util['format'](_0x5dfe('0x4a'),_0x5be6e2,_0x56b770,_0xc65b6e)};io['to'](util[_0x5dfe('0x4b')]('user:%s',_0x4a1e6e))['emit'](_0x5dfe('0x4c'),_0x4787ea);}exports['cs']=function(_0x2c3088,_0x5f202a,_0x1d8744,_0x513a88,_0x97eda7,_0x28feb3,_0x3285f0,_0x1b509e){var _0x480889={};_0x28feb3[_0x5dfe('0xe')]=intUtil[_0x5dfe('0x4d')](_0x28feb3['remoteUri']);_0x28feb3[_0x5dfe('0x4e')]=intUtil[_0x5dfe('0x4d')](_0x28feb3[_0x5dfe('0x4e')]);_0x480889[_0x5dfe('0x48')]=_0x1b509e===_0x5dfe('0x49')||_0x1b509e===_0x5dfe('0x4f')?'queue':'outbound';var _0x43188a=util[_0x5dfe('0x4b')](_0x5dfe('0x50'),_0x28feb3['remoteUri']);var _0x4df472=util[_0x5dfe('0x4b')](_0x5dfe('0x51'),_0x28feb3['tenantId']);var _0x2f00c9=util[_0x5dfe('0x4b')](_0x5dfe('0x52'),_0x28feb3[_0x5dfe('0x4e')],_0x5f202a['uniqueid'],md5(_0x5f202a[_0x5dfe('0x53')]));if(_0x97eda7&&_0x97eda7[_0x5dfe('0x54')]){logger[_0x5dfe('0x22')]('[QUEUE]',_0x5dfe('0x55'));_0x5f202a['recordingURL']=_0x2f00c9;}else if(_0x3285f0&&_0x3285f0[_0x5dfe('0x56')]&&_0x3285f0[_0x5dfe('0x56')]!==_0x5dfe('0x57')){logger['info'](_0x5dfe('0x58'),_0x5dfe('0x55'));_0x5f202a[_0x5dfe('0x59')]=_0x2f00c9;}else{_0x5f202a[_0x5dfe('0x59')]='';}return getUser(_0x480889,_0x28feb3,_0x513a88,_0x4df472,_0x43188a,_0x1b509e)['then'](function(_0x3f991b){logger[_0x5dfe('0x22')]('['+_0x1b509e[_0x5dfe('0x23')]()+']\x20The\x20User\x20ID\x20is:',_0x3f991b[_0x5dfe('0x26')]);logger[_0x5dfe('0x22')]('['+_0x1b509e[_0x5dfe('0x23')]()+_0x5dfe('0x5a'),_0x3f991b['userEmail']);return getEndUser(_0x3f991b,_0x28feb3,_0x4df472,_0x43188a,_0x5f202a,_0x1b509e);})[_0x5dfe('0x12')](function(_0x5a0ef2){logger['info']('['+_0x1b509e['toUpperCase']()+']\x20The\x20Enduser\x20ID\x20is:',_0x5a0ef2[_0x5dfe('0x36')]);logger[_0x5dfe('0x22')]('['+_0x1b509e[_0x5dfe('0x23')]()+_0x5dfe('0x5b'),_0x5f202a[_0x5dfe('0x32')]);return getTicket(_0x5a0ef2,_0x28feb3,_0x4df472,_0x43188a,_0x5f202a,_0x1d8744,_0x1b509e);})['then'](function(_0x47f85b){logger[_0x5dfe('0x22')](util[_0x5dfe('0x4b')]('['+_0x1b509e[_0x5dfe('0x23')]()+_0x5dfe('0x5c'),_0x1d8744['ticketType'],_0x47f85b['ticketId']));logger[_0x5dfe('0x22')](util[_0x5dfe('0x4b')]('['+_0x1b509e['toUpperCase']()+_0x5dfe('0x5d'),_0x1b509e));if(_0x1b509e!==_0x5dfe('0x4f')){logger['info']('['+_0x1b509e['toUpperCase']()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x28feb3[_0x5dfe('0xe')],_0x513a88[_0x5dfe('0x5e')],_0x1d8744[_0x5dfe('0x40')],_0x47f85b['ticketId']);}})['catch'](function(_0x6cdeac){logger[_0x5dfe('0x14')]('['+_0x1b509e[_0x5dfe('0x23')]()+_0x5dfe('0x5f'),util[_0x5dfe('0x60')](_0x6cdeac,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +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 diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index 8d1c726..b2dda61 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 _0xc9b6=['Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','forEach','string','nameField','customField','content','type','push','idField','variable','variableName','customVariable','Variable','toLowerCase','stripTrailingSlash','serverUrl','monitor_format','recordingURL','uniqueid','Authorization','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','recordingFormat','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','abandoned','[ABANDONED]','lodash','md5','util','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','getString','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','info','validateEmail','length','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xc9b6,0x1e8));var _0x6c9b=function(_0x4fd298,_0x595966){_0x4fd298=_0x4fd298-0x0;var _0xed434e=_0xc9b6[_0x4fd298];return _0xed434e;};'use strict';var _=require(_0x6c9b('0x0'));var rp=require('request-promise');var md5=require(_0x6c9b('0x1'));var util=require(_0x6c9b('0x2'));var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x6c9b('0x3'))(_0x6c9b('0x4'));config[_0x6c9b('0x5')]=_[_0x6c9b('0x6')](config['redis'],{'host':_0x6c9b('0x7'),'port':0x18eb});var io=require(_0x6c9b('0x8'))(new Redis(config[_0x6c9b('0x5')]));var headers={'Content-Type':_0x6c9b('0x9'),'Accept':_0x6c9b('0x9')};function emit(_0x113731,_0x358dab,_0x3f509d){io['to'](_0x113731)['emit'](_0x358dab,_0x3f509d);}function getTicket(_0x32edf8,_0x1d33ba,_0x438169,_0x577c42,_0x54504d){logger['info'](_0x6c9b('0xa'));var _0x4df3bd=_[_0x6c9b('0xb')]({'responder_id':_0x1d33ba['id'],'requester_id':_0x438169['id'],'name':util[_0x6c9b('0xc')](_0x6c9b('0xd'),_0x54504d[_0x6c9b('0xe')]),'phone':_0x54504d[_0x6c9b('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x577c42[_0x6c9b('0x10')],_0x54504d,'\x20'),'description':intUtil[_0x6c9b('0x11')](_0x577c42['Descriptions'],_0x54504d,_0x6c9b('0x12')),'tags':getTags(_0x577c42[_0x6c9b('0x13')],_0x6c9b('0x14'))},getCustomFields(_0x577c42[_0x6c9b('0x15')],_0x54504d));_0x4df3bd[_0x6c9b('0x16')]=_[_0x6c9b('0x17')](_[_0x6c9b('0x18')](_0x4df3bd['custom_fields'],'id'),_0x6c9b('0x19'));return request({'uri':util['format'](_0x6c9b('0x1a'),_0x32edf8[_0x6c9b('0x1b')]),'method':_0x6c9b('0x1c'),'body':_0x4df3bd})[_0x6c9b('0x1d')](function(_0x747ba0){logger[_0x6c9b('0x1e')]('Ticket\x20created!');return _0x747ba0;});}function getUser(_0x356b6c,_0x1e7c29){if(intUtil[_0x6c9b('0x1f')](_0x1e7c29)){return request({'uri':util[_0x6c9b('0xc')]('%s/api/v2/agents',_0x356b6c[_0x6c9b('0x1b')]),'qs':{'email':_0x1e7c29}})['then'](function(_0x7f4668){if(_0x7f4668[_0x6c9b('0x20')]){logger['info'](_0x6c9b('0x21'));return _[_0x6c9b('0x22')](_0x7f4668,function(_0x2b7a0c){return _0x2b7a0c['contact'][_0x6c9b('0x23')]===_0x1e7c29;});}else{logger[_0x6c9b('0x1e')](_0x6c9b('0x24'));return request({'uri':util[_0x6c9b('0xc')](_0x6c9b('0x25'),_0x356b6c['remoteUri'])})[_0x6c9b('0x1d')](function(_0x19c2d7){logger[_0x6c9b('0x1e')](_0x6c9b('0x26'));return _0x19c2d7;});}});}else{logger['info'](_0x6c9b('0x27'));return request({'uri':util[_0x6c9b('0xc')](_0x6c9b('0x25'),_0x356b6c[_0x6c9b('0x1b')])})[_0x6c9b('0x1d')](function(_0x3de071){logger[_0x6c9b('0x1e')](_0x6c9b('0x26'));return _0x3de071;});}}function getEndUser(_0x103d74,_0x4607bc,_0x1f0117){logger[_0x6c9b('0x1e')](_0x6c9b('0x28'),_0x1f0117);return request({'uri':util[_0x6c9b('0xc')]('%s/api/v2/contacts',_0x103d74[_0x6c9b('0x1b')]),'qs':{'phone':_0x1f0117}})[_0x6c9b('0x1d')](function(_0x51903c){if(_0x51903c[_0x6c9b('0x20')]){logger[_0x6c9b('0x1e')](_0x6c9b('0x29'));return _[_0x6c9b('0x22')](_0x51903c,{'phone':_0x1f0117});}else{logger['info'](_0x6c9b('0x2a'));return request({'uri':util[_0x6c9b('0xc')](_0x6c9b('0x2b'),_0x103d74[_0x6c9b('0x1b')]),'method':_0x6c9b('0x1c'),'body':{'name':_0x4607bc,'phone':_0x1f0117}})['then'](function(_0x1246b0){logger[_0x6c9b('0x1e')]('Enduser\x20created.');return _0x1246b0;});}});}function getAuth(_0x3e452a){return util[_0x6c9b('0xc')](_0x6c9b('0x2c'),new Buffer(_0x3e452a['apiKey']+':X')[_0x6c9b('0x2d')](_0x6c9b('0x2e')));}function request(_0x4b7c91){logger[_0x6c9b('0x2f')](_0x6c9b('0x30'),JSON[_0x6c9b('0x31')](_0x4b7c91));return rp(_[_0x6c9b('0x6')](_0x4b7c91,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x1cf810,_0x430122){var _0x20a07a=[];if(_0x1cf810&&_0x1cf810[_0x6c9b('0x20')]>0x0){_0x20a07a=_['map'](_0x1cf810,_0x430122);}return _0x20a07a;}function getCustomFields(_0x285f29,_0x22587a){var _0x3a7d9b=[];var _0x4d7346={'custom_fields':[]};if(_0x285f29[_0x6c9b('0x20')]>0x0){_[_0x6c9b('0x32')](_0x285f29,function(_0x49aafc){if(_0x49aafc['type']===_0x6c9b('0x33')&&_0x49aafc[_0x6c9b('0x34')]&&!_0x49aafc[_0x6c9b('0x35')]){_0x4d7346[_0x49aafc[_0x6c9b('0x34')]['toLowerCase']()]=_0x49aafc[_0x6c9b('0x36')][_0x6c9b('0x2d')]();}else if(_0x49aafc[_0x6c9b('0x37')]===_0x6c9b('0x33')&&_0x49aafc['idField']&&_0x49aafc[_0x6c9b('0x35')]){_0x4d7346[_0x6c9b('0x16')][_0x6c9b('0x38')]({'id':_0x49aafc[_0x6c9b('0x39')],'value':_0x49aafc['content'][_0x6c9b('0x2d')]()});}else if(_0x49aafc['type']===_0x6c9b('0x3a')&&_0x49aafc[_0x6c9b('0x3b')]&&_0x49aafc[_0x6c9b('0x39')]&&_0x49aafc[_0x6c9b('0x35')]){_0x22587a[_0x49aafc['variableName']]&&_0x4d7346[_0x6c9b('0x16')][_0x6c9b('0x38')]({'id':_0x49aafc[_0x6c9b('0x39')],'value':_0x22587a[_0x49aafc[_0x6c9b('0x3b')]][_0x6c9b('0x2d')]()});}else if(_0x49aafc[_0x6c9b('0x37')]===_0x6c9b('0x3c')&&_0x49aafc[_0x6c9b('0x3d')]&&_0x49aafc[_0x6c9b('0x3d')][_0x6c9b('0x14')]&&_0x49aafc['idField']&&_0x49aafc[_0x6c9b('0x35')]){_0x22587a[_0x49aafc[_0x6c9b('0x3d')][_0x6c9b('0x14')][_0x6c9b('0x3e')]()]&&_0x4d7346[_0x6c9b('0x16')][_0x6c9b('0x38')]({'id':_0x49aafc[_0x6c9b('0x39')],'value':_0x22587a[_0x49aafc[_0x6c9b('0x3d')]['name']['toLowerCase']()][_0x6c9b('0x2d')]()});}});}return _0x4d7346;}exports['queue']=function(_0x572140,_0x12d964,_0x680b70,_0x403c16,_0x5d8abf,_0x1d3ac4){var _0x309ff0,_0x92b411;_0x1d3ac4[_0x6c9b('0x1b')]=intUtil[_0x6c9b('0x3f')](_0x1d3ac4[_0x6c9b('0x1b')]);_0x1d3ac4[_0x6c9b('0x40')]=intUtil['stripTrailingSlash'](_0x1d3ac4[_0x6c9b('0x40')]);if(_0x5d8abf&&_0x5d8abf[_0x6c9b('0x41')]){logger[_0x6c9b('0x1e')]('[QUEUE]','Recording\x20is\x20enabled!');_0x12d964[_0x6c9b('0x42')]=util[_0x6c9b('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1d3ac4[_0x6c9b('0x40')],_0x12d964[_0x6c9b('0x43')],md5(_0x12d964['uniqueid']));}else{_0x12d964[_0x6c9b('0x42')]='';}headers[_0x6c9b('0x44')]=getAuth(_0x1d3ac4);return getUser(_0x1d3ac4,_0x403c16[_0x6c9b('0x23')])[_0x6c9b('0x1d')](function(_0xfe5ebb){_0x309ff0=_0xfe5ebb;logger[_0x6c9b('0x1e')]('The\x20User\x20ID\x20is:',_0x309ff0['id']);return getEndUser(_0x1d3ac4,_0x12d964[_0x6c9b('0xe')],_0x12d964[_0x6c9b('0xf')]);})['then'](function(_0x1813b5){_0x92b411=_0x1813b5;logger[_0x6c9b('0x1e')](_0x6c9b('0x45'),_0x92b411['id']);return getTicket(_0x1d3ac4,_0x309ff0,_0x92b411,_0x680b70,_0x12d964);})[_0x6c9b('0x1d')](function(_0x129d1a){if(_0x129d1a&&_0x129d1a['id']){logger[_0x6c9b('0x1e')](_0x6c9b('0x46'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x129d1a['id']);logger[_0x6c9b('0x1e')](_0x6c9b('0x47'),_0x6c9b('0x48'));emit(util['format'](_0x6c9b('0x49'),_0x403c16[_0x6c9b('0x14')]),_0x6c9b('0x4a'),{'uri':util[_0x6c9b('0xc')](_0x6c9b('0x4b'),_0x1d3ac4[_0x6c9b('0x1b')],_0x129d1a['id'])});}})[_0x6c9b('0x4c')](function(_0x519583){logger[_0x6c9b('0x4d')](_0x6c9b('0x47'),JSON['stringify'](_0x519583));});};exports['outbound']=function(_0x2b8ee3,_0x1aa923,_0x2e9dd5,_0x36ccee,_0x1fd2b4,_0x4bb887,_0x1eeff6){var _0x1beec9,_0x1ac372;_0x4bb887['remoteUri']=intUtil[_0x6c9b('0x3f')](_0x4bb887['remoteUri']);_0x4bb887[_0x6c9b('0x40')]=intUtil[_0x6c9b('0x3f')](_0x4bb887[_0x6c9b('0x40')]);if(_0x1eeff6&&_0x1eeff6[_0x6c9b('0x4e')]&&_0x1eeff6[_0x6c9b('0x4e')]!=='none'){logger['info']('[OUTBOUND]',_0x6c9b('0x4f'));_0x1aa923[_0x6c9b('0x42')]=util[_0x6c9b('0xc')](_0x6c9b('0x50'),_0x4bb887[_0x6c9b('0x40')],_0x1aa923[_0x6c9b('0x43')],md5(_0x1aa923[_0x6c9b('0x43')]));}headers[_0x6c9b('0x44')]=getAuth(_0x4bb887);return getUser(_0x4bb887,_0x36ccee[_0x6c9b('0x23')])['then'](function(_0x478f89){_0x1beec9=_0x478f89;logger['info'](_0x6c9b('0x51'),_0x1beec9['id']);return getEndUser(_0x4bb887,_0x1aa923[_0x6c9b('0x52')],_0x1aa923[_0x6c9b('0x53')]);})['then'](function(_0x5dc502){_0x1ac372=_0x5dc502;logger[_0x6c9b('0x1e')](_0x6c9b('0x45'),_0x1ac372['id']);return getTicket(_0x4bb887,_0x1beec9,_0x1ac372,_0x2e9dd5,_0x1aa923);})[_0x6c9b('0x1d')](function(_0x588e55){if(_0x588e55&&_0x588e55['id']){logger['info'](_0x6c9b('0x46'));logger['info'](_0x6c9b('0x54'),_0x588e55['id']);logger[_0x6c9b('0x1e')](_0x6c9b('0x55'),_0x6c9b('0x48'));emit(util[_0x6c9b('0xc')](_0x6c9b('0x49'),_0x36ccee[_0x6c9b('0x14')]),_0x6c9b('0x4a'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x4bb887[_0x6c9b('0x1b')],_0x588e55['id'])});}})[_0x6c9b('0x4c')](function(_0x578019){logger[_0x6c9b('0x4d')]('[OUTBOUND]',JSON['stringify'](_0x578019));});};exports[_0x6c9b('0x56')]=function(_0x3508ff,_0x483494,_0x178caf,_0xfbd223,_0x30ae2e,_0x3b4f95){var _0x2b6f34,_0x1b2adf;_0x3b4f95[_0x6c9b('0x1b')]=intUtil[_0x6c9b('0x3f')](_0x3b4f95[_0x6c9b('0x1b')]);_0x3b4f95[_0x6c9b('0x40')]=intUtil[_0x6c9b('0x3f')](_0x3b4f95[_0x6c9b('0x40')]);if(_0x30ae2e&&_0x30ae2e['monitor_format']){logger['info'](_0x6c9b('0x57'),_0x6c9b('0x4f'));_0x483494[_0x6c9b('0x42')]=util[_0x6c9b('0xc')](_0x6c9b('0x50'),_0x3b4f95[_0x6c9b('0x40')],_0x483494[_0x6c9b('0x43')],md5(_0x483494[_0x6c9b('0x43')]));}else{_0x483494['recordingURL']='';}headers[_0x6c9b('0x44')]=getAuth(_0x3b4f95);return getUser(_0x3b4f95,'')[_0x6c9b('0x1d')](function(_0x5dd64b){_0x2b6f34=_0x5dd64b;logger[_0x6c9b('0x1e')](_0x6c9b('0x51'),_0x2b6f34['id']);return getEndUser(_0x3b4f95,_0x483494['calleridname'],_0x483494['calleridnum']);})[_0x6c9b('0x1d')](function(_0x4edbe1){_0x1b2adf=_0x4edbe1;logger[_0x6c9b('0x1e')](_0x6c9b('0x45'),_0x1b2adf['id']);return getTicket(_0x3b4f95,_0x2b6f34,_0x1b2adf,_0x178caf,_0x483494);})['then'](function(_0x2f2e4b){if(_0x2f2e4b){logger['info'](_0x6c9b('0x46'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x2f2e4b['id']);}})[_0x6c9b('0x4c')](function(_0x4d3752){logger[_0x6c9b('0x4d')]('[ABANDONED]',JSON[_0x6c9b('0x31')](_0x4d3752));});}; \ No newline at end of file +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 diff --git a/server/services/ami/trigger/integration/freshsales.js b/server/services/ami/trigger/integration/freshsales.js index 91f002a..31f9dbc 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 _0x0852=['adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','userEmail','User\x20found:','userId','Admin\x20selected','Getting\x20contacts\x20filter','filters','forEach','name','Getting\x20contact\x20list','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contactNumber','contacts','find','mobile_number','endUserId','Contact\x20found:','Contact\x20created:','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','POST','/api/tasks','getString','ticketId','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','destcalleridnum','callDirection','queue','abandoned','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s',']\x20Error\x20running\x20Freshsales\x20integration','lodash','md5','util','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','length','email'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x0852,0x8d));var _0x2085=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x0852[_0x565ed7];return _0x183ad7;};'use strict';var _=require(_0x2085('0x0'));var rp=require('request-promise');var md5=require(_0x2085('0x1'));var util=require(_0x2085('0x2'));var moment=require('moment');var Promise=require(_0x2085('0x3'));var Redis=require(_0x2085('0x4'));var intUtil=require(_0x2085('0x5'));var config=require(_0x2085('0x6'));var logger=require(_0x2085('0x7'))('freshsales');config[_0x2085('0x8')]=_['defaults'](config['redis'],{'host':_0x2085('0x9'),'port':0x18eb});var io=require(_0x2085('0xa'))(new Redis(config[_0x2085('0x8')]));function getAdminId(_0x2aa60c,_0x4f77d4,_0x8897e7,_0xfcd7c){return new Promise(function(_0x55b29a,_0x1ad654){var _0x415e7f=![];var _0xca6c96={'method':_0x2085('0xb'),'uri':_0xfcd7c+_0x2085('0xc'),'json':!![]};_0xca6c96[_0x2085('0xd')]=_0x8897e7;logger[_0x2085('0xe')](_0x2085('0xf'));return rp(_0xca6c96)[_0x2085('0x10')](function(_0x34aede){if(_0x34aede){var _0x2fcdcc=_0x34aede['users'];var _0x4a2511=null;for(_0x4a2511=0x0;_0x4a2511<_0x2fcdcc[_0x2085('0x11')];_0x4a2511++){if(_0x2fcdcc[_0x4a2511][_0x2085('0x12')]===_0x2aa60c[_0x2085('0x13')]){_0x2aa60c[_0x2085('0x14')]=_0x2fcdcc[_0x4a2511]['id'];_0x415e7f=!![];}}if(_0x415e7f){logger[_0x2085('0xe')]('Admin\x20found:',_0x2aa60c['adminId']);_0x55b29a(_0x2aa60c);}else{_0x1ad654({'statusCode':0x194,'message':_0x2085('0x15')});}}else{_0x1ad654({'statusCode':0x194,'message':_0x2085('0x15')});}})[_0x2085('0x16')](function(_0x226a2e){logger[_0x2085('0x17')]('['+[_0x4f77d4[_0x2085('0x18')]()]+']',_0x226a2e[_0x2085('0x19')]);_0x1ad654(_0x226a2e);});});}function getUser(_0x166d9a,_0x57ec23,_0x1a03bc){return function(_0x43c846){return new Promise(function(_0x18e7c8,_0x2b63d2){var _0x3124cd={'method':_0x2085('0xb'),'uri':_0x1a03bc+_0x2085('0xc'),'json':!![]};_0x3124cd[_0x2085('0xd')]=_0x57ec23;logger['info'](_0x2085('0x1a'));return rp(_0x3124cd)[_0x2085('0x10')](function(_0x52c7b1){if(_0x52c7b1){var _0x2f3b42=_0x52c7b1['users'];var _0x4ddbc0=![];var _0x224af3=null;if(_0x43c846[_0x2085('0x1b')]!==null){logger['info']('Getting\x20user\x20with\x20email',_0x43c846[_0x2085('0x1b')]);_0x43c846[_0x2085('0x1c')]=_0x43c846[_0x2085('0x1b')];for(_0x224af3=0x0;_0x224af3<_0x2f3b42['length'];_0x224af3++){if(_0x2f3b42[_0x224af3][_0x2085('0x12')]===_0x43c846[_0x2085('0x1b')]){_0x4ddbc0=!![];_0x43c846['userId']=_0x2f3b42[_0x224af3]['id'];logger[_0x2085('0xe')](_0x2085('0x1d'),_0x43c846[_0x2085('0x1e')]);}}}if(!_0x4ddbc0){logger['info'](_0x2085('0x1f'));_0x43c846['userEmail']=_0x43c846[_0x2085('0x13')];_0x43c846['userId']=_0x43c846[_0x2085('0x14')];_0x4ddbc0=!![];}if(_0x4ddbc0){_0x18e7c8(_0x43c846);}else{_0x2b63d2({'statusCode':0x194,'message':_0x2085('0x15')});}}else{_0x2b63d2({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x2085('0x16')](function(_0x3f64da){logger[_0x2085('0x17')]('['+[_0x166d9a[_0x2085('0x18')]()]+']',_0x3f64da[_0x2085('0x19')]);_0x2b63d2(_0x3f64da);});});};}function getEndUser(_0x271a62,_0x833b32,_0x35c4c0){return function(_0x43df61){return new Promise(function(_0x599f32,_0x3b6fc2){var _0xf9bfbe=0x0;var _0x4ec7e7={'method':_0x2085('0xb'),'uri':_0x35c4c0+'/api/contacts/filters','json':!![]};_0x4ec7e7['headers']=_0x833b32;logger['info'](_0x2085('0x20'));return rp(_0x4ec7e7)[_0x2085('0x10')](function(_0x4a5385){_0x4a5385[_0x2085('0x21')][_0x2085('0x22')](function(_0x7b83bf){if(_0x7b83bf[_0x2085('0x23')]==='All\x20Contacts'){_0xf9bfbe=_0x7b83bf['id'];}});})['then'](function(){logger['info'](_0x2085('0x24'));var _0x281e96={'method':_0x2085('0xb'),'uri':_0x35c4c0+_0x2085('0x25')+_0xf9bfbe,'json':!![]};_0x281e96[_0x2085('0xd')]=_0x833b32;return rp(_0x281e96);})[_0x2085('0x10')](function(_0x3303dd){logger[_0x2085('0xe')](_0x2085('0x26'),_0x43df61[_0x2085('0x27')]);if(_0x3303dd[_0x2085('0x28')]['length']>0x0){var _0x33586e=_[_0x2085('0x29')](_0x3303dd['contacts'],function(_0x1c9497){if(_0x1c9497['work_number']===_0x43df61['contactNumber']||_0x1c9497[_0x2085('0x2a')]===_0x43df61['contactNumber']){return _0x1c9497;}});if(_0x33586e){_0x43df61[_0x2085('0x2b')]=_0x33586e['id'];logger[_0x2085('0xe')](_0x2085('0x2c'),_0x43df61[_0x2085('0x2b')]);_0x599f32(_0x43df61);}else{return createEndUser(_0x43df61,_0x271a62,_0x833b32,_0x35c4c0)[_0x2085('0x10')](function(_0x33c07b){logger['info'](_0x2085('0x2d'),_0x43df61[_0x2085('0x2b')]);_0x599f32(_0x33c07b);});}}else{return createEndUser(_0x43df61,_0x271a62,_0x833b32,_0x35c4c0)['then'](function(_0x2097c6){logger[_0x2085('0xe')](_0x2085('0x2d'),_0x43df61[_0x2085('0x2b')]);_0x599f32(_0x2097c6);});}})['catch'](function(_0x4d4ce4){throw new Error(_0x4d4ce4[_0x2085('0x19')]);});});};}function createEndUser(_0x497f16,_0x155d5e,_0x34c346,_0x5e77bb){return new Promise(function(_0x56174c,_0x53cbcf){var _0x2cfb7b=moment();var _0x5e661d={'method':'POST','uri':_0x5e77bb+_0x2085('0x2e'),'body':{'contact':{'last_name':_0x497f16['contactNumber'],'work_number':_0x497f16['contactNumber'],'mobile_number':_0x497f16['contactNumber'],'owner_id':_0x497f16[_0x2085('0x1e')],'created_at':_0x2cfb7b[_0x2085('0x2f')](_0x2085('0x30'))}},'json':!![]};_0x5e661d[_0x2085('0xd')]=_0x34c346;logger[_0x2085('0xe')](_0x2085('0x31'));return rp(_0x5e661d)[_0x2085('0x10')](function(_0x196b8d){_0x497f16['endUserId']=_0x196b8d[_0x2085('0x32')]['id'];_0x56174c(_0x497f16);})[_0x2085('0x16')](function(_0x919055){logger[_0x2085('0x17')]('['+[_0x155d5e[_0x2085('0x18')]()]+']',_0x919055[_0x2085('0x19')]);_0x53cbcf(_0x919055[_0x2085('0x19')]);});});}function getTicket(_0x2b7f56,_0x500b5f,_0x34eb18,_0x1da016,_0xe9fbfc){return function(_0x52457b){logger['info'](_0x2085('0x33'));return new Promise(function(_0x3270c8,_0x4df684){var _0x38ac80=moment();var _0xc75a36={'method':_0x2085('0x34'),'uri':_0x34eb18+_0x2085('0x35'),'body':{'title':intUtil[_0x2085('0x36')](_0x1da016['Subjects'],_0xe9fbfc,'\x20'),'description':intUtil[_0x2085('0x36')](_0x1da016['Descriptions'],_0xe9fbfc,'\x0a'),'owner_id':_0x52457b[_0x2085('0x1e')],'creater_id':_0x52457b['adminId'],'targetable_id':_0x52457b['endUserId'],'targetable_type':'Contact','created_at':_0x38ac80[_0x2085('0x2f')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x38ac80['add'](0x1e,'m')[_0x2085('0x2f')](_0x2085('0x30'))},'json':!![]};_0xc75a36['headers']=_0x500b5f;return rp(_0xc75a36)['then'](function(_0x17e70f){_0x52457b[_0x2085('0x37')]=_0x17e70f['task']['id'];logger[_0x2085('0xe')]('Task\x20created:',_0x52457b['ticketId']);_0x3270c8(_0x52457b);})[_0x2085('0x16')](function(_0x2c2ee5){logger[_0x2085('0x17')]('['+[_0x2b7f56[_0x2085('0x18')]()]+']',_0x2c2ee5[_0x2085('0x19')]);_0x4df684(_0x2c2ee5['message']);});});};}function emit(_0x2794cc,_0x58ad75,_0x5cbe41){var _0x134702={'uri':_0x2794cc+_0x2085('0x38')+_0x5cbe41};io['to'](util[_0x2085('0x2f')](_0x2085('0x39'),_0x58ad75))[_0x2085('0x3a')](_0x2085('0x3b'),_0x134702);}exports['cs']=function(_0x5d0011,_0x72fee4,_0x18a5fd,_0x16f8a7,_0x1eb9f9,_0x4c3fa2,_0x1ce61e,_0x4d38b6){var _0x2ced38={};var _0x4ffef2={'Authorization':_0x2085('0x3c')+_0x4c3fa2[_0x2085('0x3d')]};_0x4c3fa2[_0x2085('0x3e')]=intUtil[_0x2085('0x3f')](_0x4c3fa2[_0x2085('0x3e')]);_0x4c3fa2['serverUrl']=intUtil['stripTrailingSlash'](_0x4c3fa2[_0x2085('0x40')]);var _0x5d5a86=_0x4c3fa2[_0x2085('0x3e')];_0x2ced38['adminEmail']=_0x4c3fa2['username'];_0x2ced38['contactNumber']=_0x4d38b6[_0x2085('0x41')]()==='outbound'?_0x72fee4[_0x2085('0x42')]:_0x72fee4['calleridnum'];_0x2ced38[_0x2085('0x43')]=_0x4d38b6===_0x2085('0x44')||_0x4d38b6===_0x2085('0x45')?_0x2085('0x44'):'outbound';if(_0x16f8a7){_0x2ced38[_0x2085('0x1b')]=_0x16f8a7[_0x2085('0x12')];}var _0x5a3e5d=util[_0x2085('0x2f')](_0x2085('0x46'),_0x4c3fa2[_0x2085('0x40')],_0x72fee4[_0x2085('0x47')],md5(_0x72fee4['uniqueid']));if(_0x1eb9f9&&_0x1eb9f9[_0x2085('0x48')]){logger[_0x2085('0xe')](_0x2085('0x49'),_0x2085('0x4a'));_0x72fee4[_0x2085('0x4b')]=_0x5a3e5d;}else if(_0x1ce61e&&_0x1ce61e[_0x2085('0x4c')]&&_0x1ce61e['recordingFormat']!=='none'){logger[_0x2085('0xe')](_0x2085('0x4d'),_0x2085('0x4a'));_0x72fee4[_0x2085('0x4b')]=_0x5a3e5d;}else{_0x72fee4[_0x2085('0x4b')]='';}return getAdminId(_0x2ced38,_0x4d38b6,_0x4ffef2,_0x5d5a86)[_0x2085('0x10')](getUser(_0x4d38b6,_0x4ffef2,_0x5d5a86))[_0x2085('0x10')](getEndUser(_0x4d38b6,_0x4ffef2,_0x5d5a86))[_0x2085('0x10')](getTicket(_0x4d38b6,_0x4ffef2,_0x5d5a86,_0x18a5fd,_0x72fee4))['then'](function(_0x1b7835){logger['info'](util[_0x2085('0x2f')](_0x2085('0x4e'),_0x1b7835['ticketId']));if(_0x4d38b6!==_0x2085('0x45')){logger[_0x2085('0xe')]('['+[_0x4d38b6[_0x2085('0x18')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x5d5a86,_0x16f8a7[_0x2085('0x23')],_0x1b7835[_0x2085('0x2b')]);}})[_0x2085('0x16')](function(_0x37674c){logger[_0x2085('0x17')]('['+[_0x4d38b6[_0x2085('0x18')]()]+_0x2085('0x4f'),util['inspect'](_0x37674c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +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 diff --git a/server/services/ami/trigger/integration/index.js b/server/services/ami/trigger/integration/index.js index bb5b29f..a5807d5 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(_0x1e8cbb,_0xb07ce4){var _0x52b5a0=function(_0x1b0328){while(--_0x1b0328){_0x1e8cbb['push'](_0x1e8cbb['shift']());}};_0x52b5a0(++_0xb07ce4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_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 diff --git a/server/services/ami/trigger/integration/salesforce.js b/server/services/ami/trigger/integration/salesforce.js index 75a9969..a020d7d 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 _0xc04b=['stringify','outbound','recordingFormat','none','Recording\x20is\x20enabled!','uniqueid','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','[ABANDONED]\x20Ticket\x20%s\x20created.','[ABANDONED]\x20Integration\x20account\x20type\x20%s.','[ABANDONED]','lodash','moment','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','emit','ticketType','Task','assign','utc','getString','Subjects','WhoId','Case','Descriptions','ContactId','sobject','create','isNil','validateEmail','find','length','info','Agent\x20%s\x20found.','resolve','Name','identity','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','then','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','contact','execute','lead','Lead','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','forEach','type','string','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','password','concat','Connection','remoteUri','https://login.salesforce.com','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','recordingURL','email','calleridname','calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','user:%s','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch'];(function(_0x579fa4,_0x1911e0){var _0x514fa2=function(_0x31dd24){while(--_0x31dd24){_0x579fa4['push'](_0x579fa4['shift']());}};_0x514fa2(++_0x1911e0);}(_0xc04b,0x1c3));var _0xbc04=function(_0x3fb816,_0x3cd68b){_0x3fb816=_0x3fb816-0x0;var _0x29b482=_0xc04b[_0x3fb816];return _0x29b482;};'use strict';var _=require(_0xbc04('0x0'));var rp=require('request-promise');var moment=require(_0xbc04('0x1'));var BPromise=require(_0xbc04('0x2'));var md5=require('md5');var jsforce=require('jsforce');var util=require(_0xbc04('0x3'));var Redis=require(_0xbc04('0x4'));var intUtil=require(_0xbc04('0x5'));var config=require(_0xbc04('0x6'));var logger=require(_0xbc04('0x7'))(_0xbc04('0x8'));config[_0xbc04('0x9')]=_[_0xbc04('0xa')](config[_0xbc04('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbc04('0x9')]));function emit(_0x236d08,_0x2c01e9,_0x4c2683){io['to'](_0x236d08)[_0xbc04('0xb')](_0x2c01e9,_0x4c2683);}function getTicket(_0x225bca,_0x1919e9,_0x48cdb5,_0x33c8f6,_0x4aca0d,_0x25dc55,_0x2f8255,_0x191f44){var _0x4b8604={};if(_0x33c8f6[_0xbc04('0xc')]===_0xbc04('0xd')){_0x4b8604=Object[_0xbc04('0xe')]({},{'OwnerId':_0x1919e9['id'],'ActivityDate':moment[_0xbc04('0xf')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0xbc04('0x10')](_0x33c8f6[_0xbc04('0x11')],_0x4aca0d,'\x20'),'Description':intUtil[_0xbc04('0x10')](_0x33c8f6['Descriptions'],_0x4aca0d,'\x0a')},getCustomFields(_0x25dc55,_0x4aca0d));if(_0x48cdb5){_0x4b8604[_0xbc04('0x12')]=_0x48cdb5['id'];}}else if(_0x33c8f6[_0xbc04('0xc')]===_0xbc04('0x13')){_0x4b8604=Object[_0xbc04('0xe')]({},{'OwnerId':_0x1919e9['id'],'Subject':intUtil[_0xbc04('0x10')](_0x33c8f6[_0xbc04('0x11')],_0x4aca0d,'\x20'),'Description':intUtil[_0xbc04('0x10')](_0x33c8f6[_0xbc04('0x14')],_0x4aca0d,'\x0a')},getCustomFields(_0x25dc55,_0x4aca0d));if(_0x48cdb5){_0x4b8604[_0xbc04('0x15')]=_0x48cdb5['id'];}}return _0x2f8255[_0xbc04('0x16')](_0x33c8f6[_0xbc04('0xc')])[_0xbc04('0x17')](_0x4b8604);}function getUser(_0xdb9964,_0x226c7f,_0x21a47b){if(!_[_0xbc04('0x18')](_0x226c7f)&&intUtil[_0xbc04('0x19')](_0x226c7f)){var _0x3eb61d={'Email':_0x226c7f};var _0x42d5d7={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x21a47b[_0xbc04('0x16')]('User')[_0xbc04('0x1a')](_0x3eb61d,_0x42d5d7)['execute']()['then'](function(_0x2b9c1d){if(_0x2b9c1d[_0xbc04('0x1b')]){var _0x10f616=_[_0xbc04('0x1a')](_0x2b9c1d,function(_0x1c841b){return _0x1c841b['Email']===_0x226c7f;});if(_0x10f616){logger[_0xbc04('0x1c')](_0xbc04('0x1d'),_0x226c7f);return BPromise[_0xbc04('0x1e')]({'id':_0x10f616['Id'],'name':_0x10f616[_0xbc04('0x1f')]});}}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x226c7f);return _0x21a47b[_0xbc04('0x20')]()['then'](function(_0x60fd72){return BPromise[_0xbc04('0x1e')]({'id':_0x60fd72[_0xbc04('0x21')],'name':_0x60fd72[_0xbc04('0x22')]});});}});}else{logger[_0xbc04('0x1c')](_0xbc04('0x23'),_0x226c7f);return _0x21a47b[_0xbc04('0x20')]()[_0xbc04('0x24')](function(_0x40404a){return BPromise[_0xbc04('0x1e')]({'id':_0x40404a[_0xbc04('0x21')],'name':_0x40404a[_0xbc04('0x22')]});});}}function getEndUser(_0x4567e0,_0x409e70,_0x46c720,_0x55646a,_0x51f823){var _0x58dea3={'Phone':_0x55646a};var _0x516c30={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xbc04('0x1e')]()[_0xbc04('0x24')](function(){if(_0x409e70[_0xbc04('0xc')]==='Task'){logger['info'](_0xbc04('0x25'),_0x55646a,_0x409e70[_0xbc04('0x26')]);switch(_0x409e70[_0xbc04('0x26')]){case _0xbc04('0x27'):return _0x51f823[_0xbc04('0x16')](_0xbc04('0x28'))[_0xbc04('0x1a')](_0x58dea3,_0x516c30)['execute']()[_0xbc04('0x24')](function(_0x37ff7f){if(_0x37ff7f&&_0x37ff7f['length']){return _0x37ff7f;}else{return _0x51f823[_0xbc04('0x16')]('Lead')[_0xbc04('0x1a')](_0x58dea3,_0x516c30);}});case _0xbc04('0x29'):return _0x51f823[_0xbc04('0x16')]('Contact')[_0xbc04('0x1a')](_0x58dea3,_0x516c30)[_0xbc04('0x2a')]();case _0xbc04('0x2b'):return _0x51f823[_0xbc04('0x16')](_0xbc04('0x2c'))[_0xbc04('0x1a')](_0x58dea3,_0x516c30);default:return null;}}else if(_0x409e70[_0xbc04('0xc')]===_0xbc04('0x13')){logger['info'](_0xbc04('0x25'),_0x55646a,_0xbc04('0x29'));return _0x51f823['sobject'](_0xbc04('0x28'))[_0xbc04('0x1a')](_0x58dea3,_0x516c30)[_0xbc04('0x2a')]();}})['then'](function(_0x77b398){if(_0x77b398&&_0x77b398[_0xbc04('0x1b')]){var _0x221659=_[_0xbc04('0x1a')](_0x77b398,function(_0x5befbc){return _0x5befbc['Phone']===_0x55646a;});if(_0x221659){return BPromise['resolve']({'id':_0x221659['Id'],'name':_0x221659[_0xbc04('0x1f')],'phone':_0x221659['Phone']});}}})['then'](function(_0x51157a){if(_0x51157a){logger[_0xbc04('0x1c')](_0xbc04('0x2d'),_0x55646a);return BPromise['resolve'](_0x51157a);}else{logger['info'](_0xbc04('0x2e'),_0x55646a);var _0xe0a9f0={'LastName':_0x46c720!==_0xbc04('0x2f')?_0x46c720:util[_0xbc04('0x30')]('Caller\x20-\x20%s',_0x55646a),'Phone':_0x55646a};if(_0x409e70[_0xbc04('0x31')]){if(_0x409e70['moduleCreate']===_0xbc04('0x29')){logger['info'](_0xbc04('0x32'),_0x55646a,_0x409e70[_0xbc04('0x31')]);}else if(_0x409e70[_0xbc04('0x31')]===_0xbc04('0x2b')&&_0x409e70[_0xbc04('0xc')]===_0xbc04('0xd')){logger['info'](_0xbc04('0x32'),_0x55646a,_0x409e70[_0xbc04('0x31')]);_0xe0a9f0[_0xbc04('0x33')]=_0xbc04('0x34');}else{return null;}}return _0x51f823[_0xbc04('0x16')](_[_0xbc04('0x35')](_0x409e70[_0xbc04('0x31')]))[_0xbc04('0x17')](_0xe0a9f0);}});}function getCustomFields(_0x42614d,_0x24c115){var _0x4af289={};if(_0x42614d[_0xbc04('0x1b')]>0x0){_[_0xbc04('0x36')](_0x42614d,function(_0x1cd1cd){if(_0x1cd1cd[_0xbc04('0x37')]===_0xbc04('0x38')&&_0x1cd1cd[_0xbc04('0x39')]){_0x4af289[_0x1cd1cd[_0xbc04('0x39')]]=_0x1cd1cd[_0xbc04('0x3a')][_0xbc04('0x3b')]();}else if(_0x1cd1cd['type']==='variable'&&_0x1cd1cd[_0xbc04('0x3c')]&&_0x1cd1cd[_0xbc04('0x39')]){_0x24c115[_0x1cd1cd[_0xbc04('0x3c')]]&&(_0x4af289[_0x1cd1cd[_0xbc04('0x39')]]=_0x24c115[_0x1cd1cd[_0xbc04('0x3c')]][_0xbc04('0x3b')]());}else if(_0x1cd1cd[_0xbc04('0x37')]===_0xbc04('0x3d')&&_0x1cd1cd[_0xbc04('0x3e')]&&_0x1cd1cd['Variable'][_0xbc04('0x3f')]&&_0x1cd1cd[_0xbc04('0x39')]){_0x24c115[_0x1cd1cd[_0xbc04('0x3e')][_0xbc04('0x3f')][_0xbc04('0x40')]()]&&(_0x4af289[_0x1cd1cd[_0xbc04('0x39')]]=_0x24c115[_0x1cd1cd[_0xbc04('0x3e')][_0xbc04('0x3f')]['toLowerCase']()]['toString']());}});}return _0x4af289;}function getConnection(_0x37f8e0){var _0x3cfdff=_0x37f8e0[_0xbc04('0x41')][_0xbc04('0x42')](_0x37f8e0['securityToken']);var _0x22294a=new jsforce[(_0xbc04('0x43'))]({'oauth2':{'loginUrl':_0x37f8e0[_0xbc04('0x44')]||_0xbc04('0x45'),'clientId':_0x37f8e0['clientId'],'clientSecret':_0x37f8e0[_0xbc04('0x46')]}});return _0x22294a[_0xbc04('0x47')](_0x37f8e0[_0xbc04('0x48')],_0x3cfdff)[_0xbc04('0x24')](function(){logger['info'](_0xbc04('0x49'));return _0x22294a;});}exports[_0xbc04('0x4a')]=function(_0x118705,_0x30e842,_0x316f38,_0x44d199,_0x1708d8,_0x3fbf04){var _0x5981f4,_0x4592b7,_0x1763e6,_0x43a388;_0x3fbf04[_0xbc04('0x4b')]=intUtil[_0xbc04('0x4c')](_0x3fbf04[_0xbc04('0x4b')]);_0x3fbf04[_0xbc04('0x44')]=intUtil['stripTrailingSlash'](_0x3fbf04[_0xbc04('0x44')]);if(_0x1708d8&&_0x1708d8['monitor_format']){logger[_0xbc04('0x1c')](_0xbc04('0x4d'),'Recording\x20is\x20enabled!');_0x30e842['recordingURL']=util['format'](_0xbc04('0x4e'),_0x3fbf04[_0xbc04('0x4b')],_0x30e842['uniqueid'],md5(_0x30e842['uniqueid']));}else{_0x30e842[_0xbc04('0x4f')]='';}return getConnection(_0x3fbf04)[_0xbc04('0x24')](function(_0x219280){_0x43a388=_0x219280;return getUser(_0x3fbf04,_0x44d199[_0xbc04('0x50')],_0x43a388);})[_0xbc04('0x24')](function(_0x2a47e6){_0x5981f4=_0x2a47e6;return getEndUser(_0x3fbf04,_0x316f38,_0x30e842[_0xbc04('0x51')],_0x30e842[_0xbc04('0x52')],_0x43a388);})[_0xbc04('0x24')](function(_0x7c2466){_0x4592b7=_0x7c2466;return getTicket(_0x3fbf04,_0x5981f4,_0x4592b7,_0x316f38,_0x30e842,_0x316f38[_0xbc04('0x53')],_0x43a388,_0xbc04('0x4a'));})['then'](function(_0x418034){_0x1763e6=_0x418034;logger['info']('[QUEUE]\x20Ticket\x20%s\x20created',_0x1763e6['id']);logger[_0xbc04('0x1c')](_0xbc04('0x54'),_0x1763e6['id'],_0x44d199['name'],_0x3fbf04[_0xbc04('0x37')]);switch(_0x3fbf04[_0xbc04('0x37')]){case _0xbc04('0x55'):emit(util[_0xbc04('0x30')]('user:%s',_0x44d199[_0xbc04('0x3f')]),_0xbc04('0x56'),{'recordId':_0x1763e6['id']});break;case _0xbc04('0x57'):emit(util[_0xbc04('0x30')](_0xbc04('0x58'),_0x44d199['name']),'trigger:browser:url',{'uri':util[_0xbc04('0x30')](_0xbc04('0x59'),_0x43a388[_0xbc04('0x5a')],_0x1763e6['id'])});break;default:logger[_0xbc04('0x5b')](_0xbc04('0x5c'));}})[_0xbc04('0x5d')](function(_0x520424){logger[_0xbc04('0x5b')](_0xbc04('0x4d'),JSON[_0xbc04('0x5e')](_0x520424));});};exports[_0xbc04('0x5f')]=function(_0x214612,_0x927eff,_0x563a24,_0x13ed7c,_0x8772d,_0xaee51c,_0xf98d1d){var _0x28cfa2,_0x574d08,_0x5eeed9,_0x501556;_0xaee51c[_0xbc04('0x4b')]=intUtil['stripTrailingSlash'](_0xaee51c[_0xbc04('0x4b')]);_0xaee51c['remoteUri']=intUtil[_0xbc04('0x4c')](_0xaee51c[_0xbc04('0x44')]);if(_0xf98d1d&&_0xf98d1d[_0xbc04('0x60')]&&_0xf98d1d['recordingFormat']!==_0xbc04('0x61')){logger[_0xbc04('0x1c')]('[OUTBOUND]',_0xbc04('0x62'));_0x927eff[_0xbc04('0x4f')]=util[_0xbc04('0x30')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xaee51c['serverUrl'],_0x927eff['uniqueid'],md5(_0x927eff[_0xbc04('0x63')]));}return getConnection(_0xaee51c)[_0xbc04('0x24')](function(_0x4e85c9){_0x501556=_0x4e85c9;return getUser(_0xaee51c,_0x13ed7c['email'],_0x501556);})[_0xbc04('0x24')](function(_0x4f2fe6){_0x28cfa2=_0x4f2fe6;return getEndUser(_0xaee51c,_0x563a24,_0x927eff[_0xbc04('0x64')],_0x927eff[_0xbc04('0x65')],_0x501556);})[_0xbc04('0x24')](function(_0x405d1e){_0x574d08=_0x405d1e;return getTicket(_0xaee51c,_0x28cfa2,_0x574d08,_0x563a24,_0x927eff,_0x563a24['Fields'],_0x501556,_0xbc04('0x5f'));})[_0xbc04('0x24')](function(_0x5ec61b){_0x5eeed9=_0x5ec61b;logger[_0xbc04('0x1c')](_0xbc04('0x66'),_0x5eeed9['id']);logger[_0xbc04('0x1c')](_0xbc04('0x67'),_0x5eeed9['id'],_0x13ed7c['name'],_0xaee51c[_0xbc04('0x37')]);switch(_0xaee51c['type']){case _0xbc04('0x55'):emit(util[_0xbc04('0x30')](_0xbc04('0x58'),_0x13ed7c[_0xbc04('0x3f')]),_0xbc04('0x56'),{'recordId':_0x5eeed9['id']});break;case _0xbc04('0x57'):emit(util[_0xbc04('0x30')]('user:%s',_0x13ed7c[_0xbc04('0x3f')]),'trigger:browser:url',{'uri':util['format'](_0xbc04('0x59'),_0x501556[_0xbc04('0x5a')],_0x5eeed9['id'])});break;default:logger[_0xbc04('0x5b')](_0xbc04('0x68'),_0xbc04('0x69'));}})['catch'](function(_0x58cb9c){logger[_0xbc04('0x5b')](_0xbc04('0x68'),JSON['stringify'](_0x58cb9c));});};exports['abandoned']=function(_0x5a4955,_0x5ecbe1,_0x4096e0,_0x51c634,_0x49c208,_0x5ed358){var _0x57a1cb,_0x3f5cb9,_0x5a7212,_0x3c5d53;_0x5ed358[_0xbc04('0x4b')]=intUtil['stripTrailingSlash'](_0x5ed358[_0xbc04('0x4b')]);_0x5ed358[_0xbc04('0x44')]=intUtil[_0xbc04('0x4c')](_0x5ed358['remoteUri']);if(_0x49c208&&_0x49c208['monitor_format']){logger[_0xbc04('0x1c')]('[ABANDONED]','Recording\x20is\x20enabled!');_0x5ecbe1[_0xbc04('0x4f')]=util[_0xbc04('0x30')](_0xbc04('0x4e'),_0x5ed358['serverUrl'],_0x5ecbe1['uniqueid'],md5(_0x5ecbe1[_0xbc04('0x63')]));}else{_0x5ecbe1[_0xbc04('0x4f')]='';}return getConnection(_0x5ed358)[_0xbc04('0x24')](function(_0x1c07f2){_0x3c5d53=_0x1c07f2;if(!_[_0xbc04('0x18')](_0x51c634)){return getUser(_0x5ed358,_0x51c634[_0xbc04('0x3f')],_0x3c5d53);}else{return getUser(_0x5ed358,null,_0x3c5d53);}})[_0xbc04('0x24')](function(_0x5e1101){_0x57a1cb=_0x5e1101;return getEndUser(_0x5ed358,_0x4096e0,_0x5ecbe1[_0xbc04('0x51')],_0x5ecbe1[_0xbc04('0x52')],_0x3c5d53);})[_0xbc04('0x24')](function(_0x409db4){_0x3f5cb9=_0x409db4;return getTicket(_0x5ed358,_0x57a1cb,_0x3f5cb9,_0x4096e0,_0x5ecbe1,_0x4096e0[_0xbc04('0x53')],_0x3c5d53);})[_0xbc04('0x24')](function(_0x1706b6){_0x5a7212=_0x1706b6;logger['info'](_0xbc04('0x6a'),_0x5a7212['id']);logger['info'](_0xbc04('0x6b'),_0x5ed358['type']);})['catch'](function(_0x6bdd79){logger['error'](_0xbc04('0x6c'),JSON[_0xbc04('0x5e')](_0x6bdd79));});}; \ No newline at end of file +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 diff --git a/server/services/ami/trigger/integration/servicenow.js b/server/services/ami/trigger/integration/servicenow.js index 5cc48ae..4b5f5ec 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(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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(_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 diff --git a/server/services/ami/trigger/integration/sugarcrm.js b/server/services/ami/trigger/integration/sugarcrm.js index 8833623..5a3cb80 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 _0x01f0=['Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','version','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...','user:%s','trigger:browser:url','catch','outbound','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Fields','Outbound','contacts','error','[ABANDONED]','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','parent_id','parent_type','Contacts','parent_name','direction','length','push','idField','set_entry','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','JSON','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','user_name','then','find','entry_list','name_value_list','value','Agent\x20found!','resolve','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','first_name','Caller\x20-\x20%s','Enduser\x20created.','merge','forEach','string','nameField','customField','type','custom_fields','content','variableName','customVariable','Variable','toLowerCase','login','username','password','PLAIN','xCALLY\x20Motion\x20integration'];(function(_0xfc1eec,_0x26ca26){var _0x61334=function(_0x28fefc){while(--_0x28fefc){_0xfc1eec['push'](_0xfc1eec['shift']());}};_0x61334(++_0x26ca26);}(_0x01f0,0x18e));var _0x001f=function(_0x9c5831,_0x1286b7){_0x9c5831=_0x9c5831-0x0;var _0x55bf0a=_0x01f0[_0x9c5831];return _0x55bf0a;};'use strict';var _=require(_0x001f('0x0'));var rp=require(_0x001f('0x1'));var BPromise=require(_0x001f('0x2'));var md5=require('md5');var util=require(_0x001f('0x3'));var Redis=require(_0x001f('0x4'));var intUtil=require(_0x001f('0x5'));var config=require(_0x001f('0x6'));var logger=require(_0x001f('0x7'))('sugarcrm');config[_0x001f('0x8')]=_[_0x001f('0x9')](config['redis'],{'host':_0x001f('0xa'),'port':0x18eb});var io=require(_0x001f('0xb'))(new Redis(config['redis']));var def={'method':_0x001f('0xc'),'json':!![]};function emit(_0x200487,_0x247ef3,_0x2fe192){io['to'](_0x200487)[_0x001f('0xd')](_0x247ef3,_0x2fe192);}function getTicket(_0x58536f,_0x46d89c,_0xcfda6f,_0x36b64e,_0x546fae,_0x1296ff,_0x56f6ac,_0x4c0b11){logger[_0x001f('0xe')](_0x001f('0xf'));var _0x2aa772=new Date();var _0x34b5bc=[{'name':_0x001f('0x10'),'value':intUtil[_0x001f('0x11')](_0x36b64e[_0x001f('0x12')],_0x546fae,'\x20')},{'name':_0x001f('0x13'),'value':_0x46d89c['id']},{'name':'created_by','value':_0x46d89c['id']},{'name':_0x001f('0x14'),'value':intUtil[_0x001f('0x11')](_0x36b64e[_0x001f('0x15')],_0x546fae,'\x0a')},{'name':_0x001f('0x16'),'value':_0x2aa772[_0x001f('0x17')]()[_0x001f('0x18')](0x0,0x13)[_0x001f('0x19')]('T','\x20')},{'name':_0x001f('0x1a'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x001f('0x1b'),'value':_0xcfda6f['id']},{'name':_0x001f('0x1c'),'value':_0x001f('0x1d')},{'name':_0x001f('0x1e'),'value':_0xcfda6f[_0x001f('0x10')]},{'name':_0x001f('0x1f'),'value':_0x4c0b11}];if(_0x1296ff[_0x001f('0x20')]){_['forEach'](_0x1296ff,function(_0x3d15d7){if(_0x546fae[_0x3d15d7['variableName']]){_0x34b5bc[_0x001f('0x21')]({'name':_0x3d15d7[_0x001f('0x22')],'value':_0x546fae[_0x3d15d7['variableName']]});}});}return request({'form':{'method':_0x001f('0x23'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x001f('0x24')]({'session':_0x56f6ac['id'],'module_name':_0x001f('0x25'),'name_value_list':_0x34b5bc})}});}function getAuth(_0x121aba){return util[_0x001f('0x26')](_0x001f('0x27'),new Buffer(_0x121aba[_0x001f('0x28')]+':X')[_0x001f('0x29')](_0x001f('0x2a')));}function getServerInfo(_0x309375){return request({'form':{'method':_0x001f('0x2b'),'input_type':_0x001f('0x2c'),'response_type':_0x001f('0x2c'),'rest_data':JSON[_0x001f('0x24')]({'session':_0x309375['id']})}});}function getUser(_0x290f0a,_0x515fa7,_0x31a39d){if(!_[_0x001f('0x2d')](_0x515fa7)){logger['info'](_0x001f('0x2e'),_0x515fa7);return request({'form':{'method':_0x001f('0x2f'),'input_type':_0x001f('0x2c'),'response_type':'JSON','rest_data':JSON[_0x001f('0x24')]({'session':_0x31a39d['id'],'module_name':_0x001f('0x30'),'query':util['format']('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x515fa7),'order_by':'','offset':'0','select_fields':['id',_0x001f('0x10'),_0x001f('0x31')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x001f('0x32')](function(_0x57ad20){if(_0x57ad20['entry_list'][_0x001f('0x20')]){var _0x2766f2=_[_0x001f('0x33')](_0x57ad20[_0x001f('0x34')],function(_0xc74eb8){return _0xc74eb8[_0x001f('0x35')][_0x001f('0x31')][_0x001f('0x36')]===_0x515fa7;});if(_0x2766f2){logger[_0x001f('0xe')](_0x001f('0x37'));return BPromise[_0x001f('0x38')]({'id':_0x2766f2[_0x001f('0x35')]['id']['value'],'name':_0x2766f2[_0x001f('0x35')][_0x001f('0x10')][_0x001f('0x36')]});}}logger[_0x001f('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x31a39d[_0x001f('0x35')][_0x001f('0x39')][_0x001f('0x36')],'name':_0x31a39d[_0x001f('0x35')][_0x001f('0x31')][_0x001f('0x36')]});});}else{logger[_0x001f('0xe')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x001f('0x38')]({'id':_0x31a39d[_0x001f('0x35')][_0x001f('0x39')][_0x001f('0x36')],'name':_0x31a39d[_0x001f('0x35')][_0x001f('0x31')][_0x001f('0x36')]});}}function getEndUser(_0x39a71f,_0x5e4b5f,_0x35ced4,_0x25fab5){logger[_0x001f('0xe')](_0x001f('0x3a'),_0x35ced4);return request({'form':{'method':_0x001f('0x2f'),'input_type':_0x001f('0x2c'),'response_type':_0x001f('0x2c'),'rest_data':JSON[_0x001f('0x24')]({'session':_0x25fab5['id'],'module_name':'Contacts','query':util[_0x001f('0x26')](_0x001f('0x3b'),_0x35ced4),'order_by':'','offset':'0','select_fields':['id',_0x001f('0x10'),_0x001f('0x3c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x001f('0x32')](function(_0x45d49a){if(_0x45d49a[_0x001f('0x34')][_0x001f('0x20')]){var _0x47c7e1=_[_0x001f('0x33')](_0x45d49a[_0x001f('0x34')],function(_0x445128){return _0x445128[_0x001f('0x35')][_0x001f('0x3c')][_0x001f('0x36')]===_0x35ced4;});if(_0x47c7e1){logger[_0x001f('0xe')](_0x001f('0x3d'));return BPromise[_0x001f('0x38')]({'id':_0x47c7e1['name_value_list']['id'][_0x001f('0x36')],'name':_0x47c7e1[_0x001f('0x35')][_0x001f('0x10')][_0x001f('0x36')],'phone':_0x47c7e1[_0x001f('0x35')][_0x001f('0x3c')]['value']});}}else{logger[_0x001f('0xe')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x001f('0x23'),'input_type':_0x001f('0x2c'),'response_type':_0x001f('0x2c'),'rest_data':JSON[_0x001f('0x24')]({'session':_0x25fab5['id'],'module_name':_0x001f('0x1d'),'name_value_list':[{'name':_0x001f('0x3e'),'value':_0x5e4b5f!==''?_0x5e4b5f:util[_0x001f('0x26')](_0x001f('0x3f'),_0x35ced4)},{'name':_0x001f('0x3c'),'value':_0x35ced4}]})}})['then'](function(_0x381135){logger[_0x001f('0xe')](_0x001f('0x40'));return BPromise[_0x001f('0x38')]({'id':_0x381135['id'],'name':_0x381135[_0x001f('0x34')][_0x001f('0x3e')][_0x001f('0x36')],'phone':_0x381135['entry_list'][_0x001f('0x3c')]['value']});});}});}function request(_0x535d76){logger['debug']('[HTTP]',JSON['stringify'](_0x535d76));return rp(_[_0x001f('0x41')](def,_0x535d76));}function getTags(_0x136e01,_0x582f05){var _0x24a410=[];if(_0x136e01&&_0x136e01[_0x001f('0x20')]>0x0){_0x24a410=_['map'](_0x136e01,_0x582f05);}return _0x24a410;}function getCustomFields(_0x3e8936,_0x35754c){var _0x5b48ba=[];var _0x2b0ca6={'custom_fields':[]};if(_0x3e8936[_0x001f('0x20')]>0x0){_[_0x001f('0x42')](_0x3e8936,function(_0x49db3a){if(_0x49db3a['type']===_0x001f('0x43')&&_0x49db3a[_0x001f('0x44')]&&!_0x49db3a[_0x001f('0x45')]){_0x2b0ca6[_0x49db3a[_0x001f('0x44')]['toLowerCase']()]=_0x49db3a['content'][_0x001f('0x29')]();}else if(_0x49db3a[_0x001f('0x46')]===_0x001f('0x43')&&_0x49db3a[_0x001f('0x22')]&&_0x49db3a[_0x001f('0x45')]){_0x2b0ca6[_0x001f('0x47')][_0x001f('0x21')]({'id':_0x49db3a[_0x001f('0x22')],'value':_0x49db3a[_0x001f('0x48')][_0x001f('0x29')]()});}else if(_0x49db3a[_0x001f('0x46')]==='variable'&&_0x49db3a[_0x001f('0x49')]&&_0x49db3a[_0x001f('0x22')]&&_0x49db3a[_0x001f('0x45')]){_0x35754c[_0x49db3a[_0x001f('0x49')]]&&_0x2b0ca6['custom_fields'][_0x001f('0x21')]({'id':_0x49db3a[_0x001f('0x22')],'value':_0x35754c[_0x49db3a[_0x001f('0x49')]]['toString']()});}else if(_0x49db3a[_0x001f('0x46')]===_0x001f('0x4a')&&_0x49db3a[_0x001f('0x4b')]&&_0x49db3a['Variable'][_0x001f('0x10')]&&_0x49db3a[_0x001f('0x22')]&&_0x49db3a[_0x001f('0x45')]){_0x35754c[_0x49db3a[_0x001f('0x4b')][_0x001f('0x10')][_0x001f('0x4c')]()]&&_0x2b0ca6[_0x001f('0x47')]['push']({'id':_0x49db3a[_0x001f('0x22')],'value':_0x35754c[_0x49db3a[_0x001f('0x4b')]['name'][_0x001f('0x4c')]()][_0x001f('0x29')]()});}});}return _0x2b0ca6;}function getConnection(_0x5382b2){return request({'method':_0x001f('0xc'),'form':{'method':_0x001f('0x4d'),'input_type':_0x001f('0x2c'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x5382b2[_0x001f('0x4e')],'password':_0x5382b2[_0x001f('0x4f')],'encryption':_0x001f('0x50')},'application':_0x001f('0x51')})}})[_0x001f('0x32')](function(_0x16d0a9){var _0x113407=_0x16d0a9;if(_0x113407['id']){def['sessionID']=_0x113407['id'];return BPromise[_0x001f('0x38')](_0x113407);}else{throw new Error(util[_0x001f('0x26')](_0x001f('0x52'),_0x5382b2['id']));}});}function setRelationship(_0x373081,_0x59b25d,_0x40859d,_0x2746c1){return request({'form':{'method':'set_relationship','input_type':_0x001f('0x2c'),'response_type':_0x001f('0x2c'),'rest_data':JSON[_0x001f('0x24')]({'session':_0x373081['id'],'module_name':_0x001f('0x25'),'module_id':_0x40859d['id'],'link_field_name':_0x2746c1,'related_ids':[_0x59b25d['id']]})}});}exports[_0x001f('0x53')]=function(_0x6e660b,_0x432bf5,_0x20cc05,_0x45660c,_0x434f73,_0xff03a4){var _0x4b061e,_0x5eeb08,_0x33ee08,_0x42b3e6;_0xff03a4[_0x001f('0x54')]=intUtil[_0x001f('0x55')](_0xff03a4[_0x001f('0x54')]);_0xff03a4[_0x001f('0x56')]=intUtil[_0x001f('0x55')](_0xff03a4[_0x001f('0x56')]);def[_0x001f('0x57')]=util[_0x001f('0x26')](_0x001f('0x58'),_0xff03a4['remoteUri']);if(_0x434f73&&_0x434f73['monitor_format']){logger[_0x001f('0xe')](_0x001f('0x59'),_0x001f('0x5a'));_0x432bf5[_0x001f('0x5b')]=util[_0x001f('0x26')](_0x001f('0x5c'),_0xff03a4['serverUrl'],_0x432bf5[_0x001f('0x5d')],md5(_0x432bf5[_0x001f('0x5d')]));}else{_0x432bf5[_0x001f('0x5b')]='';}return getConnection(_0xff03a4)[_0x001f('0x32')](function(_0x4c9214){_0x42b3e6=_0x4c9214;return getUser(_0xff03a4,_0x45660c['name'],_0x42b3e6);})[_0x001f('0x32')](function(_0x240c1e){_0x4b061e=_0x240c1e;logger[_0x001f('0xe')]('The\x20User\x20ID\x20is:',_0x4b061e['id']);return getEndUser(_0xff03a4,_0x432bf5[_0x001f('0x5e')],_0x432bf5[_0x001f('0x5f')],_0x42b3e6);})[_0x001f('0x32')](function(_0x131fa5){_0x5eeb08=_0x131fa5;logger[_0x001f('0xe')](_0x001f('0x60'),_0x5eeb08['id']);return getTicket(_0xff03a4,_0x4b061e,_0x5eeb08,_0x20cc05,_0x432bf5,_0x20cc05['Fields'],_0x42b3e6,_0x001f('0x61'));})[_0x001f('0x32')](function(_0x2aa296){_0x33ee08=_0x2aa296;logger[_0x001f('0xe')](_0x001f('0x62'));logger['info'](_0x001f('0x63'),_0x33ee08['id']);return setRelationship(_0x42b3e6,_0x4b061e,_0x33ee08,_0x001f('0x64'));})[_0x001f('0x32')](function(){return setRelationship(_0x42b3e6,_0x5eeb08,_0x33ee08,'contacts');})[_0x001f('0x32')](function(){return getServerInfo(_0x42b3e6);})[_0x001f('0x32')](function(_0x11f393){var _0x5a82b3=parseInt(_0x11f393[_0x001f('0x65')][_0x001f('0x66')](0x0));var _0x4c1201=util[_0x001f('0x26')](_0x001f('0x67'),_0xff03a4[_0x001f('0x54')],_0x33ee08['id']);if(_0x5a82b3>0x6){_0x4c1201=util[_0x001f('0x26')](_0x001f('0x68'),_0xff03a4[_0x001f('0x54')],_0x33ee08['id']);}logger[_0x001f('0xe')](_0x001f('0x59'),_0x001f('0x69'));emit(util['format'](_0x001f('0x6a'),_0x45660c[_0x001f('0x10')]),_0x001f('0x6b'),{'uri':_0x4c1201});})[_0x001f('0x6c')](function(_0x1cb9a9){logger['error']('[QUEUE]',JSON[_0x001f('0x24')](_0x1cb9a9));});};exports[_0x001f('0x6d')]=function(_0x384d00,_0x11dc19,_0x2d0559,_0x3e8a82,_0x31b4ce,_0x293fb9,_0x46d4c9){var _0x2a189a,_0x50c0b5,_0x2cbcd3,_0x1acbeb;_0x293fb9[_0x001f('0x54')]=intUtil[_0x001f('0x55')](_0x293fb9[_0x001f('0x54')]);_0x293fb9[_0x001f('0x56')]=intUtil[_0x001f('0x55')](_0x293fb9[_0x001f('0x56')]);def[_0x001f('0x57')]=util[_0x001f('0x26')]('%s/service/v4_1/rest.php',_0x293fb9[_0x001f('0x54')]);if(_0x46d4c9&&_0x46d4c9[_0x001f('0x6e')]&&_0x46d4c9[_0x001f('0x6e')]!=='none'){logger[_0x001f('0xe')](_0x001f('0x6f'),_0x001f('0x5a'));_0x11dc19[_0x001f('0x5b')]=util['format'](_0x001f('0x5c'),_0x293fb9[_0x001f('0x56')],_0x11dc19[_0x001f('0x5d')],md5(_0x11dc19[_0x001f('0x5d')]));}return getConnection(_0x293fb9)[_0x001f('0x32')](function(_0x4cbbaa){_0x1acbeb=_0x4cbbaa;return getUser(_0x293fb9,_0x3e8a82[_0x001f('0x10')],_0x1acbeb);})[_0x001f('0x32')](function(_0xe4542b){_0x2a189a=_0xe4542b;logger[_0x001f('0xe')](_0x001f('0x70'),_0x2a189a['id']);return getEndUser(_0x293fb9,_0x11dc19[_0x001f('0x71')],_0x11dc19[_0x001f('0x72')],_0x1acbeb);})['then'](function(_0x1f68c0){_0x50c0b5=_0x1f68c0;logger[_0x001f('0xe')](_0x001f('0x60'),_0x50c0b5['id']);return getTicket(_0x293fb9,_0x2a189a,_0x50c0b5,_0x2d0559,_0x11dc19,_0x2d0559[_0x001f('0x73')],_0x1acbeb,_0x001f('0x74'));})[_0x001f('0x32')](function(_0x3fa7c4){_0x2cbcd3=_0x3fa7c4;logger[_0x001f('0xe')](_0x001f('0x62'));logger[_0x001f('0xe')](_0x001f('0x63'),_0x2cbcd3['id']);return setRelationship(_0x1acbeb,_0x2a189a,_0x2cbcd3,_0x001f('0x64'));})[_0x001f('0x32')](function(){return setRelationship(_0x1acbeb,_0x50c0b5,_0x2cbcd3,_0x001f('0x75'));})[_0x001f('0x32')](function(){return getServerInfo(_0x1acbeb);})[_0x001f('0x32')](function(_0x558354){var _0x3806fe=parseInt(_0x558354[_0x001f('0x65')][_0x001f('0x66')](0x0));var _0xd4d207=util[_0x001f('0x26')](_0x001f('0x67'),_0x293fb9[_0x001f('0x54')],_0x2cbcd3['id']);if(_0x3806fe>0x6){_0xd4d207=util[_0x001f('0x26')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x293fb9[_0x001f('0x54')],_0x2cbcd3['id']);}logger[_0x001f('0xe')](_0x001f('0x6f'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x001f('0x26')](_0x001f('0x6a'),_0x3e8a82[_0x001f('0x10')]),_0x001f('0x6b'),{'uri':_0xd4d207});})[_0x001f('0x6c')](function(_0x50e243){logger[_0x001f('0x76')](_0x001f('0x6f'),JSON[_0x001f('0x24')](_0x50e243));});};exports['abandoned']=function(_0x516087,_0x3691ab,_0xdeada,_0x50b012,_0x19a5db,_0x31e053){var _0x3cfd9c,_0x31e27c,_0x24ca5d,_0x2bd540;_0x31e053[_0x001f('0x54')]=intUtil['stripTrailingSlash'](_0x31e053[_0x001f('0x54')]);_0x31e053['serverUrl']=intUtil['stripTrailingSlash'](_0x31e053['serverUrl']);def[_0x001f('0x57')]=util[_0x001f('0x26')](_0x001f('0x58'),_0x31e053[_0x001f('0x54')]);if(_0x19a5db&&_0x19a5db['monitor_format']){logger[_0x001f('0xe')](_0x001f('0x77'),'Recording\x20is\x20enabled!');_0x3691ab[_0x001f('0x5b')]=util['format'](_0x001f('0x5c'),_0x31e053[_0x001f('0x56')],_0x3691ab['uniqueid'],md5(_0x3691ab['uniqueid']));}else{_0x3691ab['recordingURL']='';}return getConnection(_0x31e053)[_0x001f('0x32')](function(_0x1f4053){_0x2bd540=_0x1f4053;if(!_['isNil'](_0x50b012)){return getUser(_0x31e053,_0x50b012[_0x001f('0x10')],_0x2bd540);}else{return getUser(_0x31e053,null,_0x2bd540);}})[_0x001f('0x32')](function(_0x11d344){_0x3cfd9c=_0x11d344;logger[_0x001f('0xe')](_0x001f('0x70'),_0x3cfd9c['id']);return getEndUser(_0x31e053,_0x3691ab['calleridname'],_0x3691ab[_0x001f('0x5f')],_0x2bd540);})[_0x001f('0x32')](function(_0x5e84ff){_0x31e27c=_0x5e84ff;logger[_0x001f('0xe')](_0x001f('0x60'),_0x31e27c['id']);return getTicket(_0x31e053,_0x3cfd9c,_0x31e27c,_0xdeada,_0x3691ab,_0xdeada[_0x001f('0x73')],_0x2bd540,_0x001f('0x61'));})[_0x001f('0x32')](function(_0x19be27){_0x24ca5d=_0x19be27;logger[_0x001f('0xe')](_0x001f('0x62'));logger[_0x001f('0xe')](_0x001f('0x63'),_0x24ca5d['id']);return setRelationship(_0x2bd540,_0x3cfd9c,_0x24ca5d,_0x001f('0x64'));})[_0x001f('0x32')](function(){return setRelationship(_0x2bd540,_0x31e27c,_0x24ca5d,_0x001f('0x75'));})[_0x001f('0x32')](function(){return getServerInfo(_0x2bd540);})[_0x001f('0x6c')](function(_0x2b7c69){logger['error'](_0x001f('0x77'),JSON['stringify'](_0x2b7c69));});}; \ No newline at end of file +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 diff --git a/server/services/ami/trigger/integration/util.js b/server/services/ami/trigger/integration/util.js index 536adc1..98351f3 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 _0x4070=['push','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','keyContent','stripTrailingSlash','slice','substring','validateEmail','isNil','lodash','util','getString','sortBy','length','string'];(function(_0x314c5c,_0x427702){var _0x1970ec=function(_0x26c3ba){while(--_0x26c3ba){_0x314c5c['push'](_0x314c5c['shift']());}};_0x1970ec(++_0x427702);}(_0x4070,0x108));var _0x0407=function(_0x280640,_0x70386a){_0x280640=_0x280640-0x0;var _0x2bf568=_0x4070[_0x280640];return _0x2bf568;};'use strict';var _=require(_0x0407('0x0'));var util=require(_0x0407('0x1'));exports[_0x0407('0x2')]=function(_0x4182a2,_0x353531,_0x1d6f8e){var _0x4e3277=[];if(_0x4182a2['length']>0x0){var _0x39b9c4=_[_0x0407('0x3')](_0x4182a2,['id']);for(var _0x5518eb=0x0;_0x5518eb<_0x39b9c4[_0x0407('0x4')];_0x5518eb++){var _0x4f3774=_0x39b9c4[_0x5518eb];if(_0x4f3774['type']===_0x0407('0x5')){_0x4e3277[_0x0407('0x6')](_0x4f3774[_0x0407('0x7')]);}else if(_0x4f3774[_0x0407('0x8')]===_0x0407('0x9')&&_0x4f3774[_0x0407('0xa')]){_0x353531[_0x4f3774[_0x0407('0xa')]]&&_0x4e3277['push'](_0x353531[_0x4f3774[_0x0407('0xa')]][_0x0407('0xb')]());}else if(_0x4f3774['type']===_0x0407('0xc')&&_0x4f3774[_0x0407('0xd')]&&_0x4f3774[_0x0407('0xd')]['name']){_0x353531[_0x4f3774['Variable'][_0x0407('0xe')][_0x0407('0xf')]()]&&_0x4e3277['push'](_0x353531[_0x4f3774['Variable'][_0x0407('0xe')][_0x0407('0xf')]()]['toString']());}else if(_0x4f3774[_0x0407('0x8')]===_0x0407('0x10')){if(_0x4f3774[_0x0407('0x11')]===_0x0407('0x5')&&_0x4f3774[_0x0407('0x12')]){_0x4e3277['push'](util[_0x0407('0x13')](_0x0407('0x14'),_0x4f3774['key'],_0x4f3774[_0x0407('0x15')]));}else if(_0x4f3774[_0x0407('0x11')]===_0x0407('0x9')&&_0x4f3774['variableName']&&_0x4f3774[_0x0407('0x12')]){_0x353531[_0x4f3774[_0x0407('0xa')]]&&_0x4e3277['push'](util[_0x0407('0x13')](_0x0407('0x14'),_0x4f3774[_0x0407('0x12')],_0x353531[_0x4f3774[_0x0407('0xa')]]));}else if(_0x4f3774[_0x0407('0x11')]===_0x0407('0xc')&&_0x4f3774['Variable']&&_0x4f3774[_0x0407('0xd')][_0x0407('0xe')]&&_0x4f3774[_0x0407('0x12')]){_0x353531[_0x4f3774[_0x0407('0xd')][_0x0407('0xe')]['toLowerCase']()]&&_0x4e3277[_0x0407('0x6')](util[_0x0407('0x13')]('%s:\x20%s',_0x4f3774[_0x0407('0x12')],_0x353531[_0x4f3774[_0x0407('0xd')][_0x0407('0xe')][_0x0407('0xf')]()]));}}}}return _0x4e3277['join'](_0x1d6f8e);};exports[_0x0407('0x16')]=function(_0x3888d1){var _0x175185=_0x3888d1[_0x0407('0x17')](-0x1);if(_0x175185==='/'){_0x3888d1=_0x3888d1[_0x0407('0x18')](0x0,_0x3888d1['lastIndexOf'](_0x175185));}return _0x3888d1;};exports[_0x0407('0x19')]=function(_0x55080f){if(!_[_0x0407('0x1a')](_0x55080f)&&_0x55080f!==''){var _0x496767=/^(([^<>()\[\]\\.,;:\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 _0x496767['test'](String(_0x55080f)[_0x0407('0xf')]());}else{return![];}}; \ No newline at end of file +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 diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 00bb2f6..ebe4903 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 _0x3e74=['Normal','getString','Subjects','Descriptions','POST','format','%s/webservice.php','remoteUri','username','stringify','then','success','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','length','Agent\x20found!','email1','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','userId','admin','getUser','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','create','Enduser\x20created.','lastname','phone','getEndUser','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Fields','Ticket\x20created!','[OUTBOUND]','user:%s','abandoned','[ABANDONED]','lodash','bluebird','md5','util','../../../../config/environment','vTiger','redis','defaults','localhost','emit','forEach','string','idField','content','type','variable','variableName','toString','Variable','name','info','Creating\x20new\x20ticket...','merge'];(function(_0x55c711,_0x59bb32){var _0x211a08=function(_0x57ba17){while(--_0x57ba17){_0x55c711['push'](_0x55c711['shift']());}};_0x211a08(++_0x59bb32);}(_0x3e74,0x175));var _0x43e7=function(_0xd8153b,_0x54a33f){_0xd8153b=_0xd8153b-0x0;var _0x8d1d6b=_0x3e74[_0xd8153b];return _0x8d1d6b;};'use strict';var _=require(_0x43e7('0x0'));var rp=require('request-promise');var BPromise=require(_0x43e7('0x1'));var md5=require(_0x43e7('0x2'));var util=require(_0x43e7('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x43e7('0x4'));var logger=require('../../../../config/logger')(_0x43e7('0x5'));config[_0x43e7('0x6')]=_[_0x43e7('0x7')](config[_0x43e7('0x6')],{'host':_0x43e7('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x43e7('0x6')]));function emit(_0x3491d6,_0x2ede2d,_0x8528fc){io['to'](_0x3491d6)[_0x43e7('0x9')](_0x2ede2d,_0x8528fc);}function getCustomFields(_0x516b4d,_0x212c6c){var _0x554d44={};if(_0x516b4d['length']>0x0){_[_0x43e7('0xa')](_0x516b4d,function(_0x4139c9){if(_0x4139c9['type']===_0x43e7('0xb')&&_0x4139c9['idField']){_0x554d44[_0x4139c9[_0x43e7('0xc')]]=_0x4139c9[_0x43e7('0xd')]['toString']();}else if(_0x4139c9[_0x43e7('0xe')]===_0x43e7('0xf')&&_0x4139c9[_0x43e7('0x10')]&&_0x4139c9[_0x43e7('0xc')]&&_0x212c6c[_0x4139c9['variableName']]){_0x554d44[_0x4139c9['idField']]=_0x212c6c[_0x4139c9[_0x43e7('0x10')]][_0x43e7('0x11')]();}else if(_0x4139c9[_0x43e7('0xe')]==='customVariable'&&_0x4139c9['Variable']&&_0x4139c9[_0x43e7('0x12')][_0x43e7('0x13')]&&_0x4139c9[_0x43e7('0xc')]&&_0x212c6c[_0x4139c9[_0x43e7('0x12')]['name']['toLowerCase']()]){_0x554d44[_0x4139c9[_0x43e7('0xc')]]=_0x212c6c[_0x4139c9[_0x43e7('0x12')][_0x43e7('0x13')]['toLowerCase']()]['toString']();}});}return _0x554d44;}function createTicket(_0x446986,_0x1ca758,_0x9037d3,_0x140657,_0x3776f5,_0x1f24fb,_0x619236){logger[_0x43e7('0x14')](_0x43e7('0x15'));var _0xab63cf=_[_0x43e7('0x16')]({'parent_id':'','assigned_user_id':_0x1ca758['id'],'ticketpriorities':_0x43e7('0x17'),'ticketstatus':'Open','ticket_title':intUtil[_0x43e7('0x18')](_0x140657[_0x43e7('0x19')],_0x3776f5,'\x20'),'description':intUtil['getString'](_0x140657[_0x43e7('0x1a')],_0x3776f5,'\x0a'),'contact_id':_0x9037d3['id']},getCustomFields(_0x1f24fb,_0x3776f5));var _0x3e281e={'method':_0x43e7('0x1b'),'uri':util[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986[_0x43e7('0x1e')]),'form':{'operation':'create','username':_0x446986[_0x43e7('0x1f')],'sessionName':_0x619236['sessionName'],'elementType':'HelpDesk','element':JSON[_0x43e7('0x20')](_0xab63cf)},'json':!![]};return request(_0x3e281e)[_0x43e7('0x21')](function(_0x4b2b9f){if(_0x4b2b9f[_0x43e7('0x22')]){return BPromise['resolve']({'id':_0x4b2b9f[_0x43e7('0x23')]['id']});}else{throw new Error(util['format'](_0x43e7('0x24'),JSON[_0x43e7('0x20')](_0x4b2b9f[_0x43e7('0x25')])));}})[_0x43e7('0x26')](function(_0x51f4d7){var _0x52b7b3=_0x51f4d7[_0x43e7('0x27')]||0x1f4;logger['error'](_0x43e7('0x28'),_0x43e7('0x29'),_0x52b7b3,JSON[_0x43e7('0x20')](_0x51f4d7));});}function getUser(_0xb1fc63,_0x5087d7,_0x33a1a5){if(intUtil[_0x43e7('0x2a')](_0x5087d7)){logger[_0x43e7('0x14')](_0x43e7('0x2b'),_0x5087d7);return request({'method':_0x43e7('0x2c'),'uri':util[_0x43e7('0x1c')](_0x43e7('0x1d'),_0xb1fc63[_0x43e7('0x1e')]),'qs':{'operation':_0x43e7('0x2d'),'username':_0xb1fc63[_0x43e7('0x1f')],'sessionName':_0x33a1a5[_0x43e7('0x2e')],'query':util[_0x43e7('0x1c')](_0x43e7('0x2f'),_0x5087d7)},'json':!![]})[_0x43e7('0x21')](function(_0x4bdb17){if(_0x4bdb17[_0x43e7('0x22')]&&_0x4bdb17[_0x43e7('0x23')][_0x43e7('0x30')]){logger[_0x43e7('0x14')](_0x43e7('0x31'));return BPromise['resolve']({'id':_0x4bdb17[_0x43e7('0x23')][0x0]['id'],'email':_0x4bdb17[_0x43e7('0x23')][0x0][_0x43e7('0x32')],'name':_0x4bdb17[_0x43e7('0x23')][0x0]['first_name']+'\x20'+_0x4bdb17['result']['last_name']});}else{logger[_0x43e7('0x14')](_0x43e7('0x33'));return BPromise[_0x43e7('0x34')]({'id':_0x33a1a5[_0x43e7('0x35')],'email':_0xb1fc63[_0x43e7('0x1f')],'name':_0x43e7('0x36')});}})['catch'](function(_0x47baee){var _0x4ac23d=_0x47baee['statusCode']||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getUser',_0x4ac23d,JSON[_0x43e7('0x20')](_0x47baee));});}else{logger['info'](_0x43e7('0x33'));return BPromise[_0x43e7('0x34')]({'id':_0x33a1a5[_0x43e7('0x35')],'email':_0xb1fc63[_0x43e7('0x1f')],'name':_0x43e7('0x36')})[_0x43e7('0x26')](function(_0x101d45){var _0x4f1a5f=_0x101d45['statusCode']||0x1f4;logger['error'](_0x43e7('0x28'),_0x43e7('0x37'),_0x4f1a5f,JSON[_0x43e7('0x20')](_0x101d45));});}}function getEndUser(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589){logger[_0x43e7('0x14')]('Searching\x20end\x20user\x20with\x20phone',_0x1ed538);return request({'method':_0x43e7('0x2c'),'uri':util[_0x43e7('0x1c')]('%s/webservice.php',_0x16cdba[_0x43e7('0x1e')]),'qs':{'operation':'query','username':_0x16cdba[_0x43e7('0x1f')],'sessionName':_0x1d4589[_0x43e7('0x2e')],'query':util[_0x43e7('0x1c')](_0x43e7('0x38'),_0x1ed538,_0x1ed538,_0x1ed538,_0x1ed538,_0x1ed538)},'json':!![]})[_0x43e7('0x21')](function(_0x234d8f){if(_0x234d8f['success']&&_0x234d8f['result'][_0x43e7('0x30')]){logger[_0x43e7('0x14')](_0x43e7('0x39'));return BPromise[_0x43e7('0x34')]({'id':_0x234d8f[_0x43e7('0x23')][0x0]['id'],'name':_0x234d8f['result'][0x0][_0x43e7('0x3a')]+'\x20'+_0x234d8f[_0x43e7('0x23')][0x0]['lastname'],'phone':_0x1ed538});}else{logger[_0x43e7('0x14')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':_0x43e7('0x1b'),'uri':util['format'](_0x43e7('0x1d'),_0x16cdba[_0x43e7('0x1e')]),'form':{'operation':_0x43e7('0x3b'),'sessionName':_0x1d4589[_0x43e7('0x2e')],'elementType':'Contacts','element':JSON['stringify']({'lastname':_0x1b1440,'phone':_0x1ed538,'assigned_user_id':'\x20'})},'json':!![]})[_0x43e7('0x21')](function(_0x40c509){logger[_0x43e7('0x14')](_0x43e7('0x3c'));return BPromise['resolve']({'id':_0x40c509['result']['id'],'name':_0x40c509['result'][_0x43e7('0x3d')],'phone':_0x40c509['result'][_0x43e7('0x3e')]});})['catch'](function(_0x5b28db){var _0x46b2e6=_0x5b28db['statusCode']||0x1f4;logger[_0x43e7('0x25')](_0x43e7('0x28'),_0x43e7('0x3f'),_0x46b2e6,JSON[_0x43e7('0x20')](_0x5b28db));});}});}function getConnection(_0x4fc5e8){var _0x91f1e4=_0x4fc5e8[_0x43e7('0x1f')];var _0x23a611=_0x4fc5e8[_0x43e7('0x40')];return request({'method':_0x43e7('0x2c'),'uri':util[_0x43e7('0x1c')]('%s/webservice.php',_0x4fc5e8['remoteUri']),'qs':{'operation':_0x43e7('0x41'),'username':_0x91f1e4},'json':!![]})[_0x43e7('0x21')](function(_0x212841){if(_0x212841['success']){return request({'method':'POST','uri':util['format'](_0x43e7('0x1d'),_0x4fc5e8[_0x43e7('0x1e')]),'form':{'operation':'login','username':_0x91f1e4,'accessKey':md5(_0x212841[_0x43e7('0x23')][_0x43e7('0x42')]+_0x23a611)},'json':!![]});}})[_0x43e7('0x21')](function(_0x560329){if(_0x560329['success']){return BPromise['resolve'](_0x560329['result']);}else{throw new Error(util[_0x43e7('0x1c')](_0x43e7('0x43'),_0x4fc5e8['id']));}})['catch'](function(_0x23e7cb){var _0x82d32f=_0x23e7cb[_0x43e7('0x27')]||0x1f4;logger[_0x43e7('0x25')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x43e7('0x44'),_0x82d32f,JSON['stringify'](_0x23e7cb));});}function request(_0x4bebd4){logger[_0x43e7('0x14')](_0x43e7('0x45'),JSON[_0x43e7('0x20')](_0x4bebd4));return rp(_0x4bebd4);}exports[_0x43e7('0x46')]=function(_0x13503c,_0x2351cf,_0x1cd87c,_0x256ddd,_0x473fca,_0x2b5515){var _0x58dfd0,_0x119d34,_0x46c910,_0x499c03;_0x2b5515[_0x43e7('0x1e')]=intUtil['stripTrailingSlash'](_0x2b5515[_0x43e7('0x1e')]);if(_0x473fca&&_0x473fca[_0x43e7('0x47')]){logger[_0x43e7('0x14')](_0x43e7('0x48'),_0x43e7('0x49'));_0x2351cf['recordingURL']=util['format'](_0x43e7('0x4a'),_0x2b5515[_0x43e7('0x4b')],_0x2351cf[_0x43e7('0x4c')],md5(_0x2351cf[_0x43e7('0x4c')]));}else{_0x2351cf[_0x43e7('0x4d')]='';}return getConnection(_0x2b5515)[_0x43e7('0x21')](function(_0xa47464){_0x499c03=_0xa47464;return getUser(_0x2b5515,_0x256ddd[_0x43e7('0x4e')],_0x499c03);})[_0x43e7('0x21')](function(_0x24e758){_0x58dfd0=_0x24e758;logger[_0x43e7('0x14')]('The\x20User\x20ID\x20is:',_0x58dfd0['id']);return getEndUser(_0x2b5515,_0x2351cf[_0x43e7('0x4f')],_0x2351cf[_0x43e7('0x50')],_0x499c03);})['then'](function(_0x4314d8){_0x119d34=_0x4314d8;logger[_0x43e7('0x14')](_0x43e7('0x51'),_0x119d34['id']);return createTicket(_0x2b5515,_0x58dfd0,_0x119d34,_0x1cd87c,_0x2351cf,_0x1cd87c['Fields'],_0x499c03);})['then'](function(_0x459c13){_0x46c910=_0x459c13;logger[_0x43e7('0x14')]('Ticket\x20created!');logger[_0x43e7('0x14')]('The\x20Ticket\x20ID\x20is:',_0x46c910['id']);var _0x49a6ce=util[_0x43e7('0x1c')](_0x43e7('0x52'),_0x2b5515[_0x43e7('0x1e')],_[_0x43e7('0x53')](_0x46c910['id'],'x')[0x1]);logger[_0x43e7('0x14')]('[QUEUE]',_0x43e7('0x54'));emit(util[_0x43e7('0x1c')]('user:%s',_0x256ddd[_0x43e7('0x13')]),_0x43e7('0x55'),{'uri':_0x49a6ce});})[_0x43e7('0x26')](function(_0x5bb536){logger['error']('[QUEUE]',JSON[_0x43e7('0x20')](_0x5bb536));});};exports[_0x43e7('0x56')]=function(_0x323cf7,_0x3a6404,_0x52ea9c,_0x5a50fc,_0x1b27da,_0x8b50bb,_0x140438){var _0x5dd349,_0x5ea0db,_0x4438c0,_0x1a7cb5;_0x8b50bb[_0x43e7('0x1e')]=intUtil[_0x43e7('0x57')](_0x8b50bb[_0x43e7('0x1e')]);_0x8b50bb[_0x43e7('0x4b')]=intUtil[_0x43e7('0x57')](_0x8b50bb[_0x43e7('0x4b')]);if(_0x140438&&_0x140438[_0x43e7('0x58')]&&_0x140438[_0x43e7('0x58')]!==_0x43e7('0x59')){logger['info']('[OUTBOUND]',_0x43e7('0x49'));_0x3a6404['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x8b50bb[_0x43e7('0x4b')],_0x3a6404[_0x43e7('0x4c')],md5(_0x3a6404['uniqueid']));}return getConnection(_0x8b50bb)[_0x43e7('0x21')](function(_0x135791){_0x1a7cb5=_0x135791;return getUser(_0x8b50bb,_0x5a50fc[_0x43e7('0x4e')],_0x1a7cb5);})['then'](function(_0x2b7406){_0x5dd349=_0x2b7406;logger[_0x43e7('0x14')](_0x43e7('0x5a'),_0x5dd349['id']);return getEndUser(_0x8b50bb,_0x3a6404[_0x43e7('0x5b')],_0x3a6404[_0x43e7('0x5c')],_0x1a7cb5);})[_0x43e7('0x21')](function(_0x1e02fa){_0x5ea0db=_0x1e02fa;logger['info'](_0x43e7('0x51'),_0x5ea0db['id']);return createTicket(_0x8b50bb,_0x5dd349,_0x5ea0db,_0x52ea9c,_0x3a6404,_0x52ea9c[_0x43e7('0x5d')],_0x1a7cb5);})[_0x43e7('0x21')](function(_0x549f4e){_0x4438c0=_0x549f4e;logger['info'](_0x43e7('0x5e'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x4438c0['id']);var _0x1b793d=util[_0x43e7('0x1c')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x8b50bb[_0x43e7('0x1e')],_[_0x43e7('0x53')](_0x4438c0['id'],'x')[0x1]);logger[_0x43e7('0x14')](_0x43e7('0x5f'),_0x43e7('0x54'));emit(util[_0x43e7('0x1c')](_0x43e7('0x60'),_0x5a50fc['name']),_0x43e7('0x55'),{'uri':_0x1b793d});})[_0x43e7('0x26')](function(_0x4e5956){logger[_0x43e7('0x25')]('[OUTBOUND]',JSON[_0x43e7('0x20')](_0x4e5956));});};exports[_0x43e7('0x61')]=function(_0x37301b,_0x1ca24b,_0x506361,_0x2d25b5,_0x2646c2,_0xf929a5){var _0x556001,_0x17889c,_0x38fa5b,_0x219dc6;_0xf929a5[_0x43e7('0x1e')]=intUtil[_0x43e7('0x57')](_0xf929a5['remoteUri']);_0xf929a5[_0x43e7('0x4b')]=intUtil[_0x43e7('0x57')](_0xf929a5[_0x43e7('0x4b')]);if(_0x2646c2&&_0x2646c2[_0x43e7('0x47')]){logger[_0x43e7('0x14')](_0x43e7('0x62'),_0x43e7('0x49'));_0x1ca24b['recordingURL']=util['format'](_0x43e7('0x4a'),_0xf929a5['serverUrl'],_0x1ca24b['uniqueid'],md5(_0x1ca24b['uniqueid']));}else{_0x1ca24b[_0x43e7('0x4d')]='';}return getConnection(_0xf929a5)[_0x43e7('0x21')](function(_0x230fda){_0x219dc6=_0x230fda;return getUser(_0xf929a5,'',_0x219dc6);})[_0x43e7('0x21')](function(_0x18713b){_0x556001=_0x18713b;logger[_0x43e7('0x14')]('The\x20User\x20ID\x20is:',_0x556001['id']);return getEndUser(_0xf929a5,_0x1ca24b[_0x43e7('0x4f')],_0x1ca24b[_0x43e7('0x50')],_0x219dc6);})[_0x43e7('0x21')](function(_0x5b4c76){_0x17889c=_0x5b4c76;logger[_0x43e7('0x14')](_0x43e7('0x51'),_0x17889c['id']);return createTicket(_0xf929a5,_0x556001,_0x17889c,_0x506361,_0x1ca24b,_0x506361[_0x43e7('0x5d')],_0x219dc6);})[_0x43e7('0x21')](function(_0x1afea6){_0x38fa5b=_0x1afea6;logger[_0x43e7('0x14')](_0x43e7('0x5e'));logger[_0x43e7('0x14')]('The\x20Ticket\x20ID\x20is:',_0x38fa5b['id']);})['catch'](function(_0x55990c){logger[_0x43e7('0x25')](_0x43e7('0x62'),JSON['stringify'](_0x55990c));});}; \ No newline at end of file +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 diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index ddcbb76..4e99569 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 _0xd493=['Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','abandoned','[ABANDONED]','The\x20User\x20ID\x20is:','[ABANDONED]\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','./util','zendesk','redis','localhost','socket.io-emitter','emit','application/json','info','format','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','password','%s:%s','username','authType','token','toString','base64','debug','stringify','map','forEach','type','string','nameField','customField','toLowerCase','content','custom_fields','push','idField','variableName','customVariable','Variable','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab'];(function(_0x258b93,_0x188ccc){var _0x35484b=function(_0x2563ea){while(--_0x2563ea){_0x258b93['push'](_0x258b93['shift']());}};_0x35484b(++_0x188ccc);}(_0xd493,0x1bd));var _0x3d49=function(_0x1b1d65,_0x878b86){_0x1b1d65=_0x1b1d65-0x0;var _0x2924d2=_0xd493[_0x1b1d65];return _0x2924d2;};'use strict';var _=require(_0x3d49('0x0'));var rp=require('request-promise');var md5=require(_0x3d49('0x1'));var util=require(_0x3d49('0x2'));var Redis=require('ioredis');var intUtil=require(_0x3d49('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x3d49('0x4'));config[_0x3d49('0x5')]=_['defaults'](config['redis'],{'host':_0x3d49('0x6'),'port':0x18eb});var io=require(_0x3d49('0x7'))(new Redis(config[_0x3d49('0x5')]));function emit(_0x94f2fd,_0x5d3a0a,_0x3d2d14){io['to'](_0x94f2fd)[_0x3d49('0x8')](_0x5d3a0a,_0x3d2d14);}var headers={'Content-Type':_0x3d49('0x9'),'Accept':_0x3d49('0x9')};function getTicket(_0x222817,_0x25aa7d,_0x3d347e,_0x353c05,_0x3e1bff){logger[_0x3d49('0xa')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x3d49('0xb')]('%s/tickets.json',_0x222817[_0x3d49('0xc')]),'method':_0x3d49('0xd'),'body':{'ticket':_[_0x3d49('0xe')]({'requester_id':_0x3d347e['id'],'submitter_id':_0x25aa7d?_0x25aa7d['id']:undefined,'assignee_id':_0x25aa7d?_0x25aa7d['id']:undefined,'tags':getTags(_0x353c05[_0x3d49('0xf')],_0x3d49('0x10')),'subject':intUtil[_0x3d49('0x11')](_0x353c05[_0x3d49('0x12')],_0x3e1bff,'\x20'),'description':intUtil[_0x3d49('0x11')](_0x353c05[_0x3d49('0x13')],_0x3e1bff,'\x0a'),'comment':{'public':![],'body':intUtil[_0x3d49('0x11')](_0x353c05[_0x3d49('0x13')],_0x3e1bff,'\x0a')}},getCustomFields(_0x353c05[_0x3d49('0x14')],_0x3e1bff))}})[_0x3d49('0x15')](function(_0x5d65f3){logger[_0x3d49('0xa')](_0x3d49('0x16'));return _0x5d65f3[_0x3d49('0x17')];});}function getUser(_0x46f918,_0x1dc095){if(intUtil[_0x3d49('0x18')](_0x1dc095)){logger[_0x3d49('0xa')](_0x3d49('0x19'),_0x1dc095);return request({'uri':util[_0x3d49('0xb')]('%s/search.json',_0x46f918[_0x3d49('0xc')]),'qs':{'query':util[_0x3d49('0xb')](_0x3d49('0x1a'),_0x1dc095)}})[_0x3d49('0x15')](function(_0x4e3959){if(_0x4e3959[_0x3d49('0x1b')]){logger[_0x3d49('0xa')](_0x3d49('0x1c'));return _['find'](_0x4e3959[_0x3d49('0x1d')],{'email':_0x1dc095,'role':'agent'});}else{logger['info'](_0x3d49('0x1e'));return request({'uri':util[_0x3d49('0xb')](_0x3d49('0x1f'),_0x46f918[_0x3d49('0xc')])})[_0x3d49('0x15')](function(_0x387345){logger['info'](_0x3d49('0x20'));return _0x387345[_0x3d49('0x21')];});}});}else{logger[_0x3d49('0xa')](_0x3d49('0x1e'));return request({'uri':util[_0x3d49('0xb')]('%s/users/me.json',_0x46f918[_0x3d49('0xc')])})[_0x3d49('0x15')](function(_0x54b27a){logger['info'](_0x3d49('0x20'));return _0x54b27a[_0x3d49('0x21')];});}}function getEndUser(_0x87bfbd,_0x141c06,_0x149413){logger[_0x3d49('0xa')]('Searching\x20enduser\x20with\x20phone',_0x149413);return request({'uri':util[_0x3d49('0xb')]('%s/search.json',_0x87bfbd[_0x3d49('0xc')]),'qs':{'query':util['format'](_0x3d49('0x22'),_0x149413)}})[_0x3d49('0x15')](function(_0x5d3662){var _0x3925bd;if(_0x5d3662[_0x3d49('0x1d')][_0x3d49('0x23')]){_0x5d3662[_0x3d49('0x1d')]=_[_0x3d49('0x24')](_0x5d3662[_0x3d49('0x1d')],{'suspended':![],'role':_0x3d49('0x25')});if(_0x5d3662['results'][_0x3d49('0x23')]){_0x3925bd=_[_0x3d49('0x26')](_0x5d3662[_0x3d49('0x1d')]);}}if(_0x3925bd){logger[_0x3d49('0xa')](_0x3d49('0x27'));return _0x3925bd;}else{logger[_0x3d49('0xa')](_0x3d49('0x28'));return request({'uri':util[_0x3d49('0xb')](_0x3d49('0x29'),_0x87bfbd[_0x3d49('0xc')]),'method':_0x3d49('0xd'),'body':{'user':{'role':_0x3d49('0x25'),'name':util['format'](_0x3d49('0x2a'),_0x141c06||_0x149413),'phone':_0x149413}}})[_0x3d49('0x15')](function(_0x451375){logger['info'](_0x3d49('0x2b'));return _0x451375['user'];});}});}function getAuth(_0x4ddaae){var _0x4deba0;if(_0x4ddaae['authType']===_0x3d49('0x2c')){_0x4deba0=util[_0x3d49('0xb')](_0x3d49('0x2d'),_0x4ddaae[_0x3d49('0x2e')],_0x4ddaae['password']);}else if(_0x4ddaae[_0x3d49('0x2f')]===_0x3d49('0x30')){_0x4deba0=util[_0x3d49('0xb')]('%s/token:%s',_0x4ddaae['username'],_0x4ddaae[_0x3d49('0x30')]);}return util[_0x3d49('0xb')]('Basic\x20%s',new Buffer(_0x4deba0)[_0x3d49('0x31')](_0x3d49('0x32')));}function request(_0x47085f){logger[_0x3d49('0x33')]('[HTTP]',JSON[_0x3d49('0x34')](_0x47085f));return rp(_['defaults'](_0x47085f,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x435e17,_0x4a70cf){var _0x31bb9e=[];if(_0x435e17&&_0x435e17[_0x3d49('0x23')]>0x0){_0x31bb9e=_[_0x3d49('0x35')](_0x435e17,_0x4a70cf);}return _0x31bb9e;}function getCustomFields(_0x5dae06,_0x5de75e){var _0x3584cf=[];var _0xc9570a={'custom_fields':[]};if(_0x5dae06[_0x3d49('0x23')]>0x0){_[_0x3d49('0x36')](_0x5dae06,function(_0x4e5a63){if(_0x4e5a63[_0x3d49('0x37')]===_0x3d49('0x38')&&_0x4e5a63[_0x3d49('0x39')]&&!_0x4e5a63[_0x3d49('0x3a')]){_0xc9570a[_0x4e5a63[_0x3d49('0x39')][_0x3d49('0x3b')]()]=_0x4e5a63[_0x3d49('0x3c')][_0x3d49('0x31')]();}else if(_0x4e5a63[_0x3d49('0x37')]===_0x3d49('0x38')&&_0x4e5a63['idField']&&_0x4e5a63[_0x3d49('0x3a')]){_0xc9570a[_0x3d49('0x3d')][_0x3d49('0x3e')]({'id':_0x4e5a63[_0x3d49('0x3f')],'value':_0x4e5a63['content'][_0x3d49('0x31')]()});}else if(_0x4e5a63[_0x3d49('0x37')]==='variable'&&_0x4e5a63['variableName']&&_0x4e5a63[_0x3d49('0x3f')]&&_0x4e5a63[_0x3d49('0x3a')]){_0x5de75e[_0x4e5a63[_0x3d49('0x40')]]&&_0xc9570a[_0x3d49('0x3d')]['push']({'id':_0x4e5a63[_0x3d49('0x3f')],'value':_0x5de75e[_0x4e5a63[_0x3d49('0x40')]][_0x3d49('0x31')]()});}else if(_0x4e5a63[_0x3d49('0x37')]===_0x3d49('0x41')&&_0x4e5a63['Variable']&&_0x4e5a63['Variable']['name']&&_0x4e5a63[_0x3d49('0x3f')]&&_0x4e5a63['customField']){_0x5de75e[_0x4e5a63['Variable'][_0x3d49('0x10')][_0x3d49('0x3b')]()]&&_0xc9570a[_0x3d49('0x3d')][_0x3d49('0x3e')]({'id':_0x4e5a63[_0x3d49('0x3f')],'value':_0x5de75e[_0x4e5a63[_0x3d49('0x42')][_0x3d49('0x10')][_0x3d49('0x3b')]()][_0x3d49('0x31')]()});}});}return _0xc9570a;}exports[_0x3d49('0x43')]=function(_0x59d5f4,_0x3c7afd,_0xff64ba,_0x392215,_0x1df8ad,_0x203a93){var _0x22eafd,_0x2609f9;_0x203a93[_0x3d49('0xc')]=intUtil['stripTrailingSlash'](_0x203a93[_0x3d49('0xc')]);_0x203a93[_0x3d49('0x44')]=intUtil[_0x3d49('0x45')](_0x203a93['serverUrl']);if(_0x1df8ad&&_0x1df8ad[_0x3d49('0x46')]){logger[_0x3d49('0xa')]('[QUEUE]',_0x3d49('0x47'));_0x3c7afd[_0x3d49('0x48')]=util['format'](_0x3d49('0x49'),_0x203a93[_0x3d49('0x44')],_0x3c7afd[_0x3d49('0x4a')],md5(_0x3c7afd[_0x3d49('0x4a')]));}else{_0x3c7afd[_0x3d49('0x48')]='';}headers[_0x3d49('0x4b')]=getAuth(_0x203a93);return getUser(_0x203a93,_0x392215[_0x3d49('0x4c')])[_0x3d49('0x15')](function(_0x2d11e6){_0x22eafd=_0x2d11e6;logger['info']('The\x20User\x20ID\x20is:',_0x22eafd['id']);return getEndUser(_0x203a93,_0x3c7afd[_0x3d49('0x4d')],_0x3c7afd[_0x3d49('0x4e')]);})[_0x3d49('0x15')](function(_0x4168c){_0x2609f9=_0x4168c;logger[_0x3d49('0xa')]('The\x20Enduser\x20ID\x20is:',_0x2609f9['id']);return getTicket(_0x203a93,_0x22eafd,_0x2609f9,_0xff64ba,_0x3c7afd);})[_0x3d49('0x15')](function(_0x578d64){if(_0x578d64){logger[_0x3d49('0xa')](_0x3d49('0x4f'),_0x578d64['id']);switch(_0x203a93[_0x3d49('0x37')]){case _0x3d49('0x50'):logger[_0x3d49('0xa')](_0x3d49('0x51'),_0x3d49('0x52'));return request({'uri':util[_0x3d49('0xb')](_0x3d49('0x53'),_0x203a93['remoteUri'],_0x22eafd['id'],_0x578d64['id']),'method':_0x3d49('0xd')});case _0x3d49('0x54'):logger[_0x3d49('0xa')](_0x3d49('0x51'),_0x3d49('0x55'));emit(util[_0x3d49('0xb')](_0x3d49('0x56'),_0x392215[_0x3d49('0x10')]),_0x3d49('0x57'),{'uri':util[_0x3d49('0xb')](_0x3d49('0x58'),_0x203a93[_0x3d49('0xc')],_0x578d64['id'])});break;default:logger[_0x3d49('0x59')](_0x3d49('0x51'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x3d49('0x5a')](function(_0x132d64){logger[_0x3d49('0x59')](_0x3d49('0x5b'),util[_0x3d49('0x5c')](_0x132d64,{'showHidden':!![],'depth':null}));});};exports[_0x3d49('0x5d')]=function(_0x4b0a9a,_0x2af428,_0xe7b451,_0x2f3b1c,_0x176645,_0x43c3b9,_0x117976){var _0x33d0b9,_0x18b3bd;_0x43c3b9[_0x3d49('0xc')]=intUtil[_0x3d49('0x45')](_0x43c3b9[_0x3d49('0xc')]);_0x43c3b9['serverUrl']=intUtil[_0x3d49('0x45')](_0x43c3b9[_0x3d49('0x44')]);if(_0x117976&&_0x117976[_0x3d49('0x5e')]&&_0x117976['recordingFormat']!==_0x3d49('0x5f')){logger[_0x3d49('0xa')](_0x3d49('0x60'),_0x3d49('0x47'));_0x2af428[_0x3d49('0x48')]=util[_0x3d49('0xb')](_0x3d49('0x49'),_0x43c3b9[_0x3d49('0x44')],_0x2af428[_0x3d49('0x4a')],md5(_0x2af428[_0x3d49('0x4a')]));}headers[_0x3d49('0x4b')]=getAuth(_0x43c3b9);return getUser(_0x43c3b9,_0x2f3b1c['email'])[_0x3d49('0x15')](function(_0x48c8e8){_0x33d0b9=_0x48c8e8;logger[_0x3d49('0xa')]('The\x20User\x20ID\x20is:',_0x33d0b9['id']);return getEndUser(_0x43c3b9,_0x2af428[_0x3d49('0x61')],_0x2af428[_0x3d49('0x62')]);})[_0x3d49('0x15')](function(_0x47bbb2){_0x18b3bd=_0x47bbb2;logger[_0x3d49('0xa')](_0x3d49('0x63'),_0x18b3bd['id']);return getTicket(_0x43c3b9,_0x33d0b9,_0x18b3bd,_0xe7b451,_0x2af428);})['then'](function(_0x598338){if(_0x598338){logger['info'](_0x3d49('0x4f'),_0x598338['id']);switch(_0x43c3b9[_0x3d49('0x37')]){case _0x3d49('0x50'):logger['info'](_0x3d49('0x60'),_0x3d49('0x52'));return request({'uri':util['format'](_0x3d49('0x53'),_0x43c3b9[_0x3d49('0xc')],_0x33d0b9['id'],_0x598338['id']),'method':'POST'});case _0x3d49('0x54'):logger[_0x3d49('0xa')]('[OUTBOUND]',_0x3d49('0x55'));emit(util[_0x3d49('0xb')]('user:%s',_0x2f3b1c['name']),_0x3d49('0x57'),{'uri':util['format']('%s/agent/tickets/%s',_0x43c3b9[_0x3d49('0xc')],_0x598338['id'])});break;default:logger['error'](_0x3d49('0x60'),_0x3d49('0x64'));}}})[_0x3d49('0x5a')](function(_0x4932b2){logger[_0x3d49('0x59')](_0x3d49('0x65'),util[_0x3d49('0x5c')](_0x4932b2,{'showHidden':!![],'depth':null}));});};exports[_0x3d49('0x66')]=function(_0x4e4a4a,_0x400fb2,_0x372e2b,_0x1d5d22,_0x2cb97e,_0x37924b){var _0x9c97bb,_0x24879c;_0x37924b[_0x3d49('0xc')]=intUtil[_0x3d49('0x45')](_0x37924b[_0x3d49('0xc')]);_0x37924b[_0x3d49('0x44')]=intUtil[_0x3d49('0x45')](_0x37924b[_0x3d49('0x44')]);if(_0x2cb97e&&_0x2cb97e[_0x3d49('0x46')]){logger[_0x3d49('0xa')](_0x3d49('0x67'),'Recording\x20is\x20enabled!');_0x400fb2[_0x3d49('0x48')]=util[_0x3d49('0xb')](_0x3d49('0x49'),_0x37924b[_0x3d49('0x44')],_0x400fb2[_0x3d49('0x4a')],md5(_0x400fb2[_0x3d49('0x4a')]));}else{_0x400fb2['recordingURL']='';}headers[_0x3d49('0x4b')]=getAuth(_0x37924b);return getUser(_0x37924b)[_0x3d49('0x15')](function(_0x4def49){_0x9c97bb=_0x4def49;logger[_0x3d49('0xa')](_0x3d49('0x68'),_0x9c97bb['id']);return getEndUser(_0x37924b,_0x400fb2['calleridname'],_0x400fb2['calleridnum']);})[_0x3d49('0x15')](function(_0x13d9fe){_0x24879c=_0x13d9fe;logger[_0x3d49('0xa')]('The\x20Enduser\x20ID\x20is:',_0x24879c['id']);return getTicket(_0x37924b,_0x9c97bb,_0x24879c,_0x372e2b,_0x400fb2);})[_0x3d49('0x15')](function(_0x550884){if(_0x550884){logger['info'](_0x3d49('0x4f'),_0x550884['id']);}})[_0x3d49('0x5a')](function(_0x537efe){logger[_0x3d49('0x59')](_0x3d49('0x69'),util[_0x3d49('0x5c')](_0x537efe,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +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 diff --git a/server/services/ami/trigger/integration/zoho.js b/server/services/ami/trigger/integration/zoho.js index 4365f07..e3807a1 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 _0xba3d=['stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','then','users','isArrayLikeObject','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','enduserType','Error:\x20','CREATE\x20ERROR','Zoho-oauthtoken\x20','moduleSearch','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','lead','Creating\x20new\x20call...','administrator','Subject','getString','Subjects','Description','Descriptions','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','mm:ss','answertime','YYYY-MM-DDTHH:mm:ss','starttime','called','Called','rejected','Call_Result','Rejected','abandoned','Abandoned','outbound','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','SUCCESS','Call\x20created!','details','err','log','queue','stripTrailingSlash','host','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','zoho.eu','com','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','uniqueid','/downloads?type=uniqueid&token=','destcalleridname','destcalleridnum','Outbound','trigger:browser:url','[ABANDONED]','request-promise','md5','util','./util','moment','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','type','string','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','refresh_token','add','catch','error','Failing\x20creating\x20the\x20access_token'];(function(_0x2fd0f0,_0x4b634e){var _0x57f71a=function(_0x400d6f){while(--_0x400d6f){_0x2fd0f0['push'](_0x2fd0f0['shift']());}};_0x57f71a(++_0x4b634e);}(_0xba3d,0x67));var _0xdba3=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xba3d[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require('lodash');var rp=require(_0xdba3('0x0'));var md5=require(_0xdba3('0x1'));var util=require(_0xdba3('0x2'));var intUtil=require(_0xdba3('0x3'));var moment=require(_0xdba3('0x4'));var Redis=require('ioredis');var BPromise=require(_0xdba3('0x5'));var config=require(_0xdba3('0x6'));var logger=require(_0xdba3('0x7'))(_0xdba3('0x8'));config[_0xdba3('0x9')]=_[_0xdba3('0xa')](config[_0xdba3('0x9')],{'host':_0xdba3('0xb'),'port':0x18eb});var io=require(_0xdba3('0xc'))(new Redis(config[_0xdba3('0x9')]));function emit(_0x332f80,_0x5e448f,_0x238e2c){io['to'](_0x332f80)[_0xdba3('0xd')](_0x5e448f,_0x238e2c);}function request(_0x3f3dcc){logger[_0xdba3('0xe')](_0xdba3('0xf'),JSON[_0xdba3('0x10')](_0x3f3dcc));return rp(_0x3f3dcc);}function getCustomFields(_0xd0d6f4,_0x3b0c81){var _0x702430={};if(_0xd0d6f4[_0xdba3('0x11')]>0x0){_[_0xdba3('0x12')](_0xd0d6f4,function(_0x44ee46){if(_0x44ee46[_0xdba3('0x13')]===_0xdba3('0x14')&&_0x44ee46[_0xdba3('0x15')]){_0x702430[_0x44ee46[_0xdba3('0x15')]]=_0x44ee46['content'][_0xdba3('0x16')]();}else if(_0x44ee46[_0xdba3('0x13')]===_0xdba3('0x17')&&_0x44ee46['variableName']&&_0x44ee46[_0xdba3('0x15')]&&_0x3b0c81[_0x44ee46['variableName']]){_0x702430[_0x44ee46[_0xdba3('0x15')]]=_0x3b0c81[_0x44ee46[_0xdba3('0x18')]]['toString']();}else if(_0x44ee46[_0xdba3('0x13')]===_0xdba3('0x19')&&_0x44ee46[_0xdba3('0x1a')]&&_0x44ee46[_0xdba3('0x1a')][_0xdba3('0x1b')]&&_0x44ee46[_0xdba3('0x15')]&&_0x3b0c81[_0x44ee46[_0xdba3('0x1a')][_0xdba3('0x1b')][_0xdba3('0x1c')]()]){_0x702430[_0x44ee46['idField']]=_0x3b0c81[_0x44ee46[_0xdba3('0x1a')][_0xdba3('0x1b')][_0xdba3('0x1c')]()][_0xdba3('0x16')]();}});}return _0x702430;}function getName(_0x2b83d2){if(_0x2b83d2[_0xdba3('0x1d')]('\x20')>0x0){var _0xbbe9a5=_0x2b83d2[_0xdba3('0x1e')](/ (.+)/);if(_0xbbe9a5[0x1]){return _0xbbe9a5;}}return[_0x2b83d2,_0x2b83d2];}var accountsTokens={};function getAccessToken(_0x31a9fe){return new Promise(function(_0x1ec4ed,_0x2ee157){if(!_['isNil'](accountsTokens[_0x31a9fe['id']])&&!_[_0xdba3('0x1f')](accountsTokens[_0x31a9fe['id']][_0xdba3('0x20')])){if(moment()[_0xdba3('0x21')](accountsTokens[_0x31a9fe['id']][_0xdba3('0x22')])){_0x1ec4ed(accountsTokens[_0x31a9fe['id']][_0xdba3('0x20')]);}}var _0x3844d2;switch(_0x31a9fe[_0xdba3('0x23')]){case'US':_0x3844d2=_0xdba3('0x24');break;case'AU':_0x3844d2=_0xdba3('0x25');break;case'EU':_0x3844d2=_0xdba3('0x26');break;case'IN':_0x3844d2='https://accounts.zoho.in';break;case'CN':_0x3844d2=_0xdba3('0x27');break;default:_0x3844d2=_0xdba3('0x26');break;}var _0x9cd7fb={'method':_0xdba3('0x28'),'uri':_0x3844d2+'/oauth/v2/token','qs':{'refresh_token':_0x31a9fe[_0xdba3('0x29')],'client_id':_0x31a9fe[_0xdba3('0x2a')],'client_secret':_0x31a9fe[_0xdba3('0x2b')],'grant_type':_0xdba3('0x2c')},'json':!![]};return rp(_0x9cd7fb)['then'](function(_0x315989){accountsTokens[_0x31a9fe['id']]={'access_token':_0x315989[_0xdba3('0x20')],'expires_in':moment()[_0xdba3('0x2d')](_0x315989[_0xdba3('0x22')],'seconds')};_0x1ec4ed(_0x315989[_0xdba3('0x20')]);})[_0xdba3('0x2e')](function(_0x2b08fa){logger[_0xdba3('0x2f')](_0xdba3('0x30'),_0x2b08fa[_0xdba3('0x31')]);_0x2ee157(_0x2b08fa);});});}function getUser(_0x495a74,_0x5ef45b,_0x4dd71b,_0x3df92e){logger[_0xdba3('0x32')](_0xdba3('0x33'));return request({'method':_0xdba3('0x34'),'uri':util[_0xdba3('0x35')](_0xdba3('0x36'),_0x5ef45b),'qs':{'type':_0xdba3('0x37')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x495a74},'json':!![]})[_0xdba3('0x38')](function(_0x28afe5){if(_0x28afe5[_0xdba3('0x39')]){var _0x50c877=-0x1;if(_[_0xdba3('0x3a')](_0x28afe5[_0xdba3('0x39')])){if(!_[_0xdba3('0x1f')](_0x3df92e)){_0x50c877=_[_0xdba3('0x3b')](_0x28afe5[_0xdba3('0x39')],function(_0x1af3b8){return _0x1af3b8['email']===_0x3df92e;});}if(_0x50c877>=0x0){logger['info'](_0xdba3('0x3c'));}else{logger['info'](_0xdba3('0x3d'));_0x50c877=_['findIndex'](_0x28afe5[_0xdba3('0x39')],function(_0x5537f9){return _0x5537f9[_0xdba3('0x3e')][_0xdba3('0x1b')]===_0xdba3('0x3f');});}return _0x28afe5[_0xdba3('0x39')][_0x50c877];}else{if(_0x28afe5[_0xdba3('0x40')][_0xdba3('0x3e')][_0xdba3('0x1b')]===_0xdba3('0x3f')){logger[_0xdba3('0x32')](_0xdba3('0x3d'));user=_0x28afe5[_0xdba3('0x40')];return user;}else{logger['error'](_0xdba3('0x41'),JSON[_0xdba3('0x10')](_0x28afe5));throw new Error(_0xdba3('0x42')+JSON[_0xdba3('0x10')](_0x28afe5));}}}else{logger['error'](_0xdba3('0x41'),JSON[_0xdba3('0x10')](_0x28afe5));throw new Error(_0xdba3('0x42')+JSON['stringify'](_0x28afe5));}})[_0xdba3('0x2e')](function(_0x254ed7){console['error'](_0x254ed7);});}function getZohoUser(_0x5c834b,_0x495bff){return new BPromise(function(_0x313944,_0x122c80){request(_0x5c834b)[_0xdba3('0x38')](function(_0x333cb1){var _0x15592a=null;if(_0x333cb1){_0x15592a=_0x333cb1[_0xdba3('0x43')][0x0];_0x15592a['enduserType']=_0x495bff;}_0x313944(_0x15592a);})[_0xdba3('0x2e')](function(_0x23c79c){_0x122c80(_0x23c79c);});});}function createEndUser(_0x1ca5ba,_0x1163b3,_0x3c2fb0,_0x950a8f,_0x5c7359,_0x57a3b7){var _0x3c2fb0=getName(_0x3c2fb0);return request({'method':'POST','uri':'https://www.zohoapis.'+_0x1163b3+_0xdba3('0x44')+_[_0xdba3('0x45')](_0x57a3b7[_0xdba3('0x46')])+'s','body':{'data':[{'Last_Name':_0x3c2fb0[0x1],'First_Name':_0x3c2fb0[0x0],'Phone':_0x950a8f,'Owner':{'name':!_[_0xdba3('0x1f')](_0x5c7359[_0xdba3('0x47')][_0xdba3('0x1b')])?_0x5c7359[_0xdba3('0x47')][_0xdba3('0x1b')]:!_['isNil'](_0x5c7359[_0xdba3('0x48')])?_0x5c7359[_0xdba3('0x48')]+'\x20'+_0x5c7359[_0xdba3('0x49')]:_0x5c7359['last_name'],'id':_0x5c7359['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1ca5ba},'json':!![]})[_0xdba3('0x38')](function(_0x5719c4){if(_0x5719c4&&_0x5719c4[_0xdba3('0x43')][0x0][_0xdba3('0x4a')]==='SUCCESS'){var _0x311e33=_0x5719c4[_0xdba3('0x43')][0x0]['details'];_0x311e33[_0xdba3('0x4b')]=_[_0xdba3('0x45')](_0x57a3b7['moduleCreate'])+'s';return _0x311e33;}logger['error'](_0xdba3('0x41'),JSON[_0xdba3('0x10')](data));throw new Error(_0xdba3('0x4c')+JSON[_0xdba3('0x10')](data));})[_0xdba3('0x2e')](function(_0x111d53){console['log'](_0xdba3('0x4d'),_0x111d53);});}function getEndUser(_0x2be6f8,_0x125d79,_0x439475,_0x5a1340,_0x37dce3,_0x1187c0,_0x41c616){var _0x4627a5={'method':_0xdba3('0x34'),'uri':'','headers':{'Authorization':_0xdba3('0x4e')+_0x2be6f8},'json':!![]};switch(_0x41c616[_0xdba3('0x4f')]){case'contact_lead':_0x4627a5['uri']=_0xdba3('0x50')+_0x125d79+_0xdba3('0x51')+_0x37dce3+'))';return getZohoUser(_0x4627a5,_0xdba3('0x52'))[_0xdba3('0x38')](function(_0x124c47){if(_0x124c47)return _0x124c47;_0x4627a5[_0xdba3('0x53')]=_0xdba3('0x50')+_0x125d79+_0xdba3('0x54')+_0x37dce3+'))';return getZohoUser(_0x4627a5,_0xdba3('0x55'))[_0xdba3('0x38')](function(_0x214d73){if(_0x214d73)return _0x214d73;if(_0x41c616['moduleCreate']!=_0xdba3('0x56')){return createEndUser(_0x2be6f8,_0x125d79,_0x5a1340,_0x37dce3,_0x1187c0,_0x41c616);}else{return{};}});});break;case'contact':_0x4627a5[_0xdba3('0x53')]='https://www.zohoapis.'+_0x125d79+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x37dce3+'))';return getZohoUser(_0x4627a5,_0xdba3('0x52'))[_0xdba3('0x38')](function(_0x57ccdf){if(_0x57ccdf)return _0x57ccdf;if(_0x41c616[_0xdba3('0x46')]!='nothing'){return createEndUser(_0x2be6f8,_0x125d79,_0x5a1340,_0x37dce3,_0x1187c0,_0x41c616);}else{return{};}});break;case _0xdba3('0x57'):_0x4627a5[_0xdba3('0x53')]='https://www.zohoapis.'+_0x125d79+_0xdba3('0x54')+_0x37dce3+'))';return getZohoUser(_0x4627a5,'Leads')['then'](function(_0x4a33dd){if(_0x4a33dd)return _0x4a33dd;if(_0x41c616[_0xdba3('0x46')]!=_0xdba3('0x56')){return createEndUser(_0x2be6f8,_0x125d79,_0x5a1340,_0x37dce3,_0x1187c0,_0x41c616);}else{return{};}});break;}}function getCall(_0x519e88,_0x5198c3,_0x2dbf92,_0x175c86,_0x5bd479,_0x4aa8b4,_0x2ce54e,_0x584350){logger[_0xdba3('0x32')](_0xdba3('0x58'));var _0x1ead43={};_0x1ead43['Owner']={'name':!_[_0xdba3('0x1f')](_0x175c86[_0xdba3('0x47')][_0xdba3('0x1b')])&&!_[_0xdba3('0x1f')](_0x175c86[_0xdba3('0x3e')]['name'])&&_0x175c86[_0xdba3('0x3e')][_0xdba3('0x1b')]===_0xdba3('0x59')?_0x175c86[_0xdba3('0x47')][_0xdba3('0x1b')]:!_[_0xdba3('0x1f')](_0x175c86[_0xdba3('0x48')])?_0x175c86['first_name']+'\x20'+_0x175c86[_0xdba3('0x49')]:_0x175c86[_0xdba3('0x49')],'id':_0x175c86['id']};_0x1ead43[_0xdba3('0x5a')]=intUtil[_0xdba3('0x5b')](_0x4aa8b4[_0xdba3('0x5c')],_0x2ce54e,'\x20');_0x1ead43[_0xdba3('0x5d')]=intUtil['getString'](_0x4aa8b4[_0xdba3('0x5e')],_0x2ce54e,'\x0a');if(_0x5bd479[_0xdba3('0x4b')]==='Contacts'){_0x1ead43['Who_Id']={'name':!_[_0xdba3('0x1f')](_0x5bd479[_0xdba3('0x5f')])?_0x5bd479[_0xdba3('0x5f')]:!_[_0xdba3('0x1f')](_0x5bd479['First_Name'])?_0x5bd479[_0xdba3('0x60')]+'\x20'+_0x5bd479['Last_Name']:_0x5bd479[_0xdba3('0x61')],'id':_0x5bd479['id']};}if(_0x5bd479['enduserType']==='Leads'){_0x1ead43[_0xdba3('0x62')]={'name':!_[_0xdba3('0x1f')](_0x5bd479[_0xdba3('0x5f')])?_0x5bd479['Full_Name']:!_['isNil'](_0x5bd479['First_Name'])?_0x5bd479[_0xdba3('0x60')]+'\x20'+_0x5bd479[_0xdba3('0x61')]:_0x5bd479[_0xdba3('0x61')],'id':_0x5bd479['id']};_0x1ead43['$se_module']=_[_0xdba3('0x45')](_0x5bd479[_0xdba3('0x4b')]);}if(_0x2ce54e[_0xdba3('0x63')]){_0x1ead43[_0xdba3('0x64')]=moment['utc'](parseInt(_0x2ce54e[_0xdba3('0x63')])*0x3e8)[_0xdba3('0x35')](_0xdba3('0x65'));}else if(_0x2ce54e[_0xdba3('0x66')]&&_0x2ce54e['endtime']){_0x1ead43['Call_Duration']=moment['utc'](moment(_0x2ce54e['endtime'],_0xdba3('0x67'))['diff'](moment(_0x2ce54e[_0xdba3('0x68')],_0xdba3('0x67'))))[_0xdba3('0x35')](_0xdba3('0x65'));}switch(_0x2ce54e['lastevent']){case _0xdba3('0x69'):_0x1ead43['Call_Result']=_0xdba3('0x6a');break;case'complete':case'connect':_0x1ead43['Call_Result']='Answered';break;case _0xdba3('0x6b'):_0x1ead43[_0xdba3('0x6c')]=_0xdba3('0x6d');break;case _0xdba3('0x6e'):_0x1ead43['Call_Result']=_0xdba3('0x6f');break;default:}_0x1ead43['Call_Start_Time']=(_0x584350===_0xdba3('0x70')?moment(_0x2ce54e[_0xdba3('0x68')])[_0xdba3('0x35')](_0xdba3('0x67')):moment(_0x2ce54e[_0xdba3('0x71')])[_0xdba3('0x35')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0xdba3('0x35')](_0xdba3('0x67'));_0x1ead43[_0xdba3('0x72')]=_0x584350||_0xdba3('0x73');_0x1ead43=_[_0xdba3('0x74')](_0x1ead43,getCustomFields(_0x4aa8b4['Fields'],_0x2ce54e));return request({'method':_0xdba3('0x28'),'uri':_0xdba3('0x50')+_0x5198c3+_0xdba3('0x75'),'headers':{'Authorization':_0xdba3('0x4e')+_0x519e88},'body':{'data':[_0x1ead43]},'json':!![]})['then'](function(_0x29035a){if(_0x29035a&&_0x29035a['data'][0x0][_0xdba3('0x4a')]===_0xdba3('0x76')){logger['info'](_0xdba3('0x77'));return{'id':_0x29035a[_0xdba3('0x43')][0x0][_0xdba3('0x78')]['id']};}})[_0xdba3('0x2e')](function(_0x2baf44){logger[_0xdba3('0x32')](_0xdba3('0x79'),_0x2baf44[_0xdba3('0x31')]);console[_0xdba3('0x7a')](_0xdba3('0x79'),_0x2baf44);});}exports[_0xdba3('0x7b')]=function(_0x48ba19,_0x308e8e,_0xbc6f49,_0x163ffe,_0x1b86b0,_0x1a1794){var _0x152fae,_0x18cac3,_0x1653e3;_0x1a1794['host']=intUtil[_0xdba3('0x7c')](_0x1a1794[_0xdba3('0x7d')]);_0x1a1794['serverUrl']=intUtil[_0xdba3('0x7c')](_0x1a1794[_0xdba3('0x7e')]);if(_0x1b86b0&&_0x1b86b0[_0xdba3('0x7f')]){logger[_0xdba3('0x32')]('[QUEUE]',_0xdba3('0x80'));_0x308e8e[_0xdba3('0x81')]=_0x1a1794[_0xdba3('0x7e')]+_0xdba3('0x82')+_0x308e8e['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x308e8e['uniqueid']);}else{_0x308e8e['recordingURL']='';}var _0x141b3c=_0x1a1794[_0xdba3('0x7d')]===_0xdba3('0x83')?'eu':_0xdba3('0x84');return getAccessToken(_0x1a1794)[_0xdba3('0x38')](function(_0x41ce81){_0x1653e3=_0x41ce81;return getUser(_0x1653e3,_0x141b3c,_0x1a1794,_0x163ffe[_0xdba3('0x85')]);})[_0xdba3('0x38')](function(_0x5a4255){_0x152fae=_0x5a4255;logger[_0xdba3('0x32')](_0xdba3('0x86'),_0x152fae['id']);return getEndUser(_0x1653e3,_0x141b3c,_0x1a1794,_0x308e8e['calleridname'],_0x308e8e[_0xdba3('0x87')],_0x152fae,_0xbc6f49);})[_0xdba3('0x38')](function(_0x3910c2){_0x18cac3=_0x3910c2;return getCall(_0x1653e3,_0x141b3c,_0x1a1794,_0x152fae,_0x18cac3,_0xbc6f49,_0x308e8e,'Inbound');})[_0xdba3('0x38')](function(_0x98312){if(_0x98312){logger[_0xdba3('0x32')](_0xdba3('0x88'),_0x98312['id']);logger[_0xdba3('0x32')](_0xdba3('0x89'),_0xdba3('0x8a'));emit(util[_0xdba3('0x35')](_0xdba3('0x8b'),_0x163ffe[_0xdba3('0x1b')]),'trigger:browser:url',{'uri':_0xdba3('0x8c')+_0x1a1794[_0xdba3('0x7d')]+_0xdba3('0x8d')+_0x98312['id']});}})['catch'](function(_0x12b066){logger[_0xdba3('0x2f')]('[QUEUE]',JSON[_0xdba3('0x10')](_0x12b066));});};exports['outbound']=function(_0xb82873,_0x53b370,_0x5001a8,_0x2bd132,_0x5de188,_0x4b0722,_0x1e3800){var _0x501837,_0x3b08a5,_0x1b7966;_0x4b0722['host']=intUtil[_0xdba3('0x7c')](_0x4b0722['host']);_0x4b0722[_0xdba3('0x7e')]=intUtil[_0xdba3('0x7c')](_0x4b0722[_0xdba3('0x7e')]);if(_0x1e3800&&_0x1e3800[_0xdba3('0x8e')]&&_0x1e3800[_0xdba3('0x8e')]!==_0xdba3('0x8f')){logger[_0xdba3('0x32')](_0xdba3('0x90'),_0xdba3('0x80'));_0x53b370['recordingURL']=_0x4b0722[_0xdba3('0x7e')]+_0xdba3('0x82')+_0x53b370[_0xdba3('0x91')]+_0xdba3('0x92')+md5(_0x53b370[_0xdba3('0x91')]);}var _0x21376d=_0x4b0722[_0xdba3('0x7d')]===_0xdba3('0x83')?'eu':_0xdba3('0x84');return getAccessToken(_0x4b0722)[_0xdba3('0x38')](function(_0x296018){_0x1b7966=_0x296018;return getUser(_0x1b7966,_0x21376d,_0x4b0722,_0x2bd132[_0xdba3('0x85')]);})['then'](function(_0x1b6a3d){_0x501837=_0x1b6a3d;logger[_0xdba3('0x32')](_0xdba3('0x86'),_0x501837['id']);return getEndUser(_0x1b7966,_0x21376d,_0x4b0722,_0x53b370[_0xdba3('0x93')],_0x53b370[_0xdba3('0x94')],_0x501837,_0x5001a8);})[_0xdba3('0x38')](function(_0x375055){_0x3b08a5=_0x375055;return getCall(_0x1b7966,_0x21376d,_0x4b0722,_0x501837,_0x3b08a5,_0x5001a8,_0x53b370,_0xdba3('0x95'));})[_0xdba3('0x38')](function(_0x43663f){if(_0x43663f){logger[_0xdba3('0x32')]('The\x20Call\x20ID\x20is:',_0x43663f['id']);logger[_0xdba3('0x32')](_0xdba3('0x90'),_0xdba3('0x8a'));emit(util['format'](_0xdba3('0x8b'),_0x2bd132[_0xdba3('0x1b')]),_0xdba3('0x96'),{'uri':_0xdba3('0x8c')+_0x4b0722['host']+_0xdba3('0x8d')+_0x43663f['id']});}})['catch'](function(_0x368b35){logger[_0xdba3('0x2f')](_0xdba3('0x90'),JSON[_0xdba3('0x10')](_0x368b35));});};exports['abandoned']=function(_0xec3dd6,_0x544920,_0x1fcbcd,_0xf7a49,_0x3dc4ab,_0x46f346){var _0x322e59,_0x5e3e98,_0x1f5da7;_0x46f346[_0xdba3('0x7d')]=intUtil['stripTrailingSlash'](_0x46f346[_0xdba3('0x7d')]);_0x46f346[_0xdba3('0x7e')]=intUtil[_0xdba3('0x7c')](_0x46f346['serverUrl']);if(_0x3dc4ab&&_0x3dc4ab['monitor_format']){logger['info'](_0xdba3('0x97'),_0xdba3('0x80'));_0x544920[_0xdba3('0x81')]=_0x46f346[_0xdba3('0x7e')]+_0xdba3('0x82')+_0x544920[_0xdba3('0x91')]+_0xdba3('0x92')+md5(_0x544920[_0xdba3('0x91')]);}else{_0x544920[_0xdba3('0x81')]='';}var _0x39dddf=_0x46f346[_0xdba3('0x7d')]===_0xdba3('0x83')?'eu':_0xdba3('0x84');return getAccessToken(_0x46f346)[_0xdba3('0x38')](function(_0x8dd585){_0x1f5da7=_0x8dd585;return getUser(_0x1f5da7,_0x39dddf,_0x46f346);})[_0xdba3('0x38')](function(_0xf7ac7c){_0x322e59=_0xf7ac7c;logger[_0xdba3('0x32')](_0xdba3('0x86'),_0x322e59['id']);return getEndUser(_0x1f5da7,_0x39dddf,_0x46f346,_0x544920['calleridname'],_0x544920[_0xdba3('0x87')],_0x322e59,_0x1fcbcd);})[_0xdba3('0x38')](function(_0x4162f4){_0x5e3e98=_0x4162f4;return getCall(_0x1f5da7,_0x39dddf,_0x46f346,_0x322e59,_0x5e3e98,_0x1fcbcd,_0x544920,'Inbound');})[_0xdba3('0x38')](function(_0x5a03b4){if(_0x5a03b4){logger[_0xdba3('0x32')](_0xdba3('0x88'),_0x5a03b4['id']);}})[_0xdba3('0x2e')](function(_0x2a1c68){logger['error'](_0xdba3('0x97'),JSON[_0xdba3('0x10')](_0x2a1c68));});}; \ No newline at end of file +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 diff --git a/server/services/ami/trigger/script/index.js b/server/services/ami/trigger/script/index.js index 76b06e6..1183f46 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(_0x4eb94b,_0x9a82ea){var _0x588527=function(_0x100637){while(--_0x100637){_0x4eb94b['push'](_0x4eb94b['shift']());}};_0x588527(++_0x9a82ea);}(_0x7a54,0x106));var _0x47a5=function(_0x1758eb,_0x20268d){_0x1758eb=_0x1758eb-0x0;var _0x238e15=_0x7a54[_0x1758eb];return _0x238e15;};'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(_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 diff --git a/server/services/ami/trigger/urlforward/index.js b/server/services/ami/trigger/urlforward/index.js index aede252..22279ee 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 _0xb10b=['number','headers','data6','parse','error','stack','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data1','statusCode','name','message','request-promise','lodash','mustache','../../../../config/logger','exec','toUpperCase','render','data5'];(function(_0x183368,_0x53b1cc){var _0x27b79b=function(_0x436e36){while(--_0x436e36){_0x183368['push'](_0x183368['shift']());}};_0x27b79b(++_0x53b1cc);}(_0xb10b,0x12a));var _0xbb10=function(_0x568eca,_0x549174){_0x568eca=_0x568eca-0x0;var _0x767192=_0xb10b[_0x568eca];return _0x767192;};'use strict';var rp=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var Mustache=require(_0xbb10('0x2'));var logger=require(_0xbb10('0x3'))('trigger');exports[_0xbb10('0x4')]=function(_0x9bbed,_0x460981){var _0x22320e,_0x49baf4;var _0x312b72={'method':_0x9bbed['data1'][_0xbb10('0x5')](),'uri':Mustache[_0xbb10('0x6')](_0x9bbed['data2'],_0x460981),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x9bbed[_0xbb10('0x7')])===_0xbb10('0x8')&&parseInt(_0x9bbed[_0xbb10('0x7')])>=0x1&&parseInt(_0x9bbed[_0xbb10('0x7')])<=0xa?parseInt(_0x9bbed[_0xbb10('0x7')])*0x3e8:0x5*0x3e8};try{_0x312b72[_0xbb10('0x9')]=_0x9bbed[_0xbb10('0xa')]?JSON[_0xbb10('0xb')](Mustache['render'](_0x9bbed['data6'],_0x460981)):{};}catch(_0x20bd61){logger[_0xbb10('0xc')](_0x20bd61[_0xbb10('0xd')]);}switch(_0x9bbed['data1'][_0xbb10('0x5')]()){case'GET':case _0xbb10('0xe'):_0x22320e=null;_0x312b72['qs']=_0x460981;break;case _0xbb10('0xf'):case _0xbb10('0x10'):if(_0x9bbed[_0xbb10('0x11')]){try{_0x22320e=JSON[_0xbb10('0xb')](Mustache[_0xbb10('0x6')](_0x9bbed['data7'],_0x460981));_0x312b72[_0xbb10('0x12')]=_0x22320e;}catch(_0x42d7e4){logger[_0xbb10('0xc')](_0x42d7e4[_0xbb10('0xd')]);logger[_0xbb10('0xc')](_0xbb10('0x13'));}}else{_0x22320e=_0x460981;_0x312b72[_0xbb10('0x12')]=_0x22320e;}break;}logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x16'),_0x9bbed['data1'],_0x9bbed[_0xbb10('0x17')],JSON[_0xbb10('0x18')](_0x312b72)));rp(_0x312b72)[_0xbb10('0x19')](function(_0x42db98){_0x22320e=!_[_0xbb10('0x1a')](_0x22320e)?_0xbb10('0x1b')+_0x22320e:'';_0x49baf4=typeof _0x42db98[_0xbb10('0x12')]===_0xbb10('0x1c')?JSON[_0xbb10('0x18')](_0x42db98[_0xbb10('0x12')]):_0x42db98['body'];logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x1d'),_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x42db98[_0xbb10('0x1f')],_0x49baf4));})['catch'](function(_0x12f888){logger[_0xbb10('0xc')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x12f888[_0xbb10('0x1f')],_0x12f888[_0xbb10('0x20')],_0x12f888[_0xbb10('0x21')]));});}; \ No newline at end of file +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 diff --git a/server/services/email/client.js b/server/services/email/client.js index 04f8abf..a540f5f 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 _0x0ef0=['catch','exports','jayson/promise','bluebird','routing','client','http','Request','request','then','debug','error','rpc','message'];(function(_0xd7f2d1,_0x14d262){var _0x5c1967=function(_0x2284a8){while(--_0x2284a8){_0xd7f2d1['push'](_0xd7f2d1['shift']());}};_0x5c1967(++_0x14d262);}(_0x0ef0,0x80));var _0x00ef=function(_0x189b1d,_0x1df005){_0x189b1d=_0x189b1d-0x0;var _0x3d8ab0=_0x0ef0[_0x189b1d];return _0x3d8ab0;};'use strict';var jayson=require(_0x00ef('0x0'));var BPromise=require(_0x00ef('0x1'));var logger=require('../../config/logger')(_0x00ef('0x2'));var client=jayson[_0x00ef('0x3')][_0x00ef('0x4')]({'port':0x2329});client[_0x00ef('0x5')]=function(_0xd4ab59,_0x92e0b){return new BPromise(function(_0x53bad3,_0x5743e8){return client[_0x00ef('0x6')](_0xd4ab59,_0x92e0b)[_0x00ef('0x7')](function(_0x471ebf){logger[_0x00ef('0x8')]('rpc',_0x00ef('0x2'),_0xd4ab59,_0x92e0b,_0x471ebf);if(_0x471ebf[_0x00ef('0x9')]){logger[_0x00ef('0x9')](_0x00ef('0xa'),_0x00ef('0x2'),_0xd4ab59,_0x471ebf['error'][_0x00ef('0xb')],_0x92e0b);return _0x5743e8(_0x471ebf[_0x00ef('0x9')][_0x00ef('0xb')]);}else{return _0x53bad3(_0x471ebf['result']);}})[_0x00ef('0xc')](function(_0x55c5d5){logger[_0x00ef('0x9')](_0x00ef('0xa'),_0x00ef('0x2'),_0xd4ab59,_0x55c5d5,_0x92e0b);return _0x5743e8(_0x55c5d5);});});};module[_0x00ef('0xd')]=client; \ No newline at end of file +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 diff --git a/server/services/email/index.js b/server/services/email/index.js index 07c4aad..31d0195 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 _0x33c5=['listen','Setting','findOne','loginMailFrequency','catch','log','./server','./realtime','./rpc/mailAccount','../../mysqldb','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts'];(function(_0x27171e,_0xacefbb){var _0x36cd78=function(_0x16c48c){while(--_0x16c48c){_0x27171e['push'](_0x27171e['shift']());}};_0x36cd78(++_0xacefbb);}(_0x33c5,0xe6));var _0x533c=function(_0x212bf5,_0x165cbd){_0x212bf5=_0x212bf5-0x0;var _0xfcad21=_0x33c5[_0x212bf5];return _0xfcad21;};'use strict';var BPromise=require('bluebird');var server=require(_0x533c('0x0'));var Realtime=require(_0x533c('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x533c('0x2'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x533c('0x3'))['db'];function initRealtime(){return BPromise[_0x533c('0x4')]()[_0x533c('0x5')](mailAccount[_0x533c('0x6')]())['then'](realtime[_0x533c('0x7')]())[_0x533c('0x5')](function(){email[_0x533c('0x8')](realtime[_0x533c('0x9')]);return realtime;});}function main(){return server[_0x533c('0xa')](realtime,email)[_0x533c('0x5')](function(_0x3a009b){return initRealtime();})[_0x533c('0x5')](function(_0x2c297c){return db[_0x533c('0xb')][_0x533c('0xc')]({'attributes':['id',_0x533c('0xd')],'raw':!![]});})[_0x533c('0x5')](function(_0x249f1a){return setInterval(initRealtime,_0x249f1a[_0x533c('0xd')]*0x3e8);})[_0x533c('0xe')](function(_0x5a150f){console[_0x533c('0xf')](_0x5a150f);});}main(); \ No newline at end of file +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 diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 484a2e4..06bf4b5 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 _0xb707=['Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','verifySmtp','Smtp','lastSync','then','verified','verify','exports','lodash','moment','bluebird','ioredis','../../../config/environment','email','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','name','key','active','Imap','status','messageStatus','total','isNil','stringify','md5','emit','prototype','refresh','hasOwnProperty','handleImapBox','handleImapEmail','bind','end','handleImapEnd','error','handleImapError','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','notify','catch'];(function(_0xe103e2,_0x41f2f0){var _0xb0f713=function(_0x3a7b95){while(--_0x3a7b95){_0xe103e2['push'](_0xe103e2['shift']());}};_0xb0f713(++_0x41f2f0);}(_0xb707,0x1b9));var _0x7b70=function(_0x4be0da,_0x3ebc6a){_0x4be0da=_0x4be0da-0x0;var _0x17bb6e=_0xb707[_0x4be0da];return _0x17bb6e;};'use strict';var _=require(_0x7b70('0x0'));var moment=require(_0x7b70('0x1'));var BPromise=require(_0x7b70('0x2'));var md5=require('md5');var Redis=require(_0x7b70('0x3'));var config=require(_0x7b70('0x4'));var logger=require('../../../config/logger')(_0x7b70('0x5'));config[_0x7b70('0x6')]=_['defaults'](config[_0x7b70('0x6')],{'host':_0x7b70('0x7'),'port':0x18eb});var io=require(_0x7b70('0x8'))(new Redis(config['redis']));var EmailImap=require(_0x7b70('0x9'));var EmailSmtp=require(_0x7b70('0xa'));var mailAccount=require(_0x7b70('0xb'));var md5Accounts={};function EmailChannel(_0x29aca7){logger[_0x7b70('0xc')](_0x7b70('0xd'));this[_0x7b70('0xe')]=_0x29aca7[_0x7b70('0xe')];this[_0x7b70('0xf')]={};this[_0x7b70('0x10')]=new EmailSmtp();}EmailChannel['prototype']['emit']=function(_0x257a4d){var _0x12ec3f=this[_0x7b70('0xe')][_0x257a4d];var _0x2749ce={'id':_0x12ec3f['id'],'name':_0x12ec3f[_0x7b70('0x11')],'key':_0x12ec3f[_0x7b70('0x12')],'active':_0x12ec3f[_0x7b70('0x13')],'Imap':{'status':_0x12ec3f[_0x7b70('0x14')][_0x7b70('0x15')],'messageStatus':_0x12ec3f[_0x7b70('0x14')][_0x7b70('0x16')],'total':_0x12ec3f[_0x7b70('0x14')][_0x7b70('0x17')]}};if(_[_0x7b70('0x18')](md5Accounts[_0x257a4d])){md5Accounts[_0x257a4d]={};}var _0x629150=md5(JSON[_0x7b70('0x19')](_0x2749ce));if(md5Accounts[_0x257a4d]['md5']!==_0x629150){md5Accounts[_0x257a4d][_0x7b70('0x1a')]=_0x629150;io[_0x7b70('0x1b')]('mailAccount:update',_0x2749ce);}};EmailChannel[_0x7b70('0x1c')][_0x7b70('0x1d')]=function(_0x498c1e){for(var _0x378009 in _0x498c1e){if(_0x498c1e[_0x7b70('0x1e')](_0x378009)){if(_0x498c1e[_0x378009]['Imap']&&_0x498c1e[_0x378009][_0x7b70('0x13')]){var _0x6c663a=_0x498c1e[_0x378009][_0x7b70('0x14')];if(!this['imapAccounts'][_0x7b70('0x1e')](_0x6c663a['id'])){this['imapAccounts'][_0x6c663a['id']]=new EmailImap(_0x6c663a,_0x498c1e[_0x378009][_0x7b70('0x5')]);this[_0x7b70('0xf')][_0x6c663a['id']]['on']('box',this[_0x7b70('0x1f')]['bind'](this,_0x378009));this[_0x7b70('0xf')][_0x6c663a['id']]['on'](_0x7b70('0x5'),this[_0x7b70('0x20')][_0x7b70('0x21')](this,_0x378009));this[_0x7b70('0xf')][_0x6c663a['id']]['on'](_0x7b70('0x22'),this[_0x7b70('0x23')][_0x7b70('0x21')](this,_0x378009));this[_0x7b70('0xf')][_0x6c663a['id']]['on'](_0x7b70('0x24'),this[_0x7b70('0x25')]['bind'](this,_0x378009));}}else{if(_[_0x7b70('0x18')](this[_0x7b70('0xe')][_0x378009]['Imap'])){this[_0x7b70('0xe')][_0x378009][_0x7b70('0x14')]={};}this[_0x7b70('0xe')][_0x378009][_0x7b70('0x14')]['status']=_0x7b70('0x26');this[_0x7b70('0xe')][_0x378009]['Imap'][_0x7b70('0x16')]='';this[_0x7b70('0x1b')](_0x378009);}}}};EmailChannel[_0x7b70('0x1c')][_0x7b70('0x1f')]=function(_0x38938a,_0x16a2db){if(this[_0x7b70('0xe')][_0x38938a]){this['mailAccounts'][_0x38938a][_0x7b70('0x14')][_0x7b70('0x15')]=_0x7b70('0x27');this[_0x7b70('0xe')][_0x38938a]['Imap'][_0x7b70('0x16')]=_0x16a2db[_0x7b70('0x11')];if(_0x16a2db[_0x7b70('0x28')]){this[_0x7b70('0xe')][_0x38938a]['Imap']['total']=_0x16a2db[_0x7b70('0x28')][_0x7b70('0x17')];}return this[_0x7b70('0x1b')](_0x38938a);}};EmailChannel[_0x7b70('0x1c')]['handleImapEmail']=function(_0x22bf63,_0x35dcd7){logger['info'](_0x7b70('0x29'),_0x35dcd7['firstName'],_0x35dcd7[_0x7b70('0x2a')],_0x35dcd7['from'],_0x22bf63);if(this['mailAccounts'][_0x22bf63]){return mailAccount[_0x7b70('0x2b')](_0x22bf63,_0x35dcd7)['then'](function(_0x448389){if(_0x448389){logger['info']('Mail\x20accepted\x20from\x20routing');}})[_0x7b70('0x2c')](function(_0x2a5589){logger[_0x7b70('0x24')](_0x7b70('0x2d'),JSON[_0x7b70('0x19')](_0x2a5589));});}};EmailChannel[_0x7b70('0x1c')][_0x7b70('0x23')]=function(_0x281f8c){if(this[_0x7b70('0xe')][_0x281f8c]&&this[_0x7b70('0xe')][_0x281f8c]['Imap']){if(this['imapAccounts'][this[_0x7b70('0xe')][_0x281f8c][_0x7b70('0x14')]['id']]){delete this['imapAccounts'][this[_0x7b70('0xe')][_0x281f8c][_0x7b70('0x14')]['id']];}this[_0x7b70('0xe')][_0x281f8c]['Imap']['lastSync']=moment();this[_0x7b70('0x1b')](_0x281f8c);}};EmailChannel[_0x7b70('0x1c')][_0x7b70('0x25')]=function(_0x5ba272,_0x4672c5){if(this[_0x7b70('0xe')][_0x5ba272]){this['mailAccounts'][_0x5ba272][_0x7b70('0x14')][_0x7b70('0x15')]=_0x7b70('0x24');this[_0x7b70('0xe')][_0x5ba272][_0x7b70('0x14')][_0x7b70('0x16')]=_0x4672c5;return this[_0x7b70('0x1b')](_0x5ba272);}};EmailChannel['prototype'][_0x7b70('0x2e')]=function(_0x1eea8d,_0x24a0f8){return this[_0x7b70('0x10')]['send'](_0x1eea8d,_0x24a0f8);};EmailChannel[_0x7b70('0x1c')][_0x7b70('0x2f')]=function(_0x10afd5){var _0x459955=this;if(this[_0x7b70('0xe')][_0x10afd5['id']]){if(_[_0x7b70('0x18')](this[_0x7b70('0xe')][_0x10afd5['id']][_0x7b70('0x30')])){this[_0x7b70('0xe')][_0x10afd5['id']]['Smtp']={};}this[_0x7b70('0xe')][_0x10afd5['id']][_0x7b70('0x30')][_0x7b70('0x31')]=moment();return new BPromise(function(_0xdab655,_0xb685c2){return _0x459955[_0x7b70('0x10')]['verify'](_0x10afd5)[_0x7b70('0x32')](function(_0xd9c6e6){_0x459955['mailAccounts'][_0x10afd5['id']]['Smtp'][_0x7b70('0x15')]=_0x7b70('0x33');_0x459955[_0x7b70('0xe')][_0x10afd5['id']]['Smtp']['messageStatus']='';_0x459955[_0x7b70('0x1b')](_0x10afd5['id']);_0xdab655(_0xd9c6e6);})[_0x7b70('0x2c')](function(_0x33ca2a){_0x459955[_0x7b70('0xe')][_0x10afd5['id']][_0x7b70('0x30')][_0x7b70('0x15')]=_0x7b70('0x24');_0x459955[_0x7b70('0xe')][_0x10afd5['id']]['Smtp']['messageStatus']=_0x33ca2a;_0x459955[_0x7b70('0x1b')](_0x10afd5['id']);_0xb685c2(_0x33ca2a);});});}return this[_0x7b70('0x10')][_0x7b70('0x34')](_0x10afd5);};module[_0x7b70('0x35')]=EmailChannel; \ No newline at end of file +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 diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index c4d0caf..567cf05 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 _0x262d=['handleCloseBox','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','parser','stringify','textCode','hasOwnProperty','path','imap','lodash','randomstring','mailparser','simpleParser','Iconv','events','EventEmitter','./utils','email','mailbox','INBOX','account','getAccount','once','ready','handleReady','end','handleEnd','bind','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','getHost','anonymous@xcally.com','handleOpenBox','emit','readUnseen'];(function(_0x4a39c7,_0x4bf839){var _0x2007e5=function(_0x19bd01){while(--_0x19bd01){_0x4a39c7['push'](_0x4a39c7['shift']());}};_0x2007e5(++_0x4bf839);}(_0x262d,0x188));var _0xd262=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x262d[_0x4e1d03];return _0x362d4b;};'use strict';var fs=require('fs');var path=require(_0xd262('0x0'));var util=require('util');var Imap=require(_0xd262('0x1'));var _=require(_0xd262('0x2'));var rs=require(_0xd262('0x3'));var simpleParser=require(_0xd262('0x4'))[_0xd262('0x5')];var Iconv=require('iconv')[_0xd262('0x6')];var EventEmitter=require(_0xd262('0x7'))[_0xd262('0x8')];var utils=require(_0xd262('0x9'));var logger=require('../../../config/logger')(_0xd262('0xa'));function EmailImap(_0x37526e,_0x43a93c){this[_0xd262('0xb')]=_0xd262('0xc');this[_0xd262('0xd')]=this[_0xd262('0xe')](_0x37526e,_0x43a93c);this[_0xd262('0x1')]=new Imap(this['account']);this['imap'][_0xd262('0xf')](_0xd262('0x10'),this[_0xd262('0x11')]['bind'](this));this[_0xd262('0x1')][_0xd262('0xf')](_0xd262('0x12'),this[_0xd262('0x13')][_0xd262('0x14')](this));this[_0xd262('0x1')]['on'](_0xd262('0x15'),this[_0xd262('0x16')]['bind'](this));this[_0xd262('0x1')][_0xd262('0x17')]();}util[_0xd262('0x18')](EmailImap,EventEmitter);EmailImap[_0xd262('0x19')]['getAccount']=function(_0x430f2b,_0x5f54e9){var _0x22677b={'connTimeout':_0x430f2b[_0xd262('0x1a')]?_0x430f2b[_0xd262('0x1a')]*0x3e8:0x2710,'authTimeout':_0x430f2b[_0xd262('0x1b')]?_0x430f2b[_0xd262('0x1b')]*0x3e8:0x1388};if(_[_0xd262('0x1c')](_0x430f2b[_0xd262('0x1d')])){if(_0x430f2b[_0xd262('0x1e')]){_0x22677b[_0xd262('0x1f')]=_0x430f2b['user'];_0x22677b['password']=_0x430f2b[_0xd262('0x20')];}_0x22677b[_0xd262('0x21')]=_0x430f2b[_0xd262('0x21')];_0x22677b[_0xd262('0x22')]=_0x430f2b[_0xd262('0x22')]||0x3e1;if(_0x430f2b[_0xd262('0x23')]){_0x22677b[_0xd262('0x23')]=!![];}else{_0x22677b[_0xd262('0x23')]=![];_0x22677b[_0xd262('0x24')]='required';}}else{_0x22677b[_0xd262('0x1f')]=_0x430f2b[_0xd262('0x1f')];_0x22677b[_0xd262('0x20')]=_0x430f2b[_0xd262('0x20')];_0x22677b[_0xd262('0x21')]=utils[_0xd262('0x25')](_0x430f2b[_0xd262('0x1d')]);_0x22677b[_0xd262('0x22')]=0x3e1;_0x22677b[_0xd262('0x23')]=!![];}_0x22677b[_0xd262('0xa')]=_0x5f54e9||_0x430f2b[_0xd262('0x1f')]||_0xd262('0x26');return _0x22677b;};EmailImap[_0xd262('0x19')][_0xd262('0x11')]=function(){this[_0xd262('0x1')]['openBox'](this[_0xd262('0xb')],![],this[_0xd262('0x27')]['bind'](this));};EmailImap['prototype'][_0xd262('0x27')]=function(_0x844774,_0x378260){if(_0x844774){this['handleError'](_0x844774,!![]);}else{this[_0xd262('0x28')]('box',_0x378260);this[_0xd262('0x29')]();}};EmailImap['prototype'][_0xd262('0x2a')]=function(_0x15619d){if(_0x15619d){this[_0xd262('0x16')](_0x15619d,!![]);}else{this[_0xd262('0x1')][_0xd262('0x12')]();}};EmailImap[_0xd262('0x19')][_0xd262('0x29')]=function(){this[_0xd262('0x1')]['search']([_0xd262('0x2b')],this[_0xd262('0x2c')][_0xd262('0x14')](this));};EmailImap[_0xd262('0x19')][_0xd262('0x2c')]=function(_0x46c88b,_0x128ff6){if(_0x46c88b){this['handleError'](_0x46c88b,!![]);}else{if(_0x128ff6[_0xd262('0x2d')]){try{var _0x1280ee=this[_0xd262('0x1')][_0xd262('0x2e')](_0x128ff6,{'bodies':'','markSeen':!![]});_0x1280ee['on'](_0xd262('0x2f'),this[_0xd262('0x30')][_0xd262('0x14')](this));_0x1280ee[_0xd262('0xf')]('error',this[_0xd262('0x31')][_0xd262('0x14')](this));_0x1280ee[_0xd262('0xf')](_0xd262('0x12'),this[_0xd262('0x32')][_0xd262('0x14')](this));}catch(_0x5af7d5){logger[_0xd262('0x15')](_0x5af7d5);}}else{this[_0xd262('0x1')][_0xd262('0x33')](!![],this[_0xd262('0x2a')][_0xd262('0x14')](this));}}};EmailImap[_0xd262('0x19')]['handleFetchMessage']=function(_0x2cc18c,_0x3246f8){_0x2cc18c['on'](_0xd262('0x34'),this['handleMessageBody']['bind'](this));_0x2cc18c[_0xd262('0xf')](_0xd262('0x35'),this[_0xd262('0x36')][_0xd262('0x14')](this));_0x2cc18c[_0xd262('0xf')](_0xd262('0x12'),this[_0xd262('0x37')]['bind'](this));};EmailImap[_0xd262('0x19')][_0xd262('0x38')]=function(_0x203e78,_0x10e5ed){simpleParser(_0x203e78,{'Iconv':Iconv},this[_0xd262('0x39')][_0xd262('0x14')](this));};EmailImap['prototype'][_0xd262('0x36')]=function(_0x2018d6){};EmailImap[_0xd262('0x19')][_0xd262('0x37')]=function(){};EmailImap[_0xd262('0x19')][_0xd262('0x39')]=function(_0x5c2cc8,_0x3bb5c1){if(_0x5c2cc8){logger['error'](_0x5c2cc8);}else{var _0x5a7cee=this;utils[_0xd262('0x3a')](this[_0xd262('0xd')],_0x3bb5c1,function(_0x2b9bb9){_0x5a7cee[_0xd262('0x28')]('email',_0x2b9bb9);});}};EmailImap[_0xd262('0x19')][_0xd262('0x32')]=function(){this[_0xd262('0x1')][_0xd262('0x33')](!![],this[_0xd262('0x2a')][_0xd262('0x14')](this));};EmailImap[_0xd262('0x19')]['handleFetchError']=function(_0x810f16){this[_0xd262('0x16')](_0x810f16);this[_0xd262('0x1')]['closeBox'](!![],this[_0xd262('0x2a')][_0xd262('0x14')](this));};EmailImap[_0xd262('0x19')][_0xd262('0x13')]=function(){this[_0xd262('0x28')](_0xd262('0x12'));};EmailImap['prototype'][_0xd262('0x16')]=function(_0x3c0072,_0x3a184a){logger[_0xd262('0x15')](_0xd262('0x16'),this[_0xd262('0xd')][_0xd262('0xa')],JSON[_0xd262('0x3b')](_0x3c0072));var _0x2f60a3='';if(_0x3c0072){if(_0x3c0072[_0xd262('0x3c')]){_0x2f60a3=_0x3c0072[_0xd262('0x3c')];}else{for(var _0x34c46f in _0x3c0072){if(_0x3c0072[_0xd262('0x3d')](_0x34c46f)){_0x2f60a3+=_['upperFirst'](_0x34c46f)+':\x20'+_0x3c0072[_0x34c46f]+'\x0a';}}}}if(_0x3a184a){this[_0xd262('0x1')][_0xd262('0x12')]();}else{this[_0xd262('0x28')](_0xd262('0x15'),_0x2f60a3);this[_0xd262('0x28')]('end');}};module['exports']=EmailImap; \ No newline at end of file +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 diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index c508cb3..e3a59d5 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 _0xf274=['compile','toString','verify','createTransport','exports','nodemailer','prototype','send','use'];(function(_0x31d595,_0x431e8f){var _0x533aae=function(_0x5c9f5b){while(--_0x5c9f5b){_0x31d595['push'](_0x31d595['shift']());}};_0x533aae(++_0x431e8f);}(_0xf274,0x16d));var _0x4f27=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xf274[_0x57b54c];return _0x59cc19;};'use strict';var nodemailer=require(_0x4f27('0x0'));var BPromise=require('bluebird');var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x4f27('0x1')][_0x4f27('0x2')]=function(_0x5cfd06,_0xaed153){return new BPromise(function(_0x448a0d,_0x3f8fca){var _0x1d35a5=nodemailer['createTransport'](_0x5cfd06);_0x1d35a5[_0x4f27('0x3')](_0x4f27('0x4'),inlineBase64());_0x1d35a5['sendMail'](_0xaed153,function(_0xa24f75,_0x4d8ef4){if(_0xa24f75){_0x3f8fca(_0xa24f75[_0x4f27('0x5')]());}else{_0x448a0d(_0x4d8ef4);}});});};EmailSmtp[_0x4f27('0x1')][_0x4f27('0x6')]=function(_0x249fae){return new BPromise(function(_0x15d1e2,_0x55a34c){var _0x3cbefd=nodemailer[_0x4f27('0x7')](_0x249fae);_0x3cbefd['verify'](function(_0x32f244,_0x20bc1c){if(_0x32f244){_0x55a34c(_0x32f244[_0x4f27('0x5')]());}else{if(_0x20bc1c){_0x15d1e2(_0x20bc1c);}else{_0x55a34c('Not\x20verifired');}}});});};module[_0x4f27('0x8')]=EmailSmtp; \ No newline at end of file +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 diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 2c04cc3..dd84849 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 _0xeb61=['hotmail','imap-mail.outlook.com','outlook.office365.com','127.0.0.1','moment','randomstring','path','util','node-tnef','../../../config/logger','../../../config/environment','head','value','address','generate','name','split','length','slice','Anonymous','pop','isEmpty','anonymous','@xcally.com','html','test','body','textAsHtml','replace','Empty\x20message

','Attachments','push','Title','Data','getHost','gmail','yahoo','imap.mail.yahoo.com'];(function(_0x4bf286,_0x203998){var _0x473e9d=function(_0x4ec3df){while(--_0x4ec3df){_0x4bf286['push'](_0x4bf286['shift']());}};_0x473e9d(++_0x203998);}(_0xeb61,0x1d9));var _0x1eb6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeb61[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var moment=require(_0x1eb6('0x0'));var random=require(_0x1eb6('0x1'));var fs=require('fs');var path=require(_0x1eb6('0x2'));var util=require(_0x1eb6('0x3'));var tnef=require(_0x1eb6('0x4'));var logger=require(_0x1eb6('0x5'))('email');var config=require(_0x1eb6('0x6'));function getAddress(_0x5217ef){var _0x1eacad=_[_0x1eb6('0x7')](_0x5217ef[_0x1eb6('0x8')]);return _0x1eacad&&_0x1eacad['address']?_0x1eacad[_0x1eb6('0x9')]:'anonymous'+random[_0x1eb6('0xa')](0x6)+'@xcally.com';}function getFirstName(_0x550daa){var _0x5966fd=_['head'](_0x550daa['value']);if(_0x5966fd&&_0x5966fd[_0x1eb6('0xb')]){var _0x3bf55e=_0x5966fd['name'][_0x1eb6('0xc')](/\s+/);return _0x3bf55e[_0x1eb6('0xd')]?_0x3bf55e[_0x1eb6('0xe')](0x0,-0x1)['join']('\x20'):_0x5966fd[_0x1eb6('0xb')];}return _0x1eb6('0xf');}function getLastName(_0x8415f8){var _0x7f5027=_[_0x1eb6('0x7')](_0x8415f8[_0x1eb6('0x8')]);if(_0x7f5027&&_0x7f5027[_0x1eb6('0xb')]){var _0x2d1c4f=_0x7f5027[_0x1eb6('0xb')]['split'](/\s+/);return _0x2d1c4f[_0x1eb6('0xd')]>0x1?_0x2d1c4f[_0x1eb6('0x10')]():'';}return'';}function getMails(_0x3594ef,_0x35c1f0){var _0x39e5cc='';for(var _0x448893=0x0;_0x448893<_0x35c1f0[_0x1eb6('0x8')][_0x1eb6('0xd')];_0x448893+=0x1){if(_0x35c1f0[_0x1eb6('0x8')][_0x448893]['address']!==_0x3594ef){if(!_[_0x1eb6('0x11')](_0x39e5cc)){_0x39e5cc+=',';}_0x39e5cc+=_0x35c1f0['value'][_0x448893]['name']||_0x35c1f0[_0x1eb6('0x8')][_0x448893][_0x1eb6('0x9')]||'';_0x39e5cc+='\x20<';_0x39e5cc+=_0x35c1f0[_0x1eb6('0x8')][_0x448893][_0x1eb6('0x9')]?_0x35c1f0[_0x1eb6('0x8')][_0x448893][_0x1eb6('0x9')]:_0x1eb6('0x12')+random[_0x1eb6('0xa')](0x6)+_0x1eb6('0x13');_0x39e5cc+='>';}}return _0x39e5cc;}function parseEmail(_0x3fd55f,_0x345696,_0x147d3c){if(_0x345696[_0x1eb6('0x14')]){var _0x59a7a6=/)<[^<]*)*<\/script>/gi;while(_0x59a7a6[_0x1eb6('0x15')](_0x345696['html'])){_0x345696['html']=_0x345696['html']['replace'](_0x59a7a6,'');}_0x147d3c['body']=_0x345696[_0x1eb6('0x14')];}else{_0x147d3c[_0x1eb6('0x16')]=_0x345696[_0x1eb6('0x17')];}if(_0x147d3c[_0x1eb6('0x16')]){_0x147d3c[_0x1eb6('0x16')]=_0x147d3c[_0x1eb6('0x16')][_0x1eb6('0x18')](/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')](/0x0){if(this[_0x6df244+'Capacity']>0x0&&this[_0x6df244+'CurrentCapacity']>=this[_0x6df244+'Capacity']){return'maxcapacity';}else{return _0xed87('0x26');}}else{return'idle';}};Agent[_0xed87('0x23')][_0xed87('0x22')]=function(){var _0x5b1659=[_0xed87('0x27'),'chat',_0xed87('0x28'),_0xed87('0x29'),_0xed87('0x2a')];for(var _0x2a8733=0x0;_0x2a8733<_0x5b1659[_0xed87('0x2b')];_0x2a8733+=0x1){var _0x5d15b3=this[_0xed87('0x24')](_0x5b1659[_0x2a8733]);if(this[_0x5b1659[_0x2a8733]+_0xed87('0x2c')]!==_0x5d15b3){this[_0x5b1659[_0x2a8733]+_0xed87('0x2d')]=_[_0xed87('0x2e')](moment()[_0xed87('0x2f')]('x'));}this[_0x5b1659[_0x2a8733]+_0xed87('0x2c')]=_0x5d15b3;}var _0x25a6f7={'id':this['id'],'name':this[_0xed87('0x6')],'online':this[_0xed87('0x7')],'voicePause':this[_0xed87('0x8')],'chatPause':this[_0xed87('0x9')],'mailPause':this[_0xed87('0xa')],'smsPause':this[_0xed87('0xc')],'faxPause':this[_0xed87('0xb')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0xed87('0xe')],'chatStatusTime':this[_0xed87('0x30')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xed87('0x31')],'mailStatus':this[_0xed87('0x32')],'mailStatusTime':this[_0xed87('0x11')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0xed87('0x14')],'faxStatusTime':this[_0xed87('0x15')],'faxCapacity':this[_0xed87('0x16')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0xed87('0x18')],'smsStatusTime':this[_0xed87('0x19')],'smsCapacity':this[_0xed87('0x1a')],'smsCurrentCapacity':this[_0xed87('0x33')],'openchannelStatus':this[_0xed87('0x1b')],'openchannelStatusTime':this[_0xed87('0x1c')],'openchannelCapacity':this[_0xed87('0x1d')],'openchannelCurrentCapacity':this[_0xed87('0x1e')],'busy':this[_0xed87('0x1f')],'busyQueue':this['busyQueue']};var _0x37783a=md5(JSON[_0xed87('0x34')](_0x25a6f7));if(this['md5']!==_0x37783a){this[_0xed87('0x21')]=_0x37783a;io['emit'](_0xed87('0x35'),_0x25a6f7);}};module[_0xed87('0x36')]=Agent; \ No newline at end of file +var _0xf45e=['working','idle','chat','openchannel','fax','sms','length','Status','toNumber','format','chatStatusTime','smsStatus','smsCurrentCapacity','openchannelCurrentCapacity','busy','stringify','exports','lodash','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','faxStatus','faxStatusTime','faxCurrentCapacity','smsStatusTime','smsCapacity','openchannelStatusTime','openchannelCapacity','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity'];(function(_0x3bc469,_0x2385bc){var _0x3be3f2=function(_0x18ac3a){while(--_0x18ac3a){_0x3bc469['push'](_0x3bc469['shift']());}};_0x3be3f2(++_0x2385bc);}(_0xf45e,0x115));var _0xef45=function(_0x303194,_0x1f20ed){_0x303194=_0x303194-0x0;var _0x5916fa=_0xf45e[_0x303194];return _0x5916fa;};'use strict';var _=require(_0xef45('0x0'));var moment=require('moment');var md5=require(_0xef45('0x1'));var Redis=require('ioredis');var config=require(_0xef45('0x2'));config[_0xef45('0x3')]=_[_0xef45('0x4')](config[_0xef45('0x3')],{'host':_0xef45('0x5'),'port':0x18eb});var io=require(_0xef45('0x6'))(new Redis(config[_0xef45('0x3')]));function Agent(_0x116068){this['id']=_0x116068['id']||0x0;this[_0xef45('0x7')]=_0x116068[_0xef45('0x7')]||'';this[_0xef45('0x8')]=_0x116068[_0xef45('0x8')]||!![];this[_0xef45('0x9')]=_0x116068[_0xef45('0x9')]||![];this[_0xef45('0xa')]=_0x116068[_0xef45('0xa')]||![];this[_0xef45('0xb')]=_0x116068[_0xef45('0xb')]||![];this[_0xef45('0xc')]=_0x116068['faxPause']||![];this[_0xef45('0xd')]=_0x116068[_0xef45('0xd')]||![];this[_0xef45('0xe')]=_0x116068[_0xef45('0xe')]||![];this[_0xef45('0xf')]=_0xef45('0x10');this['chatStatusTime']=0x0;this[_0xef45('0x11')]=_0x116068[_0xef45('0x11')]||0x0;this[_0xef45('0x12')]=0x0;this[_0xef45('0x13')]=_0xef45('0x10');this['mailStatusTime']=0x0;this['mailCapacity']=_0x116068[_0xef45('0x14')]||0x0;this['mailCurrentCapacity']=0x0;this[_0xef45('0x15')]=_0xef45('0x10');this[_0xef45('0x16')]=0x0;this['faxCapacity']=_0x116068['faxCapacity']||0x0;this[_0xef45('0x17')]=0x0;this['smsStatus']=_0xef45('0x10');this[_0xef45('0x18')]=0x0;this[_0xef45('0x19')]=_0x116068[_0xef45('0x19')]||0x0;this['smsCurrentCapacity']=0x0;this['openchannelStatus']=_0xef45('0x10');this[_0xef45('0x1a')]=0x0;this[_0xef45('0x1b')]=_0x116068[_0xef45('0x1b')]||0x0;this['openchannelCurrentCapacity']=0x0;this['busy']=![];this[_0xef45('0x1c')]=undefined;this[_0xef45('0x1')]='';this[_0xef45('0x1d')]();}Agent[_0xef45('0x1e')][_0xef45('0x1f')]=function(_0xde347f){if(this[_0xde347f+_0xef45('0x20')]>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 diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 6d329f6..fe799e5 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 _0x844d=['online','chatPause','available','stringify','md5','format','chat:queue:%s','emit','chat_queue:save','exports','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','prototype','updateRouting','mapAgentsId','_rr','updateRealtime','loggedIn','paused','length'];(function(_0x4cc37c,_0x7657d5){var _0x697e1e=function(_0x55b515){while(--_0x55b515){_0x4cc37c['push'](_0x4cc37c['shift']());}};_0x697e1e(++_0x7657d5);}(_0x844d,0x149));var _0xd844=function(_0x5aa992,_0x559ebb){_0x5aa992=_0x5aa992-0x0;var _0x2e2d59=_0x844d[_0x5aa992];return _0x2e2d59;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xd844('0x0'));var Redis=require(_0xd844('0x1'));var config=require(_0xd844('0x2'));config[_0xd844('0x3')]=_['defaults'](config[_0xd844('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xd844('0x4'))(new Redis(config[_0xd844('0x3')]));function ChatQueue(_0x35e4b2){this['id']=_0x35e4b2['id']||0x0;this[_0xd844('0x5')]=_0x35e4b2[_0xd844('0x5')]||'';this[_0xd844('0x6')]=_0x35e4b2['timeout']||0xa;this[_0xd844('0x7')]=_0x35e4b2[_0xd844('0x7')]||_0xd844('0x8');this[_0xd844('0x9')]=_0x35e4b2[_0xd844('0x9')];this['mapAgentsId']={};this[_0xd844('0xa')]=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}ChatQueue[_0xd844('0xb')][_0xd844('0xc')]=function(){var _0x542e92=this[_0xd844('0xd')][_0xd844('0xe')];this['mapAgentsId']=_['map'](this[_0xd844('0x9')],'id');this[_0xd844('0xd')][_0xd844('0xe')]=_0x542e92;};ChatQueue[_0xd844('0xb')][_0xd844('0xf')]=function(){this[_0xd844('0x10')]=0x0;this[_0xd844('0x11')]=0x0;for(var _0x57665d=0x0;_0x57665d=0x0?this[_0xd844('0x15')]:0x0;var _0xb3e04f={'id':this['id'],'available':this[_0xd844('0x15')],'loggedIn':this[_0xd844('0x10')],'name':this[_0xd844('0x5')],'paused':this[_0xd844('0x11')],'waiting':this['waiting']};var _0x5ec596=md5(JSON[_0xd844('0x16')](_0xb3e04f));if(this[_0xd844('0x17')]!==_0x5ec596){this[_0xd844('0x17')]=_0x5ec596;io['to'](util[_0xd844('0x18')](_0xd844('0x19'),_0xb3e04f[_0xd844('0x5')]))[_0xd844('0x1a')](_0xd844('0x1b'),_0xb3e04f);}};module[_0xd844('0x1c')]=ChatQueue; \ No newline at end of file +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 diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 55f35e4..c8de9ad 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(_0x39cbea,_0x12eee4){var _0x1eb1e8=function(_0x5cbabe){while(--_0x5cbabe){_0x39cbea['push'](_0x39cbea['shift']());}};_0x1eb1e8(++_0x12eee4);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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(_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 diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 6e5f53e..7b17b39 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 _0x785d=['Intervals','exports','name'];(function(_0x526aaf,_0x3284ca){var _0x184067=function(_0x59af8d){while(--_0x59af8d){_0x526aaf['push'](_0x526aaf['shift']());}};_0x184067(++_0x3284ca);}(_0x785d,0x1b2));var _0xd785=function(_0x4d61ca,_0xedf7d9){_0x4d61ca=_0x4d61ca-0x0;var _0x1674ef=_0x785d[_0x4d61ca];return _0x1674ef;};'use strict';function Interval(_0x496b00){this['id']=_0x496b00['id']||0x0;this[_0xd785('0x0')]=_0x496b00['name']||'';this[_0xd785('0x1')]=_0x496b00[_0xd785('0x1')]||{};}module[_0xd785('0x2')]=Interval; \ No newline at end of file +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 diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index f6484ea..e0c7819 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 _0x2db9=['timeout','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','available','mail:queue:%s','emit','mail_queue:save','exports','lodash','../../../config/environment','redis','defaults','socket.io-emitter','name'];(function(_0x4427a7,_0x597800){var _0x27abd9=function(_0x1c298a){while(--_0x1c298a){_0x4427a7['push'](_0x4427a7['shift']());}};_0x27abd9(++_0x597800);}(_0x2db9,0x171));var _0x92db=function(_0xc3fb0e,_0xe088d6){_0xc3fb0e=_0xc3fb0e-0x0;var _0x222486=_0x2db9[_0xc3fb0e];return _0x222486;};'use strict';var _=require(_0x92db('0x0'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var config=require(_0x92db('0x1'));config[_0x92db('0x2')]=_[_0x92db('0x3')](config[_0x92db('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0x92db('0x4'))(new Redis(config[_0x92db('0x2')]));function MailQueue(_0x28cdf9){this['id']=_0x28cdf9['id']||0x0;this[_0x92db('0x5')]=_0x28cdf9[_0x92db('0x5')]||'';this[_0x92db('0x6')]=_0x28cdf9[_0x92db('0x6')]||0xa;this['strategy']=_0x28cdf9[_0x92db('0x7')]||_0x92db('0x8');this[_0x92db('0x9')]=_0x28cdf9[_0x92db('0x9')];this['mapAgentsId']={};this[_0x92db('0xa')]=0x0;this[_0x92db('0xb')]='';this[_0x92db('0xc')]();this[_0x92db('0xd')]();}MailQueue[_0x92db('0xe')]['updateRouting']=function(){var _0x11a0a4=this[_0x92db('0xf')][_0x92db('0x10')];this['mapAgentsId']=_[_0x92db('0x11')](this['Agents'],'id');this[_0x92db('0xf')]['_rr']=_0x11a0a4;};MailQueue[_0x92db('0xe')][_0x92db('0xd')]=function(){this[_0x92db('0x12')]=0x0;this[_0x92db('0x13')]=0x0;for(var _0x42b50e=0x0;_0x42b50e=0x0?this[_0x92db('0x14')]:0x0;var _0x38c1d1={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x92db('0x13')],'waiting':this['waiting']};var _0x5a974c=md5(JSON['stringify'](_0x38c1d1));if(this[_0x92db('0xb')]!==_0x5a974c){this[_0x92db('0xb')]=_0x5a974c;io['to'](util['format'](_0x92db('0x15'),_0x38c1d1['name']))[_0x92db('0x16')](_0x92db('0x17'),_0x38c1d1);}};module[_0x92db('0x18')]=MailQueue; \ No newline at end of file +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 diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 61b1d8a..98a36b8 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 _0x317b=['updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','online','openchannelPause','available','stringify','format','emit','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','beepall','Agents','mapAgentsId','waiting'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x317b,0xee));var _0xb317=function(_0x50e2d9,_0x2be546){_0x50e2d9=_0x50e2d9-0x0;var _0x204de0=_0x317b[_0x50e2d9];return _0x204de0;};'use strict';var _=require(_0xb317('0x0'));var md5=require(_0xb317('0x1'));var util=require(_0xb317('0x2'));var Redis=require(_0xb317('0x3'));var config=require(_0xb317('0x4'));config[_0xb317('0x5')]=_[_0xb317('0x6')](config['redis'],{'host':_0xb317('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb317('0x5')]));function OpenchannelQueue(_0x49705d){this['id']=_0x49705d['id']||0x0;this[_0xb317('0x8')]=_0x49705d['name']||'';this[_0xb317('0x9')]=_0x49705d[_0xb317('0x9')]||0xa;this['strategy']=_0x49705d['strategy']||_0xb317('0xa');this[_0xb317('0xb')]=_0x49705d[_0xb317('0xb')];this[_0xb317('0xc')]={};this[_0xb317('0xd')]=0x0;this[_0xb317('0x1')]='';this[_0xb317('0xe')]();this[_0xb317('0xf')]();}OpenchannelQueue[_0xb317('0x10')][_0xb317('0xe')]=function(){var _0x3515b7=this[_0xb317('0xc')]['_rr'];this['mapAgentsId']=_['map'](this[_0xb317('0xb')],'id');this[_0xb317('0xc')][_0xb317('0x11')]=_0x3515b7;};OpenchannelQueue['prototype'][_0xb317('0xf')]=function(){this[_0xb317('0x12')]=0x0;this[_0xb317('0x13')]=0x0;for(var _0x273020=0x0;_0x273020=0x0?this['available']:0x0;var _0x2fb9d1={'id':this['id'],'available':this[_0xb317('0x16')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0xb317('0x13')],'waiting':this[_0xb317('0xd')]};var _0x4a4059=md5(JSON[_0xb317('0x17')](_0x2fb9d1));if(this['md5']!==_0x4a4059){this[_0xb317('0x1')]=_0x4a4059;io['to'](util[_0xb317('0x18')]('openchannel:queue:%s',_0x2fb9d1[_0xb317('0x8')]))[_0xb317('0x19')](_0xb317('0x1a'),_0x2fb9d1);}};module[_0xb317('0x1b')]=OpenchannelQueue; \ No newline at end of file +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 diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 62c9be8..45d8489 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 _0xe706=['prototype','_rr','map','online','loggedIn','smsPause','available','paused','stringify','format','sms:queue:%s','emit','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x5c965a,_0x42cc16){var _0x3b6bd9=function(_0x3ba393){while(--_0x3ba393){_0x5c965a['push'](_0x5c965a['shift']());}};_0x3b6bd9(++_0x42cc16);}(_0xe706,0xa3));var _0x6e70=function(_0x202c61,_0x3673e0){_0x202c61=_0x202c61-0x0;var _0x540691=_0xe706[_0x202c61];return _0x540691;};'use strict';var _=require(_0x6e70('0x0'));var md5=require(_0x6e70('0x1'));var util=require(_0x6e70('0x2'));var Redis=require('ioredis');var config=require(_0x6e70('0x3'));config[_0x6e70('0x4')]=_[_0x6e70('0x5')](config[_0x6e70('0x4')],{'host':_0x6e70('0x6'),'port':0x18eb});var io=require(_0x6e70('0x7'))(new Redis(config[_0x6e70('0x4')]));function SmsQueue(_0x506db9){this['id']=_0x506db9['id']||0x0;this[_0x6e70('0x8')]=_0x506db9[_0x6e70('0x8')]||'';this[_0x6e70('0x9')]=_0x506db9[_0x6e70('0x9')]||0xa;this[_0x6e70('0xa')]=_0x506db9[_0x6e70('0xa')]||_0x6e70('0xb');this[_0x6e70('0xc')]=_0x506db9[_0x6e70('0xc')];this[_0x6e70('0xd')]={};this[_0x6e70('0xe')]=0x0;this[_0x6e70('0x1')]='';this[_0x6e70('0xf')]();this[_0x6e70('0x10')]();}SmsQueue[_0x6e70('0x11')][_0x6e70('0xf')]=function(){var _0x5b3d07=this['mapAgentsId'][_0x6e70('0x12')];this[_0x6e70('0xd')]=_[_0x6e70('0x13')](this[_0x6e70('0xc')],'id');this[_0x6e70('0xd')][_0x6e70('0x12')]=_0x5b3d07;};SmsQueue[_0x6e70('0x11')][_0x6e70('0x10')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x48bc72=0x0;_0x48bc72=0x0?this['available']:0x0;var _0x28a21f={'id':this['id'],'available':this[_0x6e70('0x17')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x6e70('0x18')],'waiting':this[_0x6e70('0xe')]};var _0x2368eb=md5(JSON[_0x6e70('0x19')](_0x28a21f));if(this[_0x6e70('0x1')]!==_0x2368eb){this[_0x6e70('0x1')]=_0x2368eb;io['to'](util[_0x6e70('0x1a')](_0x6e70('0x1b'),_0x28a21f[_0x6e70('0x8')]))[_0x6e70('0x1c')]('sms_queue:save',_0x28a21f);}};module[_0x6e70('0x1d')]=SmsQueue; \ No newline at end of file +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 diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index f01c31f..030832c 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 _0x1230=['strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','map','updateRealtime','length','online','loggedIn','whatsappPause','paused','available','whatsapp:queue:%s','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name'];(function(_0x3b19ea,_0x518b6b){var _0x40ece9=function(_0x3a3386){while(--_0x3a3386){_0x3b19ea['push'](_0x3b19ea['shift']());}};_0x40ece9(++_0x518b6b);}(_0x1230,0x13b));var _0x0123=function(_0x36b3b7,_0x24266c){_0x36b3b7=_0x36b3b7-0x0;var _0x1b40d6=_0x1230[_0x36b3b7];return _0x1b40d6;};'use strict';var _=require(_0x0123('0x0'));var md5=require(_0x0123('0x1'));var util=require(_0x0123('0x2'));var Redis=require(_0x0123('0x3'));var config=require(_0x0123('0x4'));config[_0x0123('0x5')]=_[_0x0123('0x6')](config[_0x0123('0x5')],{'host':_0x0123('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0123('0x5')]));function WhatsappQueue(_0x472e99){this['id']=_0x472e99['id']||0x0;this['name']=_0x472e99[_0x0123('0x8')]||'';this['timeout']=_0x472e99['timeout']||0xa;this[_0x0123('0x9')]=_0x472e99[_0x0123('0x9')]||_0x0123('0xa');this[_0x0123('0xb')]=_0x472e99[_0x0123('0xb')];this[_0x0123('0xc')]={};this[_0x0123('0xd')]=0x0;this['md5']='';this[_0x0123('0xe')]();this['updateRealtime']();}WhatsappQueue['prototype'][_0x0123('0xe')]=function(){var _0x342625=this['mapAgentsId'][_0x0123('0xf')];this['mapAgentsId']=_[_0x0123('0x10')](this[_0x0123('0xb')],'id');this[_0x0123('0xc')][_0x0123('0xf')]=_0x342625;};WhatsappQueue['prototype'][_0x0123('0x11')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x44a885=0x0;_0x44a885=0x0?this[_0x0123('0x17')]:0x0;var _0x4d44e0={'id':this['id'],'available':this[_0x0123('0x17')],'loggedIn':this[_0x0123('0x14')],'name':this['name'],'paused':this[_0x0123('0x16')],'waiting':this[_0x0123('0xd')]};var _0x870a66=md5(JSON['stringify'](_0x4d44e0));if(this['md5']!==_0x870a66){this[_0x0123('0x1')]=_0x870a66;io['to'](util['format'](_0x0123('0x18'),_0x4d44e0[_0x0123('0x8')]))['emit'](_0x0123('0x19'),_0x4d44e0);}};module[_0x0123('0x1a')]=WhatsappQueue; \ No newline at end of file +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 diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 9a3ce15..f92c726 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 _0xffc8=['initSmsQueues','initMailQueues','initFaxQueues','exports','bluebird','util','moment','../model/agent','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','agents','intervals','openchannelQueues','chatQueues','smsQueues','mailQueues','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','initAgents','length','isUndefined','mergeFromDatabase','updateRouting','updateRealtime','initChatQueues'];(function(_0x35f9b5,_0x133d57){var _0x5c5d7c=function(_0x9fbdcf){while(--_0x9fbdcf){_0x35f9b5['push'](_0x35f9b5['shift']());}};_0x5c5d7c(++_0x133d57);}(_0xffc8,0x1cb));var _0x8ffc=function(_0x48c0d8,_0x3279a4){_0x48c0d8=_0x48c0d8-0x0;var _0x16a2ed=_0xffc8[_0x48c0d8];return _0x16a2ed;};'use strict';var BPromise=require(_0x8ffc('0x0'));var util=require(_0x8ffc('0x1'));var _=require('lodash');var moment=require(_0x8ffc('0x2'));var Agent=require(_0x8ffc('0x3'));var Interval=require(_0x8ffc('0x4'));var OpenchannelQueue=require(_0x8ffc('0x5'));var ChatQueue=require(_0x8ffc('0x6'));var SmsQueue=require(_0x8ffc('0x7'));var MailQueue=require(_0x8ffc('0x8'));var FaxQueue=require('../model/faxQueue');var Realtime=function(){this[_0x8ffc('0x9')]={};this[_0x8ffc('0xa')]={};this[_0x8ffc('0xb')]={};this[_0x8ffc('0xc')]={};this[_0x8ffc('0xd')]={};this[_0x8ffc('0xe')]={};this[_0x8ffc('0xf')]={};this[_0x8ffc('0x10')]={};this[_0x8ffc('0x11')]={};this[_0x8ffc('0x12')]={};this[_0x8ffc('0x13')]={};this[_0x8ffc('0x14')]={};};function freeIsNotKey(_0x5bbe7f,_0x328dc2,_0x5a9315){var _0x2dde82=_[_0x8ffc('0x15')](_0x5bbe7f,function(_0x1dede7,_0x3c34ca){return _0x1dede7[_0x5a9315];});for(var _0x14a8ef in _0x328dc2){if(_0x328dc2[_0x8ffc('0x16')](_0x14a8ef)){if(!_0x2dde82[_0x14a8ef]){delete _0x328dc2[_0x14a8ef];}}}}Realtime[_0x8ffc('0x17')]['mergeFromDatabase']=function(_0x2a5da3,_0x396b55){for(var _0x182193 in _0x396b55){if(_0x2a5da3[_0x8ffc('0x16')](_0x182193)){_0x2a5da3[_0x182193]=_0x396b55[_0x182193];}}};Realtime[_0x8ffc('0x17')][_0x8ffc('0x18')]=function(){var _0x2e2c10=this;return function(_0x9d4d88){if(_0x9d4d88){freeIsNotKey(_0x9d4d88,_0x2e2c10['agents'],'id');for(var _0x447f69=0x0,_0x5c588d={},_0x37693c={};_0x447f69<_0x9d4d88[_0x8ffc('0x19')];_0x447f69+=0x1){_0x5c588d=_0x9d4d88[_0x447f69];if(_[_0x8ffc('0x1a')](_0x2e2c10[_0x8ffc('0x9')][_0x5c588d['id']])){_0x2e2c10['agents'][_0x5c588d['id']]=new Agent(_0x5c588d);}else{_0x2e2c10[_0x8ffc('0x1b')](_0x2e2c10[_0x8ffc('0x9')][_0x5c588d['id']],_0x5c588d);}}}return _0x2e2c10[_0x8ffc('0x9')];};};Realtime['prototype']['initIntervals']=function(){var _0x31a9c4=this;return function(_0x1131af){if(_0x1131af){freeIsNotKey(_0x1131af,_0x31a9c4['intervals'],'id');for(var _0x37dbe5=0x0,_0x30688c={},_0x49fc84={};_0x37dbe5<_0x1131af[_0x8ffc('0x19')];_0x37dbe5+=0x1){_0x30688c=_0x1131af[_0x37dbe5];if(_['isUndefined'](_0x31a9c4[_0x8ffc('0xa')][_0x30688c['id']])){_0x31a9c4['intervals'][_0x30688c['id']]=new Interval(_0x30688c);}else{_0x31a9c4[_0x8ffc('0x1b')](_0x31a9c4[_0x8ffc('0xa')][_0x30688c['id']],_0x30688c);}}}return _0x31a9c4[_0x8ffc('0xa')];};};Realtime[_0x8ffc('0x17')]['initOpenchannelQueues']=function(){var _0xc32b75=this;return function(_0x56d43f){if(_0x56d43f){freeIsNotKey(_0x56d43f,_0xc32b75[_0x8ffc('0xb')],'id');for(var _0x2deda1=0x0,_0x7fafd2={},_0x13da7f={};_0x2deda1<_0x56d43f[_0x8ffc('0x19')];_0x2deda1+=0x1){_0x7fafd2=_0x56d43f[_0x2deda1];if(_['isUndefined'](_0xc32b75[_0x8ffc('0xb')][_0x7fafd2['id']])){_0xc32b75[_0x8ffc('0xb')][_0x7fafd2['id']]=new OpenchannelQueue(_0x7fafd2);}else{_0xc32b75[_0x8ffc('0x1b')](_0xc32b75['openchannelQueues'][_0x7fafd2['id']],_0x7fafd2);}_0xc32b75['openchannelQueues'][_0x7fafd2['id']][_0x8ffc('0x1c')]();_0xc32b75[_0x8ffc('0xb')][_0x7fafd2['id']][_0x8ffc('0x1d')]();}}return _0xc32b75[_0x8ffc('0xb')];};};Realtime[_0x8ffc('0x17')][_0x8ffc('0x1e')]=function(){var _0x1ce5e0=this;return function(_0x833356){if(_0x833356){freeIsNotKey(_0x833356,_0x1ce5e0[_0x8ffc('0xc')],'id');for(var _0x10a811=0x0,_0x4c4db9={},_0x264905={};_0x10a811<_0x833356[_0x8ffc('0x19')];_0x10a811+=0x1){_0x4c4db9=_0x833356[_0x10a811];if(_[_0x8ffc('0x1a')](_0x1ce5e0[_0x8ffc('0xc')][_0x4c4db9['id']])){_0x1ce5e0[_0x8ffc('0xc')][_0x4c4db9['id']]=new ChatQueue(_0x4c4db9);}else{_0x1ce5e0[_0x8ffc('0x1b')](_0x1ce5e0[_0x8ffc('0xc')][_0x4c4db9['id']],_0x4c4db9);}_0x1ce5e0[_0x8ffc('0xc')][_0x4c4db9['id']]['updateRouting']();_0x1ce5e0[_0x8ffc('0xc')][_0x4c4db9['id']][_0x8ffc('0x1d')]();}}return _0x1ce5e0[_0x8ffc('0xc')];};};Realtime[_0x8ffc('0x17')][_0x8ffc('0x1f')]=function(){var _0x270237=this;return function(_0x593eb4){if(_0x593eb4){freeIsNotKey(_0x593eb4,_0x270237[_0x8ffc('0xd')],'id');for(var _0x599e34=0x0,_0x2eccea={},_0x48914c={};_0x599e34<_0x593eb4['length'];_0x599e34+=0x1){_0x2eccea=_0x593eb4[_0x599e34];if(_['isUndefined'](_0x270237[_0x8ffc('0xd')][_0x2eccea['id']])){_0x270237[_0x8ffc('0xd')][_0x2eccea['id']]=new SmsQueue(_0x2eccea);}else{_0x270237[_0x8ffc('0x1b')](_0x270237[_0x8ffc('0xd')][_0x2eccea['id']],_0x2eccea);}_0x270237[_0x8ffc('0xd')][_0x2eccea['id']][_0x8ffc('0x1c')]();_0x270237[_0x8ffc('0xd')][_0x2eccea['id']][_0x8ffc('0x1d')]();}}return _0x270237[_0x8ffc('0xd')];};};Realtime[_0x8ffc('0x17')][_0x8ffc('0x20')]=function(){var _0x3018d3=this;return function(_0x48fd02){if(_0x48fd02){freeIsNotKey(_0x48fd02,_0x3018d3[_0x8ffc('0xe')],'id');for(var _0x1fd396=0x0,_0xa5d4cd={},_0x405940={};_0x1fd396<_0x48fd02[_0x8ffc('0x19')];_0x1fd396+=0x1){_0xa5d4cd=_0x48fd02[_0x1fd396];if(_[_0x8ffc('0x1a')](_0x3018d3[_0x8ffc('0xe')][_0xa5d4cd['id']])){_0x3018d3[_0x8ffc('0xe')][_0xa5d4cd['id']]=new MailQueue(_0xa5d4cd);}else{_0x3018d3['mergeFromDatabase'](_0x3018d3[_0x8ffc('0xe')][_0xa5d4cd['id']],_0xa5d4cd);}_0x3018d3[_0x8ffc('0xe')][_0xa5d4cd['id']][_0x8ffc('0x1c')]();_0x3018d3[_0x8ffc('0xe')][_0xa5d4cd['id']]['updateRealtime']();}}return _0x3018d3[_0x8ffc('0xe')];};};Realtime[_0x8ffc('0x17')][_0x8ffc('0x21')]=function(){var _0x29cbfe=this;return function(_0x5a7f73){if(_0x5a7f73){freeIsNotKey(_0x5a7f73,_0x29cbfe[_0x8ffc('0xf')],'id');for(var _0x3bbcf8=0x0,_0xcf675e={},_0x3cef6d={};_0x3bbcf8<_0x5a7f73['length'];_0x3bbcf8+=0x1){_0xcf675e=_0x5a7f73[_0x3bbcf8];if(_['isUndefined'](_0x29cbfe['faxQueues'][_0xcf675e['id']])){_0x29cbfe[_0x8ffc('0xf')][_0xcf675e['id']]=new FaxQueue(_0xcf675e);}else{_0x29cbfe[_0x8ffc('0x1b')](_0x29cbfe[_0x8ffc('0xf')][_0xcf675e['id']],_0xcf675e);}_0x29cbfe[_0x8ffc('0xf')][_0xcf675e['id']][_0x8ffc('0x1c')]();_0x29cbfe['faxQueues'][_0xcf675e['id']][_0x8ffc('0x1d')]();}}return _0x29cbfe[_0x8ffc('0xf')];};};module[_0x8ffc('0x22')]=Realtime; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 1e0ffa1..7f22d27 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 _0x6314=['updateChatInteraction','addTags','addTagsToChatInteraction','update','UpdateChatInteraction'];(function(_0x5d0442,_0x1c2851){var _0x2911da=function(_0x45162){while(--_0x45162){_0x5d0442['push'](_0x5d0442['shift']());}};_0x2911da(++_0x1c2851);}(_0x6314,0xa3));var _0x4631=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x6314[_0x49ca18];return _0x145d54;};'use strict';var client=require('../client');exports[_0x4631('0x0')]=function(_0x242a6c,_0x50de40){return client['Request'](_0x4631('0x1'),{'body':_0x50de40,'options':{'where':{'id':_0x242a6c}},'log':_0x4631('0x2')});};exports[_0x4631('0x3')]=function(_0x235e84,_0x4c1e7d){return client['Request']('AddTagsToChatInteraction',{'body':_0x4c1e7d,'options':{'where':{'id':_0x235e84}},'log':_0x4631('0x4')});}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 45203e7..e9729ba 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 _0x8713=['Request','CreateChatMessage','createChatMessage','../client','create'];(function(_0x1b4b54,_0x41a52c){var _0x34d18b=function(_0x3f460f){while(--_0x3f460f){_0x1b4b54['push'](_0x1b4b54['shift']());}};_0x34d18b(++_0x41a52c);}(_0x8713,0x166));var _0x3871=function(_0x58726b,_0x4eb661){_0x58726b=_0x58726b-0x0;var _0x5eb6e5=_0x8713[_0x58726b];return _0x5eb6e5;};'use strict';var client=require(_0x3871('0x0'));exports[_0x3871('0x1')]=function(_0x68541){return client[_0x3871('0x2')](_0x3871('0x3'),{'body':_0x68541,'log':_0x3871('0x4')});}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 628fa55..fd1380d 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 _0xc204=['chatPause','../client','getChatQueues','Request','name','timeout','strategy','User','online'];(function(_0xe5246f,_0x1f9b54){var _0x5a9887=function(_0x576c95){while(--_0x576c95){_0xe5246f['push'](_0xe5246f['shift']());}};_0x5a9887(++_0x1f9b54);}(_0xc204,0x1a8));var _0x4c20=function(_0x7d4229,_0x1dc294){_0x7d4229=_0x7d4229-0x0;var _0x20174b=_0xc204[_0x7d4229];return _0x20174b;};'use strict';var client=require(_0x4c20('0x0'));exports[_0x4c20('0x1')]=function(){return function(){return client[_0x4c20('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x4c20('0x3'),_0x4c20('0x4'),_0x4c20('0x5')],'include':[{'model':_0x4c20('0x6'),'as':'Agents','attributes':['id',_0x4c20('0x3'),_0x4c20('0x7'),_0x4c20('0x8')]}]},'log':_0x4c20('0x1')});};}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index add86ec..29b1072 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 _0x24cd=['create','Request','CreateChatQueueReport','update','UpdateChatQueueReport','../client'];(function(_0x373b82,_0xc66d54){var _0x3e134b=function(_0x197179){while(--_0x197179){_0x373b82['push'](_0x373b82['shift']());}};_0x3e134b(++_0xc66d54);}(_0x24cd,0x83));var _0xd24c=function(_0x8f06e3,_0x5aba4b){_0x8f06e3=_0x8f06e3-0x0;var _0x37d199=_0x24cd[_0x8f06e3];return _0x37d199;};'use strict';var client=require(_0xd24c('0x0'));exports[_0xd24c('0x1')]=function(_0x4dc270){return client[_0xd24c('0x2')]('CreateChatQueueReport',{'body':_0x4dc270,'log':_0xd24c('0x3')});};exports[_0xd24c('0x4')]=function(_0x3bd534,_0x4d515c){return client[_0xd24c('0x2')](_0xd24c('0x5'),{'body':_0x4d515c,'options':{'where':{'uniqueid':_0x3bd534},'order':[['id','DESC']],'limit':0x1},'log':_0xd24c('0x5')});}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 6dfdedb..0009ee3 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 _0xe897=['addTags','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','Request','UpdateFaxInteraction','updateFaxInteraction'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xe897,0xf3));var _0x7e89=function(_0x179194,_0x8fca3){_0x179194=_0x179194-0x0;var _0x1b3ac7=_0xe897[_0x179194];return _0x1b3ac7;};'use strict';var client=require(_0x7e89('0x0'));exports[_0x7e89('0x1')]=function(_0x5b9206,_0x3af31e){return client[_0x7e89('0x2')](_0x7e89('0x3'),{'body':_0x3af31e,'options':{'where':{'id':_0x5b9206}},'log':_0x7e89('0x4')});};exports[_0x7e89('0x5')]=function(_0x25b555,_0x306881){return client[_0x7e89('0x2')](_0x7e89('0x6'),{'body':_0x306881,'options':{'where':{'id':_0x25b555}},'log':_0x7e89('0x7')});}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 84a4811..30951ed 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 _0xceff=['../client','create','CreateFaxMessage','createFaxMessage'];(function(_0x25a289,_0x26d759){var _0x537e03=function(_0xc58e61){while(--_0xc58e61){_0x25a289['push'](_0x25a289['shift']());}};_0x537e03(++_0x26d759);}(_0xceff,0xa8));var _0xfcef=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xceff[_0x565c49];return _0x20ca34;};'use strict';var client=require(_0xfcef('0x0'));exports[_0xfcef('0x1')]=function(_0x5ac255){return client['Request'](_0xfcef('0x2'),{'body':_0x5ac255,'log':_0xfcef('0x3')});}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 2c7fde5..844135a 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 _0x051d=['Request','GetFaxQueue','timeout','User','name','online','faxPause','../client','getFaxQueues'];(function(_0x2d9c6a,_0x59393d){var _0xf3c918=function(_0x4f3f26){while(--_0x4f3f26){_0x2d9c6a['push'](_0x2d9c6a['shift']());}};_0xf3c918(++_0x59393d);}(_0x051d,0x142));var _0xd051=function(_0x7577b9,_0x4fe21c){_0x7577b9=_0x7577b9-0x0;var _0x2660c8=_0x051d[_0x7577b9];return _0x2660c8;};'use strict';var client=require(_0xd051('0x0'));exports[_0xd051('0x1')]=function(){return function(){return client[_0xd051('0x2')](_0xd051('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xd051('0x4'),'strategy'],'include':[{'model':_0xd051('0x5'),'as':'Agents','attributes':['id',_0xd051('0x6'),_0xd051('0x7'),_0xd051('0x8')]}]},'log':_0xd051('0x1')});};}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 586e591..2c43110 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 _0xe157=['DESC','../client','create','Request','UpdateFaxQueueReport'];(function(_0x14ca06,_0x5de1fa){var _0x499bfd=function(_0x1b2122){while(--_0x1b2122){_0x14ca06['push'](_0x14ca06['shift']());}};_0x499bfd(++_0x5de1fa);}(_0xe157,0x13c));var _0x7e15=function(_0x5040e3,_0x2b99ac){_0x5040e3=_0x5040e3-0x0;var _0x11f1ae=_0xe157[_0x5040e3];return _0x11f1ae;};'use strict';var client=require(_0x7e15('0x0'));exports[_0x7e15('0x1')]=function(_0x3ac266){return client[_0x7e15('0x2')]('CreateFaxQueueReport',{'body':_0x3ac266,'log':'CreateFaxQueueReport'});};exports['update']=function(_0x187c71,_0x1d57f0){return client[_0x7e15('0x2')](_0x7e15('0x3'),{'body':_0x1d57f0,'options':{'where':{'uniqueid':_0x187c71},'order':[['id',_0x7e15('0x4')]],'limit':0x1},'log':_0x7e15('0x3')});}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index d508afe..6f35bc8 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 _0x0972=['getIntervals','GetInterval','Interval','Intervals','interval'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x0972,0x64));var _0x2097=function(_0x34363c,_0xf937e6){_0x34363c=_0x34363c-0x0;var _0x396f7e=_0x0972[_0x34363c];return _0x396f7e;};'use strict';var client=require('../client');exports[_0x2097('0x0')]=function(){return function(){return client['Request'](_0x2097('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x2097('0x2'),'as':_0x2097('0x3'),'attributes':['id','name',_0x2097('0x4')]}]},'log':_0x2097('0x0')});};}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 1f23582..c88e2fb 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 _0x1012=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','UpdateMailInteraction','updateMailInteraction','Request'];(function(_0x35128d,_0x97dfc3){var _0x20adf7=function(_0x30010e){while(--_0x30010e){_0x35128d['push'](_0x35128d['shift']());}};_0x20adf7(++_0x97dfc3);}(_0x1012,0xfe));var _0x2101=function(_0x71e493,_0x4308b7){_0x71e493=_0x71e493-0x0;var _0x3d40ab=_0x1012[_0x71e493];return _0x3d40ab;};'use strict';var client=require(_0x2101('0x0'));exports['update']=function(_0x18678c,_0x27c9e0){return client['Request'](_0x2101('0x1'),{'body':_0x27c9e0,'options':{'where':{'id':_0x18678c}},'log':_0x2101('0x2')});};exports['addTags']=function(_0x515700,_0x26695f){return client[_0x2101('0x3')](_0x2101('0x4'),{'body':_0x26695f,'options':{'where':{'id':_0x515700}},'log':_0x2101('0x5')});}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index e6002e1..a6801b1 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 _0xe3d6=['create','Request','CreateMailMessage','../client'];(function(_0x50fb34,_0x56b847){var _0x478797=function(_0x2a45df){while(--_0x2a45df){_0x50fb34['push'](_0x50fb34['shift']());}};_0x478797(++_0x56b847);}(_0xe3d6,0xdf));var _0x6e3d=function(_0x5ef28e,_0x86eea9){_0x5ef28e=_0x5ef28e-0x0;var _0x19c86e=_0xe3d6[_0x5ef28e];return _0x19c86e;};'use strict';var client=require(_0x6e3d('0x0'));exports[_0x6e3d('0x1')]=function(_0x7b0ff5){return client[_0x6e3d('0x2')](_0x6e3d('0x3'),{'body':_0x7b0ff5,'log':'createMailMessage'});}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index b167934..2c4341d 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 _0x9e7b=['mailPause','../client','getMailQueues','Request','GetMailQueue','name','strategy','User','Agents','online'];(function(_0x33d59e,_0xcbe0e3){var _0x465442=function(_0x225071){while(--_0x225071){_0x33d59e['push'](_0x33d59e['shift']());}};_0x465442(++_0xcbe0e3);}(_0x9e7b,0x1c3));var _0xb9e7=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x9e7b[_0x411017];return _0x2adeea;};'use strict';var client=require(_0xb9e7('0x0'));exports[_0xb9e7('0x1')]=function(){return function(){return client[_0xb9e7('0x2')](_0xb9e7('0x3'),{'options':{'raw':![],'attributes':['id',_0xb9e7('0x4'),'timeout',_0xb9e7('0x5')],'include':[{'model':_0xb9e7('0x6'),'as':_0xb9e7('0x7'),'attributes':['id','name',_0xb9e7('0x8'),_0xb9e7('0x9')]}]},'log':_0xb9e7('0x1')});};}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index a4b2cfc..79f4359 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 _0xcc3e=['CreateMailQueueReport','update','UpdateMailQueueReport','../client','Request'];(function(_0x47f249,_0x1f8a43){var _0x3c84ae=function(_0x264a33){while(--_0x264a33){_0x47f249['push'](_0x47f249['shift']());}};_0x3c84ae(++_0x1f8a43);}(_0xcc3e,0x94));var _0xecc3=function(_0x13c33e,_0x5a4e52){_0x13c33e=_0x13c33e-0x0;var _0x3b10df=_0xcc3e[_0x13c33e];return _0x3b10df;};'use strict';var client=require(_0xecc3('0x0'));exports['create']=function(_0x521cef){return client[_0xecc3('0x1')](_0xecc3('0x2'),{'body':_0x521cef,'log':_0xecc3('0x2')});};exports[_0xecc3('0x3')]=function(_0x382930,_0x2c3383){return client[_0xecc3('0x1')]('UpdateMailQueueReport',{'body':_0x2c3383,'options':{'where':{'uniqueid':_0x382930},'order':[['id','DESC']],'limit':0x1},'log':_0xecc3('0x4')});}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 3b1db7a..815fd0f 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 _0x43ce=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','update'];(function(_0x21a7db,_0x4758f6){var _0x374985=function(_0x137294){while(--_0x137294){_0x21a7db['push'](_0x21a7db['shift']());}};_0x374985(++_0x4758f6);}(_0x43ce,0x143));var _0xe43c=function(_0x2f6941,_0x3df8a8){_0x2f6941=_0x2f6941-0x0;var _0x30295b=_0x43ce[_0x2f6941];return _0x30295b;};'use strict';var client=require('../client');exports[_0xe43c('0x0')]=function(_0x436bac,_0x10db4f){return client[_0xe43c('0x1')](_0xe43c('0x2'),{'body':_0x10db4f,'options':{'where':{'id':_0x436bac}},'log':_0xe43c('0x3')});};exports[_0xe43c('0x4')]=function(_0x5a1230,_0x40c2ad){return client[_0xe43c('0x1')](_0xe43c('0x5'),{'body':_0x40c2ad,'options':{'where':{'id':_0x5a1230}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index a989d4c..3374b61 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 _0x153f=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0x1cfe2e,_0x1ebbcd){var _0x39233f=function(_0x48831a){while(--_0x48831a){_0x1cfe2e['push'](_0x1cfe2e['shift']());}};_0x39233f(++_0x1ebbcd);}(_0x153f,0x15b));var _0xf153=function(_0x37a47d,_0x122547){_0x37a47d=_0x37a47d-0x0;var _0x200f91=_0x153f[_0x37a47d];return _0x200f91;};'use strict';var client=require(_0xf153('0x0'));exports[_0xf153('0x1')]=function(_0xde7eae){return client[_0xf153('0x2')](_0xf153('0x3'),{'body':_0xde7eae,'log':_0xf153('0x4')});}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index ead0811..5541f53 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 _0xc4f2=['online','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','User','Agents'];(function(_0xeaa3f6,_0x56b574){var _0x592ec6=function(_0x97dfe){while(--_0x97dfe){_0xeaa3f6['push'](_0xeaa3f6['shift']());}};_0x592ec6(++_0x56b574);}(_0xc4f2,0xf1));var _0x2c4f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4f2[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x2c4f('0x0'));exports[_0x2c4f('0x1')]=function(){return function(){return client[_0x2c4f('0x2')](_0x2c4f('0x3'),{'options':{'raw':![],'attributes':['id',_0x2c4f('0x4'),_0x2c4f('0x5'),_0x2c4f('0x6')],'include':[{'model':_0x2c4f('0x7'),'as':_0x2c4f('0x8'),'attributes':['id',_0x2c4f('0x4'),_0x2c4f('0x9'),'openchannelPause']}]},'log':_0x2c4f('0x1')});};}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 4652bfc..ba69cd5 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 _0xb7a4=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0x2c04e2,_0x4d88cb){var _0x5788c0=function(_0x4aff0a){while(--_0x4aff0a){_0x2c04e2['push'](_0x2c04e2['shift']());}};_0x5788c0(++_0x4d88cb);}(_0xb7a4,0x18d));var _0x4b7a=function(_0x2a8824,_0x2cb462){_0x2a8824=_0x2a8824-0x0;var _0x7db456=_0xb7a4[_0x2a8824];return _0x7db456;};'use strict';var client=require(_0x4b7a('0x0'));exports[_0x4b7a('0x1')]=function(_0xf3dc6a){return client[_0x4b7a('0x2')](_0x4b7a('0x3'),{'body':_0xf3dc6a,'log':_0x4b7a('0x3')});};exports[_0x4b7a('0x4')]=function(_0x1589e2,_0xe8f86e){return client[_0x4b7a('0x2')](_0x4b7a('0x5'),{'body':_0xe8f86e,'options':{'where':{'uniqueid':_0x1589e2},'order':[['id',_0x4b7a('0x6')]],'limit':0x1},'log':_0x4b7a('0x5')});}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index b4bf8f9..b9b3d27 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 _0x59fe=['addTags','Request','AddTagsToSmsInteraction','addTagsToSmsInteraction','update','updateSmsInteraction'];(function(_0x3afbe5,_0x34270e){var _0x5a2c00=function(_0x416e77){while(--_0x416e77){_0x3afbe5['push'](_0x3afbe5['shift']());}};_0x5a2c00(++_0x34270e);}(_0x59fe,0x178));var _0xe59f=function(_0x1a5407,_0x83ae11){_0x1a5407=_0x1a5407-0x0;var _0x2427f5=_0x59fe[_0x1a5407];return _0x2427f5;};'use strict';var client=require('../client');exports[_0xe59f('0x0')]=function(_0x7522cc,_0x253ed1){return client['Request']('UpdateSmsInteraction',{'body':_0x253ed1,'options':{'where':{'id':_0x7522cc}},'log':_0xe59f('0x1')});};exports[_0xe59f('0x2')]=function(_0x33717b,_0x599ed6){return client[_0xe59f('0x3')](_0xe59f('0x4'),{'body':_0x599ed6,'options':{'where':{'id':_0x33717b}},'log':_0xe59f('0x5')});}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index f17865d..41062f8 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 _0xa3c4=['../client','Request','CreateSmsMessage','createSmsMessage'];(function(_0x36de16,_0x5ac25a){var _0x51db30=function(_0x1076d0){while(--_0x1076d0){_0x36de16['push'](_0x36de16['shift']());}};_0x51db30(++_0x5ac25a);}(_0xa3c4,0x114));var _0x4a3c=function(_0x709533,_0x2cf59e){_0x709533=_0x709533-0x0;var _0x3a8a26=_0xa3c4[_0x709533];return _0x3a8a26;};'use strict';var client=require(_0x4a3c('0x0'));exports['create']=function(_0x373e16){return client[_0x4a3c('0x1')](_0x4a3c('0x2'),{'body':_0x373e16,'log':_0x4a3c('0x3')});}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 68d4aa0..9611bc0 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 _0xb2b6=['name','online','smsPause','../client','Request','GetSmsQueue','timeout','strategy','User','Agents'];(function(_0x1a4b0b,_0x1f630e){var _0x198cb9=function(_0x19348e){while(--_0x19348e){_0x1a4b0b['push'](_0x1a4b0b['shift']());}};_0x198cb9(++_0x1f630e);}(_0xb2b6,0x1bb));var _0x6b2b=function(_0x24eab2,_0x426934){_0x24eab2=_0x24eab2-0x0;var _0x2c8d17=_0xb2b6[_0x24eab2];return _0x2c8d17;};'use strict';var client=require(_0x6b2b('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x6b2b('0x1')](_0x6b2b('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x6b2b('0x3'),_0x6b2b('0x4')],'include':[{'model':_0x6b2b('0x5'),'as':_0x6b2b('0x6'),'attributes':['id',_0x6b2b('0x7'),_0x6b2b('0x8'),_0x6b2b('0x9')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 1bf938c..a3f9dc5 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 _0x1573=['DESC','../client','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x24193b,_0x4a959c){var _0x428b2d=function(_0x566d29){while(--_0x566d29){_0x24193b['push'](_0x24193b['shift']());}};_0x428b2d(++_0x4a959c);}(_0x1573,0x193));var _0x3157=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x1573[_0x11c573];return _0x6b72de;};'use strict';var client=require(_0x3157('0x0'));exports['create']=function(_0x4ce143){return client[_0x3157('0x1')](_0x3157('0x2'),{'body':_0x4ce143,'log':_0x3157('0x2')});};exports[_0x3157('0x3')]=function(_0x25f925,_0x279839){return client[_0x3157('0x1')](_0x3157('0x4'),{'body':_0x279839,'options':{'where':{'uniqueid':_0x25f925},'order':[['id',_0x3157('0x5')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index f2f5c88..195256d 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 _0xa056=['faxCapacity','smsCapacity','openchannelCapacity','../client','getAgents','GetUser','pauseType','lastPauseAt','chatPause','smsPause','openchannelPause','chatCapacity','mailCapacity'];(function(_0x5a6bd2,_0x447fe7){var _0xdc89b9=function(_0x198c8b){while(--_0x198c8b){_0x5a6bd2['push'](_0x5a6bd2['shift']());}};_0xdc89b9(++_0x447fe7);}(_0xa056,0x196));var _0x6a05=function(_0x2997da,_0x35e1a6){_0x2997da=_0x2997da-0x0;var _0x43f745=_0xa056[_0x2997da];return _0x43f745;};'use strict';var client=require(_0x6a05('0x0'));exports[_0x6a05('0x1')]=function(){return function(){return client['Request'](_0x6a05('0x2'),{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id','name','online',_0x6a05('0x3'),_0x6a05('0x4'),'voicePause',_0x6a05('0x5'),'mailPause','faxPause',_0x6a05('0x6'),_0x6a05('0x7'),_0x6a05('0x8'),_0x6a05('0x9'),_0x6a05('0xa'),_0x6a05('0xb'),_0x6a05('0xc')]},'log':_0x6a05('0x1')});};}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 4f81988..24db022 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 _0x280f=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags'];(function(_0x4d86d1,_0x469cfd){var _0x2f8462=function(_0x3097ef){while(--_0x3097ef){_0x4d86d1['push'](_0x4d86d1['shift']());}};_0x2f8462(++_0x469cfd);}(_0x280f,0xe2));var _0xf280=function(_0x41b0a8,_0x1b05cc){_0x41b0a8=_0x41b0a8-0x0;var _0x3a83d4=_0x280f[_0x41b0a8];return _0x3a83d4;};'use strict';var client=require(_0xf280('0x0'));exports['update']=function(_0x412811,_0x125275){return client[_0xf280('0x1')](_0xf280('0x2'),{'body':_0x125275,'options':{'where':{'id':_0x412811}},'log':_0xf280('0x3')});};exports[_0xf280('0x4')]=function(_0xffc0f1,_0x4fe5b5){return client[_0xf280('0x1')](_0xf280('0x5'),{'body':_0x4fe5b5,'options':{'where':{'id':_0xffc0f1}},'log':_0xf280('0x6')});}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 8c93fc1..b242597 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 _0x9ccf=['create','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x2d2d40,_0x2cdce7){var _0x42dd02=function(_0x3abdfd){while(--_0x3abdfd){_0x2d2d40['push'](_0x2d2d40['shift']());}};_0x42dd02(++_0x2cdce7);}(_0x9ccf,0x1b4));var _0xf9cc=function(_0x53a548,_0x2c874b){_0x53a548=_0x53a548-0x0;var _0x28e2ed=_0x9ccf[_0x53a548];return _0x28e2ed;};'use strict';var client=require('../client');exports[_0xf9cc('0x0')]=function(_0x35aa54){return client[_0xf9cc('0x1')](_0xf9cc('0x2'),{'body':_0x35aa54,'log':_0xf9cc('0x3')});}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 6531e8f..71878cf 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 _0xe706=['Agents','online','whatsappPause','../client','getWhatsappQueues','Request','name','timeout','strategy','User'];(function(_0x435885,_0x1a3d38){var _0x5c6028=function(_0x19997f){while(--_0x19997f){_0x435885['push'](_0x435885['shift']());}};_0x5c6028(++_0x1a3d38);}(_0xe706,0xa3));var _0x6e70=function(_0x216327,_0x5482e3){_0x216327=_0x216327-0x0;var _0x4f152b=_0xe706[_0x216327];return _0x4f152b;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 37c9175..590ff76 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 _0x1110=['UpdateWhatsappQueueReport','../client','CreateWhatsappQueueReport','update'];(function(_0x2a3a18,_0x438fbf){var _0x5620f5=function(_0x3df409){while(--_0x3df409){_0x2a3a18['push'](_0x2a3a18['shift']());}};_0x5620f5(++_0x438fbf);}(_0x1110,0x159));var _0x0111=function(_0x993f24,_0x227b78){_0x993f24=_0x993f24-0x0;var _0x3064db=_0x1110[_0x993f24];return _0x3064db;};'use strict';var client=require(_0x0111('0x0'));exports['create']=function(_0x179d45){return client['Request'](_0x0111('0x1'),{'body':_0x179d45,'log':_0x0111('0x1')});};exports[_0x0111('0x2')]=function(_0x411bb8,_0x5929f5){return client['Request'](_0x0111('0x3'),{'body':_0x5929f5,'options':{'where':{'uniqueid':_0x411bb8},'order':[['id','DESC']],'limit':0x1},'log':_0x0111('0x3')});}; \ No newline at end of file +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 diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index f53c02c..c46bf98 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 _0x859b=['[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','error','[%s][AGENT]\x20%s','map','message','join','stop','agents','timeout','atimeout','channel','format','START:%s','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log'];(function(_0x574617,_0x42eccc){var _0x29de90=function(_0x367aff){while(--_0x367aff){_0x574617['push'](_0x574617['shift']());}};_0x29de90(++_0x42eccc);}(_0x859b,0x6e));var _0xb859=function(_0x4f9e22,_0x5d153a){_0x4f9e22=_0x4f9e22-0x0;var _0x331cff=_0x859b[_0x4f9e22];return _0x331cff;};'use strict';var schema=require(_0xb859('0x0'));var _=require(_0xb859('0x1'));var util=require(_0xb859('0x2'));var seqqueue=require(_0xb859('0x3'));var logger=require('../../../../config/logger')('routing');var strategy=require('./strategy');var queue=schema({'name':{'type':_0xb859('0x4'),'required':!![],'message':_0xb859('0x5')},'timeout':{'type':'number','message':_0xb859('0x6')}});function writeLog(_0x5ec012,_0x76041e,_0x4d1d63){return logger['info'](util['format'](_0xb859('0x7'),_0x5ec012,_0x76041e[_0xb859('0x8')],_0x4d1d63));}function handleFindAgent(_0xf81f57){return function(_0x2e49b6){return _0x2e49b6[_0xb859('0x8')][_0xb859('0x9')]()===_0xf81f57[_0xb859('0x9')]();};}exports['consequence']=function(_0x90084b,_0x57ef37,_0x319c54,_0x299969){return function(_0x1e480e){try{var _0x2be885={'name':_0x57ef37[0x0],'timeout':_0x57ef37[0x1]};var _0x375cdd=queue[_0xb859('0x0')](_0x2be885,{'typecast':!![]});if(_0x375cdd[_0xb859('0xa')]){logger[_0xb859('0xb')](_0xb859('0xc'),_0x90084b,_[_0xb859('0xd')](_0x375cdd,_0xb859('0xe'))[_0xb859('0xf')](',\x20'));_0x1e480e[_0xb859('0x10')]();}else{var _0x3a7815=_['find'](_0x319c54[_0xb859('0x11')],handleFindAgent(_0x2be885[_0xb859('0x8')]));if(_0x3a7815){var _0x55a64d=(_0x2be885[_0xb859('0x12')]||0xa)*0x3e8;var _0x32922b,_0x421705;var _0xb9ddc=seqqueue['createQueue'](_0x55a64d);_0xb9ddc['id']=_0x90084b;_0xb9ddc[_0xb859('0x13')]=_0x55a64d;_0xb9ddc[_0xb859('0x14')]=_0x299969[_0xb859('0x14')];writeLog(_0x90084b,_0x3a7815,util[_0xb859('0x15')](_0xb859('0x16'),_0x55a64d));_0x319c54[_0xb859('0x17')][_0x90084b]['on'](_0xb859('0x18'),function(){logger[_0xb859('0x19')](_0xb859('0x1a'),_0x90084b);clearTimeout(_0x421705);_0x421705=undefined;_0xb9ddc[_0xb859('0x1b')]();if(_0x319c54[_0xb859('0x17')][_0x90084b]){delete _0x319c54[_0xb859('0x17')][_0x90084b];}_0x1e480e[_0xb859('0x10')]();});_0x319c54[_0xb859('0x17')][_0x90084b]['on'](_0xb859('0x1c'),function(){if(_0x319c54['rules'][_0x90084b]){delete _0x319c54['rules'][_0x90084b];}});_0x421705=setTimeout(function(){logger[_0xb859('0x19')](_0xb859('0x1d'),_0x90084b);clearTimeout(_0x421705);_0xb9ddc['close']();_0x1e480e[_0xb859('0x1e')]();},_0x55a64d);strategy[_0xb859('0x1f')](_0xb9ddc,_0x3a7815,_0x319c54,_0x299969);}else{logger[_0xb859('0xb')](_0xb859('0x20'),_0x90084b,_0x2be885[_0xb859('0x8')]);_0x1e480e[_0xb859('0x10')]();}}}catch(_0x3c17e4){console[_0xb859('0x21')](_0x3c17e4);logger[_0xb859('0xb')](_0xb859('0x22'),_0x90084b,_0x3c17e4[_0xb859('0x23')]);_0x1e480e[_0xb859('0x10')]();}};}; \ No newline at end of file +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 diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 6dbb8e8..ea03da9 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 _0x2e56=['[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','toString','error','message','next','amazonlex','then','dialogState','Failed','stop','stringify','moment','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','chat','account','upperFirst','AccountId','isEmpty','body','getMustacheRender','create','catch','[%s][AMAZONLEX]\x20%s','finally'];(function(_0x2a06e4,_0x5210cb){var _0x295c01=function(_0x1ab44f){while(--_0x1ab44f){_0x2a06e4['push'](_0x2a06e4['shift']());}};_0x295c01(++_0x5210cb);}(_0x2e56,0x188));var _0x62e5=function(_0x3b4b1d,_0x15029e){_0x3b4b1d=_0x3b4b1d-0x0;var _0x488c36=_0x2e56[_0x3b4b1d];return _0x488c36;};'use strict';var _=require('lodash');var moment=require(_0x62e5('0x0'));var AWS=require('aws-sdk');var utils=require('./utils');var logger=require(_0x62e5('0x1'))('routing');var rpc={'chatMessage':require(_0x62e5('0x2')),'openchannelMessage':require(_0x62e5('0x3')),'mailMessage':require(_0x62e5('0x4')),'smsMessage':require(_0x62e5('0x5')),'faxMessage':require(_0x62e5('0x6'))};exports[_0x62e5('0x7')]=function(_0x17d86c,_0x25ba86){return function(_0xab7401){try{if(!_[_0x62e5('0x8')](this[_0x62e5('0x9')][_0x62e5('0xa')])){logger[_0x62e5('0xb')]('[%s][AMAZONLEX]\x20%s',_0x17d86c,_0x62e5('0xc'));return _0xab7401['next']();}var _0x207e73={'ContactId':this['contact']['id'],'sentAt':moment()[_0x62e5('0xd')](_0x62e5('0xe')),'direction':_0x62e5('0xf')};var _0x1de460=this[_0x62e5('0x10')];if(_0x1de460===_0x62e5('0x11')){_0x207e73['ChatWebsiteId']=this[_0x62e5('0x12')]['id'];}else{_0x207e73[_[_0x62e5('0x13')](_0x1de460)+_0x62e5('0x14')]=this[_0x62e5('0x12')]['id'];}_0x207e73[_[_0x62e5('0x13')](_0x1de460)+'InteractionId']=this[_0x62e5('0x9')]['id'];if(this[_0x62e5('0x9')]['created']){var _0x765381=_0x25ba86[0x4];if(!_[_0x62e5('0x15')](_0x765381)){_0x207e73[_0x62e5('0x16')]=utils[_0x62e5('0x17')](_0x765381,this);return rpc[_0x1de460+'Message'][_0x62e5('0x18')](_0x207e73)['then'](function(_0x28b6ef){logger[_0x62e5('0xb')]('[%s][AMAZONLEX]\x20%s',_0x17d86c,_0x207e73[_0x62e5('0x16')]);})[_0x62e5('0x19')](function(_0x46e10f){logger['error'](_0x62e5('0x1a'),_0x17d86c,JSON['stringify'](_0x46e10f));})[_0x62e5('0x1b')](function(){logger[_0x62e5('0xb')](_0x62e5('0x1c'),_0x17d86c);_0xab7401['stop']();});}else{logger[_0x62e5('0xb')](_0x62e5('0x1d'),_0x17d86c);_0xab7401['stop']();}}else{var _0x406825=this;var _0x59faf8=new AWS[(_0x62e5('0x1e'))]({'accessKeyId':_0x25ba86[0x0],'secretAccessKey':_0x25ba86[0x1],'region':_0x25ba86[0x2]});var _0x36b8ea={'botAlias':_0x62e5('0x1f'),'botName':_0x25ba86[0x3],'inputText':this['message'][_0x62e5('0x16')],'userId':this['interaction']['id'][_0x62e5('0x20')]()};_0x59faf8['postText'](_0x36b8ea,function(_0x290c4b,_0x20cd49){if(_0x290c4b){logger[_0x62e5('0x21')](_0x62e5('0x1a'),_0x17d86c,_0x290c4b[_0x62e5('0x22')]);_0xab7401[_0x62e5('0x23')]();}else if(_0x20cd49&&_0x20cd49[_0x62e5('0x22')]){_0x406825[_0x62e5('0x16')][_0x62e5('0x24')]=_0x20cd49;_0x207e73[_0x62e5('0x16')]=_0x20cd49[_0x62e5('0x22')];return rpc[_0x1de460+'Message'][_0x62e5('0x18')](_0x207e73)[_0x62e5('0x25')](function(_0x19f9ec){logger['info']('[%s][AMAZONLEX]\x20%s',_0x17d86c,_0x207e73[_0x62e5('0x16')]);if(_0x20cd49[_0x62e5('0x26')]==_0x62e5('0x27')){_0xab7401[_0x62e5('0x23')]();}else{_0xab7401[_0x62e5('0x28')]();}})[_0x62e5('0x19')](function(_0x489664){logger[_0x62e5('0x21')](_0x62e5('0x1a'),_0x17d86c,JSON[_0x62e5('0x29')](_0x489664));_0xab7401[_0x62e5('0x23')]();});}else{_0xab7401[_0x62e5('0x23')]();}});}}catch(_0x344e71){logger[_0x62e5('0x21')](_0x62e5('0x1a'),_0x17d86c,JSON['stringify'](_0x344e71));_0xab7401['stop']();}};}; \ No newline at end of file +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 diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index bea4eac..3b47bde 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 _0xe706=['next','channel','getMustacheRender','YYYY-MM-DD\x20HH:mm:ss','out','message','from','read','subject','Re:','Re:\x20','chat','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','Message','Smtp','service','host','port','secure','auth','user','pass','inReplyTo','messageId','html','','replace','body','';return mailRpc[_0x6e70('0x33')](_0x228350,_0x37b3e0)['then'](function(_0x259486){logger['info'](_0x6e70('0x34'),_0x1b0389);_0x37b3e0[_0x6e70('0x2c')]=_0x259486[_0x6e70('0x16')]['messageId'];return rpc[_0x743eb5+_0x6e70('0x22')][_0x6e70('0x35')](_0x37b3e0);})['then'](function(_0x13d673){logger[_0x6e70('0xe')]('[%s][AUTOREPLY]\x20%s',_0x1b0389,JSON[_0x6e70('0x36')](_0x13d673));})[_0x6e70('0x37')](function(_0x2d52bd){logger[_0x6e70('0x38')](_0x6e70('0x39'),_0x1b0389,JSON[_0x6e70('0x36')](_0x2d52bd));})[_0x6e70('0x3a')](function(){_0x36357b[_0x6e70('0x11')]();});}else{return rpc[this[_0x6e70('0x12')]+_0x6e70('0x22')]['create'](_0x37b3e0)[_0x6e70('0x3b')](function(_0x4795a0){logger[_0x6e70('0xe')](_0x6e70('0xf'),_0x1b0389,_0x37b3e0[_0x6e70('0x30')]);})[_0x6e70('0x37')](function(_0x233a83){logger[_0x6e70('0x38')](_0x6e70('0xf'),_0x1b0389,JSON[_0x6e70('0x36')](_0x233a83));})[_0x6e70('0x3a')](function(){_0x36357b[_0x6e70('0x11')]();});}}}catch(_0x2a5444){logger[_0x6e70('0x38')](_0x6e70('0xf'),_0x1b0389,JSON['stringify'](_0x2a5444));_0x36357b['stop']();}};}; \ No newline at end of file +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 diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 88c36e3..8c56784 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x119c=['[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stop','stringify','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','consequence'];(function(_0x272bde,_0x4c190d){var _0x22bd40=function(_0x5d4d44){while(--_0x5d4d44){_0x272bde['push'](_0x272bde['shift']());}};_0x22bd40(++_0x4c190d);}(_0x119c,0xea));var _0xc119=function(_0x3d9b04,_0x1e851a){_0x3d9b04=_0x3d9b04-0x0;var _0x557936=_0x119c[_0x3d9b04];return _0x557936;};'use strict';var moment=require('moment');var logger=require(_0xc119('0x0'))('routing');var rpc={'chatInteraction':require(_0xc119('0x1')),'openchannelInteraction':require(_0xc119('0x2')),'smsInteraction':require(_0xc119('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xc119('0x4'))};exports[_0xc119('0x5')]=function(_0x3a0d7f,_0x573014,_0xc67c68,_0x55a01a){return function(_0x38be76){try{logger['info'](_0xc119('0x6'),_0x3a0d7f,_0x573014[0x0]);var _0x3dbd20={'closed':0x1,'closedAt':moment()[_0xc119('0x7')](_0xc119('0x8')),'closeReason':_0xc119('0x9'),'disposition':_0x573014[0x0]};if(rpc[_0x55a01a[_0xc119('0xa')]+_0xc119('0xb')]){rpc[_0x55a01a[_0xc119('0xa')]+_0xc119('0xb')][_0xc119('0xc')](_0x55a01a[_0xc119('0xd')]['id'],_0x3dbd20)['then'](function(_0x4774d9){logger['info'](_0xc119('0xe'),_0x3a0d7f,_0x55a01a[_0xc119('0xd')]['id']);})[_0xc119('0xf')](function(_0x4741fd){logger[_0xc119('0x10')](_0xc119('0x11'),_0x3a0d7f,JSON['stringify'](_0x4741fd));})['finally'](function(){_0x38be76[_0xc119('0x12')]();});}}catch(_0x34d296){logger[_0xc119('0x10')](_0xc119('0x11'),_0x3a0d7f,JSON[_0xc119('0x13')](_0x34d296));_0x38be76['stop']();}};}; \ No newline at end of file +var _0x4ad3=['../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction'];(function(_0x3e3ca2,_0x293354){var _0x9d0c9=function(_0x495038){while(--_0x495038){_0x3e3ca2['push'](_0x3e3ca2['shift']());}};_0x9d0c9(++_0x293354);}(_0x4ad3,0x1b1));var _0x34ad=function(_0x2b55b5,_0x78505e){_0x2b55b5=_0x2b55b5-0x0;var _0x103d28=_0x4ad3[_0x2b55b5];return _0x103d28;};'use strict';var moment=require(_0x34ad('0x0'));var logger=require(_0x34ad('0x1'))(_0x34ad('0x2'));var rpc={'chatInteraction':require(_0x34ad('0x3')),'openchannelInteraction':require(_0x34ad('0x4')),'smsInteraction':require(_0x34ad('0x5')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x34ad('0x6'))};exports[_0x34ad('0x7')]=function(_0x269143,_0x2bea02,_0x116a1c,_0x42c532){return function(_0x2d438f){try{logger[_0x34ad('0x8')](_0x34ad('0x9'),_0x269143,_0x2bea02[0x0]);var _0x10d356={'closed':0x1,'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0x34ad('0xa'),'disposition':_0x2bea02[0x0]};if(rpc[_0x42c532[_0x34ad('0xb')]+_0x34ad('0xc')]){rpc[_0x42c532[_0x34ad('0xb')]+'Interaction'][_0x34ad('0xd')](_0x42c532[_0x34ad('0xe')]['id'],_0x10d356)[_0x34ad('0xf')](function(_0x8f5421){logger[_0x34ad('0x8')](_0x34ad('0x10'),_0x269143,_0x42c532[_0x34ad('0xe')]['id']);})[_0x34ad('0x11')](function(_0x3c986e){logger[_0x34ad('0x12')](_0x34ad('0x13'),_0x269143,JSON[_0x34ad('0x14')](_0x3c986e));})[_0x34ad('0x15')](function(){_0x2d438f[_0x34ad('0x16')]();});}}catch(_0x20d8ba){logger[_0x34ad('0x12')]('[%s][CLOSE]\x20%s',_0x269143,JSON[_0x34ad('0x14')](_0x20d8ba));_0x2d438f[_0x34ad('0x16')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 0883e7c..424254d 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x640f=['InteractionId','created','body','Message','create','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment','then','metadata','endConversation','catch','lodash','moment','apiai-promise','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','consequence','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','chat','account','upperFirst','AccountId'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x640f,0x17c));var _0xf640=function(_0x2b2ad0,_0x5432f1){_0x2b2ad0=_0x2b2ad0-0x0;var _0x5b302b=_0x640f[_0x2b2ad0];return _0x5b302b;};'use strict';var _=require(_0xf640('0x0'));var moment=require(_0xf640('0x1'));var apiai=require(_0xf640('0x2'));var md5=require('md5');var utils=require(_0xf640('0x3'));var logger=require(_0xf640('0x4'))(_0xf640('0x5'));var rpc={'chatMessage':require(_0xf640('0x6')),'openchannelMessage':require(_0xf640('0x7')),'mailMessage':require(_0xf640('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xf640('0x9'))};exports[_0xf640('0xa')]=function(_0x18751c,_0x1047ff){return function(_0x3380e9){try{if(!_['isNil'](this[_0xf640('0xb')][_0xf640('0xc')])){logger[_0xf640('0xd')](_0xf640('0xe'),_0x18751c,_0xf640('0xf'));return _0x3380e9[_0xf640('0x10')]();}var _0x533df8={'ContactId':this['contact']['id'],'sentAt':moment()[_0xf640('0x11')](_0xf640('0x12')),'direction':_0xf640('0x13')};var _0x34a0a1=this[_0xf640('0x14')];if(_0x34a0a1===_0xf640('0x15')){_0x533df8['ChatWebsiteId']=this[_0xf640('0x16')]['id'];}else{_0x533df8[_[_0xf640('0x17')](_0x34a0a1)+_0xf640('0x18')]=this[_0xf640('0x16')]['id'];}_0x533df8[_[_0xf640('0x17')](_0x34a0a1)+_0xf640('0x19')]=this[_0xf640('0xb')]['id'];if(this[_0xf640('0xb')][_0xf640('0x1a')]){var _0x1d0d13=_0x1047ff[0x2];if(!_['isEmpty'](_0x1d0d13)){_0x533df8[_0xf640('0x1b')]=utils['getMustacheRender'](_0x1d0d13,this);return rpc[_0x34a0a1+_0xf640('0x1c')][_0xf640('0x1d')](_0x533df8)['then'](function(_0x524825){logger[_0xf640('0xd')](_0xf640('0xe'),_0x18751c,_0x533df8['body']);})['catch'](function(_0x1977a0){logger[_0xf640('0x1e')](_0xf640('0xe'),_0x18751c,JSON[_0xf640('0x1f')](_0x1977a0));})[_0xf640('0x20')](function(){logger[_0xf640('0xd')](_0xf640('0x21'),_0x18751c);_0x3380e9[_0xf640('0x22')]();});}else{logger[_0xf640('0xd')](_0xf640('0x23'),_0x18751c);_0x3380e9[_0xf640('0x22')]();}}else{var _0x4f27d3=this;var _0x1774f2=apiai(_0x1047ff[0x0],{'language':_0x1047ff[0x1]||'en'});return _0x1774f2[_0xf640('0x24')](this[_0xf640('0x25')][_0xf640('0x1b')],{'sessionId':md5(this[_0xf640('0xb')]['id'])})['then'](function(_0xe51146){_0x4f27d3[_0xf640('0x1b')][_0xf640('0x26')]=_0xe51146;_0x533df8[_0xf640('0x1b')]=_0xe51146[_0xf640('0x27')][_0xf640('0x28')]['speech'];return rpc[_0x34a0a1+_0xf640('0x1c')]['create'](_0x533df8)[_0xf640('0x29')](function(_0x4d317b){logger[_0xf640('0xd')](_0xf640('0xe'),_0x18751c,_0x533df8[_0xf640('0x1b')]);if(_0xe51146[_0xf640('0x27')][_0xf640('0x2a')][_0xf640('0x2b')]){_0x3380e9[_0xf640('0x10')]();}else{_0x3380e9[_0xf640('0x22')]();}})[_0xf640('0x2c')](function(_0x295cac){logger[_0xf640('0x1e')]('[%s][DIALOGFLOW]\x20%s',_0x18751c,JSON[_0xf640('0x1f')](_0x295cac));_0x3380e9[_0xf640('0x10')]();});})[_0xf640('0x2c')](function(_0x314847){logger[_0xf640('0x1e')](_0xf640('0xe'),_0x18751c,_0x314847[_0xf640('0x25')]);_0x3380e9['next']();});}}catch(_0x13566c){logger['error'](_0xf640('0xe'),_0x18751c,JSON['stringify'](_0x13566c));_0x3380e9['stop']();}};}; \ No newline at end of file +var _0x6bfa=['info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','out','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','body','create','then','[%s][DIALOGFLOW]\x20%s','catch','stringify','finally','stop','textRequest','message','result','fulfillment','speech','Message','endConversation','next','error','lodash','moment','apiai-promise','md5','./utils','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','interaction'];(function(_0x509605,_0x27c523){var _0x49cff2=function(_0x345051){while(--_0x345051){_0x509605['push'](_0x509605['shift']());}};_0x49cff2(++_0x27c523);}(_0x6bfa,0x6c));var _0xa6bf=function(_0x4ec527,_0x4cc420){_0x4ec527=_0x4ec527-0x0;var _0x38101a=_0x6bfa[_0x4ec527];return _0x38101a;};'use strict';var _=require(_0xa6bf('0x0'));var moment=require(_0xa6bf('0x1'));var apiai=require(_0xa6bf('0x2'));var md5=require(_0xa6bf('0x3'));var utils=require(_0xa6bf('0x4'));var logger=require('../../../../config/logger')(_0xa6bf('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xa6bf('0x6')),'mailMessage':require(_0xa6bf('0x7')),'smsMessage':require(_0xa6bf('0x8')),'faxMessage':require(_0xa6bf('0x9'))};exports[_0xa6bf('0xa')]=function(_0x595a8e,_0x2f2018){return function(_0x36c7dc){try{if(!_['isNil'](this[_0xa6bf('0xb')]['UserId'])){logger[_0xa6bf('0xc')]('[%s][DIALOGFLOW]\x20%s',_0x595a8e,_0xa6bf('0xd'));return _0x36c7dc['next']();}var _0x31839a={'ContactId':this[_0xa6bf('0xe')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xa6bf('0xf')};var _0x4994cd=this['channel'];if(_0x4994cd===_0xa6bf('0x10')){_0x31839a[_0xa6bf('0x11')]=this[_0xa6bf('0x12')]['id'];}else{_0x31839a[_[_0xa6bf('0x13')](_0x4994cd)+_0xa6bf('0x14')]=this[_0xa6bf('0x12')]['id'];}_0x31839a[_[_0xa6bf('0x13')](_0x4994cd)+'InteractionId']=this['interaction']['id'];if(this[_0xa6bf('0xb')][_0xa6bf('0x15')]){var _0x31e981=_0x2f2018[0x2];if(!_[_0xa6bf('0x16')](_0x31e981)){_0x31839a[_0xa6bf('0x17')]=utils['getMustacheRender'](_0x31e981,this);return rpc[_0x4994cd+'Message'][_0xa6bf('0x18')](_0x31839a)[_0xa6bf('0x19')](function(_0x32dacb){logger[_0xa6bf('0xc')](_0xa6bf('0x1a'),_0x595a8e,_0x31839a[_0xa6bf('0x17')]);})[_0xa6bf('0x1b')](function(_0x2fdeaa){logger['error'](_0xa6bf('0x1a'),_0x595a8e,JSON[_0xa6bf('0x1c')](_0x2fdeaa));})[_0xa6bf('0x1d')](function(){logger[_0xa6bf('0xc')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x595a8e);_0x36c7dc[_0xa6bf('0x1e')]();});}else{logger[_0xa6bf('0xc')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x595a8e);_0x36c7dc[_0xa6bf('0x1e')]();}}else{var _0x470254=this;var _0x44fb0c=apiai(_0x2f2018[0x0],{'language':_0x2f2018[0x1]||'en'});return _0x44fb0c[_0xa6bf('0x1f')](this[_0xa6bf('0x20')]['body'],{'sessionId':md5(this[_0xa6bf('0xb')]['id'])})[_0xa6bf('0x19')](function(_0x279b2a){_0x470254[_0xa6bf('0x17')]['dialogflow']=_0x279b2a;_0x31839a[_0xa6bf('0x17')]=_0x279b2a[_0xa6bf('0x21')][_0xa6bf('0x22')][_0xa6bf('0x23')];return rpc[_0x4994cd+_0xa6bf('0x24')][_0xa6bf('0x18')](_0x31839a)[_0xa6bf('0x19')](function(_0x320828){logger[_0xa6bf('0xc')]('[%s][DIALOGFLOW]\x20%s',_0x595a8e,_0x31839a[_0xa6bf('0x17')]);if(_0x279b2a['result']['metadata'][_0xa6bf('0x25')]){_0x36c7dc[_0xa6bf('0x26')]();}else{_0x36c7dc['stop']();}})[_0xa6bf('0x1b')](function(_0x3826b1){logger[_0xa6bf('0x27')](_0xa6bf('0x1a'),_0x595a8e,JSON[_0xa6bf('0x1c')](_0x3826b1));_0x36c7dc[_0xa6bf('0x26')]();});})['catch'](function(_0x487e44){logger[_0xa6bf('0x27')](_0xa6bf('0x1a'),_0x595a8e,_0x487e44[_0xa6bf('0x20')]);_0x36c7dc[_0xa6bf('0x26')]();});}}catch(_0x29d08d){logger[_0xa6bf('0x27')](_0xa6bf('0x1a'),_0x595a8e,JSON[_0xa6bf('0x1c')](_0x29d08d));_0x36c7dc[_0xa6bf('0x1e')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index ffc0df0..91d097c 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x96bc=['error','[%s][GOTOIF]\x20%s','map','stop','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','validate','./utils','../../../../config/logger','string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','replace','length'];(function(_0x29d87d,_0x23dc31){var _0x1fd84b=function(_0x4e2aa1){while(--_0x4e2aa1){_0x29d87d['push'](_0x29d87d['shift']());}};_0x1fd84b(++_0x23dc31);}(_0x96bc,0x91));var _0xc96b=function(_0xc7e0fa,_0x3be90b){_0xc7e0fa=_0xc7e0fa-0x0;var _0x8675e8=_0x96bc[_0xc7e0fa];return _0x8675e8;};'use strict';var schema=require(_0xc96b('0x0'));var _=require('lodash');var htmlToText=require('html-to-text');var utils=require(_0xc96b('0x1'));var logger=require(_0xc96b('0x2'))('routing');var gotoif=schema({'condition':{'type':_0xc96b('0x3'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0xc96b('0x4'),'message':_0xc96b('0x5')},'priorityFalse':{'type':_0xc96b('0x4'),'message':_0xc96b('0x6')}});exports['consequence']=function(_0x20d8cf,_0x3b9141){return function(_0x204bd1){try{var _0x4b3d6a={'condition':htmlToText[_0xc96b('0x7')](utils[_0xc96b('0x8')](_0x3b9141[0x0],this),{'wordwrap':![]})[_0xc96b('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3b9141[0x1],'priorityFalse':_0x3b9141[0x2]};var _0x5a65e4=gotoif[_0xc96b('0x0')](_0x4b3d6a,{'typecast':!![]});if(_0x5a65e4[_0xc96b('0xa')]){logger[_0xc96b('0xb')](_0xc96b('0xc'),_0x20d8cf,_[_0xc96b('0xd')](_0x5a65e4,'message')['join'](',\x20'));_0x204bd1[_0xc96b('0xe')]();}else{try{var _0x462e52=eval('('+_0x4b3d6a['condition']+')');var _0x516deb=_0x462e52?_0x4b3d6a[_0xc96b('0xf')]:_0x4b3d6a[_0xc96b('0x10')];logger[_0xc96b('0x11')](_0xc96b('0x12'),_0x20d8cf,_0x4b3d6a['condition'],_0x462e52,_0x516deb||_0xc96b('0x13'));if(_0x516deb){var _0xbbccf7=_[_0xc96b('0x14')](_0x204bd1['rules'](),{'p':_0x516deb});if(_0xbbccf7>=0x0){logger[_0xc96b('0x11')](_0xc96b('0x15'),_0x20d8cf,_0x516deb||_0xc96b('0x13'),_0xbbccf7);_0x204bd1[_0xc96b('0x13')](_0xbbccf7);}else{logger[_0xc96b('0x11')](_0xc96b('0x16'),_0x20d8cf,_0x516deb||_0xc96b('0x13'));_0x204bd1[_0xc96b('0xe')]();}}else{_0x204bd1[_0xc96b('0x13')]();}}catch(_0x36416c){logger[_0xc96b('0xb')](_0xc96b('0x17'),_0x20d8cf,_0x36416c[_0xc96b('0x18')]);_0x204bd1['stop']();}}}catch(_0x11c8ed){logger[_0xc96b('0xb')]('[%s][GOTOIF]\x20%s',_0x20d8cf,JSON[_0xc96b('0x19')](_0x11c8ed));_0x204bd1['stop']();}};}; \ No newline at end of file +var _0x346e=['fromString','replace','error','map','message','join','stop','condition','priorityTrue','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','stringify','validate','lodash','./utils','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','consequence'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x346e,0x1bb));var _0xe346=function(_0x554d40,_0x3e4d2e){_0x554d40=_0x554d40-0x0;var _0x2e95a6=_0x346e[_0x554d40];return _0x2e95a6;};'use strict';var schema=require(_0xe346('0x0'));var _=require(_0xe346('0x1'));var htmlToText=require('html-to-text');var utils=require(_0xe346('0x2'));var logger=require('../../../../config/logger')('routing');var gotoif=schema({'condition':{'type':_0xe346('0x3'),'required':!![],'message':_0xe346('0x4')},'priorityTrue':{'type':_0xe346('0x5'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0xe346('0x5'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0xe346('0x6')]=function(_0x248c75,_0x18e053){return function(_0x4c9b8c){try{var _0x229f98={'condition':htmlToText[_0xe346('0x7')](utils['getMustacheRender'](_0x18e053[0x0],this),{'wordwrap':![]})[_0xe346('0x8')](/<\/?[^>]+(>|$)/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 diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 307fa71..238745c 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 _0xbb18=['info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','next','stringify','validate','lodash','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','[%s][GOTOP]\x20%s','map','message','join','stop'];(function(_0x17bd6c,_0x505ef2){var _0x2ccb33=function(_0x16b0f7){while(--_0x16b0f7){_0x17bd6c['push'](_0x17bd6c['shift']());}};_0x2ccb33(++_0x505ef2);}(_0xbb18,0x79));var _0x8bb1=function(_0x32f8a2,_0x49c502){_0x32f8a2=_0x32f8a2-0x0;var _0x258cca=_0xbb18[_0x32f8a2];return _0x258cca;};'use strict';var schema=require(_0x8bb1('0x0'));var _=require(_0x8bb1('0x1'));var logger=require(_0x8bb1('0x2'))(_0x8bb1('0x3'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x8bb1('0x4')}});exports['consequence']=function(_0xbadab8,_0xb50366){return function(_0x48e362){try{var _0x292f74={'priority':_0xb50366[0x0]};var _0x33aad8=gotop[_0x8bb1('0x0')](_0x292f74,{'typecast':!![]});if(_0x33aad8[_0x8bb1('0x5')]){logger[_0x8bb1('0x6')](_0x8bb1('0x7'),_0xbadab8,_[_0x8bb1('0x8')](_0x33aad8,_0x8bb1('0x9'))[_0x8bb1('0xa')](',\x20'));_0x48e362[_0x8bb1('0xb')]();}else{logger[_0x8bb1('0xc')](_0x8bb1('0xd'),_0xbadab8,_0x292f74[_0x8bb1('0xe')]);if(_0x292f74[_0x8bb1('0xe')]){var _0x1a61ff=_[_0x8bb1('0xf')](_0x48e362[_0x8bb1('0x10')](),{'p':_0x292f74[_0x8bb1('0xe')]});if(_0x1a61ff>=0x0){logger[_0x8bb1('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0xbadab8,_0x292f74[_0x8bb1('0xe')]||_0x8bb1('0x11'),_0x1a61ff);_0x48e362['next'](_0x1a61ff);}else{logger[_0x8bb1('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0xbadab8,_0x292f74[_0x8bb1('0xe')]||'next');_0x48e362[_0x8bb1('0xb')]();}}else{_0x48e362[_0x8bb1('0x11')]();}}}catch(_0x1ae984){logger[_0x8bb1('0x6')](_0x8bb1('0x7'),_0xbadab8,JSON[_0x8bb1('0x12')](_0x1ae984));_0x48e362[_0x8bb1('0xb')]();}};}; \ No newline at end of file +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 diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index e138677..4a2ad6c 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 _0x221c=['../../rpc/faxMessage','consequence','contact','channel','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','interaction','Message','create','info','[%s][MESSAGE]\x20%s','body','error','stringify','stop','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0x221c,0x1bc));var _0xc221=function(_0x38e10e,_0xa9eef2){_0x38e10e=_0x38e10e-0x0;var _0x23f846=_0x221c[_0x38e10e];return _0x23f846;};'use strict';var _=require(_0xc221('0x0'));var utils=require(_0xc221('0x1'));var logger=require(_0xc221('0x2'))('routing');var rpc={'chatMessage':require(_0xc221('0x3')),'openchannelMessage':require(_0xc221('0x4')),'mailMessage':require(_0xc221('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xc221('0x6'))};exports[_0xc221('0x7')]=function(_0x3b47e9,_0x4b1531){return function(_0x5f27c1){try{var _0x4a06dc={'body':utils['getMustacheRender'](_0x4b1531[0x0],this),'ContactId':this[_0xc221('0x8')]['id']};if(this[_0xc221('0x9')]===_0xc221('0xa')){_0x4a06dc[_0xc221('0xb')]=this[_0xc221('0xc')]['id'];}else{_0x4a06dc[_['upperFirst'](this['channel'])+_0xc221('0xd')]=this[_0xc221('0xc')]['id'];}_0x4a06dc[_[_0xc221('0xe')](this[_0xc221('0x9')])+_0xc221('0xf')]=this[_0xc221('0x10')]['id'];if(rpc[this[_0xc221('0x9')]+_0xc221('0x11')]){return rpc[this[_0xc221('0x9')]+_0xc221('0x11')][_0xc221('0x12')](_0x4a06dc)['then'](function(_0x24110f){logger[_0xc221('0x13')](_0xc221('0x14'),_0x3b47e9,_0x4a06dc[_0xc221('0x15')]);_0x5f27c1['next']();})['catch'](function(_0x17f211){logger[_0xc221('0x16')]('[%s][MESSAGE]\x20%s',_0x3b47e9,JSON[_0xc221('0x17')](_0x17f211));_0x5f27c1[_0xc221('0x18')]();});}}catch(_0x1aee61){logger[_0xc221('0x16')](_0xc221('0x14'),_0x3b47e9,JSON[_0xc221('0x17')](_0x1aee61));_0x5f27c1[_0xc221('0x18')]();}};}; \ No newline at end of file +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 diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index b2e9aa5..bb1a3ac 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 _0x0088=['error','[%s][NOOP]\x20%s','stringify','./utils','../../../../config/logger','routing','consequence','info','getMustacheRender','next'];(function(_0x1af5b2,_0x1b82fe){var _0xf1aa2d=function(_0x2ceae2){while(--_0x2ceae2){_0x1af5b2['push'](_0x1af5b2['shift']());}};_0xf1aa2d(++_0x1b82fe);}(_0x0088,0x143));var _0x8008=function(_0x179695,_0x5772aa){_0x179695=_0x179695-0x0;var _0x44bbab=_0x0088[_0x179695];return _0x44bbab;};'use strict';var utils=require(_0x8008('0x0'));var logger=require(_0x8008('0x1'))(_0x8008('0x2'));exports[_0x8008('0x3')]=function(_0x1e4785,_0x4f59d7){return function(_0x523c62){try{logger[_0x8008('0x4')]('[%s][NOOP]\x20%s',_0x1e4785,utils[_0x8008('0x5')](_0x4f59d7[0x0],this));_0x523c62[_0x8008('0x6')]();}catch(_0x45b47a){logger[_0x8008('0x7')](_0x8008('0x8'),_0x1e4785,JSON[_0x8008('0x9')](_0x45b47a));_0x523c62['stop']();}};}; \ No newline at end of file +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 diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 0d7c912..081d62f 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 _0xe605=['socket.io-emitter','queue_id','joinAt','emit','clone','queue','account','format','pick','%sQueuesWaitingInteractions','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','from','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','YYYY-MM-DD\x20HH:mm:ss','accepted','update','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','timeout','qtimeout','rules','end','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost'];(function(_0x394bc5,_0x5d33df){var _0x2f5271=function(_0x5928de){while(--_0x5928de){_0x394bc5['push'](_0x394bc5['shift']());}};_0x2f5271(++_0x5d33df);}(_0xe605,0x92));var _0x5e60=function(_0x450bf0,_0x491cdc){_0x450bf0=_0x450bf0-0x0;var _0x59a594=_0xe605[_0x450bf0];return _0x59a594;};'use strict';var schema=require(_0x5e60('0x0'));var _=require(_0x5e60('0x1'));var util=require('util');var seqqueue=require(_0x5e60('0x2'));var moment=require(_0x5e60('0x3'));var Redis=require(_0x5e60('0x4'));var config=require(_0x5e60('0x5'));var logger=require(_0x5e60('0x6'))(_0x5e60('0x7'));var strategy=require(_0x5e60('0x8'));config[_0x5e60('0x9')]=_[_0x5e60('0xa')](config[_0x5e60('0x9')],{'host':_0x5e60('0xb'),'port':0x18eb});var io=require(_0x5e60('0xc'))(new Redis(config['redis']));var attributes=['id',_0x5e60('0xd'),'account','queue','from',_0x5e60('0xe')];function emit(_0xe93f9c,_0x150a51,_0x2c5425){io['to'](_0xe93f9c)[_0x5e60('0xf')](_0x150a51,_0x2c5425);}function emitChannelQueueInteraction(_0x2cbe4e,_0x56f05a,_0x6ab0ce,_0x527f7b,_0x1d2558,_0x15035f,_0xcf1188,_0x51e7f6){var _0x371df7=_[_0x5e60('0x10')](_0x6ab0ce);_0x371df7[_0x5e60('0xd')]=_0x51e7f6;_0x371df7[_0x5e60('0x11')]=_0x56f05a;_0x371df7[_0x5e60('0x12')]=_0x527f7b;_0x371df7['id']=_0x1d2558;if(_0x15035f){_0xcf1188[util[_0x5e60('0x13')]('%sQueuesWaitingInteractions',_0x2cbe4e)][_0x1d2558]=_[_0x5e60('0x14')](_0x371df7,attributes);}else{delete _0xcf1188[util[_0x5e60('0x13')](_0x5e60('0x15'),_0x2cbe4e)][_0x1d2558];}emit(util[_0x5e60('0x13')]('%s:queue:%s',_0x2cbe4e,_0x56f05a),util[_0x5e60('0x13')]('%s_queue_waiting_interaction:%s',_0x2cbe4e,_0x15035f?_0x5e60('0x16'):_0x5e60('0x17')),_['pick'](_0x371df7,attributes));}var rpc={'openchannelQueueReport':require(_0x5e60('0x18')),'mailQueueReport':require(_0x5e60('0x19')),'chatQueueReport':require(_0x5e60('0x1a')),'smsQueueReport':require(_0x5e60('0x1b')),'faxQueueReport':require('../../rpc/faxQueueReport')};var queue=schema({'name':{'type':_0x5e60('0x1c'),'required':!![],'message':_0x5e60('0x1d')},'timeout':{'type':'number','message':_0x5e60('0x1e')}});function startRouting(_0x3a9e6b,_0x17c630,_0x311fef,_0x20db03){if(_0x3a9e6b&&_0x17c630&&_0x311fef){_0x17c630[_0x5e60('0x1f')]+=0x1;var _0x41294f={'uniqueid':_0x3a9e6b,'from':_0x311fef[_0x5e60('0x20')]?_0x311fef[_0x5e60('0x20')][_0x5e60('0x21')]:'','joinAt':moment()[_0x5e60('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x311fef[_0x5e60('0x22')]?_0x311fef['contact']['id']:null,'ListId':_0x311fef[_0x5e60('0x23')]?_0x311fef[_0x5e60('0x23')]['id']:null};_0x41294f[_[_0x5e60('0x24')](_0x311fef[_0x5e60('0x25')])+_0x5e60('0x26')]=_0x17c630['id']||null;_0x41294f[_[_0x5e60('0x24')](_0x311fef[_0x5e60('0x25')])+'InteractionId']=_0x311fef[_0x5e60('0x27')]?_0x311fef[_0x5e60('0x27')]['id']:null;_0x41294f[_[_0x5e60('0x24')](_0x311fef['channel'])+_0x5e60('0x28')]=_0x311fef[_0x5e60('0x29')]?_0x311fef[_0x5e60('0x29')]['id']:null;_0x41294f[_[_0x5e60('0x24')](_0x311fef['channel'])+(_0x311fef[_0x5e60('0x25')]!=='chat'?_0x5e60('0x2a'):_0x5e60('0x2b'))]=_0x311fef['account']?_0x311fef[_0x5e60('0x12')]['id']:null;logger[_0x5e60('0x2c')](util['format'](_0x5e60('0x2d'),_0x3a9e6b,_0x17c630[_0x5e60('0x2e')]));emitChannelQueueInteraction(_0x311fef['channel'],_0x17c630['name'],_0x41294f,_0x311fef['account'][_0x5e60('0x2e')],_0x311fef[_0x5e60('0x29')]['id'],!![],_0x20db03,_0x17c630['id']);if(rpc[_0x311fef[_0x5e60('0x25')]+_0x5e60('0x2f')]){return rpc[_0x311fef[_0x5e60('0x25')]+'QueueReport'][_0x5e60('0x30')](_0x41294f)[_0x5e60('0x31')](function(_0x4d4b55){logger[_0x5e60('0x32')]('create\x20queue\x20report');});}}}function stopRouting(_0x50f024,_0x1035b0,_0x3c4340,_0x1f474b){if(_0x50f024&&_0x1035b0){_0x1035b0[_0x5e60('0x1f')]-=0x1;var _0xaf3a35={'leaveAt':moment()[_0x5e60('0x13')](_0x5e60('0x33')),'acceptAt':moment()[_0x5e60('0x13')](_0x5e60('0x33')),'reason':_0x5e60('0x34')};logger['info'](util[_0x5e60('0x13')]('[%s][STOP:QUEUE][NAME:%s]',_0x50f024,_0x1035b0['name']));emitChannelQueueInteraction(_0x3c4340[_0x5e60('0x25')],_0x1035b0[_0x5e60('0x2e')],_0x3c4340['body'],_0x3c4340[_0x5e60('0x12')]['name'],_0x3c4340[_0x5e60('0x29')]['id'],![],_0x1f474b,_0x1035b0['id']);if(rpc[_0x3c4340[_0x5e60('0x25')]+_0x5e60('0x2f')]){return rpc[_0x3c4340[_0x5e60('0x25')]+_0x5e60('0x2f')][_0x5e60('0x35')](_0x50f024,_0xaf3a35)[_0x5e60('0x31')](function(_0x3c5200){logger['error'](_0x5e60('0x36'));});}}}function endRouting(_0x3f744d,_0x22d4ad,_0x1a3782,_0x200744){if(_0x3f744d&&_0x22d4ad){_0x22d4ad[_0x5e60('0x1f')]-=0x1;var _0x261245={'leaveAt':moment()['format'](_0x5e60('0x33')),'exitAt':moment()[_0x5e60('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger[_0x5e60('0x2c')](util[_0x5e60('0x13')](_0x5e60('0x37'),_0x3f744d,_0x22d4ad[_0x5e60('0x2e')]));emitChannelQueueInteraction(_0x1a3782[_0x5e60('0x25')],_0x22d4ad['name'],_0x1a3782[_0x5e60('0x20')],_0x1a3782[_0x5e60('0x12')][_0x5e60('0x2e')],_0x1a3782[_0x5e60('0x29')]['id'],![],_0x200744);if(rpc[_0x1a3782[_0x5e60('0x25')]+_0x5e60('0x2f')]){return rpc[_0x1a3782[_0x5e60('0x25')]+'QueueReport'][_0x5e60('0x35')](_0x3f744d,_0x261245)[_0x5e60('0x31')](function(_0x486185){logger['error']('update\x20queue\x20report');});}}}function handleFindQueue(_0x15a97b){return function(_0x1b80ad){return _0x1b80ad[_0x5e60('0x2e')][_0x5e60('0x38')]()===_0x15a97b['toLowerCase']();};}exports[_0x5e60('0x39')]=function(_0x24e893,_0x4b6192,_0x5bda22,_0x1bf6e4){return function(_0x42b9b0){try{var _0x40cb06={'name':_0x4b6192[0x0],'timeout':_0x4b6192[0x1]};var _0x38ff1d=queue[_0x5e60('0x0')](_0x40cb06,{'typecast':!![]});if(_0x38ff1d[_0x5e60('0x3a')]){logger[_0x5e60('0x32')](_0x5e60('0x3b'),_0x24e893,_[_0x5e60('0x3c')](_0x38ff1d,'message')[_0x5e60('0x3d')](',\x20'));_0x42b9b0[_0x5e60('0x3e')]();}else{var _0x59a2eb=_[_0x5e60('0x3f')](_0x5bda22[_0x1bf6e4[_0x5e60('0x25')]+_0x5e60('0x40')],handleFindQueue(_0x40cb06[_0x5e60('0x2e')]));if(_0x59a2eb){startRouting(_0x24e893,_0x59a2eb,_0x1bf6e4,_0x5bda22);var _0x76f97f=(_0x59a2eb['timeout']||0xa)*0x3e8;var _0x3f1a53=(_0x40cb06[_0x5e60('0x41')]||0x14)*0x3e8;var _0x172aff,_0x46ced1;if(_0x76f97f>_0x3f1a53){_0x3f1a53=_0x76f97f;}var _0x4b6e30=seqqueue['createQueue'](_0x76f97f);_0x4b6e30['id']=_0x24e893;_0x4b6e30['atimeout']=_0x76f97f;_0x4b6e30[_0x5e60('0x42')]=_0x3f1a53;_0x4b6e30[_0x5e60('0x25')]=_0x1bf6e4[_0x5e60('0x25')];_0x5bda22[_0x5e60('0x43')][_0x24e893]['on'](_0x5e60('0x44'),function(){logger[_0x5e60('0x2c')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x24e893);stopRouting(_0x24e893,_0x59a2eb,_0x1bf6e4,_0x5bda22);clearTimeout(_0x172aff);_0x172aff=undefined;_0x4b6e30[_0x5e60('0x45')](!![]);if(_0x5bda22[_0x5e60('0x43')][_0x24e893]){delete _0x5bda22[_0x5e60('0x43')][_0x24e893];}_0x42b9b0[_0x5e60('0x3e')]();});_0x5bda22[_0x5e60('0x43')][_0x24e893]['on'](_0x5e60('0x46'),function(){if(_0x5bda22[_0x5e60('0x43')][_0x24e893]){delete _0x5bda22['rules'][_0x24e893];}});_0x172aff=setTimeout(function(){logger[_0x5e60('0x2c')](_0x5e60('0x47'),_0x24e893);endRouting(_0x24e893,_0x59a2eb,_0x1bf6e4,_0x5bda22);clearTimeout(_0x172aff);_0x4b6e30[_0x5e60('0x45')](!![]);_0x42b9b0[_0x5e60('0x48')]();},_0x3f1a53);switch(_0x59a2eb[_0x5e60('0x49')]){case _0x5e60('0x4a'):strategy[_0x5e60('0x4a')](_0x4b6e30,_0x59a2eb,_0x5bda22,_0x1bf6e4);break;default:strategy[_0x5e60('0x4b')](_0x4b6e30,_0x59a2eb,_0x5bda22,_0x1bf6e4);}}else{logger[_0x5e60('0x32')](_0x5e60('0x4c'),_0x24e893,_0x40cb06[_0x5e60('0x2e')]);_0x42b9b0[_0x5e60('0x3e')]();}}}catch(_0x3e84be){console[_0x5e60('0x4d')](_0x3e84be);logger[_0x5e60('0x32')](_0x5e60('0x3b'),_0x24e893,_0x3e84be[_0x5e60('0x4e')]);_0x42b9b0[_0x5e60('0x3e')]();}};}; \ No newline at end of file +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 diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 40ab56f..5352d35 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 _0xaf9b=['notificationId','squeue','push','handleTimeout','timeout','bind','drained','handleDrained','prototype','handleRun','info','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','showNotification','writeLog',':FORCED','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','STOP','exports','lodash','../../../../../config/logger','routing'];(function(_0x38750a,_0x316de4){var _0x92e34a=function(_0x4f83e1){while(--_0x4f83e1){_0x38750a['push'](_0x38750a['shift']());}};_0x92e34a(++_0x316de4);}(_0xaf9b,0x183));var _0xbaf9=function(_0x34c923,_0x4118e5){_0x34c923=_0x34c923-0x0;var _0x1a154f=_0xaf9b[_0x34c923];return _0x1a154f;};'use strict';var _=require(_0xbaf9('0x0'));var uuid=require('uuid');var util=require('./util');var logger=require(_0xbaf9('0x1'))(_0xbaf9('0x2'));var Agent=function(_0x1ef76a,_0x25167a,_0x59ed11,_0x354efb){this[_0xbaf9('0x3')]=uuid['v4']();this[_0xbaf9('0x4')]=_0x1ef76a;this['agent']=_0x25167a;this['realtime']=_0x59ed11;this[_0xbaf9('0x2')]=_0x354efb;this[_0xbaf9('0x4')][_0xbaf9('0x5')](this['handleRun']['bind'](this),this[_0xbaf9('0x6')]['bind'](this));this['squeue']['on'](_0xbaf9('0x7'),this[_0xbaf9('0x6')][_0xbaf9('0x8')](this));this[_0xbaf9('0x4')]['on'](_0xbaf9('0x9'),this[_0xbaf9('0xa')][_0xbaf9('0x8')](this));};Agent[_0xbaf9('0xb')]['push']=function(){this[_0xbaf9('0x4')]['push'](this[_0xbaf9('0xc')]['bind'](this),this['handleTimeout'][_0xbaf9('0x8')](this));};Agent[_0xbaf9('0xb')][_0xbaf9('0xa')]=function(){this[_0xbaf9('0x6')](!![]);};Agent['prototype'][_0xbaf9('0xc')]=function(_0x1838d8){logger[_0xbaf9('0xd')](_0xbaf9('0xe'),this[_0xbaf9('0x4')]['id'],this[_0xbaf9('0xf')]['id']);if(_[_0xbaf9('0x10')](this[_0xbaf9('0x11')][_0xbaf9('0x12')][this['agent']['id']])){logger[_0xbaf9('0xd')](_0xbaf9('0x13'),this[_0xbaf9('0x4')]['id'],this['agent']['id']);setTimeout(this['push'][_0xbaf9('0x8')](this),0x3e8);}else{if(this[_0xbaf9('0x2')][_0xbaf9('0x14')]||util['isAgentAvailable'](this[_0xbaf9('0x4')]['id'],this['realtime'][_0xbaf9('0x12')][this[_0xbaf9('0xf')]['id']],this[_0xbaf9('0x4')][_0xbaf9('0x15')],![])){this[_0xbaf9('0x11')][_0xbaf9('0x12')][this['agent']['id']]['busy']=!![];this[_0xbaf9('0x11')][_0xbaf9('0x12')][this['agent']['id']]['busyQueue']=undefined;util[_0xbaf9('0x16')](this[_0xbaf9('0x3')],this['squeue']['id'],this[_0xbaf9('0x11')]['agents'][this[_0xbaf9('0xf')]['id']],null,this['routing']);util[_0xbaf9('0x17')](this[_0xbaf9('0x4')]['id'],this[_0xbaf9('0x11')][_0xbaf9('0x12')][this[_0xbaf9('0xf')]['id']],'RINGING'+(this['routing']['forcedOwnership']?_0xbaf9('0x18'):''));}else{logger[_0xbaf9('0xd')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0xbaf9('0x4')]['id'],this[_0xbaf9('0xf')]['id']);setTimeout(this[_0xbaf9('0x5')][_0xbaf9('0x8')](this),0x3e8);}}};Agent['prototype'][_0xbaf9('0x6')]=function(_0x17940a){if(_[_0xbaf9('0x10')](this[_0xbaf9('0x11')]['agents'][this[_0xbaf9('0xf')]['id']])){return logger[_0xbaf9('0xd')](_0xbaf9('0x13'),this[_0xbaf9('0x4')]['id'],this[_0xbaf9('0xf')]['id']);}else{logger['info'](_0xbaf9('0x19'),this['squeue']['id'],this['agent']['id']);util[_0xbaf9('0x1a')](this[_0xbaf9('0x3')],this[_0xbaf9('0x4')]['id'],this[_0xbaf9('0x11')][_0xbaf9('0x12')][this[_0xbaf9('0xf')]['id']],null,this['routing']);this[_0xbaf9('0x11')][_0xbaf9('0x12')][this[_0xbaf9('0xf')]['id']][_0xbaf9('0x1b')]=![];this[_0xbaf9('0x11')][_0xbaf9('0x12')][this['agent']['id']]['busyQueue']=undefined;util[_0xbaf9('0x17')](this[_0xbaf9('0x4')]['id'],this[_0xbaf9('0x11')][_0xbaf9('0x12')][this['agent']['id']],_0x17940a?_0xbaf9('0x1c'):'TIMEOUT');}if(!_0x17940a){setTimeout(this[_0xbaf9('0x5')][_0xbaf9('0x8')](this),0x3e8);}};function agent(_0x28127b,_0x208b0a,_0x530d52,_0x19a461){return new Agent(_0x28127b,_0x208b0a,_0x530d52,_0x19a461);}module[_0xbaf9('0x1d')]=agent; \ No newline at end of file +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 diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 802f621..91d2c76 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 _0x247f=['lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','realtime','routing','push','bind','handleTimeout','timeout','drained','handleDrained','prototype','handleRun','isNil','queue','Agents','length','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','agents','RINGING','busy','busyQueue','name','showNotification','info','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','exports'];(function(_0x443557,_0x430687){var _0x3a93b3=function(_0x1ee874){while(--_0x1ee874){_0x443557['push'](_0x443557['shift']());}};_0x3a93b3(++_0x430687);}(_0x247f,0x94));var _0xf247=function(_0x1779d1,_0x5e8e3a){_0x1779d1=_0x1779d1-0x0;var _0x34582=_0x247f[_0x1779d1];return _0x34582;};'use strict';var _=require(_0xf247('0x0'));var uuid=require(_0xf247('0x1'));var util=require(_0xf247('0x2'));var logger=require(_0xf247('0x3'))('routing');var Beepall=function(_0x20d5c7,_0x2f09fb,_0x29b171,_0x5e5c99){this[_0xf247('0x4')]=uuid['v4']();this[_0xf247('0x5')]=_0x20d5c7;this['queue']=_0x2f09fb;this[_0xf247('0x6')]=_0x29b171;this[_0xf247('0x7')]=_0x5e5c99;this[_0xf247('0x5')][_0xf247('0x8')](this['handleRun'][_0xf247('0x9')](this),this[_0xf247('0xa')][_0xf247('0x9')](this));this[_0xf247('0x5')]['on'](_0xf247('0xb'),this[_0xf247('0xa')][_0xf247('0x9')](this));this[_0xf247('0x5')]['on'](_0xf247('0xc'),this[_0xf247('0xd')]['bind'](this));};Beepall[_0xf247('0xe')][_0xf247('0x8')]=function(){this[_0xf247('0x5')][_0xf247('0x8')](this[_0xf247('0xf')][_0xf247('0x9')](this),this[_0xf247('0xa')]['bind'](this));};Beepall[_0xf247('0xe')][_0xf247('0xd')]=function(_0x24395e){this[_0xf247('0xa')](!![]);};Beepall[_0xf247('0xe')][_0xf247('0xf')]=function(_0x5d2907){var _0x52314d=!![];if(!_[_0xf247('0x10')](this[_0xf247('0x11')])&&!_[_0xf247('0x10')](this['queue']['Agents'])&&this[_0xf247('0x11')][_0xf247('0x12')][_0xf247('0x13')]>0x0){for(var _0x33acf8=0x0,_0x359d85;_0x33acf80x0){for(var _0x3d4166=0x0,_0x286312;_0x3d41660x0&&_0x59c48f[_0x5f2bd4+_0x9360('0x20')]>=_0x59c48f[_0x5f2bd4+_0x9360('0x1f')]){writeLog(_0x515944,_0x59c48f,_0x5f2bd4[_0x9360('0x21')]()+_0x9360('0x22'));return![];}}return!![];};exports[_0x9360('0x23')]=function(_0x3b398b,_0xdae2f5,_0x4cc86e,_0xa2c1a7,_0x593907){return sendNotification(!![],_0x3b398b,_0xdae2f5,_0x4cc86e,_0xa2c1a7,_0x593907);};exports[_0x9360('0x24')]=function(_0x5860d5,_0x27674c,_0x2318b2,_0x1d578b,_0x12bbd6){return sendNotification(![],_0x5860d5,_0x27674c,_0x2318b2,_0x1d578b,_0x12bbd6);};exports['writeLog']=writeLog; \ No newline at end of file +var _0x31ff=['writeLog','lodash','util','../utils','mustache','../../../../../config/logger','routing','redis','localhost','socket.io-emitter','emit','format','user:save','split','name','account','notificationSound','notificationShake','body','queue','getMustacheRender','notificationTemplate','msg','error','[%s][QUEUE]\x20%s','message','user:%s','notification:%s','save','remove','info','isAgentAvailable','busy','BUSY','online','PAUSE','Capacity','hasOwnProperty','CurrentCapacity','\x20MAXCAPACITY','showNotification','hideNotification'];(function(_0x2583fc,_0x3f4b90){var _0x2f1aa1=function(_0xd249e8){while(--_0xd249e8){_0x2583fc['push'](_0x2583fc['shift']());}};_0x2f1aa1(++_0x3f4b90);}(_0x31ff,0xd3));var _0xf31f=function(_0x45c62c,_0x8f43e6){_0x45c62c=_0x45c62c-0x0;var _0xc41286=_0x31ff[_0x45c62c];return _0xc41286;};'use strict';var _=require(_0xf31f('0x0'));var util=require(_0xf31f('0x1'));var utils=require(_0xf31f('0x2'));var Mustache=require(_0xf31f('0x3'));var Redis=require('ioredis');var config=require('../../../../../config/environment');var logger=require(_0xf31f('0x4'))(_0xf31f('0x5'));config[_0xf31f('0x6')]=_['defaults'](config[_0xf31f('0x6')],{'host':_0xf31f('0x7'),'port':0x18eb});var io=require(_0xf31f('0x8'))(new Redis(config[_0xf31f('0x6')]));function emit(_0xca0680,_0x2f9393,_0x2b8cb7){io['to'](_0xca0680)[_0xf31f('0x9')](_0x2f9393,_0x2b8cb7);}function sendNotification(_0x2e6f90,_0x23ea08,_0x3f7de1,_0x2b3201,_0x2e87b6,_0x373eb9){io['to'](util[_0xf31f('0xa')]('user:%s',_0x2b3201['name']))[_0xf31f('0x9')](_0xf31f('0xb'),_0x2b3201);var _0x12017c=_0x373eb9||{};var _0x1c1996=_0x3f7de1[_0xf31f('0xc')]('.');var _0x18cbed={'uniqueid':_0x23ea08,'channel':_0x1c1996[0x0],'id':_0x1c1996[0x1],'title':_0x1c1996[0x0]+'\x20interaction','interactionId':_0x1c1996[0x2],'queue':_0x2e87b6?_0x2e87b6[_0xf31f('0xd')]:null,'sound':_0x12017c[_0xf31f('0xe')][_0xf31f('0xf')],'shake':_0x12017c['account'][_0xf31f('0x10')]};try{if(!_0x12017c[_0xf31f('0x11')]){_0x12017c['body']={};}if(_0x2e87b6){_0x12017c['body']['queue']=_0x2e87b6;}else if(_0x12017c['body'][_0xf31f('0x12')]){delete _0x12017c[_0xf31f('0x11')]['queue'];}_0x18cbed['msg']=utils[_0xf31f('0x13')](_0x12017c['account'][_0xf31f('0x14')],_0x12017c);}catch(_0x4d6796){_0x18cbed[_0xf31f('0x15')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0xf31f('0x16')](util[_0xf31f('0xa')](_0xf31f('0x17'),_0x23ea08,_0x4d6796[_0xf31f('0x18')]));}io['to'](util['format'](_0xf31f('0x19'),_0x2b3201[_0xf31f('0xd')]))[_0xf31f('0x9')](util['format'](_0xf31f('0x1a'),_0x2e6f90?_0xf31f('0x1b'):_0xf31f('0x1c')),_0x18cbed);}function writeLog(_0x43082b,_0x3d416f,_0x403d1c){return logger[_0xf31f('0x1d')](util[_0xf31f('0xa')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x43082b,_0x3d416f[_0xf31f('0xd')],_0x403d1c));}exports[_0xf31f('0x1e')]=function(_0x3c6316,_0x3255cf,_0x17a9bc,_0x54177b){if(_0x3255cf[_0xf31f('0x1f')]){writeLog(_0x3c6316,_0x3255cf,_0xf31f('0x20'));return![];}if(!_0x3255cf[_0xf31f('0x21')]){writeLog(_0x3c6316,_0x3255cf,'OFFLINE');return![];}if(_0x3255cf[_0x17a9bc+'Pause']){writeLog(_0x3c6316,_0x3255cf,_0xf31f('0x22'));return![];}if(_0x54177b&&_0x3255cf['hasOwnProperty'](_0x17a9bc+_0xf31f('0x23'))&&_0x3255cf[_0xf31f('0x24')](_0x17a9bc+_0xf31f('0x25'))){if(_0x3255cf[_0x17a9bc+_0xf31f('0x23')]>0x0&&_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 diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 4d3d3b0..aa7d56d 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 _0x3ab2=['isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','lodash','./utils','../../../../config/logger','string','consequence','error','[%s][SYSTEM]\x20%s','map','message','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next'];(function(_0x28d2fa,_0x5630fe){var _0x183bde=function(_0x41bf1a){while(--_0x41bf1a){_0x28d2fa['push'](_0x28d2fa['shift']());}};_0x183bde(++_0x5630fe);}(_0x3ab2,0x116));var _0x23ab=function(_0x421f5f,_0x6eb9a4){_0x421f5f=_0x421f5f-0x0;var _0x1d59c9=_0x3ab2[_0x421f5f];return _0x1d59c9;};'use strict';var schema=require(_0x23ab('0x0'));var sh=require(_0x23ab('0x1'));var _=require(_0x23ab('0x2'));var utils=require(_0x23ab('0x3'));var logger=require(_0x23ab('0x4'))('routing');var system=schema({'command':{'type':_0x23ab('0x5'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x23ab('0x6')]=function(_0xa4e61e,_0xe22a0d){return function(_0x2f0ee7){try{var _0x5b1083={'command':_0xe22a0d[0x0]};var _0x2f0530=system[_0x23ab('0x0')](_0x5b1083,{'typecast':!![]});if(_0x2f0530['length']){logger[_0x23ab('0x7')](_0x23ab('0x8'),_0xa4e61e,_[_0x23ab('0x9')](_0x2f0530,_0x23ab('0xa'))['join'](',\x20'));logger[_0x23ab('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0xa4e61e);_0x2f0ee7['next']();}else{var _0x53554f=this;var _0xa54e28=utils['getMustacheRender'](_0xe22a0d[0x0],this);logger[_0x23ab('0xb')](_0x23ab('0xc'),_0xa4e61e,_0xa54e28);sh[_0x23ab('0xd')](_['trim'](_0xa54e28),function(_0x52306f,_0x3ce530){logger[_0x23ab('0xb')](_0x23ab('0xe'),_0xa4e61e,_0x52306f);if(_0x52306f==0x0){var _0x30a272=_0x3ce530[_0x23ab('0xf')](/(\r\n|\n|\r)/gm,'');if(_[_0x23ab('0x10')](_0xe22a0d[0x1])||_[_0x23ab('0x11')](_0xe22a0d[0x1])){logger['info'](_0x23ab('0x12'),_0xa4e61e);_0x53554f[_0x23ab('0x13')][_0xe22a0d[0x1]]=_0x30a272;}else{logger[_0x23ab('0xb')](_0x23ab('0x14'),_0xa4e61e,_0xe22a0d[0x1],_0x30a272);_0x53554f[_0x23ab('0x13')][_0xe22a0d[0x1]]=_0x30a272;}}_0x2f0ee7[_0x23ab('0x15')]();});}}catch(_0x56235f){logger[_0x23ab('0x7')](_0x23ab('0x8'),_0xa4e61e,_[_0x23ab('0x16')](_0x56235f)?JSON[_0x23ab('0x17')](_0x56235f):_0x56235f);logger['info'](_0x23ab('0x18'),_0xa4e61e);_0x2f0ee7['next']();}};}; \ No newline at end of file +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 diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 70f7896..2c311f9 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(_0x46f40e,_0x26327c){var _0x3d417c=function(_0x2fbb96){while(--_0x2fbb96){_0x46f40e['push'](_0x46f40e['shift']());}};_0x3d417c(++_0x26327c);}(_0x7a54,0x106));var _0x47a5=function(_0x345a9d,_0x487e81){_0x345a9d=_0x345a9d-0x0;var _0x3d542a=_0x7a54[_0x345a9d];return _0x3d542a;};'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(_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 diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 33e991c..ec925d3 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 _0x9de3=['message','account','interaction','mustache','exports','merge','contact'];(function(_0xfd4dde,_0x243383){var _0x563cbe=function(_0x4f0b29){while(--_0x4f0b29){_0xfd4dde['push'](_0xfd4dde['shift']());}};_0x563cbe(++_0x243383);}(_0x9de3,0xea));var _0x39de=function(_0x402666,_0x5b14b1){_0x402666=_0x402666-0x0;var _0x3a5fc0=_0x9de3[_0x402666];return _0x3a5fc0;};'use strict';var Mustache=require(_0x39de('0x0'));var _=require('lodash');module[_0x39de('0x1')]={'getMustacheRender':function(_0x43fb06,_0x33c312){return Mustache['render'](_0x43fb06,_[_0x39de('0x2')](_0x33c312['body'],{'contact':_0x33c312[_0x39de('0x3')],'message':_0x33c312[_0x39de('0x4')],'account':_0x33c312[_0x39de('0x5')],'interaction':_0x33c312[_0x39de('0x6')],'list':_0x33c312['list']}))||'';}}; \ No newline at end of file +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 diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 093f7e4..1a8f4f1 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 _0x5b2a=['stringify','matchPath','complete','No\x20applications\x20to\x20execute','emit','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','agent','agents','busy','busyQueue','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','openchannelQueues','smsQueues','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','path','jayson/promise','bluebird','uuid','../../../config/environment','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','channel','message','interaction','applications','length','existsSync','join','app','.js','autoreply','push','dialogflow','appdata','split','slice','TagId','%s:%s:%s','./interval','condition','intervals','consequence','info','Push\x20new\x20rule','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','Applications\x20executed'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x5b2a,0xda));var _0xa5b2=function(_0x3cb152,_0x57eb54){_0x3cb152=_0x3cb152-0x0;var _0x4f54c3=_0x5b2a[_0x3cb152];return _0x4f54c3;};'use strict';var _=require(_0xa5b2('0x0'));var util=require('util');var path=require(_0xa5b2('0x1'));var fs=require('fs');var jayson=require(_0xa5b2('0x2'));var BPromise=require(_0xa5b2('0x3'));var uuid=require(_0xa5b2('0x4'));var config=require(_0xa5b2('0x5'));var logger=require('../../../config/logger')('routing');var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport')};var rpc={'openchannelQueueReport':require(_0xa5b2('0x6')),'mailQueueReport':require(_0xa5b2('0x7')),'chatQueueReport':require(_0xa5b2('0x8')),'smsQueueReport':require(_0xa5b2('0x9')),'faxQueueReport':require('../rpc/faxQueueReport')};var RuleEngine=require('../lib/rule-engine');function getId(_0x29acac,_0x60ca3b,_0x4cd7bb){return util[_0xa5b2('0xa')](_0xa5b2('0xb'),_0x29acac,_0x60ca3b||0x0,_0x4cd7bb||0x0);}function getIntervals(_0x4b1546,_0x3a8d9e){var _0x2e48cf=[];if(!_[_0xa5b2('0xc')](_0x3a8d9e[_0xa5b2('0xd')])&&!_[_0xa5b2('0xc')](_0x4b1546[_0x3a8d9e['IntervalId']])&&!_[_0xa5b2('0xc')](_0x4b1546[_0x3a8d9e['IntervalId']][_0xa5b2('0xe')])){_0x2e48cf=_[_0xa5b2('0xf')](_0x4b1546[_0x3a8d9e[_0xa5b2('0xd')]][_0xa5b2('0xe')],_0xa5b2('0x10'));}else if(!_[_0xa5b2('0xc')](_0x3a8d9e[_0xa5b2('0x10')])){_0x2e48cf=[_0x3a8d9e[_0xa5b2('0x10')]];}return _0x2e48cf;}exports['listen']=function(_0x2237be){_0x2237be['rules']={};return new BPromise(function(_0x172805,_0x46868e){var _0xd17d11={'Start':function(_0x46ecdc){var _0x4178cc=this;return new Promise(function(_0x3c97bb,_0x32898b){if(_0x46ecdc){try{var _0x314f93=[];var _0x1ce777=getId(_0x46ecdc[_0xa5b2('0x11')],_0x46ecdc[_0xa5b2('0x12')]?_0x46ecdc[_0xa5b2('0x12')]['id']:0x0,_0x46ecdc[_0xa5b2('0x13')]?_0x46ecdc[_0xa5b2('0x13')]['id']:0x0);if(_0x46ecdc[_0xa5b2('0x14')]&&_['isArray'](_0x46ecdc[_0xa5b2('0x14')])&&_0x46ecdc['applications'][_0xa5b2('0x15')]){for(var _0xb602b0=0x0;_0xb602b0<_0x46ecdc[_0xa5b2('0x14')][_0xa5b2('0x15')];_0xb602b0+=0x1){var _0x404b70=_0x46ecdc['applications'][_0xb602b0];if(fs[_0xa5b2('0x16')](path[_0xa5b2('0x17')](__dirname,_0xa5b2('0x14'),_0x404b70[_0xa5b2('0x18')]+_0xa5b2('0x19')))){var _0x86023c=[];switch(_0x404b70['app']['toLowerCase']()){case _0xa5b2('0x1a'):var _0xe8a7ba=_0x404b70['appdata']['split'](',');_0x86023c['push'](_0xe8a7ba[0x0]);_0x86023c[_0xa5b2('0x1b')](_0xe8a7ba['slice'](0x1,_0xe8a7ba['length'])[_0xa5b2('0x17')](','));break;case _0xa5b2('0x1c'):var _0x482a24=_0x404b70[_0xa5b2('0x1d')][_0xa5b2('0x1e')](',');_0x86023c[_0xa5b2('0x1b')](_0x482a24[0x0]);_0x86023c['push'](_0x482a24[0x1]);_0x86023c[_0xa5b2('0x1b')](_0x482a24['slice'](0x2,_0x482a24['length'])[_0xa5b2('0x17')](','));break;case'amazonlex':var _0xe9b856=_0x404b70['appdata'][_0xa5b2('0x1e')](',');_0x86023c[_0xa5b2('0x1b')](_0xe9b856[0x0]);_0x86023c[_0xa5b2('0x1b')](_0xe9b856[0x1]);_0x86023c['push'](_0xe9b856[0x2]);_0x86023c[_0xa5b2('0x1b')](_0xe9b856[0x3]);_0x86023c[_0xa5b2('0x1b')](_0xe9b856[_0xa5b2('0x1f')](0x4,_0xe9b856[_0xa5b2('0x15')])[_0xa5b2('0x17')](','));break;case'message':_0x86023c[_0xa5b2('0x1b')](_0x404b70[_0xa5b2('0x1d')]);break;case'tag':_0x86023c[_0xa5b2('0x1b')](_0x404b70[_0xa5b2('0x20')]);_0x86023c[_0xa5b2('0x1b')](_0x404b70[_0xa5b2('0x1d')]);break;default:_0x86023c=_[_0xa5b2('0xc')](_0x404b70['appdata'])?[]:_0x404b70['appdata'][_0xa5b2('0x1e')](',');}var _0x1678c7={'id':util['format'](_0xa5b2('0x21'),_0x1ce777,_0x404b70['id'],_0x404b70['app']),'condition':require(_0xa5b2('0x22'))[_0xa5b2('0x23')](_0x1ce777,getIntervals(_0x2237be[_0xa5b2('0x24')],_0x404b70),_0x2237be),'consequence':require('./applications/'+_0x404b70[_0xa5b2('0x18')])[_0xa5b2('0x25')](_0x1ce777,_0x86023c,_0x2237be,_0x46ecdc),'p':_0x404b70['priority']||0x0};logger[_0xa5b2('0x26')](_0xa5b2('0x27'),_0x1678c7['id'],_0xa5b2('0x28'),getIntervals(_0x2237be['intervals'],_0x404b70)['join']('\x20|\x20'));_0x314f93[_0xa5b2('0x1b')](_0x1678c7);}else{logger[_0xa5b2('0x29')](_0xa5b2('0x2a'),path[_0xa5b2('0x17')](__dirname,_0xa5b2('0x14'),_0x404b70[_0xa5b2('0x18')]+'.js'));}}_0x2237be[_0xa5b2('0x2b')][_0x1ce777]=new RuleEngine(_0x314f93);_0x2237be[_0xa5b2('0x2b')][_0x1ce777][_0xa5b2('0x2c')](_0x46ecdc,function(_0x1df9fe){logger[_0xa5b2('0x26')](_0xa5b2('0x2d'),JSON[_0xa5b2('0x2e')](_0x1df9fe[_0xa5b2('0x2f')]));if(_0x2237be[_0xa5b2('0x2b')][_0x1ce777]){_0x2237be[_0xa5b2('0x2b')][_0x1ce777]['emit'](_0xa5b2('0x30'));}});return _0x3c97bb({'code':0xc8,'message':_0x46ecdc});}else{logger[_0xa5b2('0x26')](_0xa5b2('0x31'));return _0x3c97bb({'code':0xc8,'message':_0x46ecdc});}}catch(_0x41b637){logger[_0xa5b2('0x29')](_0x41b637['stack']);return _0x32898b(_0x4178cc[_0xa5b2('0x29')](0x1f4,_0x41b637));}}return _0x32898b('routing\x20is\x20empty');});},'AcceptMessage':function(_0x8d813e){var _0x218c59=this;return new Promise(function(_0x16005b,_0xf1b984){if(_0x8d813e['message']&&_0x8d813e[_0xa5b2('0x12')]['id']){try{var _0x300236=getId(_0x8d813e['channel'],_0x8d813e[_0xa5b2('0x12')]?_0x8d813e[_0xa5b2('0x12')]['id']:0x0,_0x8d813e[_0xa5b2('0x13')]?_0x8d813e[_0xa5b2('0x13')]['id']:0x0);if(_0x2237be[_0xa5b2('0x2b')][_0x300236]){_0x2237be[_0xa5b2('0x2b')][_0x300236][_0xa5b2('0x32')](_0xa5b2('0x33'));if(rpc[_0x8d813e[_0xa5b2('0x11')]+_0xa5b2('0x34')]){rpc[_0x8d813e[_0xa5b2('0x11')]+_0xa5b2('0x34')][_0xa5b2('0x35')](_0x300236,{'UserId':_0x8d813e[_0xa5b2('0x12')][_0xa5b2('0x36')]})[_0xa5b2('0x37')](function(_0x3bd619){logger[_0xa5b2('0x29')](_0xa5b2('0x38'));});}}return _0x16005b({'code':0xc8,'message':_0x8d813e});}catch(_0xd67392){logger['error'](_0xd67392[_0xa5b2('0x39')]);return _0xf1b984(_0x218c59[_0xa5b2('0x29')](0x1f4,_0xd67392));}}logger[_0xa5b2('0x29')](_0xa5b2('0x3a'));return _0xf1b984(_0x218c59[_0xa5b2('0x29')](0x1f4,_0xa5b2('0x3a')));});},'RejectMessage':function(_0x1b7aaf){var _0x58db50=this;return new Promise(function(_0x1656f7,_0x40cf87){if(_0x1b7aaf[_0xa5b2('0x3b')]&&_0x1b7aaf[_0xa5b2('0x3b')]['id']){try{if(_0x2237be[_0xa5b2('0x3c')][_0x1b7aaf[_0xa5b2('0x3b')]['id']]){_0x2237be[_0xa5b2('0x3c')][_0x1b7aaf[_0xa5b2('0x3b')]['id']][_0xa5b2('0x3d')]=![];_0x2237be[_0xa5b2('0x3c')][_0x1b7aaf[_0xa5b2('0x3b')]['id']][_0xa5b2('0x3e')]=undefined;}return _0x1656f7({'code':0xc8,'message':_0x1b7aaf});}catch(_0x319bbe){logger[_0xa5b2('0x29')](_0x319bbe[_0xa5b2('0x39')]);return _0x40cf87(_0x58db50['error'](0x1f4,_0x319bbe));}}logger[_0xa5b2('0x29')]('message\x20is\x20empty');return _0x40cf87(_0x58db50[_0xa5b2('0x29')](0x1f4,_0xa5b2('0x3a')));});},'AbandonInteraction':function(_0x4975d6){var _0x19ee4f=this;return new Promise(function(_0x217247,_0x287709){if(_0x4975d6[_0xa5b2('0x11')]&&_0x4975d6[_0xa5b2('0x13')]&&_0x4975d6[_0xa5b2('0x13')]['id']){try{var _0x2c629f=getId(_0x4975d6[_0xa5b2('0x11')],_0x4975d6[_0xa5b2('0x12')]?_0x4975d6[_0xa5b2('0x12')]['id']:0x0,_0x4975d6[_0xa5b2('0x13')]?_0x4975d6[_0xa5b2('0x13')]['id']:0x0);if(_0x2237be['rules'][_0x2c629f]){_0x2237be['rules'][_0x2c629f][_0xa5b2('0x32')](_0xa5b2('0x33'));}return _0x217247({'code':0xc8,'message':_0x4975d6});}catch(_0x1d7785){logger[_0xa5b2('0x29')](_0x1d7785[_0xa5b2('0x39')]);return _0x287709(_0x19ee4f[_0xa5b2('0x29')](0x1f4,_0x1d7785));}}logger[_0xa5b2('0x29')](_0xa5b2('0x3a'));return _0x287709(_0x19ee4f[_0xa5b2('0x29')](0x1f4,_0xa5b2('0x3a')));});},'AgentCapacity':function(_0x5299f4){var _0x431f4b=this;return new Promise(function(_0xe93f47,_0x58e0d5){if(_0x2237be['agents']['hasOwnProperty'](_0x5299f4['id'])){for(var _0x220491 in _0x5299f4[_0xa5b2('0x3f')]){if(_0x5299f4[_0xa5b2('0x3f')][_0xa5b2('0x40')](_0x220491)){if(_0x2237be['agents'][_0x5299f4['id']][_0xa5b2('0x40')](_0x220491+_0xa5b2('0x41'))){_0x2237be[_0xa5b2('0x3c')][_0x5299f4['id']][_0x220491+_0xa5b2('0x41')]=parseInt(_0x5299f4[_0xa5b2('0x3f')][_0x220491],0xa);}}}_0x2237be['agents'][_0x5299f4['id']][_0xa5b2('0x42')]();return _0xe93f47({'code':0xc8,'message':_0x2237be[_0xa5b2('0x3c')][_0x5299f4['id']]});}else{return _0x58e0d5(_0x431f4b['error'](0x1f4,_0xa5b2('0x43')));}});},'Agents':function(_0x16ec7a){return new Promise(function(_0x3ae2da,_0x9ac9a0){var _0x1262ee=_[_0xa5b2('0x44')](_0x2237be['agents']);_0x3ae2da({'count':_0x1262ee['length'],'rows':_0x1262ee});});},'ChatQueues':function(_0x1dbf43){return new Promise(function(_0x1adde6,_0x5b65d7){var _0x2c91d3=[];for(var _0x2a8dfe in _0x2237be[_0xa5b2('0x45')]){if(_0x2237be[_0xa5b2('0x45')][_0xa5b2('0x40')](_0x2a8dfe)){var _0x5f2677=_0x2237be[_0xa5b2('0x45')][_0x2a8dfe];var _0x3aa860={'id':_0x5f2677['id'],'available':_0x5f2677[_0xa5b2('0x46')],'loggedIn':_0x5f2677[_0xa5b2('0x47')],'name':_0x5f2677[_0xa5b2('0x48')],'paused':_0x5f2677[_0xa5b2('0x49')],'waiting':_0x5f2677[_0xa5b2('0x4a')]};_0x2c91d3[_0xa5b2('0x1b')](_0x3aa860);}}_0x1adde6({'count':_0x2c91d3[_0xa5b2('0x15')],'rows':_0x2c91d3});});},'MailQueues':function(_0x55c791){return new Promise(function(_0x2c3ca5,_0x576977){var _0xb068a5=[];for(var _0x330cbb in _0x2237be['mailQueues']){if(_0x2237be['mailQueues'][_0xa5b2('0x40')](_0x330cbb)){var _0x332024=_0x2237be['mailQueues'][_0x330cbb];var _0xedceae={'id':_0x332024['id'],'available':_0x332024[_0xa5b2('0x46')],'loggedIn':_0x332024[_0xa5b2('0x47')],'name':_0x332024['name'],'paused':_0x332024[_0xa5b2('0x49')],'waiting':_0x332024[_0xa5b2('0x4a')]};_0xb068a5[_0xa5b2('0x1b')](_0xedceae);}}_0x2c3ca5({'count':_0xb068a5['length'],'rows':_0xb068a5});});},'OpenchannelQueues':function(_0x3c5e6f){return new Promise(function(_0x15bdd1,_0x29e1d5){var _0x326495=[];for(var _0x469d38 in _0x2237be[_0xa5b2('0x4b')]){if(_0x2237be['openchannelQueues'][_0xa5b2('0x40')](_0x469d38)){var _0x3e250a=_0x2237be['openchannelQueues'][_0x469d38];var _0x3655ae={'id':_0x3e250a['id'],'available':_0x3e250a[_0xa5b2('0x46')],'loggedIn':_0x3e250a[_0xa5b2('0x47')],'name':_0x3e250a[_0xa5b2('0x48')],'paused':_0x3e250a['paused'],'waiting':_0x3e250a[_0xa5b2('0x4a')]};_0x326495[_0xa5b2('0x1b')](_0x3655ae);}}_0x15bdd1({'count':_0x326495['length'],'rows':_0x326495});});},'SmsQueues':function(_0x3a36e5){return new Promise(function(_0x4a582d,_0x3d0932){var _0x138dc9=[];for(var _0x1e1a94 in _0x2237be[_0xa5b2('0x4c')]){if(_0x2237be[_0xa5b2('0x4c')][_0xa5b2('0x40')](_0x1e1a94)){var _0x332571=_0x2237be['smsQueues'][_0x1e1a94];var _0x2b9cd1={'id':_0x332571['id'],'available':_0x332571[_0xa5b2('0x46')],'loggedIn':_0x332571[_0xa5b2('0x47')],'name':_0x332571[_0xa5b2('0x48')],'paused':_0x332571[_0xa5b2('0x49')],'waiting':_0x332571[_0xa5b2('0x4a')]};_0x138dc9[_0xa5b2('0x1b')](_0x2b9cd1);}}_0x4a582d({'count':_0x138dc9['length'],'rows':_0x138dc9});});},'FaxQueues':function(_0x353df9){return new Promise(function(_0x3d9b0a,_0x1d4d42){var _0x569914=[];for(var _0x508dcf in _0x2237be[_0xa5b2('0x4d')]){if(_0x2237be['faxQueues']['hasOwnProperty'](_0x508dcf)){var _0x1154c1=_0x2237be[_0xa5b2('0x4d')][_0x508dcf];var _0x5ccd4a={'id':_0x1154c1['id'],'available':_0x1154c1[_0xa5b2('0x46')],'loggedIn':_0x1154c1['loggedIn'],'name':_0x1154c1[_0xa5b2('0x48')],'paused':_0x1154c1['paused'],'waiting':_0x1154c1['waiting']};_0x569914['push'](_0x5ccd4a);}}_0x3d9b0a({'count':_0x569914[_0xa5b2('0x15')],'rows':_0x569914});});},'ChatQueuesWaitingInteractions':function(_0x53b178){return new Promise(function(_0x15ac0e,_0x36a581){var _0xf542c9=_[_0xa5b2('0x44')](_0x2237be[_0xa5b2('0x4e')]);_0x15ac0e({'count':_0xf542c9['length'],'rows':_0xf542c9});});},'MailQueuesWaitingInteractions':function(_0x4b1859){return new Promise(function(_0x173f11,_0xa667f){var _0x3efe74=_[_0xa5b2('0x44')](_0x2237be[_0xa5b2('0x4f')]);_0x173f11({'count':_0x3efe74[_0xa5b2('0x15')],'rows':_0x3efe74});});},'OpenchannelQueuesWaitingInteractions':function(_0x271b33){return new Promise(function(_0x210e0c,_0x2cdfea){var _0x15987a=_[_0xa5b2('0x44')](_0x2237be[_0xa5b2('0x50')]);_0x210e0c({'count':_0x15987a[_0xa5b2('0x15')],'rows':_0x15987a});});},'SmsQueuesWaitingInteractions':function(_0x1b1773){return new Promise(function(_0x421ecb,_0x5c7c4b){var _0x3e166=_[_0xa5b2('0x44')](_0x2237be['smsQueuesWaitingInteractions']);_0x421ecb({'count':_0x3e166[_0xa5b2('0x15')],'rows':_0x3e166});});},'FaxQueuesWaitingInteractions':function(_0x3f9c0d){return new Promise(function(_0x740a6e,_0x3f05fa){var _0x502d0e=_[_0xa5b2('0x44')](_0x2237be[_0xa5b2('0x51')]);_0x740a6e({'count':_0x502d0e['length'],'rows':_0x502d0e});});}};var _0x188d78=jayson[_0xa5b2('0x52')](_0xd17d11)[_0xa5b2('0x53')]();_0x188d78['on'](_0xa5b2('0x29'),function(_0x582975){logger['error'](JSON['stringify'](_0x582975));return _0x46868e(_0x582975);});_0x188d78[_0xa5b2('0x54')](0x232c,_0xa5b2('0x55'),function(){console[_0xa5b2('0x56')](_0xa5b2('0x57'),0x232c);return _0x172805('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +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 diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 1659612..e2d1a0e 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 _0x205e=['condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','iftime\x20%s','indexOf','true','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','util','jayson/promise','../../../config/logger','routing','client','http','request','then','error','message','catch'];(function(_0x194068,_0x177193){var _0x265c4e=function(_0x1fb956){while(--_0x1fb956){_0x194068['push'](_0x194068['shift']());}};_0x265c4e(++_0x177193);}(_0x205e,0x15d));var _0xe205=function(_0x171873,_0x47f495){_0x171873=_0x171873-0x0;var _0x13188d=_0x205e[_0x171873];return _0x13188d;};'use strict';var util=require(_0xe205('0x0'));var BPromise=require('bluebird');var jayson=require(_0xe205('0x1'));var _=require('lodash');var logger=require(_0xe205('0x2'))(_0xe205('0x3'));var client=jayson[_0xe205('0x4')][_0xe205('0x5')]({'port':0x232a});function request(_0x201fb2,_0x2d0bbb){return new BPromise(function(_0x58f722,_0x44014f){return client[_0xe205('0x6')](_0x201fb2,_0x2d0bbb)[_0xe205('0x7')](function(_0x23deef){if(_0x23deef['error']){return _0x44014f(_0x23deef[_0xe205('0x8')][_0xe205('0x9')]);}else{return _0x58f722(_0x23deef['result']);}})[_0xe205('0xa')](function(_0x782fb0){return _0x44014f(_0x782fb0);});});}exports[_0xe205('0xb')]=function(_0x137bde,_0xe186e3,_0x345f47){return function(_0x3f07b1){if(_0x345f47[_0xe205('0xc')]&&!_0x345f47[_0xe205('0xc')][_0x137bde]){logger[_0xe205('0xd')](_0xe205('0xe'),_0x137bde);return _0x3f07b1[_0xe205('0xf')]();}var _0x130c3e=[];for(var _0x596e98=0x0;_0x596e98<_0xe186e3[_0xe205('0x10')];_0x596e98+=0x1){_0x130c3e[_0xe205('0x11')](request(_0xe205('0x12'),{'command':util['format'](_0xe205('0x13'),_0xe186e3[_0x596e98])})['then'](function(_0x5bd12c){return _0x5bd12c&&_0x5bd12c[_0xe205('0x9')]&&_0x5bd12c[_0xe205('0x9')][_0xe205('0x14')](_0xe205('0x15'))>=0x0?!![]:![];})[_0xe205('0xa')](function(_0x11b597){logger[_0xe205('0x8')]('[%s][INTERVAL]\x20%s',_0x137bde,_0xe186e3[_0x596e98]);}));}BPromise[_0xe205('0x16')](_0x130c3e)[_0xe205('0x7')](function(_0x5ec264){var _0x28fc6d=_[_0xe205('0x17')](_0x5ec264);logger[_0xe205('0xd')](_0xe205('0x18'),_0x137bde,_0xe186e3[_0xe205('0x19')](_0xe205('0x1a')),_0x28fc6d);_0x3f07b1[_0xe205('0x1b')](_0x28fc6d);})[_0xe205('0xa')](function(_0x42bd8e){console[_0xe205('0x1c')](_0x42bd8e);logger[_0xe205('0x8')](_0xe205('0x18'),_0x137bde,_0xe186e3['join'](_0xe205('0x1a')),_0x42bd8e[_0xe205('0x1d')]);_0x3f07b1[_0xe205('0xf')]();});};}; \ No newline at end of file +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 diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 82eaf05..3924911 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 _0x235b=['agentconnect','agentconnectAt','connect','answered_elsewhere','reason','answeredelsewheredestinationuniqueid','agentcompleteAt','complete','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererexten','transfertargetuniqueid','hangup','diffTime','agent','lodash','info','format','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','queue','membername','interface','connectedlinenum','lastevent','getVoiceQueueByName','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','CreateVoiceAgentReport','request','destuniqueid','agentcalledAt','now','connectedlinename','error','stack','agentringnoanswer','isNil','agentringnoanswerAt','timeout','holdtime','ringtime','talktime','queuecallerabandon','forIn','abandoned'];(function(_0x3c5e54,_0x2b991b){var _0x3ae1f3=function(_0x43f80f){while(--_0x43f80f){_0x3c5e54['push'](_0x3c5e54['shift']());}};_0x3ae1f3(++_0x2b991b);}(_0x235b,0x1ed));var _0xb235=function(_0x710012,_0x1e01ba){_0x710012=_0x710012-0x0;var _0x45a7b8=_0x235b[_0x710012];return _0x45a7b8;};'use strict';var _=require(_0xb235('0x0'));var util=require('util');var utils=require('./utils');var agents={};var transfers={};function writeDB(_0x32c01f,_0x814264){utils[_0xb235('0x1')](util[_0xb235('0x2')](_0xb235('0x3'),_0x32c01f[_0xb235('0x4')],_0x32c01f['channel'],_0x32c01f[_0xb235('0x5')],_0x32c01f[_0xb235('0x6')],_0x32c01f[_0xb235('0x7')],_0x32c01f['calleridnum'],_0x32c01f[_0xb235('0x8')],_0x32c01f[_0xb235('0x9')]));if(_0x32c01f[_0xb235('0x5')]){utils[_0xb235('0xa')](_0x32c01f[_0xb235('0x5')])['then'](function(_0x4c8f7c){if(_0x4c8f7c){_0x32c01f[_0xb235('0xb')]=_0x4c8f7c[_0xb235('0xb')];_0x32c01f[_0xb235('0xc')]=_0x32c01f[_0xb235('0xd')]?_0x4c8f7c[_0xb235('0xe')]:![];_0x32c01f[_0xb235('0xf')]=_0x32c01f[_0xb235('0xc')]?_0x4c8f7c[_0xb235('0x10')]:0x0;}utils['request'](_0xb235('0x11'),_0x32c01f);});}else{utils[_0xb235('0x12')](_0xb235('0x11'),_0x32c01f);}if(_0x814264){delete transfers[_0x32c01f['uniqueid']];}else{delete agents[_0x32c01f[_0xb235('0x13')]];}}exports['agentcalled']=function(_0x32e54d){try{agents[_0x32e54d[_0xb235('0x13')]]=_0x32e54d;agents[_0x32e54d[_0xb235('0x13')]][_0xb235('0x14')]=utils[_0xb235('0x15')]();agents[_0x32e54d[_0xb235('0x13')]][_0xb235('0x9')]='called';agents[_0x32e54d[_0xb235('0x13')]][_0xb235('0x8')]=null;agents[_0x32e54d[_0xb235('0x13')]][_0xb235('0x16')]=null;}catch(_0x3fe421){utils[_0xb235('0x17')](_0x3fe421[_0xb235('0x18')]);}};exports[_0xb235('0x19')]=function(_0x2d6520){try{if(!_[_0xb235('0x1a')](agents[_0x2d6520[_0xb235('0x13')]])){agents[_0x2d6520[_0xb235('0x13')]][_0xb235('0x19')]=!![];agents[_0x2d6520['destuniqueid']][_0xb235('0x1b')]=utils['now']();agents[_0x2d6520[_0xb235('0x13')]]['lastevent']=_0xb235('0x1c');agents[_0x2d6520[_0xb235('0x13')]]['reason']=_0xb235('0x1c');agents[_0x2d6520[_0xb235('0x13')]][_0xb235('0x1d')]=_0x2d6520[_0xb235('0x1e')]?parseInt(_0x2d6520[_0xb235('0x1e')])/0x3e8:0x0;agents[_0x2d6520['destuniqueid']][_0xb235('0x1f')]=0x0;writeDB(agents[_0x2d6520[_0xb235('0x13')]]);}}catch(_0x403abf){utils[_0xb235('0x17')](_0x403abf[_0xb235('0x18')]);}};exports[_0xb235('0x20')]=function(_0x57a3a8){try{_[_0xb235('0x21')](agents,function(_0x57d7f5,_0x2b5c93){if(_0x57d7f5[_0xb235('0x4')]==_0x57a3a8[_0xb235('0x4')]){_0x57d7f5['agentringnoanswer']=!![];_0x57d7f5['agentringnoanswerAt']=utils['now']();_0x57d7f5[_0xb235('0x9')]='abandoned';_0x57d7f5['reason']=_0xb235('0x22');_0x57d7f5[_0xb235('0x1d')]=_0x57a3a8[_0xb235('0x1d')];_0x57d7f5['talktime']=0x0;writeDB(_0x57d7f5);}});}catch(_0x2cf4a1){utils['error'](_0x2cf4a1['stack']);}};exports[_0xb235('0x23')]=function(_0x1fa690){try{if(agents[_0x1fa690[_0xb235('0x13')]]){agents[_0x1fa690['destuniqueid']][_0xb235('0x24')]=utils[_0xb235('0x15')]();agents[_0x1fa690[_0xb235('0x13')]]['connectedlinenum']=_0x1fa690['connectedlinenum'];agents[_0x1fa690[_0xb235('0x13')]]['connectedlinename']=_0x1fa690[_0xb235('0x16')];agents[_0x1fa690['destuniqueid']]['holdtime']=_0x1fa690[_0xb235('0x1e')];agents[_0x1fa690[_0xb235('0x13')]]['lastevent']=_0xb235('0x25');_[_0xb235('0x21')](agents,function(_0x24fc09,_0x271a83){if(_0x24fc09[_0xb235('0x13')]!=_0x1fa690[_0xb235('0x13')]&&_0x24fc09[_0xb235('0x4')]==_0x1fa690[_0xb235('0x4')]){_0x24fc09[_0xb235('0x1f')]=0x0;_0x24fc09[_0xb235('0x1d')]=_0x1fa690['ringtime'];_0x24fc09['agentringnoanswer']=!![];_0x24fc09[_0xb235('0x1b')]=utils['now']();_0x24fc09['lastevent']=_0xb235('0x26');_0x24fc09[_0xb235('0x27')]=_0xb235('0x26');_0x24fc09[_0xb235('0x28')]=_0x1fa690[_0xb235('0x13')];_0x24fc09['answeredelsewheremembername']=_0x1fa690[_0xb235('0x6')];writeDB(_0x24fc09);}});}}catch(_0x41d53f){utils[_0xb235('0x17')](_0x41d53f[_0xb235('0x18')]);}};exports[_0xb235('0xd')]=function(_0x61f32f){try{if(!_[_0xb235('0x1a')](agents[_0x61f32f[_0xb235('0x13')]])){agents[_0x61f32f['destuniqueid']][_0xb235('0xd')]=!![];agents[_0x61f32f['destuniqueid']][_0xb235('0x29')]=utils['now']();agents[_0x61f32f[_0xb235('0x13')]][_0xb235('0x1f')]=utils['diffTime'](agents[_0x61f32f[_0xb235('0x13')]]['agentcompleteAt'],agents[_0x61f32f[_0xb235('0x13')]][_0xb235('0x24')]);agents[_0x61f32f[_0xb235('0x13')]][_0xb235('0x27')]=_0x61f32f['reason'];agents[_0x61f32f['destuniqueid']][_0xb235('0x9')]=_0xb235('0x2a');writeDB(agents[_0x61f32f['destuniqueid']]);}}catch(_0x473cd9){utils['error'](_0x473cd9[_0xb235('0x18')]);}};exports['blindtransfer']=function(_0x126f2f){try{if(!_[_0xb235('0x1a')](agents[_0x126f2f[_0xb235('0x2b')]])){agents[_0x126f2f['transfereruniqueid']][_0xb235('0x2c')]=!![];agents[_0x126f2f[_0xb235('0x2b')]][_0xb235('0x2d')]=_0xb235('0x2e');agents[_0x126f2f['transfereruniqueid']][_0xb235('0x2f')]=_0x126f2f[_0xb235('0x30')];agents[_0x126f2f[_0xb235('0x2b')]][_0xb235('0x31')]=agents[_0x126f2f[_0xb235('0x2b')]][_0xb235('0x4')];}}catch(_0x274ed8){utils['error'](_0x274ed8[_0xb235('0x18')]);}};exports[_0xb235('0x32')]=function(_0x178dd2){try{if(_0x178dd2[_0xb235('0x33')]==_0x178dd2[_0xb235('0x34')]){if(!_['isNil'](agents[_0x178dd2['secondtransfereruniqueid']])){agents[_0x178dd2[_0xb235('0x35')]][_0xb235('0x2c')]=!![];agents[_0x178dd2[_0xb235('0x35')]]['transfertype']=_0xb235('0x36');agents[_0x178dd2[_0xb235('0x35')]][_0xb235('0x2f')]=_0x178dd2[_0xb235('0x37')];agents[_0x178dd2[_0xb235('0x35')]][_0xb235('0x31')]=_0x178dd2['origtransfereruniqueid'];}if(_0x178dd2['transfereeuniqueid']&&agents[_0x178dd2['transfereeuniqueid']]){agents[_0x178dd2[_0xb235('0x38')]][_0xb235('0x39')]=0x1;transfers[_0x178dd2[_0xb235('0x38')]]=_[_0xb235('0x3a')](agents[_0x178dd2[_0xb235('0x38')]]);transfers[_0x178dd2[_0xb235('0x38')]]['calleridnum']=agents[_0x178dd2[_0xb235('0x35')]][_0xb235('0x3b')];transfers[_0x178dd2[_0xb235('0x38')]][_0xb235('0x3c')]=agents[_0x178dd2[_0xb235('0x35')]][_0xb235('0x3c')];transfers[_0x178dd2[_0xb235('0x38')]]['agentcalledAt']=utils['now']();transfers[_0x178dd2['transfereeuniqueid']][_0xb235('0x24')]=utils['now']();transfers[_0x178dd2[_0xb235('0x38')]][_0xb235('0x1d')]=0x0;transfers[_0x178dd2[_0xb235('0x38')]][_0xb235('0x39')]=0x2;}}else if(_0x178dd2[_0xb235('0x35')]==_0x178dd2['secondtransfererlinkedid']){if(!_['isNil'](agents[_0x178dd2['origtransfereruniqueid']])){agents[_0x178dd2[_0xb235('0x33')]][_0xb235('0x2c')]=!![];agents[_0x178dd2[_0xb235('0x33')]][_0xb235('0x2d')]=_0xb235('0x36');agents[_0x178dd2['origtransfereruniqueid']][_0xb235('0x2f')]=_0x178dd2[_0xb235('0x3d')];agents[_0x178dd2['origtransfereruniqueid']]['transferuniqueid']=_0x178dd2[_0xb235('0x35')];}if(_0x178dd2['transfertargetuniqueid']&&agents[_0x178dd2[_0xb235('0x3e')]]){agents[_0x178dd2[_0xb235('0x3e')]][_0xb235('0x39')]=0x1;transfers[_0x178dd2['transfertargetuniqueid']]=_[_0xb235('0x3a')](agents[_0x178dd2['transfertargetuniqueid']]);transfers[_0x178dd2[_0xb235('0x3e')]][_0xb235('0x3b')]=agents[_0x178dd2[_0xb235('0x33')]][_0xb235('0x3b')];transfers[_0x178dd2[_0xb235('0x3e')]][_0xb235('0x3c')]=agents[_0x178dd2[_0xb235('0x33')]][_0xb235('0x3c')];transfers[_0x178dd2[_0xb235('0x3e')]]['agentcalledAt']=utils[_0xb235('0x15')]();transfers[_0x178dd2[_0xb235('0x3e')]][_0xb235('0x24')]=utils[_0xb235('0x15')]();transfers[_0x178dd2[_0xb235('0x3e')]]['holdtime']=0x0;transfers[_0x178dd2[_0xb235('0x3e')]][_0xb235('0x39')]=0x2;}}}catch(_0xed85eb){utils[_0xb235('0x17')](_0xed85eb['stack']);}};exports[_0xb235('0x3f')]=function(_0xa49048){try{if(transfers[_0xa49048[_0xb235('0x4')]]){transfers[_0xa49048[_0xb235('0x4')]]['agentcomplete']=!![];transfers[_0xa49048['uniqueid']]['agentcompleteAt']=utils[_0xb235('0x15')]();transfers[_0xa49048[_0xb235('0x4')]][_0xb235('0x1f')]=utils[_0xb235('0x40')](transfers[_0xa49048[_0xb235('0x4')]][_0xb235('0x29')],transfers[_0xa49048[_0xb235('0x4')]][_0xb235('0x24')]);transfers[_0xa49048['uniqueid']]['reason']=_0xb235('0x41');transfers[_0xa49048[_0xb235('0x4')]][_0xb235('0x9')]='complete';writeDB(transfers[_0xa49048[_0xb235('0x4')]],!![]);}if(agents[_0xa49048[_0xb235('0x4')]]&&agents[_0xa49048[_0xb235('0x4')]]['agentconnectAt']){agents[_0xa49048[_0xb235('0x4')]][_0xb235('0xd')]=!![];agents[_0xa49048[_0xb235('0x4')]][_0xb235('0x29')]=utils[_0xb235('0x15')]();agents[_0xa49048[_0xb235('0x4')]][_0xb235('0x1f')]=utils[_0xb235('0x40')](agents[_0xa49048[_0xb235('0x4')]][_0xb235('0x29')],agents[_0xa49048['uniqueid']][_0xb235('0x24')]);agents[_0xa49048[_0xb235('0x4')]][_0xb235('0x27')]=agents[_0xa49048[_0xb235('0x4')]][_0xb235('0x2c')]?_0xb235('0x2c'):_0xb235('0x41');agents[_0xa49048[_0xb235('0x4')]][_0xb235('0x9')]=_0xb235('0x2a');writeDB(agents[_0xa49048['uniqueid']]);}}catch(_0x121c9c){utils[_0xb235('0x17')](_0x121c9c[_0xb235('0x18')]);}}; \ No newline at end of file +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 diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 4c251c1..22e3fe1 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 _0x3597=['toNumber','ANSWERED','hangup','callerid','calleridname','endtime','duration','diffTime','billableseconds','attendedtransfer','localtwolinkedid','transfereechannel','secondtransfererchannel','userfield','_attended','origtransfererchannel','musiconholdstartAt','musiconholdstop','mohtime','varset','value','variable','xmd-phone','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','queue','ContactId','xmd-cdrtype','outboundrouteid','newexten','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','lastdata','lodash','util','NO\x20ANSWER','FAILED','info','format','uniqueid','channel','type','source','destination','disposition','getUserByInternal','then','UserId','CreateVoiceCallReport','request','newchannel','linkedid','OutgoingSpoolFailed','accountcode','calleridnum','exten','context','DOCUMENTATION','error','stack','newstate','isNil','systemanswertime','transfer','destinationchannel','answertime','now'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x3597,0xd1));var _0x7359=function(_0x42f3e4,_0x2646fd){_0x42f3e4=_0x42f3e4-0x0;var _0x1d7aa6=_0x3597[_0x42f3e4];return _0x1d7aa6;};'use strict';var _=require(_0x7359('0x0'));var util=require(_0x7359('0x1'));var utils=require('./utils');var dispositions=[_0x7359('0x2'),_0x7359('0x3'),_0x7359('0x3'),_0x7359('0x2'),_0x7359('0x2'),_0x7359('0x2'),'ANSWERED','BUSY','FAILED',_0x7359('0x3'),_0x7359('0x3')];var channels={};function writeDB(_0x569b94){utils[_0x7359('0x4')](util[_0x7359('0x5')]('CALL|%s|%s|%s|%s|%s|%s|%s|%s',_0x569b94[_0x7359('0x6')],_0x569b94[_0x7359('0x7')],_0x569b94[_0x7359('0x8')],_0x569b94['accountcode'],_0x569b94[_0x7359('0x9')],_0x569b94[_0x7359('0xa')],_0x569b94['callerid'],_0x569b94[_0x7359('0xb')]));if(_0x569b94['accountcode']){utils[_0x7359('0xc')](_0x569b94['accountcode'])[_0x7359('0xd')](function(_0x3be4c3){if(_0x3be4c3){_0x569b94[_0x7359('0xe')]=_0x3be4c3['id'];}utils['request'](_0x7359('0xf'),_0x569b94);});}else{utils[_0x7359('0x10')](_0x7359('0xf'),_0x569b94);}if(channels[_0x569b94['uniqueid']]){delete channels[_0x569b94[_0x7359('0x6')]];}}exports[_0x7359('0x11')]=function(_0x55260a){try{if(_0x55260a['uniqueid']==_0x55260a[_0x7359('0x12')]&&_0x55260a['channel']!=_0x7359('0x13')){channels[_0x55260a[_0x7359('0x6')]]={'uniqueid':_0x55260a[_0x7359('0x6')],'accountcode':_0x55260a[_0x7359('0x14')],'source':_0x55260a[_0x7359('0x15')],'destination':_0x55260a[_0x7359('0x16')],'destinationcontext':_0x55260a[_0x7359('0x17')],'channel':_0x55260a[_0x7359('0x7')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x7359('0x18')};}}catch(_0x222b40){utils[_0x7359('0x19')](_0x222b40[_0x7359('0x1a')]);}};exports[_0x7359('0x1b')]=function(_0x2dd768){try{if(!_[_0x7359('0x1c')](channels[_0x2dd768['uniqueid']])&&_0x2dd768['channelstate']==0x6){if(_[_0x7359('0x1c')](channels[_0x2dd768[_0x7359('0x6')]][_0x7359('0x1d')])){channels[_0x2dd768[_0x7359('0x6')]][_0x7359('0x1d')]=utils['now']();}}else if(!_['isNil'](channels[_0x2dd768[_0x7359('0x12')]])&&_0x2dd768['channelstate']==0x6&&_0x2dd768[_0x7359('0x17')]!=_0x7359('0x1e')){channels[_0x2dd768[_0x7359('0x12')]][_0x7359('0x14')]=_0x2dd768[_0x7359('0x14')];channels[_0x2dd768[_0x7359('0x12')]][_0x7359('0x1f')]=_0x2dd768['channel'];if(_[_0x7359('0x1c')](channels[_0x2dd768[_0x7359('0x12')]][_0x7359('0x20')])){channels[_0x2dd768[_0x7359('0x12')]][_0x7359('0x20')]=utils[_0x7359('0x21')]();}channels[_0x2dd768[_0x7359('0x12')]][_0x7359('0xb')]=dispositions[_[_0x7359('0x22')](_0x2dd768['channelstate'])]||_0x7359('0x23');}}catch(_0x3480df){utils[_0x7359('0x19')](_0x3480df[_0x7359('0x1a')]);}};exports[_0x7359('0x24')]=function(_0x2d1385){try{if(!_[_0x7359('0x1c')](channels[_0x2d1385[_0x7359('0x6')]])){if(_[_0x7359('0x1c')](channels[_0x2d1385[_0x7359('0x6')]][_0x7359('0x25')])){channels[_0x2d1385[_0x7359('0x6')]]['callerid']=_0x2d1385[_0x7359('0x26')]+'\x20<'+_0x2d1385['calleridnum']+'>';}channels[_0x2d1385[_0x7359('0x6')]][_0x7359('0x27')]=utils[_0x7359('0x21')]();channels[_0x2d1385[_0x7359('0x6')]][_0x7359('0x28')]=utils[_0x7359('0x29')](channels[_0x2d1385[_0x7359('0x6')]][_0x7359('0x27')],channels[_0x2d1385[_0x7359('0x6')]]['starttime']);channels[_0x2d1385[_0x7359('0x6')]][_0x7359('0x2a')]=channels[_0x2d1385[_0x7359('0x6')]][_0x7359('0x20')]?utils['diffTime'](channels[_0x2d1385['uniqueid']][_0x7359('0x27')],channels[_0x2d1385[_0x7359('0x6')]]['answertime']):0x0;writeDB(channels[_0x2d1385['uniqueid']]);}}catch(_0x3d1d1a){utils[_0x7359('0x19')](_0x3d1d1a[_0x7359('0x1a')]);}};exports[_0x7359('0x2b')]=function(_0x19bf20){try{if(!_[_0x7359('0x1c')](channels[_0x19bf20['localtwolinkedid']])){if(channels[_0x19bf20[_0x7359('0x2c')]][_0x7359('0x7')]==_0x19bf20[_0x7359('0x2d')]){channels[_0x19bf20[_0x7359('0x2c')]][_0x7359('0x1f')]=_0x19bf20[_0x7359('0x2e')];channels[_0x19bf20[_0x7359('0x2c')]][_0x7359('0x2f')]=_0x7359('0x30');}else if(channels[_0x19bf20['localtwolinkedid']][_0x7359('0x7')]=_0x19bf20['transfertargetchannel']){channels[_0x19bf20[_0x7359('0x2c')]][_0x7359('0x1f')]=_0x19bf20[_0x7359('0x31')];channels[_0x19bf20[_0x7359('0x2c')]]['userfield']=_0x7359('0x30');}}}catch(_0x1d8030){utils[_0x7359('0x19')](_0x1d8030[_0x7359('0x1a')]);}};exports['musiconholdstart']=function(_0x1d0918){try{if(!_[_0x7359('0x1c')](channels[_0x1d0918['uniqueid']])){channels[_0x1d0918[_0x7359('0x6')]][_0x7359('0x32')]=utils['now']();}}catch(_0x218edd){utils[_0x7359('0x19')](_0x218edd[_0x7359('0x1a')]);}};exports[_0x7359('0x33')]=function(_0x4c0663){try{if(!_[_0x7359('0x1c')](channels[_0x4c0663[_0x7359('0x6')]])){if(!_[_0x7359('0x1c')](channels[_0x4c0663[_0x7359('0x6')]]['musiconholdstartAt'])){channels[_0x4c0663[_0x7359('0x6')]][_0x7359('0x34')]+=utils[_0x7359('0x29')](utils[_0x7359('0x21')](),channels[_0x4c0663[_0x7359('0x6')]][_0x7359('0x32')]);delete channels[_0x4c0663[_0x7359('0x6')]][_0x7359('0x32')];}}}catch(_0x31332d){utils[_0x7359('0x19')](_0x31332d['stack']);}};exports[_0x7359('0x35')]=function(_0x547d6c){try{if(!_[_0x7359('0x1c')](channels[_0x547d6c[_0x7359('0x6')]])){if(!_[_0x7359('0x1c')](_0x547d6c['variable']['xmd-originatecalleridnum'])){channels[_0x547d6c['uniqueid']][_0x7359('0x9')]=_0x547d6c[_0x7359('0x36')];}if(!_['isNil'](_0x547d6c[_0x7359('0x37')][_0x7359('0x38')])){channels[_0x547d6c[_0x7359('0x6')]][_0x7359('0xa')]=_0x547d6c[_0x7359('0x36')];channels[_0x547d6c[_0x7359('0x6')]]['callerid']='\x22'+_0x547d6c[_0x7359('0x36')]+'\x22\x20<'+_0x547d6c[_0x7359('0x36')]+'>';}if(!_[_0x7359('0x1c')](_0x547d6c[_0x7359('0x37')][_0x7359('0x39')])||!_['isNil'](_0x547d6c[_0x7359('0x37')][_0x7359('0x3a')])){channels[_0x547d6c[_0x7359('0x6')]]['callerid']=_0x547d6c[_0x7359('0x36')];}if(!_[_0x7359('0x1c')](_0x547d6c[_0x7359('0x37')][_0x7359('0x3b')])||!_[_0x7359('0x1c')](_0x547d6c[_0x7359('0x37')][_0x7359('0x3c')])){channels[_0x547d6c[_0x7359('0x6')]][_0x7359('0x3d')]='Queue';channels[_0x547d6c[_0x7359('0x6')]]['lastdata']=_0x547d6c[_0x7359('0x36')];channels[_0x547d6c[_0x7359('0x6')]][_0x7359('0x3e')]=!![];}if(!_[_0x7359('0x1c')](_0x547d6c[_0x7359('0x37')]['xmd-contactid'])){channels[_0x547d6c[_0x7359('0x6')]][_0x7359('0x3f')]=_0x547d6c[_0x7359('0x36')];}if(!_[_0x7359('0x1c')](_0x547d6c[_0x7359('0x37')][_0x7359('0x40')])){channels[_0x547d6c[_0x7359('0x6')]]['type']=_0x547d6c[_0x7359('0x36')];}if(!_['isNil'](_0x547d6c[_0x7359('0x37')][_0x7359('0x41')])){channels[_0x547d6c[_0x7359('0x6')]]['routeid']=_0x547d6c[_0x7359('0x36')];}if(!_[_0x7359('0x1c')](_0x547d6c['variable']['sipcallid'])){channels[_0x547d6c[_0x7359('0x6')]]['sipcallid']=_0x547d6c['value'];}}}catch(_0x3426d2){utils[_0x7359('0x19')](_0x3426d2[_0x7359('0x1a')]);}};exports[_0x7359('0x42')]=function(_0x36691c){try{if(!_['isNil'](channels[_0x36691c[_0x7359('0x6')]])){if(_0x36691c[_0x7359('0x43')][_0x7359('0x44')]()==_0x7359('0x45')&&_[_0x7359('0x46')](_0x36691c[_0x7359('0x47')]['toLowerCase'](),_0x7359('0x48'))){var _0x24ad07=_0x36691c[_0x7359('0x47')][_0x7359('0x49')]('=');var _0x1246d7=_0x24ad07[0x0][_0x7359('0x4a')](_0x24ad07[0x0]['lastIndexOf']('(')+0x1,_0x24ad07[0x0][_0x7359('0x4b')](')'));var _0x3b7515=_0x24ad07[0x1];channels[_0x36691c[_0x7359('0x6')]][_0x1246d7]=_0x3b7515;}if(!_[_0x7359('0x4c')]([_0x7359('0x24'),_0x7359('0x4d'),_0x7359('0x4e'),'set',_0x7359('0x4f')],_0x36691c[_0x7359('0x43')][_0x7359('0x44')]())){channels[_0x36691c[_0x7359('0x6')]][_0x7359('0x3d')]=_0x36691c[_0x7359('0x43')];channels[_0x36691c['uniqueid']][_0x7359('0x50')]=_0x36691c[_0x7359('0x47')];}}}catch(_0x3463e9){utils['error'](_0x3463e9[_0x7359('0x1a')]);}}; \ No newline at end of file +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 diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 0b69a7f..dcf3935 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 _0xeda8=['shutdown','SHUTDOWN','fullybooted','FULLYBOOTED','error','close','CLOSE','managerevent','./utils','lodash','info','CONNECTED'];(function(_0x3a902a,_0xca8442){var _0x24f2d5=function(_0xb6799a){while(--_0xb6799a){_0x3a902a['push'](_0x3a902a['shift']());}};_0x24f2d5(++_0xca8442);}(_0xeda8,0x104));var _0x8eda=function(_0x192be5,_0x33f055){_0x192be5=_0x192be5-0x0;var _0x303998=_0xeda8[_0x192be5];return _0x303998;};'use strict';var utils=require(_0x8eda('0x0'));var _=require(_0x8eda('0x1'));exports['connect']=function(){utils[_0x8eda('0x2')](_0x8eda('0x3'));};exports[_0x8eda('0x4')]=function(){utils[_0x8eda('0x2')](_0x8eda('0x5'));};exports[_0x8eda('0x6')]=function(){utils[_0x8eda('0x2')](_0x8eda('0x7'));};exports[_0x8eda('0x8')]=function(_0x1f3556){utils[_0x8eda('0x8')](_0x1f3556);};exports[_0x8eda('0x9')]=function(){utils['info'](_0x8eda('0xa'));};exports[_0x8eda('0xb')]=function(_0x5aa93d){}; \ No newline at end of file +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 diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 56d2779..cda09a0 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 _0x9068=['DIAL|%s|%s|%s|%s|%s|%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','application','toLowerCase','set','appdata','cdr(routeid)','split','error','stack','varset','isNil','dialbegin','assign','starttime','now','called','dialend','answertime','connect','complete','diffTime','endtime','billableseconds','lodash','./utils','info','format'];(function(_0x4bfade,_0xb26c0e){var _0x272465=function(_0x3b38cb){while(--_0x3b38cb){_0x4bfade['push'](_0x4bfade['shift']());}};_0x272465(++_0xb26c0e);}(_0x9068,0xea));var _0x8906=function(_0x18feb3,_0x1b9d62){_0x18feb3=_0x18feb3-0x0;var _0x16e7a0=_0x9068[_0x18feb3];return _0x16e7a0;};'use strict';var _=require(_0x8906('0x0'));var util=require('util');var utils=require(_0x8906('0x1'));var dials={};function writeDB(_0x265e18){utils[_0x8906('0x2')](util[_0x8906('0x3')](_0x8906('0x4'),_0x265e18[_0x8906('0x5')],_0x265e18[_0x8906('0x6')],_0x265e18[_0x8906('0x7')],_0x265e18[_0x8906('0x8')],_0x265e18[_0x8906('0x9')],_0x265e18[_0x8906('0xa')]));utils[_0x8906('0xb')]('CreateVoiceDialReport',_0x265e18);delete dials[_0x265e18[_0x8906('0x5')]];}exports['newexten']=function(_0x3329f8){try{if(_0x3329f8[_0x8906('0xc')][_0x8906('0xd')]()==_0x8906('0xe')&&_['startsWith'](_0x3329f8[_0x8906('0xf')][_0x8906('0xd')](),_0x8906('0x10'))){var _0x49bddd=_0x3329f8[_0x8906('0xf')][_0x8906('0x11')]('=');dials[_0x3329f8[_0x8906('0x5')]]={'routeId':_0x49bddd[0x1]};}}catch(_0x41ab0e){utils[_0x8906('0x12')](_0x41ab0e[_0x8906('0x13')]);}};exports[_0x8906('0x14')]=function(_0x5a1859){try{if(!_[_0x8906('0x15')](_0x5a1859['variable']['outboundrouteid'])){dials[_0x5a1859[_0x8906('0x5')]]={'routeId':_0x5a1859['value']};}}catch(_0x9a6a24){utils[_0x8906('0x12')](_0x9a6a24[_0x8906('0x13')]);}};exports[_0x8906('0x16')]=function(_0x394fd2){try{if(!_['isNil'](dials[_0x394fd2[_0x8906('0x5')]])){dials[_0x394fd2[_0x8906('0x5')]]=_[_0x8906('0x17')](dials[_0x394fd2['uniqueid']],_0x394fd2);dials[_0x394fd2[_0x8906('0x5')]][_0x8906('0x18')]=utils[_0x8906('0x19')]();dials[_0x394fd2[_0x8906('0x5')]]['lastevent']=_0x8906('0x1a');}}catch(_0x4f0811){utils[_0x8906('0x12')](_0x4f0811[_0x8906('0x13')]);}};exports[_0x8906('0x1b')]=function(_0x41e027){try{if(!_[_0x8906('0x15')](dials[_0x41e027[_0x8906('0x5')]])){dials[_0x41e027[_0x8906('0x5')]][_0x8906('0xa')]=_0x41e027[_0x8906('0xa')];if(_0x41e027[_0x8906('0xa')]=='ANSWER'){dials[_0x41e027['uniqueid']]=_[_0x8906('0x17')](dials[_0x41e027[_0x8906('0x5')]],_0x41e027);dials[_0x41e027[_0x8906('0x5')]][_0x8906('0x1c')]=utils[_0x8906('0x19')]();dials[_0x41e027[_0x8906('0x5')]]['lastevent']=_0x8906('0x1d');}}}catch(_0x2820d2){utils[_0x8906('0x12')](_0x2820d2[_0x8906('0x13')]);}};exports['hangup']=function(_0x1e653c){try{if(!_[_0x8906('0x15')](dials[_0x1e653c[_0x8906('0x5')]])){dials[_0x1e653c[_0x8906('0x5')]]=_[_0x8906('0x17')](dials[_0x1e653c[_0x8906('0x5')]],{'endtime':utils[_0x8906('0x19')](),'lastevent':_0x8906('0x1e')});dials[_0x1e653c['uniqueid']]['duration']=utils[_0x8906('0x1f')](dials[_0x1e653c[_0x8906('0x5')]]['endtime'],dials[_0x1e653c[_0x8906('0x5')]][_0x8906('0x18')]);dials[_0x1e653c[_0x8906('0x5')]]['holdtime']=utils[_0x8906('0x1f')](dials[_0x1e653c[_0x8906('0x5')]]['answertime']||dials[_0x1e653c[_0x8906('0x5')]][_0x8906('0x20')],dials[_0x1e653c[_0x8906('0x5')]][_0x8906('0x18')]);dials[_0x1e653c[_0x8906('0x5')]][_0x8906('0x21')]=dials[_0x1e653c[_0x8906('0x5')]][_0x8906('0x1c')]?utils[_0x8906('0x1f')](dials[_0x1e653c[_0x8906('0x5')]][_0x8906('0x20')],dials[_0x1e653c[_0x8906('0x5')]][_0x8906('0x1c')]):0x0;writeDB(dials[_0x1e653c[_0x8906('0x5')]]);}}catch(_0x141520){utils[_0x8906('0x12')](_0x141520[_0x8906('0x13')]);}}; \ No newline at end of file +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 diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 714b6ff..0348215 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 _0x695a=['hangup','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','../../config/environment','./utils','asterisk','password','keepConnected','xdr','disabled','./agents.controller','./calls.controller','./recordings.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate'];(function(_0x2d42cf,_0x591948){var _0x3c3a18=function(_0x5224b0){while(--_0x5224b0){_0x2d42cf['push'](_0x2d42cf['shift']());}};_0x3c3a18(++_0x591948);}(_0x695a,0x130));var _0xa695=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x695a[_0x2641f9];return _0x585741;};var AsteriskManager=require('asterisk-manager');var config=require(_0xa695('0x0'));var utils=require(_0xa695('0x1'));var ami=new AsteriskManager(config[_0xa695('0x2')]['port'],config[_0xa695('0x2')]['ip'],config[_0xa695('0x2')]['username'],config[_0xa695('0x2')][_0xa695('0x3')],!![]);ami[_0xa695('0x4')]();if(config[_0xa695('0x5')]&&config['xdr'][_0xa695('0x6')]){utils['info']('XDR\x20DISABLED');}else{var agents=require(_0xa695('0x7'));var calls=require(_0xa695('0x8'));var queues=require('./queues.controller');var recordings=require(_0xa695('0x9'));var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require(_0xa695('0xa'));var core=require(_0xa695('0xb'));ami['on'](_0xa695('0xc'),core['connect']);ami['on'](_0xa695('0xd'),core[_0xa695('0xd')]);ami['on'](_0xa695('0xe'),core[_0xa695('0xe')]);ami['on'](_0xa695('0xf'),core['error']);ami['on'](_0xa695('0x10'),core[_0xa695('0x10')]);ami['on'](_0xa695('0x11'),core['managerevent']);ami['on'](_0xa695('0x12'),function(_0x4e8a36){try{members[_0xa695('0x12')](_0x4e8a36);}catch(_0x42409b){utils['error'](_0x42409b);}});ami['on'](_0xa695('0x13'),function(_0x156b4a){try{agents[_0xa695('0x13')](_0x156b4a);}catch(_0x4413a0){utils[_0xa695('0xf')](_0x4413a0);}});ami['on'](_0xa695('0x14'),function(_0x4a5cdf){try{agents[_0xa695('0x14')](_0x4a5cdf);}catch(_0x18e944){utils[_0xa695('0xf')](_0x18e944);}});ami['on']('agentconnect',function(_0x4da482){try{agents[_0xa695('0x15')](_0x4da482);queues[_0xa695('0x15')](_0x4da482);}catch(_0x5bd4c8){utils[_0xa695('0xf')](_0x5bd4c8);}});ami['on'](_0xa695('0x16'),function(_0x124e84){try{agents[_0xa695('0x16')](_0x124e84);queues[_0xa695('0x16')](_0x124e84);members[_0xa695('0x16')](_0x124e84);}catch(_0xff114){utils[_0xa695('0xf')](_0xff114);}});ami['on'](_0xa695('0x17'),function(_0x203de9){try{agents[_0xa695('0x17')](_0x203de9);queues[_0xa695('0x17')](_0x203de9);}catch(_0x572f5a){utils[_0xa695('0xf')](_0x572f5a);}});ami['on'](_0xa695('0x18'),function(_0x151c3a){try{queues[_0xa695('0x18')](_0x151c3a);recordings['queuecallerjoin'](_0x151c3a);}catch(_0x1bdd9a){utils[_0xa695('0xf')](_0x1bdd9a);}});ami['on'](_0xa695('0x19'),function(_0x2621c6){try{queues[_0xa695('0x19')](_0x2621c6);}catch(_0x43cb4d){utils['error'](_0x43cb4d);}});ami['on'](_0xa695('0x1a'),function(_0x297f92){try{queues[_0xa695('0x1a')](_0x297f92);calls[_0xa695('0x1a')](_0x297f92);}catch(_0x2a462a){utils['error'](_0x2a462a);}});ami['on'](_0xa695('0x1b'),function(_0x46cb2e){try{queues[_0xa695('0x1b')](_0x46cb2e);calls[_0xa695('0x1b')](_0x46cb2e);}catch(_0x1c636a){utils[_0xa695('0xf')](_0x1c636a);}});ami['on']('newstate',function(_0x8aaef7){try{calls[_0xa695('0x1c')](_0x8aaef7);recordings['newstate'](_0x8aaef7);}catch(_0x9e4ed5){utils[_0xa695('0xf')](_0x9e4ed5);}});ami['on']('hangup',function(_0x2aaeab){try{calls[_0xa695('0x1d')](_0x2aaeab);recordings[_0xa695('0x1d')](_0x2aaeab);dials[_0xa695('0x1d')](_0x2aaeab);agents[_0xa695('0x1d')](_0x2aaeab);queues['hangup'](_0x2aaeab);}catch(_0x3e9ac7){utils[_0xa695('0xf')](_0x3e9ac7);}});ami['on']('cdr',function(_0x43efed){try{members['cdr'](_0x43efed);}catch(_0x3df12f){utils[_0xa695('0xf')](_0x3df12f);}});ami['on'](_0xa695('0x1e'),function(_0x444d93){try{queues['blindtransfer'](_0x444d93);agents[_0xa695('0x1e')](_0x444d93);transfers[_0xa695('0x1e')](_0x444d93);}catch(_0x36806e){utils[_0xa695('0xf')](_0x36806e);}});ami['on'](_0xa695('0x1f'),function(_0x444b0a){try{queues[_0xa695('0x1f')](_0x444b0a);transfers[_0xa695('0x1f')](_0x444b0a);agents['attendedtransfer'](_0x444b0a);calls[_0xa695('0x1f')](_0x444b0a);}catch(_0x387380){utils[_0xa695('0xf')](_0x387380);}});ami['on'](_0xa695('0x20'),function(_0x34a6c1){try{queues['varset'](_0x34a6c1);recordings[_0xa695('0x20')](_0x34a6c1);calls[_0xa695('0x20')](_0x34a6c1);dials['varset'](_0x34a6c1);}catch(_0xd7762c){utils[_0xa695('0xf')](_0xd7762c);}});ami['on'](_0xa695('0x21'),function(_0x21a88d){try{calls[_0xa695('0x21')](_0x21a88d);recordings['newexten'](_0x21a88d);dials['newexten'](_0x21a88d);}catch(_0x298fa6){utils['error'](_0x298fa6);}});ami['on']('newchannel',function(_0x122590){try{calls[_0xa695('0x22')](_0x122590);recordings[_0xa695('0x22')](_0x122590);}catch(_0x5160d0){utils[_0xa695('0xf')](_0x5160d0);}});ami['on'](_0xa695('0x23'),function(_0x5ab585){try{dials[_0xa695('0x23')](_0x5ab585);}catch(_0x2fcc0d){utils[_0xa695('0xf')](_0x2fcc0d);}});ami['on'](_0xa695('0x24'),function(_0x1b1da9){try{dials[_0xa695('0x24')](_0x1b1da9);}catch(_0x129304){utils['error'](_0x129304);}});} \ No newline at end of file +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 diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 6b2d0c4..14f149a 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 _0xc965=['Local/_attended@transfer','Queue:','info','format','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','interface','membername','type','getUserByInterface','then','name','internal','CreateMemberReport','getUserByName','split','catch','error','some','devicestatechange','BUSY','device','voice','TALKING','now','agent','isNil','exitAt','diffTime','enterAt','agentcomplete','assign','queue','channel','data1','data2','destination','destinationchannel','data3','util','./utils'];(function(_0x523377,_0x30a2e7){var _0x140d31=function(_0x405abc){while(--_0x405abc){_0x523377['push'](_0x523377['shift']());}};_0x140d31(++_0x30a2e7);}(_0xc965,0x146));var _0x5c96=function(_0x2fbcd3,_0xbb2e27){_0x2fbcd3=_0x2fbcd3-0x0;var _0x201573=_0xc965[_0x2fbcd3];return _0x201573;};'use strict';var _=require('lodash');var util=require(_0x5c96('0x0'));var utils=require(_0x5c96('0x1'));var members={};var exclude=[_0x5c96('0x2'),_0x5c96('0x3')];function writeDB(_0x123b74){utils[_0x5c96('0x4')](util[_0x5c96('0x5')](_0x5c96('0x6'),_0x123b74[_0x5c96('0x7')],_0x123b74[_0x5c96('0x8')],_0x123b74['channel'],_0x123b74['data2'],_0x123b74[_0x5c96('0x9')],_0x123b74[_0x5c96('0xa')]));if(_0x123b74[_0x5c96('0x8')]){utils[_0x5c96('0xb')](_0x123b74['interface'])[_0x5c96('0xc')](function(_0x55f5fd){if(_0x55f5fd){_0x123b74['membername']=_0x55f5fd[_0x5c96('0xd')];_0x123b74[_0x5c96('0xe')]=_0x55f5fd['internal'];utils['request'](_0x5c96('0xf'),_0x123b74);}else{utils[_0x5c96('0x10')](_0x123b74[_0x5c96('0x8')][_0x5c96('0x11')]('/')[0x1])[_0x5c96('0xc')](function(_0x4ae6a3){if(_0x4ae6a3){_0x123b74[_0x5c96('0x9')]=_0x4ae6a3['name'];_0x123b74['internal']=_0x4ae6a3[_0x5c96('0xe')];utils['request']('CreateMemberReport',_0x123b74);}});}})[_0x5c96('0x12')](function(_0xc13e37){utils[_0x5c96('0x13')](_0xc13e37);});}delete members[_0x123b74['interface']];}function startsWith(_0x1edfd3,_0xbde41f){return _[_0x5c96('0x14')](_0x1edfd3,function(_0x4307a1){return _['startsWith'](_0xbde41f,_0x4307a1);});}exports[_0x5c96('0x15')]=function(_0x5bb929){switch(_0x5bb929['state']){case'INUSE':case _0x5c96('0x16'):if(!startsWith(exclude,_0x5bb929['device'])){members[_0x5bb929[_0x5c96('0x17')]]={'channel':_0x5c96('0x18'),'interface':_0x5bb929[_0x5c96('0x17')],'type':_0x5c96('0x19'),'enterAt':utils[_0x5c96('0x1a')](),'role':_0x5c96('0x1b')};}break;case'NOT_INUSE':if(!_[_0x5c96('0x1c')](members[_0x5bb929['device']])){members[_0x5bb929[_0x5c96('0x17')]][_0x5c96('0x1d')]=utils['now']();members[_0x5bb929[_0x5c96('0x17')]]['duration']=utils[_0x5c96('0x1e')](members[_0x5bb929[_0x5c96('0x17')]][_0x5c96('0x1d')],members[_0x5bb929[_0x5c96('0x17')]][_0x5c96('0x1f')]);if(members[_0x5bb929[_0x5c96('0x17')]]['uniqueid']){writeDB(members[_0x5bb929[_0x5c96('0x17')]]);}}default:break;}};exports[_0x5c96('0x20')]=function(_0x122d76){if(!_[_0x5c96('0x1c')](members[_0x122d76[_0x5c96('0x8')]])){members[_0x122d76['interface']]=_[_0x5c96('0x21')](members[_0x122d76[_0x5c96('0x8')]],{'data4':_0x122d76[_0x5c96('0x22')],'uniqueid':_0x122d76[_0x5c96('0x7')]});}};exports['cdr']=function(_0x29f66a){if(_0x29f66a[_0x5c96('0x23')]){var _0xf8b108=_0x29f66a[_0x5c96('0x23')][_0x5c96('0x11')]('-')[0x0];if(!_[_0x5c96('0x1c')](members[_0xf8b108])){members[_0xf8b108]=_[_0x5c96('0x21')](members[_0xf8b108],{'data1':members[_0xf8b108][_0x5c96('0x24')]||_0x29f66a[_0x5c96('0xa')],'data2':members[_0xf8b108][_0x5c96('0x25')]||_0x29f66a['source'],'data3':members[_0xf8b108]['data3']||_0x29f66a[_0x5c96('0x26')],'uniqueid':members[_0xf8b108][_0x5c96('0x7')]||_0x29f66a[_0x5c96('0x7')]});if(members[_0xf8b108][_0x5c96('0x1d')]){writeDB(members[_0xf8b108]);}}}if(_0x29f66a['destinationchannel']){var _0x1169fc=_0x29f66a[_0x5c96('0x27')][_0x5c96('0x11')]('-')[0x0];if(!_[_0x5c96('0x1c')](members[_0x1169fc])){members[_0x1169fc]=_[_0x5c96('0x21')](members[_0x1169fc],{'data1':members[_0x1169fc][_0x5c96('0x24')]||_0x29f66a[_0x5c96('0xa')],'data2':members[_0x1169fc][_0x5c96('0x25')]||_0x29f66a['source'],'data3':members[_0x1169fc][_0x5c96('0x28')]||_0x29f66a[_0x5c96('0x26')],'uniqueid':members[_0x1169fc][_0x5c96('0x7')]||_0x29f66a[_0x5c96('0x7')]});if(members[_0x1169fc][_0x5c96('0x1d')]){writeDB(members[_0x1169fc]);}}}}; \ No newline at end of file +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 diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 0e1dea7..0606d84 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 _0x509e=['membername','agentcomplete','queuecallercompleteAt','reason','transfer','COMPLETEDBY','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','attendedtransfer','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','secondtransfererexten','secondtransfereruniqueid','transfertargetlinkedid','error','stack','musiconholdstartAt','musiconholdstop','mohtime','lodash','util','./utils','format','channel','queue','lastAssignedTo','calleridnum','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','assign','position','hangup','queuecallerabandon','queuecallerexit','queuecallercomplete','now','queuecallerenterreason','isNil','variable','queuestatus','toUpperCase','CONTINUE','queuecallerexitAt','value','queuecallerabandonAt','EXITWITHKEY','ABANDONED','queuecallerleave','holdtime','diffTime','queuecallerleaveAt','queuecallerjoinAt','count','connectedlinenum','connectedlinename','agentconnect','accountcode','destaccountcode'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x509e,0x1a0));var _0xe509=function(_0x3cfcfd,_0x1d9810){_0x3cfcfd=_0x3cfcfd-0x0;var _0x51c18e=_0x509e[_0x3cfcfd];return _0x51c18e;};'use strict';var _=require(_0xe509('0x0'));var util=require(_0xe509('0x1'));var utils=require(_0xe509('0x2'));var queues={};function writeDB(_0xe71c88){utils['info'](util[_0xe509('0x3')]('QUEUE|%s|%s|%s|%s|%s|%s|%s',_0xe71c88['uniqueid'],_0xe71c88[_0xe509('0x4')],_0xe71c88[_0xe509('0x5')],_0xe71c88[_0xe509('0x6')],_0xe71c88[_0xe509('0x7')],_0xe71c88['accountcode'],_0xe71c88[_0xe509('0x8')]));if(_0xe71c88[_0xe509('0x5')]){utils[_0xe509('0x9')](_0xe71c88[_0xe509('0x5')])[_0xe509('0xa')](function(_0x567032){if(_0x567032){_0xe71c88[_0xe509('0xb')]=_0x567032['type'];}utils[_0xe509('0xc')](_0xe509('0xd'),_0xe71c88);});}else{utils[_0xe509('0xc')](_0xe509('0xd'),_0xe71c88);}if(_0xe71c88[_0xe509('0xe')]){delete queues[_0xe71c88[_0xe509('0xe')]];}else{delete queues[_0xe71c88[_0xe509('0xf')]];}}exports[_0xe509('0x10')]=function(_0x33b411){queues[_0x33b411[_0xe509('0xf')]]=_[_0xe509('0x11')](_0x33b411,{'originalposition':_0x33b411[_0xe509('0x12')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});};exports[_0xe509('0x13')]=function(_0x3aa60c){if(!_['isNil'](queues[_0x3aa60c[_0xe509('0xf')]])){if(queues[_0x3aa60c['uniqueid']]['queuecallerleaveAt']){if(!queues[_0x3aa60c[_0xe509('0xf')]][_0xe509('0x14')]&&!queues[_0x3aa60c[_0xe509('0xf')]][_0xe509('0x15')]){queues[_0x3aa60c[_0xe509('0xf')]][_0xe509('0x16')]=!![];queues[_0x3aa60c['uniqueid']]['queuecallercompleteAt']=utils[_0xe509('0x17')]();queues[_0x3aa60c[_0xe509('0xf')]][_0xe509('0x8')]='COMPLETEDBYAGENT';}writeDB(queues[_0x3aa60c[_0xe509('0xf')]]);}else{if(queues[_0x3aa60c[_0xe509('0xf')]][_0xe509('0xe')]){queues[queues[_0x3aa60c[_0xe509('0xf')]][_0xe509('0xe')]]=queues[_0x3aa60c[_0xe509('0xf')]];queues[queues[_0x3aa60c[_0xe509('0xf')]][_0xe509('0xe')]][_0xe509('0x18')]=0x2;delete queues[_0x3aa60c[_0xe509('0xf')]];}}}};exports['varset']=function(_0x58ab26){if(!_[_0xe509('0x19')](_0x58ab26[_0xe509('0x1a')][_0xe509('0x1b')])&&_0x58ab26['value'][_0xe509('0x1c')]()!==_0xe509('0x1d')){if(!_[_0xe509('0x19')](queues[_0x58ab26[_0xe509('0xf')]])){queues[_0x58ab26[_0xe509('0xf')]][_0xe509('0x14')]=![];queues[_0x58ab26[_0xe509('0xf')]]['queuecallerabandonAt']=null;queues[_0x58ab26['uniqueid']][_0xe509('0x15')]=!![];queues[_0x58ab26[_0xe509('0xf')]][_0xe509('0x1e')]=utils[_0xe509('0x17')]();queues[_0x58ab26[_0xe509('0xf')]][_0xe509('0x8')]=_0x58ab26[_0xe509('0x1f')]['toUpperCase']();writeDB(queues[_0x58ab26[_0xe509('0xf')]]);}}else if(!_[_0xe509('0x19')](_0x58ab26[_0xe509('0x1a')]['queueposition'])){if(!_['isNil'](queues[_0x58ab26[_0xe509('0xf')]])&&!queues[_0x58ab26['uniqueid']][_0xe509('0x14')]){queues[_0x58ab26[_0xe509('0xf')]]['queuecallerabandon']=![];queues[_0x58ab26['uniqueid']][_0xe509('0x20')]=null;queues[_0x58ab26[_0xe509('0xf')]][_0xe509('0x15')]=!![];queues[_0x58ab26[_0xe509('0xf')]]['queuecallerexitAt']=utils[_0xe509('0x17')]();queues[_0x58ab26[_0xe509('0xf')]][_0xe509('0x8')]=_0xe509('0x21');}}};exports[_0xe509('0x14')]=function(_0x1afd6f){if(!_[_0xe509('0x19')](queues[_0x1afd6f[_0xe509('0xf')]])){queues[_0x1afd6f[_0xe509('0xf')]]['queuecallerexit']=![];queues[_0x1afd6f[_0xe509('0xf')]][_0xe509('0x1e')]=null;queues[_0x1afd6f[_0xe509('0xf')]]['queuecallerabandon']=!![];queues[_0x1afd6f['uniqueid']][_0xe509('0x20')]=utils[_0xe509('0x17')]();queues[_0x1afd6f[_0xe509('0xf')]][_0xe509('0x8')]=_0xe509('0x22');}};exports[_0xe509('0x23')]=function(_0x34783f){if(!_[_0xe509('0x19')](queues[_0x34783f[_0xe509('0xf')]])){queues[_0x34783f[_0xe509('0xf')]]['queuecallerleave']=!![];queues[_0x34783f[_0xe509('0xf')]]['queuecallerleaveAt']=utils[_0xe509('0x17')]();queues[_0x34783f[_0xe509('0xf')]][_0xe509('0x24')]=utils[_0xe509('0x25')](queues[_0x34783f[_0xe509('0xf')]][_0xe509('0x26')],queues[_0x34783f[_0xe509('0xf')]][_0xe509('0x27')]);queues[_0x34783f[_0xe509('0xf')]][_0xe509('0x12')]=_0x34783f[_0xe509('0x12')];queues[_0x34783f['uniqueid']][_0xe509('0x28')]=_0x34783f[_0xe509('0x28')];queues[_0x34783f[_0xe509('0xf')]]['connectedlinenum']=_0x34783f[_0xe509('0x29')];queues[_0x34783f[_0xe509('0xf')]][_0xe509('0x2a')]=_0x34783f[_0xe509('0x2a')];}};exports[_0xe509('0x2b')]=function(_0x18c887){if(!_[_0xe509('0x19')](queues[_0x18c887[_0xe509('0xf')]])){queues[_0x18c887['uniqueid']]['queuecallerabandon']=![];queues[_0x18c887[_0xe509('0xf')]][_0xe509('0x14')]=![];queues[_0x18c887['uniqueid']]['queuecallerabandonAt']=null;queues[_0x18c887[_0xe509('0xf')]][_0xe509('0x15')]=![];queues[_0x18c887[_0xe509('0xf')]][_0xe509('0x8')]=null;queues[_0x18c887[_0xe509('0xf')]][_0xe509('0x1e')]=null;queues[_0x18c887[_0xe509('0xf')]]['assigned']=!![];queues[_0x18c887[_0xe509('0xf')]][_0xe509('0x2c')]=_0x18c887[_0xe509('0x2d')];queues[_0x18c887[_0xe509('0xf')]][_0xe509('0x6')]=_0x18c887[_0xe509('0x2e')];}};exports[_0xe509('0x2f')]=function(_0x4fd7d6){if(!_[_0xe509('0x19')](queues[_0x4fd7d6[_0xe509('0xf')]])){if(queues[_0x4fd7d6[_0xe509('0xf')]][_0xe509('0x26')]){queues[_0x4fd7d6[_0xe509('0xf')]][_0xe509('0x14')]=![];queues[_0x4fd7d6[_0xe509('0xf')]][_0xe509('0x14')]=![];queues[_0x4fd7d6[_0xe509('0xf')]][_0xe509('0x20')]=null;queues[_0x4fd7d6[_0xe509('0xf')]][_0xe509('0x15')]=![];queues[_0x4fd7d6['uniqueid']][_0xe509('0x1e')]=null;queues[_0x4fd7d6['uniqueid']]['assigned']=!![];queues[_0x4fd7d6[_0xe509('0xf')]][_0xe509('0x6')]=_0x4fd7d6[_0xe509('0x2e')];queues[_0x4fd7d6[_0xe509('0xf')]][_0xe509('0x16')]=!![];queues[_0x4fd7d6[_0xe509('0xf')]][_0xe509('0x30')]=utils['now']();if(_0x4fd7d6[_0xe509('0x31')]==_0xe509('0x32')){if(!queues[_0x4fd7d6[_0xe509('0xf')]]['transfer']){queues[_0x4fd7d6[_0xe509('0xf')]]['queuecallerexitreason']='TRANSFER';}}else{queues[_0x4fd7d6['uniqueid']][_0xe509('0x8')]=_0xe509('0x33')+_0x4fd7d6[_0xe509('0x31')][_0xe509('0x1c')]();}writeDB(queues[_0x4fd7d6[_0xe509('0xf')]]);}}};exports[_0xe509('0x34')]=function(_0x24a4fc){if(!_[_0xe509('0x19')](queues[_0x24a4fc[_0xe509('0x35')]])){queues[_0x24a4fc['transfereeuniqueid']][_0xe509('0x32')]=!![];queues[_0x24a4fc[_0xe509('0x35')]][_0xe509('0x36')]=_0xe509('0x37');queues[_0x24a4fc[_0xe509('0x35')]][_0xe509('0x38')]=_0x24a4fc[_0xe509('0x39')];queues[_0x24a4fc[_0xe509('0x35')]][_0xe509('0x3a')]=_0x24a4fc[_0xe509('0x35')];queues[_0x24a4fc[_0xe509('0x35')]][_0xe509('0x8')]='BLINDTRANSFER';}};exports[_0xe509('0x3b')]=function(_0x4996d6){try{if(_0x4996d6['origtransfereruniqueid']==_0x4996d6[_0xe509('0x3c')]){if(!_[_0xe509('0x19')](queues[_0x4996d6['secondtransfererlinkedid']])){queues[_0x4996d6[_0xe509('0x3d')]][_0xe509('0x32')]=!![];queues[_0x4996d6[_0xe509('0x3d')]][_0xe509('0x36')]=_0xe509('0x3e');queues[_0x4996d6[_0xe509('0x3d')]]['transferexten']=_0x4996d6[_0xe509('0x3f')];queues[_0x4996d6[_0xe509('0x3d')]]['transferuniqueid']=_0x4996d6['origtransfereruniqueid'];queues[_0x4996d6[_0xe509('0x3d')]]['queuecallerexitreason']=_0xe509('0x40');}if(!_[_0xe509('0x19')](queues[_0x4996d6[_0xe509('0x3c')]])){if(_0x4996d6['transfereelinkedid']&&queues[_0x4996d6[_0xe509('0x41')]]){queues[_0x4996d6[_0xe509('0x41')]]['queuecallerenterreason']=0x1;queues[_0x4996d6[_0xe509('0x35')]]=_[_0xe509('0x42')](queues[_0x4996d6[_0xe509('0x41')]]);queues[_0x4996d6['transfereeuniqueid']]['transfereduniqueid']=_0x4996d6[_0xe509('0x43')];queues[_0x4996d6[_0xe509('0x35')]][_0xe509('0x18')]=0x2;queues[_0x4996d6['transfereeuniqueid']]['calleridnum']=queues[_0x4996d6[_0xe509('0x3d')]][_0xe509('0x7')];queues[_0x4996d6[_0xe509('0x35')]][_0xe509('0x44')]=queues[_0x4996d6[_0xe509('0x3d')]]['calleridname'];queues[_0x4996d6[_0xe509('0x35')]]['queuecallerjoinAt']=utils[_0xe509('0x17')]();queues[_0x4996d6[_0xe509('0x35')]]['queuecallerleaveAt']=utils['now']();queues[_0x4996d6[_0xe509('0x35')]][_0xe509('0x24')]=0x0;queues[_0x4996d6['transfereeuniqueid']]['mohtime']=0x0;}else{queues[_0x4996d6[_0xe509('0x3c')]][_0xe509('0xe')]=_0x4996d6[_0xe509('0x3d')];}}}else if(_0x4996d6['secondtransfereruniqueid']==_0x4996d6[_0xe509('0x3d')]){if(!_[_0xe509('0x19')](queues[_0x4996d6[_0xe509('0x3c')]])){queues[_0x4996d6[_0xe509('0x3c')]][_0xe509('0x32')]=!![];queues[_0x4996d6[_0xe509('0x3c')]][_0xe509('0x36')]='ATTENDED';queues[_0x4996d6['origtransfererlinkedid']][_0xe509('0x38')]=_0x4996d6[_0xe509('0x45')];queues[_0x4996d6[_0xe509('0x3c')]]['transferuniqueid']=_0x4996d6[_0xe509('0x46')];queues[_0x4996d6[_0xe509('0x3c')]][_0xe509('0x8')]=_0xe509('0x40');}if(!_[_0xe509('0x19')](queues[_0x4996d6[_0xe509('0x3d')]])){if(_0x4996d6[_0xe509('0x47')]&&queues[_0x4996d6[_0xe509('0x47')]]){queues[_0x4996d6[_0xe509('0x47')]][_0xe509('0x18')]=0x1;queues[_0x4996d6['transfertargetuniqueid']]=_[_0xe509('0x42')](queues[_0x4996d6[_0xe509('0x47')]]);queues[_0x4996d6[_0xe509('0x43')]][_0xe509('0xe')]=_0x4996d6[_0xe509('0x43')];queues[_0x4996d6[_0xe509('0x43')]][_0xe509('0x18')]=0x2;queues[_0x4996d6[_0xe509('0x43')]][_0xe509('0x7')]=queues[_0x4996d6[_0xe509('0x3c')]][_0xe509('0x7')];queues[_0x4996d6[_0xe509('0x43')]][_0xe509('0x44')]=queues[_0x4996d6[_0xe509('0x3c')]][_0xe509('0x44')];queues[_0x4996d6['transfertargetuniqueid']][_0xe509('0x27')]=utils[_0xe509('0x17')]();queues[_0x4996d6[_0xe509('0x43')]]['queuecallerleaveAt']=utils[_0xe509('0x17')]();queues[_0x4996d6['transfertargetuniqueid']]['holdtime']=0x0;queues[_0x4996d6[_0xe509('0x43')]]['mohtime']=0x0;}else{queues[_0x4996d6['secondtransfererlinkedid']]['transfereduniqueid']=_0x4996d6[_0xe509('0x3c')];}}}}catch(_0x24ab3a){utils[_0xe509('0x48')](_0x24ab3a[_0xe509('0x49')]);}};exports['musiconholdstart']=function(_0x20fd0a){if(!_[_0xe509('0x19')](queues[_0x20fd0a[_0xe509('0xf')]])){queues[_0x20fd0a[_0xe509('0xf')]][_0xe509('0x4a')]=utils[_0xe509('0x17')]();}};exports[_0xe509('0x4b')]=function(_0x4f35a6){if(!_[_0xe509('0x19')](queues[_0x4f35a6['uniqueid']])){if(!_[_0xe509('0x19')](queues[_0x4f35a6[_0xe509('0xf')]][_0xe509('0x4a')])){queues[_0x4f35a6[_0xe509('0xf')]][_0xe509('0x4c')]+=utils[_0xe509('0x25')](utils[_0xe509('0x17')](),queues[_0x4f35a6[_0xe509('0xf')]][_0xe509('0x4a')]);delete queues[_0x4f35a6[_0xe509('0xf')]][_0xe509('0x4a')];}}}; \ No newline at end of file +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 diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index c9e37a3..b7528b9 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 _0xedd9=['UserId','request','CreateVoiceRecording','uniqueid','linkedid','context','channel','error','stack','isNil','channelstate','varset','variable','endsWith','value','.wav49','.WAV','find','monitors','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten','application','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','./utils','debug','accountcode','getUserByInternal','then','name'];(function(_0x58b2c2,_0x2a152c){var _0x4049cd=function(_0x446b38){while(--_0x446b38){_0x58b2c2['push'](_0x58b2c2['shift']());}};_0x4049cd(++_0x2a152c);}(_0xedd9,0xfc));var _0x9edd=function(_0x1e6516,_0x204efd){_0x1e6516=_0x1e6516-0x0;var _0x4036f8=_0xedd9[_0x1e6516];return _0x4036f8;};'use strict';var _=require('lodash');var utils=require(_0x9edd('0x0'));var recordings={};function writeDB(_0x2d7989){utils[_0x9edd('0x1')](_0x2d7989);if(_0x2d7989[_0x9edd('0x2')]){utils[_0x9edd('0x3')](_0x2d7989[_0x9edd('0x2')])[_0x9edd('0x4')](function(_0x36b53f){if(_0x36b53f){_0x2d7989['membername']=_0x36b53f[_0x9edd('0x5')];_0x2d7989[_0x9edd('0x6')]=_0x36b53f['id'];}utils[_0x9edd('0x7')](_0x9edd('0x8'),_0x2d7989);});}else{utils['request'](_0x9edd('0x8'),_0x2d7989);}}exports['newchannel']=function(_0x172522){try{if(_0x172522[_0x9edd('0x9')]==_0x172522[_0x9edd('0xa')]){recordings[_0x172522[_0x9edd('0x9')]]={'uniqueid':_0x172522['uniqueid'],'accountcode':_0x172522[_0x9edd('0x2')],'exten':_0x172522['exten'],'context':_0x172522[_0x9edd('0xb')],'channel':_0x172522[_0x9edd('0xc')],'monitors':[]};}}catch(_0x523026){utils[_0x9edd('0xd')](_0x523026[_0x9edd('0xe')]);}};exports['newstate']=function(_0x30c0d7){try{if(!_[_0x9edd('0xf')](recordings[_0x30c0d7[_0x9edd('0x9')]])&&_0x30c0d7[_0x9edd('0x10')]==0x6){}else if(!_[_0x9edd('0xf')](recordings[_0x30c0d7[_0x9edd('0xa')]])&&_0x30c0d7[_0x9edd('0x10')]==0x6&&_0x30c0d7[_0x9edd('0xb')]!='transfer'){recordings[_0x30c0d7[_0x9edd('0xa')]][_0x9edd('0x2')]=_0x30c0d7[_0x9edd('0x2')];}}catch(_0x4d9a7){utils[_0x9edd('0xd')](_0x4d9a7[_0x9edd('0xe')]);}};exports[_0x9edd('0x11')]=function(_0x75a4ab){try{if(!_['isNil'](_0x75a4ab[_0x9edd('0x12')])&&!_[_0x9edd('0xf')](_0x75a4ab[_0x9edd('0x12')]['mixmonitor_filename'])){if(_[_0x9edd('0x13')](_0x75a4ab[_0x9edd('0x14')],_0x9edd('0x15'))){_0x75a4ab['value']=_0x75a4ab[_0x9edd('0x14')]['replace'](_0x9edd('0x15'),_0x9edd('0x16'));}if(recordings[_0x75a4ab['linkedid']]){var _0x498977=_[_0x9edd('0x17')](recordings[_0x75a4ab['linkedid']][_0x9edd('0x18')],{'value':_0x75a4ab['value']});if(_['isNil'](_0x498977)){recordings[_0x75a4ab[_0x9edd('0xa')]][_0x9edd('0x18')]['push']({'value':_0x75a4ab['value']});}}}}catch(_0x341d67){utils[_0x9edd('0xd')](_0x341d67[_0x9edd('0xe')]);}};exports['hangup']=function(_0x3741c8){try{if(!_[_0x9edd('0xf')](recordings[_0x3741c8[_0x9edd('0x9')]])){recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x19')]=_0x3741c8['calleridnum'];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1a')]=_0x3741c8[_0x9edd('0x1a')];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1b')]=_0x3741c8['connectedlinenum'];recordings[_0x3741c8['uniqueid']][_0x9edd('0x1c')]=_0x3741c8[_0x9edd('0x1c')];if(recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1d')]==_0x9edd('0x1e')&&recordings[_0x3741c8['uniqueid']]['accountcode']){recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1b')]=recordings[_0x3741c8[_0x9edd('0x9')]]['accountcode'];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1c')]='';}recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x18')]['forEach'](_0x2155a1=>{var _0x3fb556=_[_0x9edd('0x1f')](recordings[_0x3741c8[_0x9edd('0x9')]]);_0x3fb556[_0x9edd('0x14')]=_0x2155a1[_0x9edd('0x14')];writeDB(_0x3fb556);});delete recordings[_0x3741c8[_0x9edd('0x9')]];}}catch(_0x1fba7b){utils[_0x9edd('0xd')](_0x1fba7b[_0x9edd('0xe')]);}};exports[_0x9edd('0x20')]=function(_0x138002){try{if(!_[_0x9edd('0xf')](recordings[_0x138002[_0x9edd('0x9')]])){if(_0x138002[_0x9edd('0x21')]['toLowerCase']()==_0x9edd('0x22')&&_[_0x9edd('0x23')](_0x138002[_0x9edd('0x24')]['toLowerCase'](),_0x9edd('0x25'))){var _0x3990fb=_0x138002[_0x9edd('0x24')][_0x9edd('0x26')]('=');var _0x21bc30=_0x3990fb[0x0][_0x9edd('0x27')](_0x3990fb[0x0][_0x9edd('0x28')]('(')+0x1,_0x3990fb[0x0][_0x9edd('0x28')](')'));var _0xd0fd74=_0x3990fb[0x1];recordings[_0x138002[_0x9edd('0x9')]][_0x21bc30]=_0xd0fd74;}}}catch(_0x29e789){utils[_0x9edd('0xd')](_0x29e789[_0x9edd('0xe')]);}};exports[_0x9edd('0x29')]=function(_0x5757fc){try{if(!_[_0x9edd('0xf')](recordings[_0x5757fc['uniqueid']])){recordings[_0x5757fc[_0x9edd('0x9')]][_0x9edd('0x2a')]=_0x5757fc[_0x9edd('0x2a')];}}catch(_0x434d26){utils[_0x9edd('0xd')](_0x434d26['stack']);}}; \ No newline at end of file +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 diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 13e8599..fc96298 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 _0xbc82=['transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','info','type','blindtransfer','blind','stack','attendedtransfer','assign','origtransfererchannel','origtransferercalleridname','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','transfertargetcalleridnum','transfertargetcalleridname'];(function(_0x42fc3e,_0xdc5885){var _0x52e1fa=function(_0x9e9274){while(--_0x9e9274){_0x42fc3e['push'](_0x42fc3e['shift']());}};_0x52e1fa(++_0xdc5885);}(_0xbc82,0x13e));var _0x2bc8=function(_0x1cee4e,_0x2c30bb){_0x1cee4e=_0x1cee4e-0x0;var _0x22fdda=_0xbc82[_0x1cee4e];return _0x22fdda;};'use strict';var _=require(_0x2bc8('0x0'));var util=require('util');var utils=require('./utils');function writeDB(_0x548271){utils[_0x2bc8('0x1')](util['format']('TRANSFER|%s',_0x548271[_0x2bc8('0x2')]));utils['request']('CreateVoiceTransferReport',_0x548271);}exports[_0x2bc8('0x3')]=function(_0x5caa65){try{_0x5caa65['type']=_0x2bc8('0x4');writeDB(_0x5caa65);}catch(_0x52fde0){utils['error'](_0x52fde0[_0x2bc8('0x5')]);}};exports[_0x2bc8('0x6')]=function(_0x10ea46){try{_0x10ea46=_[_0x2bc8('0x7')](_0x10ea46,{'transfererchannel':_0x10ea46[_0x2bc8('0x8')],'transferercalleridnum':_0x10ea46['origtransferercalleridnum'],'transferercalleridname':_0x10ea46[_0x2bc8('0x9')],'transfererconnectedlinenum':_0x10ea46['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x10ea46['secondtransfererconnectedlinename'],'transfereraccountcode':_0x10ea46['origtransfereraccountcode'],'transferercontext':_0x10ea46[_0x2bc8('0xa')],'transfererexten':_0x10ea46[_0x2bc8('0xb')],'transfererlinkedid':_0x10ea46[_0x2bc8('0xc')],'context':_0x10ea46[_0x2bc8('0xd')],'extension':_0x10ea46[_0x2bc8('0xe')],'type':_0x2bc8('0xf')});if(_[_0x2bc8('0x10')](_0x10ea46[_0x2bc8('0x11')])){_0x10ea46=_[_0x2bc8('0x7')](_0x10ea46,{'transfereechannel':_0x10ea46['transfertargetchannel'],'transfereecalleridnum':_0x10ea46[_0x2bc8('0x12')],'transfereecalleridname':_0x10ea46[_0x2bc8('0x13')],'transfereeconnectedlinenum':_0x10ea46[_0x2bc8('0x14')],'transfereeconnectedlinename':_0x10ea46[_0x2bc8('0x15')],'transfereeaccountcode':_0x10ea46[_0x2bc8('0x16')],'transfereecontext':_0x10ea46[_0x2bc8('0x17')],'transfereeexten':_0x10ea46[_0x2bc8('0x18')],'transfereelinkedid':_0x10ea46[_0x2bc8('0x19')]});}writeDB(_0x10ea46);}catch(_0x3647f5){utils['error'](_0x3647f5[_0x2bc8('0x5')]);}}; \ No newline at end of file +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 diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index eeb2456..4b94dd6 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 _0x1b14=['../../config/logger','info','debug','error','request','then','stringify','stack','GetUser','internal','name','interface','result','length','FOUND','NOTFOUND','getUserByInternal','getUserByInterface','catch','getVoiceQueueByName','GetVoiceQueue','type','acw','GETVOICEQUEUEBYNAME|','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','now','isAfter','isBefore','jayson/promise','moment','bluebird','http'];(function(_0x40b9d0,_0x3d61cd){var _0x405d18=function(_0x4dd360){while(--_0x4dd360){_0x40b9d0['push'](_0x40b9d0['shift']());}};_0x405d18(++_0x3d61cd);}(_0x1b14,0x196));var _0x41b1=function(_0x6fb866,_0x23bcf4){_0x6fb866=_0x6fb866-0x0;var _0x22bca6=_0x1b14[_0x6fb866];return _0x22bca6;};'use strict';var jayson=require(_0x41b1('0x0'));var moment=require(_0x41b1('0x1'));var BPromise=require(_0x41b1('0x2'));var client=jayson['client'][_0x41b1('0x3')]({'port':0x2329});var logger=require(_0x41b1('0x4'))('xdr');exports['info']=function(_0x882dd2){logger[_0x41b1('0x5')](_0x882dd2);};exports[_0x41b1('0x6')]=function(_0x2f9742){logger[_0x41b1('0x6')](JSON['stringify'](_0x2f9742));};exports[_0x41b1('0x7')]=function(_0x1b3d7a){logger[_0x41b1('0x7')](_0x1b3d7a['stack']);};exports['request']=function(_0x45d58f,_0x224608){return client[_0x41b1('0x8')](_0x45d58f,{'body':_0x224608})[_0x41b1('0x9')](function(_0x5b0b52){logger[_0x41b1('0x6')](JSON[_0x41b1('0xa')](_0x5b0b52));})['catch'](function(_0x3c8305){logger[_0x41b1('0x7')](_0x3c8305[_0x41b1('0xb')]);});};function getUser(_0x127d86){return client[_0x41b1('0x8')](_0x41b1('0xc'),{'options':{'raw':!![],'attributes':['id',_0x41b1('0xd'),_0x41b1('0xe'),_0x41b1('0xf')],'where':_0x127d86,'limit':0x1}})['then'](function(_0x2d0e7b){logger[_0x41b1('0x5')]('GETUSER|'+JSON[_0x41b1('0xa')](_0x127d86)+'|'+(_0x2d0e7b[_0x41b1('0x10')][_0x41b1('0x11')]?_0x41b1('0x12'):_0x41b1('0x13')));return _0x2d0e7b[_0x41b1('0x10')][_0x41b1('0x11')]?_0x2d0e7b[_0x41b1('0x10')][0x0]:null;});}exports[_0x41b1('0x14')]=function(_0x4c7b56){return new BPromise(function(_0x2ca9a4,_0xd6898a){if(_0x4c7b56){return getUser({'internal':_0x4c7b56})['then'](function(_0x423e8d){return _0x2ca9a4(_0x423e8d);})['catch'](function(_0x452097){logger['error'](_0x452097[_0x41b1('0xb')]);return _0x2ca9a4(null);});}else{return _0x2ca9a4(null);}});};exports[_0x41b1('0x15')]=function(_0x1cc4fc){return new BPromise(function(_0x2aa520,_0x260f88){if(_0x1cc4fc){return getUser({'interface':_0x1cc4fc})[_0x41b1('0x9')](function(_0x2df3fd){return _0x2aa520(_0x2df3fd);})[_0x41b1('0x16')](function(_0x4abcb4){logger[_0x41b1('0x7')](_0x4abcb4[_0x41b1('0xb')]);return _0x2aa520(null);});}else{return _0x2aa520(null);}});};exports['getUserByName']=function(_0x53226d){return new BPromise(function(_0x5de1e0,_0x2169cc){if(_0x53226d){return getUser({'name':_0x53226d})[_0x41b1('0x9')](function(_0x33493f){return _0x5de1e0(_0x33493f);})[_0x41b1('0x16')](function(_0x1877ca){logger[_0x41b1('0x7')](_0x1877ca[_0x41b1('0xb')]);return _0x5de1e0(null);});}else{return _0x5de1e0(null);}});};exports[_0x41b1('0x17')]=function(_0x2501ad){return new BPromise(function(_0x58cea7,_0x1934fc){if(_0x2501ad){return client[_0x41b1('0x8')](_0x41b1('0x18'),{'options':{'raw':!![],'attributes':['id',_0x41b1('0xe'),_0x41b1('0x19'),_0x41b1('0x1a'),'acwTimeout'],'where':{'name':_0x2501ad},'limit':0x1}})[_0x41b1('0x9')](function(_0x5cdac6){logger[_0x41b1('0x5')](_0x41b1('0x1b')+_0x2501ad+'|'+(_0x5cdac6[_0x41b1('0x10')]['length']?_0x41b1('0x12'):_0x41b1('0x13')));return _0x58cea7(_0x5cdac6[_0x41b1('0x10')][_0x41b1('0x11')]?_0x5cdac6[_0x41b1('0x10')][0x0]:null);})[_0x41b1('0x16')](function(_0x49a929){logger[_0x41b1('0x7')](_0x49a929[_0x41b1('0xb')]);return _0x58cea7(null);});}else{return _0x58cea7(null);}});};exports[_0x41b1('0x1c')]=function(_0x1031f8,_0x59baf7){return moment(_0x1031f8)[_0x41b1('0x1d')](_0x59baf7,_0x41b1('0x1e'))[_0x41b1('0x1f')](_0x41b1('0x20'));};exports[_0x41b1('0x21')]=function(_0x404a95,_0x158611){return moment(_0x404a95)[_0x41b1('0x22')](_0x158611,_0x41b1('0x1e'))[_0x41b1('0x1f')](_0x41b1('0x20'));};exports[_0x41b1('0x23')]=function(_0x47cd2a,_0x5996df){return moment(_0x47cd2a)[_0x41b1('0x24')](moment(_0x5996df),_0x41b1('0x1e'));};exports[_0x41b1('0x25')]=function(_0x49800e,_0x2b079a){return parseInt(_0x49800e,0xa)+parseInt(_0x2b079a,0xa);};exports[_0x41b1('0x26')]=function(){return moment()['format'](_0x41b1('0x20'));};exports[_0x41b1('0x27')]=function(_0x45de35,_0x2a4987){if(_0x2a4987){return moment(_0x45de35)[_0x41b1('0x27')](_0x2a4987);}else{return!![];}};exports[_0x41b1('0x28')]=function(_0x1bce53,_0x41d636){if(_0x41d636){return moment(_0x1bce53)[_0x41b1('0x28')](_0x41d636);}else if(_0x1bce53){return!![];}else{return![];}}; \ No newline at end of file +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